ble nano hid over gatt
Dependencies: BLE_API mbed-dev nRF51822
keymap.h
- Committer:
- cho45
- Date:
- 2016-08-26
- Revision:
- 40:364deaa190fe
- Parent:
- 30:f9ebc769118d
- Child:
- 42:2c3be8694896
File content as of revision 40:364deaa190fe:
#include "keyboard.h" #include "keyboard--short-names.h" static const uint8_t ROWS = 8; static const uint8_t COLS = 16; // unimplemented in hardware is __ #define __________ 0 // unimplemented in firmware is _undef #define _undef 0 static const uint8_t KEYMAP_DEFINITION[ROWS][COLS] = { /*0*/{ _esc , _F1 , _F2 , _F3 , _F4 , _F5 , _F6 , __________ , __________ , _F7 , _F8 , _F9 , _F10 , _F11 , _F12 , _undef } , /*1*/{ _esc , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _6 , _7 , _8 , _9 , _0 , _dash , _equal , _backslash } , /*2*/{ _tab , _Q , _W , _E , _R , _T , _Y , __________ , _T , _Y , _U , _I , _O , _P , _bracketL , _grave } , /*3*/{ _ctrlL , _A , _S , _D , _F , _G , _H , __________ , _G , _H , _J , _K , _L , _semicolon , _quote , _bracketR } , /*4*/{ _shiftL , _Z , _X , _C , _V , _B , _N , __________ , _B , _N , _M , _comma , _period , _slash , _shiftR , _bs } , /*5*/{ _altL , _guiL , _space , __________ , __________ , _undef , __________ , __________ , __________ , _arrowU , _space , __________ , _guiR , _altR , _undef , _enter } , /*6*/{ __________ , __________ , __________ , __________ , __________ , __________ , __________ , __________ , _arrowL , _arrowD , _arrowR , __________ , __________ , __________ , __________ , __________ } , /*7*/{ __________ , __________ , __________ , __________ , __________ , __________ , __________ , __________ , __________ , __________ , __________ , __________ , __________ , __________ , __________ , __________ } , }; #undef __________ #undef _undef class Keymap { public: Keymap() { } uint8_t mappingFor(int col, int row) const { return KEYMAP_DEFINITION[row][col]; } void execute(int col, int row, bool pressed) { uint8_t key = KEYMAP_DEFINITION[row][col]; if (key) { if (pressed) { // printf("D %x\r\n", key); HIDController::appendReportData(key); } else { // printf("U %x\r\n", key); HIDController::deleteReportData(key); } } } };