Loom_Digital class
Digital pin manager module.
Contents
Available digital pins 5, 6, 9, 10, 11, 12, A0(14), A1(15), A2(16), A3(17), A4(18), A5(19)
Base classes
- class LoomSensor
- Abstract root of Loom sensor modules hierarchy.
Protected variables
- bool pin_enabled
- Array of which pins are enabled.
- bool digital_vals
- Array of last read digital values.
CONSTRUCTORS / DESTRUCTOR
- Loom_Digital(LoomManager* manager, const bool enable5 = true, const bool enable6 = true, const bool enable9 = false, const bool enable10 = false, const bool enable11 = false, const bool enable12 = false, const bool enableA0 = false, const bool enableA1 = false, const bool enableA2 = false, const bool enableA3 = false, const bool enableA4 = false, const bool enableA5 = false)
- Digital manager module constructor.
- Loom_Digital(LoomManager* manager, JsonArrayConst p)
- Constructor that takes Json Array, extracts args and delegates to regular constructor.
- ~Loom_Digital() defaulted
- Destructor.
OPERATION
- void measure() override
- Take any relevant measurements.
- void package(JsonObject json) override
- Package a modules measurements or state.
- void add_config(JsonObject json) override
- Add configuration information to JsonObject.
PRINT INFORMATION
- void print_config() const override
- Display the configuration settings of the module.
- void print_measurements() const override
- Print the last set of measurements taken.
GETTERS
- auto get_digital_val(const uint8_t pin) const -> bool
- Get value on digital pin.
- auto get_pin_enabled(const uint8_t pin) const -> bool
- Get if pin is enabled in manager.
SETTERS
- static const uint8_t pin_nums
- Used to convert pin number to index in member arrays.
- void set_digital_val(const uint8_t pin, const bool state)
- Set digital value of pin.
- void set_pin_enabled(const uint8_t pin, const bool e)
- Set pin enable state in manager.
Function documentation
Loom_Digital:: Loom_Digital(LoomManager* manager,
const bool enable5 = true,
const bool enable6 = true,
const bool enable9 = false,
const bool enable10 = false,
const bool enable11 = false,
const bool enable12 = false,
const bool enableA0 = false,
const bool enableA1 = false,
const bool enableA2 = false,
const bool enableA3 = false,
const bool enableA4 = false,
const bool enableA5 = false)
Digital manager module constructor.
Parameters | |
---|---|
manager | |
enable5 in | Bool | <true> | {true, false} | Enable pin 5 for managing |
enable6 in | Bool | <true> | {true, false} | Enable pin 6 for managing |
enable9 in | Bool | <false> | {true, false} | Enable pin 9 for managing |
enable10 in | Bool | <false> | {true, false} | Enable pin 10 for managing |
enable11 in | Bool | <false> | {true, false} | Enable pin 11 for managing |
enable12 in | Bool | <false> | {true, false} | Enable pin 12 for managing |
enableA0 in | Bool | <false> | {true, false} | Enable pin A0 for managing |
enableA1 in | Bool | <false> | {true, false} | Enable pin A1 for managing |
enableA2 in | Bool | <false> | {true, false} | Enable pin A2 for managing |
enableA3 in | Bool | <false> | {true, false} | Enable pin A3 for managing |
enableA4 in | Bool | <false> | {true, false} | Enable pin A4 for managing |
enableA5 in | Bool | <false> | {true, false} | Enable pin A5 for managing |
Loom_Digital:: Loom_Digital(LoomManager* manager,
JsonArrayConst p)
Constructor that takes Json Array, extracts args and delegates to regular constructor.
Parameters | |
---|---|
manager | |
p in | The array of constuctor args to expand |
void Loom_Digital:: package(JsonObject json) override
Package a modules measurements or state.
Parameters | |
---|---|
json out | Object to put data into |
void Loom_Digital:: add_config(JsonObject json) override
Add configuration information to JsonObject.
Parameters | |
---|---|
json in | Json configuration object to add to |
LoomManager iterates over modules to build complete configuration
void Loom_Digital:: print_measurements() const override
Print the last set of measurements taken.
Does not package the data.
bool Loom_Digital:: get_digital_val(const uint8_t pin) const
Get value on digital pin.
Returns | True if HIGH, false if LOW |
---|
bool Loom_Digital:: get_pin_enabled(const uint8_t pin) const
Get if pin is enabled in manager.
Returns | Enable state of pin |
---|
void Loom_Digital:: set_digital_val(const uint8_t pin,
const bool state)
Set digital value of pin.
Parameters | |
---|---|
pin in | Pin to set value of |
state in | State to set pin to |
void Loom_Digital:: set_pin_enabled(const uint8_t pin,
const bool e)
Set pin enable state in manager.
Parameters | |
---|---|
pin in | Pin to set enable state of |
e in | Enable state to set to |