BarPAT class
#include <main/devices/BarPAT/BarPAT.h>
Contents
A barometric pressure/temperature sensor. TODO add altitude for upgraded mpl3115A2 sensor
Base classes
-
template<i2c_port_t port = I2C_NUM_0, bool sdaPullup = false, bool sclPullup = false, uint32_t frequency = 100000UL>class I2CPerif
Constructors, destructors, conversion operators
- BarPAT(uint8_t address = 0x60) explicit
Public functions
- auto begin() -> bool override
- auto isConnected() -> bool override
- void update()
- void registerHook(function<void(DevMap&)>&& hook)
Public variables
Protected functions
Protected variables
Private functions
- void updateData() override
- void representData() override
Function documentation
perif:: BarPAT:: BarPAT(uint8_t address = 0x60) explicit
| Parameters | |
|---|---|
| address | the I2C address |
Explicit value constructor for MPL115A2 sensor.
bool perif:: BarPAT:: begin() override
| 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:: BarPAT:: isConnected() override
#include <main/perif/I2CPerif.hpp>
| Returns | if the I2C port is initialized |
|---|
Whether this I2C port is initialized.
void perif:: BarPAT:: update()
#include <main/perif/Perif.hpp>
Performs a manual update of peripheral data and notifies observers.
void perif:: BarPAT:: registerHook(function<void(DevMap&)>&& hook)
#include <main/perif/Perif.hpp>
| Parameters | |
|---|---|
| hook | the observer function |
Registers a hook for obtaining sensor data on update in Json format.
Timer& perif:: BarPAT:: getTimer() protected
#include <main/perif/Perif.hpp>
| Returns | a timer reference |
|---|
Obtains a reference to this peripheral's timer.
void perif:: BarPAT:: updateData() override private
Updates sensor data. Subclasses should maintain a reference to the data obtained from this function so it can be provided to observers.
void perif:: BarPAT:: representData() override private
The representation of this peripheral's data in a meaningful way for debugging, caching, and database operations.
Variable documentation
DevMap perif:: BarPAT:: data
#include <main/perif/Perif.hpp>
The key-value mapping of peripheral data.
list<function<void(DevMap&)>> perif:: BarPAT:: hooks
#include <main/perif/Perif.hpp>
Hooks registered to this peripheral so observers can be notified of any necessary changes.
uint8_t perif:: BarPAT:: address protected
#include <main/perif/I2CPerif.hpp>
the address for this i2c device
Timer perif:: BarPAT:: timer protected
#include <main/perif/Perif.hpp>
A timer for managing peripheral updates.