1+ #ifndef BATTERY_H
2+ #define BATTERY_H
3+
4+ #include <stdint.h>
5+
6+ /**
7+ * @brief Battery health status.
8+ *
9+ * Represents the current health condition of the battery
10+ * based on measured battery voltage.
11+ */
12+ typedef enum
13+ {
14+ BATTERY_HEALTH_GOOD = 0 , /**< Battery voltage is healthy */
15+ BATTERY_HEALTH_LOW , /**< Battery voltage is low */
16+ BATTERY_HEALTH_CRITICAL /**< Battery voltage is critical */
17+ } battery_health_t ;
18+
19+ /**
20+ * @brief Get battery percentage.
21+ *
22+ * Reads the battery voltage and converts it to a
23+ * percentage value between 0 and 100.
24+ *
25+ * @return Battery percentage.
26+ */
27+ uint8_t battery_get_percentage (void );
28+
29+ /**
30+ * @brief Determine battery health state.
31+ *
32+ * Evaluates the battery voltage and returns the
33+ * corresponding health status.
34+ *
35+ * @return Battery health status.
36+ */
37+ battery_health_t battery_get_health (void );
38+
39+ /**
40+ * @brief Update battery warning LED state.
41+ *
42+ * Turns the warning LED ON when battery level is low
43+ * and OFF when battery level is healthy.
44+ */
45+ void battery_update_led (void );
46+
47+ /**
48+ * @brief Send battery telemetry packet.
49+ *
50+ * Creates and transmits a telemetry packet containing
51+ * battery information over UART.
52+ */
53+ void battery_send_telemetry (void );
54+
55+ /**
56+ * @brief Get battery temperature.
57+ *
58+ * Reads the battery temperature from the temperature
59+ * sensor driver.
60+ *
61+ * @return Battery temperature in degrees Celsius.
62+ */
63+ int16_t battery_get_temperature (void );
64+
65+ /**
66+ * @brief Execute battery monitoring task.
67+ *
68+ * Periodically checks battery status and performs
69+ * required actions such as updating LEDs and sending
70+ * telemetry.
71+ */
72+ void battery_monitor_task (void );
73+
74+ #endif /* BATTERY_H */
0 commit comments