Loading...
Searching...
No Matches
furi_hal_power.h File Reference

Power HAL API. More...

#include <stdint.h>
#include <stdbool.h>
#include <core/string.h>
#include <core/common_defines.h>
#include <toolbox/property.h>

Go to the source code of this file.

Enumerations

enum  FuriHalPowerIC { FuriHalPowerICCharger , FuriHalPowerICFuelGauge }
 Power IC type.
 

Functions

void furi_hal_power_init (void)
 Initialize drivers.
 
bool furi_hal_power_gauge_is_ok (void)
 Check if gauge is ok.
 
bool furi_hal_power_is_shutdown_requested (void)
 Check if gauge requests system shutdown.
 
uint16_t furi_hal_power_insomnia_level (void)
 Get current insomnia level.
 
void furi_hal_power_insomnia_enter (void)
 Enter insomnia mode Prevents device from going to sleep.
 
void furi_hal_power_insomnia_exit (void)
 Exit insomnia mode Allow device to go to sleep.
 
bool furi_hal_power_sleep_available (void)
 Check if sleep available.
 
void furi_hal_power_sleep (void)
 Go to sleep.
 
uint8_t furi_hal_power_get_pct (void)
 Get predicted remaining battery capacity in percents.
 
uint8_t furi_hal_power_get_bat_health_pct (void)
 Get battery health state in percents.
 
bool furi_hal_power_is_charging (void)
 Get charging status.
 
bool furi_hal_power_is_charging_done (void)
 Get charge complete status.
 
void furi_hal_power_shutdown (void)
 Switch MCU to SHUTDOWN.
 
void furi_hal_power_off (void)
 Poweroff device.
 
FURI_NORETURN void furi_hal_power_reset (void)
 Reset device.
 
bool furi_hal_power_enable_otg (void)
 OTG enable.
 
void furi_hal_power_disable_otg (void)
 OTG disable.
 
bool furi_hal_power_check_otg_fault (void)
 Check OTG status fault.
 
void furi_hal_power_check_otg_status (void)
 Check OTG status and disable it if falt happened.
 
bool furi_hal_power_is_otg_enabled (void)
 Get OTG status.
 
float furi_hal_power_get_battery_charge_voltage_limit (void)
 Get battery charge voltage limit in V.
 
void furi_hal_power_set_battery_charge_voltage_limit (float voltage)
 Set battery charge voltage limit in V.
 
uint32_t furi_hal_power_get_battery_remaining_capacity (void)
 Get remaining battery battery capacity in mAh.
 
uint32_t furi_hal_power_get_battery_full_capacity (void)
 Get full charge battery capacity in mAh.
 
uint32_t furi_hal_power_get_battery_design_capacity (void)
 Get battery capacity in mAh from battery profile.
 
float furi_hal_power_get_battery_voltage (FuriHalPowerIC ic)
 Get battery voltage in V.
 
float furi_hal_power_get_battery_current (FuriHalPowerIC ic)
 Get battery current in A.
 
float furi_hal_power_get_battery_temperature (FuriHalPowerIC ic)
 Get temperature in C.
 
float furi_hal_power_get_usb_voltage (void)
 Get USB voltage in V.
 
void furi_hal_power_enable_external_3_3v (void)
 Enable 3.3v on external gpio and sd card.
 
void furi_hal_power_disable_external_3_3v (void)
 Disable 3.3v on external gpio and sd card.
 
void furi_hal_power_suppress_charge_enter (void)
 Enter supress charge mode.
 
void furi_hal_power_suppress_charge_exit (void)
 Exit supress charge mode.
 
void furi_hal_power_info_get (PropertyValueCallback callback, char sep, void *context)
 Get power information.
 
void furi_hal_power_debug_get (PropertyValueCallback callback, void *context)
 Get power debug information.
 

Detailed Description

Power HAL API.

Function Documentation

◆ furi_hal_power_debug_get()

void furi_hal_power_debug_get ( PropertyValueCallback callback,
void * context )

Get power debug information.

Parameters
[in]callbackcallback to provide with new data
[in]contextcontext to pass to callback

◆ furi_hal_power_gauge_is_ok()

bool furi_hal_power_gauge_is_ok ( void )

Check if gauge is ok.

Verifies that:

  • gauge is alive
  • correct profile loaded
  • self diagnostic status is good
