#ifndef USB_HID_KEYS
#define USB_HID_KEYS

#include"stdint.h"

/**
 * Modifier masks - used for the first byte in the HID report.
 * NOTE: The second byte in the report is reserved, 0x00U
 */
#define KEY_MOD_LCTRL  0x01U
#define KEY_MOD_LSHIFT 0x02U
#define KEY_MOD_LALT   0x04U
#define KEY_MOD_LMETA  0x08U
#define KEY_MOD_RCTRL  0x10U
#define KEY_MOD_RSHIFT 0x20U
#define KEY_MOD_RALT   0x40U
#define KEY_MOD_RMETA  0x80U

/**
 * Scan codes - last N slots in the HID report (usually 6).
 * 0x00U if no key pressed.
 *
 * If more than N keys are pressed, the HID reports
 * KEY_ERR_OVF in all slots to indicate this condition.
 */

#define KEY_NONE 0x00U // No key pressed
#define KEY_ERR_OVF 0x01U //  Keyboard Error Roll Over - used for all slots if too many keys are pressed ("Phantom key")
// 0x02U //  Keyboard POST Fail
// 0x03U //  Keyboard Error Undefined
#define KEY_A 0x04U // Keyboard a and A
#define KEY_B 0x05U // Keyboard b and B
#define KEY_C 0x06U // Keyboard c and C
#define KEY_D 0x07U // Keyboard d and D
#define KEY_E 0x08U // Keyboard e and E
#define KEY_F 0x09U // Keyboard f and F
#define KEY_G 0x0AU // Keyboard g and G
#define KEY_H 0x0BU // Keyboard h and H
#define KEY_I 0x0CU // Keyboard i and I
#define KEY_J 0x0DU // Keyboard j and J
#define KEY_K 0x0EU // Keyboard k and K
#define KEY_L 0x0FU // Keyboard l and L
#define KEY_M 0x10U // Keyboard m and M
#define KEY_N 0x11U // Keyboard n and N
#define KEY_O 0x12U // Keyboard o and O
#define KEY_P 0x13U // Keyboard p and P
#define KEY_Q 0x14U // Keyboard q and Q
#define KEY_R 0x15U // Keyboard r and R
#define KEY_S 0x16U // Keyboard s and S
#define KEY_T 0x17U // Keyboard t and T
#define KEY_U 0x18U // Keyboard u and U
#define KEY_V 0x19U // Keyboard v and V
#define KEY_W 0x1AU // Keyboard w and W
#define KEY_X 0x1BU // Keyboard x and X
#define KEY_Y 0x1CU // Keyboard y and Y
#define KEY_Z 0x1DU // Keyboard z and Z

#define KEY_1 0x1EU // Keyboard 1 and !
#define KEY_2 0x1FU // Keyboard 2 and @
#define KEY_3 0x20U // Keyboard 3 and #
#define KEY_4 0x21U // Keyboard 4 and $
#define KEY_5 0x22U // Keyboard 5 and %
#define KEY_6 0x23U // Keyboard 6 and ^
#define KEY_7 0x24U // Keyboard 7 and &
#define KEY_8 0x25U // Keyboard 8 and *
#define KEY_9 0x26U // Keyboard 9 and (
#define KEY_0 0x27U // Keyboard 0 and )

#define KEY_ENTER 0x28U // Keyboard Return (ENTER)
#define KEY_ESC 0x29U // Keyboard ESCAPE
#define KEY_BACKSPACE 0x2AU // Keyboard DELETE (Backspace)
#define KEY_TAB 0x2BU // Keyboard Tab
#define KEY_SPACE 0x2CU // Keyboard Spacebar
#define KEY_MINUS 0x2DU // Keyboard - and _
#define KEY_EQUAL 0x2EU // Keyboard = and +
#define KEY_LEFTBRACE 0x2FU // Keyboard [ and {
#define KEY_RIGHTBRACE 0x30U // Keyboard ] and }
#define KEY_BACKSLASH 0x31U // Keyboard \ and |
#define KEY_HASHTILDE 0x32U // Keyboard Non-US # and ~
#define KEY_SEMICOLON 0x33U // Keyboard ; and :
#define KEY_APOSTROPHE 0x34U // Keyboard ' and "
#define KEY_GRAVE 0x35U // Keyboard ` and ~
#define KEY_COMMA 0x36U // Keyboard , and <
#define KEY_DOT 0x37U // Keyboard . and >
#define KEY_SLASH 0x38U // Keyboard / and ?
#define KEY_CAPSLOCK 0x39U // Keyboard Caps Lock

#define KEY_F1 0x3AU // Keyboard F1
#define KEY_F2 0x3BU // Keyboard F2
#define KEY_F3 0x3CU // Keyboard F3
#define KEY_F4 0x3DU // Keyboard F4
#define KEY_F5 0x3EU // Keyboard F5
#define KEY_F6 0x3FU // Keyboard F6
#define KEY_F7 0x40U // Keyboard F7
#define KEY_F8 0x41U // Keyboard F8
#define KEY_F9 0x42U // Keyboard F9
#define KEY_F10 0x43U // Keyboard F10
#define KEY_F11 0x44U // Keyboard F11
#define KEY_F12 0x45U // Keyboard F12

