comparison Small_CPU/Inc/batteryCharger.h @ 696:cc542448fb28

Merge
author heinrichsweikamp
date Fri, 19 Aug 2022 11:30:24 +0200
parents 1b995079c045
children d32901746950
comparison
equal deleted inserted replaced
661:87bee7cc77b3 696:cc542448fb28
29 #endif 29 #endif
30 30
31 /* Includes ------------------------------------------------------------------*/ 31 /* Includes ------------------------------------------------------------------*/
32 #include <stdint.h> 32 #include <stdint.h>
33 33
34 #define CHARGE_IN_PIN GPIO_PIN_2
35 #define CHARGE_IN_GPIO_PORT GPIOC
36 #define CHARGE_IN_GPIO_ENABLE() __GPIOC_CLK_ENABLE()
37
38 #define CHARGE_OUT_PIN GPIO_PIN_1
39 #define CHARGE_OUT_GPIO_PORT GPIOC
40 #define CHARGE_OUT_GPIO_ENABLE() __GPIOC_CLK_ENABLE()
41
42 typedef enum
43 {
44 Charger_NotConnected = 0, /* This is identified reading CHARGE_IN_PIN == HIGH */
45 Charger_WarmUp, /* Charging started but counter did not yet reach a certain limit (used to debounce connect / disconnect events to avoid multiple increases of statistic charging cycle counter) */
46 Charger_Active, /* Charging identified by CHARGE_IN_PIN == LOW for a certain time */
47 Charger_Finished,
48 Charger_LostConnection, /* Intermediate state to debounce disconnecting events (including charging error state like over temperature) */
49 Charger_ColdStart, /* Cold start condition => check if an loaded battery has been inserted */
50 Charger_END
51 } chargerState_t;
52
53
34 uint8_t get_charge_status(void); 54 uint8_t get_charge_status(void);
35
36 void init_battery_charger_status(void); 55 void init_battery_charger_status(void);
56 void set_charge_state(chargerState_t newState);
57 uint8_t get_charge_state(void);
37 void ReInit_battery_charger_status_pins(void); 58 void ReInit_battery_charger_status_pins(void);
38 void DeInit_battery_charger_status_pins(void); 59 void DeInit_battery_charger_status_pins(void);
39 void battery_charger_get_status_and_contral_battery_gas_gauge(uint8_t cycleTimeBase); 60 void battery_charger_get_status_and_contral_battery_gas_gauge(uint8_t cycleTimeBase);
40 61
41 #ifdef __cplusplus 62 #ifdef __cplusplus