2020-11-11 06:31:35 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2020-12-02 10:47:13 +00:00
|
|
|
#include <m-string.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2020-11-11 06:31:35 +00:00
|
|
|
|
2020-12-22 18:16:32 +00:00
|
|
|
typedef enum {
|
|
|
|
ApiHalPowerICCharger,
|
|
|
|
ApiHalPowerICFuelGauge,
|
|
|
|
} ApiHalPowerIC;
|
|
|
|
|
2020-11-11 06:31:35 +00:00
|
|
|
/* Initialize drivers */
|
|
|
|
void api_hal_power_init();
|
|
|
|
|
|
|
|
/* Get predicted remaining battery capacity in percents */
|
|
|
|
uint8_t api_hal_power_get_pct();
|
|
|
|
|
|
|
|
/* Get charging status */
|
|
|
|
bool api_hal_power_is_charging();
|
|
|
|
|
|
|
|
/* Poweroff system */
|
|
|
|
void api_hal_power_off();
|
|
|
|
|
|
|
|
/* OTG enable */
|
|
|
|
void api_hal_power_enable_otg();
|
|
|
|
|
|
|
|
/* OTG disable */
|
|
|
|
void api_hal_power_disable_otg();
|
2020-12-02 10:47:13 +00:00
|
|
|
|
2020-12-22 18:16:32 +00:00
|
|
|
/* Get remaining battery battery capacity in mAh */
|
|
|
|
uint32_t api_hal_power_get_battery_remaining_capacity();
|
|
|
|
|
|
|
|
/* Get full charge battery capacity in mAh */
|
|
|
|
uint32_t api_hal_power_get_battery_full_capacity();
|
|
|
|
|
2020-12-02 10:47:13 +00:00
|
|
|
/* Get battery voltage in V */
|
2020-12-22 18:16:32 +00:00
|
|
|
float api_hal_power_get_battery_voltage(ApiHalPowerIC ic);
|
2020-12-02 10:47:13 +00:00
|
|
|
|
|
|
|
/* Get battery current in A */
|
2020-12-22 18:16:32 +00:00
|
|
|
float api_hal_power_get_battery_current(ApiHalPowerIC ic);
|
2020-12-02 10:47:13 +00:00
|
|
|
|
2020-12-18 18:03:28 +00:00
|
|
|
/* Get temperature in C */
|
2020-12-22 18:16:32 +00:00
|
|
|
float api_hal_power_get_battery_temperature(ApiHalPowerIC ic);
|
|
|
|
|
|
|
|
/* Get System voltage in V */
|
|
|
|
float api_hal_power_get_system_voltage();
|
|
|
|
|
|
|
|
/* Get USB voltage in V */
|
|
|
|
float api_hal_power_get_usb_voltage();
|
2020-12-18 18:03:28 +00:00
|
|
|
|
2020-12-02 10:47:13 +00:00
|
|
|
/* Get power system component state */
|
|
|
|
void api_hal_power_dump_state(string_t buffer);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|