Hi agmue,
the codes that must be sended over BLE are different.
The keyboard-emulation uses an array of a struct that contains the keycodes and the modifiers
typedef struct {
unsigned char usage; // keycode
unsigned char modifier;
} KEYMAP;
In the meantime I found the BLE-codes and key-modifiers for all characters with ASCII-Code-values below 127.
for a string that only contains characters below ASCII-code 127
For those characters it is sufficient to do a typecasting
uint8_t val = (uint8_t)text[i];
The typecast delivers the ASCII-code.
And the ASCII-code equals to the index-number in the array of struct KEYMAP.
This way works a lookup in an array of struct with all the keycodes and the (key)modifiers.
#define KEYMAP_SIZE (123)
const KEYMAP keymap[KEYMAP_SIZE] = {
{0x00, 0 }, /* 0 */
// ... shortened for better overview
{0x1E, KEY_SHIFT }, /* 33 ! */
{0x0 , 0 }, /* 34 */
{0x31, 0 }, /* 35 # */
{0x21, KEY_SHIFT }, /* 36 $ */
{0x22, KEY_SHIFT }, /* 37 % */
{0x23, KEY_SHIFT }, /* 38 & */
{0x31, KEY_SHIFT }, /* 39 ' */
//....
Now the characters "äöü ÄÖÜ ² ³ €" are represented by multibyte values.
This means a simple typecast to uint8_t does not work.
analysing the values beeing above or below 126 and then execute different code for retrieving the correct keycodes and modifiers is easy
But I have no idea yet how to determine the BLE-keycodes for these characters "äöü ÄÖÜ ² ³ €",
best regards Stefan