2016-07-25 09:04:22 +02:00
|
|
|
#ifndef _INTERNALS_KEYBOARD_H
|
2016-11-05 22:00:23 +01:00
|
|
|
#define _INTERNALS_KEYBOARD_H
|
2016-07-06 11:28:51 +02:00
|
|
|
|
|
|
|
#include <keyboard.h>
|
|
|
|
|
|
|
|
// Keyboard variables.
|
|
|
|
extern volatile unsigned char keyboard_state[10];
|
2016-07-14 21:10:51 +02:00
|
|
|
extern volatile int interrupt_flag;
|
2016-07-06 11:28:51 +02:00
|
|
|
|
|
|
|
// Key statistics.
|
|
|
|
extern int repeat_first, repeat_next;
|
|
|
|
extern int last_key, last_repeats, last_events;
|
|
|
|
|
2016-09-04 11:35:41 +02:00
|
|
|
// RTC callback id.
|
|
|
|
extern unsigned cb_id;
|
|
|
|
|
2016-07-06 11:28:51 +02:00
|
|
|
/*
|
|
|
|
sleep()
|
|
|
|
Puts the CPU into sleep until an interrupt request is accepted.
|
|
|
|
*/
|
|
|
|
void sleep(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
getPressedKey()
|
|
|
|
Finds a pressed key in the keyboard state and returns it.
|
|
|
|
*/
|
|
|
|
int getPressedKey(volatile unsigned char *keyboard_state);
|
|
|
|
|
|
|
|
/*
|
|
|
|
getPressedKeys()
|
|
|
|
Find 'count' pressed keys in the keyboard state and fills the 'keys'
|
2016-09-04 11:35:41 +02:00
|
|
|
array. Returns the number of keys found.
|
|
|
|
WARNING: keyboard artifacts make this function read as pressed keys
|
|
|
|
that aren't (typically, LEFT + DOWN + SHIFT => ALPHA).
|
2016-07-06 11:28:51 +02:00
|
|
|
*/
|
|
|
|
int getPressedKeys(volatile unsigned char *keyboard_state, int *keys,
|
|
|
|
int count);
|
|
|
|
|
2016-07-25 09:04:22 +02:00
|
|
|
#endif // _INTERNALS_KEYBOARD_H
|