ME 507 Romi++
Cylindrical Differential Drive Robot created for ME 507 at Cal Poly in Spring 2025
Loading...
Searching...
No Matches
battery_check.h
Go to the documentation of this file.
1/*
2 * battery_check.h
3 *
4 * Created on: Jun 4, 2025
5 * Author: jacka
6 */
7
8#ifndef INC_BATTERY_CHECK_H_
9#define INC_BATTERY_CHECK_H_
10
17
18#include <stm32f4xx_hal.h>
19#include <stdint.h>
20
22extern ADC_HandleTypeDef hadc1;
23
31{
32public:
37 typedef enum state
38 {
42 } state_t;
43
48
53 void run(void);
54
55private:
56 state_t state;
57 uint16_t raw;
58};
59
60#endif /* INC_BATTERY_CHECK_H_ */
ADC_HandleTypeDef hadc1
External reference to the ADC handle used for battery sensing.
Definition main.cpp:70
void run(void)
Executes one iteration of the battery check FSM.
Definition battery_check.cpp:27
state
Definition battery_check.h:38
@ S0_INIT
Initialization state.
Definition battery_check.h:39
@ S2_BATTERY_LOW
Battery is below acceptable threshold.
Definition battery_check.h:41
@ S1_CHECK_ADC
Check ADC for battery level.
Definition battery_check.h:40
BATTERY_CHECK()
Constructor for the BATTERY_CHECK class.
Definition battery_check.cpp:14