|
M5UnitUnified 0.2.0 git rev:9e1ffe1
|
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. | |
| types::category_t | category () const |
| Gets the category. | |
| 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 I2C access the device. | |
| Adapter * | adapter () const |
| Gets the access adapter. | |
| template<class T > | |
| auto | asAdapter (const Adapter::Type t) -> typename std::remove_cv< typename std::remove_pointer< T >::type >::type * |
| Gets the access adapter. | |
| template<class T > | |
| auto | asAdapter (const Adapter::Type t) const -> const typename std::remove_cv< typename std::remove_pointer< T >::type >::type * |
| Gets the device name. | |
Attributes | |
| bool | canAccessI2C () const |
| bool | canAccessGPIO () const |
| bool | canAccessUART () const |
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. | |
| virtual bool | assign (const int8_t rx_pin, const int8_t tx_pin) |
| Assgin GPIO. | |
| virtual bool | assign (HardwareSerial &serial) |
| Assgin UART. | |
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 * | parent () |
| Gets the parent unit. | |
| Component * | child (const uint8_t chhanle) const |
| Gets the device connected 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) |
| Read any data with transaction. | |
| template<typename Reg > | |
| bool | readRegister (const Reg reg, uint8_t *rbuf, const size_t len, const uint32_t delayMillis, const bool stop=true) |
| Read any data with transaction from register. | |
| template<typename Reg > | |
| bool | readRegister8 (const Reg reg, uint8_t &result, const uint32_t delayMillis, const bool stop=true) |
| Read byte with transaction from register. | |
| template<typename Reg > | |
| bool | readRegister16BE (const Reg reg, uint16_t &result, const uint32_t delayMillis, const bool stop=true) |
| Read word in big-endian order with transaction from register. | |
| template<typename Reg > | |
| bool | readRegister16LE (const Reg reg, uint16_t &result, const uint32_t delayMillis, const bool stop=true) |
| Read word in little-endian order with transaction from register. | |
| template<typename Reg > | |
| bool | readRegister32BE (const Reg reg, uint32_t &result, const uint32_t delayMillis, const bool stop=true) |
| Read dword in big-endian order with transaction from register. | |
| template<typename Reg > | |
| bool | readRegister32LE (const Reg reg, uint32_t &result, const uint32_t delayMillis, const bool stop=true) |
| Read dword in little-endian order with transaction from register. | |
| m5::hal::error::error_t | writeWithTransaction (const uint8_t *data, const size_t len, const bool stop=true) |
| Write any data with transaction. | |
| template<typename Reg > | |
| m5::hal::error::error_t | writeWithTransaction (const Reg reg, const uint8_t *data, const size_t len, const bool stop=true) |
| Write any data with transaction to register. | |
| template<typename Reg > | |
| bool | writeRegister (const Reg reg, const uint8_t *buf=nullptr, const size_t len=0U, const bool stop=true) |
| Write any data with transaction to register. | |
| template<typename Reg > | |
| bool | writeRegister8 (const Reg reg, const uint8_t value, const bool stop=true) |
| Write byte with transaction to register. | |
| template<typename Reg > | |
| bool | writeRegister16BE (const Reg reg, const uint16_t value, const bool stop=true) |
| Write word in big-endian order with transaction from register. | |
| template<typename Reg > | |
| bool | writeRegister16LE (const Reg reg, const uint16_t value, const bool stop=true) |
| Write word in little-endian order with transaction from register. | |
| template<typename Reg > | |
| bool | writeRegister32BE (const Reg reg, const uint32_t value, const bool stop=true) |
| Write dword in big-endian order with transaction from register. | |
| template<typename Reg > | |
| bool | writeRegister32LE (const Reg reg, const uint32_t value, const bool stop=true) |
| Write dword in little-endian order with transaction from register. | |
Static Public Attributes | |
Fixed parameters for class | |
| |
| static const types::uid_t | uid {} |
| Unique identifier. | |
| static const types::attr_t | attr {} |
| Attributes. | |
| static const char | name [] = "" |
| Device name string. | |
Protected Member Functions | |
| virtual const char * | unit_device_name () const =0 |
| virtual types::uid_t | unit_identifier () const =0 |
| virtual types::attr_t | unit_attribute () const =0 |
| virtual types::category_t | unit_category () const |
| virtual bool | in_periodic () const |
| virtual std::shared_ptr< Adapter > | ensure_adapter (const uint8_t) |
| virtual m5::hal::error::error_t | select_channel (const uint8_t) |
| size_t | stored_size () const |
| bool | add_child (Component *c) |
| bool | changeAddress (const uint8_t addr) |
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()