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

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

#include <Adafruit_NeoKey_1x4.h>

Public Member Functions

 Adafruit_MultiNeoKey1x4 (Adafruit_NeoKey_1x4 *neokeys, 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, NeoKey1x4Callback(*cb)(keyEvent))
 register a callback for a key addressed by key number. More...
 
void registerCallback (uint8_t x, uint8_t y, NeoKey1x4Callback(*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 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_NeoKey_1x4_neokeys
 a multidimensional array of neokey objects
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Adafruit_MultiNeoKey1x4()

Adafruit_MultiNeoKey1x4::Adafruit_MultiNeoKey1x4 ( Adafruit_NeoKey_1x4 neokeys,
uint8_t  rows,
uint8_t  cols 
)

class constructor

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

Member Function Documentation

◆ begin()

bool Adafruit_MultiNeoKey1x4::begin ( )

begin communication with the matrix of neotrellis boards.

Returns
true on success, false otherwise.

◆ registerCallback() [1/2]

void Adafruit_MultiNeoKey1x4::registerCallback ( uint16_t  num,
NeoKey1x4Callback(*)(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_MultiNeoKey1x4::registerCallback ( uint8_t  x,
uint8_t  y,
NeoKey1x4Callback(*)(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_MultiNeoKey1x4::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_MultiNeoKey1x4::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.

◆ setPixelColor() [1/2]

void Adafruit_MultiNeoKey1x4::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_MultiNeoKey1x4::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: