mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-21 14:50:44 +01:00
[ion] Keyboard: cheat to get user key-pressing on B3 layout as B2 in the
keyboard matrix
This commit is contained in:
@@ -11,7 +11,7 @@ namespace Keyboard {
|
||||
|
||||
enum class Key : uint8_t {
|
||||
A1=0, A2=1, A3=2, A4=3, A5=4, A6=5,
|
||||
B1=6, B2=7, /* B3=8, B4=9, B5=10, B6=11, */
|
||||
B1=6, B2=7, B3=8, /*B4=9, B5=10, B6=11, */
|
||||
C1=12, C2=13, C3=14, C4=15, C5=16, C6=17,
|
||||
D1=18, D2=19, D3=20, D4=21, D5=22, D6=23,
|
||||
E1=24, E2=25, E3=26, E4=27, E5=28, E6=29,
|
||||
|
||||
@@ -37,6 +37,10 @@ constexpr GPIO ColumnGPIO = GPIOC;
|
||||
constexpr uint8_t numberOfColumns = 6;
|
||||
constexpr uint8_t ColumnPins[numberOfColumns] = {0, 1, 2, 3, 4, 5};
|
||||
|
||||
inline uint64_t cheat(uint64_t state) {
|
||||
return state;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define ION_DEVICE_N0101_CONFIG_KEYBOARD_H
|
||||
|
||||
#include <regs/regs.h>
|
||||
#include <ion/keyboard.h>
|
||||
|
||||
/* Pin | Role | Mode
|
||||
* -----+-------------------+--------------------
|
||||
@@ -37,6 +38,12 @@ constexpr GPIO ColumnGPIO = GPIOC;
|
||||
constexpr uint8_t numberOfColumns = 6;
|
||||
constexpr uint8_t ColumnPins[numberOfColumns] = {0, 1, 2, 3, 4, 5};
|
||||
|
||||
/* The key B2 is actually on B3 in hardware on model N0101. To avoid some extra
|
||||
* work, we switch B2 and B3 bit in the bit array 'state'. */
|
||||
inline uint64_t cheat(uint64_t state) {
|
||||
return state & Ion::Keyboard::State(Ion::Keyboard::Key::B3) ? state | Ion::Keyboard::State(Ion::Keyboard::Key::B2) : state;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,9 @@ State scan() {
|
||||
state = (state << 6) | (~columns & 0x3F);
|
||||
}
|
||||
|
||||
// On model N0101, the B2 key is located on B3. We cheat here to avoid extra re-work.
|
||||
state = Config::cheat(state);
|
||||
|
||||
/* Last but not least, keys number 8, 9, 10, 11, 35, 41, 47 and 53 are not
|
||||
* defined. Therefore we want to make sure those bits are forced to zero in
|
||||
* whatever value we return. */
|
||||
|
||||
Reference in New Issue
Block a user