SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
DeviceBeginCommon Class Referenceabstract

#include <DeviceBeginCommon.hpp>

Inheritance diagram for DeviceBeginCommon:
[legend]

Public Member Functions

virtual ~DeviceBeginCommon ()
 
uint8_t getAddress () const
 
uint8_t getInterface () const
 
- Public Member Functions inherited from SensorCommWrapper
 SensorCommWrapper ()=default
 
int readReg (uint8_t reg) const
 
int readRegBuff (uint8_t reg, uint8_t *buf, size_t len) const
 
int readBuff (uint8_t *buf, size_t len) const
 
int writeReg (uint8_t reg, uint8_t val)
 
int writeRegBuff (uint8_t reg, uint8_t *buf, size_t len)
 
int writeBuff (uint8_t *buf, size_t len)
 
int writeThenRead (const uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len)
 
bool setRegBit (uint8_t reg, uint8_t bit)
 
bool clrRegBit (uint8_t reg, uint8_t bit)
 
bool getRegBit (uint8_t reg, uint8_t bit)
 
int updateBits (uint8_t reg, uint8_t mask, uint8_t value_shifted)
 
void setAddress (uint8_t address)
 
void setAck (bool enable)
 
- Public Member Functions inherited from SensorCommInterface
virtual ~SensorCommInterface ()=default
 

Protected Member Functions

 DeviceBeginCommon ()=default
 
virtual bool initImpl (uint8_t param)=0
 
virtual bool ensureValid () const override
 
virtual SensorCommBasegetComm () const override
 
virtual void beforeBegin ()
 
virtual void afterCommReady ()
 
virtual void afterInitSuccess (uint8_t param)
 
virtual void onBeginFail ()
 
bool fail ()
 
void clearCommState ()
 
template<typename CreateComm >
bool beginLifecycle (uint8_t addr, uint8_t iface, uint8_t initParam, CreateComm createComm)
 

Protected Attributes

std::unique_ptr< SensorCommBasecomm
 
std::unique_ptr< SensorHalhal
 
std::unique_ptr< SensorCommStaticstaticComm
 
uint8_t _addr = 0
 
uint8_t _iface = COMM_CUSTOM
 

Detailed Description

Definition at line 34 of file DeviceBeginCommon.hpp.

Constructor & Destructor Documentation

◆ ~DeviceBeginCommon()

virtual DeviceBeginCommon::~DeviceBeginCommon ( )
inlinevirtual

Definition at line 37 of file DeviceBeginCommon.hpp.

References comm.

◆ DeviceBeginCommon()

DeviceBeginCommon::DeviceBeginCommon ( )
protecteddefault

Member Function Documentation

◆ afterCommReady()

virtual void DeviceBeginCommon::afterCommReady ( )
inlineprotectedvirtual

Definition at line 77 of file DeviceBeginCommon.hpp.

Referenced by beginLifecycle().

◆ afterInitSuccess()

virtual void DeviceBeginCommon::afterInitSuccess ( uint8_t  param)
inlineprotectedvirtual

Definition at line 80 of file DeviceBeginCommon.hpp.

Referenced by beginLifecycle().

◆ beforeBegin()

virtual void DeviceBeginCommon::beforeBegin ( )
inlineprotectedvirtual

Definition at line 72 of file DeviceBeginCommon.hpp.

Referenced by beginLifecycle().

◆ beginLifecycle()

template<typename CreateComm >
bool DeviceBeginCommon::beginLifecycle ( uint8_t  addr,
uint8_t  iface,
uint8_t  initParam,
CreateComm  createComm 
)
inlineprotected

◆ clearCommState()

void DeviceBeginCommon::clearCommState ( )
inlineprotected

Definition at line 92 of file DeviceBeginCommon.hpp.

References _addr, _iface, comm, COMM_CUSTOM, hal, and staticComm.

Referenced by beginLifecycle().

◆ ensureValid()

virtual bool DeviceBeginCommon::ensureValid ( ) const
inlineoverrideprotectedvirtual

◆ fail()

bool DeviceBeginCommon::fail ( )
inlineprotected

Definition at line 86 of file DeviceBeginCommon.hpp.

References onBeginFail().

Referenced by beginLifecycle().

◆ getAddress()

uint8_t DeviceBeginCommon::getAddress ( ) const
inline

Definition at line 44 of file DeviceBeginCommon.hpp.

References _addr.

◆ getComm()

virtual SensorCommBase * DeviceBeginCommon::getComm ( ) const
inlineoverrideprotectedvirtual

Implements SensorCommInterface.

Definition at line 64 of file DeviceBeginCommon.hpp.

References comm.

◆ getInterface()

uint8_t DeviceBeginCommon::getInterface ( ) const
inline

Definition at line 48 of file DeviceBeginCommon.hpp.

References _iface.

◆ initImpl()

virtual bool DeviceBeginCommon::initImpl ( uint8_t  param)
protectedpure virtual

◆ onBeginFail()

virtual void DeviceBeginCommon::onBeginFail ( )
inlineprotectedvirtual

Definition at line 83 of file DeviceBeginCommon.hpp.

Referenced by fail().

Member Data Documentation

◆ _addr

◆ _iface

◆ comm

std::unique_ptr<SensorCommBase> DeviceBeginCommon::comm
protected

Definition at line 127 of file DeviceBeginCommon.hpp.

