![]() |
EVE 1.0
|
![]() |
Data Structures | |
struct | key_repeat_t |
The structure defines key repeat parameters. More... | |
struct | key_combi_t |
The structure defines combi key parameters. Note that it is possible to define individual debounce time for each group. Thus it is also the way to define an individual key with debouncing which differs from default KEY_PRELL_TIME : just define a "group of 1 key. More... | |
Enumerations |
Functions called from application programs | |
void | StartKeyScan (void) |
Start Keys scanning. More... | |
void | KeyInterruptCb (void) |
This callback function must be called when a key interrupt is received by the platform. More... | |
void | KeyDebounceTimeSet (uint16_t Time) |
Sets key debounce time. Default time is KEY_PRELL_TIME. More... | |
bool | KeyStatusGet (uint8_t KeyIndex) |
Returns status of debounced key. More... | |
Application' keypad configuration and supplied functions. | |
The following is the keypad driver setup for application's board.h and board.c files. | |
struct key_repeat_t | ConfigKeyRepeat [NUMBER_OF_REPEAT_KEYS] |
User defined array of key_repeat_t structures defines key repeat parameters. | |
struct key_combi_t | ConfigKeyCombi [NUMBER_OF_COMBI_GROUPS] |
User defined array of key_combi_t structures defines combi key groups parameters. | |
static __inline uint32_t | ReadKeyInput (void) |
Application supplied board-specific callback function for reading key inputs. More... | |
void | KeyInterruptEnable (bool Enable) |
Application supplied board-specific callback function to enable or disable HW interrupts for all keys. More... | |
#define | KEY_ENABLED true/false |
#define | KEYS_HAVE_NO_INTERRUPT true/false |
#define | REPEAT_KEY_ENABLED true/false |
#define | REPEAT_KEY_STEP2_ENABLED true/false |
#define | COMBI_KEYS_ENABLED true/false |
#define | COMBI_KEY_RELEASE_ENABLED true/false |
#define | NUMBER_OF_KEYS <N> |
#define | NUMBER_OF_REPEAT_KEYS <N> |
#define | NUMBER_OF_COMBI_GROUPS <N> |
#define | KEY_SIGNAL_RECEIVER <struct process *p> |
#define | SCAN_KEY_INTERVAL <T> |
#define | KEY_PRELL_TIME <T> |
This driver supports key debounce functionality if KEY_ENABLED is set true. The function KeyInterruptEnable() must be called to enables interrupts for all keys.
The number of scanned keys is given by NUMBER_OF_KEYS. Key debounce time is given by KEY_PRELL_TIME. When debouncing the interval is given by SCAN_KEY_INTERVAL. The keys are read by the inline function ReadKeyInput().
The following events are sent:
It is possible to send a repeated event when a key has been pressed for a given time. The event can be repeated at a given interval. This functionality is enabled if REPEAT_KEY_ENABLED is set true: The number of repeated keys is given by NUMBER_OF_REPEAT_KEYS. Repeat function is configured in table "struct key_repeat_t ConfigKeyRepeat[]" in Board.c The following events are sent:
It is possible to send a event when a combination of one or more keys have been pressed for a given time. This functionality is enabled if COMBI_KEYS_ENABLED is set true: The number of combi keys groups is given by NUMBER_OF_COMBI_GROUPS. Combi function is configured in table "struct key_combi_t ConfigKeyCombi[]" in Board.c The following events are sent:
All events are sent to process defined by KEY_SIGNAL_RECEIVER
enum key_events_t |
Event numbers being sent to the application process. Event's void *data field contains key number.
void StartKeyScan | ( | void | ) |
Start Keys scanning.
Only used if KEYS_HAVE_NO_INTERRUPT = true
void KeyInterruptCb | ( | void | ) |
This callback function must be called when a key interrupt is received by the platform.
Only used if KEYS_HAVE_NO_INTERRUPT == false
void KeyDebounceTimeSet | ( | uint16_t | Time | ) |
Sets key debounce time. Default time is KEY_PRELL_TIME.
Time | New debounce time in ms |
bool KeyStatusGet | ( | uint8_t | KeyIndex | ) |
Returns status of debounced key.
KeyIndex | key number from 0 to (NUMBER_OF_KEYS - 1) |
|
static |
Application supplied board-specific callback function for reading key inputs.
The driver calls this function in order to get current keys status. It is an application responsibility to map actual internal GPIO or GPIO extender port pins to an int32_t array of bits used as key status in the driver.
Example for 2 inverted keys (pressing connects to ground) supporting press/release event generation:
void KeyInterruptEnable | ( | bool | Enable | ) |
Application supplied board-specific callback function to enable or disable HW interrupts for all keys.
This function must be called by application to enable interrupts in interrupt mode (KEYS_HAVE_NO_INTERRUPT == false) before the driver starts to work.
While working the driver uses the function. When a key is pressed/released, the key interrupt will disable further key interrupts, and starts the key debounce scheduler. The interrupts will be re-enabled again when the scheduler is not active.
Only used if KEYS_HAVE_NO_INTERRUPT = false.
Example for 2 inverted keys (pressing connects to ground) supporting press/release event generation:
Enable | true to enable interrupts, false to disable interrupts |