nRF51 SDK - S130 SoftDevice
|
Cherry 8x16 keyboard matrix driver. More...
Macros | |
#define | CHERRY8x16_MAX_NUM_OF_PRESSED_KEYS 6 |
Maximum number of pressed keys kept in buffers. | |
#define | CHERRY8x16_DEFAULT_KEY_LOOKUP_MATRIX (const uint8_t*)0 |
If passed to cherry8x16_init, default lookup matrix will be used. | |
#define | KEY_PACKET_MODIFIER_KEY_INDEX (0) |
Index in the key packet where modifier keys such as ALT and Control are stored. | |
#define | KEY_PACKET_RESERVED_INDEX (1) |
Index in the key packet where OEMs can store information. | |
#define | KEY_PACKET_KEY_INDEX (2) |
Start index in the key packet where pressed keys are stored. | |
#define | KEY_PACKET_MAX_KEYS (6) |
Maximum number of keys that can be stored into the key packet. | |
#define | KEY_PACKET_SIZE (KEY_PACKET_KEY_INDEX+KEY_PACKET_MAX_KEYS) |
Total size of the key packet in bytes. | |
#define | KEY_PACKET_NO_KEY (0) |
Value to be stored to key index to indicate no key is pressed. | |
Enumerations | |
enum | cherry8x16_status_t { CHERRY8x16_OK, CHERRY8x16_NOT_DETECTED, CHERRY8x16_INVALID_PARAMETER } |
Functions | |
cherry8x16_status_t | cherry8x16_init (const uint8_t volatile *row_port, uint16_t *column_port, const uint8_t *key_lookup_matrix) |
Function for initializing the driver. More... | |
bool | cherry8x16_new_packet (const uint8_t **p_key_packet, uint8_t *p_key_packet_size) |
Function for creating a new key packet if new data is available and key ghosting is not detected. More... | |
Cherry 8x16 keyboard matrix driver.
enum cherry8x16_status_t |
Describes return values for: cherry8x16_init
Enumerator | |
---|---|
CHERRY8x16_OK |
Operation was succesful. |
CHERRY8x16_NOT_DETECTED |
Product/Revision ID was not what was expected |
CHERRY8x16_INVALID_PARAMETER |
Given parameters were not valid |
cherry8x16_status_t cherry8x16_init | ( | const uint8_t volatile * | row_port, |
uint16_t * | column_port, | ||
const uint8_t * | key_lookup_matrix | ||
) |
Function for initializing the driver.
row_port | Pointer to GPIO port address that is used as key matrix row input. |
column_port | Pointer to GPIO port address that is used as key matrix column output. |
key_lookup_matrix | If NULL, use a default key lookup matrix. Otherwise pointer to a 128 (8x16) element array containing HID keycodes. |
CHERRY8X16_OK | Peripheral was initialized succesfully. |
CHERRY8X16_NOT_DETECTED | Could not detect the peripheral. |
bool cherry8x16_new_packet | ( | const uint8_t ** | p_key_packet, |
uint8_t * | p_key_packet_size | ||
) |
Function for creating a new key packet if new data is available and key ghosting is not detected.
p_key_packet | Array that will hold the created key packet. Previously created packet will be discarded. |
p_key_packet_size | Key packet size in bytes. |
true | If new packet was created. |
false | If packet was not created. |