-
Notifications
You must be signed in to change notification settings - Fork 1
/
battery.h
34 lines (29 loc) · 857 Bytes
/
battery.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef BATTERY_H
#define BATTERY_H
#include <stdint.h>
/**
* @brief vehicle battery sensor data information
*
*/
typedef struct BatteryStruct {
uint8_t voltage; ///< Battery Voltage [V]
int8_t current; ///< Battery Current [A]
} Battery;
/**
* @brief Battery state considering voltage data
*
*/
typedef enum StateBatteryEnum {
BATTERY_DEAD = 0, ///< Battery not working
BATTERY_LOW = 1, ///< Battery state low
BATTERY_OPERATIONAL = 2, ///< Battery under normal operation voltage
BATTERY_CHARGING = 3 ///< Battery charging
} StateBattery;
/**
* @brief Convert the vehicle's voltage and current information into StateBattery
*
* @param battery Battery voltage and current information
* @return StateBattery
*/
StateBattery getBatteryState(Battery battery);
#endif // BATTERY_H