Brian Silverman | 8d3816a | 2017-07-03 18:52:15 -0700 | [diff] [blame] | 1 | #ifndef MOTORS_PERIPHERAL_ADC_H_ |
| 2 | #define MOTORS_PERIPHERAL_ADC_H_ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
Brian Silverman | 19ea60f | 2018-01-03 21:43:15 -0800 | [diff] [blame] | 6 | #include "motors/util.h" |
| 7 | |
Brian Silverman | 8d3816a | 2017-07-03 18:52:15 -0700 | [diff] [blame] | 8 | namespace frc971 { |
| 9 | namespace salsa { |
| 10 | |
| 11 | struct MediumAdcReadings { |
| 12 | uint16_t motor_currents[3][2]; |
| 13 | uint16_t motor_current_ref; |
| 14 | uint16_t input_voltage; |
| 15 | }; |
| 16 | |
Brian Silverman | 19ea60f | 2018-01-03 21:43:15 -0800 | [diff] [blame] | 17 | struct SmallAdcReadings { |
| 18 | uint16_t currents[3]; |
| 19 | }; |
Brian Silverman | 8d3816a | 2017-07-03 18:52:15 -0700 | [diff] [blame] | 20 | |
Brian Silverman | 19ea60f | 2018-01-03 21:43:15 -0800 | [diff] [blame] | 21 | struct SmallInitReadings { |
| 22 | uint16_t motor0_abs; |
| 23 | uint16_t motor1_abs; |
| 24 | uint16_t wheel_abs; |
| 25 | }; |
| 26 | |
Brian Silverman | 259c443 | 2018-01-15 14:34:21 -0800 | [diff] [blame] | 27 | struct JoystickAdcReadings { |
| 28 | uint16_t analog0, analog1, analog2, analog3; |
| 29 | }; |
| 30 | |
Brian Silverman | 19ea60f | 2018-01-03 21:43:15 -0800 | [diff] [blame] | 31 | void AdcInitMedium(); |
| 32 | void AdcInitSmall(); |
Brian Silverman | 259c443 | 2018-01-15 14:34:21 -0800 | [diff] [blame] | 33 | void AdcInitJoystick(); |
Brian Silverman | 19ea60f | 2018-01-03 21:43:15 -0800 | [diff] [blame] | 34 | |
| 35 | MediumAdcReadings AdcReadMedium(const DisableInterrupts &); |
| 36 | SmallAdcReadings AdcReadSmall0(const DisableInterrupts &); |
| 37 | SmallAdcReadings AdcReadSmall1(const DisableInterrupts &); |
| 38 | SmallInitReadings AdcReadSmallInit(const DisableInterrupts &); |
Brian Silverman | 259c443 | 2018-01-15 14:34:21 -0800 | [diff] [blame] | 39 | JoystickAdcReadings AdcReadJoystick(const DisableInterrupts &); |
Brian Silverman | 8d3816a | 2017-07-03 18:52:15 -0700 | [diff] [blame] | 40 | |
| 41 | } // namespace salsa |
| 42 | } // namespace frc971 |
| 43 | |
| 44 | #endif // MOTORS_PERIPHERAL_ADC_H_ |