Skip to main content
MMARI.1
Senior II
February 9, 2023
Question

currently otg keyboard working fine and getting all the character but i want hex code of function keys f1 to f9 . now i am getting only zero for f1 to f9 keys .can you show exactly where i need to map f1 to f9 keys equl hex codes in usb_hid_keybd.c

  • February 9, 2023
  • 1 reply
  • 719 views

..

This topic has been closed for replies.

1 reply

MMARI.1
MMARI.1Author
Senior II
February 16, 2023
#ifdef QWERTY_KEYBOARD
static const uint8_t HID_KEYBRD_Key[] =
{
 '\0', '`', '1', '2', '3', '4', '5', '6',
 '7', '8', '9', '0', '-', '=', '\0', '\r',
 '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u',
 'i', 'o', 'p', '[', ']', '\\',
 '\0', 'a', 's', 'd', 'f', 'g', 'h', 'j',
 'k', 'l', ';', '\'', '\0', '\n',
 '\0', '\0', 'z', 'x', 'c', 'v', 'b', 'n',
 'm', ',', '.', '/', '\0', '\0',
 '\0', '\0', '\0', ' ', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\r', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '7', '4', '1',
 '\0', '/', '8', '5', '2',
 '0', '*', '9', '6', '3',
 '.', '-', '+', '\0', '\n', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0'
};
 
static const uint8_t HID_KEYBRD_ShiftKey[] =
{
 '\0', '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')',
 '_', '+', '\0', '\0', '\0', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U',
 'I', 'O', 'P', '{', '}', '|', '\0', 'A', 'S', 'D', 'F', 'G',
 'H', 'J', 'K', 'L', ':', '"', '\0', '\n', '\0', '\0', 'Z', 'X',
 'C', 'V', 'B', 'N', 'M', '<', '>', '?', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'
};
 
#else
 
static const uint8_t HID_KEYBRD_Key[] =
{
 '\0', '`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
 '-', '=', '\0', '\r', '\t', 'a', 'z', 'e', 'r', 't', 'y', 'u',
 'i', 'o', 'p', '[', ']', '\\', '\0', 'q', 's', 'd', 'f', 'g',
 'h', 'j', 'k', 'l', 'm', '\0', '\0', '\n', '\0', '\0', 'w', 'x',
 'c', 'v', 'b', 'n', ',', ';', ':', '!', '\0', '\0', '\0', '\0',
 '\0', ' ', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\r', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '7', '4', '1', '\0', '/',
 '8', '5', '2', '0', '*', '9', '6', '3', '.', '-', '+', '\0',
 '\n', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'
};
 
static const uint8_t HID_KEYBRD_ShiftKey[] =
{
 '\0', '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_',
 '+', '\0', '\0', '\0', 'A', 'Z', 'E', 'R', 'T', 'Y', 'U', 'I', 'O',
 'P', '{', '}', '*', '\0', 'Q', 'S', 'D', 'F', 'G', 'H', 'J', 'K',
 'L', 'M', '%', '\0', '\n', '\0', '\0', 'W', 'X', 'C', 'V', 'B', 'N',
 '?', '.', '/', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'
};
#endif
 
static const uint8_t HID_KEYBRD_Codes[] =
{
 0, 0, 0, 0, 31, 50, 48, 33,
 19, 34, 35, 36, 24, 37, 38, 39, /* 0x00 - 0x0F */
 52, 51, 25, 26, 17, 20, 32, 21,
 23, 49, 18, 47, 22, 46, 2, 3, /* 0x10 - 0x1F */
 4, 5, 6, 7, 8, 9, 10, 11,
 43, 110, 15, 16, 61, 12, 13, 27, /* 0x20 - 0x2F */
 28, 29, 42, 40, 41, 1, 53, 54,
 55, 30, 112, 113, 114, 115, 116, 117, /* 0x30 - 0x3F */
 118, 119, 120, 121, 122, 123, 124, 125,
 126, 75, 80, 85, 76, 81, 86, 89, /* 0x40 - 0x4F */
 79, 84, 83, 90, 95, 100, 105, 106,
 108, 93, 98, 103, 92, 97, 102, 91, /* 0x50 - 0x5F */
 96, 101, 99, 104, 45, 129, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x6F */
 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x7F */
 0, 0, 0, 0, 0, 107, 0, 56,
 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8F */
 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 - 0x9F */
 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 - 0xAF */
 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 - 0xBF */
 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 - 0xCF */
 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 - 0xDF */
 58, 44, 60, 127, 64, 57, 62, 128 /* 0xE0 - 0xE7 */
};

0693W00000YAsi8QAD.pngwhere to insert above value ascii code in usb_hid_keybd.c above mentioned