#include <include/modem/modem_battery.h>
Function for retrieving the latest voltage measured automatically during modem wakeup or reception. During modem inactivity, the modem measures battery voltage when this function is called.
- Note
- This function sends the Nordic-proprietary
XVBAT
command that reads battery voltage. When the modem is active (either LTE communication or GNSS receiver), the XVBAT
command returns the latest voltage measured automatically during modem wakeup or reception. The voltage measured during transmission is not reported. During modem inactivity, the modem measures battery voltage when the XVBAT
command is received.
- Parameters
-
[out] | battery_voltage | Pointer to the variable for battery voltage. Battery voltage in mV, with a resolution of 4mV. |
- Return values
-
0 | if successful. |
-EINVAL | if input argument was invalid. |
-EFAULT | if AT command failed. |