Skip to content

Commit fca95d2

Browse files
committed
tweak constants for CardKB2.
1 parent c038b15 commit fca95d2

3 files changed

Lines changed: 45 additions & 45 deletions

File tree

src/unit/unit_CardKB2.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ constexpr std::pair<uint8_t, key_index_t> character_map[] = {
112112
{0x00, 0xFF}, // US (31)
113113
{1 + 2 + 4, UnitCardKB2::KEY_SPACE}, // SP (32)
114114
{4, UnitCardKB2::KEY_1}, // ! (33)
115-
{4, UnitCardKB2::KEY_P}, // " (34)
115+
{4, UnitCardKB2::KEY_H}, // " (34)
116116
{4, UnitCardKB2::KEY_3}, // # (35)
117117
{4, UnitCardKB2::KEY_4}, // $ (36)
118118
{4, UnitCardKB2::KEY_5}, // % (37)
@@ -122,10 +122,10 @@ constexpr std::pair<uint8_t, key_index_t> character_map[] = {
122122
{4, UnitCardKB2::KEY_0}, // ) (41)
123123
{4, UnitCardKB2::KEY_8}, // * (42)
124124
{4, UnitCardKB2::KEY_O}, // + (43)
125-
{1 + 2, UnitCardKB2::KEY_N}, // , (44)
126-
{4, UnitCardKB2::KEY_H}, // - (45)
127-
{1 + 2, UnitCardKB2::KEY_M}, // . (46)
128-
{4, UnitCardKB2::KEY_Y}, // / (47)
125+
{4, UnitCardKB2::KEY_N}, // , (44)
126+
{4, UnitCardKB2::KEY_I}, // - (45)
127+
{4, UnitCardKB2::KEY_M}, // . (46)
128+
{4, UnitCardKB2::KEY_T}, // / (47)
129129
{1 + 2, UnitCardKB2::KEY_0}, // 0 (48)
130130
{1 + 2, UnitCardKB2::KEY_1}, // 1 (49)
131131
{1 + 2, UnitCardKB2::KEY_2}, // 2 (50)
@@ -136,8 +136,8 @@ constexpr std::pair<uint8_t, key_index_t> character_map[] = {
136136
{1 + 2, UnitCardKB2::KEY_7}, // 7 (55)
137137
{1 + 2, UnitCardKB2::KEY_8}, // 8 (56)
138138
{1 + 2, UnitCardKB2::KEY_9}, // 9 (57)
139-
{4, UnitCardKB2::KEY_K}, // : (58)
140-
{4, UnitCardKB2::KEY_S}, // ; (59)
139+
{4, UnitCardKB2::KEY_L}, // : (58)
140+
{4, UnitCardKB2::KEY_K}, // ; (59)
141141
{4, UnitCardKB2::KEY_V}, // < (60)
142142
{4, UnitCardKB2::KEY_P}, // = (61)
143143
{4, UnitCardKB2::KEY_B}, // > (62)
@@ -173,7 +173,7 @@ constexpr std::pair<uint8_t, key_index_t> character_map[] = {
173173
{4, UnitCardKB2::KEY_R}, // \ (92)
174174
{4, UnitCardKB2::KEY_G}, // ] (93)
175175
{4, UnitCardKB2::KEY_D}, // ^ (94)
176-
{4, UnitCardKB2::KEY_I}, // _ (95)
176+
{4, UnitCardKB2::KEY_U}, // _ (95)
177177
{4, UnitCardKB2::KEY_W}, // ` (96)
178178
{1, UnitCardKB2::KEY_A}, // a (97)
179179
{1, UnitCardKB2::KEY_B}, // b (98)
@@ -202,7 +202,7 @@ constexpr std::pair<uint8_t, key_index_t> character_map[] = {
202202
{1, UnitCardKB2::KEY_Y}, // y (121)
203203
{1, UnitCardKB2::KEY_Z}, // z (122)
204204
{4, UnitCardKB2::KEY_A}, // { (123)
205-
{4, UnitCardKB2::KEY_U}, // | (124)
205+
{4, UnitCardKB2::KEY_Y}, // | (124)
206206
{4, UnitCardKB2::KEY_S}, // } (125)
207207
{4, UnitCardKB2::KEY_Q}, // ~ (126)
208208
{2, UnitCardKB2::KEY_DELETE}, // DEL (127)
@@ -393,11 +393,11 @@ void UnitCardKB2::update(const bool force)
393393
if (state == KEY_STATE_PRESSED) {
394394
_now |= bit;
395395

396-
if (kidx == 34) { // sym pressed
396+
if (kidx == KEY_SYM) { // sym pressed
397397
_sym_was_pressed = !_sym_was_pressed;
398398
}
399399

400-
if (kidx == 22) { // caps key
400+
if (kidx == KEY_AA) { // caps key
401401
_caps_pressing = true;
402402
_caps_pressed_at = at;
403403
} else {
@@ -420,7 +420,7 @@ void UnitCardKB2::update(const bool force)
420420
} else if (state == KEY_STATE_RELEASED) {
421421
_now &= ~bit;
422422

423-
if (kidx == 22 && _caps_pressing) {
423+
if (kidx == KEY_AA && _caps_pressing) {
424424
_caps_pressing = false;
425425

426426
if (_caps_hold_active) {

src/unit/unit_CardKB2.hpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,38 +41,38 @@ class UnitCardKB2 : public UnitKeyboardBitwise {
4141
static constexpr keyboard::key_index_t KEY_8{7};
4242
static constexpr keyboard::key_index_t KEY_9{8};
4343
static constexpr keyboard::key_index_t KEY_0{9};
44-
static constexpr keyboard::key_index_t KEY_Q{10};
45-
static constexpr keyboard::key_index_t KEY_W{11};
46-
static constexpr keyboard::key_index_t KEY_E{12};
47-
static constexpr keyboard::key_index_t KEY_R{13};
48-
static constexpr keyboard::key_index_t KEY_T{14};
49-
static constexpr keyboard::key_index_t KEY_Y{15};
50-
static constexpr keyboard::key_index_t KEY_U{16};
51-
static constexpr keyboard::key_index_t KEY_I{17};
52-
static constexpr keyboard::key_index_t KEY_O{18};
53-
static constexpr keyboard::key_index_t KEY_P{19};
54-
static constexpr keyboard::key_index_t KEY_DELETE{20};
55-
static constexpr keyboard::key_index_t KEY_AA{21};
56-
static constexpr keyboard::key_index_t KEY_A{22};
57-
static constexpr keyboard::key_index_t KEY_S{23};
58-
static constexpr keyboard::key_index_t KEY_D{24};
59-
static constexpr keyboard::key_index_t KEY_F{25};
60-
static constexpr keyboard::key_index_t KEY_G{26};
61-
static constexpr keyboard::key_index_t KEY_H{27};
62-
static constexpr keyboard::key_index_t KEY_J{28};
63-
static constexpr keyboard::key_index_t KEY_K{29};
64-
static constexpr keyboard::key_index_t KEY_L{30};
65-
static constexpr keyboard::key_index_t KEY_ENTER{31};
66-
static constexpr keyboard::key_index_t KEY_FN{32};
67-
static constexpr keyboard::key_index_t KEY_SYM{33};
68-
static constexpr keyboard::key_index_t KEY_Z{34};
69-
static constexpr keyboard::key_index_t KEY_X{35};
70-
static constexpr keyboard::key_index_t KEY_C{36};
71-
static constexpr keyboard::key_index_t KEY_V{37};
72-
static constexpr keyboard::key_index_t KEY_B{38};
73-
static constexpr keyboard::key_index_t KEY_N{39};
74-
static constexpr keyboard::key_index_t KEY_M{40};
75-
static constexpr keyboard::key_index_t KEY_SPACE{41};
44+
static constexpr keyboard::key_index_t KEY_Q{11};
45+
static constexpr keyboard::key_index_t KEY_W{12};
46+
static constexpr keyboard::key_index_t KEY_E{13};
47+
static constexpr keyboard::key_index_t KEY_R{14};
48+
static constexpr keyboard::key_index_t KEY_T{15};
49+
static constexpr keyboard::key_index_t KEY_Y{16};
50+
static constexpr keyboard::key_index_t KEY_U{17};
51+
static constexpr keyboard::key_index_t KEY_I{18};
52+
static constexpr keyboard::key_index_t KEY_O{19};
53+
static constexpr keyboard::key_index_t KEY_P{20};
54+
static constexpr keyboard::key_index_t KEY_DELETE{21};
55+
static constexpr keyboard::key_index_t KEY_AA{22};
56+
static constexpr keyboard::key_index_t KEY_A{23};
57+
static constexpr keyboard::key_index_t KEY_S{24};
58+
static constexpr keyboard::key_index_t KEY_D{25};
59+
static constexpr keyboard::key_index_t KEY_F{26};
60+
static constexpr keyboard::key_index_t KEY_G{27};
61+
static constexpr keyboard::key_index_t KEY_H{28};
62+
static constexpr keyboard::key_index_t KEY_J{29};
63+
static constexpr keyboard::key_index_t KEY_K{30};
64+
static constexpr keyboard::key_index_t KEY_L{31};
65+
static constexpr keyboard::key_index_t KEY_ENTER{32};
66+
static constexpr keyboard::key_index_t KEY_FN{33};
67+
static constexpr keyboard::key_index_t KEY_SYM{34};
68+
static constexpr keyboard::key_index_t KEY_Z{35};
69+
static constexpr keyboard::key_index_t KEY_X{36};
70+
static constexpr keyboard::key_index_t KEY_C{37};
71+
static constexpr keyboard::key_index_t KEY_V{38};
72+
static constexpr keyboard::key_index_t KEY_B{39};
73+
static constexpr keyboard::key_index_t KEY_N{40};
74+
static constexpr keyboard::key_index_t KEY_M{41};
75+
static constexpr keyboard::key_index_t KEY_SPACE{42};
7676
///@}
7777

7878
///@name Character code for special keys

src/unit/unit_Keyboard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void UnitKeyboard::update(const bool force)
3636
elapsed_time_t at{m5::utility::millis()};
3737
if (force || !_latest || at >= _latest + _interval) {
3838
_updated = (readWithTransaction(&_released_key, 1) == m5::hal::error::error_t::OK) && (_released_key != 0);
39-
printf("released_key:0x%02x\n", _released_key);
39+
// printf("released_key:0x%02x\n", _released_key);
4040
if (_updated) {
4141
_latest = at;
4242
}

0 commit comments

Comments
 (0)