bq25896.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #pragma once
  2. #include "bq25896_reg.h"
  3. #include <stdbool.h>
  4. #include <stdint.h>
  5. #include <furi_hal_i2c.h>
  6. /** Initialize Driver */
  7. void bq25896_init(FuriHalI2cBusHandle* handle);
  8. /** Send device into shipping mode */
  9. void bq25896_poweroff(FuriHalI2cBusHandle* handle);
  10. /** Get charging status */
  11. ChrgStat bq25896_get_charge_status(FuriHalI2cBusHandle* handle);
  12. /** Is currently charging */
  13. bool bq25896_is_charging(FuriHalI2cBusHandle* handle);
  14. /** Is charging completed while connected to charger */
  15. bool bq25896_is_charging_done(FuriHalI2cBusHandle* handle);
  16. /** Enable charging */
  17. void bq25896_enable_charging(FuriHalI2cBusHandle* handle);
  18. /** Disable charging */
  19. void bq25896_disable_charging(FuriHalI2cBusHandle* handle);
  20. /** Enable otg */
  21. void bq25896_enable_otg(FuriHalI2cBusHandle* handle);
  22. /** Disable otg */
  23. void bq25896_disable_otg(FuriHalI2cBusHandle* handle);
  24. /** Is otg enabled */
  25. bool bq25896_is_otg_enabled(FuriHalI2cBusHandle* handle);
  26. /** Get VREG (charging) voltage in mV */
  27. uint16_t bq25896_get_vreg_voltage(FuriHalI2cBusHandle* handle);
  28. /** Set VREG (charging) voltage in mV
  29. *
  30. * Valid range: 3840mV - 4208mV, in steps of 16mV
  31. */
  32. void bq25896_set_vreg_voltage(FuriHalI2cBusHandle* handle, uint16_t vreg_voltage);
  33. /** Check OTG BOOST Fault status */
  34. bool bq25896_check_otg_fault(FuriHalI2cBusHandle* handle);
  35. /** Get VBUS Voltage in mV */
  36. uint16_t bq25896_get_vbus_voltage(FuriHalI2cBusHandle* handle);
  37. /** Get VSYS Voltage in mV */
  38. uint16_t bq25896_get_vsys_voltage(FuriHalI2cBusHandle* handle);
  39. /** Get VBAT Voltage in mV */
  40. uint16_t bq25896_get_vbat_voltage(FuriHalI2cBusHandle* handle);
  41. /** Get VBAT current in mA */
  42. uint16_t bq25896_get_vbat_current(FuriHalI2cBusHandle* handle);
  43. /** Get NTC voltage in mpct of REGN */
  44. uint32_t bq25896_get_ntc_mpct(FuriHalI2cBusHandle* handle);