7 #ifndef __DRIVER_STATION_ENHANCED_IO_H__
8 #define __DRIVER_STATION_ENHANCED_IO_H__
10 #include "ErrorBase.h"
11 #include "NetworkCommunication/FRCComm.h"
16 #define kAnalogInputResolution ((double)((1<<14)-1))
17 #define kAnalogInputReference 3.3
18 #define kAnalogOutputResolution ((double)((1<<8)-1))
19 #define kAnalogOutputReference 4.0
20 #define kAccelOffset 8300
21 #define kAccelScale 3300.0
22 #define kSupportedAPIVersion 1
41 uint16_t pwm_compare[4];
42 uint16_t pwm_period[2];
50 uint8_t pwm_enable : 4;
51 uint8_t comparator_enable : 2;
52 uint8_t quad_index_enable : 2;
56 uint8_t fixed_digital_out;
68 uint8_t capsense_slider;
69 uint8_t capsense_proximity;
92 kInputBlockID = kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input,
93 kOutputBlockID = kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output,
95 enum tStatusFlags {kStatusValid = 0x01, kStatusConfigChanged = 0x02, kForceEnhancedMode = 0x04};
98 enum tDigitalConfig {kUnknown, kInputFloating, kInputPullUp, kInputPullDown, kOutput, kPWM, kAnalogComparator};
99 enum tAccelChannel {kAccelX = 0, kAccelY = 1, kAccelZ = 2};
100 enum tPWMPeriodChannels {kPWMChannels1and2, kPWMChannels3and4};
109 void SetLED(uint32_t channel,
bool value);
117 void SetPWMPeriod(tPWMPeriodChannels channels,
double period);
133 void MergeConfigIntoOutput(
const status_block_t &dsOutputBlock, status_block_t &localCache);
134 bool IsConfigEqual(
const status_block_t &dsOutputBlock,
const status_block_t &localCache);
139 control_block_t m_inputData;
140 status_block_t m_outputData;
141 SEM_ID m_inputDataSemaphore;
142 SEM_ID m_outputDataSemaphore;
145 bool m_configChanged;
146 bool m_requestEnhancedEnable;
147 int16_t m_encoderOffsets[2];
void SetPWMOutput(uint32_t channel, double value)
Definition: DriverStationEnhancedIO.cpp:948
uint16_t GetDigitals()
Definition: DriverStationEnhancedIO.cpp:429
uint8_t GetButtons()
Definition: DriverStationEnhancedIO.cpp:335
double GetPWMOutput(uint32_t channel)
Definition: DriverStationEnhancedIO.cpp:922
uint8_t GetFirmwareVersion()
Definition: DriverStationEnhancedIO.cpp:983
tDigitalConfig GetDigitalConfig(uint32_t channel)
Definition: DriverStationEnhancedIO.cpp:494
void SetLEDs(uint8_t value)
Definition: DriverStationEnhancedIO.cpp:388
void SetFixedDigitalOutput(uint32_t channel, bool value)
Definition: DriverStationEnhancedIO.cpp:749
void SetDigitalOutput(uint32_t channel, bool value)
Definition: DriverStationEnhancedIO.cpp:447
bool GetFixedDigitalOutput(uint32_t channel)
Definition: DriverStationEnhancedIO.cpp:718
bool GetEncoderIndexEnable(uint32_t encoderNumber)
Definition: DriverStationEnhancedIO.cpp:851
double GetPWMPeriod(tPWMPeriodChannels channels)
Definition: DriverStationEnhancedIO.cpp:652
Definition: DriverStationEnhancedIO.h:29
void SetDigitalConfig(uint32_t channel, tDigitalConfig config)
Definition: DriverStationEnhancedIO.cpp:563
Definition: ErrorBase.h:37
void SetAnalogOut(uint32_t channel, double value)
Definition: DriverStationEnhancedIO.cpp:271
bool GetDigital(uint32_t channel)
Definition: DriverStationEnhancedIO.cpp:406
void SetLED(uint32_t channel, bool value)
Definition: DriverStationEnhancedIO.cpp:353
double GetAnalogOut(uint32_t channel)
Definition: DriverStationEnhancedIO.cpp:241
void SetPWMPeriod(tPWMPeriodChannels channels, double period)
Definition: DriverStationEnhancedIO.cpp:680
void SetEncoderIndexEnable(uint32_t encoderNumber, bool enable)
Definition: DriverStationEnhancedIO.cpp:882
double GetTouchSlider()
Definition: DriverStationEnhancedIO.cpp:901
double GetAnalogInRatio(uint32_t channel)
Definition: DriverStationEnhancedIO.cpp:208
void ResetEncoder(uint32_t encoderNumber)
Definition: DriverStationEnhancedIO.cpp:825
bool GetButton(uint32_t channel)
Definition: DriverStationEnhancedIO.cpp:312
double GetAcceleration(tAccelChannel channel)
Definition: DriverStationEnhancedIO.cpp:166
Definition: DriverStation.h:21
int16_t GetEncoder(uint32_t encoderNumber)
Definition: DriverStationEnhancedIO.cpp:793
double GetAnalogIn(uint32_t channel)
Definition: DriverStationEnhancedIO.cpp:196