Adafruit Keypad Library
Public Member Functions | List of all members
Adafruit_Keypad Class Reference

Class for interfacing GPIO with a diode-multiplexed keypad. More...

#include <Adafruit_Keypad.h>

Public Member Functions

 Adafruit_Keypad (byte *userKeymap, byte *row, byte *col, int numRows, int numCols)
 default constructor More...
 
 ~Adafruit_Keypad ()
 default destructor
 
void begin ()
 set all the pin modes and set up variables.
 
void tick ()
 read the array of switches and place any events in the buffer.
 
bool justPressed (byte key, bool clear=true)
 check if the given key has just been pressed since the last tick. More...
 
bool justReleased (byte key)
 check if the given key has just been released since the last tick. More...
 
bool isPressed (byte key)
 check if the given key is currently pressed More...
 
bool isReleased (byte key)
 check if the given key is currently released More...
 
int available ()
 check how many events are in the keypads buffer More...
 
keypadEvent read ()
 pop the next event off of the FIFO More...
 
void clear ()
 Clear out the event buffer and all the key states.
 

Detailed Description

Class for interfacing GPIO with a diode-multiplexed keypad.

Constructor & Destructor Documentation

◆ Adafruit_Keypad()

Adafruit_Keypad::Adafruit_Keypad ( byte *  userKeymap,
byte *  row,
byte *  col,
int  numRows,
int  numCols 
)

default constructor

Parameters
userKeymapa multidimensional array of key characters
rowan array of GPIO pins that are connected to each row of the keypad
colan array of GPIO pins that are connected to each column of the keypad
numRowsthe number of rows on the keypad
numColsthe number of columns on the keypad

Member Function Documentation

◆ justPressed()

bool Adafruit_Keypad::justPressed ( byte  key,
bool  clear = true 
)

check if the given key has just been pressed since the last tick.

Parameters
keythe name of the key to be checked
clearwhether to reset the state (default yes) post-check
Returns
true if it has been pressed, false otherwise.

◆ justReleased()

bool Adafruit_Keypad::justReleased ( byte  key)

check if the given key has just been released since the last tick.

Parameters
keythe name of the key to be checked
Returns
true if it has been released, false otherwise.

◆ isPressed()

bool Adafruit_Keypad::isPressed ( byte  key)

check if the given key is currently pressed

Parameters
keythe name of the key to be checked
Returns
true if it is currently pressed, false otherwise.

◆ isReleased()

bool Adafruit_Keypad::isReleased ( byte  key)

check if the given key is currently released

Parameters
keythe name of the key to be checked
Returns
true if it is currently released, false otherwise.

◆ available()

int Adafruit_Keypad::available ( )

check how many events are in the keypads buffer

Returns
the number of events currently in the buffer

◆ read()

keypadEvent Adafruit_Keypad::read ( )

pop the next event off of the FIFO

Returns
the next event in the FIFO

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