Loom_Neopixel class
Neopixel tri-color LED actuator module.
Contents
Base classes
- class LoomActuator
- Abstract base class of actuator modules.
Protected variables
- Adafruit_NeoPixel pixels
- Array of Neopixel instances to manage up to 3 Neopixels.
- bool pin_enabled
- Whether pins A0-A2 are enabled.
- uint8_t color_vals
- The associated color values (RGB) for each of the 3 Neopixels.
CONSTRUCTORS / DESTRUCTOR
- Loom_Neopixel(LoomManager* manager, const bool enableA0 = false, const bool enableA1 = false, const bool enableA2 = true)
- Constructor.
- Loom_Neopixel(LoomManager* manager, JsonArrayConst p)
- Constructor that takes Json Array, extracts args and delegates to regular constructor.
- ~Loom_Neopixel() defaulted
- Destructor.
OPERATION
- auto dispatch(JsonObject json) -> bool override
- Route command to driver.
- void add_config(JsonObject json) override
- Add configuration information to JsonObject.
- void set_color(const uint8_t port, const uint8_t chain_num, const uint8_t red, const uint8_t green, const uint8_t blue)
- Set Neopixel color.
PRINT INFORMATION
- void print_config() const override
- Display the configuration settings of the module.
- void print_state() const override
- Display current state of the module.
SETTERS
- void enable_pin(const uint8_t port, const bool state)
- enable or disable pin for use with Neopixel
Function documentation
Loom_ Neopixel:: Loom_Neopixel(LoomManager* manager,
const bool enableA0 = false,
const bool enableA1 = false,
const bool enableA2 = true)
Constructor.
Parameters | |
---|---|
manager | |
enableA0 in | Bool | <false> | {true, false} | Whether or not to use pin A0 for Neopixel |
enableA1 in | Bool | <false> | {true, false} | Whether or not to use pin A1 for Neopixel |
enableA2 in | Bool | <true> | {true, false} | Whether or not to use pin A2 for Neopixel |
Loom_ Neopixel:: Loom_Neopixel(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_ Neopixel:: 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_ Neopixel:: set_color(const uint8_t port,
const uint8_t chain_num,
const uint8_t red,
const uint8_t green,
const uint8_t blue)
Set Neopixel color.
Parameters | |
---|---|
port in | The port the Neopixel to control is on (0-2 corresponding to A0-A2) |
chain_num in | The Neopixel number if daisy-chained |
red in | The red value (0-255) |
green in | The green value (0-255) |
blue in | The blue value (0-255) |
void Loom_ Neopixel:: enable_pin(const uint8_t port,
const bool state)
enable or disable pin for use with Neopixel
Parameters | |
---|---|
port in | Port to configure (0-2) |
state in | Enable or disable |