40 static void _putc(
void *p,
char c)
68 double voltage = voltage_pin.
read();
69 double current = current_pin.
read();
70 printf(
"%f;\t%f\n", voltage, current);
GPIO_TypeDef * current_gpio
uint8_t current_adc_channel
double read() const
Get the last reading of the pin, in volts.
const ADCHardwareStruct adc_config[ADC_NUM]
A driver for the analog-digital converters available on the microcontroller.
const BatteryMonitorHardwareStruct battery_monitor_config
static void _putc(void *p, char c)
A class to represent a single pin configured for analog input.
void put_byte(uint8_t ch) override
void init(const ADCHardwareStruct *adc_def)
Initializes the ADC according to the definition struct provided.
GPIO_TypeDef * voltage_gpio
void init(AnalogDigitalConverter *adc, GPIO_TypeDef *basePort, uint16_t pin, uint8_t adc_channel)
Initializes a pin to read analog values.
uint8_t voltage_adc_channel
void init_printf(void *putp, void(*putf)(void *, char))