Skip to content

Class daisy::NeoTrellis

template <typename Transport>

ClassList > daisy > NeoTrellis

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

  • #include <neotrellis.h>

Classes

Type Name
struct Config

Public Types

Type Name
enum KeypadEdge
enum KeypadFuncAddRegs
enum ModuleBaseAddress
enum Result
enum StatusFuncAddRegs
typedef void(* TrellisCallback
union keyEvent
union keyEventRaw
union keyState

Public Attributes

Type Name
NeoPixelI2C pixels

Public Functions

Type Name
void ActivateKey (uint8_t x, uint8_t y, uint8_t edge, bool enable)
void EnableKeypadInterrupt ()
bool GetFalling (uint8_t idx)
uint8_t GetKeypadCount ()
bool GetRising (uint8_t idx)
bool GetState (uint8_t idx)
Result GetTransportError ()
Result Init (Config config)
NeoTrellis ()
void Process (bool polling=true)
uint8_t Read8 (uint8_t reg_high, uint8_t reg_low, int delay)
void ReadKeypad (keyEventRaw * buf, uint8_t count)
void ReadLen (uint8_t reg_high, uint8_t reg_low, uint8_t * buff, uint8_t len, int delay)
void RegisterCallback (uint8_t x, uint8_t y, TrellisCallback(*)(keyEvent) cb)
void SWReset ()
void SetKeypadEvent (uint8_t key, uint8_t edge, bool enable)
void UnregisterCallback (uint8_t x, uint8_t y)
void Write8 (uint8_t reg_high, uint8_t reg_low, uint8_t value)
~NeoTrellis ()

Detailed Description

Author:

beserge

Date:

December 2021

Public Types Documentation

enum KeypadEdge

enum daisy::NeoTrellis::KeypadEdge {
    HIGH = 0,
    LOW,
    FALLING,
    RISING
};

keypad module edge definitions


enum KeypadFuncAddRegs

enum daisy::NeoTrellis::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
};

keypad module function address registers


enum ModuleBaseAddress

enum daisy::NeoTrellis::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
};

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


enum Result

enum daisy::NeoTrellis::Result {
    OK = 0,
    ERR
};

enum StatusFuncAddRegs

enum daisy::NeoTrellis::StatusFuncAddRegs {
    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


typedef TrellisCallback

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

union keyEvent


extended key event stucture for keypad module


union keyEventRaw



union keyState


key state struct that will be written to seesaw chip keypad module


Public Attributes Documentation

variable pixels

NeoPixelI2C daisy::NeoTrellis< Transport >::pixels;

Public Functions Documentation

function ActivateKey

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

activate or deactivate a given key event

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.

function EnableKeypadInterrupt

inline void daisy::NeoTrellis::EnableKeypadInterrupt () 

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


function GetFalling

inline bool daisy::NeoTrellis::GetFalling (
    uint8_t idx
) 

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

Parameters:

  • idx Key to check

Returns:

True if just released, false otherwise


function GetKeypadCount

inline uint8_t daisy::NeoTrellis::GetKeypadCount () 

Get the number of events currently in the fifo

Returns:

the number of events in the fifo


function GetRising

inline bool daisy::NeoTrellis::GetRising (
    uint8_t idx
) 

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

Parameters:

  • idx Key to check

Returns:

True if just pressed, false otherwise


function GetState

inline bool daisy::NeoTrellis::GetState (
    uint8_t idx
) 

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

Parameters:

  • idx Key to check

Returns:

True if pressed, false otherwise


function GetTransportError

inline Result daisy::NeoTrellis::GetTransportError () 

Get and reset the transport error flag

Returns:

Whether the transport has errored since the last check


function Init

inline Result daisy::NeoTrellis::Init (
    Config config
) 

Initialize the NeoTrellis device

Parameters:

  • config Configuration settings

function NeoTrellis

inline daisy::NeoTrellis::NeoTrellis () 

function Process

inline void daisy::NeoTrellis::Process (
    bool polling=true
) 

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

Parameters:

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

function Read8

inline uint8_t daisy::NeoTrellis::Read8 (
    uint8_t reg_high,
    uint8_t reg_low,
    int delay
) 

Reads an 8 bit value

Parameters:

  • reg the register address to read from

Returns:

the data uint8_t read from the device


function ReadKeypad

inline void daisy::NeoTrellis::ReadKeypad (
    keyEventRaw * buf,
    uint8_t count
) 

function ReadLen

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

function RegisterCallback

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

register a callback for a key addressed by key index.

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.

function SWReset

inline void daisy::NeoTrellis::SWReset () 

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


function SetKeypadEvent

inline void daisy::NeoTrellis::SetKeypadEvent (
    uint8_t key,
    uint8_t edge,
    bool enable
) 

activate or deactivate a key and edge on the keypad module

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.

function UnregisterCallback

inline void daisy::NeoTrellis::UnregisterCallback (
    uint8_t x,
    uint8_t y
) 

Unregister a callback for a key addressed by key index.

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.

function Write8

inline void daisy::NeoTrellis::Write8 (
    uint8_t reg_high,
    uint8_t reg_low,
    uint8_t value
) 

Writes an 8 bit value

Parameters:

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

function ~NeoTrellis

inline daisy::NeoTrellis::~NeoTrellis () 


The documentation for this class was generated from the following file external-docs/libDaisy/src/dev/neotrellis.h