Device support for the Adafruit Neotrellis device. More...
Device support for the Adafruit Neotrellis device.
#include <neotrellis.h>
Classes | |
struct | Config |
union | keyEvent |
union | keyEventRaw |
union | keyState |
Public Types | |
enum | ModuleBaseAddress { SEESAW_STATUS_BASE = 0x00 , SEESAW_GPIO_BASE = 0x01 , SEESAW_SERCOM0_BASE = 0x02 , SEESAW_TIMER_BASE = 0x08 , SEESAW_ADC_BASE = 0x09 , SEESAW_DAC_BASE = 0x0A , SEESAW_INTERRUPT_BASE = 0x0B , SEESAW_DAP_BASE = 0x0C , SEESAW_EEPROM_BASE = 0x0D , SEESAW_NEOPIXEL_BASE = 0x0E , SEESAW_TOUCH_BASE = 0x0F , SEESAW_KEYPAD_BASE = 0x10 , SEESAW_ENCODER_BASE = 0x11 , SEESAW_SPECTRUM_BASE = 0x12 } |
enum | KeypadFuncAddRegs { SEESAW_KEYPAD_STATUS = 0x00 , SEESAW_KEYPAD_EVENT = 0x01 , SEESAW_KEYPAD_INTENSET = 0x02 , SEESAW_KEYPAD_INTENCLR = 0x03 , SEESAW_KEYPAD_COUNT = 0x04 , SEESAW_KEYPAD_FIFO = 0x10 } |
enum | StatusFuncAddRegs { SEESAW_STATUS_HW_ID = 0x01 , SEESAW_STATUS_VERSION = 0x02 , SEESAW_STATUS_OPTIONS = 0x03 , SEESAW_STATUS_TEMP = 0x04 , SEESAW_STATUS_SWRST = 0x7F } |
enum | KeypadEdge { HIGH = 0 , LOW , FALLING , RISING } |
enum | Result { OK = 0 , ERR } |
typedef void(* | TrellisCallback) (keyEvent evt) |
Public Member Functions | |
NeoTrellis () | |
~NeoTrellis () | |
Result | Init (Config config) |
void | Write8 (uint8_t reg_high, uint8_t reg_low, uint8_t value) |
uint8_t | Read8 (uint8_t reg_high, uint8_t reg_low, int delay) |
void | ReadLen (uint8_t reg_high, uint8_t reg_low, uint8_t *buff, uint8_t len, int delay) |
Result | GetTransportError () |
void | SWReset () |
void | ActivateKey (uint8_t x, uint8_t y, uint8_t edge, bool enable) |
void | Process (bool polling=true) |
bool | GetState (uint8_t idx) |
bool | GetRising (uint8_t idx) |
bool | GetFalling (uint8_t idx) |
void | ReadKeypad (keyEventRaw *buf, uint8_t count) |
uint8_t | GetKeypadCount () |
void | SetKeypadEvent (uint8_t key, uint8_t edge, bool enable) |
void | EnableKeypadInterrupt () |
void | RegisterCallback (uint8_t x, uint8_t y, TrellisCallback(*cb)(keyEvent)) |
void | UnregisterCallback (uint8_t x, uint8_t y) |
Public Attributes | |
NeoPixelI2C | pixels |
Module Base Addreses The module base addresses for different seesaw modules.
|
inline |
|
inline |
|
inline |
activate or deactivate a given key event
key | the key number to map the event to |
edge | the edge sensitivity of the event |
enable | pass true to enable the passed event, false to disable it. |
|
inline |
Enable the keypad interrupt that fires when events are in the fifo.
Has this key just been released? (aka falling edge) Updated via the Process() function.
idx | Key to check |
|
inline |
Get the number of events currently in the fifo
Has this key just been pressed? (aka rising edge) Updated via the Process() function.
idx | Key to check |
Is this key currently pressed or released? Updated via the Process() function.
idx | Key to check |
|
inline |
Get and reset the transport error flag
Initialize the NeoTrellis device
config | Configuration settings |
|
inline |
read all events currently stored in the seesaw fifo and call any callbacks.
polling | pass true if the interrupt pin is not being used, false if it is. Defaults to true. |
|
inline |
Reads an 8 bit value
reg | the register address to read from |
|
inline |
|
inline |
|
inline |
register a callback for a key addressed by key index.
x | the column index of the key. column 0 is on the lefthand side of the matix. |
y | the row index of the key. row 0 is at the top of the matrix and the numbers increase downwards. |
cb | the function to be called when an event from the specified key is detected. |
|
inline |
activate or deactivate a key and edge on the keypad module
key | the key number to activate |
edge | the edge to trigger on |
enable | passing true will enable the passed event, passing false will disable it. |
|
inline |
Perform a software reset. This resets all seesaw registers to their default values. This is called automatically from Init().
|
inline |
Unregister a callback for a key addressed by key index.
x | the column index of the key. column 0 is on the lefthand side of the matix. |
y | the row index of the key. row 0 is at the top of the matrix and the numbers increase downwards. |
|
inline |
Writes an 8 bit value
reg | the register address to write to |
value | the value to write to the register |
NeoPixelI2C daisy::NeoTrellis< Transport >::pixels |