You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Provided by the registers, not used in this API.
29
18
*/
30
-
None = -1,
19
+
none = -1,
31
20
32
21
/**
33
22
* First stage of the charging process, prepares battery for the charging process.
34
23
*/
35
-
PreCharge = 0,
24
+
preCharge = 0,
36
25
37
26
/**
38
27
* Second phase of the charging process where the battery is charging in constant current mode until it reaches the voltage where the it's considered fully charged. (4.2V)
39
28
*/
40
-
FastChargeConstantCurrent = 1,
29
+
fastChargeConstantCurrent = 1,
41
30
42
31
/**
43
32
* Third phase of the charging process where the battery is kept at the fully charged voltage and current is slowly decreased to the end of charge current.
44
33
*/
45
-
FastChargeConstantVoltage = 2,
34
+
fastChargeConstantVoltage = 2,
46
35
47
36
/**
48
37
* If the battery is still connected, the charger will ensure it's kept at 4.2V by topping up the voltage to avoid self discharge.
49
38
*/
50
-
EndOfCharge = 3,
39
+
endOfCharge = 3,
51
40
52
41
/**
53
42
* Battery is fully charged
54
43
*/
55
-
Done = 4,
44
+
done = 4,
56
45
57
46
/**
58
47
* The timer that is monitoring the charge status has encountered an error.
59
48
*/
60
-
TimerFaultError = 6,
49
+
timerFaultError = 6,
61
50
62
51
/**
63
52
* Charging was suspended due to overheating
64
53
*/
65
-
ThermistorSuspendError = 7,
54
+
thermistorSuspendError = 7,
66
55
67
56
/**
68
57
* Charger is disabled
69
58
*/
70
-
ChargerDisabled = 8,
59
+
chargerDisabled = 8,
71
60
72
61
/**
73
62
* Charging was suspended due to an overvoltage fault
74
63
*/
75
-
BatteryOvervoltageError = 9,
64
+
batteryOvervoltageError = 9,
76
65
77
66
/**
78
67
* The charger is bypassed completely and the USB voltage is powering the board
79
68
*/
80
-
ChargerBypassed = 12
69
+
chargerBypassed = 12
81
70
};
82
71
83
72
/**
@@ -131,9 +120,15 @@ class Charger {
131
120
132
121
/**
133
122
* @brief Set the end-of-charge current.
134
-
* The default end-of-charge current is set to 0.05A.
123
+
* The charger IC determines when to terminate the charge cycle based on the current going into the battery
124
+
* dropping below the given threshold during the constant voltage phase. At this point, the battery
125
+
* is considered fully charged and charging is completed. If charge termination is disabled,
126
+
* the charge current will naturally decay to 0mA, but this is rarely done in practice.
127
+
* This is because the amount of charge going into the battery exponentially decreases during CV charging,
128
+
* and it would take a significantly longer time to recharge the battery with a very little increase in capacity.
135
129
* @param current End-of-charge current in milli amperes (mA).
136
-
* Supported values: 5, 10, 20, 30, 50
130
+
* The default end-of-charge current is set to 5 mA.
131
+
* Supported values: 5, 10, 20, 30, 50
137
132
* @return True if successful, false if an invalid value was provided or if the PMIC communication failed.
138
133
*/
139
134
boolsetEndOfChargeCurrent(uint16_t current);
@@ -164,20 +159,30 @@ class Charger {
164
159
* @brief Get the input current limit. It is a safeguard to prevent overcurrent when charging
165
160
* respectively to the maximum current the power source can provide.
166
161
*
167
-
* This function returns the current limit of the input power source.
168
-
*
169
-
* @return The input current limit in amps.
162
+
* @return The input current limit in milli amperes (mA).
170
163
*/
171
164
uint16_tgetInputCurrentLimit();
172
165
173
166
/**
174
167
* @brief Get the current charging status.
175
168
* @return Charging status enum value (ChargingState).
169
+
* The possible states are:
170
+
* - none: Provided by the registers, not used in this API.
171
+
* - preCharge: First stage of the charging process, prepares battery for the charging process.
172
+
* - fastChargeConstantCurrent: Second phase of the charging process where the battery is charging in constant current mode until it reaches the voltage where the it's considered fully charged. (4.2V)
173
+
* - fastChargeConstantVoltage: Third phase of the charging process where the battery is kept at the fully charged voltage and current is slowly decreased to the end of charge current.
174
+
* - endOfCharge: If the battery is still connected, the charger will ensure it's kept at 4.2V by topping up the voltage to avoid self discharge.
175
+
* - done: Battery is fully charged
176
+
* - timerFaultError: The timer that is monitoring the charge status has encountered an error.
177
+
* - thermistorSuspendError: Charging was suspended due to overheating
178
+
* - chargerDisabled: Charger is disabled
179
+
* - batteryOvervoltageError: Charging was suspended due to an overvoltage fault
180
+
* - chargerBypassed: The charger is bypassed completely and the USB voltage is powering the board
176
181
*/
177
182
ChargingState getState();
178
183
179
184
/**
180
-
* @brief Checks if the charger is enabled.
185
+
* @brief Checks if the charger and thus charging is enabled.
181
186
* By default, the charger is enabled.
182
187
* @return true if the charger is enabled, false otherwise.
0 commit comments