Power supply measurement#
Power supply measurement HW abstraction designed for development boards with coin cell battery support, i.e. Thunderboard and Dev Kit. Not suitable for other applications.
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 )
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Probe the connected supply and determine its type.
Note
The results can be acquired with sl_power_supply_get_characteristics.
sl_power_supply_get_characteristics#
void sl_power_supply_get_characteristics (uint8_t * type, float * voltage, float * ir)
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t * | [out] | type | Supply type. |
float * | [out] | voltage | Supply voltage. |
float * | [out] | ir | Internal resistance of the supply. |
Retrieve the supply characteristic variables.
sl_power_supply_get_type#
uint8_t sl_power_supply_get_type (void )
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Getter for the power supply type.
Returns
Power supply type represented as an integer.
sl_power_supply_is_low_power#
bool sl_power_supply_is_low_power (void )
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Checks if the current power supply has low power capability.
Returns
True if the supply is low power type, false otherwise.
sl_power_supply_measure_voltage#
float sl_power_supply_measure_voltage (unsigned int avg)
Type | Direction | Argument Name | Description |
---|---|---|---|
unsigned int | [in] | avg | Number of measurements to average. |
Measure the supply voltage by averaging multiple readings.
Returns
The measured voltage.
sl_power_supply_get_battery_level#
uint8_t sl_power_supply_get_battery_level (void )
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Measure the battery level.
Returns
The estimated battery capacity level in percent.