Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
hdw-battmon.c File Reference

Functions

void initBattmon (gpio_num_t gpio)
 Initialize a oneshot analog-to-digital unit to read the battery voltage.
 
void deinitBattmon (void)
 Deinitialize the analog-to-digital unit used to read the battery voltage.
 
void powerDownBattmon (void)
 Power down the battery monitor.
 
void powerUpBattmon (void)
 Power up the battery monitor.
 
int readBattmon (void)
 Read and return the battery voltage.
 

Function Documentation

◆ initBattmon()

void initBattmon ( gpio_num_t gpio)

Initialize a oneshot analog-to-digital unit to read the battery voltage.

Parameters
gpioThe GPIO to initialize the ADC on

◆ deinitBattmon()

void deinitBattmon ( void )

Deinitialize the analog-to-digital unit used to read the battery voltage.

◆ powerDownBattmon()

void powerDownBattmon ( void )

Power down the battery monitor.

◆ powerUpBattmon()

void powerUpBattmon ( void )

Power up the battery monitor.

◆ readBattmon()

int readBattmon ( void )

Read and return the battery voltage.

Returns
The voltage if read, or -1 if there was an error