5 #include "seesaw_neopixel.h" 8 #define NEO_TRELLIS_ADDR 0x2E 10 #define NEO_TRELLIS_NEOPIX_PIN 3 12 #define NEO_TRELLIS_NUM_ROWS 4 13 #define NEO_TRELLIS_NUM_COLS 4 14 #define NEO_TRELLIS_NUM_KEYS (NEO_TRELLIS_NUM_ROWS * NEO_TRELLIS_NUM_COLS) 16 #define NEO_TRELLIS_MAX_CALLBACKS 32 18 #define NEO_TRELLIS_KEY(x) (((x) / 4) * 8 + ((x) % 4)) 19 #define NEO_TRELLIS_SEESAW_KEY(x) (((x) / 8) * 4 + ((x) % 8)) 21 #define NEO_TRELLIS_X(k) ((k) % 4) 22 #define NEO_TRELLIS_Y(k) ((k) / 4) 24 #define NEO_TRELLIS_XY(x, y) ((y)*NEO_TRELLIS_NUM_COLS + (x)) 26 typedef void (*TrellisCallback)(
keyEvent evt);
37 TwoWire *i2c_bus = &Wire);
40 bool begin(uint8_t addr = NEO_TRELLIS_ADDR, int8_t flow = -1);
45 void activateKey(uint8_t key, uint8_t edge,
bool enable =
true);
47 void read(
bool polling =
true);
79 void activateKey(uint16_t num, uint8_t edge,
bool enable =
true);
80 void activateKey(uint8_t x, uint8_t y, uint8_t edge,
bool enable =
true);
82 void setPixelColor(uint8_t x, uint8_t y, uint32_t color);
83 void setPixelColor(uint16_t num, uint32_t color);
bool begin(uint8_t addr=NEO_TRELLIS_ADDR, int8_t flow=-1)
Begin communication with the RGB trellis.
Definition: Adafruit_NeoTrellis.cpp:29
Adafruit_NeoTrellis(uint8_t addr=NEO_TRELLIS_ADDR, TwoWire *i2c_bus=&Wire)
Class constructor.
Definition: Adafruit_NeoTrellis.cpp:10
uint8_t _rows
the number of trellis boards in the Y direction
Definition: Adafruit_NeoTrellis.h:89
Class that stores state and functions for interacting with multiple neotrellis boards.
Definition: Adafruit_NeoTrellis.h:66
void unregisterCallback(uint8_t key)
unregister a callback on a given key
Definition: Adafruit_NeoTrellis.cpp:62
Class that stores state and functions for interacting with seesaw helper IC.
Definition: Adafruit_seesaw.h:235
Class that stores state and functions for interacting with the seesaw keypad module.
Definition: Adafruit_NeoTrellis.h:34
uint8_t _addr
the I2C address of this board
Definition: Adafruit_NeoTrellis.h:55
uint8_t _cols
the number of trellis boards in the X direction
Definition: Adafruit_NeoTrellis.h:90
void activateKey(uint8_t key, uint8_t edge, bool enable=true)
activate or deactivate a given key event
Definition: Adafruit_NeoTrellis.cpp:74
void read(bool polling=true)
read all events currently stored in the seesaw fifo and call any callbacks.
Definition: Adafruit_NeoTrellis.cpp:86
Definition: Adafruit_seesaw.h:212
Adafruit_NeoTrellis * _trelli
a multidimensional array of neotrellis objects
Definition: Adafruit_NeoTrellis.h:92
TrellisCallback(* _callbacks[NEO_TRELLIS_NUM_KEYS])(keyEvent)
the array of callback functions
Definition: Adafruit_NeoTrellis.h:56
friend class Adafruit_MultiTrellis
Definition: Adafruit_NeoTrellis.h:51
void registerCallback(uint8_t key, TrellisCallback(*cb)(keyEvent))
register a callback function on the passed key.
Definition: Adafruit_NeoTrellis.cpp:51
seesaw_NeoPixel pixels
the onboard neopixel matrix
Definition: Adafruit_NeoTrellis.h:49