Skip to content

daisy::NeoTrellis

Module: External

Device support for the Adafruit Neotrellis device. More...

#include <neotrellis.h>

Public Classes

Name
struct Config
union keyEvent
union keyEventRaw
union keyState

Public Types

Name
enum ModuleBaseAddress
enum KeypadFuncAddRegs
enum StatusFuncAddRegs
enum KeypadEdge
enum Result
typedef void(*)(keyEvent evt) TrellisCallback

Public Functions

Name
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(*)(keyEvent) cb)
void UnregisterCallback(uint8_t x, uint8_t y)

Public Attributes

Detailed Description

template <typename Transport >
class daisy::NeoTrellis;

Device support for the Adafruit Neotrellis device.

Author: beserge

Date: December 2021

Public Types Documentation

enum ModuleBaseAddress

Enumerator Value Description
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

Module Base Addreses The module base addresses for different seesaw modules.

enum KeypadFuncAddRegs

Enumerator Value Description
SEESAW_KEYPAD_STATUS 0x00
SEESAW_KEYPAD_EVENT 0x01
SEESAW_KEYPAD_INTENSET 0x02
SEESAW_KEYPAD_INTENCLR 0x03
SEESAW_KEYPAD_COUNT 0x04
SEESAW_KEYPAD_FIFO 0x10

keypad module function address registers

enum StatusFuncAddRegs

Enumerator Value Description
SEESAW_STATUS_HW_ID 0x01
SEESAW_STATUS_VERSION 0x02
SEESAW_STATUS_OPTIONS 0x03
SEESAW_STATUS_TEMP 0x04
SEESAW_STATUS_SWRST 0x7F

status module function address registers

enum KeypadEdge

Enumerator Value Description
HIGH 0
LOW
FALLING
RISING

keypad module edge definitions

enum Result

Enumerator Value Description
OK 0
ERR

typedef TrellisCallback

typedef void(* daisy::NeoTrellis< Transport >::TrellisCallback) (keyEvent evt);

Public Functions Documentation

function NeoTrellis

inline NeoTrellis()

function ~NeoTrellis

inline ~NeoTrellis()

function Init

inline Result Init(
    Config config
)

Parameters:

  • config Configuration settings

Initialize the NeoTrellis device


function Write8

inline void Write8(
    uint8_t reg_high,
    uint8_t reg_low,
    uint8_t value
)

Parameters:

  • reg the register address to write to
  • value the value to write to the register

Writes an 8 bit value


function Read8

inline uint8_t Read8(
    uint8_t reg_high,
    uint8_t reg_low,
    int delay
)

Parameters:

  • reg the register address to read from

Return: the data uint8_t read from the device

Reads an 8 bit value


function ReadLen

inline void ReadLen(
    uint8_t reg_high,
    uint8_t reg_low,
    uint8_t * buff,
    uint8_t len,
    int delay
)

function GetTransportError

inline Result GetTransportError()

Return: Whether the transport has errored since the last check

Get and reset the transport error flag


function SWReset

inline void SWReset()

Perform a software reset. This resets all seesaw registers to their default values. This is called automatically from Init().


function ActivateKey

inline void ActivateKey(
    uint8_t x,
    uint8_t y,
    uint8_t edge,
    bool enable
)

Parameters:

  • 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.

activate or deactivate a given key event


function Process

inline void Process(
    bool polling =true
)

Parameters:

  • polling pass true if the interrupt pin is not being used, false if it is. Defaults to true.

read all events currently stored in the seesaw fifo and call any callbacks.


function GetState

inline bool GetState(
    uint8_t idx
)

Parameters:

  • idx Key to check

Return: True if pressed, false otherwise

Is this key currently pressed or released? Updated via the Process() function.


function GetRising

inline bool GetRising(
    uint8_t idx
)

Parameters:

  • idx Key to check

Return: True if just pressed, false otherwise

Has this key just been pressed? (aka rising edge) Updated via the Process() function.


function GetFalling

inline bool GetFalling(
    uint8_t idx
)

Parameters:

  • idx Key to check

Return: True if just released, false otherwise

Has this key just been released? (aka falling edge) Updated via the Process() function.


function ReadKeypad

inline void ReadKeypad(
    keyEventRaw * buf,
    uint8_t count
)

function GetKeypadCount

inline uint8_t GetKeypadCount()

Return: the number of events in the fifo

Get the number of events currently in the fifo


function SetKeypadEvent

inline void SetKeypadEvent(
    uint8_t key,
    uint8_t edge,
    bool enable
)

Parameters:

  • 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.

activate or deactivate a key and edge on the keypad module


function EnableKeypadInterrupt

inline void EnableKeypadInterrupt()

Enable the keypad interrupt that fires when events are in the fifo.


function RegisterCallback

inline void RegisterCallback(
    uint8_t x,
    uint8_t y,
    TrellisCallback(*)(keyEvent) cb
)

Parameters:

  • 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.

register a callback for a key addressed by key index.


function UnregisterCallback

inline void UnregisterCallback(
    uint8_t x,
    uint8_t y
)

Parameters:

  • 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.

Unregister a callback for a key addressed by key index.


Public Attributes Documentation

variable pixels

NeoPixelI2C pixels;

Updated on 2024-01-03 at 19:41:01 +0000