/** * Set the index source for the encoder. When this source is activated, the encoder count automatically resets. * * @param channel A DIO channel to set as the encoder index * @param type The state that will cause the encoder to reset */ void Encoder::SetIndexSource(uint32_t channel, Encoder::IndexingType type) { int32_t status = 0; bool activeHigh = (type == kResetWhileHigh) || (type == kResetOnRisingEdge); bool edgeSensitive = (type == kResetOnFallingEdge) || (type == kResetOnRisingEdge); setEncoderIndexSource(m_encoder, channel, false, activeHigh, edgeSensitive, &status); wpi_setGlobalErrorWithContext(status, getHALErrorMessage(status)); }
/** * Set the index source for the encoder. When this source is activated, the encoder count automatically resets. * * @param channel A digital source to set as the encoder index * @param type The state that will cause the encoder to reset */ void Encoder::SetIndexSource(DigitalSource *source, Encoder::IndexingType type) { int32_t status = 0; bool activeHigh = (type == kResetWhileHigh) || (type == kResetOnRisingEdge); bool edgeSensitive = (type == kResetOnFallingEdge) || (type == kResetOnRisingEdge); setEncoderIndexSource(m_encoder, source->GetChannelForRouting(), source->GetAnalogTriggerForRouting(), activeHigh, edgeSensitive, &status); wpi_setGlobalErrorWithContext(status, getHALErrorMessage(status)); }
uint64_t GetFPGATime() { int32_t status = 0; uint64_t time = HAL_GetFPGATime(&status); wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status)); return time; }
int64_t GetFPGARevision() { int32_t status = 0; int64_t revision = HAL_GetFPGARevision(&status); wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status)); return revision; }
int GetFPGAVersion() { int32_t status = 0; int version = HAL_GetFPGAVersion(&status); wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status)); return version; }
/** * Get the current sample rate for all channels * * @return Sample rate. */ float AnalogInput::GetSampleRate() { int32_t status = 0; float sampleRate = getAnalogSampleRate(&status); wpi_setGlobalErrorWithContext(status, getHALErrorMessage(status)); return sampleRate; }
/** * Set the sample rate per channel for all analog channels. * The maximum rate is 500kS/s divided by the number of channels in use. * This is 62500 samples/s per channel. * @param samplesPerSecond The number of samples per second. */ void AnalogInput::SetSampleRate(float samplesPerSecond) { int32_t status = 0; setAnalogSampleRate(samplesPerSecond, &status); wpi_setGlobalErrorWithContext(status, getHALErrorMessage(status)); }
/** * Get the current output of the 5V rail * @return The controller 5V rail output current value in Amps */ double ControllerPower::GetCurrent5V() { int32_t status = 0; double retVal = getUserCurrent5V(&status); wpi_setGlobalErrorWithContext(status, getHALErrorMessage(status)); return retVal; }
/** * Get the count of the total current faults on the 6V rail since the controller * has booted * @return The number of faults. */ int ControllerPower::GetFaultCount6V() { int32_t status = 0; int retVal = getUserCurrentFaults6V(&status); wpi_setGlobalErrorWithContext(status, getHALErrorMessage(status)); return retVal; }
/** * Get the enabled state of the 6V rail. The rail may be disabled due to a * controller * brownout, a short circuit on the rail, or controller over-voltage * @return The controller 6V rail enabled value. True for enabled. */ bool ControllerPower::GetEnabled6V() { int32_t status = 0; bool retVal = getUserActive6V(&status); wpi_setGlobalErrorWithContext(status, getHALErrorMessage(status)); return retVal; }
/** * Get the input voltage to the robot controller * @return The controller input voltage value in Volts */ double ControllerPower::GetInputVoltage() { int32_t status = 0; double retVal = getVinVoltage(&status); wpi_setGlobalErrorWithContext(status, getHALErrorMessage(status)); return retVal; }
/** * Return the FPGA Revision number. * The format of the revision is 3 numbers. * The 12 most significant bits are the Major Revision. * the next 8 bits are the Minor Revision. * The 12 least significant bits are the Build Number. * @return FPGA Revision number. */ uint32_t GetFPGARevision() { int32_t status = 0; uint32_t revision = getFPGARevision(&status); wpi_setGlobalErrorWithContext(status, getHALErrorMessage(status)); return revision; }
/** * Return the FPGA Version number. * For now, expect this to be competition year. * @return FPGA Version number. */ uint16_t GetFPGAVersion() { int32_t status = 0; uint16_t version = getFPGAVersion(&status); wpi_setGlobalErrorWithContext(status, getHALErrorMessage(status)); return version; }