Boboter
Loading...
Searching...
No Matches
Device::Battery Class Reference

#include <battery.h>

Public Member Functions

 Battery (Robot &robot)
 ~Battery ()
void initialize ()
 Configures the needed ADC channel.
void update ()
 Read and calculate current battery state.
int8_t get_percentage () const
 Returns the current battery percentage in percent.
uint16_t get_millivolts () const
 Returns the current battery voltage.

Constructor & Destructor Documentation

◆ Battery()

Device::Battery::Battery ( Robot & robot)
explicit

◆ ~Battery()

Device::Battery::~Battery ( )

Member Function Documentation

◆ get_millivolts()

uint16_t Device::Battery::get_millivolts ( ) const
inlinenodiscard

Returns the current battery voltage.

Returns
The voltage in millivolts

◆ get_percentage()

int8_t Device::Battery::get_percentage ( ) const
inlinenodiscard

Returns the current battery percentage in percent.

Note
The percentage can go negative if the measured voltage drops below 3300 mV
Returns
The current percentage from ~0% and up to 100%

◆ initialize()

void Device::Battery::initialize ( )

Configures the needed ADC channel.

◆ update()

void Device::Battery::update ( )

Read and calculate current battery state.


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