|
Loom
|
Multiplexer manager for interfacing with multiple I2C sensors. More...
#include <Multiplexer.h>

Public Member Functions | |
CONSTRUCTORS / DESTRUCTOR | |
| Loom_Multiplexer (LoomManager *manager, const byte i2c_address=0x71, const uint8_t num_ports=8, const bool dynamic_list=true, const uint update_period=5000) | |
| Multiplexer module constructor. More... | |
| Loom_Multiplexer (LoomManager *manager, JsonArrayConst p) | |
| Constructor that takes Json Array, extracts args and delegates to regular constructor. More... | |
| ~Loom_Multiplexer () | |
| Destructor. More... | |
OPERATION | |
| void | measure () |
| Call measure on all connected sensors. More... | |
| void | package (JsonObject json) override |
| Package a modules measurements or state. More... | |
| bool | dispatch (JsonObject) override |
| Route command to driver. More... | |
| void | get_sensor_list (JsonObject json) |
| Populate a bundle with a list of sensors currently attached. More... | |
| void | refresh_sensors () |
| Update sensor list. More... | |
| LoomI2CSensor * | get_sensor (uint8_t port) const |
| Get the sensor object for sensor on provided port. More... | |
| void | power_up () override |
| Turn on any hardware. More... | |
| void | power_down () override |
| Turn off any hardware. More... | |
PRINT INFORMATION | |
| void | print_config () const override |
| Display the configuration settings of the module. More... | |
| void | print_state () const override |
| Display current state of the module. More... | |
| void | print_measurements () const |
| Prints measurements of all connected sensors. More... | |
GETTERS | |
| bool | get_is_dynamic () const |
| Get whether or not sensors are updated dynamically. More... | |
| int | get_update_period () const |
| Get the sensor list update period. More... | |
SETTERS | |
| void | set_is_dynamic (const bool dynamic) |
| Set whether or not to periodically update list of attached sensors. More... | |
| void | set_update_period (const uint period) |
| Set the sensor list update period. More... | |
Public Member Functions inherited from LoomModule | |
| LoomModule (LoomManager *manager, const char *module_name="Unknown", const Type module_type=Type::Unknown) | |
| Constructor. More... | |
| virtual | ~LoomModule ()=default |
| Destructor. More... | |
| virtual void | second_stage_ctor () |
| Second stage construction. More... | |
| virtual void | add_config (JsonObject json) |
| Add configuration information to JsonObject. More... | |
| Type | get_module_type () const |
| Get module type. More... | |
| LoomManager * | get_device_manager () const |
| Get the device manager class if linked. More... | |
| void | get_module_name (char *buf) const |
| Copy module name into buffer. More... | |
| const char * | get_module_name () const |
| Get module name. More... | |
| Verbosity | get_print_verbosity () const |
| Get print verbosity. More... | |
| Verbosity | get_package_verbosity () const |
| Get package verbosity. More... | |
| bool | get_active () const |
| Get whether or not the module should be treated as active. More... | |
| Category | category () const |
| Get the category of the module. More... | |
| virtual void | link_device_manager (LoomManager *LM) |
| Add pointer back to device manager. More... | |
| void | set_print_verbosity (const Verbosity v) |
| Set print verbosity Controlls level of detail included in debug prints. More... | |
| void | set_package_verbosity (const Verbosity v) |
| Set package verbosity. More... | |
| void | set_active (const bool enable) |
| Set whether or not the module should be treated as active. More... | |
Protected Attributes | |
| LoomI2CSensor ** | sensors |
| Array of I2C sensor objects. More... | |
| byte | i2c_address |
| The multiplexer's I2C address. More... | |
| uint8_t | num_ports |
| The number of ports on the multiplexer. More... | |
| bool | dynamic_list |
| Whether or not sensor list is dynamic (refresh sensor list periodically) More... | |
| uint | update_period |
| Interval to update sensor list at. More... | |
| uint8_t | control_port |
| byte | control_address |
| unsigned long | last_update_time |
| When the sensor list was last updated. More... | |
| std::vector< byte > | i2c_conflicts |
| List of I2C address conflicts. More... | |
Protected Attributes inherited from LoomModule | |
| const Type | module_type |
| Module type. More... | |
| LoomManager * | device_manager |
| Pointer to manager. More... | |
| const String | module_name_base |
| The name of the module (Should have a DEFAULT but can be overriden if provided to constructor) More... | |
| const char * | module_name |
| bool | active |
| Whether or not the module should be treated as active. More... | |
| Verbosity | print_verbosity |
| Print verbosity. More... | |
| Verbosity | package_verbosity |
| Package verbosity. More... | |
Static Protected Attributes | |
| static const std::array< byte, 9 > | alt_addresses |
Multiplexer manager for interfacing with multiple I2C sensors.
| Loom_Multiplexer::Loom_Multiplexer | ( | LoomManager * | manager, |
| const byte | i2c_address = 0x71, |
||
| const uint8_t | num_ports = 8, |
||
| const bool | dynamic_list = true, |
||
| const uint | update_period = 5000 |
||
| ) |
Multiplexer module constructor.
| [in] | i2c_address | Set(Int) | <0x71> | {0x71} | I2C address |
| [in] | num_ports | Int | <8> | [1-8] | Number of ports available |
| [in] | dynamic_list | Bool | <true> | {true, false} | Whether or not to automatically check for new sensors |
| [in] | update_period | Int | <5000> | [500-30000] | The time between sensor list updates (if dynamic_list enabled) |
| Loom_Multiplexer::Loom_Multiplexer | ( | LoomManager * | manager, |
| JsonArrayConst | p | ||
| ) |
Constructor that takes Json Array, extracts args and delegates to regular constructor.
| [in] | p | The array of constuctor args to expand |
| Loom_Multiplexer::~Loom_Multiplexer | ( | ) |
Destructor.
|
inlineoverridevirtual |
Route command to driver.
Reimplemented from LoomModule.
|
inline |
Get whether or not sensors are updated dynamically.
|
inline |
Get the sensor object for sensor on provided port.
| void Loom_Multiplexer::get_sensor_list | ( | JsonObject | json | ) |
Populate a bundle with a list of sensors currently attached.
| [out] | json | Json object to populate with sensor list |
|
inline |
Get the sensor list update period.
| void Loom_Multiplexer::measure | ( | ) |
Call measure on all connected sensors.
|
overridevirtual |
Package a modules measurements or state.
| [out] | json | Object to put data into |
Implements LoomModule.
|
overridevirtual |
Turn off any hardware.
Reimplemented from LoomModule.
|
overridevirtual |
Turn on any hardware.
Reimplemented from LoomModule.
|
overridevirtual |
Display the configuration settings of the module.
Reimplemented from LoomModule.
| void Loom_Multiplexer::print_measurements | ( | ) | const |
Prints measurements of all connected sensors.
Calls implementations of LoomI2CSensor::print_measurements() const
|
overridevirtual |
Display current state of the module.
Reimplemented from LoomModule.
| void Loom_Multiplexer::refresh_sensors | ( | ) |
Update sensor list.
Polls all ports of multiplexer getting sensor on port (if any)
|
inline |
Set whether or not to periodically update list of attached sensors.
| [in] | dynamic | The setting to set |
|
inline |
Set the sensor list update period.
Requires dynamic_list to be enabled
| [in] | period | New update period |
|
staticprotected |
|
protected |
|
protected |
|
protected |
Whether or not sensor list is dynamic (refresh sensor list periodically)
|
protected |
The multiplexer's I2C address.
|
protected |
List of I2C address conflicts.
|
protected |
When the sensor list was last updated.
|
protected |
The number of ports on the multiplexer.
|
protected |
Array of I2C sensor objects.
|
protected |
Interval to update sensor list at.
1.8.11