PicoLowLevel
Loading...
Searching...
No Matches
Battery Class Reference

Class to measure battery level and status. More...

#include <Battery.h>

Public Member Functions

 Battery (byte pin=BAT_PIN, int r1=BAT_R1, int r2=BAT_R2)
 
float readVoltage ()
 Reads the current battery voltage.
 
float chargePercent ()
 Estimates the current battery charge.
 
bool charged ()
 Check the battery charge status.
 
bool USB ()
 Check if the Pico is being powered from the USB port.
 

Detailed Description

Class to measure battery level and status.

Constructor & Destructor Documentation

◆ Battery()

Battery::Battery ( byte  pin = BAT_PIN,
int  r1 = BAT_R1,
int  r2 = BAT_R2 
)
inline

Member Function Documentation

◆ charged()

bool Battery::charged ( )

Check the battery charge status.

Returns
true if the battery is still charged.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ chargePercent()

float Battery::chargePercent ( )

Estimates the current battery charge.

Returns
Battery charge percentage.
Here is the call graph for this function:

◆ readVoltage()

float Battery::readVoltage ( )

Reads the current battery voltage.

Returns
Battery voltage in volts.
Here is the caller graph for this function:

◆ USB()

bool Battery::USB ( )

Check if the Pico is being powered from the USB port.

Returns
true if USB is providing power

The documentation for this class was generated from the following files: