Loading...
Searching...
No Matches
backup battery monitoring

Driver to monitor the internal backup battery status. More...

Detailed Description

Driver to monitor the internal backup battery status.

The backup battery must be connected with the VBAT pin and GND. On most development boards you will have to remove a solder bridge that connects VDD with VBAT. The battery is used to retain the backup domain register and RTC register content while power (VDD) is off.

The actual driver is implemented as a CPU feature. A board that supports backup battery monitoring via ADC, must #define VBAT_ADC ADC_LINE(x), where x is the index of the internal VBAT ADC line in adc_config[] in periph_conf.h.

Files

file  vbat.h
 Interface of backup battery (VBAT) monitoring.
 

Functions

int vbat_init (void)
 Initialize backup battery monitoring.
 
int32_t vbat_sample_mv (void)
 Sample backup battery.
 
bool vbat_is_empty (void)
 Sample the backup battery and compare the result with the minimum value required to power the backup domain.
 

Function Documentation

◆ vbat_init()

int vbat_init ( void  )

Initialize backup battery monitoring.

Return values
!=0: Failure
0Success

◆ vbat_is_empty()

bool vbat_is_empty ( void  )

Sample the backup battery and compare the result with the minimum value required to power the backup domain.

Return values
trueempty
falsenot empty

◆ vbat_sample_mv()

int32_t vbat_sample_mv ( void  )

Sample backup battery.

Returns
Backup battery load in mV