annotate Small_CPU/Inc/batteryCharger.h @ 863:0c89c6fa949c Evo_2_23

Bugfix empty line in deco plan (VPM only): Floating numbers were used to calculate the target slot for the time entry of a deco stop. The float rounding caused a time to be written into one line above the intended one. In the next step the misplaced time was overwritten by the next shallower stop. To fix the problem the index calculation has been corrected and in addition digit numbers have generally been added to floating point operations to make the floating operation more visible.
author Ideenmodellierer
date Tue, 02 Jul 2024 20:05:08 +0200
parents d32901746950
children
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
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 void init_battery_charger_status(void);
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
55 void set_charge_state(chargerState_t newState);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 643
diff changeset
56 uint8_t get_charge_state(void);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 void ReInit_battery_charger_status_pins(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 void DeInit_battery_charger_status_pins(void);
643
5149cd644fbc Reimplemented charger status generation (deactivated):
Ideenmodellierer
parents: 38
diff changeset
59 void battery_charger_get_status_and_contral_battery_gas_gauge(uint8_t cycleTimeBase);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 #endif /* BATTERY_CHARGER_H */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/