cewkomator/firmware/src/keyboard.h

37 lines
666 B
C

#pragma once
/*
Keys, in order (counting from 1):
123A 456B 789C *0#D
value 0 indicates no key
*/
typedef uint8_t Key;
#define KEY_NONE 0
#define KEY_A 4
#define KEY_B 8
#define KEY_C 12
#define KEY_D 16
#define KEY_ASTERISK 13
#define KEY_HASH 15
extern const char *allKeys;
bool setupKeyboard();
/**
* Returns pressed key once upon its release
* or KEY_NONE if no key is pressed
*
* NOTE: Only one key can be pressed at a time;
* if multiple keys are pressed, the behavior is undefined
*/
Key handleKeyboard();
/**
* Returns pressed digit or -1 if the key is not a digit
*/
int8_t getPressedDigit(Key key);
Key handleDebugKeyboard(char key);