Returns
true if gauge is ok

◆ furi_hal_power_get_bat_health_pct()

uint8_t furi_hal_power_get_bat_health_pct ( void )

Get battery health state in percents.

Returns
health in percents

◆ furi_hal_power_get_battery_charge_voltage_limit()

float furi_hal_power_get_battery_charge_voltage_limit ( void )

Get battery charge voltage limit in V.

Returns
voltage in V

◆ furi_hal_power_get_battery_current()

float furi_hal_power_get_battery_current ( FuriHalPowerIC ic)

Get battery current in A.

Parameters
[in]icFuriHalPowerIc to get measurment
Returns
current in A

◆ furi_hal_power_get_battery_design_capacity()

uint32_t furi_hal_power_get_battery_design_capacity ( void )

Get battery capacity in mAh from battery profile.

Returns
capacity in mAh

◆ furi_hal_power_get_battery_full_capacity()

uint32_t furi_hal_power_get_battery_full_capacity ( void )

Get full charge battery capacity in mAh.

Returns
capacity in mAh

◆ furi_hal_power_get_battery_remaining_capacity()

uint32_t furi_hal_power_get_battery_remaining_capacity ( void )

Get remaining battery battery capacity in mAh.

Returns
capacity in mAh

◆ furi_hal_power_get_battery_temperature()

float furi_hal_power_get_battery_temperature ( FuriHalPowerIC ic)

Get temperature in C.

Parameters
[in]icFuriHalPowerIc to get measurment
Returns
temperature in C

◆ furi_hal_power_get_battery_voltage()

float furi_hal_power_get_battery_voltage ( FuriHalPowerIC ic)

Get battery voltage in V.

Parameters
[in]icFuriHalPowerIc to get measurment
Returns
voltage in V

◆ furi_hal_power_get_pct()

uint8_t furi_hal_power_get_pct ( void )

Get predicted remaining battery capacity in percents.

Returns
remaining battery capacity in percents

◆ furi_hal_power_get_usb_voltage()

float furi_hal_power_get_usb_voltage ( void )

Get USB voltage in V.

Returns
voltage in V

◆ furi_hal_power_info_get()

void furi_hal_power_info_get ( PropertyValueCallback callback,
char sep,
void * context )

Get power information.

Parameters
[in]callbackcallback to provide with new data
[in]sepcategory separator character
[in]contextcontext to pass to callback

◆ furi_hal_power_insomnia_enter()

void furi_hal_power_insomnia_enter ( void )

Enter insomnia mode Prevents device from going to sleep.

Warning
Internally increases insomnia level Must be paired with furi_hal_power_insomnia_exit

◆ furi_hal_power_insomnia_exit()

void furi_hal_power_insomnia_exit ( void )

Exit insomnia mode Allow device to go to sleep.

Warning
Internally decreases insomnia level. Must be paired with furi_hal_power_insomnia_enter

◆ furi_hal_power_insomnia_level()

uint16_t furi_hal_power_insomnia_level ( void )

Get current insomnia level.

Returns
insomnia level: 0 - no insomnia, >0 - insomnia, bearer count.

◆ furi_hal_power_is_charging()

bool furi_hal_power_is_charging ( void )

Get charging status.

Returns
true if charging

◆ furi_hal_power_is_charging_done()

bool furi_hal_power_is_charging_done ( void )

Get charge complete status.

Returns
true if done charging and connected to charger

◆ furi_hal_power_is_otg_enabled()

bool furi_hal_power_is_otg_enabled ( void )

Get OTG status.

Returns
true if enabled

◆ furi_hal_power_is_shutdown_requested()

bool furi_hal_power_is_shutdown_requested ( void )

Check if gauge requests system shutdown.

Returns
true if system shutdown requested

◆ furi_hal_power_set_battery_charge_voltage_limit()

void furi_hal_power_set_battery_charge_voltage_limit ( float voltage)

Set battery charge voltage limit in V.

Invalid values will be clamped downward to the nearest valid value.

Parameters
[in]voltagevoltage in V

◆ furi_hal_power_sleep_available()

bool furi_hal_power_sleep_available ( void )

Check if sleep available.

Returns
true if available

◆ furi_hal_power_suppress_charge_enter()

void furi_hal_power_suppress_charge_enter ( void )

Enter supress charge mode.

Use this function when your application need clean power supply.