Referenced by ComplexDeviceWithHal::begin(), ComplexStaticDeviceWithHal::begin(), SPIDeviceWithHal::begin(), I2CDeviceNoHal::begin(), I2CDeviceWithHal::begin(), SensorQMI8658::calibration(), clearCommState(), SensorQMI8658::configAccelerometer(), SensorQMI8658::configActivityInterruptMap(), SensorQMI8658::configFIFO(), SensorQMI8658::configGyroscope(), SensorQMI8658::configMotion(), SensorQMI8658::configPedometer(), SensorQMI8658::configTap(), SensorQMI8658::configWakeOnMotion(), SensorQMI8658::disableAccelerometer(), SensorQMI8658::disableGyroscope(), SensorQMI8658::disableLockingMechanism(), SensorQMI8658::disableMotionDetect(), SensorQMI8658::disablePedometer(), SensorQMI8658::disableSyncSampleMode(), SensorQMI8658::disableTap(), SensorQMI8658::dumpCtrlRegister(), SensorQMI8658::enableAccelerometer(), SensorQMI8658::enableDataReadyINT(), SensorQMI8658::enableGyroscope(), SensorQMI8658::enableINT(), SensorQMI8658::enableLockingMechanism(), SensorQMI8658::enableMotionDetect(), SensorQMI8658::enablePedometer(), SensorQMI8658::enableSyncSampleMode(), SensorQMI8658::enableTap(), ComplexDeviceWithHal::ensureValid(), ComplexStaticDeviceWithHal::ensureValid(), ensureValid(), I2CDeviceWithHal::ensureValid(), SPIDeviceWithHal::ensureValid(), SensorQMI8658::getAccelRaw(), SensorQMI8658::getChipID(), getComm(), SensorQMI8658::getDataReady(), SensorQMI8658::getGyroRaw(), SensorQMI8658::getIrqStatus(), SensorQMI8658::getPedometerCounter(), SensorQMI8658::getStatusRegister(), SensorQMI8658::getTapStatus(), SensorQMI8658::getTemperature_C(), SensorQMI8658::getTimestamp(), SensorQMI8658::initImpl(), SensorQMI8658::powerDown(), SensorQMI8658::powerOn(), GaugeAXP2602::refresh(), SensorQMI8658::reset(), SensorQMI8658::selfTestAccel(), SensorQMI8658::selfTestGyro(), SensorQMI8658::setAccelOffset(), SensorQMI8658::setGyroOffset(), SensorQMI8658::update(), SensorQMI8658::whoAmI(), SensorQMI8658::writeCalibration(), and ~DeviceBeginCommon().

◆ hal

std::unique_ptr<SensorHal> DeviceBeginCommon::hal
protected
Examples
/home/runner/work/SensorLib/SensorLib/src/sensor/accelerometer/bma/SensorBMA4XX.hpp.

Definition at line 128 of file DeviceBeginCommon.hpp.

Referenced by HapticDriver_DRV2605::autoCal(), ComplexDeviceWithHal::begin(), ComplexStaticDeviceWithHal::begin(), SPIDeviceWithHal::begin(), I2CDeviceWithHal::begin(), SensorQMI8658::calibrate(), SensorQMI8658::calibration(), clearCommState(), GaugeAXP2602::clearIRQStatus(), SensorQMI8658::configWakeOnMotionAdvanced(), AXP517Core::delayMs(), AXP517Core::digitalRead(), TouchDrvCST816::disableAutoSleep(), TouchDrvCST816::enableAutoSleep(), ComplexDeviceWithHal::ensureValid(), ComplexStaticDeviceWithHal::ensureValid(), I2CDeviceWithHal::ensureValid(), SPIDeviceWithHal::ensureValid(), SensorQMI8658::getDataReady(), GaugeBQ27220::getOperationConfig(), SensorQMI8658::hardwareSelfTest(), SensorQMI8658::initImpl(), SensorQMI8658::isDataReady(), TouchDrvInterface::isPressed(), HapticDriver_AW86224::loadRamData(), HapticDriver_AW86224::longVibration(), AXP517Core::millis(), AXP517Core::pinMode(), HapticDriver_AW86224::playEffectAsync(), HapticDriver_AW86224::playRtp(), SensorQMI8658::readFromFifo(), TouchDrvInterface::reset(), GaugeAXP2602::reset(), SensorQMI8658::reset(), SensorBMM150::reset(), SensorQMC5883L::reset(), SensorQMC6309::reset(), SensorQSTMagnetic::reset(), TouchDrvCST226::reset(), SensorQMI8658::reset(), HapticDriver_AW86224::run(), SensorQMC6309::selfTest(), SensorQSTMagnetic::selfTest(), SensorQMI8658::selfTestAccel(), SensorQMI8658::selfTestGyro(), GaugeBQ27220::setNewCapacity(), SensorQMI8658::setPins(), HapticDriver_AW86224::shortVibration(), TouchDrvCST226::sleep(), TouchDrvCST3530::sleep(), TouchDrvCST92xx::sleep(), TouchDrvGT911::sleep(), TouchDrvGT9895::sleep(), HapticDriver_AW86224::softReset(), SensorQMI8658::update(), SensorBMA4XX::update(), HapticDriver_AW86224::vibrationUpdate(), TouchDrvCST3530::wakeup(), TouchDrvGT911::wakeup(), TouchDrvGT9895::wakeup(), SensorQMI8658::writeCommand(), and GaugeAXP2602::writeGaugeData().

◆ staticComm

std::unique_ptr<SensorCommStatic> DeviceBeginCommon::staticComm
protected

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