2020-12-02 10:47:13 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-09-26 15:34:59 +00:00
|
|
|
#include "bq25896_reg.h"
|
|
|
|
|
2020-12-02 10:47:13 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
2022-01-05 16:10:18 +00:00
|
|
|
#include <furi_hal_i2c.h>
|
2020-12-02 10:47:13 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Initialize Driver */
|
2021-11-28 18:28:19 +00:00
|
|
|
void bq25896_init(FuriHalI2cBusHandle* handle);
|
2020-12-02 10:47:13 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Send device into shipping mode */
|
2021-11-28 18:28:19 +00:00
|
|
|
void bq25896_poweroff(FuriHalI2cBusHandle* handle);
|
2020-12-02 10:47:13 +00:00
|
|
|
|
2022-09-26 15:34:59 +00:00
|
|
|
/** Get charging status */
|
|
|
|
ChrgStat bq25896_get_charge_status(FuriHalI2cBusHandle* handle);
|
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Is currently charging */
|
2021-11-28 18:28:19 +00:00
|
|
|
bool bq25896_is_charging(FuriHalI2cBusHandle* handle);
|
2020-12-02 10:47:13 +00:00
|
|
|
|
2022-09-26 15:34:59 +00:00
|
|
|
/** Is charging completed while connected to charger */
|
|
|
|
bool bq25896_is_charging_done(FuriHalI2cBusHandle* handle);
|
|
|
|
|
2021-10-04 07:01:41 +00:00
|
|
|
/** Enable charging */
|
2021-11-28 18:28:19 +00:00
|
|
|
void bq25896_enable_charging(FuriHalI2cBusHandle* handle);
|
2021-10-04 07:01:41 +00:00
|
|
|
|
|
|
|
/** Disable charging */
|
2021-11-28 18:28:19 +00:00
|
|
|
void bq25896_disable_charging(FuriHalI2cBusHandle* handle);
|
2021-10-04 07:01:41 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Enable otg */
|
2021-11-28 18:28:19 +00:00
|
|
|
void bq25896_enable_otg(FuriHalI2cBusHandle* handle);
|
2020-12-02 10:47:13 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Disable otg */
|
2021-11-28 18:28:19 +00:00
|
|
|
void bq25896_disable_otg(FuriHalI2cBusHandle* handle);
|
2020-12-02 10:47:13 +00:00
|
|
|
|
2021-09-30 20:03:28 +00:00
|
|
|
/** Is otg enabled */
|
2021-11-28 18:28:19 +00:00
|
|
|
bool bq25896_is_otg_enabled(FuriHalI2cBusHandle* handle);
|
2021-09-30 20:03:28 +00:00
|
|
|
|
2023-02-26 17:23:39 +00:00
|
|
|
/** Get VREG (charging limit) voltage in mV */
|
2022-12-08 06:57:49 +00:00
|
|
|
uint16_t bq25896_get_vreg_voltage(FuriHalI2cBusHandle* handle);
|
|
|
|
|
2023-02-26 17:23:39 +00:00
|
|
|
/** Set VREG (charging limit) voltage in mV
|
2022-12-08 06:57:49 +00:00
|
|
|
*
|
|
|
|
* Valid range: 3840mV - 4208mV, in steps of 16mV
|
|
|
|
*/
|
|
|
|
void bq25896_set_vreg_voltage(FuriHalI2cBusHandle* handle, uint16_t vreg_voltage);
|
|
|
|
|
2022-01-21 16:55:44 +00:00
|
|
|
/** Check OTG BOOST Fault status */
|
|
|
|
bool bq25896_check_otg_fault(FuriHalI2cBusHandle* handle);
|
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Get VBUS Voltage in mV */
|
2021-11-28 18:28:19 +00:00
|
|
|
uint16_t bq25896_get_vbus_voltage(FuriHalI2cBusHandle* handle);
|
2020-12-02 10:47:13 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Get VSYS Voltage in mV */
|
2021-11-28 18:28:19 +00:00
|
|
|
uint16_t bq25896_get_vsys_voltage(FuriHalI2cBusHandle* handle);
|
2020-12-02 10:47:13 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Get VBAT Voltage in mV */
|
2021-11-28 18:28:19 +00:00
|
|
|
uint16_t bq25896_get_vbat_voltage(FuriHalI2cBusHandle* handle);
|
2020-12-02 10:47:13 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Get VBAT current in mA */
|
2021-11-28 18:28:19 +00:00
|
|
|
uint16_t bq25896_get_vbat_current(FuriHalI2cBusHandle* handle);
|
2020-12-02 10:47:13 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Get NTC voltage in mpct of REGN */
|
2021-11-28 18:28:19 +00:00
|
|
|
uint32_t bq25896_get_ntc_mpct(FuriHalI2cBusHandle* handle);
|