OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
Loading...
Searching...
No Matches
MAX1704x Class Reference

MAX1704x chips for battery monitoring. More...

#include <BatteryMonitorHardware.hpp>

Public Member Functions

 MAX1704x (I2CBus bus=I2CBus::PRIMARY, uint8_t i2c_address=0xFF)
 Construct a new MAX1704x object.
 
virtual ~MAX1704x ()
 Destroy the MAX1704x object.
 
virtual void onStart () override
 Called once when the battery monitor daemon is started.
 
- Public Member Functions inherited from BatteryMonitorInterface
virtual void getStatus (BatteryStatus &currentStatus)
 Get the battery status.
 

Protected Member Functions

bool read (uint8_t regAddress, uint16_t &value)
 Read from a register.
 
bool write (uint8_t regAddress, uint16_t value)
 Write to a register.
 
bool quickStart ()
 Send a quick start command.
 
virtual bool read_soc (uint8_t &currentSoC) override
 Retrieve the current state of charge.
 
- Protected Member Functions inherited from BatteryMonitorInterface

Protected Attributes

void * device = nullptr
 I2C slave device (must be type-casted)
 

Detailed Description

MAX1704x chips for battery monitoring.

Definition at line 156 of file BatteryMonitorHardware.hpp.

Constructor & Destructor Documentation

◆ MAX1704x()

MAX1704x::MAX1704x ( I2CBus bus = I2CBus::PRIMARY,
uint8_t i2c_address = 0xFF )

Construct a new MAX1704x object.

Parameters
busI2C bus where the chip is attached
i2c_address7-bit full I2C address. Set to 0xFF to use a default address.

Member Function Documentation

◆ onStart()

virtual void MAX1704x::onStart ( )
inlineoverridevirtual

Called once when the battery monitor daemon is started.

Reimplemented from BatteryMonitorInterface.

Definition at line 205 of file BatteryMonitorHardware.hpp.

◆ quickStart()

bool MAX1704x::quickStart ( )
protected

Send a quick start command.

Returns
true On success
false On failure

◆ read()

bool MAX1704x::read ( uint8_t regAddress,
uint16_t & value )
protected

Read from a register.

Parameters
regAddressRegister address
valueRegister value
Returns
true On success
false On failure

◆ read_soc()

virtual bool MAX1704x::read_soc ( uint8_t & soc)
overrideprotectedvirtual

Retrieve the current state of charge.

Parameters
[out]socState of charge. Higher than 101 if the battery is charging at constant voltage.
Returns
true If soc was retrieved with success
false If there is no battery or soc is unknown

Implements BatteryMonitorInterface.

◆ write()

bool MAX1704x::write ( uint8_t regAddress,
uint16_t value )
protected

Write to a register.

Parameters
regAddressRegister address
valueValue to write
Returns
true On success
false On failure

Member Data Documentation

◆ device

void* MAX1704x::device = nullptr
protected

I2C slave device (must be type-casted)

Definition at line 160 of file BatteryMonitorHardware.hpp.


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