M5UnitUnified 0.0.2 git rev:a353e8c
|
Base class of unit component. More...
#include <M5UnitComponent.hpp>
Classes | |
struct | component_config_t |
Component basic settings for begin. More... | |
Public Member Functions | |
bool | generalCall (const uint8_t *data, const size_t len) |
General call for I2C. | |
virtual std::string | debugInfo () const |
Output information for debug. | |
Constructor | |
| |
Component (const uint8_t addr=0x00) | |
Component (const Component &)=delete | |
Component (Component &&) noexcept=default | |
Assignment | |
| |
Component & | operator= (const Component &)=delete |
Component & | operator= (Component &&) noexcept=default |
Component settings | |
component_config_t | component_config () |
Gets the common configurations in each unit. | |
void | component_config (const component_config_t &cfg) |
Set the common configurations in each unit. | |
Functions that must be inherited | |
virtual bool | begin () |
Begin unit. | |
virtual void | update (const bool force=false) |
Update unit. | |
Properties | |
const char * | deviceName () const |
Gets the device name. | |
types::uid_t | identifier () const |
Gets the identifier. | |
types::attr_t | attribute () const |
Gets the attributes. | |
uint32_t | order () const |
Gets the registered order (== 0 means not yet) | |
int16_t | channel () const |
Gets the channel if connected to another unit. | |
bool | isRegistered () const |
Is the unit registered with the manager? | |
uint8_t | address () const |
Address used to access the device. | |
Adapter * | adapter () const |
Gets the access adapter. | |
Periodic measurement | |
bool | inPeriodic () const |
In periodic measurement? | |
bool | updated () const |
Periodic measurement data updated? | |
types::elapsed_time_t | updatedMillis () const |
Time elapsed since start-up when the measurement data was updated in update() | |
types::elapsed_time_t | interval () const |
Gets the periodic measurement interval. | |
Bus assignment | |
virtual bool | assign (m5::hal::bus::Bus *bus) |
Assgin m5::hal::bus. | |
virtual bool | assign (TwoWire &wire) |
Assgin TwoWire. | |
Parent-children relationship | |
| |
bool | hasParent () const |
Has parent unit? | |
bool | hasSiblings () const |
Are there any other devices connected to the same parent unit besides yourself? | |
bool | hasChildren () const |
Are there other devices connected to me? | |
size_t | childrenSize () const |
Number of units connected to me. | |
bool | existsChild (const uint8_t ch) const |
Is there an other unit connected to the specified channel? | |
Component * | child (const uint8_t chhanle) const |
Gets the deviceconnected to the specified channel. | |
bool | add (Component &c, const int16_t channel) |
Connect the unit to the specified channel. | |
bool | selectChannel (const uint8_t ch=8) |
Select valid channel if exists. | |
Read/Write | |
m5::hal::error::error_t | readWithTransaction (uint8_t *data, const size_t len) |
Static Public Attributes | |
Fixed parameters for class | |
| |
static const types::uid_t | uid {0} |
Unique identifier. | |
static const types::attr_t | attr {0} |
Attributes. | |
static const char | name [] = "" |
Device name string. | |
Iterator for children | |
using | child_iterator = iterator<Component> |
using | const_child_iterator = iterator<const Component> |
child_iterator | childBegin () noexcept |
child_iterator | childEnd () noexcept |
const_child_iterator | childBegin () const noexcept |
const_child_iterator | childEnd () const noexcept |
Base class of unit component.
|
inline |
Gets the access adapter.
|
inlinevirtual |
Begin unit.
Initiate functions based on component config and unit config
|
inline |
Gets the periodic measurement interval.
|
inlinevirtual |
Update unit.
force | Forced communication for updates if true |
|
inline |
Time elapsed since start-up when the measurement data was updated in update()