maple: add maple_bus_ft6_key_scan_codes

This commit is contained in:
Zack Buhman 2024-05-19 21:55:25 -05:00
parent d73b41a6ab
commit ad5b98b5ea
5 changed files with 202 additions and 0 deletions

View File

@ -53,6 +53,9 @@ maple/maple_bus_ft0.hpp: regs/maple_bus_ft0.csv regs/gen/maple_data_format.py
maple/maple_bus_ft6.hpp: regs/maple_bus_ft6.csv regs/gen/maple_data_format.py maple/maple_bus_ft6.hpp: regs/maple_bus_ft6.csv regs/gen/maple_data_format.py
python regs/gen/maple_data_format.py $< > $@ python regs/gen/maple_data_format.py $< > $@
maple/maple_bus_ft6_key_scan_codes.hpp: regs/maple_bus_ft6_key_scan_codes.csv regs/gen/maple_key_scan_codes.py
python regs/gen/maple_key_scan_codes.py $< > $@
maple/maple_bus_ft8.hpp: regs/maple_bus_ft8.csv regs/gen/maple_data_format.py maple/maple_bus_ft8.hpp: regs/maple_bus_ft8.csv regs/gen/maple_data_format.py
python regs/gen/maple_data_format.py $< > $@ python regs/gen/maple_data_format.py $< > $@

View File

@ -0,0 +1,90 @@
#include <cstdint>
namespace ft6 {
namespace scan_codes {
constexpr uint32_t no_operation = 0x0;
constexpr uint32_t rollover_error = 0x1;
constexpr uint32_t post_fail = 0x2;
constexpr uint32_t undefined_error = 0x3;
constexpr uint32_t a_A = 0x4;
constexpr uint32_t b_B = 0x5;
constexpr uint32_t c_C = 0x6;
constexpr uint32_t d_D = 0x7;
constexpr uint32_t e_E = 0x8;
constexpr uint32_t f_F = 0x9;
constexpr uint32_t g_G = 0xa;
constexpr uint32_t h_H = 0xb;
constexpr uint32_t i_I = 0xc;
constexpr uint32_t j_J = 0xd;
constexpr uint32_t k_K = 0xe;
constexpr uint32_t l_L = 0xf;
constexpr uint32_t m_M = 0x10;
constexpr uint32_t n_N = 0x11;
constexpr uint32_t o_O = 0x12;
constexpr uint32_t p_P = 0x13;
constexpr uint32_t q_Q = 0x14;
constexpr uint32_t r_R = 0x15;
constexpr uint32_t s_S = 0x16;
constexpr uint32_t t_T = 0x17;
constexpr uint32_t u_U = 0x18;
constexpr uint32_t v_V = 0x19;
constexpr uint32_t w_W = 0x1a;
constexpr uint32_t x_X = 0x1b;
constexpr uint32_t y_Y = 0x1c;
constexpr uint32_t z_Z = 0x1d;
constexpr uint32_t _1_exclam = 0x1e;
constexpr uint32_t _2_at = 0x1f;
constexpr uint32_t _3_numbersign = 0x20;
constexpr uint32_t _4_dollar = 0x21;
constexpr uint32_t _5_percent = 0x22;
constexpr uint32_t _6_asciicircum = 0x23;
constexpr uint32_t _7_ampersand = 0x24;
constexpr uint32_t _8_asterisk = 0x25;
constexpr uint32_t _9_parenleft = 0x26;
constexpr uint32_t _0_parenright = 0x27;
constexpr uint32_t return = 0x28;
constexpr uint32_t esc = 0x29;
constexpr uint32_t backspace = 0x2a;
constexpr uint32_t tab = 0x2b;
constexpr uint32_t spacebar = 0x2c;
constexpr uint32_t minus_underscore = 0x2d;
constexpr uint32_t equal_plus = 0x2e;
constexpr uint32_t bracketleft_braceleft = 0x2f;
constexpr uint32_t bracketright_braceright = 0x30;
constexpr uint32_t backslash_bar = 0x31;
constexpr uint32_t _unknown_ = 0x32;
constexpr uint32_t semicolon_colon = 0x33;
constexpr uint32_t apostrophe_quotedbl = 0x34;
constexpr uint32_t grave_asciitilde = 0x35;
constexpr uint32_t comma_less = 0x36;
constexpr uint32_t period_greater = 0x37;
constexpr uint32_t slash_question = 0x38;
constexpr uint32_t caps_lock = 0x39;
constexpr uint32_t F1 = 0x3a;
constexpr uint32_t F2 = 0x3b;
constexpr uint32_t F3 = 0x3c;
constexpr uint32_t F4 = 0x3d;
constexpr uint32_t F5 = 0x3e;
constexpr uint32_t F6 = 0x3f;
constexpr uint32_t F7 = 0x40;
constexpr uint32_t F8 = 0x41;
constexpr uint32_t F9 = 0x42;
constexpr uint32_t F10 = 0x43;
constexpr uint32_t F11 = 0x44;
constexpr uint32_t F12 = 0x45;
constexpr uint32_t print_screen = 0x46;
constexpr uint32_t scroll_lock = 0x47;
constexpr uint32_t pause = 0x48;
constexpr uint32_t insert = 0x49;
constexpr uint32_t home = 0x4a;
constexpr uint32_t page_up = 0x4b;
constexpr uint32_t delete = 0x4c;
constexpr uint32_t end = 0x4d;
constexpr uint32_t page_down = 0x4e;
constexpr uint32_t left = 0x4f;
constexpr uint32_t right = 0x50;
constexpr uint32_t down = 0x51;
constexpr uint32_t up = 0x52;
}
}

