Adafruit Library
Public Member Functions | Protected Attributes | List of all members
Adafruit_MultiTrellis Class Reference

Class that stores state and functions for interacting with multiple neotrellis boards. More...

#include <Adafruit_NeoTrellis.h>

Public Member Functions

 Adafruit_MultiTrellis (Adafruit_NeoTrellis *trelli, uint8_t rows, uint8_t cols)
 class constructor More...
 
bool begin ()
 begin communication with the matrix of neotrellis boards. More...
 
void registerCallback (uint16_t num, TrellisCallback(*cb)(keyEvent))
 register a callback for a key addressed by key number. More...
 
void registerCallback (uint8_t x, uint8_t y, TrellisCallback(*cb)(keyEvent))
 register a callback for a key addressed by key index. More...
 
void unregisterCallback (uint16_t num)
 Unregister a callback for a key addressed by key number. More...
 
void unregisterCallback (uint8_t x, uint8_t y)
 Unregister a callback for a key addressed by key index. More...
 
void activateKey (uint16_t num, uint8_t edge, bool enable=true)
 Activate or deactivate a key by number. More...
 
void activateKey (uint8_t x, uint8_t y, uint8_t edge, bool enable=true)
 Activate or deactivate a key by number. More...
 
void setPixelColor (uint8_t x, uint8_t y, uint32_t color)
 set the color of a neopixel at a key index. More...
 
void setPixelColor (uint16_t num, uint32_t color)
 set the color of a neopixel at a key number. More...
 
void show ()
 call show for all connected neotrellis boards to show all neopixels
 
void read ()
 read all events currently stored in the seesaw fifo and call any callbacks.
 

Protected Attributes

uint8_t _rows
 the number of trellis boards in the Y direction
 
uint8_t _cols
 the number of trellis boards in the X direction
 
Adafruit_NeoTrellis_trelli
 a multidimensional array of neotrellis objects
 

Detailed Description

Class that stores state and functions for interacting with multiple neotrellis boards.

Constructor & Destructor Documentation

◆ Adafruit_MultiTrellis()

Adafruit_MultiTrellis::Adafruit_MultiTrellis ( Adafruit_NeoTrellis trelli,
uint8_t  rows,
uint8_t  cols 
)

class constructor

Parameters
trellipointer to a multidimensional array of neotrellis objects. these object must have their I2C addresses specified in the class constructors.
rowsthe number of individual neotrellis boards in the Y direction of your matrix.
colsthe number of individual neotrellis boards in the X direction of your matrix.

Member Function Documentation

◆ begin()

bool Adafruit_MultiTrellis::begin ( )

begin communication with the matrix of neotrellis boards.

Returns
true on success, false otherwise.

◆ registerCallback() [1/2]

void Adafruit_MultiTrellis::registerCallback ( uint16_t  num,
TrellisCallback(*)(keyEvent cb 
)

register a callback for a key addressed by key number.

Parameters
numthe keynumber to set the color of. Key 0 is in the top left corner of the trellis matrix, key 1 is directly to the right of it, and the last key number is in the bottom righthand corner.
cbthe function to be called when an event from the specified key is detected.

◆ registerCallback() [2/2]

void Adafruit_MultiTrellis::registerCallback ( uint8_t  x,
uint8_t  y,
TrellisCallback(*)(keyEvent cb 
)

register a callback for a key addressed by key index.

Parameters
xthe column index of the key. column 0 is on the lefthand side of the matix.
ythe row index of the key. row 0 is at the top of the matrix and the numbers increase downwards.
cbthe function to be called when an event from the specified key is detected.

◆ unregisterCallback() [1/2]

void Adafruit_MultiTrellis::unregisterCallback ( uint16_t  num)

Unregister a callback for a key addressed by key number.

Parameters
numthe keynumber to set the color of. Key 0 is in the top left corner of the trellis matrix, key 1 is directly to the right of it, and the last key number is in the bottom righthand corner.

◆ unregisterCallback() [2/2]

void Adafruit_MultiTrellis::unregisterCallback ( uint8_t  x,
uint8_t  y 
)

Unregister a callback for a key addressed by key index.

Parameters
xthe column index of the key. column 0 is on the lefthand side of the matix.
ythe row index of the key. row 0 is at the top of the matrix and the numbers increase downwards.

◆ activateKey() [1/2]

void Adafruit_MultiTrellis::activateKey ( uint16_t  num,
uint8_t  edge,
bool  enable = true 
)

Activate or deactivate a key by number.

Parameters
numthe keynumber to set the color of. Key 0 is in the top left corner of the trellis matrix, key 1 is directly to the right of it, and the last key number is in the bottom righthand corner.
edgethe edge that the key triggers an event on. Use SEESAW_KEYPAD_EDGE_FALLING or SEESAW_KEYPAD_EDGE_RISING.
enablepass true to enable the key on the passed edge, false to disable.

◆ activateKey() [2/2]

void Adafruit_MultiTrellis::activateKey ( uint8_t  x,
uint8_t  y,
uint8_t  edge,
bool  enable = true 
)

Activate or deactivate a key by number.

Parameters
xthe column index of the key. column 0 is on the lefthand side of the matix.
ythe row index of the key. row 0 is at the top of the matrix and the numbers increase downwards.
edgethe edge that the key triggers an event on. Use SEESAW_KEYPAD_EDGE_FALLING or SEESAW_KEYPAD_EDGE_RISING.
enablepass true to enable the key on the passed edge, false to disable.

◆ setPixelColor() [1/2]

void Adafruit_MultiTrellis::setPixelColor ( uint8_t  x,
uint8_t  y,
uint32_t  color 
)

set the color of a neopixel at a key index.

Parameters
xthe column index of the key. column 0 is on the lefthand side of the matix.
ythe row index of the key. row 0 is at the top of the matrix and the numbers increase downwards.
colorthe color to set the pixel to. This is a 24 bit RGB value. for example, full brightness red would be 0xFF0000, and full brightness blue would be 0x0000FF.

◆ setPixelColor() [2/2]

void Adafruit_MultiTrellis::setPixelColor ( uint16_t  num,
uint32_t  color 
)

set the color of a neopixel at a key number.

Parameters
numthe keynumber to set the color of. Key 0 is in the top left corner of the trellis matrix, key 1 is directly to the right of it, and the last key number is in the bottom righthand corner.
colorthe color to set the pixel to. This is a 24 bit RGB value. for example, full brightness red would be 0xFF0000, and full brightness blue would be 0x0000FF.

The documentation for this class was generated from the following files: