3 #define KEYBOARD_WITH_PRESSED 4 #define KEYBOARD_WITH_REPEAT 5 #define KEYBOARD_WITH_LONG 6 #define KEYBOARD_WITH_RELEASE 24 #define KEYSCANPORT PORTB 25 #define KEYSCANDDR DDRB 26 #define KEYRETPORT PORTA 27 #define KEYRETPIN PINA 28 #define KEYRETDDR DDRA 29 #define KEY_SCANLINES 3 30 #define KEY_RETLINES 4 33 #define ROTBUTTON (PIND & (1<<PIND5)) 100 char rotChar=pgm_read_byte(&(
rotMatrix[rotIndex]));
167 #ifdef KEYBOARD_WITH_LONG 173 #ifdef KEYBOARD_WITH_REPEAT 187 #ifdef KEYBOARD_WITH_RELEASE PutCharReturn_t PutKey(KEY_CHAR_t c)
Puts a key into the keyboard buffer.
Definition: keyboard.c:152
uint8_t rot
Current value of the rotary encoder (0..3)
Definition: keyboard.c:86
#define KEY_SCANLINES
Number of Scan Lines.
Definition: keyboard.h:29
#define KEYRETPIN
Definition: keyboard.h:27
The return value of PutKey() if no space available. The Character has been discarded.
Definition: keyboard.h:51
static const uint8_t KEY_PRESSED_LONG
The Key is pressed for at least KEY_REPEAT_DELAY.
Definition: keyboard.h:14
uint8_t keyTimer[KEY_RETLINES *KEY_SCANLINES]
Starts counting at 0 as soon as a Key is pressed. Topped at KEY_REPEAT_DELAY.
Definition: keyboard.c:84
#define KEYSCANPORT
Definition: keyboard.h:24
The return value of Putkey() if the Key has been successfully placed in the Keyboard Queue.
Definition: keyboard.h:50
static const uint8_t KEY_ACTION_MASK
The upper two Bits of a Key are Flags.
Definition: keyboard.h:11
static const uint8_t KEY_REPEAT_RATE
Key is Repeated every n Calls to scanKeyboard()/KEY_SCANLINES.
Definition: keyboard.h:10
uint8_t keynum
Scancode of a key (0..11 or 255)
Definition: keyboard.c:78
uint8_t lastRot
Last value of the rotary encoder (0..3)
Definition: keyboard.c:85
#define ROTBUTTON
Definition: keyboard.h:33
uint8_t bufReadPtr
Read Pointer Index of the keyboard buffer. The buffer is defined to be empty if Read PTR == Write PTR...
Definition: keyboard.c:81
static void InitKeyboard()
Initializes the keyboard.
Definition: keyboard.h:71
uint8_t lastRotButton
Last value of the rotary encoder pushbutton (0 or 1)
Definition: keyboard.c:87
#define KEY_ENTER
The Enter/Yes Key.
Definition: keyboard.h:42
static void scanKeyboard()
Reads the Return Lines and sets the next Scan Line active.
Definition: keyboard.h:133
uint8_t scancnt
Counter for current scan line.
Definition: keyboard.c:77
static const uint8_t KEY_PRESSED
The Key has just been pressed.
Definition: keyboard.h:12
#define ROTPORT
Definition: keyboard.h:31
KEY_CHAR_t GetKey(void)
Gets the next key from the keyboard buffer.
Definition: keyboard.c:186
static const uint8_t KEY_REPEAT_DELAY
Key Repetition starts after n Calls to scanKeyboard()/KEY_SCANLINES.
Definition: keyboard.h:9
uint8_t KEY_CHAR_t
Definition: keyboard.h:17
const char decodeMatrix[]
uint8_t bufWritePtr
Write Pointer Index of the keyboard buffer. The buffer is defined to be empty if Read PTR == Write PT...
Definition: keyboard.c:82
static bool keyStat(void)
Returns True if Keystrokes are pending.
Definition: keyboard.h:60
volatile uint8_t keyboardLocked
Lock status of the keyboard.
Definition: keyboard.c:136
#define ROTPIN
Definition: keyboard.h:32
#define KEYSCANDDR
Definition: keyboard.h:25
const char rotMatrix[16]
Matrix for decoding the rotary encoder.
Definition: keyboard.c:99
static const uint8_t KEY_REPEAT
The Key is repeated due to long press time.
Definition: keyboard.h:13
uint8_t rotButton
Current value of the rotary encoder pushbutton (0 or 1)
Definition: keyboard.c:88
#define KEYRETPORT
Definition: keyboard.h:26
uint8_t repeatRateCnt
Counts as long as a Key is pressed from 0 to KEY_REPEAT_RATE and issues the key again on overflow.
Definition: keyboard.c:91
The return value of PutKey() if the Keyboard is locked. The Character has been discarded.
Definition: keyboard.h:52
static const uint8_t KEY_RELEASED
The Key has just been released.
Definition: keyboard.h:15
volatile unsigned char keyPressed
Contains the key pressed. Set it to KEY_NONE after usage.
Definition: keyboard.c:125
PutCharReturn_t
Definition: keyboard.h:49
static void scanRotaryEncoder(void)
Scans the rotary encoder.
Definition: keyboard.h:94
#define KEY_RETLINES
Number of Return Lines.
Definition: keyboard.h:30