MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / mapRawKeyToPhysical

Function mapRawKeyToPhysical

boards/m5stack-cardputer/interface.cpp:65–77  ·  view source on GitHub ↗

** Function name: mapRawKeyToPhysical() ** Location: interface.cpp ** Description: initial mapping for keyboard ***************************************************************************************/

Source from the content-addressed store, hash-verified

63** Description: initial mapping for keyboard
64***************************************************************************************/
65inline void mapRawKeyToPhysical(uint8_t keyvalue, uint8_t &row, uint8_t &col) {
66 const uint8_t u = keyvalue % 10; // 1..8
67 const uint8_t t = keyvalue / 10; // 0..6
68
69 if (u >= 1 && u <= 8 && t <= 6) {
70 const uint8_t u0 = u - 1; // 0..7
71 row = u0 & 0x03; // bits [1:0] => 0..3
72 col = (t << 1) | (u0 >> 2); // t*2 + bit2(u0) => 0..13
73 } else {
74 row = 0xFF; // invalid
75 col = 0xFF;
76 }
77}
78
79/***************************************************************************************
80** Function name: _setup_gpio()

Callers 1

InputHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected