annotate Small_CPU/Inc/batteryCharger.h @ 787:aeb72882f30a

Dev Bugfx Empty buffer indication and stability improvments: The mux prototype used ASCII coding for channel selection while the current realization used real number (0...4) for addressing the mux. The UART read function uses the '0' to indicate an empty buffer element. The mux now loops back '0' used by channel selection causing the read function to process the data. As result data interrups are visible at the display. To avoid this another character has been defined indicate empty buffer locations. Beside this the functionality has been improved with regard to access speed and better recovery in case of transition failure.
author Ideenmodellierer
date Sun, 04 Jun 2023 21:59:26 +0200
parents 1b995079c045
children d32901746950
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file batteryCharger.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @date 09-Dec-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @since 09-Dec-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 * @brief LTC4054 Standalone Linear Li-Ion Battery Charger
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ##### How to use #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 * <h2><center>&copy; COPYRIGHT(c) 2015 heinrichs weikamp</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /* Define to prevent recursive inclusion -------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 #ifndef BATTERY_CHARGER_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 #define BATTERY_CHARGER_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 extern "C" {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include <stdint.h>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
34 #define CHARGE_IN_PIN GPIO_PIN_2
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
35 #define CHARGE_IN_GPIO_PORT GPIOC
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
36 #define CHARGE_IN_GPIO_ENABLE() __GPIOC_CLK_ENABLE()
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
37
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
38 #define CHARGE_OUT_PIN GPIO_PIN_1
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
39 #define CHARGE_OUT_GPIO_PORT GPIOC
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
40 #define CHARGE_OUT_GPIO_ENABLE() __GPIOC_CLK_ENABLE()
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
42 typedef enum
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
43 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
44 Charger_NotConnected = 0, /* This is identified reading CHARGE_IN_PIN == HIGH */
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
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) */
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
46 Charger_Active, /* Charging identified by CHARGE_IN_PIN == LOW for a certain time */
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
47 Charger_Finished,
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
48 Charger_LostConnection, /* Intermediate state to debounce disconnecting events (including charging error state like over temperature) */
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
49 Charger_ColdStart, /* Cold start condition => check if an loaded battery has been inserted */
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
50 Charger_END
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
51 } chargerState_t;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
52
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
53
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
54 uint8_t get_charge_status(void);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 void init_battery_charger_status(void);
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
56 void set_charge_state(chargerState_t newState);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
57 uint8_t get_charge_state(void);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 void ReInit_battery_charger_status_pins(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 void DeInit_battery_charger_status_pins(void);
643
5149cd644fbc Reimplemented charger status generation (deactivated):
Ideenmodellierer
parents: 38
diff changeset
60 void battery_charger_get_status_and_contral_battery_gas_gauge(uint8_t cycleTimeBase);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 #endif /* BATTERY_CHARGER_H */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/