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 | |
| 27 | void AdcInitMedium(); |
| 28 | void AdcInitSmall(); |
| 29 | |
| 30 | MediumAdcReadings AdcReadMedium(const DisableInterrupts &); |
| 31 | SmallAdcReadings AdcReadSmall0(const DisableInterrupts &); |
| 32 | SmallAdcReadings AdcReadSmall1(const DisableInterrupts &); |
| 33 | SmallInitReadings AdcReadSmallInit(const DisableInterrupts &); |
Brian Silverman | 8d3816a | 2017-07-03 18:52:15 -0700 | [diff] [blame] | 34 | |
| 35 | } // namespace salsa |
| 36 | } // namespace frc971 |
| 37 | |
| 38 | #endif // MOTORS_PERIPHERAL_ADC_H_ |