#define KEY_SYSRQ 0x46U // Keyboard Print Screen
#define KEY_SCROLLLOCK 0x47U // Keyboard Scroll Lock
#define KEY_PAUSE 0x48U // Keyboard Pause
#define KEY_INSERT 0x49U // Keyboard Insert
#define KEY_HOME 0x4AU // Keyboard Home
#define KEY_PAGEUP 0x4BU // Keyboard Page Up
#define KEY_DELETE 0x4CU // Keyboard Delete Forward
#define KEY_END 0x4DU // Keyboard End
#define KEY_PAGEDOWN 0x4EU // Keyboard Page Down
#define KEY_RIGHT 0x4FU // Keyboard Right Arrow
#define KEY_LEFT 0x50U // Keyboard Left Arrow
#define KEY_DOWN 0x51U // Keyboard Down Arrow
#define KEY_UP 0x52U // Keyboard Up Arrow

#define KEY_NUMLOCK 0x53U // Keyboard Num Lock and Clear
#define KEY_KPSLASH 0x54U // Keypad /
#define KEY_KPASTERISK 0x55U // Keypad *
#define KEY_KPMINUS 0x56U // Keypad -
#define KEY_KPPLUS 0x57U // Keypad +
#define KEY_KPENTER 0x58U // Keypad ENTER
#define KEY_KP1 0x59U // Keypad 1 and End
#define KEY_KP2 0x5AU // Keypad 2 and Down Arrow
#define KEY_KP3 0x5BU // Keypad 3 and PageDn
#define KEY_KP4 0x5CU // Keypad 4 and Left Arrow
#define KEY_KP5 0x5DU // Keypad 5
#define KEY_KP6 0x5EU // Keypad 6 and Right Arrow
#define KEY_KP7 0x5FU // Keypad 7 and Home
#define KEY_KP8 0x60U // Keypad 8 and Up Arrow
#define KEY_KP9 0x61U // Keypad 9 and Page Up
#define KEY_KP0 0x62U // Keypad 0 and Insert
#define KEY_KPDOT 0x63U // Keypad . and Delete

#define KEY_102ND 0x64U // Keyboard Non-US \ and |
#define KEY_COMPOSE 0x65U // Keyboard Application
#define KEY_POWER 0x66U // Keyboard Power
#define KEY_KPEQUAL 0x67U // Keypad =

#define KEY_F13 0x68U // Keyboard F13
#define KEY_F14 0x69U // Keyboard F14
#define KEY_F15 0x6AU // Keyboard F15
#define KEY_F16 0x6BU // Keyboard F16
#define KEY_F17 0x6CU // Keyboard F17
#define KEY_F18 0x6DU // Keyboard F18
#define KEY_F19 0x6EU // Keyboard F19
#define KEY_F20 0x6FU // Keyboard F20
#define KEY_F21 0x70U // Keyboard F21
#define KEY_F22 0x71U // Keyboard F22
#define KEY_F23 0x72U // Keyboard F23
#define KEY_F24 0x73U // Keyboard F24

#define KEY_OPEN 0x74U // Keyboard Execute
#define KEY_HELP 0x75U // Keyboard Help
#define KEY_PROPS 0x76U // Keyboard Menu
#define KEY_FRONT 0x77U // Keyboard Select
#define KEY_STOP 0x78U // Keyboard Stop
#define KEY_AGAIN 0x79U // Keyboard Again
#define KEY_UNDO 0x7AU // Keyboard Undo
#define KEY_CUT 0x7BU // Keyboard Cut
#define KEY_COPY 0x7CU // Keyboard Copy
#define KEY_PASTE 0x7DU // Keyboard Paste
#define KEY_FIND 0x7EU // Keyboard Find
#define KEY_MUTE 0x7FU // Keyboard Mute
#define KEY_VOLUMEUP 0x80U // Keyboard Volume Up
#define KEY_VOLUMEDOWN 0x81U // Keyboard Volume Down
// 0x82U  Keyboard Locking Caps Lock
// 0x83U  Keyboard Locking Num Lock
// 0x84U  Keyboard Locking Scroll Lock
#define KEY_KPCOMMA 0x85U // Keypad Comma
// 0x86U  Keypad Equal Sign
#define KEY_RO 0x87U // Keyboard International1
#define KEY_KATAKANAHIRAGANA 0x88U // Keyboard International2
#define KEY_YEN 0x89U // Keyboard International3
#define KEY_HENKAN 0x8AU // Keyboard International4
#define KEY_MUHENKAN 0x8BU // Keyboard International5
#define KEY_KPJPCOMMA 0x8CU // Keyboard International6
// 0x8DU  Keyboard International7
// 0x8EU  Keyboard International8
// 0x8FU  Keyboard International9
#define KEY_HANGEUL 0x90U // Keyboard LANG1
#define KEY_HANJA 0x91U // Keyboard LANG2
#define KEY_KATAKANA 0x92U // Keyboard LANG3
#define KEY_HIRAGANA 0x93U // Keyboard LANG4
#define KEY_ZENKAKUHANKAKU 0x94U // Keyboard LANG5
// 0x95U  Keyboard LANG6
// 0x96U  Keyboard LANG7
// 0x97U  Keyboard LANG8
// 0x98U  Keyboard LANG9
// 0x99U  Keyboard Alternate Erase
// 0x9AU  Keyboard SysReq/Attention
// 0x9BU  Keyboard Cancel
// 0x9CU  Keyboard Clear
// 0x9DU  Keyboard Prior
// 0x9EU  Keyboard Return
// 0x9FU  Keyboard Separator
// 0xA0U  Keyboard Out
// 0xA1U  Keyboard Oper
// 0xA2U  Keyboard Clear/Again
// 0xA3U  Keyboard CrSel/Props
// 0xA4U  Keyboard ExSel

