ZUNO_SETUP_BATTERY_HANDLER()
By default Z-Uno automatically maps battery voltage from 2.8V–3.0V to 0%–100% measuring the voltage on the 3V pin. But sometimes Z-Uno us powered via step-up converters and measuring the voltage on 3V pin will not make any sense. In that case you can define your own handler for battery reports, measure a value on ADC pins or even read the value from another chip via UART/SPI/I2C. This getter function will be called each time Z-Uno needs to report battery value.
ZUNO_SETUP_BATTERY_HANDLER(user_battery_level_handler)
user_battery_level_handler
name of the function returning % value as a BYTE
Battery is reported only if device is configured as sleeping (ZUNO_SLEEPING_MODE_SLEEPING or ZUNO_SLEEPING_MODE_FREQUENTLY_AWAKE).
ZUNO_SETUP_BATTERY_HANDLER(my_battery_handler);
…
byte my_battery_handler() {
byte percents = …
return percents;
}
ZUNO_SETUP_BATTERY_LEVELS