blob: d855acf5600403e29165f49c89a6e7e8acde4c3c [file] [log] [blame]
Brian Silverman8d3816a2017-07-03 18:52:15 -07001#ifndef MOTORS_PERIPHERAL_ADC_H_
2#define MOTORS_PERIPHERAL_ADC_H_
3
4#include <stdint.h>
5
Brian Silverman19ea60f2018-01-03 21:43:15 -08006#include "motors/util.h"
7
Brian Silverman8d3816a2017-07-03 18:52:15 -07008namespace frc971 {
9namespace salsa {
10
11struct MediumAdcReadings {
12 uint16_t motor_currents[3][2];
13 uint16_t motor_current_ref;
14 uint16_t input_voltage;
15};
16
Brian Silverman19ea60f2018-01-03 21:43:15 -080017struct SmallAdcReadings {
18 uint16_t currents[3];
19};
Brian Silverman8d3816a2017-07-03 18:52:15 -070020
Brian Silverman19ea60f2018-01-03 21:43:15 -080021struct SmallInitReadings {
22 uint16_t motor0_abs;
23 uint16_t motor1_abs;
24 uint16_t wheel_abs;
25};
26
Brian Silverman259c4432018-01-15 14:34:21 -080027struct JoystickAdcReadings {
28 uint16_t analog0, analog1, analog2, analog3;
29};
30
Brian Silverman19ea60f2018-01-03 21:43:15 -080031void AdcInitMedium();
32void AdcInitSmall();
Brian Silverman259c4432018-01-15 14:34:21 -080033void AdcInitJoystick();
Brian Silverman19ea60f2018-01-03 21:43:15 -080034
35MediumAdcReadings AdcReadMedium(const DisableInterrupts &);
36SmallAdcReadings AdcReadSmall0(const DisableInterrupts &);
37SmallAdcReadings AdcReadSmall1(const DisableInterrupts &);
38SmallInitReadings AdcReadSmallInit(const DisableInterrupts &);
Brian Silverman259c4432018-01-15 14:34:21 -080039JoystickAdcReadings AdcReadJoystick(const DisableInterrupts &);
Brian Silverman8d3816a2017-07-03 18:52:15 -070040
41} // namespace salsa
42} // namespace frc971
43
44#endif // MOTORS_PERIPHERAL_ADC_H_