// 0xB0U  Keypad 00
// 0xB1U  Keypad 000
// 0xB2U  Thousands Separator
// 0xB3U  Decimal Separator
// 0xB4U  Currency Unit
// 0xB5U  Currency Sub-unit
#define KEY_KPLEFTPAREN 0xB6U // Keypad (
#define KEY_KPRIGHTPAREN 0xB7U // Keypad )
// 0xB8U  Keypad {
// 0xB9U  Keypad }
// 0xBAU  Keypad Tab
// 0xBBU  Keypad Backspace
// 0xBCU  Keypad A
// 0xBDU  Keypad B
// 0xBEU  Keypad C
// 0xBFU  Keypad D
// 0xC0U  Keypad E
// 0xC1U  Keypad F
// 0xC2U  Keypad XOR
// 0xC3U  Keypad ^
// 0xC4U  Keypad %
// 0xC5U  Keypad <
// 0xC6U  Keypad >
// 0xC7U  Keypad &
// 0xC8U  Keypad &&
// 0xC9U  Keypad |
// 0xCAU  Keypad ||
// 0xCBU  Keypad :
// 0xCCU  Keypad #
// 0xCDU  Keypad Space
// 0xCEU  Keypad @
// 0xCFU  Keypad !
// 0xD0U  Keypad Memory Store
// 0xD1U  Keypad Memory Recall
// 0xD2U  Keypad Memory Clear
// 0xD3U  Keypad Memory Add
// 0xD4U  Keypad Memory Subtract
// 0xD5U  Keypad Memory Multiply
// 0xD6U  Keypad Memory Divide
// 0xD7U  Keypad +/-
// 0xD8U  Keypad Clear
// 0xD9U  Keypad Clear Entry
// 0xDAU  Keypad Binary
// 0xDBU  Keypad Octal
// 0xDCU  Keypad Decimal
// 0xDDU  Keypad Hexadecimal

#define KEY_LEFTCTRL 0xE0U // Keyboard Left Control
#define KEY_LEFTSHIFT 0xE1U // Keyboard Left Shift
#define KEY_LEFTALT 0xE2U // Keyboard Left Alt
#define KEY_LEFTMETA 0xE3U // Keyboard Left GUI
#define KEY_RIGHTCTRL 0xE4U // Keyboard Right Control
#define KEY_RIGHTSHIFT 0xE5U // Keyboard Right Shift
#define KEY_RIGHTALT 0xE6U // Keyboard Right Alt
#define KEY_RIGHTMETA 0xE7U // Keyboard Right GUI

#define KEY_MEDIA_PLAYPAUSE 0xE8U
#define KEY_MEDIA_STOPCD 0xE9U
#define KEY_MEDIA_PREVIOUSSONG 0xEAU
#define KEY_MEDIA_NEXTSONG 0xEBU
#define KEY_MEDIA_EJECTCD 0xECU
#define KEY_MEDIA_VOLUMEUP 0xEDU
#define KEY_MEDIA_VOLUMEDOWN 0xEEU
#define KEY_MEDIA_MUTE 0xEFU
#define KEY_MEDIA_WWW 0xF0U
#define KEY_MEDIA_BACK 0xF1U
#define KEY_MEDIA_FORWARD 0xF2U
#define KEY_MEDIA_STOP 0xF3U
#define KEY_MEDIA_FIND 0xF4U
#define KEY_MEDIA_SCROLLUP 0xF5U
#define KEY_MEDIA_SCROLLDOWN 0xF6U
#define KEY_MEDIA_EDIT 0xF7U
#define KEY_MEDIA_SLEEP 0xF8U
#define KEY_MEDIA_COFFEE 0xF9U
#define KEY_MEDIA_REFRESH 0xFAU
#define KEY_MEDIA_CALC 0xFBU

//Function Prototypes

uint8_t cNumericToKey(char c);

#endif // USB_HID_KEYS
