Power supply measurement#

Power supply measurement HW abstraction designed for Thunderboard.

Functions#

void
sl_power_supply_get_characteristics(uint8_t *type, float *voltage, float *ir)
float

Macros#

#define

Unknown power supply type.

#define

The board powered from the USB connector.

#define

The board powered from AA batteries.

#define

The board powered from AAA batteries.

#define

The board powered from a CR2032 battery.

Function Documentation#

sl_power_supply_probe#

void sl_power_supply_probe (void )
Parameters
N/A

Probe the connected supply and determine its type.

Note


Definition at line 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)
Parameters
[out]type

Supply type.

[out]voltage

Supply voltage.

[out]ir

Internal resistance of the supply.

Retrieve the supply characteristic variables.


Definition at line 62 of file common/power_supply/sl_power_supply.h

sl_power_supply_get_type#

uint8_t sl_power_supply_get_type (void )
Parameters
N/A

Getter for the power supply type.

Returns

  • Power supply type represented as an integer.


Definition at line 69 of file common/power_supply/sl_power_supply.h

sl_power_supply_is_low_power#

bool sl_power_supply_is_low_power (void )
Parameters
N/A

Checks if the current power supply has low power capability.

Returns

  • True if the supply is low power type, false otherwise.


Definition at line 76 of file common/power_supply/sl_power_supply.h

sl_power_supply_measure_voltage#

float sl_power_supply_measure_voltage (unsigned int avg)
Parameters
[in]avg

Number of measurements to average.

Measure the supply voltage by averaging multiple readings.

Returns

  • The measured voltage.


Definition at line 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 )
Parameters
N/A

Measure the battery level.

Returns

  • The estimated battery capacity level in percent.


Definition at line 91 of file common/power_supply/sl_power_supply.h

Macro Definition Documentation#

SL_POWER_SUPPLY_TYPE_UNKNOWN#

#define SL_POWER_SUPPLY_TYPE_UNKNOWN
Value:
0

Unknown power supply type.


Definition at line 42 of file common/power_supply/sl_power_supply.h

SL_POWER_SUPPLY_TYPE_USB#

#define SL_POWER_SUPPLY_TYPE_USB
Value:
1

The board powered from the USB connector.


Definition at line 43 of file common/power_supply/sl_power_supply.h

SL_POWER_SUPPLY_TYPE_AA#

#define SL_POWER_SUPPLY_TYPE_AA
Value:
2

The board powered from AA batteries.


Definition at line 44 of file common/power_supply/sl_power_supply.h

SL_POWER_SUPPLY_TYPE_AAA#

#define SL_POWER_SUPPLY_TYPE_AAA
Value:
3

The board powered from AAA batteries.


Definition at line 45 of file common/power_supply/sl_power_supply.h

SL_POWER_SUPPLY_TYPE_CR2032#

#define SL_POWER_SUPPLY_TYPE_CR2032
Value:
4

The board powered from a CR2032 battery.


Definition at line 46 of file common/power_supply/sl_power_supply.h