Skip to content

Commit cfac38b

Browse files
committed
add eta4662 driver.
1 parent b16105f commit cfac38b

6 files changed

Lines changed: 634 additions & 55 deletions

File tree

src/fw/board/board_sf32lb.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ typedef struct {
305305

306306
//! Approximate hours of battery life
307307
const uint8_t battery_capacity_hours;
308+
309+
const InputConfig charger_int_gpio;
310+
const ExtiConfig charger_exti;
308311
} BoardConfigPower;
309312

310313
typedef struct {

src/fw/drivers/battery/battery_obelix.c renamed to src/fw/drivers/battery/battery_obelix_bb.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,23 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
1716
#include "drivers/battery.h"
18-
1917
#include "drivers/exti.h"
2018
#include "drivers/gpio.h"
2119
#include "board/board.h"
2220
#include "drivers/otp.h"
2321
#include "drivers/periph_config.h"
2422
#include "system/logging.h"
25-
2623
#include <mcu.h>
2724

2825
#include <stdlib.h>
2926
#include <string.h>
30-
3127
#include "charger_eta4662.h"
3228

33-
34-
3529
void battery_init(void) {
3630
chager_init();
3731
}
3832

39-
4033
int battery_get_millivolts(void) {
4134
//ADCVoltageMonitorReading info = battery_read_voltage_monitor();
4235

@@ -52,3 +45,29 @@ int battery_get_millivolts(void) {
5245
return 3600;//battery_convert_reading_to_millivolts(info, 3599, 1373);
5346
}
5447

48+
bool battery_charge_controller_thinks_we_are_charging_impl(void) {
49+
return false;//pmic_is_charging();
50+
}
51+
52+
bool battery_is_usb_connected_impl(void) {
53+
return false;//pmic_is_usb_connected();
54+
}
55+
56+
void battery_set_charge_enable(bool charging_enabled) {
57+
//pmic_set_charger_state(charging_enabled);
58+
}
59+
60+
// TODO
61+
// This is my understanding from Figure 9 of the datasheet:
62+
// Charger off -> Pre charge -> Fast Charge (constant current) ->
63+
// Fast Charge (constant voltage) -> Maintain Charge -> Maintain Charge Done
64+
//
65+
// The Pre Charge and Charge Termination currents are programmed via I2C
66+
// The Fast Charge current is determined by Rset
67+
//
68+
// There doesn't seem to be a way to change the current in constant current mode
69+
void battery_set_fast_charge(bool fast_charge_enabled) {
70+
71+
}
72+
73+

0 commit comments

Comments
 (0)