Perif class
#include <main/perif/Perif.hpp>
Contents
Abstract class for sensors. Used to manage all peripheral data and persistence.
Base classes
- class PerifBase
Derived classes
-
template<i2c_port_t port = I2C_NUM_0, bool sdaPullup = false, bool sclPullup = false, uint32_t frequency = 100000UL>class I2CPerif
- class GPIOPerif
-
template<i2c_port_t port = I2C_NUM_0, bool sdaPullup = false, bool sclPullup = false, uint32_t frequency = 100000UL>class I2CPerif
- class SPIPerif
- class UARTPerif
Constructors, destructors, conversion operators
Public functions
- auto begin() -> bool pure virtual
- auto isConnected() -> bool pure virtual
- void update()
Protected functions
- void updateData() pure virtual
- void representData() pure virtual
- auto getTimer() -> Timer&
Protected variables
Function documentation
perif:: Perif:: Perif(const char* name) explicit
| Parameters | |
|---|---|
| name | this sensor's name |
Explicit Value Constructor taking the name of this sensor.
perif:: Perif:: ~Perif() defaulted
Destructor.
bool perif:: Perif:: begin() pure virtual
| Returns | whether the peripheral initialization succeeded |
|---|
Performs initialization of a peripheral. Necessary to avoid initialization in the constructor which causes many side effects.
bool perif:: Perif:: isConnected() pure virtual
| Returns | if the sensor is connected |
|---|
Returns whether the sensor is connected or not.
void perif:: Perif:: update()
Performs a manual update of peripheral data and notifies observers.
void perif:: Perif:: updateData() pure virtual protected
Updates sensor data. Subclasses should maintain a reference to the data obtained from this function so it can be provided to observers.
void perif:: Perif:: representData() pure virtual protected
The representation of this peripheral's data in a meaningful way for debugging, caching, and database operations.