View File

@ -0,0 +1,25 @@
import sys
from csv_input import read_input
from generate import renderer
def render_row(row):
usage = row['usage']
code = int(row['code'], 16)
yield f"constexpr uint32_t {usage} = {hex(code)};"
def render_rows(rows):
yield "#include <cstdint>"
yield ""
yield "namespace ft6 {"
yield "namespace scan_codes {"
for row in rows:
yield from render_row(row)
yield "}"
yield "}"
if __name__ == "__main__":
rows = read_input(sys.argv[1])
render, out = renderer()
render(render_rows(rows))
print(out.getvalue())

View File

@ -0,0 +1,84 @@
"code","usage"
"0x00","no_operation"
"0x01","rollover_error"
"0x02","post_fail"
"0x03","undefined_error"
"0x04","a_A"
"0x05","b_B"
"0x06","c_C"
"0x07","d_D"
"0x08","e_E"
"0x09","f_F"
"0x0a","g_G"
"0x0b","h_H"
"0x0c","i_I"
"0x0d","j_J"
"0x0e","k_K"
"0x0f","l_L"
"0x10","m_M"
"0x11","n_N"
"0x12","o_O"
"0x13","p_P"
"0x14","q_Q"
"0x15","r_R"
"0x16","s_S"
"0x17","t_T"
"0x18","u_U"
"0x19","v_V"
"0x1a","w_W"
"0x1b","x_X"
"0x1c","y_Y"
"0x1d","z_Z"
"0x1e","_1_exclam"
"0x1f","_2_at"
"0x20","_3_numbersign"
"0x21","_4_dollar"
"0x22","_5_percent"
"0x23","_6_asciicircum"
"0x24","_7_ampersand"
"0x25","_8_asterisk"
"0x26","_9_parenleft"
"0x27","_0_parenright"
"0x28","return"
"0x29","esc"
"0x2a","backspace"
"0x2b","tab"
"0x2c","spacebar"
"0x2d","minus_underscore"
"0x2e","equal_plus"
"0x2f","bracketleft_braceleft"
"0x30","bracketright_braceright"
"0x31","backslash_bar"
"0x32","_unknown_"
"0x33","semicolon_colon"
"0x34","apostrophe_quotedbl"
"0x35","grave_asciitilde"
"0x36","comma_less"
"0x37","period_greater"
"0x38","slash_question"
"0x39","caps_lock"
"0x3a","F1"
"0x3b","F2"
"0x3c","F3"
"0x3d","F4"
"0x3e","F5"
"0x3f","F6"
"0x40","F7"
"0x41","F8"
"0x42","F9"
"0x43","F10"
"0x44","F11"
"0x45","F12"
"0x46","print_screen"
"0x47","scroll_lock"
"0x48","pause"
"0x49","insert"
"0x4a","home"
"0x4b","page_up"
"0x4c","delete"
"0x4d","end"
"0x4e","page_down"
"0x4f","left"
"0x50","right"
"0x51","down"
"0x52","up"
1 code usage
2 0x00 no_operation
3 0x01 rollover_error
4 0x02 post_fail
5 0x03 undefined_error
6 0x04 a_A
7 0x05 b_B
8 0x06 c_C
9 0x07 d_D
10 0x08 e_E
11 0x09 f_F
12 0x0a g_G
13 0x0b h_H
14 0x0c i_I
15 0x0d j_J
16 0x0e k_K
17 0x0f l_L
18 0x10 m_M
19 0x11 n_N
20 0x12 o_O
21 0x13 p_P
22 0x14 q_Q
23 0x15 r_R
24 0x16 s_S
25 0x17 t_T
26 0x18 u_U
27 0x19 v_V
28 0x1a w_W
29 0x1b x_X
30 0x1c y_Y
31 0x1d z_Z
32 0x1e _1_exclam
33 0x1f _2_at
34 0x20 _3_numbersign
35 0x21 _4_dollar
36 0x22 _5_percent
37 0x23 _6_asciicircum
38 0x24 _7_ampersand
39 0x25 _8_asterisk
40 0x26 _9_parenleft
41 0x27 _0_parenright
42 0x28 return
43 0x29 esc
44 0x2a backspace
45 0x2b tab
46 0x2c spacebar
47 0x2d minus_underscore
48 0x2e equal_plus
49 0x2f bracketleft_braceleft
50 0x30 bracketright_braceright
51 0x31 backslash_bar
52 0x32 _unknown_
53 0x33 semicolon_colon
54 0x34 apostrophe_quotedbl
55 0x35 grave_asciitilde
56 0x36 comma_less
57 0x37 period_greater
58 0x38 slash_question
59 0x39 caps_lock
60 0x3a F1
61 0x3b F2
62 0x3c F3
63 0x3d F4
64 0x3e F5
65 0x3f F6
66 0x40 F7
67 0x41 F8
68 0x42 F9
69 0x43 F10
70 0x44 F11
71 0x45 F12
72 0x46 print_screen
73 0x47 scroll_lock
74 0x48 pause
75 0x49 insert
76 0x4a home
77 0x4b page_up
78 0x4c delete
79 0x4d end
80 0x4e page_down
81 0x4f left
82 0x50 right
83 0x51 down
84 0x52 up