Power supply measurement#
Power supply measurement HW abstraction designed for Thunderboard.
Functions#
Macros#
Unknown power supply type.
The board powered from the USB connector.
The board powered from AA batteries.
The board powered from AAA batteries.
The board powered from a CR2032 battery.
Function Documentation#
sl_power_supply_probe#
void sl_power_supply_probe (void )
N/A |
Probe the connected supply and determine its type.
Note
The results can be acquired with sl_power_supply_get_characteristics.
53
of file common/power_supply/sl_power_supply.h
sl_power_supply_get_characteristics#
void sl_power_supply_get_characteristics (uint8_t * type, float * voltage, float * ir)
[out] | type | Supply type. |
[out] | voltage | Supply voltage. |
[out] | ir | Internal resistance of the supply. |
Retrieve the supply characteristic variables.
62
of file common/power_supply/sl_power_supply.h
sl_power_supply_get_type#
uint8_t sl_power_supply_get_type (void )
N/A |
Getter for the power supply type.
Returns
Power supply type represented as an integer.
69
of file common/power_supply/sl_power_supply.h
sl_power_supply_is_low_power#
bool sl_power_supply_is_low_power (void )
N/A |
Checks if the current power supply has low power capability.
Returns
True if the supply is low power type, false otherwise.
76
of file common/power_supply/sl_power_supply.h
sl_power_supply_measure_voltage#
float sl_power_supply_measure_voltage (unsigned int avg)
[in] | avg | Number of measurements to average. |
Measure the supply voltage by averaging multiple readings.
Returns
The measured voltage.
84
of file common/power_supply/sl_power_supply.h
sl_power_supply_get_battery_level#
uint8_t sl_power_supply_get_battery_level (void )
N/A |
Measure the battery level.
Returns
The estimated battery capacity level in percent.
91
of file common/power_supply/sl_power_supply.h
Macro Definition Documentation#
SL_POWER_SUPPLY_TYPE_UNKNOWN#
#define SL_POWER_SUPPLY_TYPE_UNKNOWNValue:
0
Unknown power supply type.
42
of file common/power_supply/sl_power_supply.h
SL_POWER_SUPPLY_TYPE_USB#
#define SL_POWER_SUPPLY_TYPE_USBValue:
1
The board powered from the USB connector.
43
of file common/power_supply/sl_power_supply.h
SL_POWER_SUPPLY_TYPE_AA#
#define SL_POWER_SUPPLY_TYPE_AAValue:
2
The board powered from AA batteries.
44
of file common/power_supply/sl_power_supply.h
SL_POWER_SUPPLY_TYPE_AAA#
#define SL_POWER_SUPPLY_TYPE_AAAValue:
3
The board powered from AAA batteries.
45
of file common/power_supply/sl_power_supply.h
SL_POWER_SUPPLY_TYPE_CR2032#
#define SL_POWER_SUPPLY_TYPE_CR2032Value:
4
The board powered from a CR2032 battery.
46
of file common/power_supply/sl_power_supply.h