refactor: introduce special battery level value
This commit is contained in:
parent
9ef105522b
commit
0884db66e0
1 changed files with 5 additions and 2 deletions
|
@ -19,8 +19,11 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||||
#include <zmk/battery.h>
|
#include <zmk/battery.h>
|
||||||
#include <zmk/events/battery_state_changed.h>
|
#include <zmk/events/battery_state_changed.h>
|
||||||
|
|
||||||
static uint8_t last_state_of_charge = 0;
|
const uint8_t NULL_BATTERY_LEVEL = 0xFF;
|
||||||
static uint8_t last_state_of_peripheral_charge = 0;
|
|
||||||
|
// Initialize the charge level to a special value indicating no sampling has been made yet.
|
||||||
|
static uint8_t last_state_of_charge = NULL_BATTERY_LEVEL;
|
||||||
|
static uint8_t last_state_of_peripheral_charge = NULL_BATTERY_LEVEL;
|
||||||
|
|
||||||
static void blvl_ccc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value) {
|
static void blvl_ccc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value) {
|
||||||
ARG_UNUSED(attr);
|
ARG_UNUSED(attr);
|
||||||
|
|
Loading…
Add table
Reference in a new issue