nRF Connect SDK API 2.8.99
|
int dult_battery_level_set | ( | const struct dult_user * | user, |
uint8_t | percentage_level ) |
#include <include/dult.h>
Set the current battery level.
This function sets the current battery level. The battery level is an optional feature in the DULT specification and this API must not be used when the
CONFIG_DULT_BATTERY
Kconfig is disabled.
If the
CONFIG_DULT_BATTERY
Kconfig is enabled, this function must be called to initialize the battery level after registering the DULT user with dult_user_register and before enabling DULT with dult_enable function. Subsequent calls to update the battery level are allowed in the enabled mode.
To keep the battery level information accurate, the user should set the battery level to the new value with the help of this API as soon as the device battery level changes.
The exact mapping of the battery percentage to the battery level as defined by the DULT specification in the ANOS is implementation-specific. The mapping configuration is controlled by the following Kconfig options:
CONFIG_DULT_BATTERY_LEVEL_CRITICAL_THR
,
CONFIG_DULT_BATTERY_LEVEL_LOW_THR
and
CONFIG_DULT_BATTERY_LEVEL_MEDIUM_THR
.
user | User structure used to authenticate the user. |
percentage_level | Battery level as a percentage [0-100%] |