summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/api.yml2
-rw-r--r--.github/workflows/develop_api.yml6
-rw-r--r--.github/workflows/unit_test.yml2
-rw-r--r--api_data/_config.yml1
-rw-r--r--builddefs/bootloader.mk4
-rw-r--r--builddefs/build_keyboard.mk8
-rw-r--r--builddefs/build_test.mk2
-rw-r--r--builddefs/common_features.mk11
-rw-r--r--builddefs/common_rules.mk2
-rw-r--r--builddefs/converters.mk37
-rw-r--r--builddefs/generic_features.mk3
-rw-r--r--builddefs/mcu_selection.mk84
-rw-r--r--builddefs/show_options.mk5
-rw-r--r--builddefs/testlist.mk1
-rw-r--r--data/mappings/defaults.json35
-rw-r--r--data/mappings/info_config.json10
-rw-r--r--data/mappings/info_rules.json7
-rw-r--r--data/schemas/definitions.jsonschema5
-rw-r--r--data/schemas/keyboard.jsonschema42
-rw-r--r--data/templates/api/readme.md (renamed from api_data/readme.md)0
-rw-r--r--docs/_summary.md20
-rw-r--r--docs/cli_commands.md12
-rw-r--r--docs/config_options.md2
-rw-r--r--docs/data_driven_config.md5
-rw-r--r--docs/feature_caps_word.md156
-rw-r--r--docs/feature_encoders.md36
-rw-r--r--docs/feature_hd44780.md345
-rw-r--r--docs/feature_joystick.md2
-rw-r--r--docs/feature_midi.md6
-rw-r--r--docs/feature_pointing_device.md32
-rw-r--r--docs/feature_rgb_matrix.md14
-rw-r--r--docs/feature_rgblight.md13
-rw-r--r--docs/feature_swap_hands.md13
-rw-r--r--docs/feature_unicode.md11
-rw-r--r--docs/flashing.md11
-rw-r--r--docs/gpio_control.md (renamed from docs/internals_gpio_control.md)0
-rw-r--r--docs/internals/defines.md (renamed from docs/internals_defines.md)0
-rw-r--r--docs/internals/input_callback_reg.md (renamed from docs/internals_input_callback_reg.md)0
-rw-r--r--docs/internals/midi_device.md (renamed from docs/internals_midi_device.md)0
-rw-r--r--docs/internals/midi_device_setup_process.md (renamed from docs/internals_midi_device_setup_process.md)0
-rw-r--r--docs/internals/midi_util.md (renamed from docs/internals_midi_util.md)0
-rw-r--r--docs/internals/send_functions.md (renamed from docs/internals_send_functions.md)0
-rw-r--r--docs/internals/sysex_tools.md (renamed from docs/internals_sysex_tools.md)0
-rw-r--r--docs/ja/_summary.md16
-rw-r--r--docs/ja/feature_unicode.md11
-rw-r--r--docs/ja/gpio_control.md (renamed from docs/ja/internals_gpio_control.md)4
-rw-r--r--docs/ja/internals_defines.md78
-rw-r--r--docs/ja/internals_input_callback_reg.md173
-rw-r--r--docs/ja/internals_midi_device.md148
-rw-r--r--docs/ja/internals_midi_device_setup_process.md36
-rw-r--r--docs/ja/internals_midi_util.md59
-rw-r--r--docs/ja/internals_send_functions.md246
-rw-r--r--docs/ja/internals_sysex_tools.md66
-rw-r--r--docs/ja/proton_c_conversion.md2
-rw-r--r--docs/keycodes.md20
-rw-r--r--docs/proton_c_conversion.md2
-rw-r--r--docs/quantum_keycodes.md12
-rw-r--r--docs/quantum_painter.md705
-rw-r--r--docs/quantum_painter_qff.md103
-rw-r--r--docs/quantum_painter_qgf.md178
-rw-r--r--docs/quantum_painter_rle.md29
-rw-r--r--docs/squeezing_avr.md13
-rw-r--r--docs/tap_hold.md2
-rw-r--r--docs/zh-cn/_summary.md16
-rw-r--r--drivers/gpio/sn74x154.c58
-rw-r--r--drivers/gpio/sn74x154.h48
-rw-r--r--drivers/lcd/hd44780.c284
-rw-r--r--drivers/lcd/hd44780.h220
-rw-r--r--drivers/led/issi/is31fl3737.c6
-rw-r--r--drivers/painter/comms/qp_comms_spi.c137
-rw-r--r--drivers/painter/comms/qp_comms_spi.h51
-rw-r--r--drivers/painter/gc9a01/qp_gc9a01.c150
-rw-r--r--drivers/painter/gc9a01/qp_gc9a01.h37
-rw-r--r--drivers/painter/gc9a01/qp_gc9a01_opcodes.h78
-rw-r--r--drivers/painter/ili9xxx/qp_ili9163.c121
-rw-r--r--drivers/painter/ili9xxx/qp_ili9163.h37
-rw-r--r--drivers/painter/ili9xxx/qp_ili9341.c128
-rw-r--r--drivers/painter/ili9xxx/qp_ili9341.h37
-rw-r--r--drivers/painter/ili9xxx/qp_ili9xxx_opcodes.h100
-rw-r--r--drivers/painter/ssd1351/qp_ssd1351.c125
-rw-r--r--drivers/painter/ssd1351/qp_ssd1351.h37
-rw-r--r--drivers/painter/ssd1351/qp_ssd1351_opcodes.h48
-rw-r--r--drivers/painter/st77xx/qp_st7789.c144
-rw-r--r--drivers/painter/st77xx/qp_st7789.h44
-rw-r--r--drivers/painter/st77xx/qp_st7789_opcodes.h64
-rw-r--r--drivers/painter/st77xx/qp_st77xx_opcodes.h51
-rw-r--r--drivers/painter/tft_panel/qp_tft_panel.c130
-rw-r--r--drivers/painter/tft_panel/qp_tft_panel.h67
-rw-r--r--drivers/sensors/pmw3360.c155
-rw-r--r--drivers/sensors/pmw3360.h16
-rw-r--r--keyboards/al1/config.h5
-rw-r--r--keyboards/al1/matrix.c152
-rw-r--r--keyboards/al1/rules.mk3
-rwxr-xr-xkeyboards/amjkeyboard/amj40/amj40.c (renamed from keyboards/amj40/amj40.c)0
-rwxr-xr-xkeyboards/amjkeyboard/amj40/amj40.h (renamed from keyboards/amj40/amj40.h)0
-rwxr-xr-xkeyboards/amjkeyboard/amj40/config.h (renamed from keyboards/amj40/config.h)2
-rw-r--r--keyboards/amjkeyboard/amj40/info.json (renamed from keyboards/amj40/info.json)0
-rwxr-xr-xkeyboards/amjkeyboard/amj40/keymaps/default/keymap.c (renamed from keyboards/amj40/keymaps/default/keymap.c)0
-rwxr-xr-xkeyboards/amjkeyboard/amj40/keymaps/default/readme.md (renamed from keyboards/amj40/keymaps/default/readme.md)0
-rw-r--r--keyboards/amjkeyboard/amj40/keymaps/default_625u_space/keymap.c (renamed from keyboards/amj40/keymaps/default_625u_space/keymap.c)0
-rw-r--r--keyboards/amjkeyboard/amj40/keymaps/default_ortho_275u_space/keymap.c (renamed from keyboards/amj40/keymaps/default_ortho_275u_space/keymap.c)0
-rw-r--r--keyboards/amjkeyboard/amj40/keymaps/default_ortho_600u_space/keymap.c (renamed from keyboards/amj40/keymaps/default_ortho_600u_space/keymap.c)0
-rwxr-xr-xkeyboards/amjkeyboard/amj40/keymaps/fabian/keymap.c (renamed from keyboards/amj40/keymaps/fabian/keymap.c)0
-rw-r--r--keyboards/amjkeyboard/amj40/keymaps/fabian/rules.mk (renamed from keyboards/amj40/keymaps/fabian/rules.mk)0
-rw-r--r--keyboards/amjkeyboard/amj40/keymaps/jetpacktuxedo/config.h (renamed from keyboards/amj40/keymaps/jetpacktuxedo/config.h)0
-rwxr-xr-xkeyboards/amjkeyboard/amj40/keymaps/jetpacktuxedo/keymap.c (renamed from keyboards/amj40/keymaps/jetpacktuxedo/keymap.c)0
-rwxr-xr-xkeyboards/amjkeyboard/amj40/keymaps/jetpacktuxedo/readme.md (renamed from keyboards/amj40/keymaps/jetpacktuxedo/readme.md)0
-rw-r--r--keyboards/amjkeyboard/amj40/keymaps/jetpacktuxedo/rules.mk (renamed from keyboards/amj40/keymaps/jetpacktuxedo/rules.mk)0
-rw-r--r--keyboards/amjkeyboard/amj40/keymaps/myee/build.sh (renamed from keyboards/amj40/keymaps/myee/build.sh)0
-rw-r--r--keyboards/amjkeyboard/amj40/keymaps/myee/config.h (renamed from keyboards/amj40/keymaps/myee/config.h)0
-rw-r--r--keyboards/amjkeyboard/amj40/keymaps/myee/keymap.c (renamed from keyboards/amj40/keymaps/myee/keymap.c)0
-rw-r--r--keyboards/amjkeyboard/amj40/keymaps/myee/readme.md (renamed from keyboards/amj40/keymaps/myee/readme.md)0
-rw-r--r--keyboards/amjkeyboard/amj40/keymaps/myee/rules.mk (renamed from keyboards/amj40/keymaps/myee/rules.mk)0
-rw-r--r--keyboards/amjkeyboard/amj40/keymaps/myee/updatemerge.sh (renamed from keyboards/amj40/keymaps/myee/updatemerge.sh)0
-rwxr-xr-xkeyboards/amjkeyboard/amj40/readme.md (renamed from keyboards/amj40/readme.md)4
-rwxr-xr-xkeyboards/amjkeyboard/amj40/rules.mk (renamed from keyboards/amj40/rules.mk)0
-rw-r--r--keyboards/amjkeyboard/amj60/amj60.c (renamed from keyboards/amj60/amj60.c)0
-rw-r--r--keyboards/amjkeyboard/amj60/amj60.h (renamed from keyboards/amj60/amj60.h)0
-rw-r--r--keyboards/amjkeyboard/amj60/config.h (renamed from keyboards/amj60/config.h)2
-rw-r--r--keyboards/amjkeyboard/amj60/info.json (renamed from keyboards/amj60/info.json)0
-rw-r--r--keyboards/amjkeyboard/amj60/keymaps/default/keymap.c (renamed from keyboards/amj60/keymaps/default/keymap.c)0
-rw-r--r--keyboards/amjkeyboard/amj60/readme.md (renamed from keyboards/amj60/readme.md)4
-rw-r--r--keyboards/amjkeyboard/amj60/rules.mk (renamed from keyboards/amj60/rules.mk)0
-rw-r--r--keyboards/amjkeyboard/amj66/config.h2
-rw-r--r--keyboards/amjkeyboard/amj96/amj96.c (renamed from keyboards/amj96/amj96.c)0
-rw-r--r--keyboards/amjkeyboard/amj96/amj96.h (renamed from keyboards/amj96/amj96.h)0
-rw-r--r--keyboards/amjkeyboard/amj96/config.h (renamed from keyboards/amj96/config.h)2
-rw-r--r--keyboards/amjkeyboard/amj96/info.json (renamed from keyboards/amj96/info.json)0
-rw-r--r--keyboards/amjkeyboard/amj96/keymaps/default/keymap.c (renamed from keyboards/amj96/keymaps/default/keymap.c)0
-rw-r--r--keyboards/amjkeyboard/amj96/matrix.c (renamed from keyboards/amj96/matrix.c)0
-rw-r--r--keyboards/amjkeyboard/amj96/readme.md (renamed from keyboards/amj96/readme.md)4
-rw-r--r--keyboards/amjkeyboard/amj96/rules.mk (renamed from keyboards/amj96/rules.mk)0
-rw-r--r--keyboards/amjkeyboard/amjpad/amjpad.c (renamed from keyboards/amjpad/amjpad.c)0
-rw-r--r--keyboards/amjkeyboard/amjpad/amjpad.h (renamed from keyboards/amjpad/amjpad.h)0
-rw-r--r--keyboards/amjkeyboard/amjpad/config.h (renamed from keyboards/amjpad/config.h)2
-rw-r--r--keyboards/amjkeyboard/amjpad/info.json (renamed from keyboards/amjpad/info.json)0
-rw-r--r--keyboards/amjkeyboard/amjpad/keymaps/default/keymap.c (renamed from keyboards/amjpad/keymaps/default/keymap.c)0
-rw-r--r--keyboards/amjkeyboard/amjpad/keymaps/max/keymap.c (renamed from keyboards/amjpad/keymaps/max/keymap.c)0
-rw-r--r--keyboards/amjkeyboard/amjpad/keymaps/ortho_left/keymap.c (renamed from keyboards/amjpad/keymaps/ortho_left/keymap.c)0
-rw-r--r--keyboards/amjkeyboard/amjpad/keymaps/ortho_right/keymap.c (renamed from keyboards/amjpad/keymaps/ortho_right/keymap.c)0
-rw-r--r--keyboards/amjkeyboard/amjpad/readme.md (renamed from keyboards/amjpad/readme.md)2
-rw-r--r--keyboards/amjkeyboard/amjpad/rules.mk (renamed from keyboards/amjpad/rules.mk)0
-rw-r--r--keyboards/bt66tech/bt66tech60/chconf.h29
-rw-r--r--keyboards/cannonkeys/ortho48/chconf.h29
-rw-r--r--keyboards/cannonkeys/ortho60/chconf.h29
-rw-r--r--keyboards/cannonkeys/ortho75/chconf.h29
-rw-r--r--keyboards/cannonkeys/practice60/chconf.h29
-rw-r--r--keyboards/cannonkeys/practice65/chconf.h29
-rw-r--r--keyboards/converter/siemens_tastatur/chconf.h29
-rw-r--r--keyboards/converter/usb_usb/info.json1032
-rw-r--r--keyboards/converter/usb_usb/keymaps/chriskopher/keymap.c48
-rw-r--r--keyboards/converter/usb_usb/rules.mk2
-rw-r--r--keyboards/converter/usb_usb/usb_usb.h32
-rw-r--r--keyboards/draculad/config.h3
-rw-r--r--keyboards/evyd13/wasdat/matrix.c43
-rw-r--r--keyboards/evyd13/wasdat_code/config.h11
-rw-r--r--keyboards/evyd13/wasdat_code/matrix.c332
-rw-r--r--keyboards/evyd13/wasdat_code/rules.mk3
-rw-r--r--keyboards/gboards/gergoplex/config.h2
-rw-r--r--keyboards/gboards/gergoplex/keymaps/colemak-dhm/config.h4
-rw-r--r--keyboards/gboards/gergoplex/keymaps/colemak-dhm/rules.mk1
-rw-r--r--keyboards/gboards/gergoplex/keymaps/default/config.h4
-rw-r--r--keyboards/gboards/gergoplex/keymaps/default/rules.mk1
-rw-r--r--keyboards/gboards/gergoplex/keymaps/georgepetri/config.h2
-rw-r--r--keyboards/gboards/gergoplex/keymaps/georgepetri/rules.mk1
-rw-r--r--keyboards/gboards/gergoplex/keymaps/tgrosinger/config.h4
-rw-r--r--keyboards/gboards/gergoplex/keymaps/tgrosinger/rules.mk1
-rw-r--r--keyboards/gboards/gergoplex/rules.mk1
-rw-r--r--keyboards/gmmk/pro/ansi/keymaps/andrewcharnley/config.h (renamed from keyboards/ramonimbao/squishyfrl/chconf.h)10
-rw-r--r--keyboards/gmmk/pro/ansi/keymaps/andrewcharnley/keymap.c87
-rw-r--r--keyboards/gmmk/pro/ansi/keymaps/andrewcharnley/readme.md18
-rw-r--r--keyboards/handwired/battleship_gamepad/battleship_gamepad.c2
-rw-r--r--keyboards/handwired/misterdeck/keymaps/default/keymap.c2
-rw-r--r--keyboards/handwired/misterdeck/keymaps/nobuttons/keymap.c2
-rw-r--r--keyboards/handwired/ms_sculpt_mobile/astar/config.h6
-rw-r--r--keyboards/handwired/ms_sculpt_mobile/astar/rules.mk5
-rw-r--r--keyboards/handwired/ms_sculpt_mobile/config.h17
-rw-r--r--keyboards/handwired/ms_sculpt_mobile/info.json187
-rw-r--r--keyboards/handwired/ms_sculpt_mobile/keymaps/default/rules.mk10
-rw-r--r--keyboards/handwired/ms_sculpt_mobile/readme.md2
-rw-r--r--keyboards/handwired/ms_sculpt_mobile/rules.mk20
-rw-r--r--keyboards/handwired/ms_sculpt_mobile/teensy2pp/config.h6
-rw-r--r--keyboards/handwired/ms_sculpt_mobile/teensy2pp/rules.mk5
-rw-r--r--keyboards/handwired/onekey/blackpill_f401/blackpill_f401.c23
-rw-r--r--keyboards/handwired/onekey/bluepill/chconf.h28
-rw-r--r--keyboards/handwired/onekey/keymaps/hardware_id/keymap.c28
-rw-r--r--keyboards/handwired/onekey/keymaps/joystick/keymap.c2
-rw-r--r--keyboards/handwired/onekey/keymaps/reboot/keymap.c5
-rw-r--r--keyboards/handwired/pill60/bluepill/chconf.h29
-rw-r--r--keyboards/handwired/sono1/stm32f103/chconf.h28
-rw-r--r--keyboards/handwired/t111/chconf.h29
-rw-r--r--keyboards/handwired/uthol/rev3/rev3.c2
-rw-r--r--keyboards/handwired/wakizashi40/config.h1
-rw-r--r--keyboards/handwired/wakizashi40/info.json10
-rw-r--r--keyboards/handwired/wakizashi40/keymaps/via/keymap.c96
-rw-r--r--keyboards/handwired/wakizashi40/readme.md12
-rw-r--r--keyboards/handwired/xealous/info.json23
-rw-r--r--keyboards/handwired/xealous/keymaps/default/keymap.c9
-rw-r--r--keyboards/handwired/xealous/rev1/rev1.h2
-rw-r--r--keyboards/handwired/z150/chconf.h29
-rw-r--r--keyboards/helix/local_drivers/i2c.c159
-rw-r--r--keyboards/helix/local_drivers/i2c.h46
-rw-r--r--keyboards/helix/local_drivers/serial.c589
-rw-r--r--keyboards/helix/local_drivers/serial.h86
-rw-r--r--keyboards/helix/local_drivers/ssd1306.c341
-rw-r--r--keyboards/helix/local_drivers/ssd1306.h89
-rw-r--r--keyboards/helix/rev2/config.h6
-rw-r--r--keyboards/helix/rev2/custom/matrix.c341
-rw-r--r--keyboards/helix/rev2/custom/split_scomm.c92
-rw-r--r--keyboards/helix/rev2/custom/split_scomm.h21
-rw-r--r--keyboards/helix/rev2/custom/split_util.c109
-rw-r--r--keyboards/helix/rev2/custom/split_util.h21
-rw-r--r--keyboards/helix/rev2/keymaps/default/oled_display.c196
-rw-r--r--keyboards/helix/rev2/local_features.mk53
-rw-r--r--keyboards/helix/rev2/override_helix_options.mk-maintenance (renamed from keyboards/helix/rev2/override_helix_options.mk)0
-rw-r--r--keyboards/helix/rev2/rev2.c16
-rw-r--r--keyboards/helix/rev2/rules.mk7
-rw-r--r--keyboards/hhkb/jp/info.json2
-rw-r--r--keyboards/hhkb/jp/jp.h2
-rw-r--r--keyboards/hhkb/jp/keymaps/bakingpy/keymap.c4
-rw-r--r--keyboards/hhkb/jp/keymaps/default/keymap.c4
-rw-r--r--keyboards/hhkb/jp/keymaps/default_mac/keymap.c4
-rw-r--r--keyboards/hhkb/jp/keymaps/dhertz/keymap.c6
-rw-r--r--keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c4
-rw-r--r--keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c6
-rw-r--r--keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c6
-rw-r--r--keyboards/hhkb/jp/keymaps/sh_jp/keymap.c10
-rw-r--r--keyboards/hhkb/jp/keymaps/via/keymap.c6
-rw-r--r--keyboards/hnahkb/vn66/rules.mk1
-rw-r--r--keyboards/horrortroll/handwired_k552/rules.mk1
-rw-r--r--keyboards/input_club/ergodox_infinity/mcuconf.h2
-rw-r--r--keyboards/kabedon/kabedon98e/chconf.h28
-rw-r--r--keyboards/keyhive/absinthe/absinthe.c (renamed from keyboards/absinthe/absinthe.c)0
-rw-r--r--keyboards/keyhive/absinthe/absinthe.h (renamed from keyboards/absinthe/absinthe.h)0
-rw-r--r--keyboards/keyhive/absinthe/config.h (renamed from keyboards/absinthe/config.h)0
-rw-r--r--keyboards/keyhive/absinthe/info.json (renamed from keyboards/absinthe/info.json)0
-rw-r--r--keyboards/keyhive/absinthe/keymaps/ansi/keymap.c (renamed from keyboards/absinthe/keymaps/ansi/keymap.c)0
-rw-r--r--keyboards/keyhive/absinthe/keymaps/ansi/readme.md (renamed from keyboards/absinthe/keymaps/ansi/readme.md)0
-rw-r--r--keyboards/keyhive/absinthe/keymaps/default/keymap.c (renamed from keyboards/absinthe/keymaps/default/keymap.c)0
-rw-r--r--keyboards/keyhive/absinthe/keymaps/default/readme.md (renamed from keyboards/absinthe/keymaps/default/readme.md)0
-rw-r--r--keyboards/keyhive/absinthe/keymaps/via/keymap.c (renamed from keyboards/absinthe/keymaps/via/keymap.c)0
-rw-r--r--keyboards/keyhive/absinthe/keymaps/via/rules.mk (renamed from keyboards/absinthe/keymaps/via/rules.mk)0
-rw-r--r--keyboards/keyhive/absinthe/readme.md (renamed from keyboards/absinthe/readme.md)2
-rw-r--r--keyboards/keyhive/absinthe/rules.mk (renamed from keyboards/absinthe/rules.mk)0
-rw-r--r--keyboards/keyhive/ergosaurus/config.h (renamed from keyboards/ergosaurus/config.h)0
-rw-r--r--keyboards/keyhive/ergosaurus/ergosaurus.c (renamed from keyboards/ergosaurus/ergosaurus.c)0
-rw-r--r--keyboards/keyhive/ergosaurus/ergosaurus.h (renamed from keyboards/ergosaurus/ergosaurus.h)0
-rw-r--r--keyboards/keyhive/ergosaurus/info.json (renamed from keyboards/ergosaurus/info.json)0
-rw-r--r--keyboards/keyhive/ergosaurus/keymaps/default/keymap.c (renamed from keyboards/ergosaurus/keymaps/default/keymap.c)0
-rw-r--r--keyboards/keyhive/ergosaurus/keymaps/default/readme.md (renamed from keyboards/ergosaurus/keymaps/default/readme.md)0
-rw-r--r--keyboards/keyhive/ergosaurus/keymaps/via/keymap.c (renamed from keyboards/ergosaurus/keymaps/via/keymap.c)0
-rw-r--r--keyboards/keyhive/ergosaurus/keymaps/via/rules.mk (renamed from keyboards/ergosaurus/keymaps/via/rules.mk)0
-rw-r--r--keyboards/keyhive/ergosaurus/readme.md (renamed from keyboards/ergosaurus/readme.md)2
-rw-r--r--keyboards/keyhive/ergosaurus/rules.mk (renamed from keyboards/ergosaurus/rules.mk)0
-rwxr-xr-xkeyboards/keyhive/honeycomb/config.h (renamed from keyboards/honeycomb/config.h)0
-rwxr-xr-xkeyboards/keyhive/honeycomb/honeycomb.c (renamed from keyboards/honeycomb/honeycomb.c)0
-rwxr-xr-xkeyboards/keyhive/honeycomb/honeycomb.h (renamed from keyboards/honeycomb/honeycomb.h)0
-rw-r--r--keyboards/keyhive/honeycomb/info.json (renamed from keyboards/honeycomb/info.json)0
-rwxr-xr-xkeyboards/keyhive/honeycomb/keymaps/default/keymap.c (renamed from keyboards/honeycomb/keymaps/default/keymap.c)0
-rwxr-xr-xkeyboards/keyhive/honeycomb/matrix.c (renamed from keyboards/honeycomb/matrix.c)0
-rwxr-xr-xkeyboards/keyhive/honeycomb/readme.md (renamed from keyboards/honeycomb/readme.md)6
-rwxr-xr-xkeyboards/keyhive/honeycomb/rules.mk (renamed from keyboards/honeycomb/rules.mk)0
-rw-r--r--keyboards/keyhive/lattice60/config.h (renamed from keyboards/lattice60/config.h)0
-rw-r--r--keyboards/keyhive/lattice60/info.json (renamed from keyboards/lattice60/info.json)0
-rw-r--r--keyboards/keyhive/lattice60/keymaps/default/config.h (renamed from keyboards/lattice60/keymaps/default/config.h)0
-rw-r--r--keyboards/keyhive/lattice60/keymaps/default/keymap.c (renamed from keyboards/lattice60/keymaps/default/keymap.c)0
-rw-r--r--keyboards/keyhive/lattice60/keymaps/default/readme.md (renamed from keyboards/lattice60/keymaps/default/readme.md)0
-rw-r--r--keyboards/keyhive/lattice60/keymaps/default_hhkb/config.h (renamed from keyboards/lattice60/keymaps/default_hhkb/config.h)0
-rw-r--r--keyboards/keyhive/lattice60/keymaps/default_hhkb/keymap.c (renamed from keyboards/lattice60/keymaps/default_hhkb/keymap.c)0
-rw-r--r--keyboards/keyhive/lattice60/keymaps/default_hhkb/readme.md (renamed from keyboards/lattice60/keymaps/default_hhkb/readme.md)0
-rw-r--r--keyboards/keyhive/lattice60/keymaps/emdarcher/config.h (renamed from keyboards/lattice60/keymaps/emdarcher/config.h)0
-rw-r--r--keyboards/keyhive/lattice60/keymaps/emdarcher/keymap.c (renamed from keyboards/lattice60/keymaps/emdarcher/keymap.c)0
-rw-r--r--keyboards/keyhive/lattice60/keymaps/emdarcher/readme.md (renamed from keyboards/lattice60/keymaps/emdarcher/readme.md)0
-rw-r--r--keyboards/keyhive/lattice60/lattice60.c (renamed from keyboards/lattice60/lattice60.c)0
-rw-r--r--keyboards/keyhive/lattice60/lattice60.h (renamed from keyboards/lattice60/lattice60.h)0
-rw-r--r--keyboards/keyhive/lattice60/readme.md (renamed from keyboards/lattice60/readme.md)4
-rw-r--r--keyboards/keyhive/lattice60/rules.mk (renamed from keyboards/lattice60/rules.mk)0
-rw-r--r--keyboards/keyhive/navi10/.noci (renamed from keyboards/navi10/.noci)0
-rw-r--r--keyboards/keyhive/navi10/info.json (renamed from keyboards/navi10/info.json)0
-rw-r--r--keyboards/keyhive/navi10/keymaps/default/keymap.c (renamed from keyboards/navi10/keymaps/default/keymap.c)0
-rw-r--r--keyboards/keyhive/navi10/keymaps/default/readme.md (renamed from keyboards/navi10/keymaps/default/readme.md)0
-rw-r--r--keyboards/keyhive/navi10/keymaps/default/rules.mk (renamed from keyboards/mt980/keymaps/walker/rules.mk)0
-rw-r--r--keyboards/keyhive/navi10/keymaps/devdev/config.h (renamed from keyboards/navi10/keymaps/devdev/config.h)0
-rw-r--r--keyboards/keyhive/navi10/keymaps/devdev/keymap.c (renamed from keyboards/navi10/keymaps/devdev/keymap.c)0
-rw-r--r--keyboards/keyhive/navi10/keymaps/devdev/rules.mk (renamed from keyboards/navi10/keymaps/devdev/rules.mk)0
-rw-r--r--keyboards/keyhive/navi10/keymaps/emdarcher/keymap.c (renamed from keyboards/navi10/keymaps/emdarcher/keymap.c)0
-rw-r--r--keyboards/keyhive/navi10/keymaps/emdarcher/readme.md (renamed from keyboards/navi10/keymaps/emdarcher/readme.md)0
-rw-r--r--keyboards/keyhive/navi10/keymaps/emdarcher/rules.mk (renamed from keyboards/navi10/keymaps/default/rules.mk)0
-rw-r--r--keyboards/keyhive/navi10/readme.md (renamed from keyboards/navi10/readme.md)4
-rw-r--r--keyboards/keyhive/navi10/rev0/.noci (renamed from keyboards/navi10/rev0/.noci)0
-rw-r--r--keyboards/keyhive/navi10/rev0/config.h (renamed from keyboards/navi10/rev0/config.h)0
-rw-r--r--keyboards/keyhive/navi10/rev0/rev0.c (renamed from keyboards/navi10/rev0/rev0.c)0
-rw-r--r--keyboards/keyhive/navi10/rev0/rev0.h (renamed from keyboards/navi10/rev0/rev0.h)0
-rw-r--r--keyboards/keyhive/navi10/rev0/rules.mk (renamed from keyboards/navi10/rev0/rules.mk)0
-rw-r--r--keyboards/keyhive/navi10/rev2/.noci (renamed from keyboards/navi10/rev2/.noci)0
-rw-r--r--keyboards/keyhive/navi10/rev2/config.h (renamed from keyboards/navi10/rev2/config.h)0
-rw-r--r--keyboards/keyhive/navi10/rev2/rev2.c (renamed from keyboards/navi10/rev2/rev2.c)0
-rw-r--r--keyboards/keyhive/navi10/rev2/rev2.h (renamed from keyboards/navi10/rev2/rev2.h)0
-rw-r--r--keyboards/keyhive/navi10/rev2/rules.mk (renamed from keyboards/navi10/rev2/rules.mk)0
-rw-r--r--keyboards/keyhive/navi10/rev3/config.h (renamed from keyboards/navi10/rev3/config.h)0
-rw-r--r--keyboards/keyhive/navi10/rev3/rev3.c (renamed from keyboards/navi10/rev3/rev3.c)0
-rw-r--r--keyboards/keyhive/navi10/rev3/rev3.h (renamed from keyboards/navi10/rev3/rev3.h)0
-rw-r--r--keyboards/keyhive/navi10/rev3/rules.mk (renamed from keyboards/navi10/rev3/rules.mk)0
-rw-r--r--keyboards/keyhive/navi10/rules.mk1
-rw-r--r--keyboards/keyhive/opus/config.h (renamed from keyboards/opus/config.h)0
-rw-r--r--keyboards/keyhive/opus/info.json (renamed from keyboards/opus/info.json)0
-rw-r--r--keyboards/keyhive/opus/keymaps/default/keymap.c (renamed from keyboards/opus/keymaps/default/keymap.c)0
-rw-r--r--keyboards/keyhive/opus/keymaps/default/readme.md (renamed from keyboards/opus/keymaps/default/readme.md)0
-rw-r--r--keyboards/keyhive/opus/keymaps/thefoxcodes/config.h (renamed from keyboards/opus/keymaps/thefoxcodes/config.h)0
-rw-r--r--keyboards/keyhive/opus/keymaps/thefoxcodes/keymap.c (renamed from keyboards/opus/keymaps/thefoxcodes/keymap.c)0
-rw-r--r--keyboards/keyhive/opus/keymaps/thefoxcodes/readme.md (renamed from keyboards/opus/keymaps/thefoxcodes/readme.md)0
-rw-r--r--keyboards/keyhive/opus/keymaps/thefoxcodes/rules.mk (renamed from keyboards/opus/keymaps/thefoxcodes/rules.mk)0
-rw-r--r--keyboards/keyhive/opus/opus.c (renamed from keyboards/opus/opus.c)0
-rw-r--r--keyboards/keyhive/opus/opus.h (renamed from keyboards/opus/opus.h)0
-rw-r--r--keyboards/keyhive/opus/readme.md (renamed from keyboards/opus/readme.md)2
-rw-r--r--keyboards/keyhive/opus/rules.mk (renamed from keyboards/opus/rules.mk)0
-rw-r--r--keyboards/keyhive/smallice/config.h (renamed from keyboards/smallice/config.h)0
-rw-r--r--keyboards/keyhive/smallice/info.json (renamed from keyboards/smallice/info.json)0
-rw-r--r--keyboards/keyhive/smallice/keymaps/default/keymap.c (renamed from keyboards/smallice/keymaps/default/keymap.c)0
-rw-r--r--keyboards/keyhive/smallice/keymaps/default/readme.md (renamed from keyboards/smallice/keymaps/default/readme.md)0
-rw-r--r--keyboards/keyhive/smallice/keymaps/via/keymap.c (renamed from keyboards/smallice/keymaps/via/keymap.c)0
-rw-r--r--keyboards/keyhive/smallice/keymaps/via/readme.md (renamed from keyboards/smallice/keymaps/via/readme.md)0
-rw-r--r--keyboards/keyhive/smallice/keymaps/via/rules.mk (renamed from keyboards/smallice/keymaps/via/rules.mk)0
-rw-r--r--keyboards/keyhive/smallice/readme.md (renamed from keyboards/smallice/readme.md)2
-rw-r--r--keyboards/keyhive/smallice/rules.mk (renamed from keyboards/smallice/rules.mk)0
-rw-r--r--keyboards/keyhive/smallice/smallice.c (renamed from keyboards/smallice/smallice.c)0
-rw-r--r--keyboards/keyhive/smallice/smallice.h (renamed from keyboards/smallice/smallice.h)0
-rw-r--r--keyboards/keyhive/southpole/config.h (renamed from keyboards/southpole/config.h)0
-rw-r--r--keyboards/keyhive/southpole/info.json (renamed from keyboards/southpole/info.json)0
-rw-r--r--keyboards/keyhive/southpole/keymaps/default/keymap.c (renamed from keyboards/southpole/keymaps/default/keymap.c)0
-rw-r--r--keyboards/keyhive/southpole/keymaps/foobeard/keymap.c (renamed from keyboards/southpole/keymaps/foobeard/keymap.c)0
-rw-r--r--keyboards/keyhive/southpole/readme.md (renamed from keyboards/southpole/readme.md)4
-rw-r--r--keyboards/keyhive/southpole/rules.mk (renamed from keyboards/southpole/rules.mk)0
-rw-r--r--keyboards/keyhive/southpole/southpole.c (renamed from keyboards/southpole/southpole.c)0
-rw-r--r--keyboards/keyhive/southpole/southpole.h (renamed from keyboards/southpole/southpole.h)0
-rw-r--r--keyboards/keyhive/uno/config.h (renamed from keyboards/uno/config.h)0
-rw-r--r--keyboards/keyhive/uno/info.json (renamed from keyboards/uno/info.json)0
-rw-r--r--keyboards/keyhive/uno/keymaps/copypasta/keymap.c (renamed from keyboards/uno/keymaps/copypasta/keymap.c)0
-rw-r--r--keyboards/keyhive/uno/keymaps/copypasta/readme.md (renamed from keyboards/uno/keymaps/copypasta/readme.md)0
-rw-r--r--keyboards/keyhive/uno/keymaps/default/keymap.c (renamed from keyboards/uno/keymaps/default/keymap.c)0
-rw-r--r--keyboards/keyhive/uno/keymaps/default/readme.md (renamed from keyboards/uno/keymaps/default/readme.md)0
-rw-r--r--keyboards/keyhive/uno/keymaps/demo/keymap.c (renamed from keyboards/uno/keymaps/demo/keymap.c)0
-rw-r--r--keyboards/keyhive/uno/keymaps/demo/readme.md (renamed from keyboards/uno/keymaps/demo/readme.md)0
-rw-r--r--keyboards/keyhive/uno/readme.md (renamed from keyboards/uno/readme.md)8
-rw-r--r--keyboards/keyhive/uno/rev1/config.h (renamed from keyboards/uno/rev1/config.h)0
-rw-r--r--keyboards/keyhive/uno/rev1/rev1.h (renamed from keyboards/uno/rev1/rev1.h)0
-rw-r--r--keyboards/keyhive/uno/rev1/rules.mk (renamed from keyboards/uno/rev1/rules.mk)0
-rw-r--r--keyboards/keyhive/uno/rev2/config.h (renamed from keyboards/uno/rev2/config.h)0
-rw-r--r--keyboards/keyhive/uno/rev2/rev2.h (renamed from keyboards/uno/rev2/rev2.h)0
-rw-r--r--keyboards/keyhive/uno/rev2/rules.mk (renamed from keyboards/uno/rev2/rules.mk)0
-rw-r--r--keyboards/keyhive/uno/rules.mk1
-rw-r--r--keyboards/keyhive/uno/uno.c (renamed from keyboards/uno/uno.c)0
-rw-r--r--keyboards/keyhive/uno/uno.h (renamed from keyboards/uno/uno.h)4
-rw-r--r--keyboards/keyhive/ut472/config.h (renamed from keyboards/ut472/config.h)0
-rw-r--r--keyboards/keyhive/ut472/info.json (renamed from keyboards/ut472/info.json)0
-rwxr-xr-xkeyboards/keyhive/ut472/keymaps/annihilator6000/UT472_Annihilator6000_Configurator_file.json (renamed from keyboards/ut472/keymaps/annihilator6000/UT472_Annihilator6000_Configurator_file.json)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/annihilator6000/config.h (renamed from keyboards/ut472/keymaps/annihilator6000/config.h)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/annihilator6000/keymap.c (renamed from keyboards/ut472/keymaps/annihilator6000/keymap.c)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/annihilator6000/readme.md (renamed from keyboards/ut472/keymaps/annihilator6000/readme.md)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/default/keymap.c (renamed from keyboards/ut472/keymaps/default/keymap.c)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/default/readme.md (renamed from keyboards/ut472/keymaps/default/readme.md)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/hvp/config.h (renamed from keyboards/ut472/keymaps/hvp/config.h)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/hvp/keymap.c (renamed from keyboards/ut472/keymaps/hvp/keymap.c)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/hvp/readme.md (renamed from keyboards/ut472/keymaps/hvp/readme.md)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/hvp/rules.mk (renamed from keyboards/ut472/keymaps/hvp/rules.mk)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/stefanopace/config.h (renamed from keyboards/ut472/keymaps/stefanopace/config.h)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/stefanopace/keymap.c (renamed from keyboards/ut472/keymaps/stefanopace/keymap.c)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/stefanopace/readme.md (renamed from keyboards/ut472/keymaps/stefanopace/readme.md)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/stefanopace/rules.mk (renamed from keyboards/ut472/keymaps/stefanopace/rules.mk)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/tucznak/config.h (renamed from keyboards/ut472/keymaps/tucznak/config.h)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/tucznak/keymap.c (renamed from keyboards/ut472/keymaps/tucznak/keymap.c)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/tucznak/readme.md (renamed from keyboards/ut472/keymaps/tucznak/readme.md)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/tucznak/rules.mk (renamed from keyboards/ut472/keymaps/tucznak/rules.mk)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/via/keymap.c (renamed from keyboards/ut472/keymaps/via/keymap.c)0
-rw-r--r--keyboards/keyhive/ut472/keymaps/via/rules.mk (renamed from keyboards/melody96/keymaps/via/rules.mk)0
-rw-r--r--keyboards/keyhive/ut472/readme.md (renamed from keyboards/ut472/readme.md)2
-rw-r--r--keyboards/keyhive/ut472/rules.mk (renamed from keyboards/ut472/rules.mk)0
-rw-r--r--keyboards/keyhive/ut472/ut472.c (renamed from keyboards/ut472/ut472.c)0
-rw-r--r--keyboards/keyhive/ut472/ut472.h (renamed from keyboards/ut472/ut472.h)0
-rw-r--r--keyboards/lime/keymaps/default/keymap.c1
-rw-r--r--keyboards/matrix/abelx/mcuconf.h3
-rw-r--r--keyboards/mechlovin/hex4b/rev2/chconf.h24
-rw-r--r--keyboards/mechwild/obe/obe.c6
-rw-r--r--keyboards/mechwild/waka60/waka60.c6
-rw-r--r--keyboards/mlego/m65/rev1/chconf.h28
-rw-r--r--keyboards/mlego/m65/rev2/chconf.h28
-rw-r--r--keyboards/mode/m65ha_alpha/m65ha_alpha.c1
-rw-r--r--keyboards/mode/m65hi_alpha/m65hi_alpha.c1
-rw-r--r--keyboards/mode/m65s/m65s.c1
-rw-r--r--keyboards/mode/m75h/m75h.c1
-rw-r--r--keyboards/mode/m75s/m75s.c1
-rw-r--r--keyboards/moonlander/config.h1
-rw-r--r--keyboards/mt/blocked65/blocked65.c (renamed from keyboards/wheatfield/blocked65/blocked65.c)0
-rw-r--r--keyboards/mt/blocked65/blocked65.h (renamed from keyboards/wheatfield/blocked65/blocked65.h)0
-rw-r--r--keyboards/mt/blocked65/config.h (renamed from keyboards/wheatfield/blocked65/config.h)0
-rw-r--r--keyboards/mt/blocked65/info.json (renamed from keyboards/wheatfield/blocked65/info.json)0
-rw-r--r--keyboards/mt/blocked65/keymaps/default/keymap.c (renamed from keyboards/wheatfield/blocked65/keymaps/default/keymap.c)0
-rw-r--r--keyboards/mt/blocked65/keymaps/via/keymap.c (renamed from keyboards/wheatfield/blocked65/keymaps/via/keymap.c)0
-rw-r--r--keyboards/mt/blocked65/keymaps/via/rules.mk (renamed from keyboards/wheatfield/blocked65/keymaps/via/rules.mk)0
-rw-r--r--keyboards/mt/blocked65/readme.md (renamed from keyboards/wheatfield/blocked65/readme.md)2
-rw-r--r--keyboards/mt/blocked65/rules.mk (renamed from keyboards/wheatfield/blocked65/rules.mk)0
-rw-r--r--keyboards/mt/mt40/config.h (renamed from keyboards/mt40/config.h)0
-rw-r--r--keyboards/mt/mt40/info.json (renamed from keyboards/mt40/info.json)0
-rw-r--r--keyboards/mt/mt40/keymaps/default/config.h (renamed from keyboards/mt40/keymaps/default/config.h)0
-rw-r--r--keyboards/mt/mt40/keymaps/default/keymap.c (renamed from keyboards/mt40/keymaps/default/keymap.c)0
-rw-r--r--keyboards/mt/mt40/keymaps/default/readme.md (renamed from keyboards/mt40/keymaps/default/readme.md)0
-rw-r--r--keyboards/mt/mt40/mt40.c (renamed from keyboards/mt40/mt40.c)0
-rw-r--r--keyboards/mt/mt40/mt40.h (renamed from keyboards/mt40/mt40.h)0
-rw-r--r--keyboards/mt/mt40/readme.md (renamed from keyboards/mt40/readme.md)4
-rw-r--r--keyboards/mt/mt40/rules.mk (renamed from keyboards/mt40/rules.mk)0
-rw-r--r--keyboards/mt/mt64rgb/config.h (renamed from keyboards/mt64rgb/config.h)0
-rw-r--r--keyboards/mt/mt64rgb/info.json (renamed from keyboards/mt64rgb/info.json)0
-rw-r--r--keyboards/mt/mt64rgb/keymaps/default/keymap.c (renamed from keyboards/mt64rgb/keymaps/default/keymap.c)0
-rw-r--r--keyboards/mt/mt64rgb/keymaps/default/readme.md (renamed from keyboards/mt64rgb/keymaps/default/readme.md)0
-rw-r--r--keyboards/mt/mt64rgb/keymaps/via/keymap.c (renamed from keyboards/mt64rgb/keymaps/via/keymap.c)0
-rw-r--r--keyboards/mt/mt64rgb/keymaps/via/rules.mk (renamed from keyboards/mt64rgb/keymaps/via/rules.mk)0
-rw-r--r--keyboards/mt/mt64rgb/mt64rgb.c (renamed from keyboards/mt64rgb/mt64rgb.c)0
-rw-r--r--keyboards/mt/mt64rgb/mt64rgb.h (renamed from keyboards/mt64rgb/mt64rgb.h)0
-rw-r--r--keyboards/mt/mt64rgb/readme.md (renamed from keyboards/mt64rgb/readme.md)2
-rw-r--r--keyboards/mt/mt64rgb/rules.mk (renamed from keyboards/mt64rgb/rules.mk)0
-rw-r--r--keyboards/mt/mt84/config.h (renamed from keyboards/mt84/config.h)0
-rw-r--r--keyboards/mt/mt84/info.json (renamed from keyboards/mt84/info.json)0
-rw-r--r--keyboards/mt/mt84/keymaps/default/config.h (renamed from keyboards/mt84/keymaps/default/config.h)0
-rw-r--r--keyboards/mt/mt84/keymaps/default/keymap.c (renamed from keyboards/mt84/keymaps/default/keymap.c)0
-rw-r--r--keyboards/mt/mt84/keymaps/via/keymap.c (renamed from keyboards/mt84/keymaps/via/keymap.c)0
-rw-r--r--keyboards/mt/mt84/keymaps/via/rules.mk (renamed from keyboards/mt84/keymaps/via/rules.mk)0
-rw-r--r--keyboards/mt/mt84/mt84.c (renamed from keyboards/mt84/mt84.c)0
-rw-r--r--keyboards/mt/mt84/mt84.h (renamed from keyboards/mt84/mt84.h)0
-rw-r--r--keyboards/mt/mt84/readme.md (renamed from keyboards/mt84/readme.md)4
-rw-r--r--keyboards/mt/mt84/rules.mk (renamed from keyboards/mt84/rules.mk)0
-rw-r--r--keyboards/mt/mt980/config.h (renamed from keyboards/mt980/config.h)0
-rw-r--r--keyboards/mt/mt980/info.json (renamed from keyboards/mt980/info.json)0
-rw-r--r--keyboards/mt/mt980/keymaps/default/keymap.c (renamed from keyboards/mt980/keymaps/default/keymap.c)0
-rw-r--r--keyboards/mt/mt980/keymaps/walker/config.h (renamed from keyboards/mt980/keymaps/walker/config.h)0
-rw-r--r--keyboards/mt/mt980/keymaps/walker/keymap.c (renamed from keyboards/mt980/keymaps/walker/keymap.c)0
-rw-r--r--keyboards/mt/mt980/keymaps/walker/rules.mk (renamed from keyboards/navi10/keymaps/emdarcher/rules.mk)0
-rw-r--r--keyboards/mt/mt980/mt980.c (renamed from keyboards/mt980/mt980.c)0
-rw-r--r--keyboards/mt/mt980/mt980.h (renamed from keyboards/mt980/mt980.h)0
-rw-r--r--keyboards/mt/mt980/readme.md (renamed from keyboards/mt980/readme.md)2
-rw-r--r--keyboards/mt/mt980/rules.mk (renamed from keyboards/mt980/rules.mk)0
-rw-r--r--keyboards/mt/split75/config.h (renamed from keyboards/wheatfield/split75/config.h)0
-rw-r--r--keyboards/mt/split75/info.json (renamed from keyboards/wheatfield/split75/info.json)0
-rw-r--r--keyboards/mt/split75/keymaps/art/keymap.c (renamed from keyboards/wheatfield/split75/keymaps/art/keymap.c)0
-rw-r--r--keyboards/mt/split75/keymaps/art/rules.mk (renamed from keyboards/wheatfield/split75/keymaps/art/rules.mk)0
-rw-r--r--keyboards/mt/split75/keymaps/default/keymap.c (renamed from keyboards/wheatfield/split75/keymaps/default/keymap.c)0
-rw-r--r--keyboards/mt/split75/keymaps/iso/keymap.c (renamed from keyboards/wheatfield/split75/keymaps/iso/keymap.c)0
-rw-r--r--keyboards/mt/split75/matrix.c (renamed from keyboards/wheatfield/split75/matrix.c)0
-rw-r--r--keyboards/mt/split75/readme.md (renamed from keyboards/wheatfield/split75/readme.md)4
-rw-r--r--keyboards/mt/split75/rules.mk (renamed from keyboards/wheatfield/split75/rules.mk)0
-rw-r--r--keyboards/mt/split75/split75.c (renamed from keyboards/wheatfield/split75/split75.c)0
-rw-r--r--keyboards/mt/split75/split75.h (renamed from keyboards/wheatfield/split75/split75.h)0
-rw-r--r--keyboards/navi10/rules.mk1
-rw-r--r--keyboards/ramonimbao/squishytkl/chconf.h24
-rw-r--r--keyboards/rart/rartlice/chconf.h29
-rwxr-xr-xkeyboards/reviung/reviung34/info.json37
-rwxr-xr-xkeyboards/reviung/reviung34/keymaps/default_2u/keymap.c (renamed from keyboards/reviung/reviung34/keymaps/default_2uL/keymap.c)8
-rwxr-xr-xkeyboards/reviung/reviung34/keymaps/default_2u/readme.md (renamed from keyboards/reviung/reviung34/keymaps/default_2uL/readme.md)0
-rwxr-xr-xkeyboards/reviung/reviung34/keymaps/default_rgb2u/keymap.c8
-rwxr-xr-xkeyboards/reviung/reviung34/reviung34.h2
-rwxr-xr-xkeyboards/sofle/keyhive/config.h11
-rw-r--r--keyboards/sowbug/68keys/config.h1
-rw-r--r--keyboards/sowbug/ansi_tkl/config.h1
-rw-r--r--keyboards/tkc/portico68v2/config.h4
-rw-r--r--keyboards/tronguylabs/m122_3270/bluepill/chconf.h29
-rw-r--r--keyboards/unicomp/spacesaver_m_pre_2013/overnumpad_1xb/config.h1
-rw-r--r--keyboards/uno/rules.mk1
-rw-r--r--keyboards/viktus/at101_bh/at101_bh.c (renamed from keyboards/at101_bh/at101_bh.c)0
-rw-r--r--keyboards/viktus/at101_bh/at101_bh.h (renamed from keyboards/at101_bh/at101_bh.h)0
-rw-r--r--keyboards/viktus/at101_bh/config.h (renamed from keyboards/at101_bh/config.h)0
-rw-r--r--keyboards/viktus/at101_bh/info.json (renamed from keyboards/at101_bh/info.json)0
-rw-r--r--keyboards/viktus/at101_bh/keymaps/default/keymap.c (renamed from keyboards/at101_bh/keymaps/default/keymap.c)0
-rw-r--r--keyboards/viktus/at101_bh/readme.md (renamed from keyboards/at101_bh/readme.md)2
-rw-r--r--keyboards/viktus/at101_bh/rules.mk (renamed from keyboards/at101_bh/rules.mk)0
-rw-r--r--keyboards/viktus/omnikey_bh/config.h (renamed from keyboards/omnikey_bh/config.h)0
-rw-r--r--keyboards/viktus/omnikey_bh/info.json (renamed from keyboards/omnikey_bh/info.json)0
-rw-r--r--keyboards/viktus/omnikey_bh/keymaps/default/keymap.c (renamed from keyboards/omnikey_bh/keymaps/default/keymap.c)0
-rw-r--r--keyboards/viktus/omnikey_bh/omnikey_bh.c (renamed from keyboards/omnikey_bh/omnikey_bh.c)0
-rw-r--r--keyboards/viktus/omnikey_bh/omnikey_bh.h (renamed from keyboards/omnikey_bh/omnikey_bh.h)0
-rw-r--r--keyboards/viktus/omnikey_bh/readme.md (renamed from keyboards/omnikey_bh/readme.md)2
-rw-r--r--keyboards/viktus/omnikey_bh/rules.mk (renamed from keyboards/omnikey_bh/rules.mk)0
-rw-r--r--keyboards/viktus/sp_mini/config.h4
-rw-r--r--keyboards/viktus/z150_bh/config.h (renamed from keyboards/z150_bh/config.h)0
-rw-r--r--keyboards/viktus/z150_bh/info.json (renamed from keyboards/z150_bh/info.json)0
-rw-r--r--keyboards/viktus/z150_bh/keymaps/default/keymap.c (renamed from keyboards/z150_bh/keymaps/default/keymap.c)0
-rw-r--r--keyboards/viktus/z150_bh/keymaps/default_tkl/keymap.c (renamed from keyboards/z150_bh/keymaps/default_tkl/keymap.c)0
-rw-r--r--keyboards/viktus/z150_bh/readme.md (renamed from keyboards/z150_bh/readme.md)2
-rw-r--r--keyboards/viktus/z150_bh/rules.mk (renamed from keyboards/z150_bh/rules.mk)0
-rw-r--r--keyboards/viktus/z150_bh/z150_bh.c (renamed from keyboards/z150_bh/z150_bh.c)0
-rw-r--r--keyboards/viktus/z150_bh/z150_bh.h (renamed from keyboards/z150_bh/z150_bh.h)0
-rw-r--r--keyboards/xelus/ninjin/config.h1
-rw-r--r--keyboards/ymdk/melody96/config.h (renamed from keyboards/melody96/config.h)0
-rw-r--r--keyboards/ymdk/melody96/info.json (renamed from keyboards/melody96/info.json)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/crilith/keymap.c (renamed from keyboards/melody96/keymaps/crilith/keymap.c)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/default/keymap.c (renamed from keyboards/melody96/keymaps/default/keymap.c)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/default_96_with60_split_num0/keymap.c (renamed from keyboards/melody96/keymaps/default_96_with60_split_num0/keymap.c)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/dvz/config.h (renamed from keyboards/melody96/keymaps/dvz/config.h)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/dvz/keymap.c (renamed from keyboards/melody96/keymaps/dvz/keymap.c)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/dvz/readme.md (renamed from keyboards/melody96/keymaps/dvz/readme.md)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/dvz/rules.mk (renamed from keyboards/melody96/keymaps/dvz/rules.mk)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/konstantin/config.h (renamed from keyboards/melody96/keymaps/konstantin/config.h)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/konstantin/keymap.c (renamed from keyboards/melody96/keymaps/konstantin/keymap.c)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/konstantin/rules.mk (renamed from keyboards/melody96/keymaps/konstantin/rules.mk)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/via/keymap.c (renamed from keyboards/melody96/keymaps/via/keymap.c)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/via/rules.mk (renamed from keyboards/ut472/keymaps/via/rules.mk)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/zunger/config.h (renamed from keyboards/melody96/keymaps/zunger/config.h)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/zunger/keymap.c (renamed from keyboards/melody96/keymaps/zunger/keymap.c)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/zunger/readme.md (renamed from keyboards/melody96/keymaps/zunger/readme.md)0
-rw-r--r--keyboards/ymdk/melody96/keymaps/zunger/rules.mk (renamed from keyboards/melody96/keymaps/zunger/rules.mk)0
-rw-r--r--keyboards/ymdk/melody96/melody96.c (renamed from keyboards/melody96/melody96.c)0
-rw-r--r--keyboards/ymdk/melody96/melody96.h (renamed from keyboards/melody96/melody96.h)0
-rw-r--r--keyboards/ymdk/melody96/readme.md (renamed from keyboards/melody96/readme.md)2
-rw-r--r--keyboards/ymdk/melody96/rules.mk (renamed from keyboards/melody96/rules.mk)0
-rw-r--r--keyboards/zvecr/split_blackpill/chconf.h29
m---------lib/chibios0
m---------lib/chibios-contrib0
-rw-r--r--lib/python/qmk/cli/__init__.py4
-rw-r--r--lib/python/qmk/cli/format/c.py2
-rwxr-xr-xlib/python/qmk/cli/generate/api.py28
-rwxr-xr-xlib/python/qmk/cli/generate/config_h.py24
-rw-r--r--lib/python/qmk/cli/generate/docs.py7
-rwxr-xr-xlib/python/qmk/cli/generate/rules_mk.py14
-rwxr-xr-xlib/python/qmk/cli/info.py16
-rw-r--r--lib/python/qmk/cli/new/keyboard.py20
-rw-r--r--lib/python/qmk/cli/painter/__init__.py2
-rw-r--r--lib/python/qmk/cli/painter/convert_graphics.py86
-rw-r--r--lib/python/qmk/cli/painter/make_font.py87
-rw-r--r--lib/python/qmk/cli/pytest.py3
-rw-r--r--lib/python/qmk/commands.py2
-rw-r--r--lib/python/qmk/info.py134
-rw-r--r--lib/python/qmk/json_schema.py6
-rw-r--r--lib/python/qmk/painter.py268
-rw-r--r--lib/python/qmk/painter_qff.py401
-rw-r--r--lib/python/qmk/painter_qgf.py408
-rw-r--r--lib/python/qmk/tests/test_cli_commands.py4
-rw-r--r--platforms/arm_atsam/_pin_defs.h (renamed from platforms/arm_atsam/pin_defs.h)0
-rw-r--r--platforms/arm_atsam/bootloaders/md_boot.c4
-rw-r--r--platforms/arm_atsam/hardware_id.c9
-rw-r--r--platforms/avr/_pin_defs.h (renamed from platforms/avr/pin_defs.h)0
-rw-r--r--platforms/avr/bootloaders/bootloadhid.c7
-rw-r--r--platforms/avr/bootloaders/caterina.c9
-rw-r--r--platforms/avr/bootloaders/custom.c9
-rw-r--r--platforms/avr/bootloaders/dfu.c9
-rw-r--r--platforms/avr/bootloaders/halfkay.c10
-rw-r--r--platforms/avr/bootloaders/usbasploader.c9
-rw-r--r--platforms/avr/drivers/hd44780.c542
-rw-r--r--platforms/avr/drivers/hd44780.h348
-rw-r--r--platforms/avr/hardware_id.c19
-rw-r--r--platforms/avr/platform.c13
-rw-r--r--platforms/avr/platform.mk18
-rw-r--r--platforms/bootloader.h1
-rw-r--r--platforms/chibios/_pin_defs.h289
-rw-r--r--platforms/chibios/boards/BLACKPILL_STM32_F401/configs/board.h57
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F303XC/configs/mcuconf.h3
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F401XC/board/board.mk9
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F401XC/configs/board.h77
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F401XC/configs/config.h22
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F401XC/configs/mcuconf.h244
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F405XG/configs/mcuconf.h75
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h75
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F411XE/board/board.mk9
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F411XE/configs/board.h20
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F411XE/configs/config.h22
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_F411XE/configs/mcuconf.h252
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_G431XB/configs/mcuconf.h20
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_G474XE/configs/mcuconf.h22
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_L412XB/configs/board.h5
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_L412XB/configs/config.h2
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_L412XB/configs/mcuconf.h60
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_L432XC/configs/config.h3
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_L432XC/configs/mcuconf.h14
-rw-r--r--platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h2
-rw-r--r--platforms/chibios/boards/QMK_PROTON_C/configs/chconf.h69
-rw-r--r--platforms/chibios/boards/QMK_PROTON_C/configs/halconf.h31
-rw-r--r--platforms/chibios/boards/QMK_PROTON_C/configs/mcuconf.h3
-rw-r--r--platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.c3
-rw-r--r--platforms/chibios/boards/STM32_F103_STM32DUINO/configs/chconf.h8
-rw-r--r--platforms/chibios/boards/STM32_F103_STM32DUINO/configs/config.h9
-rw-r--r--platforms/chibios/boards/common/configs/chconf.h69
-rw-r--r--platforms/chibios/boards/common/configs/halconf.h31
-rw-r--r--platforms/chibios/boards/common/ld/STM32F401xC_tinyuf2.ld (renamed from platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xC_tinyuf2.ld)0
-rw-r--r--platforms/chibios/boards/common/ld/STM32F401xE_tinyuf2.ld (renamed from platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xE_tinyuf2.ld)0
-rw-r--r--platforms/chibios/boards/common/ld/STM32F411xC_tinyuf2.ld (renamed from platforms/chibios/boards/BLACKPILL_STM32_F411/ld/STM32F411xC_tinyuf2.ld)0
-rw-r--r--platforms/chibios/boards/common/ld/STM32F411xE_tinyuf2.ld (renamed from platforms/chibios/boards/BLACKPILL_STM32_F411/ld/STM32F411xE_tinyuf2.ld)0
-rw-r--r--platforms/chibios/bootloaders/custom.c1
-rw-r--r--platforms/chibios/bootloaders/gd32v_dfu.c7
-rw-r--r--platforms/chibios/bootloaders/halfkay.c2
-rw-r--r--platforms/chibios/bootloaders/kiibohd.c1
-rw-r--r--platforms/chibios/bootloaders/stm32_dfu.c7
-rw-r--r--platforms/chibios/bootloaders/stm32duino.c5
-rw-r--r--platforms/chibios/bootloaders/tinyuf2.c4
-rw-r--r--platforms/chibios/bootloaders/wb32_dfu.c53
-rw-r--r--platforms/chibios/converters/promicro_to_proton_c/_pin_defs.h41
-rw-r--r--platforms/chibios/converters/promicro_to_proton_c/converter.mk (renamed from platforms/chibios/boards/QMK_PROTON_C/convert_to_proton_c.mk)2
-rw-r--r--platforms/chibios/drivers/serial.c29
-rw-r--r--platforms/chibios/drivers/serial_usart.c10
-rw-r--r--platforms/chibios/drivers/ws2812_spi.c28
-rw-r--r--platforms/chibios/eeprom_stm32_defs.h4
-rw-r--r--platforms/chibios/flash.mk14
-rw-r--r--platforms/chibios/gpio.h9
-rw-r--r--platforms/chibios/hardware_id.c15
-rw-r--r--platforms/chibios/pin_defs.h323
-rw-r--r--platforms/chibios/platform.mk16
-rw-r--r--platforms/chibios/synchronization_util.c26
-rw-r--r--platforms/chibios/timer.c2
-rw-r--r--platforms/chibios/wait.c2
-rw-r--r--platforms/common.mk1
-rw-r--r--platforms/hardware_id.h18
-rw-r--r--platforms/pin_defs.h4
-rw-r--r--platforms/synchronization_util.h14
-rw-r--r--platforms/test/bootloaders/none.c1
-rw-r--r--platforms/test/hardware_id.c9
-rw-r--r--quantum/action.c95
-rw-r--r--quantum/action_layer.c76
-rw-r--r--quantum/action_tapping.c34
-rw-r--r--quantum/action_tapping.h8
-rw-r--r--quantum/action_util.c14
-rw-r--r--quantum/backlight/backlight_avr.c8
-rw-r--r--quantum/caps_word.c80
-rw-r--r--quantum/caps_word.h43
-rw-r--r--quantum/dynamic_keymap.c69
-rw-r--r--quantum/dynamic_keymap.h6
-rw-r--r--quantum/eeconfig.c2
-rw-r--r--quantum/eeconfig.h2
-rw-r--r--quantum/encoder.c142
-rw-r--r--quantum/encoder.h34
-rw-r--r--quantum/encoder/tests/config_mock.h22
-rw-r--r--quantum/encoder/tests/config_mock_split_left_eq_right.h26
-rw-r--r--quantum/encoder/tests/config_mock_split_left_gt_right.h26
-rw-r--r--quantum/encoder/tests/config_mock_split_left_lt_right.h26
-rw-r--r--quantum/encoder/tests/config_mock_split_no_left.h26
-rw-r--r--quantum/encoder/tests/config_mock_split_no_right.h26
-rw-r--r--quantum/encoder/tests/encoder_tests.cpp36
-rw-r--r--quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp135
-rw-r--r--quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp139
-rw-r--r--quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp139
-rw-r--r--quantum/encoder/tests/encoder_tests_split_no_left.cpp (renamed from quantum/encoder/tests/encoder_tests_split.cpp)68
-rw-r--r--quantum/encoder/tests/encoder_tests_split_no_right.cpp118
-rw-r--r--quantum/encoder/tests/mock.h6
-rw-r--r--quantum/encoder/tests/mock_split.h16
-rw-r--r--quantum/encoder/tests/rules.mk53
-rw-r--r--quantum/encoder/tests/testlist.mk6
-rw-r--r--quantum/joystick.c37
-rw-r--r--quantum/joystick.h17
-rw-r--r--quantum/keyboard.c27
-rw-r--r--quantum/keyboard.h36
-rw-r--r--quantum/keycode_config.h2
-rw-r--r--quantum/keymap.h6
-rw-r--r--quantum/keymap_common.c13
-rw-r--r--quantum/main.c11
-rw-r--r--quantum/mousekey.c25
-rw-r--r--quantum/painter/qff.c137
-rw-r--r--quantum/painter/qff.h88
-rw-r--r--quantum/painter/qgf.c292
-rw-r--r--quantum/painter/qgf.h136
-rw-r--r--quantum/painter/qp.c228
-rw-r--r--quantum/painter/qp.h453
-rw-r--r--quantum/painter/qp_comms.c72
-rw-r--r--quantum/painter/qp_comms.h25
-rw-r--r--quantum/painter/qp_draw.h85
-rw-r--r--quantum/painter/qp_draw_circle.c172
-rw-r--r--quantum/painter/qp_draw_codec.c142
-rw-r--r--quantum/painter/qp_draw_core.c294
-rw-r--r--quantum/painter/qp_draw_ellipse.c116
-rw-r--r--quantum/painter/qp_draw_image.c382
-rw-r--r--quantum/painter/qp_draw_text.c444
-rw-r--r--quantum/painter/qp_internal.h33
-rw-r--r--quantum/painter/qp_internal_driver.h82
-rw-r--r--quantum/painter/qp_internal_formats.h49
-rw-r--r--quantum/painter/qp_stream.c171
-rw-r--r--quantum/painter/qp_stream.h82
-rw-r--r--quantum/painter/rules.mk116
-rw-r--r--quantum/pointing_device.c13
-rw-r--r--quantum/pointing_device.h1
-rw-r--r--quantum/pointing_device_drivers.c18
-rw-r--r--quantum/process_keycode/process_auto_shift.c7
-rw-r--r--quantum/process_keycode/process_caps_word.c160
-rw-r--r--quantum/process_keycode/process_caps_word.h37
-rw-r--r--quantum/process_keycode/process_combo.c11
-rw-r--r--quantum/process_keycode/process_joystick.c36
-rw-r--r--quantum/process_keycode/process_secure.c39
-rw-r--r--quantum/process_keycode/process_secure.h15
-rw-r--r--quantum/process_keycode/process_space_cadet.c7
-rw-r--r--quantum/process_keycode/process_tap_dance.c6
-rw-r--r--quantum/process_keycode/process_unicode_common.c63
-rw-r--r--quantum/process_keycode/process_unicode_common.h1
-rw-r--r--quantum/quantum.c49
-rw-r--r--quantum/quantum.h19
-rw-r--r--quantum/quantum_keycodes.h11
-rw-r--r--quantum/rgb_matrix/animations/digital_rain_anim.h22
-rw-r--r--quantum/rgb_matrix/animations/typing_heatmap_anim.h5
-rw-r--r--quantum/rgblight/rgblight.c31
-rw-r--r--quantum/rgblight/rgblight.h26
-rw-r--r--quantum/secure.c87
-rw-r--r--quantum/secure.h67
-rw-r--r--quantum/send_string_keycodes.h463
-rw-r--r--quantum/split_common/transactions.c21
-rw-r--r--quantum/split_common/transport.h3
-rw-r--r--quantum/utf8.c46
-rw-r--r--quantum/utf8.h21
-rw-r--r--quantum/util.h8
-rw-r--r--quantum/via.c108
-rw-r--r--readme.md4
-rw-r--r--requirements.txt3
-rw-r--r--setup.cfg4
-rw-r--r--tests/caps_word/config.h21
-rw-r--r--tests/caps_word/test.mk19
-rw-r--r--tests/caps_word/test_caps_word.cpp423
-rw-r--r--tmk_core/protocol/chibios/usb_main.c14
-rw-r--r--tmk_core/protocol/report.c13
-rw-r--r--tmk_core/protocol/report.h4
-rw-r--r--tmk_core/protocol/usb_descriptor.c43
-rwxr-xr-xutil/generate_internal_docs.sh31
-rwxr-xr-xutil/install/msys2.sh3
-rwxr-xr-xutil/uf2conv.py114
-rw-r--r--util/uf2families.json192
715 files changed, 15542 insertions, 7182 deletions
diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml
index a19667f97e..f0c49baf60 100644
--- a/.github/workflows/api.yml
+++ b/.github/workflows/api.yml
@@ -35,4 +35,4 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_KEY }}
AWS_S3_ENDPOINT: https://nyc3.digitaloceanspaces.com
- SOURCE_DIR: 'api_data'
+ SOURCE_DIR: '.build/api_data'
diff --git a/.github/workflows/develop_api.yml b/.github/workflows/develop_api.yml
index f0098142c7..44d259cfac 100644
--- a/.github/workflows/develop_api.yml
+++ b/.github/workflows/develop_api.yml
@@ -24,7 +24,9 @@ jobs:
persist-credentials: false
- name: Generate API Data
- run: qmk generate-api
+ run: |
+ python3 -m pip install -r requirements-dev.txt
+ qmk generate-api
- name: Upload API Data
uses: jakejarvis/s3-sync-action@master
@@ -35,4 +37,4 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_KEY }}
AWS_S3_ENDPOINT: https://nyc3.digitaloceanspaces.com
- SOURCE_DIR: 'api_data'
+ SOURCE_DIR: '.build/api_data'
diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml
index 26bcb2f511..726ce19f0c 100644
--- a/.github/workflows/unit_test.yml
+++ b/.github/workflows/unit_test.yml
@@ -26,5 +26,7 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: recursive
+ - name: Install dependencies
+ run: pip3 install -r requirements-dev.txt
- name: Run tests
run: make test:all
diff --git a/api_data/_config.yml b/api_data/_config.yml
deleted file mode 100644
index 277f1f2c51..0000000000
--- a/api_data/_config.yml
+++ /dev/null
@@ -1 +0,0 @@
-theme: jekyll-theme-cayman
diff --git a/builddefs/bootloader.mk b/builddefs/bootloader.mk
index 1a53bfa663..eba8e280e4 100644
--- a/builddefs/bootloader.mk
+++ b/builddefs/bootloader.mk
@@ -208,6 +208,10 @@ ifeq ($(strip $(BOOTLOADER)), md-boot)
OPT_DEFS += -DBOOTLOADER_MD_BOOT
BOOTLOADER_TYPE = md_boot
endif
+ifeq ($(strip $(BOOTLOADER)), wb32-dfu)
+ OPT_DEFS += -DBOOTLOADER_WB32_DFU
+ BOOTLOADER_TYPE = wb32_dfu
+endif
ifeq ($(strip $(BOOTLOADER_TYPE)),)
$(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,No bootloader specified. Please set an appropriate 'BOOTLOADER' in your keyboard's 'rules.mk' file.)
diff --git a/builddefs/build_keyboard.mk b/builddefs/build_keyboard.mk
index 44acd964cc..4503f018a8 100644
--- a/builddefs/build_keyboard.mk
+++ b/builddefs/build_keyboard.mk
@@ -172,13 +172,7 @@ generated-files: $(KEYMAP_OUTPUT)/src/config.h $(KEYMAP_OUTPUT)/src/keymap.c
endif
-ifeq ($(strip $(CTPC)), yes)
- CONVERT_TO_PROTON_C=yes
-endif
-
-ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
- include platforms/chibios/boards/QMK_PROTON_C/convert_to_proton_c.mk
-endif
+include $(BUILDDEFS_PATH)/converters.mk
include $(BUILDDEFS_PATH)/mcu_selection.mk
diff --git a/builddefs/build_test.mk b/builddefs/build_test.mk
index 7226004aab..5ad33b19c5 100644
--- a/builddefs/build_test.mk
+++ b/builddefs/build_test.mk
@@ -4,6 +4,8 @@ endif
.DEFAULT_GOAL := all
+OPT = g
+
include paths.mk
include $(BUILDDEFS_PATH)/message.mk
diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk
index 08d186d656..c976b8296d 100644
--- a/builddefs/common_features.mk
+++ b/builddefs/common_features.mk
@@ -149,6 +149,11 @@ ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
endif
endif
+QUANTUM_PAINTER_ENABLE ?= no
+ifeq ($(strip $(QUANTUM_PAINTER_ENABLE)), yes)
+ include $(QUANTUM_DIR)/painter/rules.mk
+endif
+
VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c spi
EEPROM_DRIVER ?= vendor
ifeq ($(filter $(EEPROM_DRIVER),$(VALID_EEPROM_DRIVER_TYPES)),)
@@ -646,8 +651,9 @@ ifeq ($(strip $(HAPTIC_ENABLE)),yes)
endif
ifeq ($(strip $(HD44780_ENABLE)), yes)
- SRC += platforms/avr/drivers/hd44780.c
OPT_DEFS += -DHD44780_ENABLE
+ COMMON_VPATH += $(DRIVER_PATH)/lcd
+ SRC += hd44780.c
endif
VALID_OLED_DRIVER_TYPES := SSD1306 custom
@@ -695,7 +701,8 @@ endif
ifeq ($(strip $(UNICODE_COMMON)), yes)
OPT_DEFS += -DUNICODE_COMMON_ENABLE
- SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
+ SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c \
+ $(QUANTUM_DIR)/utf8.c
endif
MAGIC_ENABLE ?= yes
diff --git a/builddefs/common_rules.mk b/builddefs/common_rules.mk
index b303a87919..85dfe67f3f 100644
--- a/builddefs/common_rules.mk
+++ b/builddefs/common_rules.mk
@@ -316,7 +316,7 @@ gccversion :
@$(BUILD_CMD)
%.uf2: %.hex
- $(eval CMD=$(UF2CONV) $(BUILD_DIR)/$(TARGET).hex -o $(BUILD_DIR)/$(TARGET).uf2 -c -f $(UF2_FAMILY) >/dev/null 2>&1)
+ $(eval CMD=$(UF2CONV) $(BUILD_DIR)/$(TARGET).hex --output $(BUILD_DIR)/$(TARGET).uf2 --convert --family $(UF2_FAMILY) >/dev/null 2>&1)
#@$(SILENT) || printf "$(MSG_EXECUTING) '$(CMD)':\n"
@$(SILENT) || printf "$(MSG_UF2) $@" | $(AWK_CMD)
@$(BUILD_CMD)
diff --git a/builddefs/converters.mk b/builddefs/converters.mk
new file mode 100644
index 0000000000..b3e7bec007
--- /dev/null
+++ b/builddefs/converters.mk
@@ -0,0 +1,37 @@
+# Note for new boards -- CTPC and CONVERT_TO_PROTON_C are deprecated terms
+# and should not be replicated for new boards. These will be removed from
+# documentation as well as existing keymaps in due course.
+ifeq ($(strip $(CTPC)), yes)
+ CONVERT_TO_PROTON_C=yes
+endif
+ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
+ CONVERT_TO=proton_c
+
+cpfirmware: ctpc_warning
+.INTERMEDIATE: ctpc_warning
+ctpc_warning: elf
+ $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@)
+ $(info The `CONVERT_TO_PROTON_C` and `CTPC` options are soon to be deprecated.)
+ $(info Boards should be changed to use `CONVERT_TO=proton_c` instead.)
+ $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@)
+endif
+
+# TODO: opt in rather than assume everything uses a pro micro
+PIN_COMPATIBLE ?= promicro
+ifneq ($(CONVERT_TO),)
+ # glob to search each platfrorm and/or check for valid converter
+ CONVERTER := $(wildcard $(PLATFORM_PATH)/*/converters/$(PIN_COMPATIBLE)_to_$(CONVERT_TO)/)
+ ifeq ($(CONVERTER),)
+ $(call CATASTROPHIC_ERROR,Converting from '$(PIN_COMPATIBLE)' to '$(CONVERT_TO)' not possible!)
+ endif
+
+ TARGET := $(TARGET)_$(CONVERT_TO)
+
+ # Configure any defaults
+ OPT_DEFS += -DCONVERT_TO_$(strip $(shell echo $(CONVERT_TO) | tr '[:lower:]' '[:upper:]'))
+ OPT_DEFS += -DCONVERTER_ENABLED
+ VPATH += $(CONVERTER)
+
+ # Finally run any converter specific logic
+ include $(CONVERTER)/converter.mk
+endif
diff --git a/builddefs/generic_features.mk b/builddefs/generic_features.mk
index e4151eb217..c3f1ec0f72 100644
--- a/builddefs/generic_features.mk
+++ b/builddefs/generic_features.mk
@@ -17,6 +17,7 @@ SPACE_CADET_ENABLE ?= yes
GRAVE_ESC_ENABLE ?= yes
GENERIC_FEATURES = \
+ CAPS_WORD \
COMBO \
COMMAND \
DEFERRED_EXEC \
@@ -25,12 +26,14 @@ GENERIC_FEATURES = \
DYNAMIC_KEYMAP \
DYNAMIC_MACRO \
ENCODER \
+ ENCODER_MAP \
GRAVE_ESC \
HAPTIC \
KEY_LOCK \
KEY_OVERRIDE \
LEADER \
PROGRAMMABLE_BUTTON \
+ SECURE \
SPACE_CADET \
SWAP_HANDS \
TAP_DANCE \
diff --git a/builddefs/mcu_selection.mk b/builddefs/mcu_selection.mk
index 9fdd22c3b6..dba5c404be 100644
--- a/builddefs/mcu_selection.mk
+++ b/builddefs/mcu_selection.mk
@@ -9,7 +9,9 @@ ifneq ($(findstring MKL26Z64, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = KINETIS
MCU_SERIES = KL2x
@@ -36,7 +38,9 @@ ifneq ($(findstring MK20DX128, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = KINETIS
MCU_SERIES = K20x
@@ -63,7 +67,9 @@ ifneq ($(findstring MK20DX256, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = KINETIS
MCU_SERIES = K20x
@@ -90,7 +96,9 @@ ifneq ($(findstring MK66FX1M0, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = KINETIS
MCU_SERIES = MK66F18
@@ -117,7 +125,9 @@ ifneq ($(findstring STM32F042, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32F0xx
@@ -157,7 +167,9 @@ ifneq ($(findstring STM32F072, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32F0xx
@@ -192,7 +204,9 @@ ifneq ($(findstring STM32F103, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32F1xx
@@ -224,7 +238,9 @@ ifneq ($(findstring STM32F303, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32F3xx
@@ -259,7 +275,9 @@ ifneq ($(findstring STM32F401, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32F4xx
@@ -299,7 +317,9 @@ ifneq ($(findstring STM32F405, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32F4xx
@@ -334,7 +354,9 @@ ifneq ($(findstring STM32F407, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32F4xx
@@ -369,7 +391,9 @@ ifneq ($(findstring STM32F411, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32F4xx
@@ -409,7 +433,9 @@ ifneq ($(findstring STM32F446, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32F4xx
@@ -441,7 +467,9 @@ ifneq ($(findstring STM32G431, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32G4xx
@@ -476,7 +504,9 @@ ifneq ($(findstring STM32G474, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32G4xx
@@ -511,7 +541,9 @@ ifneq (,$(filter $(MCU),STM32L432 STM32L442))
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32L4xx
@@ -548,7 +580,9 @@ ifneq (,$(filter $(MCU),STM32L433 STM32L443))
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32L4xx
@@ -585,7 +619,9 @@ ifneq (,$(filter $(MCU),STM32L412 STM32L422))
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32L4xx
@@ -602,7 +638,7 @@ ifneq (,$(filter $(MCU),STM32L412 STM32L422))
# <keyboard_dir>/boards/, or drivers/boards/
BOARD ?= GENERIC_STM32_L412XB
- PLATFORM_NAME ?= platform_l432
+ PLATFORM_NAME ?= platform_l412_l422
USE_FPU ?= yes
@@ -622,7 +658,9 @@ ifneq ($(findstring WB32F3G71, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = WB32
MCU_SERIES = WB32F3G71xx
@@ -642,7 +680,6 @@ ifneq ($(findstring WB32F3G71, $(MCU)),)
USE_FPU ?= no
# Bootloader address for WB32 DFU
- STM32_BOOTLOADER_ADDRESS ?= 0x1FFFE000
WB32_BOOTLOADER_ADDRESS ?= 0x1FFFE000
endif
@@ -657,7 +694,10 @@ ifneq ($(findstring GD32VF103, $(MCU)),)
## chip/board settings
# - the next two should match the directories in
- # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
+ # OR
+ # <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_PORT_NAME = GD
MCU_FAMILY = GD32V
MCU_SERIES = GD32VF103
diff --git a/builddefs/show_options.mk b/builddefs/show_options.mk
index 2820332d56..f67d009191 100644
--- a/builddefs/show_options.mk
+++ b/builddefs/show_options.mk
@@ -57,6 +57,7 @@ OTHER_OPTION_NAMES = \
HELIX ZINC \
AUTOLOG_ENABLE \
DEBUG_ENABLE \
+ ENCODER_MAP_ENABLE \
ENCODER_ENABLE_CUSTOM \
GERMAN_ENABLE \
HAPTIC_ENABLE \
@@ -79,7 +80,9 @@ OTHER_OPTION_NAMES = \
LED_MIRRORED \
RGBLIGHT_FULL_POWER \
LTO_ENABLE \
- PROGRAMMABLE_BUTTON_ENABLE
+ PROGRAMMABLE_BUTTON_ENABLE \
+ SECURE_ENABLE \
+ CAPS_WORD_ENABLE
define NAME_ECHO
@printf " %-30s = %-16s # %s\\n" "$1" "$($1)" "$(origin $1)"
diff --git a/builddefs/testlist.mk b/builddefs/testlist.mk
index 86da5668ac..b8d22bce80 100644
--- a/builddefs/testlist.mk
+++ b/builddefs/testlist.mk
@@ -2,6 +2,7 @@ TEST_LIST = $(sort $(patsubst %/test.mk,%, $(shell find $(ROOT_DIR)tests -type f
FULL_TESTS := $(notdir $(TEST_LIST))
include $(QUANTUM_PATH)/debounce/tests/testlist.mk
+include $(QUANTUM_PATH)/encoder/tests/testlist.mk
include $(QUANTUM_PATH)/sequencer/tests/testlist.mk
include $(PLATFORM_PATH)/test/testlist.mk
diff --git a/data/mappings/defaults.json b/data/mappings/defaults.json
new file mode 100644
index 0000000000..e62ab688d6
--- /dev/null
+++ b/data/mappings/defaults.json
@@ -0,0 +1,35 @@
+{
+ "development_board": {
+ "promicro": {
+ "processor": "atmega32u4",
+ "bootloader": "caterina",
+ "pin_compatible": "promicro"
+ },
+ "elite_c": {
+ "processor": "atmega32u4",
+ "bootloader": "atmel-dfu",
+ "pin_compatible": "promicro"
+ },
+ "proton_c": {
+ "processor": "STM32F303",
+ "bootloader": "stm32-dfu",
+ "board": "QMK_PROTON_C",
+ "pin_compatible": "promicro"
+ },
+ "bluepill": {
+ "processor": "STM32F103",
+ "bootloader": "stm32duino",
+ "board": "STM32_F103_STM32DUINO"
+ },
+ "blackpill_f401": {
+ "processor": "STM32F401",
+ "bootloader": "stm32-dfu",
+ "board": "BLACKPILL_STM32_F401"
+ },
+ "blackpill_f411": {
+ "processor": "STM32F411",
+ "bootloader": "stm32-dfu",
+ "board": "BLACKPILL_STM32_F411"
+ }
+ }
+} \ No newline at end of file
diff --git a/data/mappings/info_config.json b/data/mappings/info_config.json
index cfe8807d43..d9f96b5892 100644
--- a/data/mappings/info_config.json
+++ b/data/mappings/info_config.json
@@ -3,7 +3,7 @@
{
# Format:
# <config.h key>: {"info_key": <info.json key>, ["value_type": <value_type>], ["to_json": <true/false>], ["to_c": <true/false>]}
- # value_type: one of "array", "array.int", "bool", "int", "hex", "list", "mapping"
+ # value_type: one of "array", "array.int", "bool", "int", "hex", "list", "mapping", "str", "raw"
# to_json: Default `true`. Set to `false` to exclude this mapping from info.json
# to_c: Default `true`. Set to `false` to exclude this mapping from config.h
# warn_duplicate: Default `true`. Set to `false` to turn off warning when a value exists in both places
@@ -11,14 +11,17 @@
"BACKLIGHT_BREATHING": {"info_key": "backlight.breathing", "value_type": "bool"},
"BREATHING_PERIOD": {"info_key": "backlight.breathing_period", "value_type": "int"},
"BACKLIGHT_PIN": {"info_key": "backlight.pin"},
+ "BOTH_SHIFTS_TURNS_ON_CAPS_WORD": {"info_key": "caps_word.both_shifts_turns_on", "value_type": "bool"},
+ "CAPS_WORD_IDLE_TIMEOUT": {"info_key": "caps_word.idle_timeout", "value_type": "int"},
"COMBO_COUNT": {"info_key": "combo.count", "value_type": "int"},
"COMBO_TERM": {"info_key": "combo.term", "value_type": "int"},
"DEBOUNCE": {"info_key": "debounce", "value_type": "int"},
"DEVICE_VER": {"info_key": "usb.device_ver", "value_type": "hex"},
# TODO: Replace ^^^ with vvv
#"DEVICE_VER": {"info_key": "usb.device_version", "value_type": "bcd_version"},
- "DESCRIPTION": {"info_key": "keyboard_folder", "to_json": false},
+ "DESCRIPTION": {"info_key": "keyboard_folder", "value_type": "str", "to_json": false},
"DIODE_DIRECTION": {"info_key": "diode_direction"},
+ "DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD": {"info_key": "caps_word.double_tap_shift_turns_on", "value_type": "bool"},
"FORCE_NKRO": {"info_key": "usb.force_nkro", "value_type": "bool"},
"DYNAMIC_KEYMAP_EEPROM_MAX_ADDR": {"info_key": "dynamic_keymap.eeprom_max_addr", "value_type": "int"},
"DYNAMIC_KEYMAP_LAYER_COUNT": {"info_key": "dynamic_keymap.layer_count", "value_type": "int"},
@@ -78,6 +81,9 @@
"QMK_KEYS_PER_SCAN": {"info_key": "qmk.keys_per_scan", "value_type": "int"},
"QMK_LED": {"info_key": "qmk_lufa_bootloader.led"},
"QMK_SPEAKER": {"info_key": "qmk_lufa_bootloader.speaker"},
+ "SECURE_UNLOCK_SEQUENCE": {"info_key": "secure.unlock_sequence", "value_type": "array.array.int", "to_json": false},
+ "SECURE_UNLOCK_TIMEOUT": {"info_key": "secure.unlock_timeout", "value_type": "int"},
+ "SECURE_IDLE_TIMEOUT": {"info_key": "secure.idle_timeout", "value_type": "int"},
"SENDSTRING_BELL": {"info_key": "audio.macro_beep", "value_type": "bool"},
"SPLIT_MODS_ENABLE": {"info_key": "split.transport.sync_modifiers", "value_type": "bool"},
"SPLIT_TRANSPORT_MIRROR": {"info_key": "split.transport.sync_matrix_state", "value_type": "bool"},
diff --git a/data/mappings/info_rules.json b/data/mappings/info_rules.json
index aea67e04c8..a8b39afbd1 100644
--- a/data/mappings/info_rules.json
+++ b/data/mappings/info_rules.json
@@ -3,13 +3,14 @@
{
# Format:
# <rules.mk key>: {"info_key": <info.json key>, ["value_type": <value_type>], ["to_json": <true/false>], ["to_c": <true/false>]}
- # value_type: one of "array", "array.int", "bool", "int", "list", "hex", "mapping"
+ # value_type: one of "array", "array.int", "bool", "int", "list", "hex", "mapping", "str", "raw"
# to_json: Default `true`. Set to `false` to exclude this mapping from info.json
# to_c: Default `true`. Set to `false` to exclude this mapping from rules.mk
# warn_duplicate: Default `true`. Set to `false` to turn off warning when a value exists in both places
"BOARD": {"info_key": "board"},
"BOOTLOADER": {"info_key": "bootloader", "warn_duplicate": false},
"BLUETOOTH": {"info_key": "bluetooth.driver"},
+ "CAPS_WORD_ENABLE": {"info_key": "caps_word.enabled", "value_type": "bool"},
"FIRMWARE_FORMAT": {"info_key": "build.firmware_format"},
"KEYBOARD_SHARED_EP": {"info_key": "usb.shared_endpoint.keyboard", "value_type": "bool"},
"MOUSE_SHARED_EP": {"info_key": "usb.shared_endpoint.mouse", "value_type": "bool"},
@@ -19,7 +20,9 @@
"MCU": {"info_key": "processor", "warn_duplicate": false},
"MOUSEKEY_ENABLE": {"info_key": "mouse_key.enabled", "value_type": "bool"},
"NO_USB_STARTUP_CHECK": {"info_key": "usb.no_startup_check", "value_type": "bool"},
+ "PIN_COMPATIBLE": {"info_key": "pin_compatible"},
+ "SECURE_ENABLE": {"info_key": "secure.enabled", "value_type": "bool"},
"SPLIT_KEYBOARD": {"info_key": "split.enabled", "value_type": "bool"},
- "SPLIT_TRANSPORT": {"info_key": "split.transport.protocol", "value_type": "str", "to_c": false},
+ "SPLIT_TRANSPORT": {"info_key": "split.transport.protocol", "to_c": false},
"WAIT_FOR_USB": {"info_key": "usb.wait_for", "value_type": "bool"}
}
diff --git a/data/schemas/definitions.jsonschema b/data/schemas/definitions.jsonschema
index cca30af827..1bdfbbeb03 100644
--- a/data/schemas/definitions.jsonschema
+++ b/data/schemas/definitions.jsonschema
@@ -41,8 +41,6 @@
"LAYOUT_2x2uC",
"LAYOUT_2x3uC",
"LAYOUT_625uC",
- "LAYOUT_ANSI_DEFAULT",
- "LAYOUT_JP",
"LAYOUT_ortho_3x12_1x2uC",
"LAYOUT_ortho_4x12_1x2uC",
"LAYOUT_ortho_4x12_1x2uL",
@@ -57,8 +55,7 @@
"LAYOUT_planck_1x2uR",
"LAYOUT_preonic_1x2uC",
"LAYOUT_preonic_1x2uL",
- "LAYOUT_preonic_1x2uR",
- "LAYOUT_reviung34_2uL"
+ "LAYOUT_preonic_1x2uR"
]
},
{
diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema
index adb63fd13e..aaf6f887d5 100644
--- a/data/schemas/keyboard.jsonschema
+++ b/data/schemas/keyboard.jsonschema
@@ -12,6 +12,14 @@
"type": "string",
"format": "uri"
},
+ "development_board": {
+ "type": "string",
+ "enum": ["promicro", "elite_c", "proton_c", "bluepill", "blackpill_f401", "blackpill_f411"]
+ },
+ "pin_compatible": {
+ "type": "string",
+ "enum": ["promicro"]
+ },
"processor": {
"type": "string",
"enum": ["cortex-m0", "cortex-m0plus", "cortex-m3", "cortex-m4", "MKL26Z64", "MK20DX128", "MK20DX256", "MK66FX1M0", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F405", "STM32F407", "STM32F411", "STM32F446", "STM32G431", "STM32G474", "STM32L412", "STM32L422", "STM32L432", "STM32L433", "STM32L442", "STM32L443", "GD32VF103", "WB32F3G71", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"]
@@ -84,6 +92,16 @@
"enum": ["COL2ROW", "ROW2COL"]
},
"debounce": {"$ref": "qmk.definitions.v1#/unsigned_int"},
+ "caps_word": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "enabled": {"type": "boolean"},
+ "both_shifts_turns_on": {"type": "boolean"},
+ "double_tap_shift_turns_on": {"type": "boolean"},
+ "idle_timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"},
+ },
+ },
"combo": {
"type": "object",
"properties": {
@@ -236,6 +254,30 @@
}
}
},
+ "secure": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "enabled": {"type": "boolean"},
+ "unlock_timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"},
+ "idle_timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"},
+ "unlock_sequence": {
+ "type": "array",
+ "minLength": 1,
+ "maxLength": 5,
+ "items": {
+ "type": "array",
+ "minItems": 2,
+ "maxItems": 2,
+ "items": {
+ "type": "number",
+ "min": 0,
+ "multipleOf": 1
+ }
+ }
+ }
+ }
+ },
"split": {
"type": "object",
"additionalProperties": false,
diff --git a/api_data/readme.md b/data/templates/api/readme.md
index a4b2c6bce7..a4b2c6bce7 100644
--- a/api_data/readme.md
+++ b/data/templates/api/readme.md
diff --git a/docs/_summary.md b/docs/_summary.md
index 74203aa0f8..fed75196b4 100644
--- a/docs/_summary.md
+++ b/docs/_summary.md
@@ -75,6 +75,7 @@
* Software Features
* [Auto Shift](feature_auto_shift.md)
+ * [Caps Word](feature_caps_word.md)
* [Combos](feature_combo.md)
* [Debounce API](feature_debounce_type.md)
* [Key Lock](feature_key_lock.md)
@@ -94,7 +95,8 @@
* Hardware Features
* Displays
- * [HD44780 LCD Controller](feature_hd44780.md)
+ * [Quantum Painter](quantum_painter.md)
+ * [HD44780 LCD Driver](feature_hd44780.md)
* [ST7565 LCD Driver](feature_st7565.md)
* [OLED Driver](feature_oled_driver.md)
* Lighting
@@ -147,7 +149,7 @@
* [EEPROM Driver](eeprom_driver.md)
* ['serial' Driver](serial_driver.md)
* [UART Driver](uart_driver.md)
- * [GPIO Controls](internals_gpio_control.md)
+ * [GPIO Controls](gpio_control.md)
* [Keyboard Guidelines](hardware_keyboard_guidelines.md)
* Python Development
@@ -183,10 +185,10 @@
* [Understanding QMK](understanding_qmk.md)
* QMK Internals (In Progress)
- * [Defines](internals_defines.md)
- * [Input Callback Reg](internals_input_callback_reg.md)
- * [Midi Device](internals_midi_device.md)
- * [Midi Device Setup Process](internals_midi_device_setup_process.md)
- * [Midi Util](internals_midi_util.md)
- * [Send Functions](internals_send_functions.md)
- * [Sysex Tools](internals_sysex_tools.md)
+ * [Defines](internals/defines.md)
+ * [Input Callback Reg](internals/input_callback_reg.md)
+ * [Midi Device](internals/midi_device.md)
+ * [Midi Device Setup Process](internals/midi_device_setup_process.md)
+ * [Midi Util](internals/midi_util.md)
+ * [Send Functions](internals/send_functions.md)
+ * [Sysex Tools](internals/sysex_tools.md)
diff --git a/docs/cli_commands.md b/docs/cli_commands.md
index 463abcef12..a380d3eb2f 100644
--- a/docs/cli_commands.md
+++ b/docs/cli_commands.md
@@ -515,3 +515,15 @@ Run single test:
qmk pytest -t qmk.tests.test_cli_commands.test_c2json
qmk pytest -t qmk.tests.test_qmk_path
+
+## `qmk painter-convert-graphics`
+
+This command converts images to a format usable by QMK, i.e. the QGF File Format. See the [Quantum Painter](quantum_painter.md?id=quantum-painter-cli) documentation for more information on this command.
+
+## `qmk painter-make-font-image`
+
+This command converts a TTF font to an intermediate format for editing, before converting to the QFF File Format. See the [Quantum Painter](quantum_painter.md?id=quantum-painter-cli) documentation for more information on this command.
+
+## `qmk painter-convert-font-image`
+
+This command converts an intermediate font image to the QFF File Format. See the [Quantum Painter](quantum_painter.md?id=quantum-painter-cli) documentation for more information on this command.
diff --git a/docs/config_options.md b/docs/config_options.md
index 838c4d86fd..8227a0e074 100644
--- a/docs/config_options.md
+++ b/docs/config_options.md
@@ -131,6 +131,8 @@ If you define these options you will disable the associated feature, which can s
If you define these options you will enable the associated feature, which may increase your code size.
+* `#define ENABLE_COMPILE_KEYCODE`
+ * Enables the `QK_MAKE` keycode
* `#define FORCE_NKRO`
* NKRO by default requires to be turned on, this forces it on during keyboard startup regardless of EEPROM setting. NKRO can still be turned off but will be turned on again if the keyboard reboots.
* `#define STRICT_LAYER_RELEASE`
diff --git a/docs/data_driven_config.md b/docs/data_driven_config.md
index 38fb5dbf14..cdcf21a19c 100644
--- a/docs/data_driven_config.md
+++ b/docs/data_driven_config.md
@@ -44,7 +44,7 @@ In other cases you should group like options together in an `object`. This is pa
In most cases you can add a simple mapping. These are maintained as JSON files in `data/mappings/info_config.json` and `data/mappings/info_rules.json`, and control mapping for `config.h` and `rules.mk`, respectively. Each mapping is keyed by the `config.h` or `rules.mk` variable, and the value is a hash with the following keys:
* `info_key`: (required) The location within `info.json` for this value. See below.
-* `value_type`: (optional) Default `str`. The format for this variable's value. See below.
+* `value_type`: (optional) Default `raw`. The format for this variable's value. See below.
* `to_json`: (optional) Default `true`. Set to `false` to exclude this mapping from info.json
* `to_c`: (optional) Default `true`. Set to `false` to exclude this mapping from config.h
* `warn_duplicate`: (optional) Default `true`. Set to `false` to turn off warning when a value exists in both places
@@ -57,7 +57,7 @@ Under the hood we use [Dotty Dict](https://dotty-dict.readthedocs.io/en/latest/)
#### Value Types
-By default we treat all values as simple strings. If your value is more complex you can use one of these types to intelligently parse the data:
+By default we treat all values as unquoted "raw" data. If your value is more complex you can use one of these types to intelligently parse the data:
* `array`: A comma separated array of strings
* `array.int`: A comma separated array of integers
@@ -65,6 +65,7 @@ By default we treat all values as simple strings. If your value is more complex
* `hex`: A number formatted as hex
* `list`: A space separate array of strings
* `mapping`: A hash of key/value pairs
+* `str`: A quoted string literal
### Add code to extract it
diff --git a/docs/feature_caps_word.md b/docs/feature_caps_word.md
new file mode 100644
index 0000000000..0b71119917
--- /dev/null
+++ b/docs/feature_caps_word.md
@@ -0,0 +1,156 @@
+# Caps Word
+
+It is often useful to type a single word in all capitals, for instance
+abbreviations like "QMK", or in code, identifiers like `KC_SPC`. "Caps Word" is
+a modern alternative to Caps Lock:
+
+* Letters are capitalized while active, and Caps Word automatically disables
+ itself at the end of the word. That is, it stops by default once a space or
+ any key other than `a`--`z`, `0`--`9`, `-`, `_`, delete, or backspace is
+ pressed. Caps Word also disables itself if the keyboard is idle for 5 seconds.
+ This is configurable, see below.
+
+* To avoid requiring a dedicated key for Caps Word, there is an option
+ (`BOTH_SHIFTS_TURNS_ON_CAPS_WORD`) to activate Caps Word by simultaneously
+ pressing both shift keys. See below for other options.
+
+* The implementation does not use the Caps Lock (`KC_CAPS`) keycode. Caps Word
+ works even if you're remapping Caps Lock at the OS level to Ctrl or something
+ else, as Emacs and Vim users often do.
+
+
+## How do I enable Caps Word :id=how-do-i-enable-caps-word
+
+In your `rules.mk`, add:
+
+```make
+CAPS_WORD_ENABLE = yes
+```
+
+Next, use one the following methods to activate Caps Word:
+
+* **Activate by pressing a key**: Use the `CAPS_WORD` keycode (short
+ alias `CAPSWRD`) in your keymap.
+
+* **Activate by pressing Left Shift + Right Shift**: Add `#define
+ BOTH_SHIFTS_TURNS_ON_CAPS_WORD` to config.h. You may also need to disable or
+ reconfigure Command, details below. Then, simultaneously pressing both left
+ and right shifts turns on Caps Word. This method works with the plain
+ `KC_LSFT` and `KC_RSFT` keycodes as well as one-shot shifts and Space Cadet
+ shifts. If your shift keys are mod-taps, hold both shift mod-tap keys until
+ the tapping term, then release them.
+
+* **Activate by double tapping Left Shift**: Add `#define
+ DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD` config.h. Then, double tapping Left Shift
+ turns on Caps Word. This method works with `KC_LSFT` or one-shot Left Shift
+ `OSM(MOD_LSFT)`. To count as a double tap, the maximum time in milliseconds
+ between taps is `TAPPING_TERM`, or if using `TAPPING_TERM_PER_KEY`, the time
+ returned by `get_tapping_term()` for the shift keycode being tapped.
+
+* **Custom activation**: You can activate Caps Word from code by calling
+ `caps_word_on()`. This may be used to activate Caps Word through [a
+ combo](feature_combo.md) or [tap dance](feature_tap_dance.md) or any means
+ you like.
+
+### Troubleshooting: Command :id=troubleshooting-command
+
+When using `BOTH_SHIFTS_TURNS_ON_CAPS_WORD`, you might see a compile message
+**"BOTH_SHIFTS_TURNS_ON_CAPS_WORD and Command should not be enabled at the same
+time, since both use the Left Shift + Right Shift key combination."**
+
+Many keyboards enable the [Command feature](feature_command.md), which by
+default is also activated using the Left Shift + Right Shift key combination. To
+fix this conflict, please disable Command by adding in rules.mk:
+
+```make
+COMMAND_ENABLE = no
+```
+
+Or configure Command to use another key combination like Left Ctrl + Right Ctrl
+by defining `IS_COMMAND()` in config.h:
+
+```c
+// Activate Command with Left Ctrl + Right Ctrl.
+#define IS_COMMAND() (get_mods() == MOD_MASK_CTRL)
+```
+
+
+## Customizing Caps Word :id=customizing-caps-word
+
+### Idle timeout :id=idle-timeout
+
+Caps Word turns off automatically if no keys are pressed for
+`CAPS_WORD_IDLE_TIMEOUT` milliseconds. The default is 5000 (5 seconds).
+Configure the timeout duration in config.h, for instance
+
+```c
+#define CAPS_WORD_IDLE_TIMEOUT 3000 // 3 seconds.
+```
+
+Setting `CAPS_WORD_IDLE_TIMEOUT` to 0 configures Caps Word to never time out.
+Caps Word then remains active indefinitely until a word breaking key is pressed.
+
+
+### Functions :id=functions
+
+Functions to manipulate Caps Word:
+
+| Function | Description |
+|-------------------------|------------------------------------------------|
+| `caps_word_on()` | Turns Caps Word on. |
+| `caps_word_off()` | Turns Caps Word off. |
+| `caps_word_toggle()` | Toggles Caps Word. |
+| `is_caps_word_on()` | Returns true if Caps Word is currently on. |
+
+
+### Configure which keys are "word breaking" :id=configure-which-keys-are-word-breaking
+
+You can define the `caps_word_press_user(uint16_t keycode)` callback to
+configure which keys should be shifted and which keys are considered "word
+breaking" and stop Caps Word.
+
+The callback is called on every key press while Caps Word is active. When the
+key should be shifted (that is, a letter key), the callback should call
+`add_weak_mods(MOD_BIT(KC_LSFT))` to shift the key. Returning true continues the
+current "word," while returning false is "word breaking" and deactivates Caps
+Word. The default callback is
+
+```c
+bool caps_word_press_user(uint16_t keycode) {
+ switch (keycode) {
+ // Keycodes that continue Caps Word, with shift applied.
+ case KC_A ... KC_Z:
+ case KC_MINS:
+ add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to next key.
+ return true;
+
+ // Keycodes that continue Caps Word, without shifting.
+ case KC_1 ... KC_0:
+ case KC_BSPC:
+ case KC_DEL:
+ case KC_UNDS:
+ return true;
+
+ default:
+ return false; // Deactivate Caps Word.
+ }
+}
+```
+
+
+### Representing Caps Word state :id=representing-caps-word-state
+
+Define `caps_word_set_user(bool active)` to get callbacks when Caps Word turns
+on or off. This is useful to represent the current Caps Word state, e.g. by
+setting an LED or playing a sound. In your keymap, define
+
+```c
+void caps_word_set_user(bool active) {
+ if (active) {
+ // Do something when Caps Word activates.
+ } else {
+ // Do something when Caps Word deactivates.
+ }
+}
+```
+
diff --git a/docs/feature_encoders.md b/docs/feature_encoders.md
index 6a1a3750a6..a3d56fd5ef 100644
--- a/docs/feature_encoders.md
+++ b/docs/feature_encoders.md
@@ -54,9 +54,43 @@ If you are using different pinouts for the encoders on each half of a split keyb
#define ENCODER_RESOLUTIONS_RIGHT { 2, 4 }
```
+If the `_RIGHT` definitions aren't specified in your `config.h`, then the non-`_RIGHT` versions will be applied to both sides of the split.
+
+Additionally, if one side does not have an encoder, you can specify `{}` for the pins/resolution -- for example, a split keyboard with only a right-side encoder:
+
+```c
+#define ENCODERS_PAD_A { }
+#define ENCODERS_PAD_B { }
+#define ENCODER_RESOLUTIONS { }
+#define ENCODERS_PAD_A_RIGHT { B12 }
+#define ENCODERS_PAD_B_RIGHT { B13 }
+#define ENCODER_RESOLUTIONS_RIGHT { 4 }
+```
+
+## Encoder map
+
+Encoder mapping may be added to your `keymap.c`, which replicates the normal keyswitch layer handling functionality, but with encoders. Add this to your `rules.mk`:
+
+```make
+ENCODER_MAP_ENABLE = yes
+```
+
+Your `keymap.c` will then need an encoder mapping defined (for four layers and two encoders):
+
+```c
+#if defined(ENCODER_MAP_ENABLE)
+const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
+ [_BASE] = { ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
+ [_LOWER] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI), ENCODER_CCW_CW(RGB_SAD, RGB_SAI) },
+ [_RAISE] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(RGB_SPD, RGB_SPI) },
+ [_ADJUST] = { ENCODER_CCW_CW(RGB_RMOD, RGB_MOD), ENCODER_CCW_CW(KC_RIGHT, KC_LEFT) },
+};
+#endif
+```
+
## Callbacks
-The callback functions can be inserted into your `<keyboard>.c`:
+When not using `ENCODER_MAP_ENABLE = yes`, the callback functions can be inserted into your `<keyboard>.c`:
```c
bool encoder_update_kb(uint8_t index, bool clockwise) {
diff --git a/docs/feature_hd44780.md b/docs/feature_hd44780.md
index dc476c734f..4ade640baa 100644
--- a/docs/feature_hd44780.md
+++ b/docs/feature_hd44780.md
@@ -1,57 +1,298 @@
-# HD44780 LCD Displays
-
-This is an integration of Peter Fleury's LCD library. This page will explain the basics. [For in depth documentation visit his page.](http://www.peterfleury.epizy.com/doxygen/avr-gcc-libraries/group__pfleury__lcd.html)
-
-You can enable support for HD44780 Displays by setting the `HD44780_ENABLE` flag in your keyboards `rules.mk` to yes.
-
-## Configuration
-
-You will need to configure the pins used by your display, and its number of lines and columns in your keyboard's `config.h`.
-
-
-Uncomment the section labled HD44780 and change the parameters as needed.
-````
-/*
- * HD44780 LCD Display Configuration
- */
-
-#define LCD_LINES 2 //< number of visible lines of the display
-#define LCD_DISP_LENGTH 16 //< visibles characters per line of the display
-#define LCD_IO_MODE 1 //< 0: memory mapped mode, 1: IO port mode
-#if LCD_IO_MODE
-#define LCD_PORT PORTB //< port for the LCD lines
-#define LCD_DATA0_PORT LCD_PORT //< port for 4bit data bit 0
-#define LCD_DATA1_PORT LCD_PORT //< port for 4bit data bit 1
-#define LCD_DATA2_PORT LCD_PORT //< port for 4bit data bit 2
-#define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3
-#define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0
-#define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1
-#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2
-#define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3
-#define LCD_RS_PORT LCD_PORT //< port for RS line
-#define LCD_RS_PIN 3 //< pin for RS line
-#define LCD_RW_PORT LCD_PORT //< port for RW line
-#define LCD_RW_PIN 2 //< pin for RW line
-#define LCD_E_PORT LCD_PORT //< port for Enable line
-#define LCD_E_PIN 1 //< pin for Enable line
-#endif
-````
-
-Should you need to configure other properties you can copy them from `quantum/hd44780.h` and set them in your `config.h`
+# HD44780 LCD Driver
+
+## Supported Hardware
+
+LCD modules using [HD44780U](https://www.sparkfun.com/datasheets/LCD/HD44780.pdf) IC or equivalent, communicating in 4-bit mode.
+
+|Module|Size |Notes |
+|------|--------------|---------------------------------|
+|1602A |16x2, 5x8 dots| |
+|2004A |20x4, 5x8 dots|Untested, not currently supported|
+
+To run these modules at 3.3V, an additional MAX660 voltage converter IC must be soldered on, along with two 10µF capacitors. See [this page](https://www.codrey.com/electronic-circuits/hack-your-16x2-lcd/) for more details.
## Usage
-To initialize your display, call `lcd_init()` with one of these parameters:
-````
-LCD_DISP_OFF : display off
-LCD_DISP_ON : display on, cursor off
-LCD_DISP_ON_CURSOR : display on, cursor on
-LCD_DISP_ON_CURSOR_BLINK : display on, cursor on flashing
-````
-This is best done in your keyboards `matrix_init_kb` or your keymaps `matrix_init_user`.
-It is advised to clear the display before use.
-To do so call `lcd_clrscr()`.
+Add the following to your `rules.mk`:
+
+```make
+HD44780_ENABLE = yes
+```
+
+## Basic Configuration
+
+Add the following to your `config.h`:
+
+|Define |Default |Description |
+|-----------------------|--------------|-----------------------------------------------------------------------------------------------------|
+|`HD44780_DATA_PINS` |*Not defined* |(Required) An array of four GPIO pins connected to the display's D4-D7 pins, eg. `{ B1, B3, B2, B6 }`|
+|`HD44780_RS_PIN` |*Not defined* |(Required) The GPIO connected to the display's RS pin |
+|`HD44780_RW_PIN` |*Not defined* |(Required) The GPIO connected to the display's RW pin |
+|`HD44780_E_PIN` |*Not defined* |(Required) The GPIO connected to the display's E pin |
+|`HD44780_DISPLAY_COLS` |`16` |The number of visible characters on a single line of the display |
+|`HD44780_DISPLAY_LINES`|`2` |The number of visible lines on the display |
+|`HD44780_WRAP_LINES` |*Not defined* |If defined, input characters will wrap to the next line |
+
+## Examples
+
+### Hello World
+
+Add the following to your `keymap.c`:
+
+```c
+void keyboard_post_init_user(void) {
+ hd44780_init(true, true); // Show blinking cursor
+ hd44780_puts_P(PSTR("Hello, world!\n"));
+}
+```
+
+### Custom Character Definition
+
+Up to eight custom characters can be defined. This data is stored in the Character Generator RAM (CGRAM), and is not persistent across power cycles.
+
+This example defines the QMK Psi as the first custom character. The first 16 positions in the character set are reserved for the eight custom characters duplicated.
+
+```
+Byte | 16 8 4 2 1
+ 1 | x x x ■ □ ■ □ ■
+ 2 | x x x ■ □ ■ □ ■
+ 3 | x x x ■ □ ■ □ ■
+ 4 | x x x □ ■ ■ ■ □
+ 5 | x x x □ □ ■ □ □
+ 6 | x x x □ □ ■ □ □
+ 7 | x x x □ □ ■ □ □
+ 8 | x x x □ □ □ □ □
+```
+
+```c
+const uint8_t PROGMEM psi[8] = { 0x15, 0x15, 0x15, 0x0E, 0x04, 0x04, 0x04, 0x00 };
+
+void keyboard_post_init_user(void) {
+ hd44780_init(false, false);
+ hd44780_define_char_P(0, psi);
+ // Cursor is incremented while defining characters so must be reset
+ hd44780_home();
+ // 0x08 to avoid null terminator
+ hd44780_puts_P(PSTR("\x08 QMK Firmware"));
+}
+```
+
+## API
+
+### `void hd44780_init(bool cursor, bool blink)`
+
+Initialize the display.
+
+This function should be called only once, before any of the other functions can be called.
+
+#### Arguments
+
+ - `bool cursor`
+ Whether to show the cursor.
+ - `bool blink`
+ Whether to blink the cursor, if shown.
+
+---
+
+### `void hd44780_clear(void)`
+
+Clear the display.
+
+This function is called on init.
+
+---
+
+### `void hd44780_home(void)`
+
+Move the cursor to the home position.
+
+This function is called on init.
+
+---
+
+### `void hd44780_on(bool cursor, bool blink)`
+
+Turn the display on, and/or set the cursor properties.
+
+This function is called on init.
+
+#### Arguments
+
+ - `bool cursor`
+ Whether to show the cursor.
+ - `bool blink`
+ Whether to blink the cursor, if shown.
+
+---
+
+### `void hd44780_off(void)`
+
+Turn the display off.
+
+---
+
+### `void hd44780_set_cursor(uint8_t col, uint8_t line)`
+
+Move the cursor to the specified position on the display.
+
+#### Arguments
+
+ - `uint8_t col`
+ The column number to move to, from 0 to 15 on 16x2 displays.
+ - `bool line`
+ The line number to move to, either 0 or 1 on 16x2 displays.
+
+---
+
+### `void hd44780_putc(char c)`
+
+Print a character to the display. The newline character `\n` will move the cursor to the start of the next line.
+
+The exact character shown may depend on the ROM code of your particular display - refer to the datasheet for the full character set.
+
+#### Arguments
+
+ - `char c`
+ The character to print.
+
+---
+
+### `void hd44780_puts(const char *s)`
+
+Print a string of characters to the display.
+
+#### Arguments
+
+ - `const char *s`
+ The string to print.
+
+---
+
+### `void hd44780_puts_P(const char *s)`
+
+Print a string of characters from PROGMEM to the display.
+
+On ARM devices, this function is simply an alias of `hd44780_puts()`.
+
+#### Arguments
+
+ - `const char *s`
+ The PROGMEM string to print (ie. `PSTR("Hello")`).
+
+---
+
+### `void hd44780_define_char(uint8_t index, uint8_t *data)`
+
+Define a custom character.
+
+#### Arguments
+
+ - `uint8_t index`
+ The index of the custom character to define, from 0 to 7.
+ - `uint8_t *data`
+ An array of 8 bytes containing the 5-bit row data of the character, where the first byte is the topmost row, and the least significant bit of each byte is the rightmost column.
+
+---
+
+### `void hd44780_define_char_P(uint8_t index, const uint8_t *data)`
+
+Define a custom character from PROGMEM.
+
+On ARM devices, this function is simply an alias of `hd44780_define_char()`.
+
+#### Arguments
+
+ - `uint8_t index`
+ The index of the custom character to define, from 0 to 7.
+ - `const uint8_t *data`
+ A PROGMEM array of 8 bytes containing the 5-bit row data of the character, where the first byte is the topmost row, and the least significant bit of each byte is the rightmost column.
+
+---
+
+### `bool hd44780_busy(void)`
+
+Indicates whether the display is currently processing, and cannot accept instructions.
+
+#### Return Value
+
+`true` if the display is busy.
+
+---
+
+### `void hd44780_write(uint8_t data, bool isData)`
+
+Write a byte to the display.
+
+#### Arguments
+
+ - `uint8_t data`
+ The byte to send to the display.
+ - `bool isData`
+ Whether the byte is an instruction or character data.
+
+---
+
+### `uint8_t hd44780_read(bool isData)`
+
+Read a byte from the display.
+
+#### Arguments
+
+ - `bool isData`
+ Whether to read the current cursor position, or the character at the cursor.
+
+#### Return Value
+
+If `isData` is `true`, the returned byte will be the character at the current DDRAM address. Otherwise, it will be the current DDRAM address and the busy flag.
+
+---
+
+### `void hd44780_command(uint8_t command)`
+
+Send a command to the display. Refer to the datasheet and `hd44780.h` for the valid commands and defines.
+
+This function waits for the display to clear the busy flag before sending the command.
+
+#### Arguments
+
+ - `uint8_t command`
+ The command to send.
+
+---
+
+### `void hd44780_data(uint8_t data)`
+
+Send a byte of data to the display.
+
+This function waits for the display to clear the busy flag before sending the data.
+
+#### Arguments
+
+ - `uint8_t data`
+ The byte of data to send.
+
+---
+
+### `void hd44780_set_cgram_address(uint8_t address)`
+
+Set the CGRAM address.
+
+This function is used when defining custom characters.
+
+#### Arguments
+
+ - `uint8_t address`
+ The CGRAM address to move to, from `0x00` to `0x3F`.
+
+---
+
+### `void hd44780_set_ddram_address(uint8_t address)`
+
+Set the DDRAM address.
+
+This function is used when printing characters to the display, and setting the cursor.
-To now print something to your Display you first call `lcd_gotoxy(column, line)`. To go to the start of the first line you would call `lcd_gotoxy(0, 0)` and then print a string with `lcd_puts("example string")`.
+#### Arguments
-There are more methods available to control the display. [For in depth documentation please visit the linked page.](http://www.peterfleury.epizy.com/doxygen/avr-gcc-libraries/group__pfleury__lcd.html)
+ - `uint8_t address`
+ The DDRAM address to move to, from `0x00` to `0x7F`.
diff --git a/docs/feature_joystick.md b/docs/feature_joystick.md
index fe33517a16..2635298587 100644
--- a/docs/feature_joystick.md
+++ b/docs/feature_joystick.md
@@ -150,3 +150,5 @@ Note that the supported AVR MCUs have a 10-bit ADC, and 12-bit for most STM32 MC
Joystick buttons are normal Quantum keycodes, defined as `JS_BUTTON0` to `JS_BUTTON31`, depending on the number of buttons you have configured.
To trigger a joystick button, just add the corresponding keycode to your keymap.
+
+You can also trigger joystick buttons in code with `register_joystick_button(button)` and `unregister_joystick_button(button)`, where `button` is the 0-based button index (0 = button 1).
diff --git a/docs/feature_midi.md b/docs/feature_midi.md
index 3da5c4940a..490bf7cc7d 100644
--- a/docs/feature_midi.md
+++ b/docs/feature_midi.md
@@ -254,7 +254,7 @@ For the above, the `MI_C` keycode will produce a C3 (note number 48), and so on.
<!--
#### QMK Internals (Autogenerated)
- * [Internals/MIDI Device Setup Process](internals_midi_device_setup_process.md)
- * [Internals/MIDI Device](internals_midi_device.md)
- * [Internals/MIDI Util](internals_midi_util.md)
+ * [Internals/MIDI Device Setup Process](internals/midi_device_setup_process.md)
+ * [Internals/MIDI Device](internals/midi_device.md)
+ * [Internals/MIDI Util](internals/midi_util.md)
-->
diff --git a/docs/feature_pointing_device.md b/docs/feature_pointing_device.md
index 8c51865558..02c1e64a31 100644
--- a/docs/feature_pointing_device.md
+++ b/docs/feature_pointing_device.md
@@ -134,6 +134,7 @@ The Pimoroni Trackball module is a I2C based breakout board with an RGB enable t
### PMW 3360 Sensor
+This drivers supports multiple sensors _per_ controller, so 2 can be attached at the same side for split keyboards (or unsplit keyboards).
To use the PMW 3360 sensor, add this to your `rules.mk`
```make
@@ -145,6 +146,7 @@ The PMW 3360 is an SPI driven optical sensor, that uses a built in IR LED for su
| Setting | Description | Default |
|-----------------------------|--------------------------------------------------------------------------------------------|---------------|
|`PMW3360_CS_PIN` | (Required) Sets the Cable Select pin connected to the sensor. | _not defined_ |
+|`PMW3360_CS_PINS` | (Alternative) Sets the Cable Select pins connected to multiple sensors. | _not defined_ |
|`PMW3360_CLOCK_SPEED` | (Optional) Sets the clock speed that the sensor runs at. | `2000000` |
|`PMW3360_SPI_LSBFIRST` | (Optional) Sets the Least/Most Significant Byte First setting for SPI. | `false` |
|`PMW3360_SPI_MODE` | (Optional) Sets the SPI Mode for the sensor. | `3` |
@@ -155,6 +157,36 @@ The PMW 3360 is an SPI driven optical sensor, that uses a built in IR LED for su
The CPI range is 100-12000, in increments of 100. Defaults to 1600 CPI.
+To use multiple sensors, instead of setting `PMW3360_CS_PIN` you need to set `PMW3360_CS_PINS` and also handle and merge the read from this sensor in user code.
+Note that different (per sensor) values of CPI, speed liftoff, rotational angle or flipping of X/Y is not currently supported.
+
+```c
+// in config.h:
+#define PMW3360_CS_PINS { B5, B6 }
+
+// in keyboard.c:
+#ifdef POINTING_DEVICE_ENABLE
+void pointing_device_init_kb(void) {
+ pmw3360_init(1); // index 1 is the second device.
+ pointing_device_set_cpi(800); // applies to both sensors
+ pointing_device_init_user();
+}
+
+// Contains report from sensor #0 already, need to merge in from sensor #1
+report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
+ report_pmw3360_t data = pmw3360_read_burst(1);
+ if (data.isOnSurface && data.isMotion) {
+// From quantum/pointing_device_drivers.c
+#define constrain_hid(amt) ((amt) < -127 ? -127 : ((amt) > 127 ? 127 : (amt)))
+ mouse_report.x = constrain_hid(mouse_report.x + data.dx);
+ mouse_report.y = constrain_hid(mouse_report.y + data.dy);
+ }
+ return pointing_device_task_user(mouse_report);
+}
+#endif
+
+```
+
### PMW 3389 Sensor
To use the PMW 3389 sensor, add this to your `rules.mk`
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 87dbc5f780..b2fc61e51e 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -171,6 +171,7 @@ Configure the hardware via your `config.h`:
|----------|-------------|---------|
| `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 |
| `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 |
+| `ISSI_PWM_FREQUENCY` | (Optional) PWM Frequency Setting - IS31FL3737B only | 0 |
| `ISSI_SWPULLUP` | (Optional) Set the value of the SWx lines on-chip de-ghosting resistors | PUR_0R (Disabled) |
| `ISSI_CSPULLUP` | (Optional) Set the value of the CSx lines on-chip de-ghosting resistors | PUR_0R (Disabled) |
| `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | |
@@ -656,18 +657,19 @@ You can enable a single effect by defining `ENABLE_[EFFECT_NAME]` in your `confi
### RGB Matrix Effect Typing Heatmap :id=rgb-matrix-effect-typing-heatmap
-This effect will color the RGB matrix according to a heatmap of recently pressed
-keys. Whenever a key is pressed its "temperature" increases as well as that of
-its neighboring keys. The temperature of each key is then decreased
-automatically every 25 milliseconds by default.
+This effect will color the RGB matrix according to a heatmap of recently pressed keys. Whenever a key is pressed its "temperature" increases as well as that of its neighboring keys. The temperature of each key is then decreased automatically every 25 milliseconds by default.
-In order to change the delay of temperature decrease define
-`RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS`:
+In order to change the delay of temperature decrease define `RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS`:
```c
#define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 50
```
+Heatmap effect may not light up the correct adjacent LEDs for certain key matrix layout such as split keyboards. The following define will limit the effect to pressed keys only:
+```c
+#define RGB_MATRIX_TYPING_HEATMAP_SLIM
+```
+
## Custom RGB Matrix Effects :id=custom-rgb-matrix-effects
By setting `RGB_MATRIX_CUSTOM_USER = yes` in `rules.mk`, new effects can be defined directly from your keymap or userspace, without having to edit any QMK core files. To declare new effects, create a `rgb_matrix_user.inc` file in the user keymap directory or userspace folder.
diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md
index 08e820c0a6..11d4f89950 100644
--- a/docs/feature_rgblight.md
+++ b/docs/feature_rgblight.md
@@ -326,6 +326,19 @@ void post_process_record_user(uint16_t keycode, keyrecord_t *record) {
```
would turn the layer 0 (or 1) on and off again three times when `DEBUG` is pressed.
+Blinking accumulates layers so if multiple layers are set blinking at the same time they will all blink for the duration and repeat times of the last layer to be blinked.
+To stop these other layers from blinking use `rgblight_unblink_layer` or `rgblight_unblink_all_but_layer`:
+
+```c
+rgblight_blink_layer(1, 500);
+rgblight_unblink_all_but_layer(1);
+```
+
+```c
+rgblight_unblink_layer(3);
+rgblight_blink_layer(2, 500);
+```
+
!> Lighting layers on split keyboards will require layer state synced to the slave half (e.g. `#define SPLIT_LAYER_STATE_ENABLE`). See [data sync options](feature_split_keyboard.md#data-sync-options) for more details.
### Overriding RGB Lighting on/off status
diff --git a/docs/feature_swap_hands.md b/docs/feature_swap_hands.md
index 654108ae70..6768020f12 100644
--- a/docs/feature_swap_hands.md
+++ b/docs/feature_swap_hands.md
@@ -31,3 +31,16 @@ Note that the array indices are reversed same as the matrix and the values are o
|`SH_OS` |One shot swap hands: toggles while pressed or until next key press. |
`SH_TT` swap-hands tap-toggle key is similar to [layer tap-toggle](feature_layers.md?id=switching-and-toggling-layers). Tapping repeatedly (5 taps by default) will toggle swap-hands on or off, like `SH_TG`. Tap-toggle count can be changed by defining a value for `TAPPING_TOGGLE`.
+
+## Encoder Mapping
+
+When using an encoder mapping, it's also able to handle swapping encoders between sides, too.
+
+Encoder indexes are defined as left-to-right, and the extent of the array needs to match the number of encoders on the keyboard.
+
+As an example, if a split keyboard has a single encoder per side, you can swap the order by using the following code in your keymap:
+```c
+#if defined(SWAP_HANDS_ENABLE) && defined(ENCODER_MAP_ENABLE)
+const uint8_t PROGMEM encoder_hand_swap_config[NUM_ENCODERS] = { 1, 0 };
+#endif
+```
diff --git a/docs/feature_unicode.md b/docs/feature_unicode.md
index 6c3e2a1a2f..bced419a03 100644
--- a/docs/feature_unicode.md
+++ b/docs/feature_unicode.md
@@ -230,17 +230,6 @@ send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
Example uses include sending Unicode strings when a key is pressed, as described in [Macros](feature_macros.md).
-### `send_unicode_hex_string()` (Deprecated)
-
-Similar to `send_unicode_string()`, but the characters are represented by their Unicode code points, written in hexadecimal and separated by spaces. For example, the table flip above would be achieved with:
-
-```c
-send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
-```
-
-An easy way to convert your Unicode string to this format is to use [this site](https://r12a.github.io/app-conversion/) and take the result in the "Hex/UTF-32" section.
-
-
## Additional Language Support
In `quantum/keymap_extras`, you'll see various language files — these work the same way as the ones for alternative layouts such as Colemak or BÉPO. When you include one of these language headers, you gain access to keycodes specific to that language / national layout. Such keycodes are defined by a 2-letter country/language code, followed by an underscore and a 4-letter abbreviation of the character to which the key corresponds. For example, including `keymap_french.h` and using `FR_UGRV` in your keymap will output `ù` when typed on a system with a native French AZERTY layout.
diff --git a/docs/flashing.md b/docs/flashing.md
index 83f4bf82ae..ae31f9c621 100644
--- a/docs/flashing.md
+++ b/docs/flashing.md
@@ -347,3 +347,14 @@ Flashing sequence:
2. Wait for the OS to detect the device
3. Copy the .uf2 file to the new USB disk
4. Wait for the keyboard to become available
+
+or
+
+CLI Flashing sequence:
+
+1. Enter the bootloader using any of the following methods:
+ * Tap the `RESET` keycode
+ * Double-tap the `nRST` button on the PCB.
+2. Wait for the OS to detect the device
+3. Flash via QMK CLI eg. `qmk flash --keyboard handwired/onekey/blackpill_f411_tinyuf2 --keymap default`
+4. Wait for the keyboard to become available
diff --git a/docs/internals_gpio_control.md b/docs/gpio_control.md
index e1f1515b71..e1f1515b71 100644
--- a/docs/internals_gpio_control.md
+++ b/docs/gpio_control.md
diff --git a/docs/internals_defines.md b/docs/internals/defines.md
index fdcb553589..fdcb553589 100644
--- a/docs/internals_defines.md
+++ b/docs/internals/defines.md
diff --git a/docs/internals_input_callback_reg.md b/docs/internals/input_callback_reg.md
index 4ea132a83a..4ea132a83a 100644
--- a/docs/internals_input_callback_reg.md
+++ b/docs/internals/input_callback_reg.md
diff --git a/docs/internals_midi_device.md b/docs/internals/midi_device.md
index 5b57abd454..5b57abd454 100644
--- a/docs/internals_midi_device.md
+++ b/docs/internals/midi_device.md
diff --git a/docs/internals_midi_device_setup_process.md b/docs/internals/midi_device_setup_process.md
index ae82197c5c..ae82197c5c 100644
--- a/docs/internals_midi_device_setup_process.md
+++ b/docs/internals/midi_device_setup_process.md
diff --git a/docs/internals_midi_util.md b/docs/internals/midi_util.md
index 97821bd180..97821bd180 100644
--- a/docs/internals_midi_util.md
+++ b/docs/internals/midi_util.md
diff --git a/docs/internals_send_functions.md b/docs/internals/send_functions.md
index b331508008..b331508008 100644
--- a/docs/internals_send_functions.md
+++ b/docs/internals/send_functions.md
diff --git a/docs/internals_sysex_tools.md b/docs/internals/sysex_tools.md
index 55dbe9e164..55dbe9e164 100644
--- a/docs/internals_sysex_tools.md
+++ b/docs/internals/sysex_tools.md
diff --git a/docs/ja/_summary.md b/docs/ja/_summary.md
index b90480041c..81b5756c27 100644
--- a/docs/ja/_summary.md
+++ b/docs/ja/_summary.md
@@ -137,7 +137,7 @@
* [EEPROM ドライバ](ja/eeprom_driver.md)
* [シリアル ドライバ](ja/serial_driver.md)
* [UART ドライバ](ja/uart_driver.md)
- * [GPIO 制御](ja/internals_gpio_control.md)
+ * [GPIO 制御](ja/gpio_control.md)
* [キーボード ガイドライン](ja/hardware_keyboard_guidelines.md)
* Python 開発
@@ -173,10 +173,10 @@
* [QMK を理解する](ja/understanding_qmk.md)
* QMK の内部詳細(作成中)
- * [定義](ja/internals_defines.md)
- * [入力コールバック登録](ja/internals_input_callback_reg.md)
- * [Midi デバイス](ja/internals_midi_device.md)
- * [Midi デバイスのセットアップ手順](ja/internals_midi_device_setup_process.md)
- * [Midi ユーティリティ](ja/internals_midi_util.md)
- * [Midi 送信関数](ja/internals_send_functions.md)
- * [Sysex Tools](ja/internals_sysex_tools.md)
+ * [定義](ja/internals/defines.md)
+ * [入力コールバック登録](ja/internals/input_callback_reg.md)
+ * [Midi デバイス](ja/internals/midi_device.md)
+ * [Midi デバイスのセットアップ手順](ja/internals/midi_device_setup_process.md)
+ * [Midi ユーティリティ](ja/internals/midi_util.md)
+ * [Midi 送信関数](ja/internals/send_functions.md)
+ * [Sysex Tools](ja/internals/sysex_tools.md)
diff --git a/docs/ja/feature_unicode.md b/docs/ja/feature_unicode.md
index bfcb866ce1..2158678f3c 100644
--- a/docs/ja/feature_unicode.md
+++ b/docs/ja/feature_unicode.md
@@ -233,17 +233,6 @@ send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
使用例には、[Macros](ja/feature_macros.md) で説明されているように、キーが押された時に Unicode 文字列を送信することが含まれます。
-### `send_unicode_hex_string()`
-
-`send_unicode_string()` に似ていますが、文字は Unicode コードポイントで表され、16進数で記述され、空白で区切られています。例えば、上記のちゃぶ台返しは以下で表されます:
-
-```c
-send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
-```
-
-[このサイト](https://r12a.github.io/app-conversion/)で結果を "Hex/UTF-32" で受け取ることで、Unicode 文字列をこの形式に簡単に変換できます。
-
-
## 追加の言語サポート
`quantum/keymap_extras` には、様々な言語ファイルがあります — これらは Colemak または BÉPO のような代替レイアウトのファイルと同じように動作します。これらの言語ヘッダのいずれかを `#include` すると、その言語/国のレイアウトに固有のキーコードにアクセスできます。このようなキーコードは、2文字の国/言語コードの後に、アンダースコアとキーが対応する4文字の略語が続くことで定義されます。例えば、キーマップに `keymap_french.h` を含め、`FR_UGRV` を使うと、ネイティブのフランス語 AZERTY レイアウトを使うシステムで入力すると、`ù` が出力されます。
diff --git a/docs/ja/internals_gpio_control.md b/docs/ja/gpio_control.md
index 60c5367870..7bece3e0c7 100644
--- a/docs/ja/internals_gpio_control.md
+++ b/docs/ja/gpio_control.md
@@ -1,8 +1,8 @@
# GPIO 制御 :id=gpio-control
<!---
- original document: 0.13.15:docs/internals_gpio_control.md
- git diff 0.13.15 HEAD -- docs/internals_gpio_control.md | cat
+ original document: 0.13.15:docs/gpio_control.md
+ git diff 0.13.15 HEAD -- docs/gpio_control.md | cat
-->
QMK には、マイクロコントローラに依存しない GPIO 制御抽象レイヤーがあります。これは異なるプラットフォーム間でピン制御に簡単にアクセスできるようにするためのものです。
diff --git a/docs/ja/internals_defines.md b/docs/ja/internals_defines.md
deleted file mode 100644
index 512730df75..0000000000
--- a/docs/ja/internals_defines.md
+++ /dev/null
@@ -1,78 +0,0 @@
-# `defines` グループ {#group__defines}
-
-## 概要
-
-メンバー | 説明
---------------------------------|---------------------------------------------
-`define `[`SYSEX_BEGIN`](#group__defines_1ga1a3c39bb790dda8a368c4247caabcf79) |
-`define `[`SYSEX_END`](#group__defines_1ga753706d1d28e6f96d7caf1973e80feed) |
-`define `[`MIDI_STATUSMASK`](#group__defines_1gab78a1c818a5f5dab7a8946543f126c69) |
-`define `[`MIDI_CHANMASK`](#group__defines_1ga239edc0a6f8405d3a8f2804f1590b909) |
-`define `[`MIDI_CC`](#group__defines_1ga45f116a1daab76b3c930c2cecfaef215) |
-`define `[`MIDI_NOTEON`](#group__defines_1gafd416f27bf3590868c0c1f55c30be4c7) |
-`define `[`MIDI_NOTEOFF`](#group__defines_1gabed24bea2d989fd655e2ef2ad0765adc) |
-`define `[`MIDI_AFTERTOUCH`](#group__defines_1ga3a322d8cfd53576a2e167c1840551b0f) |
-`define `[`MIDI_PITCHBEND`](#group__defines_1gabcc799504e8064679bca03f232223af4) |
-`define `[`MIDI_PROGCHANGE`](#group__defines_1gaefb3f1595ffbb9db66b46c2c919a3d42) |
-`define `[`MIDI_CHANPRESSURE`](#group__defines_1gaeb3281cc7fcd0daade8ed3d2dfc33dbe) |
-`define `[`MIDI_CLOCK`](#group__defines_1gafa5e4e295aafd15ab7893344599b3b89) |
-`define `[`MIDI_TICK`](#group__defines_1ga3b99408ff864613765d4c3c2ceb52aa7) |
-`define `[`MIDI_START`](#group__defines_1ga8233631c85823aa546f932ad8975caa4) |
-`define `[`MIDI_CONTINUE`](#group__defines_1gab24430f0081e27215b0da84dd0ee745c) |
-`define `[`MIDI_STOP`](#group__defines_1ga3af9271d4b1f0d22904a0b055f48cf62) |
-`define `[`MIDI_ACTIVESENSE`](#group__defines_1gacd88ed42dba52bb4b2052c5656362677) |
-`define `[`MIDI_RESET`](#group__defines_1ga02947f30ca62dc332fdeb10c5868323b) |
-`define `[`MIDI_TC_QUARTERFRAME`](#group__defines_1gaaa072f33590e236d1bfd8f28e833ae31) |
-`define `[`MIDI_SONGPOSITION`](#group__defines_1ga412f6ed33a2150051374bee334ee1705) |
-`define `[`MIDI_SONGSELECT`](#group__defines_1gafcab254838b028365ae0259729e72c4e) |
-`define `[`MIDI_TUNEREQUEST`](#group__defines_1ga8100b907b8c0a84e58b1c53dcd9bd795) |
-`define `[`SYSEX_EDUMANUFID`](#group__defines_1ga5ef855ed955b00a2239ca16afbeb164f) |
-
-## メンバー
-
-#### `define `[`SYSEX_BEGIN`](#group__defines_1ga1a3c39bb790dda8a368c4247caabcf79) {#group__defines_1ga1a3c39bb790dda8a368c4247caabcf79}
-
-#### `define `[`SYSEX_END`](#group__defines_1ga753706d1d28e6f96d7caf1973e80feed) {#group__defines_1ga753706d1d28e6f96d7caf1973e80feed}
-
-#### `define `[`MIDI_STATUSMASK`](#group__defines_1gab78a1c818a5f5dab7a8946543f126c69) {#group__defines_1gab78a1c818a5f5dab7a8946543f126c69}
-
-#### `define `[`MIDI_CHANMASK`](#group__defines_1ga239edc0a6f8405d3a8f2804f1590b909) {#group__defines_1ga239edc0a6f8405d3a8f2804f1590b909}
-
-#### `define `[`MIDI_CC`](#group__defines_1ga45f116a1daab76b3c930c2cecfaef215) {#group__defines_1ga45f116a1daab76b3c930c2cecfaef215}
-
-#### `define `[`MIDI_NOTEON`](#group__defines_1gafd416f27bf3590868c0c1f55c30be4c7) {#group__defines_1gafd416f27bf3590868c0c1f55c30be4c7}
-
-#### `define `[`MIDI_NOTEOFF`](#group__defines_1gabed24bea2d989fd655e2ef2ad0765adc) {#group__defines_1gabed24bea2d989fd655e2ef2ad0765adc}
-
-#### `define `[`MIDI_AFTERTOUCH`](#group__defines_1ga3a322d8cfd53576a2e167c1840551b0f) {#group__defines_1ga3a322d8cfd53576a2e167c1840551b0f}
-
-#### `define `[`MIDI_PITCHBEND`](#group__defines_1gabcc799504e8064679bca03f232223af4) {#group__defines_1gabcc799504e8064679bca03f232223af4}
-
-#### `define `[`MIDI_PROGCHANGE`](#group__defines_1gaefb3f1595ffbb9db66b46c2c919a3d42) {#group__defines_1gaefb3f1595ffbb9db66b46c2c919a3d42}
-
-#### `define `[`MIDI_CHANPRESSURE`](#group__defines_1gaeb3281cc7fcd0daade8ed3d2dfc33dbe) {#group__defines_1gaeb3281cc7fcd0daade8ed3d2dfc33dbe}
-
-#### `define `[`MIDI_CLOCK`](#group__defines_1gafa5e4e295aafd15ab7893344599b3b89) {#group__defines_1gafa5e4e295aafd15ab7893344599b3b89}
-
-#### `define `[`MIDI_TICK`](#group__defines_1ga3b99408ff864613765d4c3c2ceb52aa7) {#group__defines_1ga3b99408ff864613765d4c3c2ceb52aa7}
-
-#### `define `[`MIDI_START`](#group__defines_1ga8233631c85823aa546f932ad8975caa4) {#group__defines_1ga8233631c85823aa546f932ad8975caa4}
-
-#### `define `[`MIDI_CONTINUE`](#group__defines_1gab24430f0081e27215b0da84dd0ee745c) {#group__defines_1gab24430f0081e27215b0da84dd0ee745c}
-
-#### `define `[`MIDI_STOP`](#group__defines_1ga3af9271d4b1f0d22904a0b055f48cf62) {#group__defines_1ga3af9271d4b1f0d22904a0b055f48cf62}
-
-#### `define `[`MIDI_ACTIVESENSE`](#group__defines_1gacd88ed42dba52bb4b2052c5656362677) {#group__defines_1gacd88ed42dba52bb4b2052c5656362677}
-
-#### `define `[`MIDI_RESET`](#group__defines_1ga02947f30ca62dc332fdeb10c5868323b) {#group__defines_1ga02947f30ca62dc332fdeb10c5868323b}
-
-#### `define `[`MIDI_TC_QUARTERFRAME`](#group__defines_1gaaa072f33590e236d1bfd8f28e833ae31) {#group__defines_1gaaa072f33590e236d1bfd8f28e833ae31}
-
-#### `define `[`MIDI_SONGPOSITION`](#group__defines_1ga412f6ed33a2150051374bee334ee1705) {#group__defines_1ga412f6ed33a2150051374bee334ee1705}
-
-#### `define `[`MIDI_SONGSELECT`](#group__defines_1gafcab254838b028365ae0259729e72c4e) {#group__defines_1gafcab254838b028365ae0259729e72c4e}
-
-#### `define `[`MIDI_TUNEREQUEST`](#group__defines_1ga8100b907b8c0a84e58b1c53dcd9bd795) {#group__defines_1ga8100b907b8c0a84e58b1c53dcd9bd795}
-
-#### `define `[`SYSEX_EDUMANUFID`](#group__defines_1ga5ef855ed955b00a2239ca16afbeb164f) {#group__defines_1ga5ef855ed955b00a2239ca16afbeb164f}
-
diff --git a/docs/ja/internals_input_callback_reg.md b/docs/ja/internals_input_callback_reg.md
deleted file mode 100644
index 864b1d5750..0000000000
--- a/docs/ja/internals_input_callback_reg.md
+++ /dev/null
@@ -1,173 +0,0 @@
-# group `input_callback_reg` {#group__input__callback__reg}
-
-<!---
- original document: 0.9.34:docs/internals_input_callback_reg.md
- git diff 0.9.34 HEAD -- docs/internals_input_callback_reg.md | cat
--->
-
-これらは受信コールバックを登録するために使用する関数です。
-
-関数は、適切な midi メッセージが関連するデバイスの入力と一致した場合に呼び出されます。
-
-## 概要
-
-| メンバー | 説明 |
---------------------------------|---------------------------------------------
-| `public void `[`midi_register_cc_callback`](#group__input__callback__reg_1ga64ab672abbbe393c9c4a83110c8df718)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_three_byte_func_t func)` | コントロールチェンジメッセージ受信コールバックを登録する。 |
-| `public void `[`midi_register_noteon_callback`](#group__input__callback__reg_1ga3962f276c17618923f1152779552103e)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_three_byte_func_t func)` | ノートオン受信コールバックを登録する。 |
-| `public void `[`midi_register_noteoff_callback`](#group__input__callback__reg_1gac847b66051bd6d53b762958be0ec4c6d)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_three_byte_func_t func)` | ノートオフ受信コールバックを登録する。 |
-| `public void `[`midi_register_aftertouch_callback`](#group__input__callback__reg_1gaa95bc901bd9edff956a667c9a69dd01f)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_three_byte_func_t func)` | アフタータッチ受信コールバックを登録する。 |
-| `public void `[`midi_register_pitchbend_callback`](#group__input__callback__reg_1ga071a28f02ba14f53de219be70ebd9a48)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_three_byte_func_t func)` | ピッチベンド受信コールバックを登録する。 |
-| `public void `[`midi_register_songposition_callback`](#group__input__callback__reg_1gaf2adfd79637f3553d8f26deb1ca22ed6)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_three_byte_func_t func)` | ソングポジション受信コールバックを登録する。 |
-| `public void `[`midi_register_progchange_callback`](#group__input__callback__reg_1gae6ba1a35a4cde9bd15dd42f87401d127)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_two_byte_func_t func)` | プログラムチェンジ受信コールバックを登録する。 |
-| `public void `[`midi_register_chanpressure_callback`](#group__input__callback__reg_1ga39b31f1f4fb93917ce039b958f21b4f5)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_two_byte_func_t func)` | チャンネルプレッシャー受信コールバックを登録する。 |
-| `public void `[`midi_register_songselect_callback`](#group__input__callback__reg_1gaf9aafc76a2dc4b9fdbb4106cbda6ce72)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_two_byte_func_t func)` | ソングセレクト受信コールバックを登録する。 |
-| `public void `[`midi_register_tc_quarterframe_callback`](#group__input__callback__reg_1ga0a119fada2becc628cb15d753b257e6e)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_two_byte_func_t func)` | タイムコードクォータフレーム受信コールバックを登録する。 |
-| `public void `[`midi_register_realtime_callback`](#group__input__callback__reg_1ga764f440e857b89084b1a07f9da2ff93a)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_one_byte_func_t func)` | リアルタイム受信コールバックを登録する。 |
-| `public void `[`midi_register_tunerequest_callback`](#group__input__callback__reg_1gae40ff3ce20bda79fef87da24b8321cb1)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_one_byte_func_t func)` | チューンリクエスト受信コールバックを登録する。 |
-| `public void `[`midi_register_sysex_callback`](#group__input__callback__reg_1ga63ce9631b025785c1848d0122d4c4c48)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_sysex_func_t func)` | システムエクスクルーシブ受信コールバックを登録する。 |
-| `public void `[`midi_register_fallthrough_callback`](#group__input__callback__reg_1ga7ed189164aa9682862b3181153afbd94)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_var_byte_func_t func)` | フォールスルー受信コールバックを登録する。 |
-| `public void `[`midi_register_catchall_callback`](#group__input__callback__reg_1ga9dbfed568d047a6cd05708f11fe39e99)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_var_byte_func_t func)` | キャッチオール受信コールバックを登録する。 |
-
-## メンバー
-
-#### `public void `[`midi_register_cc_callback`](#group__input__callback__reg_1ga64ab672abbbe393c9c4a83110c8df718)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_three_byte_func_t func)` {#group__input__callback__reg_1ga64ab672abbbe393c9c4a83110c8df718}
-
-コントロールチェンジメッセージ受信コールバックを登録する。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_noteon_callback`](#group__input__callback__reg_1ga3962f276c17618923f1152779552103e)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_three_byte_func_t func)` {#group__input__callback__reg_1ga3962f276c17618923f1152779552103e}
-
-ノートオン受信コールバックを登録する。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_noteoff_callback`](#group__input__callback__reg_1gac847b66051bd6d53b762958be0ec4c6d)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_three_byte_func_t func)` {#group__input__callback__reg_1gac847b66051bd6d53b762958be0ec4c6d}
-
-ノートオフ受信コールバックを登録する。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_aftertouch_callback`](#group__input__callback__reg_1gaa95bc901bd9edff956a667c9a69dd01f)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_three_byte_func_t func)` {#group__input__callback__reg_1gaa95bc901bd9edff956a667c9a69dd01f}
-
-アフタータッチ受信コールバックを登録する。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_pitchbend_callback`](#group__input__callback__reg_1ga071a28f02ba14f53de219be70ebd9a48)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_three_byte_func_t func)` {#group__input__callback__reg_1ga071a28f02ba14f53de219be70ebd9a48}
-
-ピッチベンド受信コールバックを登録する。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_songposition_callback`](#group__input__callback__reg_1gaf2adfd79637f3553d8f26deb1ca22ed6)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_three_byte_func_t func)` {#group__input__callback__reg_1gaf2adfd79637f3553d8f26deb1ca22ed6}
-
-ソングポジション受信コールバックを登録する。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_progchange_callback`](#group__input__callback__reg_1gae6ba1a35a4cde9bd15dd42f87401d127)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_two_byte_func_t func)` {#group__input__callback__reg_1gae6ba1a35a4cde9bd15dd42f87401d127}
-
-プログラムチェンジ受信コールバックを登録する。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_chanpressure_callback`](#group__input__callback__reg_1ga39b31f1f4fb93917ce039b958f21b4f5)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_two_byte_func_t func)` {#group__input__callback__reg_1ga39b31f1f4fb93917ce039b958f21b4f5}
-
-チャンネルプレッシャー受信コールバックを登録する。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_songselect_callback`](#group__input__callback__reg_1gaf9aafc76a2dc4b9fdbb4106cbda6ce72)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_two_byte_func_t func)` {#group__input__callback__reg_1gaf9aafc76a2dc4b9fdbb4106cbda6ce72}
-
-ソングセレクト受信コールバックを登録する。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_tc_quarterframe_callback`](#group__input__callback__reg_1ga0a119fada2becc628cb15d753b257e6e)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_two_byte_func_t func)` {#group__input__callback__reg_1ga0a119fada2becc628cb15d753b257e6e}
-
-タイムコードクォータフレーム受信コールバックを登録する。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_realtime_callback`](#group__input__callback__reg_1ga764f440e857b89084b1a07f9da2ff93a)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_one_byte_func_t func)` {#group__input__callback__reg_1ga764f440e857b89084b1a07f9da2ff93a}
-
-リアルタイム受信コールバックを登録する。
-
-全てのリアルタイムメッセージ型に対してコールバックが呼ばれます。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_tunerequest_callback`](#group__input__callback__reg_1gae40ff3ce20bda79fef87da24b8321cb1)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_one_byte_func_t func)` {#group__input__callback__reg_1gae40ff3ce20bda79fef87da24b8321cb1}
-
-チューンリクエスト受信コールバックを登録する。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_sysex_callback`](#group__input__callback__reg_1ga63ce9631b025785c1848d0122d4c4c48)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_sysex_func_t func)` {#group__input__callback__reg_1ga63ce9631b025785c1848d0122d4c4c48}
-
-システムエクスクルーシブ受信コールバックを登録する。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_fallthrough_callback`](#group__input__callback__reg_1ga7ed189164aa9682862b3181153afbd94)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_var_byte_func_t func)` {#group__input__callback__reg_1ga7ed189164aa9682862b3181153afbd94}
-
-フォールスルー受信コールバックを登録する。
-
-より具体的なコールバックが見つからない場合にのみ呼ばれます。例えば、ノートオン受信コールバックを登録していないがノートオンメッセージを受け取った場合、フォールスルー受信コールバックが登録されている場合はそれが呼ばれます。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
-
-#### `public void `[`midi_register_catchall_callback`](#group__input__callback__reg_1ga9dbfed568d047a6cd05708f11fe39e99)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_var_byte_func_t func)` {#group__input__callback__reg_1ga9dbfed568d047a6cd05708f11fe39e99}
-
-キャッチオール受信コールバックを登録する。
-
-登録されている場合は、より具体的なコールバックあるいはフォールスルー受信コールバックが登録されている場合でも、一致する全てのメッセージに対してキャッチオール受信コールバックが呼ばれます。
-
-#### パラメータ
-* `device` 関連するデバイス
-
-* `func` 登録するコールバック関数
diff --git a/docs/ja/internals_midi_device.md b/docs/ja/internals_midi_device.md
deleted file mode 100644
index 6adc2d5ad9..0000000000
--- a/docs/ja/internals_midi_device.md
+++ /dev/null
@@ -1,148 +0,0 @@
-# `midi_device` グループ {#group__midi__device}
-
-<!---
- original document: 0.10.9:docs/internals_midi_device.md
- git diff 0.10.9 HEAD -- docs/internals_midi_device.md | cat
--->
-
-独自の MIDI デバイスを実装する時に、関数を使います。
-
-実際にデバイスを介してバイトを送信するために、送信関数を設定します。このメソッドは、このデバイスで例えば midi_send_cc のような送信関数を呼ぶ時に呼ばれます。
-
-midi_device_input を使ってデバイスからの入力データを処理し、それをデバイスに関連付けられたコールバックで渡します。
-
-デバイスのプロセス関数の最初に呼び出される関数が必要な場合、midi_device_set_pre_input_process_func を使います。通常、入力をポーリングして midi_device_input に渡します。
-
-## 概要
-
-メンバー | 説明
---------------------------------|---------------------------------------------
-`define `[`MIDI_INPUT_QUEUE_LENGTH`](#group__midi__device_1ga4aaa419caebdca2bbdfc1331e79781a8) |
-`enum `[`input_state_t`](#group__midi__device_1gac203e877d3df4275ceb8e7180a61f621) |
-`public void `[`midi_device_input`](#group__midi__device_1gad8d3db8eb35d9cfa51ef036a0a9d70db)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t cnt,uint8_t * input)` | 入力バイトを処理します。この関数はバイトを解析し、指定されたデバイスに関連する適切なコールバックを呼びます。この関数は、カスタムデバイスを作成していて、MIDI 入力が必要な場合に使います。
-`public void `[`midi_device_set_send_func`](#group__midi__device_1ga59f5a46bdd4452f186cc73d9e96d4673)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_var_byte_func_t send_func)` | 出力データバイトの送信に使われるコールバック関数を設定します。これは、カスタムデバイスを作成している場合のみ使われます。ロックを気にすることなく様々な MIDI 送信関数を呼び出すことができるように、コールバック関数で割り込みを無効にすることができます。
-`public void `[`midi_device_set_pre_input_process_func`](#group__midi__device_1ga4de0841b87c04fc23cb56b6451f33b69)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_no_byte_func_t pre_process_func)` | midi_device_process 呼び出しの最初に呼ばれるコールバックを設定します。これは入力データをポーリングし、midi_device_input 関数を介してデータを送信できます。カスタムデバイスを作成している場合のみ、これを使う可能性があります。
-`struct `[`_midi_device`](docs/api_midi_device.md#struct__midi__device) | この構造体は、MIDI デバイスの入出力関数と処理データを表します。
-
-## メンバー
-
-#### `define `[`MIDI_INPUT_QUEUE_LENGTH`](#group__midi__device_1ga4aaa419caebdca2bbdfc1331e79781a8) {#group__midi__device_1ga4aaa419caebdca2bbdfc1331e79781a8}
-
-#### `enum `[`input_state_t`](#group__midi__device_1gac203e877d3df4275ceb8e7180a61f621) {#group__midi__device_1gac203e877d3df4275ceb8e7180a61f621}
-
-値 | 説明
---------------------------------|---------------------------------------------
-IDLE |
-ONE_BYTE_MESSAGE |
-TWO_BYTE_MESSAGE |
-THREE_BYTE_MESSAGE |
-SYSEX_MESSAGE |
-
-#### `public void `[`midi_device_input`](#group__midi__device_1gad8d3db8eb35d9cfa51ef036a0a9d70db)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t cnt,uint8_t * input)` {#group__midi__device_1gad8d3db8eb35d9cfa51ef036a0a9d70db}
-
-入力バイトを処理します。この関数はバイトを解析し、指定されたデバイスに関連する適切なコールバックを呼びます。この関数は、カスタムデバイスを作成していて、MIDI 入力が必要な場合に使います。
-
-#### パラメータ
-* `device` 入力を関連付ける MIDI デバイス
-
-* `cnt` 処理中のバイト数
-
-* `input` 処理するバイトデータ
-
-#### `public void `[`midi_device_set_send_func`](#group__midi__device_1ga59f5a46bdd4452f186cc73d9e96d4673)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_var_byte_func_t send_func)` {#group__midi__device_1ga59f5a46bdd4452f186cc73d9e96d4673}
-
-出力データバイトの送信に使われるコールバック関数を設定します。これは、カスタムデバイスを作成している場合のみ使われます。ロックを気にすることなく様々な MIDI 送信関数を呼び出すことができるように、コールバック関数で割り込みを無効にすることができます。
-
-#### パラメータ
-* `device` このコールバックを関連付ける MIDI デバイス
-
-* `send_func` 送信を行うコールバック関数
-
-#### `public void `[`midi_device_set_pre_input_process_func`](#group__midi__device_1ga4de0841b87c04fc23cb56b6451f33b69)`(`[`MidiDevice`](#struct__midi__device)` * device,midi_no_byte_func_t pre_process_func)` {#group__midi__device_1ga4de0841b87c04fc23cb56b6451f33b69}
-
-midi_device_process 呼び出しの最初に呼ばれるコールバックを設定します。これは入力データをポーリングし、midi_device_input 関数を介してデータを送信できます。カスタムデバイスを作成している場合のみ、これを使う可能性があります。
-
-#### パラメータ
-* `device` このコールバックを関連付ける MIDI デバイス
-
-* `midi_no_byte_func_t` 実際のコールバック関数
-
-# `_midi_device` 構造体 {#struct__midi__device}
-
-この構造体は、MIDI デバイスの入出力関数と処理データを表します。
-
-デバイスは、実際の物理デバイス [シリアルポート、USB ポート]、または仮想デバイスを表すことができます。この構造体を直接変更する必要はありません。
-
-## 概要
-
-| メンバー | 説明
---------------------------------|---------------------------------------------
-`public midi_var_byte_func_t `[`send_func`](docs/api_midi_device.md#struct__midi__device_1a25d4c94b4bbccd5b98f1032b469f3ff9) |
-`public midi_three_byte_func_t `[`input_cc_callback`](docs/api_midi_device.md#struct__midi__device_1a6da5236c1bc73877728df92d213a78d1) |
-`public midi_three_byte_func_t `[`input_noteon_callback`](docs/api_midi_device.md#struct__midi__device_1aa10b15cf1a7fb825a5df0d2abbe34a1c) |
-`public midi_three_byte_func_t `[`input_noteoff_callback`](docs/api_midi_device.md#struct__midi__device_1aaf290043078534d3a5a0ea4c840eba84) |
-`public midi_three_byte_func_t `[`input_aftertouch_callback`](docs/api_midi_device.md#struct__midi__device_1acb0b4901c545cec4b28b126f2d8c315f) |
-`public midi_three_byte_func_t `[`input_pitchbend_callback`](docs/api_midi_device.md#struct__midi__device_1a305fea672caeb996f2233bf8cd2bef18) |
-`public midi_three_byte_func_t `[`input_songposition_callback`](docs/api_midi_device.md#struct__midi__device_1a5f3f13638b3fef3fc561ed1bf301d586) |
-`public midi_two_byte_func_t `[`input_progchange_callback`](docs/api_midi_device.md#struct__midi__device_1adaf1da617c9a10a9dcad00ab1959d3da) |
-`public midi_two_byte_func_t `[`input_chanpressure_callback`](docs/api_midi_device.md#struct__midi__device_1ab7ca2925c539915d43974eff604d85f7) |
-`public midi_two_byte_func_t `[`input_songselect_callback`](docs/api_midi_device.md#struct__midi__device_1a89bed8a5a55376120cfc0a62b42f057f) |
-`public midi_two_byte_func_t `[`input_tc_quarterframe_callback`](docs/api_midi_device.md#struct__midi__device_1ad9813e75d22e284f9f65a907d20600f0) |
-`public midi_one_byte_func_t `[`input_realtime_callback`](docs/api_midi_device.md#struct__midi__device_1a9448eba4afb7e43650434748db3777be) |
-`public midi_one_byte_func_t `[`input_tunerequest_callback`](docs/api_midi_device.md#struct__midi__device_1a0cb8fd53e00cf1d4202d4fa04d038e8d) |
-`public midi_sysex_func_t `[`input_sysex_callback`](docs/api_midi_device.md#struct__midi__device_1afff9a0ce641762aaef24c1e6953ec9a2) |
-`public midi_var_byte_func_t `[`input_fallthrough_callback`](docs/api_midi_device.md#struct__midi__device_1abb974ec6d734001b4a0e370f292be503) |
-`public midi_var_byte_func_t `[`input_catchall_callback`](docs/api_midi_device.md#struct__midi__device_1aae0d535129d4fd650edc98eb3f7584f8) |
-`public midi_no_byte_func_t `[`pre_input_process_callback`](docs/api_midi_device.md#struct__midi__device_1aeb0bb8923d66c23d874e177dc4265754) |
-`public uint8_t `[`input_buffer`](docs/api_midi_device.md#struct__midi__device_1a7c5684857d6af4ebc4dc12da27bd6b2a) |
-`public input_state_t `[`input_state`](docs/api_midi_device.md#struct__midi__device_1a69a687d2d1c449ec15a11c07a5722e39) |
-`public uint16_t `[`input_count`](docs/api_midi_device.md#struct__midi__device_1a68dea8e7b6151e89c85c95caa612ee5d) |
-`public uint8_t `[`input_queue_data`](docs/api_midi_device.md#struct__midi__device_1ada41de021135dc423abedcbb30f366ff) |
-`public `[`byteQueue_t`](#structbyte_queue__t)` `[`input_queue`](#struct__midi__device_1a49c8538a8a02193c58e28a56eb695d8f) |
-
-## メンバー
-
-#### `public midi_var_byte_func_t `[`send_func`](docs/api_midi_device.md#struct__midi__device_1a25d4c94b4bbccd5b98f1032b469f3ff9) {#struct__midi__device_1a25d4c94b4bbccd5b98f1032b469f3ff9}
-
-#### `public midi_three_byte_func_t `[`input_cc_callback`](docs/api_midi_device.md#struct__midi__device_1a6da5236c1bc73877728df92d213a78d1) {#struct__midi__device_1a6da5236c1bc73877728df92d213a78d1}
-
-#### `public midi_three_byte_func_t `[`input_noteon_callback`](docs/api_midi_device.md#struct__midi__device_1aa10b15cf1a7fb825a5df0d2abbe34a1c) {#struct__midi__device_1aa10b15cf1a7fb825a5df0d2abbe34a1c}
-
-#### `public midi_three_byte_func_t `[`input_noteoff_callback`](docs/api_midi_device.md#struct__midi__device_1aaf290043078534d3a5a0ea4c840eba84) {#struct__midi__device_1aaf290043078534d3a5a0ea4c840eba84}
-
-#### `public midi_three_byte_func_t `[`input_aftertouch_callback`](docs/api_midi_device.md#struct__midi__device_1acb0b4901c545cec4b28b126f2d8c315f) {#struct__midi__device_1acb0b4901c545cec4b28b126f2d8c315f}
-
-#### `public midi_three_byte_func_t `[`input_pitchbend_callback`](docs/api_midi_device.md#struct__midi__device_1a305fea672caeb996f2233bf8cd2bef18) {#struct__midi__device_1a305fea672caeb996f2233bf8cd2bef18}
-
-#### `public midi_three_byte_func_t `[`input_songposition_callback`](docs/api_midi_device.md#struct__midi__device_1a5f3f13638b3fef3fc561ed1bf301d586) {#struct__midi__device_1a5f3f13638b3fef3fc561ed1bf301d586}
-
-#### `public midi_two_byte_func_t `[`input_progchange_callback`](docs/api_midi_device.md#struct__midi__device_1adaf1da617c9a10a9dcad00ab1959d3da) {#struct__midi__device_1adaf1da617c9a10a9dcad00ab1959d3da}
-
-#### `public midi_two_byte_func_t `[`input_chanpressure_callback`](docs/api_midi_device.md#struct__midi__device_1ab7ca2925c539915d43974eff604d85f7) {#struct__midi__device_1ab7ca2925c539915d43974eff604d85f7}
-
-#### `public midi_two_byte_func_t `[`input_songselect_callback`](docs/api_midi_device.md#struct__midi__device_1a89bed8a5a55376120cfc0a62b42f057f) {#struct__midi__device_1a89bed8a5a55376120cfc0a62b42f057f}
-
-#### `public midi_two_byte_func_t `[`input_tc_quarterframe_callback`](docs/api_midi_device.md#struct__midi__device_1ad9813e75d22e284f9f65a907d20600f0) {#struct__midi__device_1ad9813e75d22e284f9f65a907d20600f0}
-
-#### `public midi_one_byte_func_t `[`input_realtime_callback`](docs/api_midi_device.md#struct__midi__device_1a9448eba4afb7e43650434748db3777be) {#struct__midi__device_1a9448eba4afb7e43650434748db3777be}
-
-#### `public midi_one_byte_func_t `[`input_tunerequest_callback`](docs/api_midi_device.md#struct__midi__device_1a0cb8fd53e00cf1d4202d4fa04d038e8d) {#struct__midi__device_1a0cb8fd53e00cf1d4202d4fa04d038e8d}
-
-#### `public midi_sysex_func_t `[`input_sysex_callback`](docs/api_midi_device.md#struct__midi__device_1afff9a0ce641762aaef24c1e6953ec9a2) {#struct__midi__device_1afff9a0ce641762aaef24c1e6953ec9a2}
-
-#### `public midi_var_byte_func_t `[`input_fallthrough_callback`](docs/api_midi_device.md#struct__midi__device_1abb974ec6d734001b4a0e370f292be503) {#struct__midi__device_1abb974ec6d734001b4a0e370f292be503}
-
-#### `public midi_var_byte_func_t `[`input_catchall_callback`](docs/api_midi_device.md#struct__midi__device_1aae0d535129d4fd650edc98eb3f7584f8) {#struct__midi__device_1aae0d535129d4fd650edc98eb3f7584f8}
-
-#### `public midi_no_byte_func_t `[`pre_input_process_callback`](docs/api_midi_device.md#struct__midi__device_1aeb0bb8923d66c23d874e177dc4265754) {#struct__midi__device_1aeb0bb8923d66c23d874e177dc4265754}
-
-#### `public uint8_t `[`input_buffer`](docs/api_midi_device.md#struct__midi__device_1a7c5684857d6af4ebc4dc12da27bd6b2a) {#struct__midi__device_1a7c5684857d6af4ebc4dc12da27bd6b2a}
-
-#### `public input_state_t `[`input_state`](docs/api_midi_device.md#struct__midi__device_1a69a687d2d1c449ec15a11c07a5722e39) {#struct__midi__device_1a69a687d2d1c449ec15a11c07a5722e39}
-
-#### `public uint16_t `[`input_count`](docs/api_midi_device.md#struct__midi__device_1a68dea8e7b6151e89c85c95caa612ee5d) {#struct__midi__device_1a68dea8e7b6151e89c85c95caa612ee5d}
-
-#### `public uint8_t `[`input_queue_data`](docs/api_midi_device.md#struct__midi__device_1ada41de021135dc423abedcbb30f366ff) {#struct__midi__device_1ada41de021135dc423abedcbb30f366ff}
-
-#### `public `[`byteQueue_t`](#structbyte_queue__t)` `[`input_queue`](#struct__midi__device_1a49c8538a8a02193c58e28a56eb695d8f) {#struct__midi__device_1a49c8538a8a02193c58e28a56eb695d8f}
-
diff --git a/docs/ja/internals_midi_device_setup_process.md b/docs/ja/internals_midi_device_setup_process.md
deleted file mode 100644
index 9806156452..0000000000
--- a/docs/ja/internals_midi_device_setup_process.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# `midi_device_setup_process` グループ {#group__midi__device__setup__process}
-
-<!---
- original document: 0.10.9:docs/internals_midi_device_setup_process.md
- git diff 0.10.9 HEAD -- docs/internals_midi_device_setup_process.md | cat
--->
-
-これらは、デバイスを初期化して実行するために使う必要があるメソッドです。
-
-## 概要
-
-メンバー | 説明
---------------------------------|---------------------------------------------
-`public void `[`midi_device_init`](#group__midi__device__setup__process_1gaf29deddc94ea98a59daa0bde1aefd9d9)`(`[`MidiDevice`](#struct__midi__device)` * device)` | デバイスを初期化します。
-`public void `[`midi_device_process`](#group__midi__device__setup__process_1gaa3d5993d0e998a1b59bbf5ab9c7b492b)`(`[`MidiDevice`](#struct__midi__device)` * device)` | 入力データを処理します。
-
-## メンバー
-
-#### `public void `[`midi_device_init`](#group__midi__device__setup__process_1gaf29deddc94ea98a59daa0bde1aefd9d9)`(`[`MidiDevice`](#struct__midi__device)` * device)` {#group__midi__device__setup__process_1gaf29deddc94ea98a59daa0bde1aefd9d9}
-
-デバイスを初期化します。
-
-問題のデバイスを使う前にこれを呼び出す必要があります。
-
-#### パラメータ
-* `device` 初期化するデバイス
-
-#### `public void `[`midi_device_process`](#group__midi__device__setup__process_1gaa3d5993d0e998a1b59bbf5ab9c7b492b)`(`[`MidiDevice`](#struct__midi__device)` * device)` {#group__midi__device__setup__process_1gaa3d5993d0e998a1b59bbf5ab9c7b492b}
-
-入力データを処理します。
-
-このメソッドは入力処理を駆動します。入力コールバックが呼び出されることが予想される場合は、このメソッドを頻繁に呼び出す必要があります。
-
-#### パラメータ
-* `device` 処理するデバイス
-
diff --git a/docs/ja/internals_midi_util.md b/docs/ja/internals_midi_util.md
deleted file mode 100644
index 5ff9870df9..0000000000
--- a/docs/ja/internals_midi_util.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# `midi_util` グループ {#group__midi__util}
-
-<!---
- original document: 0.10.9:docs/internals_midi_util.md
- git diff 0.10.9 HEAD -- docs/internals_midi_util.md | cat
--->
-
-## 概要
-
-| メンバー | 説明
---------------------------------|---------------------------------------------
-| `enum `[`midi_packet_length_t`](#group__midi__util_1gae29ff56aee2b430ffe53933b97e5e79e) | 可能なパケット長の値の列挙型。
-| `public bool `[`midi_is_statusbyte`](#group__midi__util_1ga12e3b42ff9cbb4b4f2bc455fc8743ee5)`(uint8_t theByte)` | 指定されたバイトがステータスバイトであるかどうかを検査します。
-| `public bool `[`midi_is_realtime`](#group__midi__util_1gad2f52c363e34a8000d80c983c324e2d7)`(uint8_t theByte)` | 指定されたバイトがリアルタイムメッセージであるかどうかを検査します。
-| `public `[`midi_packet_length_t`](#group__midi__util_1gae29ff56aee2b430ffe53933b97e5e79e)` `[`midi_packet_length`](#group__midi__util_1gaa168b43af6ae9de0debce1625e4b8175)`(uint8_t status)` | 指定されたステータスバイトに関連付けられたパケットの長さを調べます。
-
-## メンバー
-
-#### `enum `[`midi_packet_length_t`](#group__midi__util_1gae29ff56aee2b430ffe53933b97e5e79e) {#group__midi__util_1gae29ff56aee2b430ffe53933b97e5e79e}
-
-| 値 | 説明
---------------------------------|---------------------------------------------
-UNDEFINED |
-ONE |
-TWO |
-THREE |
-
-可能なパケット長の値の列挙型。
-
-#### `public bool `[`midi_is_statusbyte`](#group__midi__util_1ga12e3b42ff9cbb4b4f2bc455fc8743ee5)`(uint8_t theByte)` {#group__midi__util_1ga12e3b42ff9cbb4b4f2bc455fc8743ee5}
-
-指定されたバイトがステータスバイトであるかどうかを検査します。
-
-#### パラメータ
-* `theByte` 検査するバイト
-
-#### 返り値
-指定されたバイトが MIDI ステータスバイトの場合は true
-
-#### `public bool `[`midi_is_realtime`](#group__midi__util_1gad2f52c363e34a8000d80c983c324e2d7)`(uint8_t theByte)` {#group__midi__util_1gad2f52c363e34a8000d80c983c324e2d7}
-
-指定されたバイトがリアルタイムメッセージであるかどうかを検査します。
-
-#### パラメータ
-* `theByte` 検査するバイト
-
-#### 返り値
-リアルタイムメッセージの場合は true、それ以外の場合は false
-
-#### `public `[`midi_packet_length_t`](#group__midi__util_1gae29ff56aee2b430ffe53933b97e5e79e)` `[`midi_packet_length`](#group__midi__util_1gaa168b43af6ae9de0debce1625e4b8175)`(uint8_t status)` {#group__midi__util_1gaa168b43af6ae9de0debce1625e4b8175}
-
-指定されたステータスバイトに関連付けられたパケットの長さを調べます。
-
-#### パラメータ
-* `status` ステータスバイト
-
-#### 返り値
-パケットの長さ。バイトがステータスバイトではない場合、あるいは sysex ステータスバイトの場合は、UNDEFINED を返します。
-
diff --git a/docs/ja/internals_send_functions.md b/docs/ja/internals_send_functions.md
deleted file mode 100644
index 2747d3997f..0000000000
--- a/docs/ja/internals_send_functions.md
+++ /dev/null
@@ -1,246 +0,0 @@
-# `send_functions` グループ {#group__send__functions}
-
-<!---
- original document: 0.10.9:docs/internals_send_functions.md
- git diff 0.10.9 HEAD -- docs/internals_send_functions.md | cat
--->
-
-これらは、デバイスを介して MIDI データを送信するために使う関数です。
-
-## 概要
-
-メンバー | 説明
---------------------------------|---------------------------------------------
-`public void `[`midi_send_cc`](#group__send__functions_1gaaf884811c92df405ca8fe1a00082f960)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,uint8_t num,uint8_t val)` | 指定されたデバイスを介して、コントロールチェンジメッセージを送信します。
-`public void `[`midi_send_noteon`](#group__send__functions_1ga467bcf46dbf03ec269ce565b46bc2775)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,uint8_t num,uint8_t vel)` | 指定されたデバイスを介してノートオンメッセージを送信します。
-`public void `[`midi_send_noteoff`](#group__send__functions_1gaedb7d8805425eef5d47d57ddcb4c7a49)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,uint8_t num,uint8_t vel)` | 指定されたデバイスを介してノートオフメッセージを送信します。
-`public void `[`midi_send_aftertouch`](#group__send__functions_1ga0014847571317a0e34b2ef46a6bc584f)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,uint8_t note_num,uint8_t amt)` | 指定されたデバイスを介してアフタータッチメッセージを送信します。
-`public void `[`midi_send_pitchbend`](#group__send__functions_1gae5a4a1e71611e7534be80af9ce3d3491)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,int16_t amt)` | 指定されたデバイスを介してピッチベンドメッセージを送信します。
-`public void `[`midi_send_programchange`](#group__send__functions_1ga7b15588ef25e5e1ff09c2afc3151ce86)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,uint8_t num)` | 指定されたデバイスを介してプログラムチェンジメッセージを送信します。
-`public void `[`midi_send_channelpressure`](#group__send__functions_1gaf23e69fdf812e89c0036f51f88ab2e1b)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,uint8_t amt)` | 指定されたデバイスを介してチャンネルプレッシャーメッセージを送信します。
-`public void `[`midi_send_clock`](#group__send__functions_1ga4e1b11a7cdb0875f6e03ce7c79c581aa)`(`[`MidiDevice`](#struct__midi__device)` * device)` | 指定されたデバイスを介してクロックメッセージを送信します。
-`public void `[`midi_send_tick`](#group__send__functions_1ga2b43c7d433d940c5b907595aac947972)`(`[`MidiDevice`](#struct__midi__device)` * device)` | 指定されたデバイスを介してティックメッセージを送信します。
-`public void `[`midi_send_start`](#group__send__functions_1ga1569749a8d58ccc56789289d7c7245cc)`(`[`MidiDevice`](#struct__midi__device)` * device)` | 指定されたデバイスを介してスタートメッセージを送信します。
-`public void `[`midi_send_continue`](#group__send__functions_1gaed5dc29d754a27372e89ab8bc20ee120)`(`[`MidiDevice`](#struct__midi__device)` * device)` | 指定されたデバイスを介してコンティニューメッセージを送信します。
-`public void `[`midi_send_stop`](#group__send__functions_1ga026e1a620276cb653ac501aa0d12a988)`(`[`MidiDevice`](#struct__midi__device)` * device)` | 指定されたデバイスを介してストップメッセージを送信します。
-`public void `[`midi_send_activesense`](#group__send__functions_1ga9b6e4c6ce4719d2604187b325620db37)`(`[`MidiDevice`](#struct__midi__device)` * device)` | 指定されたデバイスを介してアクティブセンスメッセージを送信します。
-`public void `[`midi_send_reset`](#group__send__functions_1ga3671e39a6d93ca9568fc493001af1b1b)`(`[`MidiDevice`](#struct__midi__device)` * device)` | 指定されたデバイスを介してリセットメッセージを送信します。
-`public void `[`midi_send_tcquarterframe`](#group__send__functions_1ga5b85639910eec280bb744c934d0fd45a)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t time)` | 指定されたデバイスを介してタイムコードクォータフレームメッセージを送信します。
-`public void `[`midi_send_songposition`](#group__send__functions_1gab1c9eeef3b57a8cd2e6128d18e85eb7f)`(`[`MidiDevice`](#struct__midi__device)` * device,uint16_t pos)` | 指定されたデバイスを介してソングポジションメッセージを送信します。
-`public void `[`midi_send_songselect`](#group__send__functions_1ga42de7838ba70d949af9a50f9facc3c50)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t song)` | 指定されたデバイスを介してソングセレクトメッセージを送信します。
-`public void `[`midi_send_tunerequest`](#group__send__functions_1ga8db6c7e04d48e4d2266dd59118ca0656)`(`[`MidiDevice`](#struct__midi__device)` * device)` | 指定されたデバイスを介してチューンリクエストメッセージを送信します。
-`public void `[`midi_send_byte`](#group__send__functions_1ga857e85eb90b288385642d4d991e09881)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t b)` | 指定されたデバイスを介してバイトを送信します。
-`public void `[`midi_send_data`](#group__send__functions_1ga36e2f2e45369d911b76969361679054b)`(`[`MidiDevice`](#struct__midi__device)` * device,uint16_t count,uint8_t byte0,uint8_t byte1,uint8_t byte2)` | 最大3バイトのデータを送信します。
-`public void `[`midi_send_array`](#group__send__functions_1ga245243cb1da18d2cea18d4b18d846ead)`(`[`MidiDevice`](#struct__midi__device)` * device,uint16_t count,uint8_t * array)` | フォーマットされた MIDI データの配列を送信します。
-
-## メンバー
-
-#### `public void `[`midi_send_cc`](#group__send__functions_1gaaf884811c92df405ca8fe1a00082f960)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,uint8_t num,uint8_t val)` {#group__send__functions_1gaaf884811c92df405ca8fe1a00082f960}
-
-指定されたデバイスを介して、コントロールチェンジメッセージ(cc)を送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-* `chan` 送信するチャンネル、0-15
-
-* `num` コントロールチェンジナンバー
-
-* `val` コントロールチェンジナンバーの値
-
-#### `public void `[`midi_send_noteon`](#group__send__functions_1ga467bcf46dbf03ec269ce565b46bc2775)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,uint8_t num,uint8_t vel)` {#group__send__functions_1ga467bcf46dbf03ec269ce565b46bc2775}
-
-指定されたデバイスを介してノートオンメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-* `chan` 送信するチャンネル、0-15
-
-* `num` ノート番号
-
-* `vel` ノートベロシティ
-
-#### `public void `[`midi_send_noteoff`](#group__send__functions_1gaedb7d8805425eef5d47d57ddcb4c7a49)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,uint8_t num,uint8_t vel)` {#group__send__functions_1gaedb7d8805425eef5d47d57ddcb4c7a49}
-
-指定されたデバイスを介してノートオフメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-* `chan` 送信するチャンネル、0-15
-
-* `num` ノート番号
-
-* `vel` ノートベロシティ
-
-#### `public void `[`midi_send_aftertouch`](#group__send__functions_1ga0014847571317a0e34b2ef46a6bc584f)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,uint8_t note_num,uint8_t amt)` {#group__send__functions_1ga0014847571317a0e34b2ef46a6bc584f}
-
-指定されたデバイスを介してアフタータッチメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-* `chan` 送信するチャンネル、0-15
-
-* `note_num` ノート番号
-
-* `amt` アフタータッチ量
-
-#### `public void `[`midi_send_pitchbend`](#group__send__functions_1gae5a4a1e71611e7534be80af9ce3d3491)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,int16_t amt)` {#group__send__functions_1gae5a4a1e71611e7534be80af9ce3d3491}
-
-指定されたデバイスを介してピッチベンドメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-* `chan` 送信するチャンネル、0-15
-
-* `amt` ベンド量の範囲: -8192..8191、0 はベンドしないことを意味します
-
-#### `public void `[`midi_send_programchange`](#group__send__functions_1ga7b15588ef25e5e1ff09c2afc3151ce86)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,uint8_t num)` {#group__send__functions_1ga7b15588ef25e5e1ff09c2afc3151ce86}
-
-指定されたデバイスを介してプログラムチェンジメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-* `chan` 送信するチャンネル、0-15
-
-* `num` 変更先のプログラム
-
-#### `public void `[`midi_send_channelpressure`](#group__send__functions_1gaf23e69fdf812e89c0036f51f88ab2e1b)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t chan,uint8_t amt)` {#group__send__functions_1gaf23e69fdf812e89c0036f51f88ab2e1b}
-
-指定されたデバイスを介してチャンネルプレッシャーメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-* `chan` 送信するチャンネル、0-15
-
-* `amt` チャンネルプレッシャーの量
-
-#### `public void `[`midi_send_clock`](#group__send__functions_1ga4e1b11a7cdb0875f6e03ce7c79c581aa)`(`[`MidiDevice`](#struct__midi__device)` * device)` {#group__send__functions_1ga4e1b11a7cdb0875f6e03ce7c79c581aa}
-
-指定されたデバイスを介してクロックメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-#### `public void `[`midi_send_tick`](#group__send__functions_1ga2b43c7d433d940c5b907595aac947972)`(`[`MidiDevice`](#struct__midi__device)` * device)` {#group__send__functions_1ga2b43c7d433d940c5b907595aac947972}
-
-指定されたデバイスを介してティックメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-#### `public void `[`midi_send_start`](#group__send__functions_1ga1569749a8d58ccc56789289d7c7245cc)`(`[`MidiDevice`](#struct__midi__device)` * device)` {#group__send__functions_1ga1569749a8d58ccc56789289d7c7245cc}
-
-指定されたデバイスを介してスタートメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-#### `public void `[`midi_send_continue`](#group__send__functions_1gaed5dc29d754a27372e89ab8bc20ee120)`(`[`MidiDevice`](#struct__midi__device)` * device)` {#group__send__functions_1gaed5dc29d754a27372e89ab8bc20ee120}
-
-指定されたデバイスを介してコンティニューメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-#### `public void `[`midi_send_stop`](#group__send__functions_1ga026e1a620276cb653ac501aa0d12a988)`(`[`MidiDevice`](#struct__midi__device)` * device)` {#group__send__functions_1ga026e1a620276cb653ac501aa0d12a988}
-
-指定されたデバイスを介してストップメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-#### `public void `[`midi_send_activesense`](#group__send__functions_1ga9b6e4c6ce4719d2604187b325620db37)`(`[`MidiDevice`](#struct__midi__device)` * device)` {#group__send__functions_1ga9b6e4c6ce4719d2604187b325620db37}
-
-指定されたデバイスを介してアクティブセンスメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-#### `public void `[`midi_send_reset`](#group__send__functions_1ga3671e39a6d93ca9568fc493001af1b1b)`(`[`MidiDevice`](#struct__midi__device)` * device)` {#group__send__functions_1ga3671e39a6d93ca9568fc493001af1b1b}
-
-指定されたデバイスを介してリセットメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-#### `public void `[`midi_send_tcquarterframe`](#group__send__functions_1ga5b85639910eec280bb744c934d0fd45a)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t time)` {#group__send__functions_1ga5b85639910eec280bb744c934d0fd45a}
-
-指定されたデバイスを介してタイムコードクォータフレームメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-* `time` このクォータフレームの時間。範囲は、0..16383
-
-#### `public void `[`midi_send_songposition`](#group__send__functions_1gab1c9eeef3b57a8cd2e6128d18e85eb7f)`(`[`MidiDevice`](#struct__midi__device)` * device,uint16_t pos)` {#group__send__functions_1gab1c9eeef3b57a8cd2e6128d18e85eb7f}
-
-指定されたデバイスを介してソングポジションメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-* `pos` ソングポジション
-
-#### `public void `[`midi_send_songselect`](#group__send__functions_1ga42de7838ba70d949af9a50f9facc3c50)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t song)` {#group__send__functions_1ga42de7838ba70d949af9a50f9facc3c50}
-
-指定されたデバイスを介してソングセレクトメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-* `song` 選択するソング
-
-#### `public void `[`midi_send_tunerequest`](#group__send__functions_1ga8db6c7e04d48e4d2266dd59118ca0656)`(`[`MidiDevice`](#struct__midi__device)` * device)` {#group__send__functions_1ga8db6c7e04d48e4d2266dd59118ca0656}
-
-指定されたデバイスを介してチューンリクエストメッセージを送信します。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-#### `public void `[`midi_send_byte`](#group__send__functions_1ga857e85eb90b288385642d4d991e09881)`(`[`MidiDevice`](#struct__midi__device)` * device,uint8_t b)` {#group__send__functions_1ga857e85eb90b288385642d4d991e09881}
-
-指定されたデバイスを介してバイトを送信します。
-
-これは、指定された MIDI デバイスを介してデータを送信する一般的なメソッドです。これは、この API に実装されていない sysex データまたはメッセージがある場合、それらを送信するのに役立ちます。そのようなものを見つけた場合は、私たちがそれらを追加できるように、作者に連絡してください。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-* `b` 送信するバイト
-
-#### `public void `[`midi_send_data`](#group__send__functions_1ga36e2f2e45369d911b76969361679054b)`(`[`MidiDevice`](#struct__midi__device)` * device,uint16_t count,uint8_t byte0,uint8_t byte1,uint8_t byte2)` {#group__send__functions_1ga36e2f2e45369d911b76969361679054b}
-
-最大3バイトのデータを送信します。
-
-これを使って sysex を通過できるように count に4の剰余が適用されます。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-* `count` 送信するバイト数、4の剰余が適用されます
-
-* `byte0` 最初のバイト
-
-* `byte1` 2番目のバイト。cnt % 4 != 2 の場合は無視されます
-
-* `byte2` 3番目のバイト。cnt % 4 != 3 の場合は無視されます
-
-#### `public void `[`midi_send_array`](#group__send__functions_1ga245243cb1da18d2cea18d4b18d846ead)`(`[`MidiDevice`](#struct__midi__device)` * device,uint16_t count,uint8_t * array)` {#group__send__functions_1ga245243cb1da18d2cea18d4b18d846ead}
-
-フォーマットされた MIDI データの配列を送信します。
-
-sysex に使うことができます。
-
-#### パラメータ
-* `device` 送信に使うデバイス
-
-* `count` 送信するバイト数
-
-* `array` バイトの配列
-
diff --git a/docs/ja/internals_sysex_tools.md b/docs/ja/internals_sysex_tools.md
deleted file mode 100644
index 629b4f2445..0000000000
--- a/docs/ja/internals_sysex_tools.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# `sysex_tools` グループ {#group__sysex__tools}
-
-<!---
- original document: 0.10.9:docs/internals_sysex_tools.md
- git diff 0.10.9 HEAD -- docs/internals_sysex_tools.md | cat
--->
-
-## 概要
-
-| メンバー | 説明
---------------------------------|---------------------------------------------
-| `public uint16_t `[`sysex_encoded_length`](#group__sysex__tools_1ga061e5607030412d6e62e2390d8013f0a)`(uint16_t decoded_length)` | エンコード後のメッセージの長さを計算します。
-| `public uint16_t `[`sysex_decoded_length`](#group__sysex__tools_1ga121fc227d3acc1c0ea08c9a5c26fa3b0)`(uint16_t encoded_length)` | デコード後のメッセージの長さを計算します。
-| `public uint16_t `[`sysex_encode`](#group__sysex__tools_1ga54d77f8d32f92a6f329daefa2b314742)`(uint8_t * encoded,const uint8_t * source,uint16_t length)` | sysex メッセージで安全に送信できるようにデータをエンコードします。
-| `public uint16_t `[`sysex_decode`](#group__sysex__tools_1gaaad1d9ba2d5eca709a0ab4ba40662229)`(uint8_t * decoded,const uint8_t * source,uint16_t length)` | エンコードされたデータをデコードします。
-
-## メンバー
-
-#### `public uint16_t `[`sysex_encoded_length`](#group__sysex__tools_1ga061e5607030412d6e62e2390d8013f0a)`(uint16_t decoded_length)` {#group__sysex__tools_1ga061e5607030412d6e62e2390d8013f0a}
-
-エンコード後のメッセージの長さを計算します。
-
-#### パラメータ
-* `decoded_length` エンコードするメッセージの長さのバイト数。
-
-#### 返り値
-エンコード後のメッセージの長さのバイト数。
-
-#### `public uint16_t `[`sysex_decoded_length`](#group__sysex__tools_1ga121fc227d3acc1c0ea08c9a5c26fa3b0)`(uint16_t encoded_length)` {#group__sysex__tools_1ga121fc227d3acc1c0ea08c9a5c26fa3b0}
-
-デコード後のメッセージの長さを計算します。
-
-#### パラメータ
-* `encoded_length` エンコードされたメッセージの長さのバイト数。
-
-#### 返り値
-デコードされた後のメッセージの長さのバイト数。
-
-#### `public uint16_t `[`sysex_encode`](#group__sysex__tools_1ga54d77f8d32f92a6f329daefa2b314742)`(uint8_t * encoded,const uint8_t * source,uint16_t length)` {#group__sysex__tools_1ga54d77f8d32f92a6f329daefa2b314742}
-
-sysex メッセージで安全に送信できるようにデータをエンコードします。
-
-#### パラメータ
-* `encoded` 出力データバッファは、少なくとも sysex_encoded_length(length) バイトの長さが必要です。
-
-* `source` エンコードされるデータの入力バッファ。
-
-* `length` 入力バッファからエンコードするバイト数。
-
-#### 返り値
-エンコードされたバイト数。
-
-#### `public uint16_t `[`sysex_decode`](#group__sysex__tools_1gaaad1d9ba2d5eca709a0ab4ba40662229)`(uint8_t * decoded,const uint8_t * source,uint16_t length)` {#group__sysex__tools_1gaaad1d9ba2d5eca709a0ab4ba40662229}
-
-エンコードされたデータをデコードします。
-
-#### パラメータ
-* `decoded` 出力データバッファは、少なくとも sysex_decoded_length(length) バイトの長さが必要です。
-
-* `source` デコードされるデータの入力バッファ。
-
-* `length` 入力バッファからデコードするバイト数。
-
-#### 返り値
-デコードされたバイト数。
-
diff --git a/docs/ja/proton_c_conversion.md b/docs/ja/proton_c_conversion.md
index 983aed4ee5..8f0c857cba 100644
--- a/docs/ja/proton_c_conversion.md
+++ b/docs/ja/proton_c_conversion.md
@@ -27,7 +27,7 @@ QMK で現在サポートされているキーボードが Pro Micro(または
#endif
```
-`PORTB/DDRB` などが定義されていないというエラーが発生した場合は、ARM と AVR の両方で機能する [GPIO 制御](ja/internals_gpio_control.md) を使用するようにキーボードのコードを変換する必要があります。これは AVR ビルドにまったく影響を与えません。
+`PORTB/DDRB` などが定義されていないというエラーが発生した場合は、ARM と AVR の両方で機能する [GPIO 制御](ja/gpio_control.md) を使用するようにキーボードのコードを変換する必要があります。これは AVR ビルドにまったく影響を与えません。
Proton C には1つのオンボード LED(C13)しかなく、デフォルトでは TXLED(D5) がそれにマップされています。代わりに RXLED(B0) をそれにマッピングしたい場合は、`config.h` に次のように追加してください。
diff --git a/docs/keycodes.md b/docs/keycodes.md
index 58ce43d309..bd5af32dd3 100644
--- a/docs/keycodes.md
+++ b/docs/keycodes.md
@@ -219,11 +219,13 @@ See also: [Basic Keycodes](keycodes_basic.md)
See also: [Quantum Keycodes](quantum_keycodes.md#qmk-keycodes)
-|Key |Aliases |Description |
-|-----------------|---------|-------------------------------------------------------|
-|`QK_BOOTLOADER` |`QK_BOOT`|Put the keyboard into bootloader mode for flashing |
-|`QK_DEBUG_TOGGLE`|`DB_TOGG`|Toggle debug mode |
-|`QK_CLEAR_EEPROM`|`EE_CLR` |Reinitializes the keyboard's EEPROM (persistent memory)|
+|Key |Aliases |Description |
+|-----------------|---------|---------------------------------------------------------------------------------|
+|`QK_BOOTLOADER` |`QK_BOOT`|Put the keyboard into bootloader mode for flashing |
+|`QK_DEBUG_TOGGLE`|`DB_TOGG`|Toggle debug mode |
+|`QK_CLEAR_EEPROM`|`EE_CLR` |Reinitializes the keyboard's EEPROM (persistent memory) |
+|`QK_MAKE` | |Sends `qmk compile -kb (keyboard) -km (keymap)`, or `qmk flash` if shift is held |
+|`QK_REBOOT` |`QK_RBT` |Resets the keyboard. Does not load the bootloader |
## Audio Keys :id=audio-keys
@@ -267,6 +269,14 @@ See also: [Bluetooth](feature_bluetooth.md)
|`OUT_USB` |USB only |
|`OUT_BT` |Bluetooth only |
+## Caps Word :id=caps-word
+
+See also: [Caps Word](feature_caps_word.md)
+
+|Key |Aliases |Description |
+|-----------|---------|------------------------------|
+|`CAPS_WORD`|`CAPSWRD`|Toggles Caps Word |
+
## Dynamic Macros :id=dynamic-macros
See also: [Dynamic Macros](feature_dynamic_macros.md)
diff --git a/docs/proton_c_conversion.md b/docs/proton_c_conversion.md
index 47511e1b1e..1e1b1e806d 100644
--- a/docs/proton_c_conversion.md
+++ b/docs/proton_c_conversion.md
@@ -20,7 +20,7 @@ This exposes the `CONVERT_TO_PROTON_C` flag that you can use in your code with `
#endif
```
-If you get errors about `PORTB/DDRB`, etc not being defined, so you'll need to convert the keyboard's code to use the [GPIO Controls](internals_gpio_control.md) that will work for both ARM and AVR. This shouldn't affect the AVR builds at all.
+If you get errors about `PORTB/DDRB`, etc not being defined, so you'll need to convert the keyboard's code to use the [GPIO Controls](gpio_control.md) that will work for both ARM and AVR. This shouldn't affect the AVR builds at all.
The Proton C only has one on-board LED (C13), and by default, the TXLED (D5) is mapped to it. If you want the RXLED (B0) mapped to it instead, add this like to your `config.h`:
diff --git a/docs/quantum_keycodes.md b/docs/quantum_keycodes.md
index 8e29e05886..a1923777ef 100644
--- a/docs/quantum_keycodes.md
+++ b/docs/quantum_keycodes.md
@@ -8,8 +8,10 @@ On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are
## QMK Keycodes :id=qmk-keycodes
-|Key |Aliases |Description |
-|-----------------|---------|-------------------------------------------------------|
-|`QK_BOOTLOADER` |`QK_BOOT`|Put the keyboard into bootloader mode for flashing |
-|`QK_DEBUG_TOGGLE`|`DB_TOGG`|Toggle debug mode |
-|`QK_CLEAR_EEPROM`|`EE_CLR` |Reinitializes the keyboard's EEPROM (persistent memory)|
+|Key |Aliases |Description |
+|-----------------|---------|---------------------------------------------------------------------------------|
+|`QK_BOOTLOADER` |`QK_BOOT`|Put the keyboard into bootloader mode for flashing |
+|`QK_DEBUG_TOGGLE`|`DB_TOGG`|Toggle debug mode |
+|`QK_CLEAR_EEPROM`|`EE_CLR` |Reinitializes the keyboard's EEPROM (persistent memory) |
+|`QK_MAKE` | |Sends `qmk compile -kb (keyboard) -km (keymap)`, or `qmk flash` if shift is held |
+|`QK_REBOOT` |`QK_RBT` |Resets the keyboard. Does not load the bootloader |
diff --git a/docs/quantum_painter.md b/docs/quantum_painter.md
new file mode 100644
index 0000000000..a3705b62ce
--- /dev/null
+++ b/docs/quantum_painter.md
@@ -0,0 +1,705 @@
+# Quantum Painter :id=quantum-painter
+
+Quantum Painter is the standardised API for graphical displays. It currently includes support for basic drawing primitives, as well as custom images, animations, and fonts.
+
+Due to the complexity, there is no support for Quantum Painter on AVR-based boards.
+
+To enable overall Quantum Painter to be built into your firmware, add the following to `rules.mk`:
+
+```make
+QUANTUM_PAINTER_ENABLE = yes
+QUANTUM_PAINTER_DRIVERS = ......
+```
+
+You will also likely need to select an appropriate driver in `rules.mk`, which is listed below.
+
+!> Quantum Painter is not currently integrated with system-level operations such as disabling displays after a configurable timeout, or when the keyboard goes into suspend. Users will need to handle this manually at the current time.
+
+The QMK CLI can be used to convert from normal images such as PNG files or animated GIFs, as well as fonts from TTF files.
+
+Hardware supported:
+
+| Display Panel | Panel Type | Size | Comms Transport | Driver |
+|---------------|--------------------|------------------|-----------------|-----------------------------------------|
+| GC9A01 | RGB LCD (circular) | 240x240 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS = gc9a01_spi` |
+| ILI9163 | RGB LCD | 128x128 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS = ili9163_spi` |
+| ILI9341 | RGB LCD | 240x320 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS = ili9341_spi` |
+| SSD1351 | RGB OLED | 128x128 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS = ssd1351_spi` |
+| ST7789 | RGB LCD | 240x320, 240x240 | SPI + D/C + RST | `QUANTUM_PAINTER_DRIVERS = st7789_spi` |
+
+## Quantum Painter Configuration :id=quantum-painter-config
+
+| Option | Default | Purpose |
+|-----------------------------------------|---------|---------------------------------------------------------------------------------------------------------------------------------------------|
+| `QUANTUM_PAINTER_NUM_IMAGES` | `8` | The maximum number of images/animations that can be loaded at any one time. |
+| `QUANTUM_PAINTER_NUM_FONTS` | `4` | The maximum number of fonts that can be loaded at any one time. |
+| `QUANTUM_PAINTER_CONCURRENT_ANIMATIONS` | `4` | The maximum number of animations that can be executed at the same time. |
+| `QUANTUM_PAINTER_LOAD_FONTS_TO_RAM` | `FALSE` | Whether or not fonts should be loaded to RAM. Relevant for fonts stored in off-chip persistent storage, such as external flash. |
+| `QUANTUM_PAINTER_PIXDATA_BUFFER_SIZE` | `32` | The limit of the amount of pixel data that can be transmitted in one transaction to the display. Higher values require more RAM on the MCU. |
+| `QUANTUM_PAINTER_SUPPORTS_256_PALETTE` | `FALSE` | If 256-color palettes are supported. Requires significantly more RAM on the MCU. |
+| `QUANTUM_PAINTER_DEBUG` | _unset_ | Prints out significant amounts of debugging information to CONSOLE output. Significant performance degradation, use only for debugging. |
+
+Drivers have their own set of configurable options, and are described in their respective sections.
+
+## Quantum Painter CLI Commands :id=quantum-painter-cli
+
+### `qmk painter-convert-graphics`
+
+This command converts images to a format usable by QMK, i.e. the QGF File Format.
+
+**Usage**:
+
+```
+usage: qmk painter-convert-graphics [-h] [-d] [-r] -f FORMAT [-o OUTPUT] -i INPUT [-v]
+
+optional arguments:
+ -h, --help show this help message and exit
+ -d, --no-deltas Disables the use of delta frames when encoding animations.
+ -r, --no-rle Disables the use of RLE when encoding images.
+ -f FORMAT, --format FORMAT
+ Output format, valid types: pal256, pal16, pal4, pal2, mono256, mono16, mono4, mono2
+ -o OUTPUT, --output OUTPUT
+ Specify output directory. Defaults to same directory as input.
+ -i INPUT, --input INPUT
+ Specify input graphic file.
+ -v, --verbose Turns on verbose output.
+```
+
+The `INPUT` argument can be any image file loadable by Python's Pillow module. Common formats include PNG, or Animated GIF.
+
+The `OUTPUT` argument needs to be a directory, and will default to the same directory as the input argument.
+
+The `FORMAT` argument can be any of the following:
+
+| Format | Meaning |
+|-----------|-----------------------------------------------------------------------|
+| `pal256` | 256-color palette (requires `QUANTUM_PAINTER_SUPPORTS_256_PALETTE`) |
+| `pal16` | 16-color palette |
+| `pal4` | 4-color palette |
+| `pal2` | 2-color palette |
+| `mono256` | 256-shade grayscale (requires `QUANTUM_PAINTER_SUPPORTS_256_PALETTE`) |
+| `mono16` | 16-shade grayscale |
+| `mono4` | 4-shade grayscale |
+| `mono2` | 2-shade grayscale |
+
+**Examples**:
+
+```
+$ cd /home/qmk/qmk_firmware/keyboards/my_keeb
+$ qmk painter-convert-graphics -f mono16 -i my_image.gif -o ./generated/
+Writing /home/qmk/qmk_firmware/keyboards/my_keeb/generated/my_image.qgf.h...
+Writing /home/qmk/qmk_firmware/keyboards/my_keeb/generated/my_image.qgf.c...
+```
+
+### `qmk painter-make-font-image`
+
+This command converts a TTF font to an intermediate format for editing, before converting to the QFF File Format.
+
+**Usage**:
+
+```
+usage: qmk painter-make-font-image [-h] [-a] [-u UNICODE_GLYPHS] [-n] [-s SIZE] -o OUTPUT -f FONT
+
+optional arguments:
+ -h, --help show this help message and exit
+ -a, --no-aa Disable anti-aliasing on fonts.
+ -u UNICODE_GLYPHS, --unicode-glyphs UNICODE_GLYPHS
+ Also generate the specified unicode glyphs.
+ -n, --no-ascii Disables output of the full ASCII character set (0x20..0x7E), exporting only the glyphs specified.
+ -s SIZE, --size SIZE Specify font size. Default 12.
+ -o OUTPUT, --output OUTPUT
+ Specify output image path.
+ -f FONT, --font FONT Specify input font file.
+```
+
+The `FONT` argument is generally a TrueType Font file (TTF).
+
+The `OUTPUT` argument is the output image to generate, generally something like `my_font.png`.
+
+The `UNICODE_GLYPHS` argument allows for specifying extra unicode glyphs to generate, and accepts a string.
+
+**Examples**:
+
+```
+$ qmk painter-make-font-image --font NotoSans-ExtraCondensedBold.ttf --size 11 -o noto11.png --unicode-glyphs "ĄȽɂɻɣɈʣ"
+```
+
+### `qmk painter-convert-font-image`
+
+This command converts an intermediate font image to the QFF File Format.
+
+This command expects an image that conforms to the following format:
+
+* Top-left pixel (at `0,0`) is the "delimiter" color:
+ * Each glyph in the font starts when a pixel of this color is found on the first row
+ * The first row is discarded when converting to the QFF format
+* The number of delimited glyphs must match the supplied arguments to the command:
+ * The full ASCII set `0x20..0x7E` (if `--no-ascii` was not specified)
+ * The corresponding number of unicode glyphs if any were specified with `--unicode-glyphs`
+* The order of the glyphs matches the ASCII set, if any, followed by the Unicode glyph set, if any.
+
+**Usage**:
+
+```
+usage: qmk painter-convert-font-image [-h] [-r] -f FORMAT [-u UNICODE_GLYPHS] [-n] [-o OUTPUT] [-i INPUT]
+
+optional arguments:
+ -h, --help show this help message and exit
+ -r, --no-rle Disable the use of RLE to minimise converted image size.
+ -f FORMAT, --format FORMAT
+ Output format, valid types: pal256, pal16, pal4, pal2, mono256, mono16, mono4, mono2
+ -u UNICODE_GLYPHS, --unicode-glyphs UNICODE_GLYPHS
+ Also generate the specified unicode glyphs.
+ -n, --no-ascii Disables output of the full ASCII character set (0x20..0x7E), exporting only the glyphs specified.
+ -o OUTPUT, --output OUTPUT
+ Specify output directory. Defaults to same directory as input.
+ -i INPUT, --input INPUT
+ Specify input graphic file.
+```
+
+The same arguments for `--no-ascii` and `--unicode-glyphs` need to be specified, as per `qmk painter-make-font-image`.
+
+**Examples**:
+
+```
+$ cd /home/qmk/qmk_firmware/keyboards/my_keeb
+$ qmk painter-convert-font-image --input noto11.png -f mono4 --unicode-glyphs "ĄȽɂɻɣɈʣ"
+Writing /home/qmk/qmk_firmware/keyboards/my_keeb/generated/noto11.qff.h...
+Writing /home/qmk/qmk_firmware/keyboards/my_keeb/generated/noto11.qff.c...
+```
+
+## Quantum Painter Drawing API :id=quantum-painter-api
+
+All APIs require a `painter_device_t` object as their first parameter -- this object comes from the specific device initialisation, and instructions on creating it can be found in each driver's respective section.
+
+To use any of the APIs, you need to include `qp.h`:
+```c
+#include <qp.h>
+```
+
+### General Notes :id=quantum-painter-api-general
+
+The coordinate system used in Quantum Painter generally accepts `left`, `top`, `right`, and `bottom` instead of x/y/width/height, and each coordinate is inclusive of where pixels should be drawn. This is required as some datatypes used by display panels have a maximum value of `255` -- for any value or geometry extent that matches `256`, this would be represented as a `0`, instead.
+
+?> Drawing a horizontal line 8 pixels long, starting from 4 pixels inside the left side of the display, will need `left=4`, `right=11`.
+
+All color data matches the standard QMK HSV triplet definitions:
+
+* Hue is of the range `0...255` and is internally mapped to 0...360 degrees.
+* Saturation is of the range `0...255` and is internally mapped to 0...100% saturation.
+* Value is of the range `0...255` and is internally mapped to 0...100% brightness.
+
+?> Colors used in Quantum Painter are not subject to the RGB lighting CIE curve, if it is enabled.
+
+### Device Control :id=quantum-painter-api-device-control
+
+#### Display Initialisation :id=quantum-painter-api-init
+
+```c
+bool qp_init(painter_device_t device, painter_rotation_t rotation);
+```
+
+The `qp_init` function is used to initialise a display device after it has been created. This accepts a rotation parameter (`QP_ROTATION_0`, `QP_ROTATION_90`, `QP_ROTATION_180`, `QP_ROTATION_270`), which makes sure that the orientation of what's drawn on the display is correct.
+
+```c
+static painter_device_t display;
+void keyboard_post_init_kb(void) {
+ display = qp_make_.......; // Create the display
+ qp_init(display, QP_ROTATION_0); // Initialise the display
+}
+```
+
+#### Display Power :id=quantum-painter-api-power
+
+```c
+bool qp_power(painter_device_t device, bool power_on);
+```
+
+The `qp_power` function instructs the display whether or not the display panel should be on or off.
+
+!> If there is a separate backlight controlled through the normal QMK backlight API, this is not controlled by the `qp_power` function and needs to be manually handled elsewhere.
+
+```c
+static uint8_t last_backlight = 255;
+void suspend_power_down_user(void) {
+ if (last_backlight == 255) {
+ last_backlight = get_backlight_level();
+ }
+ backlight_set(0);
+ rgb_matrix_set_suspend_state(true);
+ qp_power(display, false);
+}
+
+void suspend_wakeup_init_user(void) {
+ qp_power(display, true);
+ rgb_matrix_set_suspend_state(false);
+ if (last_backlight != 255) {
+ backlight_set(last_backlight);
+ }
+ last_backlight = 255;
+}
+```
+
+#### Display Clear :id=quantum-painter-api-clear
+
+```c
+bool qp_clear(painter_device_t device);
+```
+
+The `qp_clear` function clears the display's screen.
+
+#### Display Flush :id=quantum-painter-api-flush
+
+```c
+bool qp_flush(painter_device_t device);
+```
+
+The `qp_flush` function ensures that all drawing operations are "pushed" to the display. This should be done as the last operation whenever a sequence of draws occur, and guarantees that any changes are applied.
+
+!> Some display panels may seem to work even without a call to `qp_flush` -- this may be because the driver cannot queue drawing operations and needs to display them immediately when invoked. In general, calling `qp_flush` at the end is still considered "best practice".
+
+```c
+void housekeeping_task_user(void) {
+ static uint32_t last_draw = 0;
+ if (timer_elapsed32(last_draw) > 33) { // Throttle to 30fps
+ last_draw = timer_read32();
+ // Draw a rect based off the current RGB color
+ qp_rect(display, 0, 7, 0, 239, rgb_matrix_get_hue(), 255, 255);
+ qp_flush(display);
+ }
+}
+```
+
+### Drawing Primitives :id=quantum-painter-api-primitives
+
+#### Set Pixel :id=quantum-painter-api-setpixel
+
+```c
+bool qp_setpixel(painter_device_t device, uint16_t x, uint16_t y, uint8_t hue, uint8_t sat, uint8_t val);
+```
+
+The `qp_setpixel` can be used to set a specific pixel on the screen to the supplied color.
+
+?> Using `qp_setpixel` for large amounts of drawing operations is inefficient and should be avoided unless they cannot be achieved with other drawing APIs.
+
+```c
+void housekeeping_task_user(void) {
+ static uint32_t last_draw = 0;
+ if (timer_elapsed32(last_draw) > 33) { // Throttle to 30fps
+ last_draw = timer_read32();
+ // Draw a 240px high vertical rainbow line on X=0:
+ for (int i = 0; i < 239; ++i) {
+ qp_setpixel(display, 0, i, i, 255, 255);
+ }
+ qp_flush(display);
+ }
+}
+```
+
+#### Draw Line :id=quantum-painter-api-line
+
+```c
+bool qp_line(painter_device_t device, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t hue, uint8_t sat, uint8_t val);
+```
+
+The `qp_line` can be used to draw lines on the screen with the supplied color.
+
+```c
+void housekeeping_task_user(void) {
+ static uint32_t last_draw = 0;
+ if (timer_elapsed32(last_draw) > 33) { // Throttle to 30fps
+ last_draw = timer_read32();
+ // Draw 8px-wide rainbow down the left side of the display
+ for (int i = 0; i < 239; ++i) {
+ qp_line(display, 0, i, 7, i, i, 255, 255);
+ }
+ qp_flush(display);
+ }
+}
+```
+
+#### Draw Rect :id=quantum-painter-api-rect
+
+```c
+bool qp_rect(painter_device_t device, uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint8_t hue, uint8_t sat, uint8_t val, bool filled);
+```
+
+The `qp_rect` can be used to draw rectangles on the screen with the supplied color, with or without a background fill. If not filled, any pixels inside the rectangle will be left as-is.
+
+```c
+void housekeeping_task_user(void) {
+ static uint32_t last_draw = 0;
+ if (timer_elapsed32(last_draw) > 33) { // Throttle to 30fps
+ last_draw = timer_read32();
+ // Draw 8px-wide rainbow filled rectangles down the left side of the display
+ for (int i = 0; i < 239; i+=8) {
+ qp_rect(display, 0, i, 7, i+7, i, 255, 255, true);
+ }
+ qp_flush(display);
+ }
+}
+```
+
+#### Draw Circle :id=quantum-painter-api-circle
+
+```c
+bool qp_circle(painter_device_t device, uint16_t x, uint16_t y, uint16_t radius, uint8_t hue, uint8_t sat, uint8_t val, bool filled);
+```
+
+The `qp_circle` can be used to draw circles on the screen with the supplied color, with or without a background fill. If not filled, any pixels inside the circle will be left as-is.
+
+```c
+void housekeeping_task_user(void) {
+ static uint32_t last_draw = 0;
+ if (timer_elapsed32(last_draw) > 33) { // Throttle to 30fps
+ last_draw = timer_read32();
+ // Draw r=4 filled circles down the left side of the display
+ for (int i = 0; i < 239; i+=8) {
+ qp_circle(display, 4, 4+i, 4, i, 255, 255, true);
+ }
+ qp_flush(display);
+ }
+}
+```
+
+#### Draw Ellipse :id=quantum-painter-api-ellipse
+
+```c
+bool qp_ellipse(painter_device_t device, uint16_t x, uint16_t y, uint16_t sizex, uint16_t sizey, uint8_t hue, uint8_t sat, uint8_t val, bool filled);
+```
+
+The `qp_ellipse` can be used to draw ellipses on the screen with the supplied color, with or without a background fill. If not filled, any pixels inside the ellipses will be left as-is.
+
+```c
+void housekeeping_task_user(void) {
+ static uint32_t last_draw = 0;
+ if (timer_elapsed32(last_draw) > 33) { // Throttle to 30fps
+ last_draw = timer_read32();
+ // Draw 16x8 filled ellipses down the left side of the display
+ for (int i = 0; i < 239; i+=8) {
+ qp_ellipse(display, 8, 4+i, 16, 8, i, 255, 255, true);
+ }
+ qp_flush(display);
+ }
+}
+```
+
+### Image Functions :id=quantum-painter-api-images
+
+#### Load Image :id=quantum-painter-api-load-image
+
+```c
+painter_image_handle_t qp_load_image_mem(const void *buffer);
+```
+
+The `qp_load_image_mem` function loads a QGF image from memory or flash.
+
+`qp_load_image_mem` returns a handle to the loaded image, which can then be used to draw to the screen using `qp_drawimage`, `qp_drawimage_recolor`, `qp_animate`, or `qp_animate_recolor`. If an image is no longer required, it can be unloaded by calling `qp_close_image` below.
+
+See the [CLI Commands](quantum_painter.md?id=quantum-painter-cli) for instructions on how to convert images to [QGF](quantum_painter_qgf.md).
+
+?> The total number of images available to load at any one time is controlled by the configurable option `QUANTUM_PAINTER_NUM_IMAGES` in the table above. If more images are required, the number should be increased in `config.h`.
+
+Image information is available through accessing the handle:
+
+| Property | Accessor |
+|-------------|----------------------|
+| Width | `image->width` |
+| Height | `image->height` |
+| Frame Count | `image->frame_count` |
+
+#### Unload Image :id=quantum-painter-api-close-image
+
+```c
+bool qp_close_image(painter_image_handle_t image);
+```
+
+The `qp_close_image` function releases resources related to the loading of the supplied image.
+
+#### Draw image :id=quantum-painter-api-draw-image
+
+```c
+bool qp_drawimage(painter_device_t device, uint16_t x, uint16_t y, painter_image_handle_t image);
+bool qp_drawimage_recolor(painter_device_t device, uint16_t x, uint16_t y, painter_image_handle_t image, uint8_t hue_fg, uint8_t sat_fg, uint8_t val_fg, uint8_t hue_bg, uint8_t sat_bg, uint8_t val_bg);
+```
+
+The `qp_drawimage` and `qp_drawimage_recolor` functions draw the supplied image to the screen at the supplied location, with the latter function allowing for monochrome-based images to be recolored.
+
+```c
+// Draw an image on the bottom-right of the 240x320 display on initialisation
+static painter_image_handle_t my_image;
+void keyboard_post_init_kb(void) {
+ my_image = qp_load_image_mem(gfx_my_image);
+ if (my_image != NULL) {
+ qp_drawimage(display, (239 - my_image->width), (319 - my_image->height), my_image);
+ }
+}
+```
+
+#### Animate Image :id=quantum-painter-api-animate-image
+
+```c
+deferred_token qp_animate(painter_device_t device, uint16_t x, uint16_t y, painter_image_handle_t image);
+deferred_token qp_animate_recolor(painter_device_t device, uint16_t x, uint16_t y, painter_image_handle_t image, uint8_t hue_fg, uint8_t sat_fg, uint8_t val_fg, uint8_t hue_bg, uint8_t sat_bg, uint8_t val_bg);
+```
+
+The `qp_animate` and `qp_animate_recolor` functions draw the supplied image to the screen at the supplied location, with the latter function allowing for monochrome-based animations to be recolored. They also set up internal timing such that each frame is rendered at the correct time as per the animated image.
+
+Once an image has been set to animate, it will loop indefinitely until stopped, with no user intervention required.
+
+Both functions return a `deferred_token`, which can then be used to stop the animation, using `qp_stop_animation` below.
+
+```c
+// Animate an image on the bottom-right of the 240x320 display on initialisation
+static painter_image_handle_t my_image;
+static deferred_token my_anim;
+void keyboard_post_init_kb(void) {
+ my_image = qp_load_image_mem(gfx_my_image);
+ if (my_image != NULL) {
+ my_anim = qp_animate(display, (239 - my_image->width), (319 - my_image->height), my_image);
+ }
+}
+```
+
+#### Stop Animation :id=quantum-painter-api-stop-animation
+
+```c
+void qp_stop_animation(deferred_token anim_token);
+```
+
+The `qp_stop_animation` function stops the previously-started animation.
+```c
+void housekeeping_task_user(void) {
+ if (some_random_stop_reason) {
+ qp_stop_animation(my_anim);
+ }
+}
+```
+
+### Font Functions :id=quantum-painter-api-fonts
+
+#### Load Font :id=quantum-painter-api-load-font
+
+```c
+painter_font_handle_t qp_load_font_mem(const void *buffer);
+```
+
+The `qp_load_font_mem` function loads a QFF font from memory or flash.
+
+`qp_load_font_mem` returns a handle to the loaded font, which can then be measured using `qp_textwidth`, or drawn to the screen using `qp_drawtext`, or `qp_drawtext_recolor`. If a font is no longer required, it can be unloaded by calling `qp_close_font` below.
+
+See the [CLI Commands](quantum_painter.md?id=quantum-painter-cli) for instructions on how to convert TTF fonts to [QFF](quantum_painter_qff.md).
+
+?> The total number of fonts available to load at any one time is controlled by the configurable option `QUANTUM_PAINTER_NUM_FONTS` in the table above. If more fonts are required, the number should be increased in `config.h`.
+
+Font information is available through accessing the handle:
+
+| Property | Accessor |
+|-------------|----------------------|
+| Line Height | `image->line_height` |
+
+#### Unload Font :id=quantum-painter-api-close-font
+
+```c
+bool qp_close_font(painter_font_handle_t font);
+```
+
+The `qp_close_font` function releases resources related to the loading of the supplied font.
+
+#### Measure Text :id=quantum-painter-api-textwidth
+
+```c
+int16_t qp_textwidth(painter_font_handle_t font, const char *str);
+```
+
+The `qp_textwidth` function allows measurement of how many pixels wide the supplied string would result in, for the given font.
+
+#### Draw Text :id=quantum-painter-api-drawtext
+
+```c
+int16_t qp_drawtext(painter_device_t device, uint16_t x, uint16_t y, painter_font_handle_t font, const char *str);
+int16_t qp_drawtext_recolor(painter_device_t device, uint16_t x, uint16_t y, painter_font_handle_t font, const char *str, uint8_t hue_fg, uint8_t sat_fg, uint8_t val_fg, uint8_t hue_bg, uint8_t sat_bg, uint8_t val_bg);
+```
+
+The `qp_drawtext` and `qp_drawtext_recolor` functions draw the supplied string to the screen at the given location using the font supplied, with the latter function allowing for monochrome-based fonts to be recolored.
+
+```c
+// Draw a text message on the bottom-right of the 240x320 display on initialisation
+static painter_font_handle_t my_font;
+void keyboard_post_init_kb(void) {
+ my_font = qp_load_font_mem(font_opensans);
+ if (my_font != NULL) {
+ static const char *text = "Hello from QMK!";
+ int16_t width = qp_textwidth(my_font, text);
+ qp_drawtext(display, (239 - width), (319 - my_font->line_height), my_font, text);
+ }
+}
+```
+
+### Advanced Functions :id=quantum-painter-api-advanced
+
+#### Get Geometry :id=quantum-painter-api-get-geometry
+
+```c
+void qp_get_geometry(painter_device_t device, uint16_t *width, uint16_t *height, painter_rotation_t *rotation, uint16_t *offset_x, uint16_t *offset_y);
+```
+
+The `qp_get_geometry` function allows external code to retrieve the current width, height, rotation, and drawing offsets.
+
+#### Set Viewport Offsets :id=quantum-painter-api-set-viewport
+
+```c
+void qp_set_viewport_offsets(painter_device_t device, uint16_t offset_x, uint16_t offset_y);
+```
+
+The `qp_set_viewport_offsets` function can be used to offset all subsequent drawing operations. For example, if a display controller is internally 240x320, but the display panel is 240x240 and has a Y offset of 80 pixels, you could invoke `qp_set_viewport_offsets(display, 0, 80);` and the drawing positioning would be corrected.
+
+#### Set Viewport :id=quantum-painter-api-viewport
+
+```c
+bool qp_viewport(painter_device_t device, uint16_t left, uint16_t top, uint16_t right, uint16_t bottom);
+```
+
+The `qp_viewport` function controls where raw pixel data is written to.
+
+#### Stream Pixel Data :id=quantum-painter-api-pixdata
+
+```c
+bool qp_pixdata(painter_device_t device, const void *pixel_data, uint32_t native_pixel_count);
+```
+
+The `qp_pixdata` function allows raw pixel data to be streamed to the display. It requires a native pixel count rather than the number of bytes to transfer, to ensure display panel data alignment is respected. E.g. for display panels using RGB565 internal format, sending 10 pixels will result in 20 bytes of transfer.
+
+!> Under normal circumstances, users will not need to manually call either `qp_viewport` or `qp_pixdata`. These allow for writing of raw pixel information, in the display panel's native format, to the area defined by the viewport.
+
+## Quantum Painter Display Drivers :id=quantum-painter-drivers
+
+### Common: Standard TFT (SPI + D/C + RST)
+
+Most TFT display panels use a 5-pin interface -- SPI SCK, SPI MOSI, SPI CS, D/C, and RST pins.
+
+For these displays, QMK's `spi_master` must already be correctly configured for the platform you're building for.
+
+The pin assignments for SPI CS, D/C, and RST are specified during device construction.
+
+### GC9A01 :id=qp-driver-gc9a01
+
+Enabling support for the GC9A01 in Quantum Painter is done by adding the following to `rules.mk`:
+
+```make
+QUANTUM_PAINTER_ENABLE = yes
+QUANTUM_PAINTER_DRIVERS = gc9a01_spi
+```
+
+Creating a GC9A01 device in firmware can then be done with the following API:
+
+```c
+painter_device_t qp_gc9a01_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode);
+```
+
+The device handle returned from the `qp_gc9a01_make_spi_device` function can be used to perform all other drawing operations.
+
+The maximum number of displays can be configured by changing the following in your `config.h` (default is 1):
+
+```c
+// 3 displays:
+#define GC9A01_NUM_DEVICES 3
+```
+
+### ILI9163 :id=qp-driver-ili9163
+
+Enabling support for the ILI9163 in Quantum Painter is done by adding the following to `rules.mk`:
+
+```make
+QUANTUM_PAINTER_ENABLE = yes
+QUANTUM_PAINTER_DRIVERS = ili9163_spi
+```
+
+Creating a ILI9163 device in firmware can then be done with the following API:
+
+```c
+painter_device_t qp_ili9163_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode);
+```
+
+The device handle returned from the `qp_ili9163_make_spi_device` function can be used to perform all other drawing operations.
+
+The maximum number of displays can be configured by changing the following in your `config.h` (default is 1):
+
+```c
+// 3 displays:
+#define ILI9163_NUM_DEVICES 3
+```
+
+### ILI9341 :id=qp-driver-ili9341
+
+Enabling support for the ILI9341 in Quantum Painter is done by adding the following to `rules.mk`:
+
+```make
+QUANTUM_PAINTER_ENABLE = yes
+QUANTUM_PAINTER_DRIVERS = ili9341_spi
+```
+
+Creating a ILI9341 device in firmware can then be done with the following API:
+
+```c
+painter_device_t qp_ili9341_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode);
+```
+
+The device handle returned from the `qp_ili9341_make_spi_device` function can be used to perform all other drawing operations.
+
+The maximum number of displays can be configured by changing the following in your `config.h` (default is 1):
+
+```c
+// 3 displays:
+#define ILI9341_NUM_DEVICES 3
+```
+
+### SSD1351 :id=qp-driver-ssd1351
+
+Enabling support for the SSD1351 in Quantum Painter is done by adding the following to `rules.mk`:
+
+```make
+QUANTUM_PAINTER_ENABLE = yes
+QUANTUM_PAINTER_DRIVERS = ssd1351_spi
+```
+
+Creating a SSD1351 device in firmware can then be done with the following API:
+
+```c
+painter_device_t qp_ssd1351_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode);
+```
+
+The device handle returned from the `qp_ssd1351_make_spi_device` function can be used to perform all other drawing operations.
+
+The maximum number of displays can be configured by changing the following in your `config.h` (default is 1):
+
+```c
+// 3 displays:
+#define SSD1351_NUM_DEVICES 3
+```
+
+### ST7789 :id=qp-driver-st7789
+
+Enabling support for the ST7789 in Quantum Painter is done by adding the following to `rules.mk`:
+
+```make
+QUANTUM_PAINTER_ENABLE = yes
+QUANTUM_PAINTER_DRIVERS = st7789_spi
+```
+
+Creating a ST7789 device in firmware can then be done with the following API:
+
+```c
+painter_device_t qp_st7789_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode);
+```
+
+The device handle returned from the `qp_st7789_make_spi_device` function can be used to perform all other drawing operations.
+
+The maximum number of displays can be configured by changing the following in your `config.h` (default is 1):
+
+```c
+// 3 displays:
+#define ST7789_NUM_DEVICES 3
+```
+
+!> Some ST7789 devices are known to have different drawing offsets -- despite being a 240x320 pixel display controller internally, some display panels are only 240x240, or smaller. These may require an offset to be applied; see `qp_set_viewport_offsets` above for information on how to override the offsets if they aren't correctly rendered. \ No newline at end of file
diff --git a/docs/quantum_painter_qff.md b/docs/quantum_painter_qff.md
new file mode 100644
index 0000000000..f62d59bdcb
--- /dev/null
+++ b/docs/quantum_painter_qff.md
@@ -0,0 +1,103 @@
+# QMK Font Format :id=qmk-font-format
+
+QMK uses a font format _("Quantum Font Format" - QFF)_ specifically for resource-constrained systems.
+
+This format is capable of encoding 1-, 2-, 4-, and 8-bit-per-pixel greyscale- and palette-based images into a font. It also includes RLE for pixel data for some basic compression.
+
+All integer values are in little-endian format.
+
+The QFF is defined in terms of _blocks_ -- each _block_ contains a _header_ and an optional _blob_ of data. The _header_ contains the block's _typeid_, and the length of the _blob_ that follows. Each block type is denoted by a different _typeid_ has its own block definition below. All blocks are defined as packed structs, containing zero padding between fields.
+
+The general structure of the file is:
+
+* _Font descriptor block_
+* _ASCII glyph block_ (optional, only if ASCII glyphs are included)
+* _Unicode glyph block_ (optional, only if Unicode glyphs are included)
+* _Font palette block_ (optional, depending on frame format)
+* _Font data block_
+
+## Block Header :id=qff-block-header
+
+The block header is identical to [QGF's block header](quantum_painter_qgf.md#qgf-block-header), and is present for all blocks, including the font descriptor.
+
+## Font descriptor block :id=qff-font-descriptor
+
+* _typeid_ = 0x00
+* _length_ = 20
+
+This block must be located at the start of the file contents, and can exist a maximum of once in an entire QGF file. It is always followed by either the _ASCII glyph table_ or the _Unicode glyph table_, depending on which glyphs are included in the font.
+
+_Block_ format:
+
+```c
+typedef struct __attribute__((packed)) qff_font_descriptor_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x00, .neg_type_id = (~0x00), .length = 20 }
+ uint24_t magic; // constant, equal to 0x464651 ("QFF")
+ uint8_t qff_version; // constant, equal to 0x01
+ uint32_t total_file_size; // total size of the entire file, starting at offset zero
+ uint32_t neg_total_file_size; // negated value of total_file_size, used for detecting parsing errors
+ uint8_t line_height; // glyph height in pixels
+ bool has_ascii_table; // whether the font has an ascii table of glyphs (0x20...0x7E)
+ uint16_t num_unicode_glyphs; // the number of glyphs in the unicode table -- no table specified if zero
+ uint8_t format; // frame format, see below.
+ uint8_t flags; // frame flags, see below.
+ uint8_t compression_scheme; // compression scheme, see below.
+ uint8_t transparency_index; // palette index used for transparent pixels (not yet implemented)
+} qff_font_descriptor_v1_t;
+// _Static_assert(sizeof(qff_font_descriptor_v1_t) == (sizeof(qgf_block_header_v1_t) + 20), "qff_font_descriptor_v1_t must be 25 bytes in v1 of QFF");
+```
+
+The values for `format`, `flags`, `compression_scheme`, and `transparency_index` match [QGF's frame descriptor block](quantum_painter_qgf.md#qgf-frame-descriptor), with the exception that the `delta` flag is ignored by QFF.
+
+## ASCII glyph table :id=qff-ascii-table
+
+* _typeid_ = 0x01
+* _length_ = 290
+
+If the font contains ascii characters, the _ASCII glyph block_ must be located directly after the _font descriptor block_.
+
+```c
+#define QFF_GLYPH_WIDTH_BITS 6
+#define QFF_GLYPH_WIDTH_MASK ((1<<QFF_GLYPH_WIDTH_BITS)-1)
+#define QFF_GLYPH_OFFSET_BITS 18
+#define QFF_GLYPH_OFFSET_MASK (((1<<QFF_GLYPH_OFFSET_BITS)-1) << QFF_GLYPH_WIDTH_BITS)
+
+typedef struct __attribute__((packed)) qff_ascii_glyph_table_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x01, .neg_type_id = (~0x01), .length = 285 }
+ uint24_t glyph[95]; // 95 glyphs, 0x20..0x7E, see bits/masks above for values
+} qff_ascii_glyph_table_v1_t;
+// _Static_assert(sizeof(qff_ascii_glyph_table_v1_t) == (sizeof(qgf_block_header_v1_t) + 285), "qff_ascii_glyph_table_v1_t must be 290 bytes in v1 of QFF");
+```
+
+## Unicode glyph table :id=qff-unicode-table
+
+* _typeid_ = 0x02
+* _length_ = variable
+
+If this font contains unicode characters, the _unicode glyph block_ must be located directly after the _ASCII glyph table block_, or the _font descriptor block_ if the font does not contain ASCII characters.
+
+```c
+typedef struct __attribute__((packed)) qff_unicode_glyph_table_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x02, .neg_type_id = (~0x02), .length = (N * 6) }
+ struct __attribute__((packed)) { // container for a single unicode glyph
+ uint24_t code_point; // the unicode code point
+ uint24_t glyph; // the glyph information, as per ASCII glyphs above
+ } glyph[N]; // N glyphs worth of data
+} qff_unicode_glyph_table_v1_t;
+```
+
+## Font palette block :id=qff-palette-descriptor
+
+* _typeid_ = 0x03
+* _length_ = variable
+
+The _font palette block_ is identical to [QGF's frame palette block](quantum_painter_qgf.md#qgf-frame-palette-descriptor), retaining the same _typeid_ of 0x03.
+
+It is only specified in the QFF if the font is palette-based, and follows the _unicode glyph block_ if the font contains any Unicode glyphs, or the _ASCII glyph block_ if the font contains only ASCII glyphs.
+
+## Font data block :id=qff-data-descriptor
+
+* _typeid_ = 0x04
+* _length_ = variable
+
+The _font data block_ is the last block in the file and is identical to [QGF's frame data block](quantum_painter_qgf.md#qgf-frame-data-descriptor), however has a different _typeid_ of 0x04 in QFF.
diff --git a/docs/quantum_painter_qgf.md b/docs/quantum_painter_qgf.md
new file mode 100644
index 0000000000..caf6731e65
--- /dev/null
+++ b/docs/quantum_painter_qgf.md
@@ -0,0 +1,178 @@
+# QMK Graphics Format :id=qmk-graphics-format
+
+QMK uses a graphics format _("Quantum Graphics Format" - QGF)_ specifically for resource-constrained systems.
+
+This format is capable of encoding 1-, 2-, 4-, and 8-bit-per-pixel greyscale- and palette-based images. It also includes RLE for pixel data for some basic compression.
+
+All integer values are in little-endian format.
+
+The QGF is defined in terms of _blocks_ -- each _block_ contains a _header_ and an optional _blob_ of data. The _header_ contains the block's _typeid_, and the length of the _blob_ that follows. Each block type is denoted by a different _typeid_ has its own block definition below. All blocks are defined as packed structs, containing zero padding between fields.
+
+The general structure of the file is:
+
+* _Graphics descriptor block_
+* _Frame offset block_
+* Repeating list of frames:
+ * _Frame descriptor block_
+ * _Frame palette block_ (optional, depending on frame format)
+ * _Frame delta block_ (optional, depending on delta flag)
+ * _Frame data block_
+
+Different frames within the file should be considered "isolated" and may have their own image format and/or palette.
+
+## Block Header :id=qgf-block-header
+
+This block header is present for all blocks, including the graphics descriptor.
+
+_Block header_ format:
+
+```c
+typedef struct __attribute__((packed)) qgf_block_header_v1_t {
+ uint8_t type_id; // See each respective block type
+ uint8_t neg_type_id; // Negated type ID, used for detecting parsing errors
+ uint24_t length; // 24-bit blob length, allowing for block sizes of a maximum of 16MB
+} qgf_block_header_v1_t;
+// _Static_assert(sizeof(qgf_block_header_v1_t) == 5, "qgf_block_header_v1_t must be 5 bytes in v1 of QGF");
+```
+The _length_ describes the number of octets in the data following the block header -- a block header may specify a _length_ of `0` if no blob is specified.
+
+## Graphics descriptor block :id=qgf-graphics-descriptor
+
+* _typeid_ = 0x00
+* _length_ = 18
+
+This block must be located at the start of the file contents, and can exist a maximum of once in an entire QGF file. It is always followed by the _frame offset block_.
+
+_Block_ format:
+
+```c
+typedef struct __attribute__((packed)) qgf_graphics_descriptor_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x00, .neg_type_id = (~0x00), .length = 18 }
+ uint24_t magic; // constant, equal to 0x464751 ("QGF")
+ uint8_t qgf_version; // constant, equal to 0x01
+ uint32_t total_file_size; // total size of the entire file, starting at offset zero
+ uint32_t neg_total_file_size; // negated value of total_file_size, used for detecting parsing errors
+ uint16_t image_width; // in pixels
+ uint16_t image_height; // in pixels
+ uint16_t frame_count; // minimum of 1
+} qgf_graphics_descriptor_v1_t;
+// _Static_assert(sizeof(qgf_graphics_descriptor_v1_t) == (sizeof(qgf_block_header_v1_t) + 18), "qgf_graphics_descriptor_v1_t must be 23 bytes in v1 of QGF");
+```
+
+## Frame offset block :id=qgf-frame-offset-descriptor
+
+* _typeid_ = 0x01
+* _length_ = variable
+
+This block denotes the offsets within the file to each frame's _frame descriptor block_, relative to the start of the file. The _frame offset block_ always immediately follows the _graphics descriptor block_. The contents of this block are an array of U32's, with one entry for each frame.
+
+Duplicate frame offsets in this block are allowed, if a certain frame is to be shown multiple times during animation.
+
+_Block_ format:
+
+```c
+typedef struct __attribute__((packed)) qgf_frame_offsets_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x01, .neg_type_id = (~0x01), .length = (N * sizeof(uint32_t)) }
+ uint32_t offset[N]; // where 'N' is the number of frames in the file
+} qgf_frame_offsets_v1_t;
+```
+
+## Frame descriptor block :id=qgf-frame-descriptor
+
+* _typeid_ = 0x02
+* _length_ = 5
+
+This block denotes the start of a frame.
+
+_Block_ format:
+
+```c
+typedef struct __attribute__((packed)) qgf_frame_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x02, .neg_type_id = (~0x02), .length = 5 }
+ uint8_t format; // Frame format, see below.
+ uint8_t flags; // Frame flags, see below.
+ uint8_t compression_scheme; // Compression scheme, see below.
+ uint8_t transparency_index; // palette index used for transparent pixels (not yet implemented)
+ uint16_t delay; // frame delay time for animations (in units of milliseconds)
+} qgf_frame_v1_t;
+// _Static_assert(sizeof(qgf_frame_v1_t) == (sizeof(qgf_block_header_v1_t) + 6), "qgf_frame_v1_t must be 11 bytes in v1 of QGF");
+```
+
+If this frame is grayscale, the _frame descriptor block_ (or _frame delta block_ if flags denote a delta frame) is immediately followed by this frame's corresponding _frame data block_.
+
+If the frame uses an indexed palette, the _frame descriptor block_ (or _frame delta block_ if flags denote a delta frame) is immediately followed by this frame's corresponding _frame palette block_.
+
+Frame format possible values:
+
+* `0x00`: 1bpp grayscale, no palette, `0` = black, `1` = white, LSb first pixel
+* `0x01`: 2bpp grayscale, no palette, `0` = black, `3` = white, linear interpolation of brightness, LSb first pixel
+* `0x02`: 4bpp grayscale, no palette, `0` = black, `15` = white, linear interpolation of brightness, LSb first pixel
+* `0x03`: 8bpp grayscale, no palette, `0` = black, `255` = white, linear interpolation of brightness, LSb first pixel
+* `0x04`: 1bpp indexed palette, 2 colors, LSb first pixel
+* `0x05`: 2bpp indexed palette, 4 colors, LSb first pixel
+* `0x06`: 4bpp indexed palette, 16 colors, LSb first pixel
+* `0x07`: 8bpp indexed palette, 256 colors, LSb first pixel
+
+Frame flags is a bitmask with the following format:
+
+| `bit 7` | `bit 6` | `bit 5` | `bit 4` | `bit 3` | `bit 2` | `bit 1` | `bit 0` |
+|---------|---------|---------|---------|---------|---------|---------|--------------|
+| - | - | - | - | - | - | Delta | Transparency |
+
+* `[1]` -- Delta: Signifies that the current frame is a delta frame, which specifies only a sub-image. The _frame delta block_ follows the _frame palette block_ if the image format specifies a palette, otherwise it directly follows the _frame descriptor block_.
+* `[0]` -- Transparency: The transparent palette index in the _blob_ is considered valid and should be used when considering which pixels should be transparent during rendering this frame, if possible.
+
+Compression scheme possible values:
+
+* `0x00`: No compression
+* `0x01`: [QMK RLE](quantum_painter_rle.md)
+
+## Frame palette block :id=qgf-frame-palette-descriptor
+
+* _typeid_ = 0x03
+* _length_ = variable
+
+This block describes the palette used for the frame. The _blob_ contains an array of palette entries -- one palette entry is present for each color used -- each palette entry is in QMK HSV888 format:
+
+```c
+typedef struct __attribute__((packed)) qgf_palette_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x03, .neg_type_id = (~0x03), .length = (N * 3 * sizeof(uint8_t)) }
+ struct { // container for a single HSV palette entry
+ uint8_t h; // hue component: `[0,360)` degrees is mapped to `[0,255]` uint8_t.
+ uint8_t s; // saturation component: `[0,1]` is mapped to `[0,255]` uint8_t.
+ uint8_t v; // value component: `[0,1]` is mapped to `[0,255]` uint8_t.
+ } hsv[N]; // N * hsv, where N is the number of palette entries depending on the frame format in the descriptor
+} qgf_palette_v1_t;
+```
+
+## Frame delta block :id=qgf-frame-delta-descriptor
+
+* _typeid_ = 0x04
+* _length_ = 8
+
+This block describes where the delta frame should be drawn, with respect to the top left location of the image.
+
+```c
+typedef struct __attribute__((packed)) qgf_delta_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x04, .neg_type_id = (~0x04), .length = 8 }
+ uint16_t left; // The left pixel location to draw the delta image
+ uint16_t top; // The top pixel location to draw the delta image
+ uint16_t right; // The right pixel location to to draw the delta image
+ uint16_t bottom; // The bottom pixel location to to draw the delta image
+} qgf_delta_v1_t;
+// _Static_assert(sizeof(qgf_delta_v1_t) == 13, "qgf_delta_v1_t must be 13 bytes in v1 of QGF");
+```
+
+## Frame data block :id=qgf-frame-data-descriptor
+
+* _typeid_ = 0x05
+* _length_ = variable
+
+This block describes the data associated with the frame. The _blob_ contains an array of bytes containing the data corresponding to the frame's image format:
+
+```c
+typedef struct __attribute__((packed)) qgf_data_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x05, .neg_type_id = (~0x05), .length = N }
+ uint8_t data[N]; // N data octets
+} qgf_data_v1_t;
+```
diff --git a/docs/quantum_painter_rle.md b/docs/quantum_painter_rle.md
new file mode 100644
index 0000000000..dcb9a1e1a7
--- /dev/null
+++ b/docs/quantum_painter_rle.md
@@ -0,0 +1,29 @@
+# QMK QGF/QFF RLE data schema :id=qmk-qp-rle-schema
+
+There are two "modes" to the RLE algorithm used in both [QGF](quantum_painter_qgf.md)/[QFF](quantum_painter_qff.md):
+
+* Non-repeating sections of octets, with associated length of up to `128` octets
+ * `length` = `marker - 128`
+ * A corresponding `length` number of octets follow directly after the marker octet
+* Repeated octet with associated length, with associated length of up to `128`
+ * `length` = `marker`
+ * A single octet follows the marker that should be repeated `length` times.
+
+Decoder pseudocode:
+```
+while !EOF
+ marker = READ_OCTET()
+
+ if marker >= 128
+ length = marker - 128
+ for i = 0 ... length-1
+ c = READ_OCTET()
+ WRITE_OCTET(c)
+
+ else
+ length = marker
+ c = READ_OCTET()
+ for i = 0 ... length-1
+ WRITE_OCTET(c)
+
+```
diff --git a/docs/squeezing_avr.md b/docs/squeezing_avr.md
index 62f0a5d290..f7e21d932b 100644
--- a/docs/squeezing_avr.md
+++ b/docs/squeezing_avr.md
@@ -30,6 +30,19 @@ MAGIC_ENABLE = no
These features are enabled by default, but may not be needed. Double check to make sure, though.
Largest in size is "magic" -- the QMK magic keycodes -- which control things like NKRO toggling, GUI and ALT/CTRL swapping, etc. Disabling it will disable those functions.
+If you use `sprintf` or `snprintf` functions you can save around ~400 Bytes by enabling this option.
+```make
+AVR_USE_MINIMAL_PRINTF = yes
+```
+
+This will include smaller implementations from AVRs libc into your Firmware. They are [not fully featured](https://www.nongnu.org/avr-libc/user-manual/group__avr__stdio.html#gaa3b98c0d17b35642c0f3e4649092b9f1), for instance zero padding and field width specifiers are not supported. So if you use `sprintf` or `snprintf` like this:
+```c
+sprintf(wpm_str, "%03d", get_current_wpm());
+snprintf(keylog_str, sizeof(keylog_str), "%dx%d, k%2d : %c");
+```
+
+you will still need the standard implementation.
+
## `config.h` Settings
If you've done all of that, and you don't want to disable features like RGB, Audio, OLEDs, etc, there are some additional options that you can add to your config.h that can help.
diff --git a/docs/tap_hold.md b/docs/tap_hold.md
index 39fa84a9f3..601aef0493 100644
--- a/docs/tap_hold.md
+++ b/docs/tap_hold.md
@@ -112,7 +112,7 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
}
```
-The reason being that `TAPPING_TERM` is a macro that expands to a constant integer and thus cannot be changed at runtime whereas `g_tapping_term` is a variable whose value can be changed at runtime. If you want, you can temporarily enable `DYNAMIC_TAPPING_TERM_ENABLE` to find a suitable tapping term value and then disable that feature and revert back to using the classic syntax for per-key tapping term settings.
+The reason being that `TAPPING_TERM` is a macro that expands to a constant integer and thus cannot be changed at runtime whereas `g_tapping_term` is a variable whose value can be changed at runtime. If you want, you can temporarily enable `DYNAMIC_TAPPING_TERM_ENABLE` to find a suitable tapping term value and then disable that feature and revert back to using the classic syntax for per-key tapping term settings. In case you need to access the tapping term from elsewhere in your code, you can use the `GET_TAPPING_TERM(keycode, record)` macro. This macro will expand to whatever is the appropriate access pattern given the current configuration.
## Tap-Or-Hold Decision Modes
diff --git a/docs/zh-cn/_summary.md b/docs/zh-cn/_summary.md
index 8a710a9ec1..dbad1021fa 100644
--- a/docs/zh-cn/_summary.md
+++ b/docs/zh-cn/_summary.md
@@ -146,7 +146,7 @@
* [EEPROM驱动](zh-cn/eeprom_driver.md)
* [串口驱动](zh-cn/serial_driver.md)
* [UART驱动](zh-cn/uart_driver.md)
- * [操控GPIO](zh-cn/internals_gpio_control.md)
+ * [操控GPIO](zh-cn/gpio_control.md)
* [键盘开发指引](zh-cn/hardware_keyboard_guidelines.md)
* Python开发
@@ -182,12 +182,12 @@
* [了解QMK](zh-cn/understanding_qmk.md)
* QMK内部细节 (编辑中)
- * [定义](zh-cn/internals_defines.md)
- * [输入回调的注册](zh-cn/internals_input_callback_reg.md)
- * [Midi设备](zh-cn/internals_midi_device.md)
- * [Midi设备驱动流程](zh-cn/internals_midi_device_setup_process.md)
- * [Midi辅助功能](zh-cn/internals_midi_util.md)
- * [发送函数](zh-cn/internals_send_functions.md)
- * [Sysex工具](zh-cn/internals_sysex_tools.md)
+ * [定义](zh-cn/internals/defines.md)
+ * [输入回调的注册](zh-cn/internals/input_callback_reg.md)
+ * [Midi设备](zh-cn/internals/midi_device.md)
+ * [Midi设备驱动流程](zh-cn/internals/midi_device_setup_process.md)
+ * [Midi辅助功能](zh-cn/internals/midi_util.md)
+ * [发送函数](zh-cn/internals/send_functions.md)
+ * [Sysex工具](zh-cn/internals/sysex_tools.md)
<!--fromen:20211014-12:00(GMT+8) commit 04cf161aa01fd433b5dae69d9fd31569ed5dca59-->
diff --git a/drivers/gpio/sn74x154.c b/drivers/gpio/sn74x154.c
new file mode 100644
index 0000000000..5f21f12b55
--- /dev/null
+++ b/drivers/gpio/sn74x154.c
@@ -0,0 +1,58 @@
+/* Copyright 2022
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "sn74x154.h"
+#include "gpio.h"
+
+#define ADDRESS_PIN_COUNT 4
+
+#ifndef SN74X154_ADDRESS_PINS
+# error sn74x154: no address pins defined!
+#endif
+
+static const pin_t address_pins[ADDRESS_PIN_COUNT] = SN74X154_ADDRESS_PINS;
+
+void sn74x154_init(void) {
+ for (int i = 0; i < ADDRESS_PIN_COUNT; i++) {
+ setPinOutput(address_pins[i]);
+ writePinLow(address_pins[i]);
+ }
+
+#if defined(SN74X154_E0_PIN)
+ setPinOutput(SN74X154_E0_PIN);
+ writePinHigh(SN74X154_E0_PIN);
+#endif
+
+#if defined(SN74X154_E1_PIN)
+ setPinOutput(SN74X154_E1_PIN);
+ writePinHigh(SN74X154_E1_PIN);
+#endif
+}
+
+void sn74x154_set_enabled(bool enabled) {
+#if defined(SN74X154_E0_PIN)
+ writePin(SN74X154_E0_PIN, !enabled);
+#endif
+#if defined(SN74X154_E1_PIN)
+ writePin(SN74X154_E1_PIN, !enabled);
+#endif
+}
+
+void sn74x154_set_addr(uint8_t address) {
+ for (int i = 0; i < ADDRESS_PIN_COUNT; i++) {
+ writePin(address_pins[i], address & (1 << i));
+ }
+}
diff --git a/drivers/gpio/sn74x154.h b/drivers/gpio/sn74x154.h
new file mode 100644
index 0000000000..ce6a9ddb0e
--- /dev/null
+++ b/drivers/gpio/sn74x154.h
@@ -0,0 +1,48 @@
+/* Copyright 2022
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+
+/**
+ * Driver for 74x154 4-to-16 decoder/demultiplexer with inverting outputs
+ * https://assets.nexperia.com/documents/data-sheet/74HC_HCT154.pdf
+ */
+
+/**
+ * Initialize the address and output enable pins.
+ */
+void sn74x154_init(void);
+
+/**
+ * Set the enabled state.
+ *
+ * When enabled is true, pulls the E0 and E1 pins low.
+ *
+ * \param enabled The enable state to set.
+ */
+void sn74x154_set_enabled(bool enabled);
+
+/**
+ * Set the output pin address.
+ *
+ * The selected output pin will be pulled low, while the remaining output pins will be high.
+ *
+ * \param address The address to set, from 0 to 15.
+ */
+void sn74x154_set_addr(uint8_t address);
diff --git a/drivers/lcd/hd44780.c b/drivers/lcd/hd44780.c
new file mode 100644
index 0000000000..c988ebe56c
--- /dev/null
+++ b/drivers/lcd/hd44780.c
@@ -0,0 +1,284 @@
+/*
+Copyright 2022
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "hd44780.h"
+#include "gpio.h"
+#include "progmem.h"
+#include "wait.h"
+
+#ifndef HD44780_DATA_PINS
+# error hd44780: no data pins defined!
+#endif
+
+#ifndef HD44780_RS_PIN
+# error hd44780: no RS pin defined!
+#endif
+
+#ifndef HD44780_RW_PIN
+# error hd44780: no R/W pin defined!
+#endif
+
+#ifndef HD44780_E_PIN
+# error hd44780: no E pin defined!
+#endif
+
+static const pin_t data_pins[4] = HD44780_DATA_PINS;
+
+#ifndef HD44780_DISPLAY_COLS
+# define HD44780_DISPLAY_COLS 16
+#endif
+
+#ifndef HD44780_DISPLAY_LINES
+# define HD44780_DISPLAY_LINES 2
+#endif
+
+#ifndef HD44780_DDRAM_LINE0_ADDR
+# define HD44780_DDRAM_LINE0_ADDR 0x00
+#endif
+#ifndef HD44780_DDRAM_LINE1_ADDR
+# define HD44780_DDRAM_LINE1_ADDR 0x40
+#endif
+
+#define HD44780_INIT_DELAY_MS 16
+#define HD44780_ENABLE_DELAY_US 1
+
+static void hd44780_latch(void) {
+ writePinHigh(HD44780_E_PIN);
+ wait_us(HD44780_ENABLE_DELAY_US);
+ writePinLow(HD44780_E_PIN);
+}
+
+void hd44780_write(uint8_t data, bool isData) {
+ writePin(HD44780_RS_PIN, isData);
+ writePinLow(HD44780_RW_PIN);
+
+ for (int i = 0; i < 4; i++) {
+ setPinOutput(data_pins[i]);
+ }
+
+ // Write high nibble
+ for (int i = 0; i < 4; i++) {
+ writePin(data_pins[i], (data >> 4) & (1 << i));
+ }
+ hd44780_latch();
+
+ // Write low nibble
+ for (int i = 0; i < 4; i++) {
+ writePin(data_pins[i], data & (1 << i));
+ }
+ hd44780_latch();
+
+ for (int i = 0; i < 4; i++) {
+ writePinHigh(data_pins[i]);
+ }
+}
+
+uint8_t hd44780_read(bool isData) {
+ uint8_t data = 0;
+
+ writePin(HD44780_RS_PIN, isData);
+ writePinHigh(HD44780_RW_PIN);
+
+ for (int i = 0; i < 4; i++) {
+ setPinInput(data_pins[i]);
+ }
+
+ writePinHigh(HD44780_E_PIN);
+ wait_us(HD44780_ENABLE_DELAY_US);
+
+ // Read high nibble
+ for (int i = 0; i < 4; i++) {
+ data |= (readPin(data_pins[i]) << i);
+ }
+
+ data <<= 4;
+
+ writePinLow(HD44780_E_PIN);
+ wait_us(HD44780_ENABLE_DELAY_US);
+ writePinHigh(HD44780_E_PIN);
+ wait_us(HD44780_ENABLE_DELAY_US);
+
+ // Read low nibble
+ for (int i = 0; i < 4; i++) {
+ data |= (readPin(data_pins[i]) << i);
+ }
+
+ writePinLow(HD44780_E_PIN);
+
+ return data;
+}
+
+bool hd44780_busy(void) {
+ return hd44780_read(false) & HD44780_BUSY_FLAG;
+}
+
+void hd44780_command(uint8_t command) {
+ while (hd44780_busy())
+ ;
+ hd44780_write(command, false);
+}
+
+void hd44780_data(uint8_t data) {
+ while (hd44780_busy())
+ ;
+ hd44780_write(data, true);
+}
+
+void hd44780_clear(void) {
+ hd44780_command(HD44780_CMD_CLEAR_DISPLAY);
+}
+
+void hd44780_home(void) {
+ hd44780_command(HD44780_CMD_RETURN_HOME);
+}
+
+void hd44780_on(bool cursor, bool blink) {
+ if (cursor) {
+ if (blink) {
+ hd44780_command(HD44780_CMD_DISPLAY | HD44780_DISPLAY_ON | HD44780_DISPLAY_CURSOR | HD44780_DISPLAY_BLINK);
+ } else {
+ hd44780_command(HD44780_CMD_DISPLAY | HD44780_DISPLAY_ON | HD44780_DISPLAY_CURSOR);
+ }
+ } else {
+ hd44780_command(HD44780_CMD_DISPLAY | HD44780_DISPLAY_ON);
+ }
+}
+
+void hd44780_off() {
+ hd44780_command(HD44780_CMD_DISPLAY);
+}
+
+void hd44780_set_cgram_address(uint8_t address) {
+ hd44780_command(HD44780_CMD_SET_CGRAM_ADDRESS + (address & 0x3F));
+}
+
+void hd44780_set_ddram_address(uint8_t address) {
+ hd44780_command(HD44780_CMD_SET_DDRAM_ADDRESS + (address & 0x7F));
+}
+
+void hd44780_init(bool cursor, bool blink) {
+ setPinOutput(HD44780_RS_PIN);
+ setPinOutput(HD44780_RW_PIN);
+ setPinOutput(HD44780_E_PIN);
+
+ for (int i = 0; i < 4; i++) {
+ setPinOutput(data_pins[i]);
+ }
+
+ wait_ms(HD44780_INIT_DELAY_MS);
+
+ // Manually configure for 4-bit mode - can't use hd44780_command() yet
+ // HD44780U datasheet, Fig. 24 (p46)
+ writePinHigh(data_pins[0]); // Function set
+ writePinHigh(data_pins[1]); // DL = 1
+ hd44780_latch();
+ wait_ms(5);
+ // Send again
+ hd44780_latch();
+ wait_us(64);
+ // And again (?)
+ hd44780_latch();
+ wait_us(64);
+
+ writePinLow(data_pins[0]); // DL = 0
+ hd44780_latch();
+ wait_us(64);
+
+#if HD44780_DISPLAY_LINES == 1
+ hd44780_command(HD44780_CMD_FUNCTION); // 4 bit, 1 line, 5x8 dots
+#else
+ hd44780_command(HD44780_CMD_FUNCTION | HD44780_FUNCTION_2_LINES); // 4 bit, 2 lines, 5x8 dots
+#endif
+ hd44780_on(cursor, blink);
+ hd44780_clear();
+ hd44780_home();
+ hd44780_command(HD44780_CMD_ENTRY_MODE | HD44780_ENTRY_MODE_INC);
+}
+
+void hd44780_set_cursor(uint8_t col, uint8_t line) {
+ register uint8_t address = col;
+
+#if HD44780_DISPLAY_LINES == 1
+ address += HD44780_DDRAM_LINE0_ADDR;
+#elif HD44780_DISPLAY_LINES == 2
+ if (line == 0) {
+ address += HD44780_DDRAM_LINE0_ADDR;
+ } else {
+ address += HD44780_DDRAM_LINE1_ADDR;
+ }
+#endif
+
+ hd44780_set_ddram_address(address);
+}
+
+void hd44780_define_char(uint8_t index, uint8_t *data) {
+ hd44780_set_cgram_address((index & 0x7) << 3);
+ for (uint8_t i = 0; i < 8; i++) {
+ hd44780_data(data[i]);
+ }
+}
+
+void hd44780_putc(char c) {
+ while (hd44780_busy())
+ ;
+ uint8_t current_position = hd44780_read(false);
+
+ if (c == '\n') {
+ hd44780_set_cursor(0, current_position < HD44780_DDRAM_LINE1_ADDR ? 1 : 0);
+ } else {
+#if defined(HD44780_WRAP_LINES)
+# if HD44780_DISPLAY_LINES == 1
+ if (current_position == HD44780_DDRAM_LINE0_ADDR + HD44780_DISPLAY_COLS) {
+ // Go to start of line
+ hd44780_set_cursor(0, 0);
+ }
+# elif HD44780_DISPLAY_LINES == 2
+ if (current_position == HD44780_DDRAM_LINE0_ADDR + HD44780_DISPLAY_COLS) {
+ // Go to start of second line
+ hd44780_set_cursor(0, 1);
+ } else if (current_position == HD44780_DDRAM_LINE1_ADDR + HD44780_DISPLAY_COLS) {
+ // Go to start of first line
+ hd44780_set_cursor(0, 0);
+ }
+# endif
+#endif
+ hd44780_data(c);
+ }
+}
+
+void hd44780_puts(const char *s) {
+ register char c;
+ while ((c = *s++)) {
+ hd44780_putc(c);
+ }
+}
+
+#if defined(__AVR__)
+void hd44780_define_char_P(uint8_t index, const uint8_t *data) {
+ hd44780_set_cgram_address(index << 3);
+ for (uint8_t i = 0; i < 8; i++) {
+ hd44780_data(pgm_read_byte(data++));
+ }
+}
+
+void hd44780_puts_P(const char *s) {
+ register char c;
+ while ((c = pgm_read_byte(s++))) {
+ hd44780_putc(c);
+ }
+}
+#endif
diff --git a/drivers/lcd/hd44780.h b/drivers/lcd/hd44780.h
new file mode 100644
index 0000000000..9e43339344
--- /dev/null
+++ b/drivers/lcd/hd44780.h
@@ -0,0 +1,220 @@
+/*
+Copyright 2022
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+
+/**
+ * \defgroup hd44780
+ *
+ * HD44780 Character LCD Driver
+ * \{
+ */
+
+/*
+ * HD44780 instructions
+ * https://www.sparkfun.com/datasheets/LCD/HD44780.pdf
+ * Table 6 (p24)
+ */
+// Clear display
+#define HD44780_CMD_CLEAR_DISPLAY 0x01
+// Return home
+#define HD44780_CMD_RETURN_HOME 0x02
+// Entry mode set
+#define HD44780_CMD_ENTRY_MODE 0x04
+#define HD44780_ENTRY_MODE_INC 0x02 // I/D
+#define HD44780_ENTRY_MODE_SHIFT 0x01 // S
+// Display on/off control
+#define HD44780_CMD_DISPLAY 0x08
+#define HD44780_DISPLAY_ON 0x04 // D
+#define HD44780_DISPLAY_CURSOR 0x02 // C
+#define HD44780_DISPLAY_BLINK 0x01 // B
+// Cursor or display shift
+#define HD44780_CMD_MOVE 0x10
+#define HD44780_MOVE_DISPLAY 0x08 // S/C
+#define HD44780_MOVE_RIGHT 0x04 // R/L
+// Function set
+#define HD44780_CMD_FUNCTION 0x20
+#define HD44780_FUNCTION_8_BIT 0x10 // DL
+#define HD44780_FUNCTION_2_LINES 0x08 // N
+#define HD44780_FUNCTION_5X10_DOTS 0x04 // F
+// Set CGRAM address
+#define HD44780_CMD_SET_CGRAM_ADDRESS 0x40
+// Set DDRAM address
+#define HD44780_CMD_SET_DDRAM_ADDRESS 0x80
+
+// Bitmask for busy flag when reading
+#define HD44780_BUSY_FLAG 0x80
+
+/**
+ * \brief Write a byte to the display.
+ *
+ * \param data The byte to send to the display.
+ * \param isData Whether the byte is an instruction or character data.
+ */
+void hd44780_write(uint8_t data, bool isData);
+
+/**
+ * \brief Read a byte from the display.
+ *
+ * \param isData Whether to read the current cursor position, or the character at the cursor.
+ *
+ * \return If `isData` is `true`, the returned byte will be the character at the current DDRAM address. Otherwise, it will be the current DDRAM address and the busy flag.
+ */
+uint8_t hd44780_read(bool isData);
+
+/**
+ * \brief Indicates whether the display is currently processing, and cannot accept instructions.
+ *
+ * \return `true` if the display is busy.
+ */
+bool hd44780_busy(void);
+
+/**
+ * \brief Send a command to the display. Refer to the datasheet for the valid commands.
+ *
+ * This function waits for the display to clear the busy flag before sending the command.
+ *
+ * \param command The command to send.
+ */
+void hd44780_command(uint8_t command);
+
+/**
+ * \brief Send a byte of data to the display.
+ *
+ * This function waits for the display to clear the busy flag before sending the data.
+ *
+ * \param data The byte of data to send.
+ */
+void hd44780_data(uint8_t data);
+
+/**
+ * \brief Clear the display.
+ *
+ * This function is called on init.
+ */
+void hd44780_clear(void);
+
+/**
+ * \brief Move the cursor to the home position.
+ *
+ * This function is called on init.
+ */
+void hd44780_home(void);
+
+/**
+ * \brief Turn the display on, and/or set the cursor position.
+ *
+ * This function is called on init.
+ *
+ * \param cursor Whether to show the cursor.
+ * \param blink Whether to blink the cursor, if shown.
+ */
+void hd44780_on(bool cursor, bool blink);
+
+/**
+ * \brief Turn the display off.
+ */
+void hd44780_off(void);
+
+/**
+ * \brief Set the CGRAM address.
+ *
+ * This function is used when defining custom characters.
+ *
+ * \param address The CGRAM address to move to, from `0x00` to `0x3F`.
+ */
+void hd44780_set_cgram_address(uint8_t address);
+
+/**
+ * \brief Set the DDRAM address.
+ *
+ * This function is used when printing characters to the display, and setting the cursor.
+ *
+ * \param address The DDRAM address to move to, from `0x00` to `0x7F`.
+ */
+void hd44780_set_ddram_address(uint8_t address);
+
+/**
+ * \brief Initialize the display.
+ *
+ * This function should be called only once, before any of the other functions can be called.
+ *
+ * \param cursor Whether to show the cursor.
+ * \param blink Whether to blink the cursor, if shown.
+ */
+void hd44780_init(bool cursor, bool blink);
+
+/**
+ * \brief Move the cursor to the specified position on the display.
+ *
+ * \param col The column number to move to, from 0 to 15 on 16x2 displays.
+ * \param line The line number to move to, either 0 or 1 on 16x2 displays.
+ */
+void hd44780_set_cursor(uint8_t col, uint8_t line);
+
+/**
+ * \brief Define a custom character.
+ *
+ * \param index The index of the custom character to define, from 0 to 7.
+ * \param data An array of 8 bytes containing the 5-bit row data of the character, where the first byte is the topmost row, and the least significant bit of each byte is the rightmost column.
+ */
+void hd44780_define_char(uint8_t index, uint8_t *data);
+
+/**
+ * \brief Print a character to the display. The newline character will move the cursor to the start of the next line.
+ *
+ * The exact character shown may depend on the ROM code of your particular display - refer to the datasheet for the full character set.
+ *
+ * \param c The character to print.
+ */
+void hd44780_putc(char c);
+
+/**
+ * \brief Print a string of characters to the display.
+ *
+ * \param s The string to print.
+ */
+void hd44780_puts(const char *s);
+
+#if defined(__AVR__) || defined(__DOXYGEN__)
+/**
+ * \brief Define a custom character from PROGMEM.
+ *
+ * On ARM devices, this function is simply an alias of hd44780_define_char().
+ *
+ * \param index The index of the custom character to define, from 0 to 7.
+ * \param data A PROGMEM array of 8 bytes containing the 5-bit row data of the character, where the first byte is the topmost row, and the least significant bit of each byte is the rightmost column.
+ */
+void hd44780_define_char_P(uint8_t index, const uint8_t *data);
+
+/**
+ * \brief Print a string of characters from PROGMEM to the display.
+ *
+ * On ARM devices, this function is simply an alias of hd44780_puts().
+ *
+ * \param s The PROGMEM string to print.
+ */
+void hd44780_puts_P(const char *s);
+#else
+# define hd44780_define_char_P(index, data) hd44780_define_char(index, data)
+# define hd44780_puts_P(s) hd44780_puts(s)
+#endif
+
+/** \} */
diff --git a/drivers/led/issi/is31fl3737.c b/drivers/led/issi/is31fl3737.c
index 9f2a13de45..bce0c34b2c 100644
--- a/drivers/led/issi/is31fl3737.c
+++ b/drivers/led/issi/is31fl3737.c
@@ -57,6 +57,10 @@
# define ISSI_PERSISTENCE 0
#endif
+#ifndef ISSI_PWM_FREQUENCY
+# define ISSI_PWM_FREQUENCY 0b000 // PFS - IS31FL3737B only
+#endif
+
#ifndef ISSI_SWPULLUP
# define ISSI_SWPULLUP PUR_0R
#endif
@@ -159,7 +163,7 @@ void IS31FL3737_init(uint8_t addr) {
// Set global current to maximum.
IS31FL3737_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
// Disable software shutdown.
- IS31FL3737_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
+ IS31FL3737_write_register(addr, ISSI_REG_CONFIGURATION, ((ISSI_PWM_FREQUENCY & 0b111) << 3) | 0x01);
// Wait 10ms to ensure the device has woken up.
wait_ms(10);
diff --git a/drivers/painter/comms/qp_comms_spi.c b/drivers/painter/comms/qp_comms_spi.c
new file mode 100644
index 0000000000..e644ba9f84
--- /dev/null
+++ b/drivers/painter/comms/qp_comms_spi.c
@@ -0,0 +1,137 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#ifdef QUANTUM_PAINTER_SPI_ENABLE
+
+# include "spi_master.h"
+# include "qp_comms_spi.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Base SPI support
+
+bool qp_comms_spi_init(painter_device_t device) {
+ struct painter_driver_t * driver = (struct painter_driver_t *)device;
+ struct qp_comms_spi_config_t *comms_config = (struct qp_comms_spi_config_t *)driver->comms_config;
+
+ // Initialize the SPI peripheral
+ spi_init();
+
+ // Set up CS as output high
+ setPinOutput(comms_config->chip_select_pin);
+ writePinHigh(comms_config->chip_select_pin);
+
+ return true;
+}
+
+bool qp_comms_spi_start(painter_device_t device) {
+ struct painter_driver_t * driver = (struct painter_driver_t *)device;
+ struct qp_comms_spi_config_t *comms_config = (struct qp_comms_spi_config_t *)driver->comms_config;
+
+ return spi_start(comms_config->chip_select_pin, comms_config->lsb_first, comms_config->mode, comms_config->divisor);
+}
+
+uint32_t qp_comms_spi_send_data(painter_device_t device, const void *data, uint32_t byte_count) {
+ uint32_t bytes_remaining = byte_count;
+ const uint8_t *p = (const uint8_t *)data;
+ while (bytes_remaining > 0) {
+ uint32_t bytes_this_loop = bytes_remaining < 1024 ? bytes_remaining : 1024;
+ spi_transmit(p, bytes_this_loop);
+ p += bytes_this_loop;
+ bytes_remaining -= bytes_this_loop;
+ }
+
+ return byte_count - bytes_remaining;
+}
+
+void qp_comms_spi_stop(painter_device_t device) {
+ struct painter_driver_t * driver = (struct painter_driver_t *)device;
+ struct qp_comms_spi_config_t *comms_config = (struct qp_comms_spi_config_t *)driver->comms_config;
+ spi_stop();
+ writePinHigh(comms_config->chip_select_pin);
+}
+
+const struct painter_comms_vtable_t spi_comms_vtable = {
+ .comms_init = qp_comms_spi_init,
+ .comms_start = qp_comms_spi_start,
+ .comms_send = qp_comms_spi_send_data,
+ .comms_stop = qp_comms_spi_stop,
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// SPI with D/C and RST pins
+
+# ifdef QUANTUM_PAINTER_SPI_DC_RESET_ENABLE
+
+bool qp_comms_spi_dc_reset_init(painter_device_t device) {
+ if (!qp_comms_spi_init(device)) {
+ return false;
+ }
+
+ struct painter_driver_t * driver = (struct painter_driver_t *)device;
+ struct qp_comms_spi_dc_reset_config_t *comms_config = (struct qp_comms_spi_dc_reset_config_t *)driver->comms_config;
+
+ // Set up D/C as output low, if specified
+ if (comms_config->dc_pin != NO_PIN) {
+ setPinOutput(comms_config->dc_pin);
+ writePinLow(comms_config->dc_pin);
+ }
+
+ // Set up RST as output, if specified, performing a reset in the process
+ if (comms_config->reset_pin != NO_PIN) {
+ setPinOutput(comms_config->reset_pin);
+ writePinLow(comms_config->reset_pin);
+ wait_ms(20);
+ writePinHigh(comms_config->reset_pin);
+ wait_ms(20);
+ }
+
+ return true;
+}
+
+uint32_t qp_comms_spi_dc_reset_send_data(painter_device_t device, const void *data, uint32_t byte_count) {
+ struct painter_driver_t * driver = (struct painter_driver_t *)device;
+ struct qp_comms_spi_dc_reset_config_t *comms_config = (struct qp_comms_spi_dc_reset_config_t *)driver->comms_config;
+ writePinHigh(comms_config->dc_pin);
+ return qp_comms_spi_send_data(device, data, byte_count);
+}
+
+void qp_comms_spi_dc_reset_send_command(painter_device_t device, uint8_t cmd) {
+ struct painter_driver_t * driver = (struct painter_driver_t *)device;
+ struct qp_comms_spi_dc_reset_config_t *comms_config = (struct qp_comms_spi_dc_reset_config_t *)driver->comms_config;
+ writePinLow(comms_config->dc_pin);
+ spi_write(cmd);
+}
+
+void qp_comms_spi_dc_reset_bulk_command_sequence(painter_device_t device, const uint8_t *sequence, size_t sequence_len) {
+ for (size_t i = 0; i < sequence_len;) {
+ uint8_t command = sequence[i];
+ uint8_t delay = sequence[i + 1];
+ uint8_t num_bytes = sequence[i + 2];
+ qp_comms_spi_dc_reset_send_command(device, command);
+ if (num_bytes > 0) {
+ qp_comms_spi_dc_reset_send_data(device, &sequence[i + 3], num_bytes);
+ }
+ if (delay > 0) {
+ wait_ms(delay);
+ }
+ i += (3 + num_bytes);
+ }
+}
+
+const struct painter_comms_with_command_vtable_t spi_comms_with_dc_vtable = {
+ .base =
+ {
+ .comms_init = qp_comms_spi_dc_reset_init,
+ .comms_start = qp_comms_spi_start,
+ .comms_send = qp_comms_spi_dc_reset_send_data,
+ .comms_stop = qp_comms_spi_stop,
+ },
+ .send_command = qp_comms_spi_dc_reset_send_command,
+ .bulk_command_sequence = qp_comms_spi_dc_reset_bulk_command_sequence,
+};
+
+# endif // QUANTUM_PAINTER_SPI_DC_RESET_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif // QUANTUM_PAINTER_SPI_ENABLE
diff --git a/drivers/painter/comms/qp_comms_spi.h b/drivers/painter/comms/qp_comms_spi.h
new file mode 100644
index 0000000000..9989987327
--- /dev/null
+++ b/drivers/painter/comms/qp_comms_spi.h
@@ -0,0 +1,51 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#ifdef QUANTUM_PAINTER_SPI_ENABLE
+
+# include <stdint.h>
+
+# include "gpio.h"
+# include "qp_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Base SPI support
+
+struct qp_comms_spi_config_t {
+ pin_t chip_select_pin;
+ uint16_t divisor;
+ bool lsb_first;
+ int8_t mode;
+};
+
+bool qp_comms_spi_init(painter_device_t device);
+bool qp_comms_spi_start(painter_device_t device);
+uint32_t qp_comms_spi_send_data(painter_device_t device, const void* data, uint32_t byte_count);
+void qp_comms_spi_stop(painter_device_t device);
+
+extern const struct painter_comms_vtable_t spi_comms_vtable;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// SPI with D/C and RST pins
+
+# ifdef QUANTUM_PAINTER_SPI_DC_RESET_ENABLE
+
+struct qp_comms_spi_dc_reset_config_t {
+ struct qp_comms_spi_config_t spi_config;
+ pin_t dc_pin;
+ pin_t reset_pin;
+};
+
+void qp_comms_spi_dc_reset_send_command(painter_device_t device, uint8_t cmd);
+uint32_t qp_comms_spi_dc_reset_send_data(painter_device_t device, const void* data, uint32_t byte_count);
+void qp_comms_spi_dc_reset_bulk_command_sequence(painter_device_t device, const uint8_t* sequence, size_t sequence_len);
+
+extern const struct painter_comms_with_command_vtable_t spi_comms_with_dc_vtable;
+
+# endif // QUANTUM_PAINTER_SPI_DC_RESET_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif // QUANTUM_PAINTER_SPI_ENABLE
diff --git a/drivers/painter/gc9a01/qp_gc9a01.c b/drivers/painter/gc9a01/qp_gc9a01.c
new file mode 100644
index 0000000000..ad76d58b07
--- /dev/null
+++ b/drivers/painter/gc9a01/qp_gc9a01.c
@@ -0,0 +1,150 @@
+// Copyright 2021 Paul Cotter (@gr1mr3aver)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <wait.h>
+#include "qp_internal.h"
+#include "qp_comms.h"
+#include "qp_gc9a01.h"
+#include "qp_gc9a01_opcodes.h"
+#include "qp_tft_panel.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Driver storage
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+tft_panel_dc_reset_painter_device_t gc9a01_drivers[GC9A01_NUM_DEVICES] = {0};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Initialization
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+bool qp_gc9a01_init(painter_device_t device, painter_rotation_t rotation) {
+ // A lot of these "unknown" opcodes are sourced from other OSS projects and are seemingly required for this display to function.
+ // clang-format off
+ const uint8_t gc9a01_init_sequence[] = {
+ // Command, Delay, N, Data[N]
+ GC9A01_SET_INTER_REG_ENABLE2, 0, 0,
+ 0xEB, 0, 1, 0x14,
+ GC9A01_SET_INTER_REG_ENABLE1, 0, 0,
+ GC9A01_SET_INTER_REG_ENABLE2, 0, 0,
+ 0xEB, 0, 1, 0x14,
+ 0x84, 0, 1, 0x40,
+ 0x85, 0, 1, 0xFF,
+ 0x86, 0, 1, 0xFF,
+ 0x87, 0, 1, 0xFF,
+ 0x88, 0, 1, 0x0A,
+ 0x89, 0, 1, 0x21,
+ 0x8a, 0, 1, 0x00,
+ 0x8b, 0, 1, 0x80,
+ 0x8c, 0, 1, 0x01,
+ 0x8d, 0, 1, 0x01,
+ 0x8e, 0, 1, 0xFF,
+ 0x8f, 0, 1, 0xFF,
+ GC9A01_SET_FUNCTION_CTL, 0, 2, 0x00, 0x20,
+ GC9A01_SET_PIX_FMT, 0, 1, 0x55,
+ 0x90, 0, 4, 0x08, 0x08, 0x08, 0x08,
+ 0xBD, 0, 1, 0x06,
+ 0xBC, 0, 1, 0x00,
+ 0xFF, 0, 3, 0x60, 0x01, 0x04,
+ GC9A01_SET_POWER_CTL_2, 0, 1, 0x13,
+ GC9A01_SET_POWER_CTL_3, 0, 1, 0x13,
+ GC9A01_SET_POWER_CTL_4, 0, 1, 0x22,
+ 0xBE, 0, 1, 0x11,
+ 0xE1, 0, 2, 0x10, 0x0E,
+ 0xDF, 0, 3, 0x21, 0x0C, 0x02,
+ GC9A01_SET_GAMMA1, 0, 6, 0x45, 0x09, 0x08, 0x08, 0x26, 0x2A,
+ GC9A01_SET_GAMMA2, 0, 6, 0x43, 0x70, 0x72, 0x36, 0x37, 0x6F,
+ GC9A01_SET_GAMMA3, 0, 6, 0x45, 0x09, 0x08, 0x08, 0x26, 0x2A,
+ GC9A01_SET_GAMMA4, 0, 6, 0x43, 0x70, 0x72, 0x36, 0x37, 0x6F,
+ 0xED, 0, 2, 0x1B, 0x0B,
+ 0xAE, 0, 1, 0x77,
+ 0xCD, 0, 1, 0x63,
+ 0x70, 0, 9, 0x07, 0x07, 0x04, 0x0E, 0x0F, 0x09, 0x07, 0x08, 0x03,
+ GC9A01_SET_FRAME_RATE, 0, 1, 0x34,
+ 0x62, 0, 12, 0x18, 0x0D, 0x71, 0xED, 0x70, 0x70, 0x18, 0x0F, 0x71, 0xEF, 0x70, 0x70,
+ 0x63, 0, 12, 0x18, 0x11, 0x71, 0xF1, 0x70, 0x70, 0x18, 0x13, 0x71, 0xF3, 0x70, 0x70,
+ 0x64, 0, 7, 0x28, 0x29, 0xF1, 0x01, 0xF1, 0x00, 0x07,
+ 0x66, 0, 10, 0x3C, 0x00, 0xCD, 0x67, 0x45, 0x45, 0x10, 0x00, 0x00, 0x00,
+ 0x67, 0, 10, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x54, 0x10, 0x32, 0x98,
+ 0x74, 0, 7, 0x10, 0x85, 0x80, 0x00, 0x00, 0x4E, 0x00,
+ 0x98, 0, 2, 0x3E, 0x07,
+ GC9A01_CMD_TEARING_OFF, 0, 0,
+ GC9A01_CMD_INVERT_OFF, 0, 0,
+ GC9A01_CMD_SLEEP_OFF, 120, 0,
+ GC9A01_CMD_DISPLAY_ON, 20, 0
+ };
+ // clang-format on
+
+ // clang-format on
+ qp_comms_bulk_command_sequence(device, gc9a01_init_sequence, sizeof(gc9a01_init_sequence));
+
+ // Configure the rotation (i.e. the ordering and direction of memory writes in GRAM)
+ const uint8_t madctl[] = {
+ [QP_ROTATION_0] = GC9A01_MADCTL_BGR,
+ [QP_ROTATION_90] = GC9A01_MADCTL_BGR | GC9A01_MADCTL_MX | GC9A01_MADCTL_MV,
+ [QP_ROTATION_180] = GC9A01_MADCTL_BGR | GC9A01_MADCTL_MX | GC9A01_MADCTL_MY,
+ [QP_ROTATION_270] = GC9A01_MADCTL_BGR | GC9A01_MADCTL_MV | GC9A01_MADCTL_MY,
+ };
+ qp_comms_command_databyte(device, GC9A01_SET_MEM_ACS_CTL, madctl[rotation]);
+
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Driver vtable
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+const struct tft_panel_dc_reset_painter_driver_vtable_t gc9a01_driver_vtable = {
+ .base =
+ {
+ .init = qp_gc9a01_init,
+ .power = qp_tft_panel_power,
+ .clear = qp_tft_panel_clear,
+ .flush = qp_tft_panel_flush,
+ .pixdata = qp_tft_panel_pixdata,
+ .viewport = qp_tft_panel_viewport,
+ .palette_convert = qp_tft_panel_palette_convert,
+ .append_pixels = qp_tft_panel_append_pixels,
+ },
+ .rgb888_to_native16bit = qp_rgb888_to_rgb565_swapped,
+ .num_window_bytes = 2,
+ .swap_window_coords = false,
+ .opcodes =
+ {
+ .display_on = GC9A01_CMD_DISPLAY_ON,
+ .display_off = GC9A01_CMD_DISPLAY_OFF,
+ .set_column_address = GC9A01_SET_COL_ADDR,
+ .set_row_address = GC9A01_SET_PAGE_ADDR,
+ .enable_writes = GC9A01_SET_MEM,
+ },
+};
+
+#ifdef QUANTUM_PAINTER_GC9A01_SPI_ENABLE
+// Factory function for creating a handle to the ILI9341 device
+painter_device_t qp_gc9a01_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode) {
+ for (uint32_t i = 0; i < GC9A01_NUM_DEVICES; ++i) {
+ tft_panel_dc_reset_painter_device_t *driver = &gc9a01_drivers[i];
+ if (!driver->base.driver_vtable) {
+ driver->base.driver_vtable = (const struct painter_driver_vtable_t *)&gc9a01_driver_vtable;
+ driver->base.comms_vtable = (const struct painter_comms_vtable_t *)&spi_comms_with_dc_vtable;
+ driver->base.native_bits_per_pixel = 16; // RGB565
+ driver->base.panel_width = panel_width;
+ driver->base.panel_height = panel_height;
+ driver->base.rotation = QP_ROTATION_0;
+ driver->base.offset_x = 0;
+ driver->base.offset_y = 0;
+
+ // SPI and other pin configuration
+ driver->base.comms_config = &driver->spi_dc_reset_config;
+ driver->spi_dc_reset_config.spi_config.chip_select_pin = chip_select_pin;
+ driver->spi_dc_reset_config.spi_config.divisor = spi_divisor;
+ driver->spi_dc_reset_config.spi_config.lsb_first = false;
+ driver->spi_dc_reset_config.spi_config.mode = spi_mode;
+ driver->spi_dc_reset_config.dc_pin = dc_pin;
+ driver->spi_dc_reset_config.reset_pin = reset_pin;
+ return (painter_device_t)driver;
+ }
+ }
+ return NULL;
+}
+
+#endif // QUANTUM_PAINTER_GC9A01_SPI_ENABLE
diff --git a/drivers/painter/gc9a01/qp_gc9a01.h b/drivers/painter/gc9a01/qp_gc9a01.h
new file mode 100644
index 0000000000..e2b1939564
--- /dev/null
+++ b/drivers/painter/gc9a01/qp_gc9a01.h
@@ -0,0 +1,37 @@
+// Copyright 2021 Paul Cotter (@gr1mr3aver)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "gpio.h"
+#include "qp_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter GC9A01 configurables (add to your keyboard's config.h)
+
+#ifndef GC9A01_NUM_DEVICES
+/**
+ * @def This controls the maximum number of GC9A01 devices that Quantum Painter can communicate with at any one time.
+ * Increasing this number allows for multiple displays to be used.
+ */
+# define GC9A01_NUM_DEVICES 1
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter GC9A01 device factories
+
+#ifdef QUANTUM_PAINTER_GC9A01_SPI_ENABLE
+/**
+ * Factory method for an GC9A01 SPI LCD device.
+ *
+ * @param panel_width[in] the width of the display panel
+ * @param panel_height[in] the height of the display panel
+ * @param chip_select_pin[in] the GPIO pin used for SPI chip select
+ * @param dc_pin[in] the GPIO pin used for D/C control
+ * @param reset_pin[in] the GPIO pin used for RST
+ * @param spi_divisor[in] the SPI divisor to use when communicating with the display
+ * @param spi_mode[in] the SPI mode to use when communicating with the display
+ * @return the device handle used with all drawing routines in Quantum Painter
+ */
+painter_device_t qp_gc9a01_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode);
+#endif // QUANTUM_PAINTER_GC9A01_SPI_ENABLE
diff --git a/drivers/painter/gc9a01/qp_gc9a01_opcodes.h b/drivers/painter/gc9a01/qp_gc9a01_opcodes.h
new file mode 100644
index 0000000000..6ff4efe7a8
--- /dev/null
+++ b/drivers/painter/gc9a01/qp_gc9a01_opcodes.h
@@ -0,0 +1,78 @@
+// Copyright 2021 Paul Cotter (@gr1mr3aver)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter GC9A01 command opcodes
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Level 1 command opcodes
+
+#define GC9A01_GET_ID_INFO 0x04 // Get ID information
+#define GC9A01_GET_STATUS 0x09 // Get status
+#define GC9A01_CMD_SLEEP_ON 0x10 // Enter sleep mode
+#define GC9A01_CMD_SLEEP_OFF 0x11 // Exit sleep mode
+#define GC9A01_CMD_PARTIAL_ON 0x12 // Enter partial mode
+#define GC9A01_CMD_PARTIAL_OFF 0x13 // Exit partial mode
+#define GC9A01_CMD_INVERT_ON 0x20 // Enter inverted mode
+#define GC9A01_CMD_INVERT_OFF 0x21 // Exit inverted mode
+#define GC9A01_CMD_DISPLAY_OFF 0x28 // Disable display
+#define GC9A01_CMD_DISPLAY_ON 0x29 // Enable display
+#define GC9A01_SET_COL_ADDR 0x2A // Set column address
+#define GC9A01_SET_PAGE_ADDR 0x2B // Set page address
+#define GC9A01_SET_MEM 0x2C // Set memory
+#define GC9A01_SET_PARTIAL_AREA 0x30 // Set partial area
+#define GC9A01_SET_VSCROLL 0x33 // Set vertical scroll def
+#define GC9A01_CMD_TEARING_ON 0x34 // Tearing line enabled
+#define GC9A01_CMD_TEARING_OFF 0x35 // Tearing line disabled
+#define GC9A01_SET_MEM_ACS_CTL 0x36 // Set mem access ctl
+#define GC9A01_SET_VSCROLL_ADDR 0x37 // Set vscroll start addr
+#define GC9A01_CMD_IDLE_OFF 0x38 // Exit idle mode
+#define GC9A01_CMD_IDLE_ON 0x39 // Enter idle mode
+#define GC9A01_SET_PIX_FMT 0x3A // Set pixel format
+#define GC9A01_SET_MEM_CONT 0x3C // Set memory continue
+#define GC9A01_SET_TEAR_SCANLINE 0x44 // Set tearing scanline
+#define GC9A01_GET_TEAR_SCANLINE 0x45 // Get tearing scanline
+#define GC9A01_SET_BRIGHTNESS 0x51 // Set brightness
+#define GC9A01_SET_DISPLAY_CTL 0x53 // Set display ctl
+#define GC9A01_GET_ID1 0xDA // Get ID1
+#define GC9A01_GET_ID2 0xDB // Get ID2
+#define GC9A01_GET_ID3 0xDC // Get ID3
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Level 2 command opcodes
+
+#define GC9A01_SET_RGB_IF_SIG_CTL 0xB0 // RGB IF signal ctl
+#define GC9A01_SET_BLANKING_PORCH_CTL 0xB5 // Set blanking porch ctl
+#define GC9A01_SET_FUNCTION_CTL 0xB6 // Set function ctl
+#define GC9A01_SET_TEARING_EFFECT 0xBA // Set backlight ctl 3
+#define GC9A01_SET_IF_CTL 0xF6 // Set interface control
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Level 3 command opcodes
+
+#define GC9A01_SET_FRAME_RATE 0xE8 // Set frame rate
+#define GC9A01_SET_SPI_2DATA 0xE9 // Set frame rate
+#define GC9A01_SET_POWER_CTL_1 0xC1 // Set power ctl 1
+#define GC9A01_SET_POWER_CTL_2 0xC3 // Set power ctl 2
+#define GC9A01_SET_POWER_CTL_3 0xC4 // Set power ctl 3
+#define GC9A01_SET_POWER_CTL_4 0xC9 // Set power ctl 4
+#define GC9A01_SET_POWER_CTL_7 0xA7 // Set power ctl 7
+#define GC9A01_SET_INTER_REG_ENABLE1 0xFE // Enable Inter Register 1
+#define GC9A01_SET_INTER_REG_ENABLE2 0xEF // Enable Inter Register 2
+#define GC9A01_SET_GAMMA1 0xF0 //
+#define GC9A01_SET_GAMMA2 0xF1
+#define GC9A01_SET_GAMMA3 0xF2
+#define GC9A01_SET_GAMMA4 0xF3
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// MADCTL Flags
+#define GC9A01_MADCTL_MY 0b10000000
+#define GC9A01_MADCTL_MX 0b01000000
+#define GC9A01_MADCTL_MV 0b00100000
+#define GC9A01_MADCTL_ML 0b00010000
+#define GC9A01_MADCTL_RGB 0b00000000
+#define GC9A01_MADCTL_BGR 0b00001000
+#define GC9A01_MADCTL_MH 0b00000100
diff --git a/drivers/painter/ili9xxx/qp_ili9163.c b/drivers/painter/ili9xxx/qp_ili9163.c
new file mode 100644
index 0000000000..beaac0fbb5
--- /dev/null
+++ b/drivers/painter/ili9xxx/qp_ili9163.c
@@ -0,0 +1,121 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "qp_internal.h"
+#include "qp_comms.h"
+#include "qp_ili9163.h"
+#include "qp_ili9xxx_opcodes.h"
+#include "qp_tft_panel.h"
+
+#ifdef QUANTUM_PAINTER_ILI9163_SPI_ENABLE
+# include "qp_comms_spi.h"
+#endif // QUANTUM_PAINTER_ILI9163_SPI_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Common
+
+// Driver storage
+tft_panel_dc_reset_painter_device_t ili9163_drivers[ILI9163_NUM_DEVICES] = {0};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Initialization
+
+bool qp_ili9163_init(painter_device_t device, painter_rotation_t rotation) {
+ // clang-format off
+ const uint8_t ili9163_init_sequence[] = {
+ // Command, Delay, N, Data[N]
+ ILI9XXX_CMD_RESET, 120, 0,
+ ILI9XXX_CMD_SLEEP_OFF, 5, 0,
+ ILI9XXX_SET_PIX_FMT, 0, 1, 0x55,
+ ILI9XXX_SET_GAMMA, 0, 1, 0x04,
+ ILI9XXX_ENABLE_3_GAMMA, 0, 1, 0x01,
+ ILI9XXX_SET_FUNCTION_CTL, 0, 2, 0xFF, 0x06,
+ ILI9XXX_SET_PGAMMA, 0, 15, 0x36, 0x29, 0x12, 0x22, 0x1C, 0x15, 0x42, 0xB7, 0x2F, 0x13, 0x12, 0x0A, 0x11, 0x0B, 0x06,
+ ILI9XXX_SET_NGAMMA, 0, 15, 0x09, 0x16, 0x2D, 0x0D, 0x13, 0x15, 0x40, 0x48, 0x53, 0x0C, 0x1D, 0x25, 0x2E, 0x34, 0x39,
+ ILI9XXX_SET_FRAME_CTL_NORMAL, 0, 2, 0x08, 0x02,
+ ILI9XXX_SET_POWER_CTL_1, 0, 2, 0x0A, 0x02,
+ ILI9XXX_SET_POWER_CTL_2, 0, 1, 0x02,
+ ILI9XXX_SET_VCOM_CTL_1, 0, 2, 0x50, 0x63,
+ ILI9XXX_SET_VCOM_CTL_2, 0, 1, 0x00,
+ ILI9XXX_CMD_PARTIAL_OFF, 0, 0,
+ ILI9XXX_CMD_DISPLAY_ON, 20, 0
+ };
+ // clang-format on
+ qp_comms_bulk_command_sequence(device, ili9163_init_sequence, sizeof(ili9163_init_sequence));
+
+ // Configure the rotation (i.e. the ordering and direction of memory writes in GRAM)
+ const uint8_t madctl[] = {
+ [QP_ROTATION_0] = ILI9XXX_MADCTL_BGR,
+ [QP_ROTATION_90] = ILI9XXX_MADCTL_BGR | ILI9XXX_MADCTL_MX | ILI9XXX_MADCTL_MV,
+ [QP_ROTATION_180] = ILI9XXX_MADCTL_BGR | ILI9XXX_MADCTL_MX | ILI9XXX_MADCTL_MY,
+ [QP_ROTATION_270] = ILI9XXX_MADCTL_BGR | ILI9XXX_MADCTL_MV | ILI9XXX_MADCTL_MY,
+ };
+ qp_comms_command_databyte(device, ILI9XXX_SET_MEM_ACS_CTL, madctl[rotation]);
+
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Driver vtable
+
+const struct tft_panel_dc_reset_painter_driver_vtable_t ili9163_driver_vtable = {
+ .base =
+ {
+ .init = qp_ili9163_init,
+ .power = qp_tft_panel_power,
+ .clear = qp_tft_panel_clear,
+ .flush = qp_tft_panel_flush,
+ .pixdata = qp_tft_panel_pixdata,
+ .viewport = qp_tft_panel_viewport,
+ .palette_convert = qp_tft_panel_palette_convert,
+ .append_pixels = qp_tft_panel_append_pixels,
+ },
+ .rgb888_to_native16bit = qp_rgb888_to_rgb565_swapped,
+ .num_window_bytes = 2,
+ .swap_window_coords = false,
+ .opcodes =
+ {
+ .display_on = ILI9XXX_CMD_DISPLAY_ON,
+ .display_off = ILI9XXX_CMD_DISPLAY_OFF,
+ .set_column_address = ILI9XXX_SET_COL_ADDR,
+ .set_row_address = ILI9XXX_SET_PAGE_ADDR,
+ .enable_writes = ILI9XXX_SET_MEM,
+ },
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// SPI
+
+#ifdef QUANTUM_PAINTER_ILI9163_SPI_ENABLE
+
+// Factory function for creating a handle to the ILI9163 device
+painter_device_t qp_ili9163_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode) {
+ for (uint32_t i = 0; i < ILI9163_NUM_DEVICES; ++i) {
+ tft_panel_dc_reset_painter_device_t *driver = &ili9163_drivers[i];
+ if (!driver->base.driver_vtable) {
+ driver->base.driver_vtable = (const struct painter_driver_vtable_t *)&ili9163_driver_vtable;
+ driver->base.comms_vtable = (const struct painter_comms_vtable_t *)&spi_comms_with_dc_vtable;
+ driver->base.panel_width = panel_width;
+ driver->base.panel_height = panel_height;
+ driver->base.rotation = QP_ROTATION_0;
+ driver->base.offset_x = 0;
+ driver->base.offset_y = 0;
+ driver->base.native_bits_per_pixel = 16; // RGB565
+
+ // SPI and other pin configuration
+ driver->base.comms_config = &driver->spi_dc_reset_config;
+ driver->spi_dc_reset_config.spi_config.chip_select_pin = chip_select_pin;
+ driver->spi_dc_reset_config.spi_config.divisor = spi_divisor;
+ driver->spi_dc_reset_config.spi_config.lsb_first = false;
+ driver->spi_dc_reset_config.spi_config.mode = spi_mode;
+ driver->spi_dc_reset_config.dc_pin = dc_pin;
+ driver->spi_dc_reset_config.reset_pin = reset_pin;
+ return (painter_device_t)driver;
+ }
+ }
+ return NULL;
+}
+
+#endif // QUANTUM_PAINTER_ILI9163_SPI_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/drivers/painter/ili9xxx/qp_ili9163.h b/drivers/painter/ili9xxx/qp_ili9163.h
new file mode 100644
index 0000000000..88d23629a9
--- /dev/null
+++ b/drivers/painter/ili9xxx/qp_ili9163.h
@@ -0,0 +1,37 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "gpio.h"
+#include "qp_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter ILI9163 configurables (add to your keyboard's config.h)
+
+#ifndef ILI9163_NUM_DEVICES
+/**
+ * @def This controls the maximum number of ILI9163 devices that Quantum Painter can communicate with at any one time.
+ * Increasing this number allows for multiple displays to be used.
+ */
+# define ILI9163_NUM_DEVICES 1
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter ILI9163 device factories
+
+#ifdef QUANTUM_PAINTER_ILI9163_SPI_ENABLE
+/**
+ * Factory method for an ILI9163 SPI LCD device.
+ *
+ * @param panel_width[in] the width of the display panel
+ * @param panel_height[in] the height of the display panel
+ * @param chip_select_pin[in] the GPIO pin used for SPI chip select
+ * @param dc_pin[in] the GPIO pin used for D/C control
+ * @param reset_pin[in] the GPIO pin used for RST
+ * @param spi_divisor[in] the SPI divisor to use when communicating with the display
+ * @param spi_mode[in] the SPI mode to use when communicating with the display
+ * @return the device handle used with all drawing routines in Quantum Painter
+ */
+painter_device_t qp_ili9163_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode);
+#endif // QUANTUM_PAINTER_ILI9163_SPI_ENABLE
diff --git a/drivers/painter/ili9xxx/qp_ili9341.c b/drivers/painter/ili9xxx/qp_ili9341.c
new file mode 100644
index 0000000000..1f41dcfc0b
--- /dev/null
+++ b/drivers/painter/ili9xxx/qp_ili9341.c
@@ -0,0 +1,128 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "qp_internal.h"
+#include "qp_comms.h"
+#include "qp_ili9341.h"
+#include "qp_ili9xxx_opcodes.h"
+#include "qp_tft_panel.h"
+
+#ifdef QUANTUM_PAINTER_ILI9341_SPI_ENABLE
+# include <qp_comms_spi.h>
+#endif // QUANTUM_PAINTER_ILI9341_SPI_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Common
+
+// Driver storage
+tft_panel_dc_reset_painter_device_t ili9341_drivers[ILI9341_NUM_DEVICES] = {0};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Initialization
+
+bool qp_ili9341_init(painter_device_t device, painter_rotation_t rotation) {
+ // clang-format off
+ const uint8_t ili9341_init_sequence[] = {
+ // Command, Delay, N, Data[N]
+ ILI9XXX_CMD_RESET, 120, 0,
+ ILI9XXX_CMD_SLEEP_OFF, 5, 0,
+ ILI9XXX_POWER_CTL_A, 0, 5, 0x39, 0x2C, 0x00, 0x34, 0x02,
+ ILI9XXX_POWER_CTL_B, 0, 3, 0x00, 0xD9, 0x30,
+ ILI9XXX_POWER_ON_SEQ_CTL, 0, 4, 0x64, 0x03, 0x12, 0x81,
+ ILI9XXX_SET_PUMP_RATIO_CTL, 0, 1, 0x20,
+ ILI9XXX_SET_POWER_CTL_1, 0, 1, 0x26,
+ ILI9XXX_SET_POWER_CTL_2, 0, 1, 0x11,
+ ILI9XXX_SET_VCOM_CTL_1, 0, 2, 0x35, 0x3E,
+ ILI9XXX_SET_VCOM_CTL_2, 0, 1, 0xBE,
+ ILI9XXX_DRV_TIMING_CTL_A, 0, 3, 0x85, 0x10, 0x7A,
+ ILI9XXX_DRV_TIMING_CTL_B, 0, 2, 0x00, 0x00,
+ ILI9XXX_SET_BRIGHTNESS, 0, 1, 0xFF,
+ ILI9XXX_ENABLE_3_GAMMA, 0, 1, 0x00,
+ ILI9XXX_SET_GAMMA, 0, 1, 0x01,
+ ILI9XXX_SET_PGAMMA, 0, 15, 0x0F, 0x29, 0x24, 0x0C, 0x0E, 0x09, 0x4E, 0x78, 0x3C, 0x09, 0x13, 0x05, 0x17, 0x11, 0x00,
+ ILI9XXX_SET_NGAMMA, 0, 15, 0x00, 0x16, 0x1B, 0x04, 0x11, 0x07, 0x31, 0x33, 0x42, 0x05, 0x0C, 0x0A, 0x28, 0x2F, 0x0F,
+ ILI9XXX_SET_PIX_FMT, 0, 1, 0x05,
+ ILI9XXX_SET_FRAME_CTL_NORMAL, 0, 2, 0x00, 0x1B,
+ ILI9XXX_SET_FUNCTION_CTL, 0, 2, 0x0A, 0xA2,
+ ILI9XXX_CMD_PARTIAL_OFF, 0, 0,
+ ILI9XXX_CMD_DISPLAY_ON, 20, 0
+ };
+ // clang-format on
+ qp_comms_bulk_command_sequence(device, ili9341_init_sequence, sizeof(ili9341_init_sequence));
+
+ // Configure the rotation (i.e. the ordering and direction of memory writes in GRAM)
+ const uint8_t madctl[] = {
+ [QP_ROTATION_0] = ILI9XXX_MADCTL_BGR,
+ [QP_ROTATION_90] = ILI9XXX_MADCTL_BGR | ILI9XXX_MADCTL_MX | ILI9XXX_MADCTL_MV,
+ [QP_ROTATION_180] = ILI9XXX_MADCTL_BGR | ILI9XXX_MADCTL_MX | ILI9XXX_MADCTL_MY,
+ [QP_ROTATION_270] = ILI9XXX_MADCTL_BGR | ILI9XXX_MADCTL_MV | ILI9XXX_MADCTL_MY,
+ };
+ qp_comms_command_databyte(device, ILI9XXX_SET_MEM_ACS_CTL, madctl[rotation]);
+
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Driver vtable
+
+const struct tft_panel_dc_reset_painter_driver_vtable_t ili9341_driver_vtable = {
+ .base =
+ {
+ .init = qp_ili9341_init,
+ .power = qp_tft_panel_power,
+ .clear = qp_tft_panel_clear,
+ .flush = qp_tft_panel_flush,
+ .pixdata = qp_tft_panel_pixdata,
+ .viewport = qp_tft_panel_viewport,
+ .palette_convert = qp_tft_panel_palette_convert,
+ .append_pixels = qp_tft_panel_append_pixels,
+ },
+ .rgb888_to_native16bit = qp_rgb888_to_rgb565_swapped,
+ .num_window_bytes = 2,
+ .swap_window_coords = false,
+ .opcodes =
+ {
+ .display_on = ILI9XXX_CMD_DISPLAY_ON,
+ .display_off = ILI9XXX_CMD_DISPLAY_OFF,
+ .set_column_address = ILI9XXX_SET_COL_ADDR,
+ .set_row_address = ILI9XXX_SET_PAGE_ADDR,
+ .enable_writes = ILI9XXX_SET_MEM,
+ },
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// SPI
+
+#ifdef QUANTUM_PAINTER_ILI9341_SPI_ENABLE
+
+// Factory function for creating a handle to the ILI9341 device
+painter_device_t qp_ili9341_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode) {
+ for (uint32_t i = 0; i < ILI9341_NUM_DEVICES; ++i) {
+ tft_panel_dc_reset_painter_device_t *driver = &ili9341_drivers[i];
+ if (!driver->base.driver_vtable) {
+ driver->base.driver_vtable = (const struct painter_driver_vtable_t *)&ili9341_driver_vtable;
+ driver->base.comms_vtable = (const struct painter_comms_vtable_t *)&spi_comms_with_dc_vtable;
+ driver->base.native_bits_per_pixel = 16; // RGB565
+ driver->base.panel_width = panel_width;
+ driver->base.panel_height = panel_height;
+ driver->base.rotation = QP_ROTATION_0;
+ driver->base.offset_x = 0;
+ driver->base.offset_y = 0;
+
+ // SPI and other pin configuration
+ driver->base.comms_config = &driver->spi_dc_reset_config;
+ driver->spi_dc_reset_config.spi_config.chip_select_pin = chip_select_pin;
+ driver->spi_dc_reset_config.spi_config.divisor = spi_divisor;
+ driver->spi_dc_reset_config.spi_config.lsb_first = false;
+ driver->spi_dc_reset_config.spi_config.mode = spi_mode;
+ driver->spi_dc_reset_config.dc_pin = dc_pin;
+ driver->spi_dc_reset_config.reset_pin = reset_pin;
+ return (painter_device_t)driver;
+ }
+ }
+ return NULL;
+}
+
+#endif // QUANTUM_PAINTER_ILI9341_SPI_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/drivers/painter/ili9xxx/qp_ili9341.h b/drivers/painter/ili9xxx/qp_ili9341.h
new file mode 100644
index 0000000000..28b0152a84
--- /dev/null
+++ b/drivers/painter/ili9xxx/qp_ili9341.h
@@ -0,0 +1,37 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "gpio.h"
+#include "qp_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter ILI9341 configurables (add to your keyboard's config.h)
+
+#ifndef ILI9341_NUM_DEVICES
+/**
+ * @def This controls the maximum number of ILI9341 devices that Quantum Painter can communicate with at any one time.
+ * Increasing this number allows for multiple displays to be used.
+ */
+# define ILI9341_NUM_DEVICES 1
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter ILI9341 device factories
+
+#ifdef QUANTUM_PAINTER_ILI9341_SPI_ENABLE
+/**
+ * Factory method for an ILI9341 SPI LCD device.
+ *
+ * @param panel_width[in] the width of the display panel
+ * @param panel_height[in] the height of the display panel
+ * @param chip_select_pin[in] the GPIO pin used for SPI chip select
+ * @param dc_pin[in] the GPIO pin used for D/C control
+ * @param reset_pin[in] the GPIO pin used for RST
+ * @param spi_divisor[in] the SPI divisor to use when communicating with the display
+ * @param spi_mode[in] the SPI mode to use when communicating with the display
+ * @return the device handle used with all drawing routines in Quantum Painter
+ */
+painter_device_t qp_ili9341_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode);
+#endif // QUANTUM_PAINTER_ILI9341_SPI_ENABLE
diff --git a/drivers/painter/ili9xxx/qp_ili9xxx_opcodes.h b/drivers/painter/ili9xxx/qp_ili9xxx_opcodes.h
new file mode 100644
index 0000000000..1fa395cb89
--- /dev/null
+++ b/drivers/painter/ili9xxx/qp_ili9xxx_opcodes.h
@@ -0,0 +1,100 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter ILI9xxx command opcodes
+#define ILI9XXX_CMD_NOP 0x00 // No operation
+#define ILI9XXX_CMD_RESET 0x01 // Software reset
+#define ILI9XXX_GET_ID_INFO 0x04 // Get ID information
+#define ILI9XXX_GET_STATUS 0x09 // Get status
+#define ILI9XXX_GET_PWR_MODE 0x0A // Get power mode
+#define ILI9XXX_GET_MADCTL 0x0B // Get MADCTL
+#define ILI9XXX_GET_PIX_FMT 0x0C // Get pixel format
+#define ILI9XXX_GET_IMG_FMT 0x0D // Get image format
+#define ILI9XXX_GET_SIG_MODE 0x0E // Get signal mode
+#define ILI9XXX_GET_SELF_DIAG 0x0F // Get self-diagnostics
+#define ILI9XXX_CMD_SLEEP_ON 0x10 // Enter sleep mode
+#define ILI9XXX_CMD_SLEEP_OFF 0x11 // Exist sleep mode
+#define ILI9XXX_CMD_PARTIAL_ON 0x12 // Enter partial mode
+#define ILI9XXX_CMD_PARTIAL_OFF 0x13 // Exit partial mode
+#define ILI9XXX_CMD_INVERT_ON 0x20 // Enter inverted mode
+#define ILI9XXX_CMD_INVERT_OFF 0x21 // Exit inverted mode
+#define ILI9XXX_SET_GAMMA 0x26 // Set gamma params
+#define ILI9XXX_CMD_DISPLAY_OFF 0x28 // Disable display
+#define ILI9XXX_CMD_DISPLAY_ON 0x29 // Enable display
+#define ILI9XXX_SET_COL_ADDR 0x2A // Set column address
+#define ILI9XXX_SET_PAGE_ADDR 0x2B // Set page address
+#define ILI9XXX_SET_MEM 0x2C // Set memory
+#define ILI9XXX_SET_COLOR 0x2D // Set color
+#define ILI9XXX_GET_MEM 0x2E // Get memory
+#define ILI9XXX_SET_PARTIAL_AREA 0x30 // Set partial area
+#define ILI9XXX_SET_VSCROLL 0x33 // Set vertical scroll def
+#define ILI9XXX_CMD_TEARING_ON 0x34 // Tearing line enabled
+#define ILI9XXX_CMD_TEARING_OFF 0x35 // Tearing line disabled
+#define ILI9XXX_SET_MEM_ACS_CTL 0x36 // Set mem access ctl
+#define ILI9XXX_SET_VSCROLL_ADDR 0x37 // Set vscroll start addr
+#define ILI9XXX_CMD_IDLE_OFF 0x38 // Exit idle mode
+#define ILI9XXX_CMD_IDLE_ON 0x39 // Enter idle mode
+#define ILI9XXX_SET_PIX_FMT 0x3A // Set pixel format
+#define ILI9XXX_SET_MEM_CONT 0x3C // Set memory continue
+#define ILI9XXX_GET_MEM_CONT 0x3E // Get memory continue
+#define ILI9XXX_SET_TEAR_SCANLINE 0x44 // Set tearing scanline
+#define ILI9XXX_GET_TEAR_SCANLINE 0x45 // Get tearing scanline
+#define ILI9XXX_SET_BRIGHTNESS 0x51 // Set brightness
+#define ILI9XXX_GET_BRIGHTNESS 0x52 // Get brightness
+#define ILI9XXX_SET_DISPLAY_CTL 0x53 // Set display ctl
+#define ILI9XXX_GET_DISPLAY_CTL 0x54 // Get display ctl
+#define ILI9XXX_SET_CABC 0x55 // Set CABC
+#define ILI9XXX_GET_CABC 0x56 // Get CABC
+#define ILI9XXX_SET_CABC_MIN 0x5E // Set CABC min
+#define ILI9XXX_GET_CABC_MIN 0x5F // Set CABC max
+#define ILI9XXX_GET_ID1 0xDA // Get ID1
+#define ILI9XXX_GET_ID2 0xDB // Get ID2
+#define ILI9XXX_GET_ID3 0xDC // Get ID3
+#define ILI9XXX_SET_RGB_IF_SIG_CTL 0xB0 // RGB IF signal ctl
+#define ILI9XXX_SET_FRAME_CTL_NORMAL 0xB1 // Set frame ctl (normal)
+#define ILI9XXX_SET_FRAME_CTL_IDLE 0xB2 // Set frame ctl (idle)
+#define ILI9XXX_SET_FRAME_CTL_PARTIAL 0xB3 // Set frame ctl (partial)
+#define ILI9XXX_SET_INVERSION_CTL 0xB4 // Set inversion ctl
+#define ILI9XXX_SET_BLANKING_PORCH_CTL 0xB5 // Set blanking porch ctl
+#define ILI9XXX_SET_FUNCTION_CTL 0xB6 // Set function ctl
+#define ILI9XXX_SET_ENTRY_MODE 0xB7 // Set entry mode
+#define ILI9XXX_SET_LIGHT_CTL_1 0xB8 // Set backlight ctl 1
+#define ILI9XXX_SET_LIGHT_CTL_2 0xB9 // Set backlight ctl 2
+#define ILI9XXX_SET_LIGHT_CTL_3 0xBA // Set backlight ctl 3
+#define ILI9XXX_SET_LIGHT_CTL_4 0xBB // Set backlight ctl 4
+#define ILI9XXX_SET_LIGHT_CTL_5 0xBC // Set backlight ctl 5
+#define ILI9XXX_SET_LIGHT_CTL_7 0xBE // Set backlight ctl 7
+#define ILI9XXX_SET_LIGHT_CTL_8 0xBF // Set backlight ctl 8
+#define ILI9XXX_SET_POWER_CTL_1 0xC0 // Set power ctl 1
+#define ILI9XXX_SET_POWER_CTL_2 0xC1 // Set power ctl 2
+#define ILI9XXX_SET_VCOM_CTL_1 0xC5 // Set VCOM ctl 1
+#define ILI9XXX_SET_VCOM_CTL_2 0xC7 // Set VCOM ctl 2
+#define ILI9XXX_POWER_CTL_A 0xCB // Set power control A
+#define ILI9XXX_POWER_CTL_B 0xCF // Set power control B
+#define ILI9XXX_DRV_TIMING_CTL_A 0xE8 // Set driver timing control A
+#define ILI9XXX_DRV_TIMING_CTL_B 0xEA // Set driver timing control B
+#define ILI9XXX_POWER_ON_SEQ_CTL 0xED // Set Power on sequence control
+#define ILI9XXX_SET_NVMEM 0xD0 // Set NVMEM data
+#define ILI9XXX_GET_NVMEM_KEY 0xD1 // Get NVMEM protect key
+#define ILI9XXX_GET_NVMEM_STATUS 0xD2 // Get NVMEM status
+#define ILI9XXX_GET_ID4 0xD3 // Get ID4
+#define ILI9XXX_SET_PGAMMA 0xE0 // Set positive gamma
+#define ILI9XXX_SET_NGAMMA 0xE1 // Set negative gamma
+#define ILI9XXX_SET_DGAMMA_CTL_1 0xE2 // Set digital gamma ctl 1
+#define ILI9XXX_SET_DGAMMA_CTL_2 0xE3 // Set digital gamma ctl 2
+#define ILI9XXX_ENABLE_3_GAMMA 0xF2 // Enable 3 gamma
+#define ILI9XXX_SET_IF_CTL 0xF6 // Set interface control
+#define ILI9XXX_SET_PUMP_RATIO_CTL 0xF7 // Set pump ratio control
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// MADCTL Flags
+#define ILI9XXX_MADCTL_MY 0b10000000
+#define ILI9XXX_MADCTL_MX 0b01000000
+#define ILI9XXX_MADCTL_MV 0b00100000
+#define ILI9XXX_MADCTL_ML 0b00010000
+#define ILI9XXX_MADCTL_RGB 0b00000000
+#define ILI9XXX_MADCTL_BGR 0b00001000
+#define ILI9XXX_MADCTL_MH 0b00000100
diff --git a/drivers/painter/ssd1351/qp_ssd1351.c b/drivers/painter/ssd1351/qp_ssd1351.c
new file mode 100644
index 0000000000..970e7e67f3
--- /dev/null
+++ b/drivers/painter/ssd1351/qp_ssd1351.c
@@ -0,0 +1,125 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "qp_internal.h"
+#include "qp_comms.h"
+#include "qp_ssd1351.h"
+#include "qp_ssd1351_opcodes.h"
+#include "qp_tft_panel.h"
+
+#ifdef QUANTUM_PAINTER_SSD1351_SPI_ENABLE
+# include "qp_comms_spi.h"
+#endif // QUANTUM_PAINTER_SSD1351_SPI_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Common
+
+// Driver storage
+tft_panel_dc_reset_painter_device_t ssd1351_drivers[SSD1351_NUM_DEVICES] = {0};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Initialization
+
+bool qp_ssd1351_init(painter_device_t device, painter_rotation_t rotation) {
+ tft_panel_dc_reset_painter_device_t *driver = (tft_panel_dc_reset_painter_device_t *)device;
+
+ // clang-format off
+ const uint8_t ssd1351_init_sequence[] = {
+ // Command, Delay, N, Data[N]
+ SSD1351_COMMANDLOCK, 5, 1, 0x12,
+ SSD1351_COMMANDLOCK, 5, 1, 0xB1,
+ SSD1351_DISPLAYOFF, 5, 0,
+ SSD1351_CLOCKDIV, 5, 1, 0xF1,
+ SSD1351_MUXRATIO, 5, 1, 0x7F,
+ SSD1351_DISPLAYOFFSET, 5, 1, 0x00,
+ SSD1351_SETGPIO, 5, 1, 0x00,
+ SSD1351_FUNCTIONSELECT, 5, 1, 0x01,
+ SSD1351_PRECHARGE, 5, 1, 0x32,
+ SSD1351_VCOMH, 5, 1, 0x05,
+ SSD1351_NORMALDISPLAY, 5, 0,
+ SSD1351_CONTRASTABC, 5, 3, 0xC8, 0x80, 0xC8,
+ SSD1351_CONTRASTMASTER, 5, 1, 0x0F,
+ SSD1351_SETVSL, 5, 3, 0xA0, 0xB5, 0x55,
+ SSD1351_PRECHARGE2, 5, 1, 0x01,
+ SSD1351_DISPLAYON, 5, 0,
+ };
+ // clang-format on
+ qp_comms_bulk_command_sequence(device, ssd1351_init_sequence, sizeof(ssd1351_init_sequence));
+
+ // Configure the rotation (i.e. the ordering and direction of memory writes in GRAM)
+ const uint8_t madctl[] = {
+ [QP_ROTATION_0] = SSD1351_MADCTL_BGR | SSD1351_MADCTL_MY,
+ [QP_ROTATION_90] = SSD1351_MADCTL_BGR | SSD1351_MADCTL_MX | SSD1351_MADCTL_MY | SSD1351_MADCTL_MV,
+ [QP_ROTATION_180] = SSD1351_MADCTL_BGR | SSD1351_MADCTL_MX,
+ [QP_ROTATION_270] = SSD1351_MADCTL_BGR | SSD1351_MADCTL_MV,
+ };
+ qp_comms_command_databyte(device, SSD1351_SETREMAP, madctl[rotation]);
+ qp_comms_command_databyte(device, SSD1351_STARTLINE, (rotation == QP_ROTATION_0 || rotation == QP_ROTATION_90) ? driver->base.panel_height : 0);
+
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Driver vtable
+
+const struct tft_panel_dc_reset_painter_driver_vtable_t ssd1351_driver_vtable = {
+ .base =
+ {
+ .init = qp_ssd1351_init,
+ .power = qp_tft_panel_power,
+ .clear = qp_tft_panel_clear,
+ .flush = qp_tft_panel_flush,
+ .pixdata = qp_tft_panel_pixdata,
+ .viewport = qp_tft_panel_viewport,
+ .palette_convert = qp_tft_panel_palette_convert,
+ .append_pixels = qp_tft_panel_append_pixels,
+ },
+ .rgb888_to_native16bit = qp_rgb888_to_rgb565_swapped,
+ .num_window_bytes = 1,
+ .swap_window_coords = true,
+ .opcodes =
+ {
+ .display_on = SSD1351_DISPLAYON,
+ .display_off = SSD1351_DISPLAYOFF,
+ .set_column_address = SSD1351_SETCOLUMN,
+ .set_row_address = SSD1351_SETROW,
+ .enable_writes = SSD1351_WRITERAM,
+ },
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// SPI
+
+#ifdef QUANTUM_PAINTER_SSD1351_SPI_ENABLE
+
+// Factory function for creating a handle to the SSD1351 device
+painter_device_t qp_ssd1351_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode) {
+ for (uint32_t i = 0; i < SSD1351_NUM_DEVICES; ++i) {
+ tft_panel_dc_reset_painter_device_t *driver = &ssd1351_drivers[i];
+ if (!driver->base.driver_vtable) {
+ driver->base.driver_vtable = (const struct painter_driver_vtable_t *)&ssd1351_driver_vtable;
+ driver->base.comms_vtable = (const struct painter_comms_vtable_t *)&spi_comms_with_dc_vtable;
+ driver->base.panel_width = panel_width;
+ driver->base.panel_height = panel_height;
+ driver->base.rotation = QP_ROTATION_0;
+ driver->base.offset_x = 0;
+ driver->base.offset_y = 0;
+ driver->base.native_bits_per_pixel = 16; // RGB565
+
+ // SPI and other pin configuration
+ driver->base.comms_config = &driver->spi_dc_reset_config;
+ driver->spi_dc_reset_config.spi_config.chip_select_pin = chip_select_pin;
+ driver->spi_dc_reset_config.spi_config.divisor = spi_divisor;
+ driver->spi_dc_reset_config.spi_config.lsb_first = false;
+ driver->spi_dc_reset_config.spi_config.mode = spi_mode;
+ driver->spi_dc_reset_config.dc_pin = dc_pin;
+ driver->spi_dc_reset_config.reset_pin = reset_pin;
+ return (painter_device_t)driver;
+ }
+ }
+ return NULL;
+}
+
+#endif // QUANTUM_PAINTER_SSD1351_SPI_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/drivers/painter/ssd1351/qp_ssd1351.h b/drivers/painter/ssd1351/qp_ssd1351.h
new file mode 100644
index 0000000000..0df34f204d
--- /dev/null
+++ b/drivers/painter/ssd1351/qp_ssd1351.h
@@ -0,0 +1,37 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "gpio.h"
+#include "qp_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter SSD1351 configurables (add to your keyboard's config.h)
+
+#ifndef SSD1351_NUM_DEVICES
+/**
+ * @def This controls the maximum number of SSD1351 devices that Quantum Painter can communicate with at any one time.
+ * Increasing this number allows for multiple displays to be used.
+ */
+# define SSD1351_NUM_DEVICES 1
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter SSD1351 device factories
+
+#ifdef QUANTUM_PAINTER_SSD1351_SPI_ENABLE
+/**
+ * Factory method for an SSD1351 SPI OLED device.
+ *
+ * @param panel_width[in] the width of the display panel
+ * @param panel_height[in] the height of the display panel
+ * @param chip_select_pin[in] the GPIO pin used for SPI chip select
+ * @param dc_pin[in] the GPIO pin used for D/C control
+ * @param reset_pin[in] the GPIO pin used for RST
+ * @param spi_divisor[in] the SPI divisor to use when communicating with the display
+ * @param spi_mode[in] the SPI mode to use when communicating with the display
+ * @return the device handle used with all drawing routines in Quantum Painter
+ */
+painter_device_t qp_ssd1351_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode);
+#endif // QUANTUM_PAINTER_SSD1351_SPI_ENABLE
diff --git a/drivers/painter/ssd1351/qp_ssd1351_opcodes.h b/drivers/painter/ssd1351/qp_ssd1351_opcodes.h
new file mode 100644
index 0000000000..48ed2a3a7c
--- /dev/null
+++ b/drivers/painter/ssd1351/qp_ssd1351_opcodes.h
@@ -0,0 +1,48 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter SSD1351 command opcodes
+
+// System function commands
+#define SSD1351_SETCOLUMN 0x15
+#define SSD1351_SETROW 0x75
+#define SSD1351_WRITERAM 0x5C
+#define SSD1351_READRAM 0x5D
+#define SSD1351_SETREMAP 0xA0
+#define SSD1351_STARTLINE 0xA1
+#define SSD1351_DISPLAYOFFSET 0xA2
+#define SSD1351_DISPLAYALLOFF 0xA4
+#define SSD1351_DISPLAYALLON 0xA5
+#define SSD1351_NORMALDISPLAY 0xA6
+#define SSD1351_INVERTDISPLAY 0xA7
+#define SSD1351_FUNCTIONSELECT 0xAB
+#define SSD1351_DISPLAYOFF 0xAE
+#define SSD1351_DISPLAYON 0xAF
+#define SSD1351_PRECHARGE 0xB1
+#define SSD1351_DISPLAYENHANCE 0xB2
+#define SSD1351_CLOCKDIV 0xB3
+#define SSD1351_SETVSL 0xB4
+#define SSD1351_SETGPIO 0xB5
+#define SSD1351_PRECHARGE2 0xB6
+#define SSD1351_SETGRAY 0xB8
+#define SSD1351_USELUT 0xB9
+#define SSD1351_PRECHARGELEVEL 0xBB
+#define SSD1351_VCOMH 0xBE
+#define SSD1351_CONTRASTABC 0xC1
+#define SSD1351_CONTRASTMASTER 0xC7
+#define SSD1351_MUXRATIO 0xCA
+#define SSD1351_COMMANDLOCK 0xFD
+#define SSD1351_HORIZSCROLL 0x96
+#define SSD1351_STOPSCROLL 0x9E
+#define SSD1351_STARTSCROLL 0x9F
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// SETREMAP (MADCTL) Flags
+#define SSD1351_MADCTL_MY 0b00010000
+#define SSD1351_MADCTL_MX 0b00000010
+#define SSD1351_MADCTL_MV 0b00000001
+#define SSD1351_MADCTL_RGB 0b01100000
+#define SSD1351_MADCTL_BGR 0b01100100
diff --git a/drivers/painter/st77xx/qp_st7789.c b/drivers/painter/st77xx/qp_st7789.c
new file mode 100644
index 0000000000..d005ece050
--- /dev/null
+++ b/drivers/painter/st77xx/qp_st7789.c
@@ -0,0 +1,144 @@
+// Copyright 2021 Paul Cotter (@gr1mr3aver)
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "qp_internal.h"
+#include "qp_comms.h"
+#include "qp_st7789.h"
+#include "qp_st77xx_opcodes.h"
+#include "qp_st7789_opcodes.h"
+#include "qp_tft_panel.h"
+
+#ifdef QUANTUM_PAINTER_ST7789_SPI_ENABLE
+# include "qp_comms_spi.h"
+#endif // QUANTUM_PAINTER_ST7789_SPI_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Common
+
+// Driver storage
+tft_panel_dc_reset_painter_device_t st7789_drivers[ST7789_NUM_DEVICES] = {0};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Automatic viewport offsets
+
+#ifndef ST7789_NO_AUTOMATIC_OFFSETS
+static inline void st7789_automatic_viewport_offsets(painter_device_t device, painter_rotation_t rotation) {
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+
+ // clang-format off
+ const struct {
+ uint16_t offset_x;
+ uint16_t offset_y;
+ } rotation_offsets_240x240[] = {
+ [QP_ROTATION_0] = { .offset_x = 0, .offset_y = 0 },
+ [QP_ROTATION_90] = { .offset_x = 0, .offset_y = 0 },
+ [QP_ROTATION_180] = { .offset_x = 0, .offset_y = 80 },
+ [QP_ROTATION_270] = { .offset_x = 80, .offset_y = 0 },
+ };
+ // clang-format on
+
+ if (driver->panel_width == 240 && driver->panel_height == 240) {
+ driver->offset_x = rotation_offsets_240x240[rotation].offset_x;
+ driver->offset_y = rotation_offsets_240x240[rotation].offset_y;
+ }
+}
+#endif // ST7789_NO_AUTOMATIC_OFFSETS
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Initialization
+
+bool qp_st7789_init(painter_device_t device, painter_rotation_t rotation) {
+ // clang-format off
+ const uint8_t st7789_init_sequence[] = {
+ // Command, Delay, N, Data[N]
+ ST77XX_CMD_RESET, 120, 0,
+ ST77XX_CMD_SLEEP_OFF, 5, 0,
+ ST77XX_SET_PIX_FMT, 0, 1, 0x55,
+ ST77XX_CMD_INVERT_ON, 0, 0,
+ ST77XX_CMD_NORMAL_ON, 0, 0,
+ ST77XX_CMD_DISPLAY_ON, 20, 0
+ };
+ // clang-format on
+ qp_comms_bulk_command_sequence(device, st7789_init_sequence, sizeof(st7789_init_sequence));
+
+ // Configure the rotation (i.e. the ordering and direction of memory writes in GRAM)
+ const uint8_t madctl[] = {
+ [QP_ROTATION_0] = ST77XX_MADCTL_RGB,
+ [QP_ROTATION_90] = ST77XX_MADCTL_RGB | ST77XX_MADCTL_MX | ST77XX_MADCTL_MV,
+ [QP_ROTATION_180] = ST77XX_MADCTL_RGB | ST77XX_MADCTL_MX | ST77XX_MADCTL_MY,
+ [QP_ROTATION_270] = ST77XX_MADCTL_RGB | ST77XX_MADCTL_MV | ST77XX_MADCTL_MY,
+ };
+ qp_comms_command_databyte(device, ST77XX_SET_MADCTL, madctl[rotation]);
+
+#ifndef ST7789_NO_AUTOMATIC_VIEWPORT_OFFSETS
+ st7789_automatic_viewport_offsets(device, rotation);
+#endif // ST7789_NO_AUTOMATIC_VIEWPORT_OFFSETS
+
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Driver vtable
+
+const struct tft_panel_dc_reset_painter_driver_vtable_t st7789_driver_vtable = {
+ .base =
+ {
+ .init = qp_st7789_init,
+ .power = qp_tft_panel_power,
+ .clear = qp_tft_panel_clear,
+ .flush = qp_tft_panel_flush,
+ .pixdata = qp_tft_panel_pixdata,
+ .viewport = qp_tft_panel_viewport,
+ .palette_convert = qp_tft_panel_palette_convert,
+ .append_pixels = qp_tft_panel_append_pixels,
+ },
+ .rgb888_to_native16bit = qp_rgb888_to_rgb565_swapped,
+ .num_window_bytes = 2,
+ .swap_window_coords = false,
+ .opcodes =
+ {
+ .display_on = ST77XX_CMD_DISPLAY_ON,
+ .display_off = ST77XX_CMD_DISPLAY_OFF,
+ .set_column_address = ST77XX_SET_COL_ADDR,
+ .set_row_address = ST77XX_SET_ROW_ADDR,
+ .enable_writes = ST77XX_SET_MEM,
+ },
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// SPI
+
+#ifdef QUANTUM_PAINTER_ST7789_SPI_ENABLE
+
+// Factory function for creating a handle to the ST7789 device
+painter_device_t qp_st7789_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode) {
+ for (uint32_t i = 0; i < ST7789_NUM_DEVICES; ++i) {
+ tft_panel_dc_reset_painter_device_t *driver = &st7789_drivers[i];
+ if (!driver->base.driver_vtable) {
+ driver->base.driver_vtable = (const struct painter_driver_vtable_t *)&st7789_driver_vtable;
+ driver->base.comms_vtable = (const struct painter_comms_vtable_t *)&spi_comms_with_dc_vtable;
+ driver->base.panel_width = panel_width;
+ driver->base.panel_height = panel_height;
+ driver->base.rotation = QP_ROTATION_0;
+ driver->base.offset_x = 0;
+ driver->base.offset_y = 0;
+ driver->base.native_bits_per_pixel = 16; // RGB565
+
+ // SPI and other pin configuration
+ driver->base.comms_config = &driver->spi_dc_reset_config;
+ driver->spi_dc_reset_config.spi_config.chip_select_pin = chip_select_pin;
+ driver->spi_dc_reset_config.spi_config.divisor = spi_divisor;
+ driver->spi_dc_reset_config.spi_config.lsb_first = false;
+ driver->spi_dc_reset_config.spi_config.mode = spi_mode;
+ driver->spi_dc_reset_config.dc_pin = dc_pin;
+ driver->spi_dc_reset_config.reset_pin = reset_pin;
+ return (painter_device_t)driver;
+ }
+ }
+ return NULL;
+}
+
+#endif // QUANTUM_PAINTER_ST7789_SPI_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/drivers/painter/st77xx/qp_st7789.h b/drivers/painter/st77xx/qp_st7789.h
new file mode 100644
index 0000000000..ec61f5d70b
--- /dev/null
+++ b/drivers/painter/st77xx/qp_st7789.h
@@ -0,0 +1,44 @@
+// Copyright 2021 Paul Cotter (@gr1mr3aver)
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "gpio.h"
+#include "qp_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter ST7789 configurables (add to your keyboard's config.h)
+
+#ifndef ST7789_NUM_DEVICES
+/**
+ * @def This controls the maximum number of ST7789 devices that Quantum Painter can communicate with at any one time.
+ * Increasing this number allows for multiple displays to be used.
+ */
+# define ST7789_NUM_DEVICES 1
+#endif
+
+// Additional configuration options to be copied to your keyboard's config.h (don't change here):
+
+// If you know exactly which offsets should be used on your panel with respect to selected rotation, then this config
+// option allows you to save some flash space -- you'll need to invoke qp_set_viewport_offsets() instead from your keyboard.
+// #define ST7789_NO_AUTOMATIC_VIEWPORT_OFFSETS
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter ST7789 device factories
+
+#ifdef QUANTUM_PAINTER_ST7789_SPI_ENABLE
+/**
+ * Factory method for an ST7789 SPI LCD device.
+ *
+ * @param panel_width[in] the width of the display panel
+ * @param panel_height[in] the height of the display panel
+ * @param chip_select_pin[in] the GPIO pin used for SPI chip select
+ * @param dc_pin[in] the GPIO pin used for D/C control
+ * @param reset_pin[in] the GPIO pin used for RST
+ * @param spi_divisor[in] the SPI divisor to use when communicating with the display
+ * @param spi_mode[in] the SPI mode to use when communicating with the display
+ * @return the device handle used with all drawing routines in Quantum Painter
+ */
+painter_device_t qp_st7789_make_spi_device(uint16_t panel_width, uint16_t panel_height, pin_t chip_select_pin, pin_t dc_pin, pin_t reset_pin, uint16_t spi_divisor, int spi_mode);
+#endif // QUANTUM_PAINTER_ST7789_SPI_ENABLE
diff --git a/drivers/painter/st77xx/qp_st7789_opcodes.h b/drivers/painter/st77xx/qp_st7789_opcodes.h
new file mode 100644
index 0000000000..b5baba7184
--- /dev/null
+++ b/drivers/painter/st77xx/qp_st7789_opcodes.h
@@ -0,0 +1,64 @@
+// Copyright 2021 Paul Cotter (@gr1mr3aver)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter ST7789 additional command opcodes
+
+// System function commands
+#define ST7789_GET_SELF_DIAG 0x0F // Get self-diagnostic result
+#define ST7789_SET_VERT_SCRL 0x33 // Set vertical scroll definition
+#define ST7789_SET_VERT_SCRL_ADDR 0x37 // SEt Vertical scroll start address
+#define ST7789_SET_MEM_CONT 0x3C // Memory Write continue
+#define ST7789_GET_MEM_CONT 0x3E // Memory Read continue
+#define ST7789_SET_TEAR_LINE 0x44 // Set tear scanline
+#define ST7789_GET_TEAR_LINE 0x45 // Get tear scanline
+#define ST7789_SET_BRIGHTNESS 0x51 // Set display brightness
+#define ST7789_GET_BRIGHTNESS 0x52 // Get display brightness
+#define ST7789_SET_CTRL 0x53 // Set CTRL display
+#define ST7789_GET_CTRL 0x54 // Get CTRL display value
+#define ST7789_SET_CAB_COLOR 0x55 // Set content adaptive brightness control and color enhancement
+#define ST7789_GET_CAB_COLOR 0x56 // Get content adaptive brightness control and color enhancement
+#define ST7789_SET_CAB_BRIGHTNESS 0x5E // Set content adaptive minimum brightness
+#define ST7789_GET_CAB_BRIGHTNESS 0x5F // Get content adaptive minimum brightness
+#define ST7789_GET_ABC_SELF_DIAG 0x68 // Get Auto brightness control self diagnostics
+
+// Panel Function Commands
+#define ST7789_SET_RAM_CTL 0xB0 // Set RAM control
+#define ST7789_SET_RGB_CTL 0xB1 // Set RGB control
+#define ST7789_SET_PORCH_CTL 0xB2 // Set Porch control
+#define ST7789_SET_FRAME_RATE_CTL_1 0xB3 // Set frame rate control 1
+#define ST7789_SET_PARTIAL_CTL 0xB5 // Set Partial control
+#define ST7789_SET_GATE_CTL 0xB7 // Set gate control
+#define ST7789_SET_GATE_ON_TIMING 0xB8 // Set gate on timing adjustment
+#define ST7789_SET_DIGITAL_GAMMA_ON 0xBA // Enable digital gamma
+#define ST7789_SET_VCOM 0xBB // Set VCOM
+#define ST7789_SET_POWER_SAVE 0xBC // Set power saving mode
+#define ST7789_SET_DISP_OFF_POWER 0xBD // Set display off power saving
+#define ST7789_SET_LCM_CTL 0xC0 // Set LCM control
+#define ST7789_SET_IDS 0xC1 // Set IDs
+#define ST7789_SET_VDV_VRH_ON 0xC2 // Set VDV and VRH command enable
+#define ST7789_SET_VRH 0xC3 // Set VRH
+#define ST7789_SET_VDV 0xC4 // Set VDV
+#define ST7789_SET_VCOM_OFFSET 0xC5 // Set VCOM offset ctl
+#define ST7789_SET_FRAME_RATE_CTL_2 0xC6 // Set frame rate control 2
+#define ST7789_SET_CABC_CTL 0xC7 // Set CABC Control
+#define ST7789_GET_REG_1 0xC8 // Get register value selection1
+#define ST7789_GET_REG_2 0xCA // Get register value selection2
+#define ST7789_SET_PWM_FREQ 0xCC // Set PWM frequency
+#define ST7789_SET_POWER_CTL_1 0xD0 // Set power ctl 1
+#define ST7789_SET_VAP_VAN_ON 0xD2 // Enable VAP/VAN signal output
+#define ST7789_SET_CMD2_ENABLE 0xDF // Enable command 2
+#define ST7789_SET_PGAMMA 0xE0 // Set positive gamma
+#define ST7789_SET_NGAMMA 0xE1 // Set negative gamma
+#define ST7789_SET_DIGITAL_GAMMA_RED 0xE2 // Set digital gamma lookup table for red
+#define ST7789_SET_DIGITAL_GAMMA_BLUE 0xE3 // Get digital gamma lookup table for blue
+#define ST7789_SET_GATE_CTL_2 0xE4 // Set gate control 2
+#define ST7789_SET_SPI2_ENABLE 0xE7 // Enable SPI2
+#define ST7789_SET_POWER_CTL_2 0xE8 // Set power ctl 2
+#define ST7789_SET_EQ_TIME_CTL 0xE9 // Set equalize time control
+#define ST7789_SET_PROG_CTL 0xEC // Set program control
+#define ST7789_SET_PROG_MODE_ENABLE 0xFA // Set program mode enable
+#define ST7789_SET_NVMEM 0xFC // Set NVMEM data
+#define ST7789_SET_PROG_ACTION 0xFE // Set program action
diff --git a/drivers/painter/st77xx/qp_st77xx_opcodes.h b/drivers/painter/st77xx/qp_st77xx_opcodes.h
new file mode 100644
index 0000000000..131378d832
--- /dev/null
+++ b/drivers/painter/st77xx/qp_st77xx_opcodes.h
@@ -0,0 +1,51 @@
+// Copyright 2021 Paul Cotter (@gr1mr3aver)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter ST77XX command opcodes
+
+// System function commands
+#define ST77XX_CMD_NOP 0x00 // No operation
+#define ST77XX_CMD_RESET 0x01 // Software reset
+#define ST77XX_GET_ID_INFO 0x04 // Get ID information
+#define ST77XX_GET_STATUS 0x09 // Get status
+#define ST77XX_GET_PWR_MODE 0x0A // Get power mode
+#define ST77XX_GET_MADCTL 0x0B // Get mem access ctl
+#define ST77XX_GET_PIX_FMT 0x0C // Get pixel format
+#define ST77XX_GET_IMG_FMT 0x0D // Get image format
+#define ST77XX_GET_SIG_MODE 0x0E // Get signal mode
+#define ST77XX_CMD_SLEEP_ON 0x10 // Enter sleep mode
+#define ST77XX_CMD_SLEEP_OFF 0x11 // Exist sleep mode
+#define ST77XX_CMD_PARTIAL_ON 0x12 // Enter partial mode
+#define ST77XX_CMD_NORMAL_ON 0x13 // Exit partial mode
+#define ST77XX_CMD_INVERT_OFF 0x20 // Exit inverted mode
+#define ST77XX_CMD_INVERT_ON 0x21 // Enter inverted mode
+#define ST77XX_SET_GAMMA 0x26 // Set gamma params
+#define ST77XX_CMD_DISPLAY_OFF 0x28 // Disable display
+#define ST77XX_CMD_DISPLAY_ON 0x29 // Enable display
+#define ST77XX_SET_COL_ADDR 0x2A // Set column address
+#define ST77XX_SET_ROW_ADDR 0x2B // Set page (row) address
+#define ST77XX_SET_MEM 0x2C // Set memory
+#define ST77XX_GET_MEM 0x2E // Get memory
+#define ST77XX_SET_PARTIAL_AREA 0x30 // Set partial area
+#define ST77XX_CMD_TEARING_OFF 0x34 // Tearing line disabled
+#define ST77XX_CMD_TEARING_ON 0x35 // Tearing line enabled
+#define ST77XX_SET_MADCTL 0x36 // Set mem access ctl
+#define ST77XX_CMD_IDLE_OFF 0x38 // Exit idle mode
+#define ST77XX_CMD_IDLE_ON 0x39 // Enter idle mode
+#define ST77XX_SET_PIX_FMT 0x3A // Set pixel format
+#define ST77XX_GET_ID1 0xDA // Get ID1
+#define ST77XX_GET_ID2 0xDB // Get ID2
+#define ST77XX_GET_ID3 0xDC // Get ID3
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// MADCTL Flags
+#define ST77XX_MADCTL_MY 0b10000000
+#define ST77XX_MADCTL_MX 0b01000000
+#define ST77XX_MADCTL_MV 0b00100000
+#define ST77XX_MADCTL_ML 0b00010000
+#define ST77XX_MADCTL_RGB 0b00000000
+#define ST77XX_MADCTL_BGR 0b00001000
+#define ST77XX_MADCTL_MH 0b00000100
diff --git a/drivers/painter/tft_panel/qp_tft_panel.c b/drivers/painter/tft_panel/qp_tft_panel.c
new file mode 100644
index 0000000000..4d636c9509
--- /dev/null
+++ b/drivers/painter/tft_panel/qp_tft_panel.c
@@ -0,0 +1,130 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "color.h"
+#include "qp_internal.h"
+#include "qp_comms.h"
+#include "qp_draw.h"
+#include "qp_tft_panel.h"
+
+#define BYTE_SWAP(x) (((((uint16_t)(x)) >> 8) & 0x00FF) | ((((uint16_t)(x)) << 8) & 0xFF00))
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Native pixel format conversion
+
+uint16_t qp_rgb888_to_rgb565(uint8_t r, uint8_t g, uint8_t b) {
+ uint16_t rgb565 = (((uint16_t)r) >> 3) << 11 | (((uint16_t)g) >> 2) << 5 | (((uint16_t)b) >> 3);
+ return rgb565;
+}
+
+uint16_t qp_rgb888_to_rgb565_swapped(uint8_t r, uint8_t g, uint8_t b) {
+ uint16_t rgb565 = (((uint16_t)r) >> 3) << 11 | (((uint16_t)g) >> 2) << 5 | (((uint16_t)b) >> 3);
+ return BYTE_SWAP(rgb565);
+}
+
+uint16_t qp_rgb888_to_bgr565(uint8_t r, uint8_t g, uint8_t b) {
+ uint16_t bgr565 = (((uint16_t)b) >> 3) << 11 | (((uint16_t)g) >> 2) << 5 | (((uint16_t)r) >> 3);
+ return bgr565;
+}
+
+uint16_t qp_rgb888_to_bgr565_swapped(uint8_t r, uint8_t g, uint8_t b) {
+ uint16_t bgr565 = (((uint16_t)b) >> 3) << 11 | (((uint16_t)g) >> 2) << 5 | (((uint16_t)r) >> 3);
+ return BYTE_SWAP(bgr565);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter API implementations
+
+// Power control
+bool qp_tft_panel_power(painter_device_t device, bool power_on) {
+ struct painter_driver_t * driver = (struct painter_driver_t *)device;
+ struct tft_panel_dc_reset_painter_driver_vtable_t *vtable = (struct tft_panel_dc_reset_painter_driver_vtable_t *)driver->driver_vtable;
+ qp_comms_command(device, power_on ? vtable->opcodes.display_on : vtable->opcodes.display_off);
+ return true;
+}
+
+// Screen clear
+bool qp_tft_panel_clear(painter_device_t device) {
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ driver->driver_vtable->init(device, driver->rotation); // Re-init the LCD
+ return true;
+}
+
+// Screen flush
+bool qp_tft_panel_flush(painter_device_t device) {
+ // No-op, as there's no framebuffer in RAM for this device.
+ return true;
+}
+
+// Viewport to draw to
+bool qp_tft_panel_viewport(painter_device_t device, uint16_t left, uint16_t top, uint16_t right, uint16_t bottom) {
+ struct painter_driver_t * driver = (struct painter_driver_t *)device;
+ struct tft_panel_dc_reset_painter_driver_vtable_t *vtable = (struct tft_panel_dc_reset_painter_driver_vtable_t *)driver->driver_vtable;
+
+ // Fix up the drawing location if required
+ left += driver->offset_x;
+ right += driver->offset_x;
+ top += driver->offset_y;
+ bottom += driver->offset_y;
+
+ // Check if we need to manually swap the window coordinates based on whether or not we're in a sideways rotation
+ if (vtable->swap_window_coords && (driver->rotation == QP_ROTATION_90 || driver->rotation == QP_ROTATION_270)) {
+ uint16_t temp;
+
+ temp = left;
+ left = top;
+ top = temp;
+
+ temp = right;
+ right = bottom;
+ bottom = temp;
+ }
+
+ if (vtable->num_window_bytes == 1) {
+ // Set up the x-window
+ uint8_t xbuf[2] = {left & 0xFF, right & 0xFF};
+ qp_comms_command_databuf(device, vtable->opcodes.set_column_address, xbuf, sizeof(xbuf));
+
+ // Set up the y-window
+ uint8_t ybuf[2] = {top & 0xFF, bottom & 0xFF};
+ qp_comms_command_databuf(device, vtable->opcodes.set_row_address, ybuf, sizeof(ybuf));
+ } else if (vtable->num_window_bytes == 2) {
+ // Set up the x-window
+ uint8_t xbuf[4] = {left >> 8, left & 0xFF, right >> 8, right & 0xFF};
+ qp_comms_command_databuf(device, vtable->opcodes.set_column_address, xbuf, sizeof(xbuf));
+
+ // Set up the y-window
+ uint8_t ybuf[4] = {top >> 8, top & 0xFF, bottom >> 8, bottom & 0xFF};
+ qp_comms_command_databuf(device, vtable->opcodes.set_row_address, ybuf, sizeof(ybuf));
+ }
+
+ // Lock in the window
+ qp_comms_command(device, vtable->opcodes.enable_writes);
+ return true;
+}
+
+// Stream pixel data to the current write position in GRAM
+bool qp_tft_panel_pixdata(painter_device_t device, const void *pixel_data, uint32_t native_pixel_count) {
+ qp_comms_send(device, pixel_data, native_pixel_count * sizeof(uint16_t));
+ return true;
+}
+
+// Convert supplied palette entries into their native equivalents
+bool qp_tft_panel_palette_convert(painter_device_t device, int16_t palette_size, qp_pixel_t *palette) {
+ struct painter_driver_t * driver = (struct painter_driver_t *)device;
+ struct tft_panel_dc_reset_painter_driver_vtable_t *vtable = (struct tft_panel_dc_reset_painter_driver_vtable_t *)driver->driver_vtable;
+ for (int16_t i = 0; i < palette_size; ++i) {
+ RGB rgb = hsv_to_rgb_nocie((HSV){palette[i].hsv888.h, palette[i].hsv888.s, palette[i].hsv888.v});
+ palette[i].rgb565 = vtable->rgb888_to_native16bit(rgb.r, rgb.g, rgb.b);
+ }
+ return true;
+}
+
+// Append pixels to the target location, keyed by the pixel index
+bool qp_tft_panel_append_pixels(painter_device_t device, uint8_t *target_buffer, qp_pixel_t *palette, uint32_t pixel_offset, uint32_t pixel_count, uint8_t *palette_indices) {
+ uint16_t *buf = (uint16_t *)target_buffer;
+ for (uint32_t i = 0; i < pixel_count; ++i) {
+ buf[pixel_offset + i] = palette[palette_indices[i]].rgb565;
+ }
+ return true;
+}
diff --git a/drivers/painter/tft_panel/qp_tft_panel.h b/drivers/painter/tft_panel/qp_tft_panel.h
new file mode 100644
index 0000000000..6eddfc503d
--- /dev/null
+++ b/drivers/painter/tft_panel/qp_tft_panel.h
@@ -0,0 +1,67 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "color.h"
+#include "qp_internal.h"
+
+#ifdef QUANTUM_PAINTER_SPI_ENABLE
+# include "qp_comms_spi.h"
+#endif // QUANTUM_PAINTER_SPI_ENABLE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Common TFT panel implementation using D/C, and RST pins.
+
+typedef uint16_t (*rgb888_to_native_uint16_t)(uint8_t r, uint8_t g, uint8_t b);
+
+// Driver vtable with extras
+struct tft_panel_dc_reset_painter_driver_vtable_t {
+ struct painter_driver_vtable_t base; // must be first, so it can be cast to/from the painter_driver_vtable_t* type
+
+ // Conversion function for palette entries
+ rgb888_to_native_uint16_t rgb888_to_native16bit;
+
+ // Number of bytes for transmitting x/y coordinates
+ uint8_t num_window_bytes;
+
+ // Whether or not the x/y coords should be swapped on 90/270 rotation
+ bool swap_window_coords;
+
+ // Opcodes for normal display operation
+ struct {
+ uint8_t display_on;
+ uint8_t display_off;
+ uint8_t set_column_address;
+ uint8_t set_row_address;
+ uint8_t enable_writes;
+ } opcodes;
+};
+
+// Device definition
+typedef struct tft_panel_dc_reset_painter_device_t {
+ struct painter_driver_t base; // must be first, so it can be cast to/from the painter_device_t* type
+
+ union {
+#ifdef QUANTUM_PAINTER_SPI_ENABLE
+ // SPI-based configurables
+ struct qp_comms_spi_dc_reset_config_t spi_dc_reset_config;
+#endif // QUANTUM_PAINTER_SPI_ENABLE
+
+ // TODO: I2C/parallel etc.
+ };
+} tft_panel_dc_reset_painter_device_t;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Forward declarations for injecting into concrete driver vtables
+
+bool qp_tft_panel_power(painter_device_t device, bool power_on);
+bool qp_tft_panel_clear(painter_device_t device);
+bool qp_tft_panel_flush(painter_device_t device);
+bool qp_tft_panel_viewport(painter_device_t device, uint16_t left, uint16_t top, uint16_t right, uint16_t bottom);
+bool qp_tft_panel_pixdata(painter_device_t device, const void *pixel_data, uint32_t native_pixel_count);
+bool qp_tft_panel_palette_convert(painter_device_t device, int16_t palette_size, qp_pixel_t *palette);
+bool qp_tft_panel_append_pixels(painter_device_t device, uint8_t *target_buffer, qp_pixel_t *palette, uint32_t pixel_offset, uint32_t pixel_count, uint8_t *palette_indices);
+
+uint16_t qp_rgb888_to_rgb565(uint8_t r, uint8_t g, uint8_t b);
+uint16_t qp_rgb888_to_rgb565_swapped(uint8_t r, uint8_t g, uint8_t b);
+uint16_t qp_rgb888_to_bgr565(uint8_t r, uint8_t g, uint8_t b);
+uint16_t qp_rgb888_to_bgr565_swapped(uint8_t r, uint8_t g, uint8_t b);
diff --git a/drivers/sensors/pmw3360.c b/drivers/sensors/pmw3360.c
index 8c977be1c8..5f4d17a3f0 100644
--- a/drivers/sensors/pmw3360.c
+++ b/drivers/sensors/pmw3360.c
@@ -1,6 +1,7 @@
/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
* Copyright 2019 Sunjun Kim
* Copyright 2020 Ploopy Corporation
+ * Copyright 2022 Ulrich Spörlein
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -83,7 +84,11 @@
# define MAX_CPI 0x77
#endif
-bool _inBurst = false;
+static const pin_t pins[] = PMW3360_CS_PINS;
+#define NUMBER_OF_SENSORS (sizeof(pins) / sizeof(pin_t))
+
+// per-sensor driver state
+static bool _inBurst[NUMBER_OF_SENSORS] = {0};
#ifdef CONSOLE_ENABLE
void print_byte(uint8_t byte) {
@@ -92,18 +97,18 @@ void print_byte(uint8_t byte) {
#endif
#define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
-bool pmw3360_spi_start(void) {
- bool status = spi_start(PMW3360_CS_PIN, PMW3360_SPI_LSBFIRST, PMW3360_SPI_MODE, PMW3360_SPI_DIVISOR);
+bool pmw3360_spi_start(int8_t index) {
+ bool status = spi_start(pins[index], PMW3360_SPI_LSBFIRST, PMW3360_SPI_MODE, PMW3360_SPI_DIVISOR);
// tNCS-SCLK, 120ns
wait_us(1);
return status;
}
-spi_status_t pmw3360_write(uint8_t reg_addr, uint8_t data) {
- pmw3360_spi_start();
+spi_status_t pmw3360_write(int8_t index, uint8_t reg_addr, uint8_t data) {
+ pmw3360_spi_start(index);
if (reg_addr != REG_Motion_Burst) {
- _inBurst = false;
+ _inBurst[index] = false;
}
// send address of the register, with MSBit = 1 to indicate it's a write
@@ -114,13 +119,13 @@ spi_status_t pmw3360_write(uint8_t reg_addr, uint8_t data) {
wait_us(35);
spi_stop();
- // tSWW/tSWR (=180us) minus tSCLK-NCS. Could be shortened, but is looks like a safe lower bound
+ // tSWW/tSWR (=180us) minus tSCLK-NCS. Could be shortened, but it looks like a safe lower bound
wait_us(145);
return status;
}
-uint8_t pmw3360_read(uint8_t reg_addr) {
- pmw3360_spi_start();
+uint8_t pmw3360_read(int8_t index, uint8_t reg_addr) {
+ pmw3360_spi_start(index);
// send adress of the register, with MSBit = 0 to indicate it's a read
spi_write(reg_addr & 0x7f);
// tSRAD (=160us)
@@ -136,36 +141,62 @@ uint8_t pmw3360_read(uint8_t reg_addr) {
return data;
}
-bool pmw3360_init(void) {
- setPinOutput(PMW3360_CS_PIN);
+bool pmw3360_check_signature(int8_t index) {
+ uint8_t pid = pmw3360_read(index, REG_Product_ID);
+ uint8_t iv_pid = pmw3360_read(index, REG_Inverse_Product_ID);
+ uint8_t SROM_ver = pmw3360_read(index, REG_SROM_ID);
+ return (pid == firmware_signature[0] && iv_pid == firmware_signature[1] && SROM_ver == firmware_signature[2]); // signature for SROM 0x04
+}
- spi_init();
- _inBurst = false;
+void pmw3360_upload_firmware(int8_t index) {
+ // Datasheet claims we need to disable REST mode first, but during startup
+ // it's already disabled and we're not turning it on ...
+ // pmw3360_write(index, REG_Config2, 0x00); // disable REST mode
+ pmw3360_write(index, REG_SROM_Enable, 0x1d);
- spi_stop();
- pmw3360_spi_start();
- spi_stop();
+ wait_ms(10);
+
+ pmw3360_write(index, REG_SROM_Enable, 0x18);
+
+ pmw3360_spi_start(index);
+ spi_write(REG_SROM_Load_Burst | 0x80);
+ wait_us(15);
- pmw3360_write(REG_Shutdown, 0xb6); // Shutdown first
- wait_ms(300);
+ for (uint16_t i = 0; i < FIRMWARE_LENGTH; i++) {
+ spi_write(pgm_read_byte(firmware_data + i));
+#ifndef PMW3360_FIRMWARE_UPLOAD_FAST
+ wait_us(15);
+#endif
+ }
+ wait_us(200);
- pmw3360_spi_start();
+ pmw3360_read(index, REG_SROM_ID);
+ pmw3360_write(index, REG_Config2, 0x00);
+}
+
+bool pmw3360_init(int8_t index) {
+ if (index >= NUMBER_OF_SENSORS) {
+ return false;
+ }
+ spi_init();
+
+ // power up, need to first drive NCS high then low.
+ // the datasheet does not say for how long, 40us works well in practice.
+ pmw3360_spi_start(index);
wait_us(40);
spi_stop();
wait_us(40);
-
- // power up, need to first drive NCS high then low, see above.
- pmw3360_write(REG_Power_Up_Reset, 0x5a);
+ pmw3360_write(index, REG_Power_Up_Reset, 0x5a);
wait_ms(50);
// read registers and discard
- pmw3360_read(REG_Motion);
- pmw3360_read(REG_Delta_X_L);
- pmw3360_read(REG_Delta_X_H);
- pmw3360_read(REG_Delta_Y_L);
- pmw3360_read(REG_Delta_Y_H);
+ pmw3360_read(index, REG_Motion);
+ pmw3360_read(index, REG_Delta_X_L);
+ pmw3360_read(index, REG_Delta_X_H);
+ pmw3360_read(index, REG_Delta_Y_L);
+ pmw3360_read(index, REG_Delta_Y_H);
- pmw3360_upload_firmware();
+ pmw3360_upload_firmware(index);
spi_stop();
@@ -174,13 +205,13 @@ bool pmw3360_init(void) {
wait_ms(1);
- pmw3360_write(REG_Config2, 0x00);
+ pmw3360_write(index, REG_Config2, 0x00);
- pmw3360_write(REG_Angle_Tune, constrain(ROTATIONAL_TRANSFORM_ANGLE, -127, 127));
+ pmw3360_write(index, REG_Angle_Tune, constrain(ROTATIONAL_TRANSFORM_ANGLE, -127, 127));
- pmw3360_write(REG_Lift_Config, PMW3360_LIFTOFF_DISTANCE);
+ pmw3360_write(index, REG_Lift_Config, PMW3360_LIFTOFF_DISTANCE);
- bool init_success = pmw3360_check_signature();
+ bool init_success = pmw3360_check_signature(index);
#ifdef CONSOLE_ENABLE
if (init_success) {
dprintf("pmw3360 signature verified");
@@ -189,66 +220,38 @@ bool pmw3360_init(void) {
}
#endif
- writePinLow(PMW3360_CS_PIN);
-
return init_success;
}
-void pmw3360_upload_firmware(void) {
- // Datasheet claims we need to disable REST mode first, but during startup
- // it's already disabled and we're not turning it on ...
- // pmw3360_write(REG_Config2, 0x00); // disable REST mode
- pmw3360_write(REG_SROM_Enable, 0x1d);
-
- wait_ms(10);
-
- pmw3360_write(REG_SROM_Enable, 0x18);
-
- pmw3360_spi_start();
- spi_write(REG_SROM_Load_Burst | 0x80);
- wait_us(15);
-
- for (uint16_t i = 0; i < FIRMWARE_LENGTH; i++) {
- spi_write(pgm_read_byte(firmware_data + i));
-#ifndef PMW3360_FIRMWARE_UPLOAD_FAST
- wait_us(15);
-#endif
- }
- wait_us(200);
-
- pmw3360_read(REG_SROM_ID);
- pmw3360_write(REG_Config2, 0x00);
-}
-
-bool pmw3360_check_signature(void) {
- uint8_t pid = pmw3360_read(REG_Product_ID);
- uint8_t iv_pid = pmw3360_read(REG_Inverse_Product_ID);
- uint8_t SROM_ver = pmw3360_read(REG_SROM_ID);
- return (pid == firmware_signature[0] && iv_pid == firmware_signature[1] && SROM_ver == firmware_signature[2]); // signature for SROM 0x04
-}
-
+// Only support reading the value from sensor #0, no one is using this anyway.
uint16_t pmw3360_get_cpi(void) {
- uint8_t cpival = pmw3360_read(REG_Config1);
+ uint8_t cpival = pmw3360_read(0, REG_Config1);
return (uint16_t)((cpival + 1) & 0xFF) * CPI_STEP;
}
+// Write same CPI to all sensors.
void pmw3360_set_cpi(uint16_t cpi) {
uint8_t cpival = constrain((cpi / CPI_STEP) - 1, 0, MAX_CPI);
- pmw3360_write(REG_Config1, cpival);
+ for (size_t i = 0; i < NUMBER_OF_SENSORS; i++) {
+ pmw3360_write(i, REG_Config1, cpival);
+ }
}
-report_pmw3360_t pmw3360_read_burst(void) {
+report_pmw3360_t pmw3360_read_burst(int8_t index) {
report_pmw3360_t report = {0};
+ if (index >= NUMBER_OF_SENSORS) {
+ return report;
+ }
- if (!_inBurst) {
+ if (!_inBurst[index]) {
#ifdef CONSOLE_ENABLE
- dprintf("burst on");
+ dprintf("burst on for index %d", index);
#endif
- pmw3360_write(REG_Motion_Burst, 0x00);
- _inBurst = true;
+ pmw3360_write(index, REG_Motion_Burst, 0x00);
+ _inBurst[index] = true;
}
- pmw3360_spi_start();
+ pmw3360_spi_start(index);
spi_write(REG_Motion_Burst);
wait_us(35); // waits for tSRAD_MOTBR
@@ -261,7 +264,7 @@ report_pmw3360_t pmw3360_read_burst(void) {
report.mdy = spi_read();
if (report.motion & 0b111) { // panic recovery, sometimes burst mode works weird.
- _inBurst = false;
+ _inBurst[index] = false;
}
spi_stop();
diff --git a/drivers/sensors/pmw3360.h b/drivers/sensors/pmw3360.h
index eec7295871..3aa8ed0ed8 100644
--- a/drivers/sensors/pmw3360.h
+++ b/drivers/sensors/pmw3360.h
@@ -52,8 +52,14 @@
# define ROTATIONAL_TRANSFORM_ANGLE 0x00
#endif
-#ifndef PMW3360_CS_PIN
-# error "No chip select pin defined -- missing PMW3360_CS_PIN"
+// Support single and plural spellings
+#ifndef PMW3360_CS_PINS
+# ifndef PMW3360_CS_PIN
+# error "No chip select pin defined -- missing PMW3360_CS_PIN or PMW3360_CS_PINS"
+# else
+# define PMW3360_CS_PINS \
+ { PMW3360_CS_PIN }
+# endif
#endif
typedef struct {
@@ -66,10 +72,8 @@ typedef struct {
int8_t mdy;
} report_pmw3360_t;
-bool pmw3360_init(void);
-void pmw3360_upload_firmware(void);
-bool pmw3360_check_signature(void);
+bool pmw3360_init(int8_t index);
uint16_t pmw3360_get_cpi(void);
void pmw3360_set_cpi(uint16_t cpi);
/* Reads and clears the current delta values on the sensor */
-report_pmw3360_t pmw3360_read_burst(void);
+report_pmw3360_t pmw3360_read_burst(int8_t index);
diff --git a/keyboards/al1/config.h b/keyboards/al1/config.h
index ea6474dc18..07cc94a279 100644
--- a/keyboards/al1/config.h
+++ b/keyboards/al1/config.h
@@ -30,6 +30,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROWS 6
#define MATRIX_COLS 16
+#define MATRIX_ROW_PINS { C7, B1, B2, C6, B4, B5 }
+
+#define SN74X154_ADDRESS_PINS { D4, D5, D6, D7 }
+#define SN74X154_E1_PIN D3
+
#define LED_NUM_LOCK_PIN D0
#define LED_CAPS_LOCK_PIN B7
#define LED_SCROLL_LOCK_PIN D1
diff --git a/keyboards/al1/matrix.c b/keyboards/al1/matrix.c
index 1407cbc089..e3d7971f1c 100644
--- a/keyboards/al1/matrix.c
+++ b/keyboards/al1/matrix.c
@@ -1,91 +1,101 @@
-#include "matrix.h"
+/* Copyright 2022
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "matrix.h"
#include "gpio.h"
+#include "sn74x154.h"
-static uint8_t read_rows(void) {
- return (readPin(C7) ? 0 : 1) |
- (readPin(B1) ? 0 : 2) |
- (readPin(B2) ? 0 : 4) |
- (readPin(C6) ? 0 : 8) |
- (readPin(B4) ? 0 : 16) |
- (readPin(B5) ? 0 : 32);
-}
+static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
+/* All columns use a 74HC154 4-to-16 demultiplexer.
+ * D3 is the enable pin, must be set high to use it.
+ *
+ * A3 A2 A1 A0
+ * D7 D6 D5 D4
+ * 0: 0 0 0 0
+ * 1: 0 0 0 1
+ * 2: 0 0 1 0
+ * 3: 0 0 1 1
+ * 4: 0 1 0 0
+ * 5: 0 1 0 1
+ * 6: 0 1 1 0
+ * 7: 0 1 1 1
+ * 8: 1 0 0 0
+ * 9: 1 0 0 1
+ * 10: 1 0 1 0
+ * 11: 1 0 1 1
+ * 12: 1 1 0 0
+ * 13: 1 1 0 1
+ * 14: 1 1 1 0
+ * 15: 1 1 1 1
+ */
static void select_col(uint8_t col) {
- writePinLow(D3);
-
- writePin(D4, (col & 1));
- writePin(D5, (col & 2));
- writePin(D6, (col & 4));
- writePin(D7, (col & 8));
+ sn74x154_set_addr(col);
}
-static void unselect_cols(void) {
- writePinHigh(D3);
+static void init_pins(void) {
+ for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
+ setPinInputHigh(row_pins[x]);
+ }
}
-void matrix_init_custom(void) {
- /* 74HC154 col pin configuration
- * pin: D3 D7 D6 D5 D4
- * row: off 0 x x x x
- * 0 1 0 0 0 0
- * 1 1 0 0 0 1
- * 2 1 0 0 1 0
- * 3 1 0 0 1 1
- * 4 1 0 1 0 0
- * 5 1 0 1 0 1
- * 6 1 0 1 1 0
- * 7 1 0 1 1 1
- * 8 1 1 0 0 0
- * 9 1 1 0 0 1
- * 10 1 1 0 1 0
- * 11 1 1 0 1 1
- * 12 1 1 1 0 0
- * 13 1 1 1 0 1
- * 14 1 1 1 1 0
- * 15 1 1 1 1 1
- */
- setPinOutput(D3);
- writePinHigh(D3);
+static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
+ bool matrix_changed = false;
+
+ // Select col and wait for col seleciton to stabilize
+ select_col(current_col);
+ matrix_io_delay();
- setPinOutput(D4);
- setPinOutput(D5);
- setPinOutput(D6);
- setPinOutput(D7);
+ // For each row...
+ for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
+ // Store last value of row prior to reading
+ matrix_row_t last_row_value = current_matrix[row_index];
+ // Check row pin state
+ if (readPin(row_pins[row_index]) == 0) {
+ // Pin LO, set col bit
+ current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col);
+ } else {
+ // Pin HI, clear col bit
+ current_matrix[row_index] &= ~(MATRIX_ROW_SHIFTER << current_col);
+ }
- /* Row pin configuration
- *
- * row: 0 1 2 3 4 5
- * pin: C7 B1 B2 C6 B4 B5
- *
- */
- setPinInputHigh(C7);
- setPinInputHigh(B1);
- setPinInputHigh(B2);
- setPinInputHigh(C6);
- setPinInputHigh(B4);
- setPinInputHigh(B5);
+ // Determine if the matrix changed state
+ if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) {
+ matrix_changed = true;
+ }
+ }
+
+ return matrix_changed;
+}
+
+void matrix_init_custom(void) {
+ // initialize demultiplexer
+ sn74x154_init();
+ sn74x154_set_enabled(true);
+ // initialize key pins
+ init_pins();
}
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
bool changed = false;
- for (uint8_t col = 0; col < MATRIX_COLS; col++) {
- select_col(col);
- matrix_io_delay();
- uint8_t rows = read_rows();
-
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- bool prev_bit = current_matrix[row] & ((matrix_row_t)1 << col);
- bool curr_bit = rows & (1 << row);
-
- if (prev_bit != curr_bit) {
- current_matrix[row] ^= ((matrix_row_t)1 << col);
- changed = true;
- }
- }
- unselect_cols();
+ // Set col, read rows
+ for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
+ changed |= read_rows_on_col(current_matrix, current_col);
}
return changed;
diff --git a/keyboards/al1/rules.mk b/keyboards/al1/rules.mk
index 670712f661..1f8e81de20 100644
--- a/keyboards/al1/rules.mk
+++ b/keyboards/al1/rules.mk
@@ -18,4 +18,5 @@ RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
CUSTOM_MATRIX = lite
-SRC += matrix.c
+VPATH += drivers/gpio
+SRC += matrix.c sn74x154.c
diff --git a/keyboards/amj40/amj40.c b/keyboards/amjkeyboard/amj40/amj40.c
index f0f3121c6a..f0f3121c6a 100755
--- a/keyboards/amj40/amj40.c
+++ b/keyboards/amjkeyboard/amj40/amj40.c
diff --git a/keyboards/amj40/amj40.h b/keyboards/amjkeyboard/amj40/amj40.h
index 14ea383811..14ea383811 100755
--- a/keyboards/amj40/amj40.h
+++ b/keyboards/amjkeyboard/amj40/amj40.h
diff --git a/keyboards/amj40/config.h b/keyboards/amjkeyboard/amj40/config.h
index 71a8d34413..2f472eac01 100755
--- a/keyboards/amj40/config.h
+++ b/keyboards/amjkeyboard/amj40/config.h
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config_common.h"
/* USB Device descriptor parameter */
-#define VENDOR_ID 0xFEED
+#define VENDOR_ID 0x00D8 //A+M+J
#define PRODUCT_ID 0x6072
#define DEVICE_VER 0x0002
#define MANUFACTURER Han Chen
diff --git a/keyboards/amj40/info.json b/keyboards/amjkeyboard/amj40/info.json
index 575fd1b034..575fd1b034 100644
--- a/keyboards/amj40/info.json
+++ b/keyboards/amjkeyboard/amj40/info.json
diff --git a/keyboards/amj40/keymaps/default/keymap.c b/keyboards/amjkeyboard/amj40/keymaps/default/keymap.c
index 658b4b3c55..658b4b3c55 100755
--- a/keyboards/amj40/keymaps/default/keymap.c
+++ b/keyboards/amjkeyboard/amj40/keymaps/default/keymap.c
diff --git a/keyboards/amj40/keymaps/default/readme.md b/keyboards/amjkeyboard/amj40/keymaps/default/readme.md
index 2659292ae5..2659292ae5 100755
--- a/keyboards/amj40/keymaps/default/readme.md
+++ b/keyboards/amjkeyboard/amj40/keymaps/default/readme.md
diff --git a/keyboards/amj40/keymaps/default_625u_space/keymap.c b/keyboards/amjkeyboard/amj40/keymaps/default_625u_space/keymap.c
index f5b33ad84f..f5b33ad84f 100644
--- a/keyboards/amj40/keymaps/default_625u_space/keymap.c
+++ b/keyboards/amjkeyboard/amj40/keymaps/default_625u_space/keymap.c
diff --git a/keyboards/amj40/keymaps/default_ortho_275u_space/keymap.c b/keyboards/amjkeyboard/amj40/keymaps/default_ortho_275u_space/keymap.c
index fe99884696..fe99884696 100644
--- a/keyboards/amj40/keymaps/default_ortho_275u_space/keymap.c
+++ b/keyboards/amjkeyboard/amj40/keymaps/default_ortho_275u_space/keymap.c
diff --git a/keyboards/amj40/keymaps/default_ortho_600u_space/keymap.c b/keyboards/amjkeyboard/amj40/keymaps/default_ortho_600u_space/keymap.c
index 527390cd1e..527390cd1e 100644
--- a/keyboards/amj40/keymaps/default_ortho_600u_space/keymap.c
+++ b/keyboards/amjkeyboard/amj40/keymaps/default_ortho_600u_space/keymap.c
diff --git a/keyboards/amj40/keymaps/fabian/keymap.c b/keyboards/amjkeyboard/amj40/keymaps/fabian/keymap.c
index a35337a4e2..a35337a4e2 100755
--- a/keyboards/amj40/keymaps/fabian/keymap.c
+++ b/keyboards/amjkeyboard/amj40/keymaps/fabian/keymap.c
diff --git a/keyboards/amj40/keymaps/fabian/rules.mk b/keyboards/amjkeyboard/amj40/keymaps/fabian/rules.mk
index 59a2cb09a8..59a2cb09a8 100644
--- a/keyboards/amj40/keymaps/fabian/rules.mk
+++ b/keyboards/amjkeyboard/amj40/keymaps/fabian/rules.mk
diff --git a/keyboards/amj40/keymaps/jetpacktuxedo/config.h b/keyboards/amjkeyboard/amj40/keymaps/jetpacktuxedo/config.h
index 7311833201..7311833201 100644
--- a/keyboards/amj40/keymaps/jetpacktuxedo/config.h
+++ b/keyboards/amjkeyboard/amj40/keymaps/jetpacktuxedo/config.h
diff --git a/keyboards/amj40/keymaps/jetpacktuxedo/keymap.c b/keyboards/amjkeyboard/amj40/keymaps/jetpacktuxedo/keymap.c
index caf6700bc3..caf6700bc3 100755
--- a/keyboards/amj40/keymaps/jetpacktuxedo/keymap.c
+++ b/keyboards/amjkeyboard/amj40/keymaps/jetpacktuxedo/keymap.c
diff --git a/keyboards/amj40/keymaps/jetpacktuxedo/readme.md b/keyboards/amjkeyboard/amj40/keymaps/jetpacktuxedo/readme.md
index 64ae16c7eb..64ae16c7eb 100755
--- a/keyboards/amj40/keymaps/jetpacktuxedo/readme.md
+++ b/keyboards/amjkeyboard/amj40/keymaps/jetpacktuxedo/readme.md
diff --git a/keyboards/amj40/keymaps/jetpacktuxedo/rules.mk b/keyboards/amjkeyboard/amj40/keymaps/jetpacktuxedo/rules.mk
index 780d48a438..780d48a438 100644
--- a/keyboards/amj40/keymaps/jetpacktuxedo/rules.mk
+++ b/keyboards/amjkeyboard/amj40/keymaps/jetpacktuxedo/rules.mk
diff --git a/keyboards/amj40/keymaps/myee/build.sh b/keyboards/amjkeyboard/amj40/keymaps/myee/build.sh
index 6b4b4568f5..6b4b4568f5 100644
--- a/keyboards/amj40/keymaps/myee/build.sh
+++ b/keyboards/amjkeyboard/amj40/keymaps/myee/build.sh
diff --git a/keyboards/amj40/keymaps/myee/config.h b/keyboards/amjkeyboard/amj40/keymaps/myee/config.h
index 8e6c4dfa43..8e6c4dfa43 100644
--- a/keyboards/amj40/keymaps/myee/config.h
+++ b/keyboards/amjkeyboard/amj40/keymaps/myee/config.h
diff --git a/keyboards/amj40/keymaps/myee/keymap.c b/keyboards/amjkeyboard/amj40/keymaps/myee/keymap.c
index ec8cdd87db..ec8cdd87db 100644
--- a/keyboards/amj40/keymaps/myee/keymap.c
+++ b/keyboards/amjkeyboard/amj40/keymaps/myee/keymap.c
diff --git a/keyboards/amj40/keymaps/myee/readme.md b/keyboards/amjkeyboard/amj40/keymaps/myee/readme.md
index 2659292ae5..2659292ae5 100644
--- a/keyboards/amj40/keymaps/myee/readme.md
+++ b/keyboards/amjkeyboard/amj40/keymaps/myee/readme.md
diff --git a/keyboards/amj40/keymaps/myee/rules.mk b/keyboards/amjkeyboard/amj40/keymaps/myee/rules.mk
index b8cc8b42c7..b8cc8b42c7 100644
--- a/keyboards/amj40/keymaps/myee/rules.mk
+++ b/keyboards/amjkeyboard/amj40/keymaps/myee/rules.mk
diff --git a/keyboards/amj40/keymaps/myee/updatemerge.sh b/keyboards/amjkeyboard/amj40/keymaps/myee/updatemerge.sh
index da5457e195..da5457e195 100644
--- a/keyboards/amj40/keymaps/myee/updatemerge.sh
+++ b/keyboards/amjkeyboard/amj40/keymaps/myee/updatemerge.sh
diff --git a/keyboards/amj40/readme.md b/keyboards/amjkeyboard/amj40/readme.md
index 1d7316fcf5..f557b9df49 100755
--- a/keyboards/amj40/readme.md
+++ b/keyboards/amjkeyboard/amj40/readme.md
@@ -12,11 +12,11 @@ DIY/Assembled compact 40% keyboard.
Make example for this keyboard (after setting up your build environment):
- make amj40:default
+ make amjkeyboard/amj40:default
Flashing example for this keyboard:
- make amj40:default:flash
+ make amjkeyboard/amj40:default:flash
To reset the board into bootloader mode, hold the key at the top left of the keyboard while connecting the USB cable (also erases persistent settings).
diff --git a/keyboards/amj40/rules.mk b/keyboards/amjkeyboard/amj40/rules.mk
index b27013f863..b27013f863 100755
--- a/keyboards/amj40/rules.mk
+++ b/keyboards/amjkeyboard/amj40/rules.mk
diff --git a/keyboards/amj60/amj60.c b/keyboards/amjkeyboard/amj60/amj60.c
index af0539a679..af0539a679 100644
--- a/keyboards/amj60/amj60.c
+++ b/keyboards/amjkeyboard/amj60/amj60.c
diff --git a/keyboards/amj60/amj60.h b/keyboards/amjkeyboard/amj60/amj60.h
index feda680030..feda680030 100644
--- a/keyboards/amj60/amj60.h
+++ b/keyboards/amjkeyboard/amj60/amj60.h
diff --git a/keyboards/amj60/config.h b/keyboards/amjkeyboard/amj60/config.h
index 1c25e4fea0..4e894a45fc 100644
--- a/keyboards/amj60/config.h
+++ b/keyboards/amjkeyboard/amj60/config.h
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config_common.h"
/* USB Device descriptor parameter */
-#define VENDOR_ID 0xFEED
+#define VENDOR_ID 0x00D8 //A+M+J
#define PRODUCT_ID 0x6066
#define DEVICE_VER 0x0001
#define MANUFACTURER Han Chen
diff --git a/keyboards/amj60/info.json b/keyboards/amjkeyboard/amj60/info.json
index 2c1781738e..2c1781738e 100644
--- a/keyboards/amj60/info.json
+++ b/keyboards/amjkeyboard/amj60/info.json
diff --git a/keyboards/amj60/keymaps/default/keymap.c b/keyboards/amjkeyboard/amj60/keymaps/default/keymap.c
index 6a0a394f54..6a0a394f54 100644
--- a/keyboards/amj60/keymaps/default/keymap.c
+++ b/keyboards/amjkeyboard/amj60/keymaps/default/keymap.c
diff --git a/keyboards/amj60/readme.md b/keyboards/amjkeyboard/amj60/readme.md
index 50cf3cfcb2..8f276bd89f 100644
--- a/keyboards/amj60/readme.md
+++ b/keyboards/amjkeyboard/amj60/readme.md
@@ -11,11 +11,11 @@ A 60% keyboard.
Make example for this keyboard (after setting up your build environment):
- make amj60:default
+ make amjkeyboard/amj60:default
Flashing example for this keyboard:
- make amj60:default:flash
+ make amjkeyboard/amj60:default:flash
To reset the board into bootloader mode, tap the Reset switch mounted on the bottom side of the PCB.
diff --git a/keyboards/amj60/rules.mk b/keyboards/amjkeyboard/amj60/rules.mk
index 602667e948..602667e948 100644
--- a/keyboards/amj60/rules.mk
+++ b/keyboards/amjkeyboard/amj60/rules.mk
diff --git a/keyboards/amjkeyboard/amj66/config.h b/keyboards/amjkeyboard/amj66/config.h
index 1f8a930a6a..cc84524b0b 100644
--- a/keyboards/amjkeyboard/amj66/config.h
+++ b/keyboards/amjkeyboard/amj66/config.h
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config_common.h"
/* USB Device descriptor parameter */
-#define VENDOR_ID 0xFEED
+#define VENDOR_ID 0x00D8 //A+M+J
#define PRODUCT_ID 0xBD66
#define DEVICE_VER 0x0001
#define MANUFACTURER AMJKeyboard
diff --git a/keyboards/amj96/amj96.c b/keyboards/amjkeyboard/amj96/amj96.c
index 65fca6f12a..65fca6f12a 100644
--- a/keyboards/amj96/amj96.c
+++ b/keyboards/amjkeyboard/amj96/amj96.c
diff --git a/keyboards/amj96/amj96.h b/keyboards/amjkeyboard/amj96/amj96.h
index bd4e688360..bd4e688360 100644
--- a/keyboards/amj96/amj96.h
+++ b/keyboards/amjkeyboard/amj96/amj96.h
diff --git a/keyboards/amj96/config.h b/keyboards/amjkeyboard/amj96/config.h
index f5b26220b7..67b3699047 100644
--- a/keyboards/amj96/config.h
+++ b/keyboards/amjkeyboard/amj96/config.h
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config_common.h"
/* USB Device descriptor parameter */
-#define VENDOR_ID 0xFEED
+#define VENDOR_ID 0x00D8 //A+M+J
#define PRODUCT_ID 0x6074
#define DEVICE_VER 0x0002
#define MANUFACTURER Han Chen
diff --git a/keyboards/amj96/info.json b/keyboards/amjkeyboard/amj96/info.json
index b2aac215c0..b2aac215c0 100644
--- a/keyboards/amj96/info.json
+++ b/keyboards/amjkeyboard/amj96/info.json
diff --git a/keyboards/amj96/keymaps/default/keymap.c b/keyboards/amjkeyboard/amj96/keymaps/default/keymap.c
index baa4bef9dc..baa4bef9dc 100644
--- a/keyboards/amj96/keymaps/default/keymap.c
+++ b/keyboards/amjkeyboard/amj96/keymaps/default/keymap.c
diff --git a/keyboards/amj96/matrix.c b/keyboards/amjkeyboard/amj96/matrix.c
index 2999c6241b..2999c6241b 100644
--- a/keyboards/amj96/matrix.c
+++ b/keyboards/amjkeyboard/amj96/matrix.c
diff --git a/keyboards/amj96/readme.md b/keyboards/amjkeyboard/amj96/readme.md
index 8cd4ea94a1..0941b6f3e1 100644
--- a/keyboards/amj96/readme.md
+++ b/keyboards/amjkeyboard/amj96/readme.md
@@ -8,11 +8,11 @@ The AMD96 is a 96 key custom keyboard with anodized aluminum case, twin usb port
Make example for this keyboard (after setting up your build environment):
- make amj96:default
+ make amjkeyboard/amj96:default
Flashing example for this keyboard:
- make amj96:default:flash
+ make amjkeyboard/amj96:default:flash
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/amj96/rules.mk b/keyboards/amjkeyboard/amj96/rules.mk
index 9e9f03f764..9e9f03f764 100644
--- a/keyboards/amj96/rules.mk
+++ b/keyboards/amjkeyboard/amj96/rules.mk
diff --git a/keyboards/amjpad/amjpad.c b/keyboards/amjkeyboard/amjpad/amjpad.c
index 83cdedf688..83cdedf688 100644
--- a/keyboards/amjpad/amjpad.c
+++ b/keyboards/amjkeyboard/amjpad/amjpad.c
diff --git a/keyboards/amjpad/amjpad.h b/keyboards/amjkeyboard/amjpad/amjpad.h
index 976a7ab041..976a7ab041 100644
--- a/keyboards/amjpad/amjpad.h
+++ b/keyboards/amjkeyboard/amjpad/amjpad.h
diff --git a/keyboards/amjpad/config.h b/keyboards/amjkeyboard/amjpad/config.h
index dd8ed34e47..fe621b7bf3 100644
--- a/keyboards/amjpad/config.h
+++ b/keyboards/amjkeyboard/amjpad/config.h
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config_common.h"
/* USB Device descriptor parameter */
-#define VENDOR_ID 0xFEED
+#define VENDOR_ID 0x00D8 //A+M+J
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0003
#define MANUFACTURER AMJ
diff --git a/keyboards/amjpad/info.json b/keyboards/amjkeyboard/amjpad/info.json
index 76147716d2..76147716d2 100644
--- a/keyboards/amjpad/info.json
+++ b/keyboards/amjkeyboard/amjpad/info.json
diff --git a/keyboards/amjpad/keymaps/default/keymap.c b/keyboards/amjkeyboard/amjpad/keymaps/default/keymap.c
index 9df4317bb0..9df4317bb0 100644
--- a/keyboards/amjpad/keymaps/default/keymap.c
+++ b/keyboards/amjkeyboard/amjpad/keymaps/default/keymap.c
diff --git a/keyboards/amjpad/keymaps/max/keymap.c b/keyboards/amjkeyboard/amjpad/keymaps/max/keymap.c
index 7bfaed5999..7bfaed5999 100644
--- a/keyboards/amjpad/keymaps/max/keymap.c
+++ b/keyboards/amjkeyboard/amjpad/keymaps/max/keymap.c
diff --git a/keyboards/amjpad/keymaps/ortho_left/keymap.c b/keyboards/amjkeyboard/amjpad/keymaps/ortho_left/keymap.c
index 815ac2a681..815ac2a681 100644
--- a/keyboards/amjpad/keymaps/ortho_left/keymap.c
+++ b/keyboards/amjkeyboard/amjpad/keymaps/ortho_left/keymap.c
diff --git a/keyboards/amjpad/keymaps/ortho_right/keymap.c b/keyboards/amjkeyboard/amjpad/keymaps/ortho_right/keymap.c
index cbb81a2eab..cbb81a2eab 100644
--- a/keyboards/amjpad/keymaps/ortho_right/keymap.c
+++ b/keyboards/amjkeyboard/amjpad/keymaps/ortho_right/keymap.c
diff --git a/keyboards/amjpad/readme.md b/keyboards/amjkeyboard/amjpad/readme.md
index c069af25ad..98af32edef 100644
--- a/keyboards/amjpad/readme.md
+++ b/keyboards/amjkeyboard/amjpad/readme.md
@@ -9,6 +9,6 @@ Hardware Availability: https://geekhack.org/index.php?topic=83546.0
Make example for this keyboard (after setting up your build environment):
- make amjpad:default
+ make amjkeyboard/amjpad:default
See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
diff --git a/keyboards/amjpad/rules.mk b/keyboards/amjkeyboard/amjpad/rules.mk
index c56fff39b3..c56fff39b3 100644
--- a/keyboards/amjpad/rules.mk
+++ b/keyboards/amjkeyboard/amjpad/rules.mk
diff --git a/keyboards/bt66tech/bt66tech60/chconf.h b/keyboards/bt66tech/bt66tech60/chconf.h
deleted file mode 100644
index 93c4ebe405..0000000000
--- a/keyboards/bt66tech/bt66tech60/chconf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/bt66tech/bt66tech60/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/keyboards/cannonkeys/ortho48/chconf.h b/keyboards/cannonkeys/ortho48/chconf.h
deleted file mode 100644
index 583eb9febf..0000000000
--- a/keyboards/cannonkeys/ortho48/chconf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/cannonkeys/ortho48/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/keyboards/cannonkeys/ortho60/chconf.h b/keyboards/cannonkeys/ortho60/chconf.h
deleted file mode 100644
index ae16c0f747..0000000000
--- a/keyboards/cannonkeys/ortho60/chconf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/cannonkeys/ortho60/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/keyboards/cannonkeys/ortho75/chconf.h b/keyboards/cannonkeys/ortho75/chconf.h
deleted file mode 100644
index 2bf13952d9..0000000000
--- a/keyboards/cannonkeys/ortho75/chconf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/cannonkeys/ortho75/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/keyboards/cannonkeys/practice60/chconf.h b/keyboards/cannonkeys/practice60/chconf.h
deleted file mode 100644
index ddf9c24df7..0000000000
--- a/keyboards/cannonkeys/practice60/chconf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/cannonkeys/practice60/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/keyboards/cannonkeys/practice65/chconf.h b/keyboards/cannonkeys/practice65/chconf.h
deleted file mode 100644
index 0f412cfbf4..0000000000
--- a/keyboards/cannonkeys/practice65/chconf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/cannonkeys/practice65/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/keyboards/converter/siemens_tastatur/chconf.h b/keyboards/converter/siemens_tastatur/chconf.h
deleted file mode 100644
index eed5776e77..0000000000
--- a/keyboards/converter/siemens_tastatur/chconf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/converter/siemens_tastatur/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/keyboards/converter/usb_usb/info.json b/keyboards/converter/usb_usb/info.json
index 5ba1a46b71..8df3bb3e76 100644
--- a/keyboards/converter/usb_usb/info.json
+++ b/keyboards/converter/usb_usb/info.json
@@ -1,483 +1,555 @@
{
- "keyboard_name": "converter/usb_usb",
- "url": "",
- "maintainer": "qmk",
- "layouts": {
- "LAYOUT_all": {
- "layout": [
- {"label":"F13", "x":2, "y":0},
- {"label":"F14", "x":3, "y":0},
- {"label":"F15", "x":4, "y":0},
- {"label":"F16", "x":5, "y":0},
- {"label":"F17", "x":6.5, "y":0},
- {"label":"F18", "x":7.5, "y":0},
- {"label":"F19", "x":8.5, "y":0},
- {"label":"F20", "x":9.5, "y":0},
- {"label":"F21", "x":11, "y":0},
- {"label":"F22", "x":12, "y":0},
- {"label":"F23", "x":13, "y":0},
- {"label":"F24", "x":14, "y":0},
- {"label":"Esc", "x":0, "y":1},
- {"label":"F1", "x":2, "y":1},
- {"label":"F2", "x":3, "y":1},
- {"label":"F3", "x":4, "y":1},
- {"label":"F4", "x":5, "y":1},
- {"label":"F5", "x":6.5, "y":1},
- {"label":"F6", "x":7.5, "y":1},
- {"label":"F7", "x":8.5, "y":1},
- {"label":"F8", "x":9.5, "y":1},
- {"label":"F9", "x":11, "y":1},
- {"label":"F10", "x":12, "y":1},
- {"label":"F11", "x":13, "y":1},
- {"label":"F12", "x":14, "y":1},
- {"label":"Print Screen", "x":15.25, "y":1},
- {"label":"Scroll Lock", "x":16.25, "y":1},
- {"label":"Pause", "x":17.25, "y":1},
- {"label":"Volume Down", "x":18.5, "y":1},
- {"label":"Vol Up", "x":19.5, "y":1},
- {"label":"Mute", "x":20.5, "y":1},
- {"label":"Power", "x":21.5, "y":1},
- {"label":"Help", "x":22.75, "y":1},
- {"label":"`", "x":0, "y":2.5},
- {"label":"1", "x":1, "y":2.5},
- {"label":"2", "x":2, "y":2.5},
- {"label":"3", "x":3, "y":2.5},
- {"label":"4", "x":4, "y":2.5},
- {"label":"5", "x":5, "y":2.5},
- {"label":"6", "x":6, "y":2.5},
- {"label":"7", "x":7, "y":2.5},
- {"label":"8", "x":8, "y":2.5},
- {"label":"9", "x":9, "y":2.5},
- {"label":"0", "x":10, "y":2.5},
- {"label":"-", "x":11, "y":2.5},
- {"label":"=", "x":12, "y":2.5},
- {"label":"Yen", "x":13, "y":2.5},
- {"label":"Back Space", "x":14, "y":2.5},
- {"label":"Insert", "x":15.25, "y":2.5},
- {"label":"Home", "x":16.25, "y":2.5},
- {"label":"Page Up", "x":17.25, "y":2.5},
- {"label":"Num Lock", "x":18.5, "y":2.5},
- {"label":"Num /", "x":19.5, "y":2.5},
- {"label":"Num *", "x":20.5, "y":2.5},
- {"label":"Num -", "x":21.5, "y":2.5},
- {"label":"Stop", "x":22.75, "y":2.5},
- {"label":"Again", "x":23.75, "y":2.5},
- {"label":"Tab", "x":0, "y":3.5, "w":1.5},
- {"label":"Q", "x":1.5, "y":3.5},
- {"label":"W", "x":2.5, "y":3.5},
- {"label":"E", "x":3.5, "y":3.5},
- {"label":"R", "x":4.5, "y":3.5},
- {"label":"T", "x":5.5, "y":3.5},
- {"label":"Y", "x":6.5, "y":3.5},
- {"label":"U", "x":7.5, "y":3.5},
- {"label":"I", "x":8.5, "y":3.5},
- {"label":"O", "x":9.5, "y":3.5},
- {"label":"P", "x":10.5, "y":3.5},
- {"label":"[", "x":11.5, "y":3.5},
- {"label":"]", "x":12.5, "y":3.5},
- {"label":"\\", "x":13.5, "y":3.5, "w":1.5},
- {"label":"Delete", "x":15.25, "y":3.5},
- {"label":"End", "x":16.25, "y":3.5},
- {"label":"Page Down", "x":17.25, "y":3.5},
- {"label":"Num 7", "x":18.5, "y":3.5},
- {"label":"Num 8", "x":19.5, "y":3.5},
- {"label":"Num 9", "x":20.5, "y":3.5},
- {"label":"Num +", "x":21.5, "y":3.5},
- {"label":"Menu", "x":22.75, "y":3.5},
- {"label":"Undo", "x":23.75, "y":3.5},
- {"label":"Caps Lock", "x":0, "y":4.5, "w":1.75},
- {"label":"A", "x":1.75, "y":4.5},
- {"label":"S", "x":2.75, "y":4.5},
- {"label":"D", "x":3.75, "y":4.5},
- {"label":"F", "x":4.75, "y":4.5},
- {"label":"G", "x":5.75, "y":4.5},
- {"label":"H", "x":6.75, "y":4.5},
- {"label":"J", "x":7.75, "y":4.5},
- {"label":"K", "x":8.75, "y":4.5},
- {"label":"L", "x":9.75, "y":4.5},
- {"label":";", "x":10.75, "y":4.5},
- {"label":"\"", "x":11.75, "y":4.5},
- {"label":"ISO #", "x":12.75, "y":4.5},
- {"label":"Enter", "x":13.75, "y":4.5, "w":1.25},
- {"label":"Num 4", "x":18.5, "y":4.5},
- {"label":"Num 5", "x":19.5, "y":4.5},
- {"label":"Num 6", "x":20.5, "y":4.5},
- {"label":"Num , ", "x":21.5, "y":4.5},
- {"label":"Select", "x":22.75, "y":4.5},
- {"label":"Copy", "x":23.75, "y":4.5},
- {"label":"Shift", "x":0, "y":5.5, "w":1.25},
- {"label":"ISO \\", "x":1.25, "y":5.5},
- {"label":"Z", "x":2.25, "y":5.5},
- {"label":"X", "x":3.25, "y":5.5},
- {"label":"C", "x":4.25, "y":5.5},
- {"label":"V", "x":5.25, "y":5.5},
- {"label":"B", "x":6.25, "y":5.5},
- {"label":"N", "x":7.25, "y":5.5},
- {"label":"M", "x":8.25, "y":5.5},
- {"label":",", "x":9.25, "y":5.5},
- {"label":".", "x":10.25, "y":5.5},
- {"label":"/", "x":11.25, "y":5.5},
- {"label":"JIS \\", "x":12.25, "y":5.5},
- {"label":"Shift", "x":13.25, "y":5.5, "w":1.75},
- {"label":"Up", "x":16.25, "y":5.5},
- {"label":"Num 1", "x":18.5, "y":5.5},
- {"label":"Num 2", "x":19.5, "y":5.5},
- {"label":"Num 3", "x":20.5, "y":5.5},
- {"label":"Num =", "x":21.5, "y":5.5},
- {"label":"Exec", "x":22.75, "y":5.5},
- {"label":"Paste", "x":23.75, "y":5.5},
- {"label":"Ctrl", "x":0, "y":6.5},
- {"label":"GUI", "x":1, "y":6.5},
- {"label":"Alt", "x":2, "y":6.5},
- {"label":"JIS Muhenkan", "x":3, "y":6.5},
- {"label":"Hanja", "x":4, "y":6.5},
- {"label":"Space", "x":5, "y":6.5, "w":3},
- {"label":"Hangul/English", "x":8, "y":6.5},
- {"label":"JIS Henkan", "x":9, "y":6.5},
- {"label":"JIS Katakana/Hiragana", "x":10, "y":6.5},
- {"label":"Alt", "x":11, "y":6.5},
- {"label":"GUI", "x":12, "y":6.5},
- {"label":"App", "x":13, "y":6.5},
- {"label":"Ctrl", "x":14, "y":6.5},
- {"label":"Left", "x":15.25, "y":6.5},
- {"label":"Down", "x":16.25, "y":6.5},
- {"label":"Right", "x":17.25, "y":6.5},
- {"label":"Num 0", "x":18.5, "y":6.5, "w":2},
- {"label":"Num .", "x":20.5, "y":6.5},
- {"label":"Num Enter", "x":21.5, "y":6.5},
- {"label":"Find", "x":22.75, "y":6.5},
- {"label":"Cut", "x":23.75, "y":6.5}
- ]
- },
- "LAYOUT_ansi": {
- "layout": [
- {"label":"Esc", "x":0, "y":0},
- {"label":"F1", "x":2, "y":0},
- {"label":"F2", "x":3, "y":0},
- {"label":"F3", "x":4, "y":0},
- {"label":"F4", "x":5, "y":0},
- {"label":"F5", "x":6.5, "y":0},
- {"label":"F6", "x":7.5, "y":0},
- {"label":"F7", "x":8.5, "y":0},
- {"label":"F8", "x":9.5, "y":0},
- {"label":"F9", "x":11, "y":0},
- {"label":"F10", "x":12, "y":0},
- {"label":"F11", "x":13, "y":0},
- {"label":"F12", "x":14, "y":0},
- {"label":"PrtSc", "x":15.25, "y":0},
- {"label":"Scroll Lock", "x":16.25, "y":0},
- {"label":"Pause", "x":17.25, "y":0},
- {"label":"`", "x":0, "y":1.5},
- {"label":"1", "x":1, "y":1.5},
- {"label":"2", "x":2, "y":1.5},
- {"label":"3", "x":3, "y":1.5},
- {"label":"4", "x":4, "y":1.5},
- {"label":"5", "x":5, "y":1.5},
- {"label":"6", "x":6, "y":1.5},
- {"label":"7", "x":7, "y":1.5},
- {"label":"8", "x":8, "y":1.5},
- {"label":"9", "x":9, "y":1.5},
- {"label":"0", "x":10, "y":1.5},
- {"label":"-", "x":11, "y":1.5},
- {"label":"=", "x":12, "y":1.5},
- {"label":"Backspace", "x":13, "y":1.5, "w":2},
- {"label":"Insert", "x":15.25, "y":1.5},
- {"label":"Home", "x":16.25, "y":1.5},
- {"label":"Page Up", "x":17.25, "y":1.5},
- {"label":"Num Lock", "x":18.5, "y":1.5},
- {"label":"Num /", "x":19.5, "y":1.5},
- {"label":"Num *", "x":20.5, "y":1.5},
- {"label":"Num -", "x":21.5, "y":1.5},
- {"label":"Tab", "x":0, "y":2.5, "w":1.5},
- {"label":"Q", "x":1.5, "y":2.5},
- {"label":"W", "x":2.5, "y":2.5},
- {"label":"E", "x":3.5, "y":2.5},
- {"label":"R", "x":4.5, "y":2.5},
- {"label":"T", "x":5.5, "y":2.5},
- {"label":"Y", "x":6.5, "y":2.5},
- {"label":"U", "x":7.5, "y":2.5},
- {"label":"I", "x":8.5, "y":2.5},
- {"label":"O", "x":9.5, "y":2.5},
- {"label":"P", "x":10.5, "y":2.5},
- {"label":"[", "x":11.5, "y":2.5},
- {"label":"]", "x":12.5, "y":2.5},
- {"label":"\\", "x":13.5, "y":2.5, "w":1.5},
- {"label":"Delete", "x":15.25, "y":2.5},
- {"label":"End", "x":16.25, "y":2.5},
- {"label":"Page Down", "x":17.25, "y":2.5},
- {"label":"Num 7", "x":18.5, "y":2.5},
- {"label":"Num 8", "x":19.5, "y":2.5},
- {"label":"Num 9", "x":20.5, "y":2.5},
- {"label":"Caps Lock", "x":0, "y":3.5, "w":1.75},
- {"label":"A", "x":1.75, "y":3.5},
- {"label":"S", "x":2.75, "y":3.5},
- {"label":"D", "x":3.75, "y":3.5},
- {"label":"F", "x":4.75, "y":3.5},
- {"label":"G", "x":5.75, "y":3.5},
- {"label":"H", "x":6.75, "y":3.5},
- {"label":"J", "x":7.75, "y":3.5},
- {"label":"K", "x":8.75, "y":3.5},
- {"label":"L", "x":9.75, "y":3.5},
- {"label":":", "x":10.75, "y":3.5},
- {"label":"\"", "x":11.75, "y":3.5},
- {"label":"Enter", "x":12.75, "y":3.5, "w":2.25},
- {"label":"Num 4", "x":18.5, "y":3.5},
- {"label":"Num 5", "x":19.5, "y":3.5},
- {"label":"Num 6", "x":20.5, "y":3.5},
- {"label":"Num +", "x":21.5, "y":2.5, "h":2},
- {"label":"Shift", "x":0, "y":4.5, "w":2.25},
- {"label":"Z", "x":2.25, "y":4.5},
- {"label":"X", "x":3.25, "y":4.5},
- {"label":"C", "x":4.25, "y":4.5},
- {"label":"V", "x":5.25, "y":4.5},
- {"label":"B", "x":6.25, "y":4.5},
- {"label":"N", "x":7.25, "y":4.5},
- {"label":"M", "x":8.25, "y":4.5},
- {"label":",", "x":9.25, "y":4.5},
- {"label":".", "x":10.25, "y":4.5},
- {"label":"/", "x":11.25, "y":4.5},
- {"label":"Shift", "x":12.25, "y":4.5, "w":2.75},
- {"label":"Up", "x":16.25, "y":4.5},
- {"label":"Num 1", "x":18.5, "y":4.5},
- {"label":"Num 2", "x":19.5, "y":4.5},
- {"label":"Num 3", "x":20.5, "y":4.5},
- {"label":"Ctrl", "x":0, "y":5.5, "w":1.25},
- {"label":"GUI", "x":1.25, "y":5.5, "w":1.25},
- {"label":"Alt", "x":2.5, "y":5.5, "w":1.25},
- {"label":"Space", "x":3.75, "y":5.5, "w":6.25},
- {"label":"Alt", "x":10, "y":5.5, "w":1.25},
- {"label":"GUI", "x":11.25, "y":5.5, "w":1.25},
- {"label":"Menu", "x":12.5, "y":5.5, "w":1.25},
- {"label":"Ctrl", "x":13.75, "y":5.5, "w":1.25},
- {"label":"Left", "x":15.25, "y":5.5},
- {"label":"Down", "x":16.25, "y":5.5},
- {"label":"Right", "x":17.25, "y":5.5},
- {"label":"Num 0", "x":18.5, "y":5.5, "w":2},
- {"label":"Num .", "x":20.5, "y":5.5},
- {"label":"Num Enter", "x":21.5, "y":4.5, "h":2}
- ]
- },
- "LAYOUT_iso": {
- "layout": [
- {"label":"Esc", "x":0, "y":0},
- {"label":"F1", "x":2, "y":0},
- {"label":"F2", "x":3, "y":0},
- {"label":"F3", "x":4, "y":0},
- {"label":"F4", "x":5, "y":0},
- {"label":"F5", "x":6.5, "y":0},
- {"label":"F6", "x":7.5, "y":0},
- {"label":"F7", "x":8.5, "y":0},
- {"label":"F8", "x":9.5, "y":0},
- {"label":"F9", "x":11, "y":0},
- {"label":"F10", "x":12, "y":0},
- {"label":"F11", "x":13, "y":0},
- {"label":"F12", "x":14, "y":0},
- {"label":"Print Screen", "x":15.25, "y":0},
- {"label":"Scroll Lock", "x":16.25, "y":0},
- {"label":"Pause", "x":17.25, "y":0},
- {"label":"`", "x":0, "y":1.5},
- {"label":"1", "x":1, "y":1.5},
- {"label":"2", "x":2, "y":1.5},
- {"label":"3", "x":3, "y":1.5},
- {"label":"4", "x":4, "y":1.5},
- {"label":"5", "x":5, "y":1.5},
- {"label":"6", "x":6, "y":1.5},
- {"label":"7", "x":7, "y":1.5},
- {"label":"8", "x":8, "y":1.5},
- {"label":"9", "x":9, "y":1.5},
- {"label":"0", "x":10, "y":1.5},
- {"label":"-", "x":11, "y":1.5},
- {"label":"=", "x":12, "y":1.5},
- {"label":"Backspace", "x":13, "y":1.5, "w":2},
- {"label":"Insert", "x":15.25, "y":1.5},
- {"label":"Home", "x":16.25, "y":1.5},
- {"label":"Page Up", "x":17.25, "y":1.5},
- {"label":"Num Lock", "x":18.5, "y":1.5},
- {"label":"Num /", "x":19.5, "y":1.5},
- {"label":"Num *", "x":20.5, "y":1.5},
- {"label":"Num -", "x":21.5, "y":1.5},
- {"label":"Tab", "x":0, "y":2.5, "w":1.5},
- {"label":"Q", "x":1.5, "y":2.5},
- {"label":"W", "x":2.5, "y":2.5},
- {"label":"E", "x":3.5, "y":2.5},
- {"label":"R", "x":4.5, "y":2.5},
- {"label":"T", "x":5.5, "y":2.5},
- {"label":"Y", "x":6.5, "y":2.5},
- {"label":"U", "x":7.5, "y":2.5},
- {"label":"I", "x":8.5, "y":2.5},
- {"label":"O", "x":9.5, "y":2.5},
- {"label":"P", "x":10.5, "y":2.5},
- {"label":"[", "x":11.5, "y":2.5},
- {"label":"]", "x":12.5, "y":2.5},
- {"label":"Enter", "x":13.75, "y":2.5, "w":1.25, "h":2},
- {"label":"Delete", "x":15.25, "y":2.5},
- {"label":"End", "x":16.25, "y":2.5},
- {"label":"Page Down", "x":17.25, "y":2.5},
- {"label":"Num 7", "x":18.5, "y":2.5},
- {"label":"Num 8", "x":19.5, "y":2.5},
- {"label":"Num 9", "x":20.5, "y":2.5},
- {"label":"Num +", "x":21.5, "y":2.5, "h":2},
- {"label":"Caps Lock", "x":0, "y":3.5, "w":1.75},
- {"label":"A", "x":1.75, "y":3.5},
- {"label":"S", "x":2.75, "y":3.5},
- {"label":"D", "x":3.75, "y":3.5},
- {"label":"F", "x":4.75, "y":3.5},
- {"label":"G", "x":5.75, "y":3.5},
- {"label":"H", "x":6.75, "y":3.5},
- {"label":"J", "x":7.75, "y":3.5},
- {"label":"K", "x":8.75, "y":3.5},
- {"label":"L", "x":9.75, "y":3.5},
- {"label":";", "x":10.75, "y":3.5},
- {"label":"'", "x":11.75, "y":3.5},
- {"label":"ISO #", "x":12.75, "y":3.5},
- {"label":"Num 4", "x":18.5, "y":3.5},
- {"label":"Num 5", "x":19.5, "y":3.5},
- {"label":"Num 6", "x":20.5, "y":3.5},
- {"label":"Shift", "x":0, "y":4.5, "w":1.25},
- {"label":"ISO \\", "x":1.25, "y":4.5},
- {"label":"Z", "x":2.25, "y":4.5},
- {"label":"X", "x":3.25, "y":4.5},
- {"label":"C", "x":4.25, "y":4.5},
- {"label":"V", "x":5.25, "y":4.5},
- {"label":"B", "x":6.25, "y":4.5},
- {"label":"N", "x":7.25, "y":4.5},
- {"label":"M", "x":8.25, "y":4.5},
- {"label":",", "x":9.25, "y":4.5},
- {"label":".", "x":10.25, "y":4.5},
- {"label":"/", "x":11.25, "y":4.5},
- {"label":"Shift", "x":12.25, "y":4.5, "w":2.75},
- {"label":"Up", "x":16.25, "y":4.5},
- {"label":"Num 1", "x":18.5, "y":4.5},
- {"label":"Num 2", "x":19.5, "y":4.5},
- {"label":"Num 3", "x":20.5, "y":4.5},
- {"label":"Num Enter", "x":21.5, "y":4.5, "h":2},
- {"label":"Ctrl", "x":0, "y":5.5, "w":1.25},
- {"label":"GUI", "x":1.25, "y":5.5, "w":1.25},
- {"label":"Alt", "x":2.5, "y":5.5, "w":1.25},
- {"label":"Space", "x":3.75, "y":5.5, "w":6.25},
- {"label":"AltGr", "x":10, "y":5.5, "w":1.25},
- {"label":"GUI", "x":11.25, "y":5.5, "w":1.25},
- {"label":"Menu", "x":12.5, "y":5.5, "w":1.25},
- {"label":"Ctrl", "x":13.75, "y":5.5, "w":1.25},
- {"label":"Left", "x":15.25, "y":5.5},
- {"label":"Down", "x":16.25, "y":5.5},
- {"label":"Right", "x":17.25, "y":5.5},
- {"label":"Num 0", "x":18.5, "y":5.5, "w":2},
- {"label":"Num .", "x":20.5, "y":5.5}
- ]
- },
- "LAYOUT_jis": {
- "layout": [
- {"label":"Esc", "x":0, "y":0},
- {"label":"F1", "x":2, "y":0},
- {"label":"F2", "x":3, "y":0},
- {"label":"F3", "x":4, "y":0},
- {"label":"F4", "x":5, "y":0},
- {"label":"F5", "x":6.5, "y":0},
- {"label":"F6", "x":7.5, "y":0},
- {"label":"F7", "x":8.5, "y":0},
- {"label":"F8", "x":9.5, "y":0},
- {"label":"F9", "x":11, "y":0},
- {"label":"F10", "x":12, "y":0},
- {"label":"F11", "x":13, "y":0},
- {"label":"F12", "x":14, "y":0},
- {"label":"Print Screen", "x":15.25, "y":0},
- {"label":"Scroll Lock", "x":16.25, "y":0},
- {"label":"Pause", "x":17.25, "y":0},
- {"label":"JIS Hankaku / Zenkaku", "x":0, "y":1.5},
- {"label":"1", "x":1, "y":1.5},
- {"label":"2", "x":2, "y":1.5},
- {"label":"3", "x":3, "y":1.5},
- {"label":"4", "x":4, "y":1.5},
- {"label":"5", "x":5, "y":1.5},
- {"label":"6", "x":6, "y":1.5},
- {"label":"7", "x":7, "y":1.5},
- {"label":"8", "x":8, "y":1.5},
- {"label":"9", "x":9, "y":1.5},
- {"label":"0", "x":10, "y":1.5},
- {"label":"-", "x":11, "y":1.5},
- {"label":"&circ;", "x":12, "y":1.5},
- {"label":"JIS Yen", "x":13, "y":1.5},
- {"label":"Back Space", "x":14, "y":1.5},
- {"label":"Insert", "x":15.25, "y":1.5},
- {"label":"Home", "x":16.25, "y":1.5},
- {"label":"Page Up", "x":17.25, "y":1.5},
- {"label":"Num Lock", "x":18.5, "y":1.5},
- {"label":"Num /", "x":19.5, "y":1.5},
- {"label":"Num *", "x":20.5, "y":1.5},
- {"label":"Num -", "x":21.5, "y":1.5},
- {"label":"Tab", "x":0, "y":2.5, "w":1.5},
- {"label":"Q", "x":1.5, "y":2.5},
- {"label":"W", "x":2.5, "y":2.5},
- {"label":"E", "x":3.5, "y":2.5},
- {"label":"R", "x":4.5, "y":2.5},
- {"label":"T", "x":5.5, "y":2.5},
- {"label":"Y", "x":6.5, "y":2.5},
- {"label":"U", "x":7.5, "y":2.5},
- {"label":"I", "x":8.5, "y":2.5},
- {"label":"O", "x":9.5, "y":2.5},
- {"label":"P", "x":10.5, "y":2.5},
- {"label":"@", "x":11.5, "y":2.5},
- {"label":"[", "x":12.5, "y":2.5},
- {"label":"Enter", "x":13.75, "y":2.5, "w":1.25, "h":2},
- {"label":"Delete", "x":15.25, "y":2.5},
- {"label":"End", "x":16.25, "y":2.5},
- {"label":"Page Down", "x":17.25, "y":2.5},
- {"label":"Num 7", "x":18.5, "y":2.5},
- {"label":"Num 8", "x":19.5, "y":2.5},
- {"label":"Num 9", "x":20.5, "y":2.5},
- {"label":"Num +", "x":21.5, "y":2.5, "h":2},
- {"label":"Caps Lock", "x":0, "y":3.5, "w":1.75},
- {"label":"A", "x":1.75, "y":3.5},
- {"label":"S", "x":2.75, "y":3.5},
- {"label":"D", "x":3.75, "y":3.5},
- {"label":"F", "x":4.75, "y":3.5},
- {"label":"G", "x":5.75, "y":3.5},
- {"label":"H", "x":6.75, "y":3.5},
- {"label":"J", "x":7.75, "y":3.5},
- {"label":"K", "x":8.75, "y":3.5},
- {"label":"L", "x":9.75, "y":3.5},
- {"label":";", "x":10.75, "y":3.5},
- {"label":":", "x":11.75, "y":3.5},
- {"label":"]", "x":12.75, "y":3.5},
- {"label":"Num 4", "x":18.5, "y":3.5},
- {"label":"Num 5", "x":19.5, "y":3.5},
- {"label":"Num 6", "x":20.5, "y":3.5},
- {"label":"Shift", "x":0, "y":4.5, "w":2.25},
- {"label":"Z", "x":2.25, "y":4.5},
- {"label":"X", "x":3.25, "y":4.5},
- {"label":"C", "x":4.25, "y":4.5},
- {"label":"V", "x":5.25, "y":4.5},
- {"label":"B", "x":6.25, "y":4.5},
- {"label":"N", "x":7.25, "y":4.5},
- {"label":"M", "x":8.25, "y":4.5},
- {"label":",", "x":9.25, "y":4.5},
- {"label":".", "x":10.25, "y":4.5},
- {"label":"/", "x":11.25, "y":4.5},
- {"label":"JIS \\", "x":12.25, "y":4.5},
- {"label":"Shift", "x":13.25, "y":4.5, "w":1.75},
- {"label":"Up", "x":16.25, "y":4.5},
- {"label":"Num 1", "x":18.5, "y":4.5},
- {"label":"Num 2", "x":19.5, "y":4.5},
- {"label":"Num 3", "x":20.5, "y":4.5},
- {"label":"Num Enter", "x":21.5, "y":4.5, "h":2},
- {"label":"Ctrl", "x":0, "y":5.5, "w":1.25},
- {"label":"GUI", "x":1.25, "y":5.5, "w":1.25},
- {"label":"Alt", "x":2.5, "y":5.5, "w":1.25},
- {"label":"JIS Muhenkan", "x":3.75, "y":5.5, "w":1.25},
- {"label":"Space", "x":5, "y":5.5, "w":2.5},
- {"label":"JIS Henkan", "x":7.5, "y":5.5, "w":1.25},
- {"label":"JIS Hiragana / Katakana", "x":8.75, "y":5.5, "w":1.25},
- {"label":"Alt", "x":10, "y":5.5, "w":1.25},
- {"label":"GUI", "x":11.25, "y":5.5, "w":1.25},
- {"label":"Menu", "x":12.5, "y":5.5, "w":1.25},
- {"label":"Ctrl", "x":13.75, "y":5.5, "w":1.25},
- {"label":"Left", "x":15.25, "y":5.5},
- {"label":"Down", "x":16.25, "y":5.5},
- {"label":"Right", "x":17.25, "y":5.5},
- {"label":"Num 0", "x":18.5, "y":5.5, "w":2},
- {"label":"Num .", "x":20.5, "y":5.5}
- ]
+ "keyboard_name": "converter/usb_usb",
+ "url": "",
+ "maintainer": "qmk",
+ "layouts": {
+ "LAYOUT_all": {
+ "layout": [
+ {"x": 2, "y": 0},
+ {"x": 3, "y": 0},
+ {"x": 4, "y": 0},
+ {"x": 5, "y": 0},
+ {"x": 6.5, "y": 0},
+ {"x": 7.5, "y": 0},
+ {"x": 8.5, "y": 0},
+ {"x": 9.5, "y": 0},
+ {"x": 11, "y": 0},
+ {"x": 12, "y": 0},
+ {"x": 13, "y": 0},
+ {"x": 14, "y": 0},
+
+ {"x": 0, "y": 1},
+
+ {"x": 2, "y": 1},
+ {"x": 3, "y": 1},
+ {"x": 4, "y": 1},
+ {"x": 5, "y": 1},
+ {"x": 6.5, "y": 1},
+ {"x": 7.5, "y": 1},
+ {"x": 8.5, "y": 1},
+ {"x": 9.5, "y": 1},
+ {"x": 11, "y": 1},
+ {"x": 12, "y": 1},
+ {"x": 13, "y": 1},
+ {"x": 14, "y": 1},
+
+ {"x": 15.25, "y": 1},
+ {"x": 16.25, "y": 1},
+ {"x": 17.25, "y": 1},
+
+ {"x": 18.5, "y": 1},
+ {"x": 19.5, "y": 1},
+ {"x": 20.5, "y": 1},
+ {"x": 21.5, "y": 1},
+
+ {"x": 22.75, "y": 1},
+
+ {"x": 0, "y": 2.5},
+ {"x": 1, "y": 2.5},
+ {"x": 2, "y": 2.5},
+ {"x": 3, "y": 2.5},
+ {"x": 4, "y": 2.5},
+ {"x": 5, "y": 2.5},
+ {"x": 6, "y": 2.5},
+ {"x": 7, "y": 2.5},
+ {"x": 8, "y": 2.5},
+ {"x": 9, "y": 2.5},
+ {"x": 10, "y": 2.5},
+ {"x": 11, "y": 2.5},
+ {"x": 12, "y": 2.5},
+ {"x": 13, "y": 2.5},
+ {"x": 14, "y": 2.5},
+
+ {"x": 15.25, "y": 2.5},
+ {"x": 16.25, "y": 2.5},
+ {"x": 17.25, "y": 2.5},
+
+ {"x": 18.5, "y": 2.5},
+ {"x": 19.5, "y": 2.5},
+ {"x": 20.5, "y": 2.5},
+ {"x": 21.5, "y": 2.5},
+
+ {"x": 22.75, "y": 2.5},
+ {"x": 23.75, "y": 2.5},
+
+ {"x": 0, "y": 3.5, "w": 1.5},
+ {"x": 1.5, "y": 3.5},
+ {"x": 2.5, "y": 3.5},
+ {"x": 3.5, "y": 3.5},
+ {"x": 4.5, "y": 3.5},
+ {"x": 5.5, "y": 3.5},
+ {"x": 6.5, "y": 3.5},
+ {"x": 7.5, "y": 3.5},
+ {"x": 8.5, "y": 3.5},
+ {"x": 9.5, "y": 3.5},
+ {"x": 10.5, "y": 3.5},
+ {"x": 11.5, "y": 3.5},
+ {"x": 12.5, "y": 3.5},
+ {"x": 13.5, "y": 3.5, "w": 1.5},
+
+ {"x": 15.25, "y": 3.5},
+ {"x": 16.25, "y": 3.5},
+ {"x": 17.25, "y": 3.5},
+
+ {"x": 18.5, "y": 3.5},
+ {"x": 19.5, "y": 3.5},
+ {"x": 20.5, "y": 3.5},
+ {"x": 21.5, "y": 3.5},
+
+ {"x": 22.75, "y": 3.5},
+ {"x": 23.75, "y": 3.5},
+
+ {"x": 0, "y": 4.5, "w": 1.75},
+ {"x": 1.75, "y": 4.5},
+ {"x": 2.75, "y": 4.5},
+ {"x": 3.75, "y": 4.5},
+ {"x": 4.75, "y": 4.5},
+ {"x": 5.75, "y": 4.5},
+ {"x": 6.75, "y": 4.5},
+ {"x": 7.75, "y": 4.5},
+ {"x": 8.75, "y": 4.5},
+ {"x": 9.75, "y": 4.5},
+ {"x": 10.75, "y": 4.5},
+ {"x": 11.75, "y": 4.5},
+ {"x": 12.75, "y": 4.5},
+ {"x": 13.75, "y": 4.5, "w": 1.25},
+
+ {"x": 18.5, "y": 4.5},
+ {"x": 19.5, "y": 4.5},
+ {"x": 20.5, "y": 4.5},
+ {"x": 21.5, "y": 4.5},
+
+ {"x": 22.75, "y": 4.5},
+ {"x": 23.75, "y": 4.5},
+
+ {"x": 0, "y": 5.5, "w": 1.25},
+ {"x": 1.25, "y": 5.5},
+ {"x": 2.25, "y": 5.5},
+ {"x": 3.25, "y": 5.5},
+ {"x": 4.25, "y": 5.5},
+ {"x": 5.25, "y": 5.5},
+ {"x": 6.25, "y": 5.5},
+ {"x": 7.25, "y": 5.5},
+ {"x": 8.25, "y": 5.5},
+ {"x": 9.25, "y": 5.5},
+ {"x": 10.25, "y": 5.5},
+ {"x": 11.25, "y": 5.5},
+ {"x": 12.25, "y": 5.5},
+ {"x": 13.25, "y": 5.5, "w": 1.75},
+
+ {"x": 16.25, "y": 5.5},
+
+ {"x": 18.5, "y": 5.5},
+ {"x": 19.5, "y": 5.5},
+ {"x": 20.5, "y": 5.5},
+ {"x": 21.5, "y": 5.5},
+
+ {"x": 22.75, "y": 5.5},
+ {"x": 23.75, "y": 5.5},
+
+ {"x": 0, "y": 6.5},
+ {"x": 1, "y": 6.5},
+ {"x": 2, "y": 6.5},
+ {"x": 3, "y": 6.5},
+ {"x": 4, "y": 6.5},
+ {"x": 5, "y": 6.5, "w": 3},
+ {"x": 8, "y": 6.5},
+ {"x": 9, "y": 6.5},
+ {"x": 10, "y": 6.5},
+ {"x": 11, "y": 6.5},
+ {"x": 12, "y": 6.5},
+ {"x": 13, "y": 6.5},
+ {"x": 14, "y": 6.5},
+
+ {"x": 15.25, "y": 6.5},
+ {"x": 16.25, "y": 6.5},
+ {"x": 17.25, "y": 6.5},
+
+ {"x": 18.5, "y": 6.5, "w": 2},
+ {"x": 20.5, "y": 6.5},
+ {"x": 21.5, "y": 6.5},
+
+ {"x": 22.75, "y": 6.5},
+ {"x": 23.75, "y": 6.5}
+ ]
+ },
+ "LAYOUT_fullsize_ansi": {
+ "layout": [
+ {"x": 0, "y": 0},
+
+ {"x": 2, "y": 0},
+ {"x": 3, "y": 0},
+ {"x": 4, "y": 0},
+ {"x": 5, "y": 0},
+ {"x": 6.5, "y": 0},
+ {"x": 7.5, "y": 0},
+ {"x": 8.5, "y": 0},
+ {"x": 9.5, "y": 0},
+ {"x": 11, "y": 0},
+ {"x": 12, "y": 0},
+ {"x": 13, "y": 0},
+ {"x": 14, "y": 0},
+
+ {"x": 15.25, "y": 0},
+ {"x": 16.25, "y": 0},
+ {"x": 17.25, "y": 0},
+
+ {"x": 0, "y": 1.5},
+ {"x": 1, "y": 1.5},
+ {"x": 2, "y": 1.5},
+ {"x": 3, "y": 1.5},
+ {"x": 4, "y": 1.5},
+ {"x": 5, "y": 1.5},
+ {"x": 6, "y": 1.5},
+ {"x": 7, "y": 1.5},
+ {"x": 8, "y": 1.5},
+ {"x": 9, "y": 1.5},
+ {"x": 10, "y": 1.5},
+ {"x": 11, "y": 1.5},
+ {"x": 12, "y": 1.5},
+ {"x": 13, "y": 1.5, "w": 2},
+
+ {"x": 15.25, "y": 1.5},
+ {"x": 16.25, "y": 1.5},
+ {"x": 17.25, "y": 1.5},
+
+ {"x": 18.5, "y": 1.5},
+ {"x": 19.5, "y": 1.5},
+ {"x": 20.5, "y": 1.5},
+ {"x": 21.5, "y": 1.5},
+
+ {"x": 0, "y": 2.5, "w": 1.5},
+ {"x": 1.5, "y": 2.5},
+ {"x": 2.5, "y": 2.5},
+ {"x": 3.5, "y": 2.5},
+ {"x": 4.5, "y": 2.5},
+ {"x": 5.5, "y": 2.5},
+ {"x": 6.5, "y": 2.5},
+ {"x": 7.5, "y": 2.5},
+ {"x": 8.5, "y": 2.5},
+ {"x": 9.5, "y": 2.5},
+ {"x": 10.5, "y": 2.5},
+ {"x": 11.5, "y": 2.5},
+ {"x": 12.5, "y": 2.5},
+ {"x": 13.5, "y": 2.5, "w": 1.5},
+
+ {"x": 15.25, "y": 2.5},
+ {"x": 16.25, "y": 2.5},
+ {"x": 17.25, "y": 2.5},
+
+ {"x": 18.5, "y": 2.5},
+ {"x": 19.5, "y": 2.5},
+ {"x": 20.5, "y": 2.5},
+ {"x": 21.5, "y": 2.5, "h": 2},
+
+ {"x": 0, "y": 3.5, "w": 1.75},
+ {"x": 1.75, "y": 3.5},
+ {"x": 2.75, "y": 3.5},
+ {"x": 3.75, "y": 3.5},
+ {"x": 4.75, "y": 3.5},
+ {"x": 5.75, "y": 3.5},
+ {"x": 6.75, "y": 3.5},
+ {"x": 7.75, "y": 3.5},
+ {"x": 8.75, "y": 3.5},
+ {"x": 9.75, "y": 3.5},
+ {"x": 10.75, "y": 3.5},
+ {"x": 11.75, "y": 3.5},
+ {"x": 12.75, "y": 3.5, "w": 2.25},
+
+ {"x": 18.5, "y": 3.5},
+ {"x": 19.5, "y": 3.5},
+ {"x": 20.5, "y": 3.5},
+
+ {"x": 0, "y": 4.5, "w": 2.25},
+ {"x": 2.25, "y": 4.5},
+ {"x": 3.25, "y": 4.5},
+ {"x": 4.25, "y": 4.5},
+ {"x": 5.25, "y": 4.5},
+ {"x": 6.25, "y": 4.5},
+ {"x": 7.25, "y": 4.5},
+ {"x": 8.25, "y": 4.5},
+ {"x": 9.25, "y": 4.5},
+ {"x": 10.25, "y": 4.5},
+ {"x": 11.25, "y": 4.5},
+ {"x": 12.25, "y": 4.5, "w": 2.75},
+
+ {"x": 16.25, "y": 4.5},
+
+ {"x": 18.5, "y": 4.5},
+ {"x": 19.5, "y": 4.5},
+ {"x": 20.5, "y": 4.5},
+ {"x": 21.5, "y": 4.5, "h": 2},
+
+ {"x": 0, "y": 5.5, "w": 1.25},
+ {"x": 1.25, "y": 5.5, "w": 1.25},
+ {"x": 2.5, "y": 5.5, "w": 1.25},
+ {"x": 3.75, "y": 5.5, "w": 6.25},
+ {"x": 10, "y": 5.5, "w": 1.25},
+ {"x": 11.25, "y": 5.5, "w": 1.25},
+ {"x": 12.5, "y": 5.5, "w": 1.25},
+ {"x": 13.75, "y": 5.5, "w": 1.25},
+
+ {"x": 15.25, "y": 5.5},
+ {"x": 16.25, "y": 5.5},
+ {"x": 17.25, "y": 5.5},
+
+ {"x": 18.5, "y": 5.5, "w": 2},
+ {"x": 20.5, "y": 5.5}
+ ]
+ },
+ "LAYOUT_fullsize_iso": {
+ "layout": [
+ {"x": 0, "y": 0},
+
+ {"x": 2, "y": 0},
+ {"x": 3, "y": 0},
+ {"x": 4, "y": 0},
+ {"x": 5, "y": 0},
+ {"x": 6.5, "y": 0},
+ {"x": 7.5, "y": 0},
+ {"x": 8.5, "y": 0},
+ {"x": 9.5, "y": 0},
+ {"x": 11, "y": 0},
+ {"x": 12, "y": 0},
+ {"x": 13, "y": 0},
+ {"x": 14, "y": 0},
+
+ {"x": 15.25, "y": 0},
+ {"x": 16.25, "y": 0},
+ {"x": 17.25, "y": 0},
+
+ {"x": 0, "y": 1.5},
+ {"x": 1, "y": 1.5},
+ {"x": 2, "y": 1.5},
+ {"x": 3, "y": 1.5},
+ {"x": 4, "y": 1.5},
+ {"x": 5, "y": 1.5},
+ {"x": 6, "y": 1.5},
+ {"x": 7, "y": 1.5},
+ {"x": 8, "y": 1.5},
+ {"x": 9, "y": 1.5},
+ {"x": 10, "y": 1.5},
+ {"x": 11, "y": 1.5},
+ {"x": 12, "y": 1.5},
+ {"x": 13, "y": 1.5, "w": 2},
+
+ {"x": 15.25, "y": 1.5},
+ {"x": 16.25, "y": 1.5},
+ {"x": 17.25, "y": 1.5},
+
+ {"x": 18.5, "y": 1.5},
+ {"x": 19.5, "y": 1.5},
+ {"x": 20.5, "y": 1.5},
+ {"x": 21.5, "y": 1.5},
+
+ {"x": 0, "y": 2.5, "w": 1.5},
+ {"x": 1.5, "y": 2.5},
+ {"x": 2.5, "y": 2.5},
+ {"x": 3.5, "y": 2.5},
+ {"x": 4.5, "y": 2.5},
+ {"x": 5.5, "y": 2.5},
+ {"x": 6.5, "y": 2.5},
+ {"x": 7.5, "y": 2.5},
+ {"x": 8.5, "y": 2.5},
+ {"x": 9.5, "y": 2.5},
+ {"x": 10.5, "y": 2.5},
+ {"x": 11.5, "y": 2.5},
+ {"x": 12.5, "y": 2.5},
+
+ {"x": 15.25, "y": 2.5},
+ {"x": 16.25, "y": 2.5},
+ {"x": 17.25, "y": 2.5},
+
+ {"x": 18.5, "y": 2.5},
+ {"x": 19.5, "y": 2.5},
+ {"x": 20.5, "y": 2.5},
+ {"x": 21.5, "y": 2.5, "h": 2},
+
+ {"x": 0, "y": 3.5, "w": 1.75},
+ {"x": 1.75, "y": 3.5},
+ {"x": 2.75, "y": 3.5},
+ {"x": 3.75, "y": 3.5},
+ {"x": 4.75, "y": 3.5},
+ {"x": 5.75, "y": 3.5},
+ {"x": 6.75, "y": 3.5},
+ {"x": 7.75, "y": 3.5},
+ {"x": 8.75, "y": 3.5},
+ {"x": 9.75, "y": 3.5},
+ {"x": 10.75, "y": 3.5},
+ {"x": 11.75, "y": 3.5},
+ {"x": 12.75, "y": 3.5},
+ {"x": 13.75, "y": 2.5, "w": 1.25, "h": 2},
+
+ {"x": 18.5, "y": 3.5},
+ {"x": 19.5, "y": 3.5},
+ {"x": 20.5, "y": 3.5},
+
+ {"x": 0, "y": 4.5, "w": 1.25},
+ {"x": 1.25, "y": 4.5},
+ {"x": 2.25, "y": 4.5},
+ {"x": 3.25, "y": 4.5},
+ {"x": 4.25, "y": 4.5},
+ {"x": 5.25, "y": 4.5},
+ {"x": 6.25, "y": 4.5},
+ {"x": 7.25, "y": 4.5},
+ {"x": 8.25, "y": 4.5},
+ {"x": 9.25, "y": 4.5},
+ {"x": 10.25, "y": 4.5},
+ {"x": 11.25, "y": 4.5},
+ {"x": 12.25, "y": 4.5, "w": 2.75},
+
+ {"x": 16.25, "y": 4.5},
+
+ {"x": 18.5, "y": 4.5},
+ {"x": 19.5, "y": 4.5},
+ {"x": 20.5, "y": 4.5},
+ {"x": 21.5, "y": 4.5, "h": 2},
+
+ {"x": 0, "y": 5.5, "w": 1.25},
+ {"x": 1.25, "y": 5.5, "w": 1.25},
+ {"x": 2.5, "y": 5.5, "w": 1.25},
+ {"x": 3.75, "y": 5.5, "w": 6.25},
+ {"x": 10, "y": 5.5, "w": 1.25},
+ {"x": 11.25, "y": 5.5, "w": 1.25},
+ {"x": 12.5, "y": 5.5, "w": 1.25},
+ {"x": 13.75, "y": 5.5, "w": 1.25},
+
+ {"x": 15.25, "y": 5.5},
+ {"x": 16.25, "y": 5.5},
+ {"x": 17.25, "y": 5.5},
+
+ {"x": 18.5, "y": 5.5, "w": 2},
+ {"x": 20.5, "y": 5.5}
+ ]
+ },
+ "LAYOUT_fullsize_jis": {
+ "layout": [
+ {"x": 0, "y": 0},
+
+ {"x": 2, "y": 0},
+ {"x": 3, "y": 0},
+ {"x": 4, "y": 0},
+ {"x": 5, "y": 0},
+ {"x": 6.5, "y": 0},
+ {"x": 7.5, "y": 0},
+ {"x": 8.5, "y": 0},
+ {"x": 9.5, "y": 0},
+ {"x": 11, "y": 0},
+ {"x": 12, "y": 0},
+ {"x": 13, "y": 0},
+ {"x": 14, "y": 0},
+
+ {"x": 15.25, "y": 0},
+ {"x": 16.25, "y": 0},
+ {"x": 17.25, "y": 0},
+
+ {"x": 0, "y": 1.5},
+ {"x": 1, "y": 1.5},
+ {"x": 2, "y": 1.5},
+ {"x": 3, "y": 1.5},
+ {"x": 4, "y": 1.5},
+ {"x": 5, "y": 1.5},
+ {"x": 6, "y": 1.5},
+ {"x": 7, "y": 1.5},
+ {"x": 8, "y": 1.5},
+ {"x": 9, "y": 1.5},
+ {"x": 10, "y": 1.5},
+ {"x": 11, "y": 1.5},
+ {"x": 12, "y": 1.5},
+ {"x": 13, "y": 1.5},
+ {"x": 14, "y": 1.5},
+
+ {"x": 15.25, "y": 1.5},
+ {"x": 16.25, "y": 1.5},
+ {"x": 17.25, "y": 1.5},
+
+ {"x": 18.5, "y": 1.5},
+ {"x": 19.5, "y": 1.5},
+ {"x": 20.5, "y": 1.5},
+ {"x": 21.5, "y": 1.5},
+
+ {"x": 0, "y": 2.5, "w": 1.5},
+ {"x": 1.5, "y": 2.5},
+ {"x": 2.5, "y": 2.5},
+ {"x": 3.5, "y": 2.5},
+ {"x": 4.5, "y": 2.5},
+ {"x": 5.5, "y": 2.5},
+ {"x": 6.5, "y": 2.5},
+ {"x": 7.5, "y": 2.5},
+ {"x": 8.5, "y": 2.5},
+ {"x": 9.5, "y": 2.5},
+ {"x": 10.5, "y": 2.5},
+ {"x": 11.5, "y": 2.5},
+ {"x": 12.5, "y": 2.5},
+
+ {"x": 15.25, "y": 2.5},
+ {"x": 16.25, "y": 2.5},
+ {"x": 17.25, "y": 2.5},
+
+ {"x": 18.5, "y": 2.5},
+ {"x": 19.5, "y": 2.5},
+ {"x": 20.5, "y": 2.5},
+ {"x": 21.5, "y": 2.5, "h": 2},
+
+ {"x": 0, "y": 3.5, "w": 1.75},
+ {"x": 1.75, "y": 3.5},
+ {"x": 2.75, "y": 3.5},
+ {"x": 3.75, "y": 3.5},
+ {"x": 4.75, "y": 3.5},
+ {"x": 5.75, "y": 3.5},
+ {"x": 6.75, "y": 3.5},
+ {"x": 7.75, "y": 3.5},
+ {"x": 8.75, "y": 3.5},
+ {"x": 9.75, "y": 3.5},
+ {"x": 10.75, "y": 3.5},
+ {"x": 11.75, "y": 3.5},
+ {"x": 12.75, "y": 3.5},
+ {"x": 13.75, "y": 2.5, "w": 1.25, "h": 2},
+
+ {"x": 18.5, "y": 3.5},
+ {"x": 19.5, "y": 3.5},
+ {"x": 20.5, "y": 3.5},
+
+ {"x": 0, "y": 4.5, "w": 2.25},
+ {"x": 2.25, "y": 4.5},
+ {"x": 3.25, "y": 4.5},
+ {"x": 4.25, "y": 4.5},
+ {"x": 5.25, "y": 4.5},
+ {"x": 6.25, "y": 4.5},
+ {"x": 7.25, "y": 4.5},
+ {"x": 8.25, "y": 4.5},
+ {"x": 9.25, "y": 4.5},
+ {"x": 10.25, "y": 4.5},
+ {"x": 11.25, "y": 4.5},
+ {"x": 12.25, "y": 4.5},
+ {"x": 13.25, "y": 4.5, "w": 1.75},
+
+ {"x": 16.25, "y": 4.5},
+
+ {"x": 18.5, "y": 4.5},
+ {"x": 19.5, "y": 4.5},
+ {"x": 20.5, "y": 4.5},
+ {"x": 21.5, "y": 4.5, "h": 2},
+
+ {"x": 0, "y": 5.5, "w": 1.25},
+ {"x": 1.25, "y": 5.5, "w": 1.25},
+ {"x": 2.5, "y": 5.5, "w": 1.25},
+ {"x": 3.75, "y": 5.5, "w": 1.25},
+ {"x": 5, "y": 5.5, "w": 2.5},
+ {"x": 7.5, "y": 5.5, "w": 1.25},
+ {"x": 8.75, "y": 5.5, "w": 1.25},
+ {"x": 10, "y": 5.5, "w": 1.25},
+ {"x": 11.25, "y": 5.5, "w": 1.25},
+ {"x": 12.5, "y": 5.5, "w": 1.25},
+ {"x": 13.75, "y": 5.5, "w": 1.25},
+
+ {"x": 15.25, "y": 5.5},
+ {"x": 16.25, "y": 5.5},
+ {"x": 17.25, "y": 5.5},
+
+ {"x": 18.5, "y": 5.5, "w": 2},
+ {"x": 20.5, "y": 5.5}
+ ]
+ }
}
- }
}
diff --git a/keyboards/converter/usb_usb/keymaps/chriskopher/keymap.c b/keyboards/converter/usb_usb/keymaps/chriskopher/keymap.c
index 716ff19abd..b9b9c5ad2c 100644
--- a/keyboards/converter/usb_usb/keymaps/chriskopher/keymap.c
+++ b/keyboards/converter/usb_usb/keymaps/chriskopher/keymap.c
@@ -39,10 +39,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_CKO] = LAYOUT_ansi(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
- KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9,
- LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, TD(SCLN_CLN), KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS,
- TD(ESPC_L), LT(_DEV,KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, TD(ESPC_R), KC_UP, KC_P1, KC_P2, KC_P3,
- MEH_T(KC_CAPS), KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LT(_ADJUST,KC_RGUI), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS,
+ LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, TD(SCLN_CLN), KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6,
+ TD(ESPC_L), LT(_DEV,KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, TD(ESPC_R), KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT,
+ MEH_T(KC_CAPS), KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LT(_ADJUST,KC_RGUI), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT
),
/* Regular Qwerty: default layer
@@ -64,10 +64,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT_ansi(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
- KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9,
- KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS,
- KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3,
- KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LT(_ADJUST,KC_RGUI), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT,
+ KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LT(_ADJUST,KC_RGUI), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT
),
/* SuperDuper
@@ -89,10 +89,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_SUPERDUPER] = LAYOUT_ansi(
______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
- ______, ______, ______, ______, ______, ______, ______, C(KC_1), C(S(KC_TAB)), C(KC_TAB), C(KC_9), ______, ______, ______, ______, ______, ______, ______, ______, ______,
- ______, KC_LALT, ______, ______, KC_BSPC, KC_LCTL, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_DEL, ______, ______, ______, ______, ______, ______,
- ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, TG(_SUPERDUPER), ______, ______, ______, ______, ______,
- ______, ______, ______, KC_LSFT, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______
+ ______, ______, ______, ______, ______, ______, ______, C(KC_1), C(S(KC_TAB)), C(KC_TAB), C(KC_9), ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
+ ______, KC_LALT, ______, ______, KC_BSPC, KC_LCTL, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_DEL, ______, ______, ______, ______, ______,
+ ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, TG(_SUPERDUPER), ______, ______, ______, ______, ______, ______,
+ ______, ______, ______, KC_LSFT, ______, ______, ______, ______, ______, ______, ______, ______, ______
),
/* Dev
@@ -114,10 +114,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_DEV] = LAYOUT_ansi(
______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
- ______, ______, ______, ______, ______, ______, ______, KC_MINS, S(KC_EQL), S(KC_9), S(KC_0), ______, ______, ______, ______, ______, ______, ______, ______, ______,
- ______, ______, ______, ______, ______, ______, S(KC_MINS), KC_LBRC, KC_RBRC, S(KC_LBRC), S(KC_RBRC), ______, ______, ______, ______, ______, ______,
- ______, ______, ______, ______, ______, ______, KC_EQL, S(KC_BSLASH), S(KC_COMM), S(KC_DOT), S(KC_SLSH), ______, ______, ______, ______, ______,
- ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______
+ ______, ______, ______, ______, ______, ______, ______, KC_MINS, S(KC_EQL), S(KC_9), S(KC_0), ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
+ ______, ______, ______, ______, ______, ______, S(KC_MINS), KC_LBRC, KC_RBRC, S(KC_LBRC), S(KC_RBRC), ______, ______, ______, ______, ______,
+ ______, ______, ______, ______, ______, ______, KC_EQL, S(KC_BSLASH), S(KC_COMM), S(KC_DOT), S(KC_SLSH), ______, ______, ______, ______, ______, ______,
+ ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______
),
/* Adjust
@@ -139,10 +139,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_ADJUST] = LAYOUT_ansi(
______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, KC_MPLY, KC_MNXT, KC_VOLU, ______, ______, ______, ______,
- ______, DF(_QWERTY), ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, KC_MSTP, KC_MPRV, KC_VOLD, ______, ______, ______,
- ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
- ______, ______, ______, DF(_CKO), ______, ______, KC_MPLY, KC_MUTE, KC_VOLD, KC_VOLU, TG(_SUPERDUPER), ______, ______, ______, ______, ______,
- ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______
+ ______, DF(_QWERTY), ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, KC_MSTP, KC_MPRV, KC_VOLD, ______, ______, ______, ______,
+ ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
+ ______, ______, ______, DF(_CKO), ______, ______, KC_MPLY, KC_MUTE, KC_VOLD, KC_VOLU, TG(_SUPERDUPER), ______, ______, ______, ______, ______, ______,
+ ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______
)
/* Empty layout for future reference
@@ -165,10 +165,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* [_EMPTY] = LAYOUT_ansi(
* ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
* ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
- * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
- * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
- * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
- * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______
+ * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
+ * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
+ * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,
+ * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______
* ),
*/
};
diff --git a/keyboards/converter/usb_usb/rules.mk b/keyboards/converter/usb_usb/rules.mk
index a33c0aaa54..1bdf3416aa 100644
--- a/keyboards/converter/usb_usb/rules.mk
+++ b/keyboards/converter/usb_usb/rules.mk
@@ -22,3 +22,5 @@ CUSTOM_MATRIX = yes
SRC += custom_matrix.cpp
DEFAULT_FOLDER = converter/usb_usb/hasu
+
+LAYOUTS = fullsize_ansi fullsize_iso
diff --git a/keyboards/converter/usb_usb/usb_usb.h b/keyboards/converter/usb_usb/usb_usb.h
index 99baa003cb..bcd8b52974 100644
--- a/keyboards/converter/usb_usb/usb_usb.h
+++ b/keyboards/converter/usb_usb/usb_usb.h
@@ -114,14 +114,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .|Ent|
* `-----------------------------------------------------------' `-----------' `---------------'
*/
-#define LAYOUT_ansi( \
+#define LAYOUT_fullsize_ansi( \
k29, k3A, k3B, k3C, k3D, k3E, k3F, k40, k41, k42, k43, k44, k45, k46, k47, k48, \
\
k35, k1E, k1F, k20, k21, k22, k23, k24, k25, k26, k27, k2D, k2E, k2A, k49, k4A, k4B, k53, k54, k55, k56, \
- k2B, k14, k1A, k08, k15, k17, k1C, k18, k0C, k12, k13, k2F, k30, k31, k4C, k4D, k4E, k5F, k60, k61, \
- k39, k04, k16, k07, k09, k0A, k0B, k0D, k0E, k0F, k33, k34, k28, k5C, k5D, k5E, k57, \
- kE1, k1D, k1B, k06, k19, k05, k11, k10, k36, k37, k38, kE5, k52, k59, k5A, k5B, \
- kE0, kE3, kE2, k2C, kE6, kE7, k65, kE4, k50, k51, k4F, k62, k63, k58 \
+ k2B, k14, k1A, k08, k15, k17, k1C, k18, k0C, k12, k13, k2F, k30, k31, k4C, k4D, k4E, k5F, k60, k61, k57, \
+ k39, k04, k16, k07, k09, k0A, k0B, k0D, k0E, k0F, k33, k34, k28, k5C, k5D, k5E, \
+ kE1, k1D, k1B, k06, k19, k05, k11, k10, k36, k37, k38, kE5, k52, k59, k5A, k5B, k58, \
+ kE0, kE3, kE2, k2C, kE6, kE7, k65, kE4, k50, k51, k4F, k62, k63 \
) { \
{ XXX, XXX, XXX, XXX, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, k0F }, \
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, k1F }, \
@@ -129,8 +129,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{ k30, k31, XXX, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, k3F }, \
{ k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4A, k4B, k4C, k4D, k4E, k4F }, \
{ k50, k51, k52, k53, k54, k55, k56, k57, k58, k59, k5A, k5B, k5C, k5D, k5E, k5F }, \
- { k60, k61, k62, k63, XXX, k65, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX,}, \
- { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX,}, \
+ { k60, k61, k62, k63, XXX, k65, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \
+ { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \
{ XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \
{ XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \
{ XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \
@@ -156,14 +156,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| |
* `-----------------------------------------------------------' `-----------' `---------------'
*/
-#define LAYOUT_iso( \
+#define LAYOUT_fullsize_iso( \
k29, k3A, k3B, k3C, k3D, k3E, k3F, k40, k41, k42, k43, k44, k45, k46, k47, k48, \
\
k35, k1E, k1F, k20, k21, k22, k23, k24, k25, k26, k27, k2D, k2E, k2A, k49, k4A, k4B, k53, k54, k55, k56, \
- k2B, k14, k1A, k08, k15, k17, k1C, k18, k0C, k12, k13, k2F, k30, k28, k4C, k4D, k4E, k5F, k60, k61, k57, \
- k39, k04, k16, k07, k09, k0A, k0B, k0D, k0E, k0F, k33, k34, k32, k5C, k5D, k5E, \
+ k2B, k14, k1A, k08, k15, k17, k1C, k18, k0C, k12, k13, k2F, k30, k4C, k4D, k4E, k5F, k60, k61, k57, \
+ k39, k04, k16, k07, k09, k0A, k0B, k0D, k0E, k0F, k33, k34, k32, k28, k5C, k5D, k5E, \
kE1, k64, k1D, k1B, k06, k19, k05, k11, k10, k36, k37, k38, kE5, k52, k59, k5A, k5B, k58, \
- kE0, kE3, kE2, k2C, kE6, kE7, k65, kE4, k50, k51, k4F, k62, k63 \
+ kE0, kE3, kE2, k2C, kE6, kE7, k65, kE4, k50, k51, k4F, k62, k63 \
) { \
{ XXX, XXX, XXX, XXX, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, k0F }, \
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, k1F }, \
@@ -198,12 +198,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* |Ctl|Gui|Alt|MHEN| Space |HENK|KNA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0| .| |
* `-----------------------------------------------------------' `-----------' `---------------'
*/
-#define LAYOUT_jis( \
+#define LAYOUT_fullsize_jis( \
k29, k3A, k3B, k3C, k3D, k3E, k3F, k40, k41, k42, k43, k44, k45, k46, k47, k48, \
\
k35, k1E, k1F, k20, k21, k22, k23, k24, k25, k26, k27, k2D, k2E, k89, k2A, k49, k4A, k4B, k53, k54, k55, k56, \
- k2B, k14, k1A, k08, k15, k17, k1C, k18, k0C, k12, k13, k2F, k30, k28, k4C, k4D, k4E, k5F, k60, k61, k57, \
- k39, k04, k16, k07, k09, k0A, k0B, k0D, k0E, k0F, k33, k34, k32, k5C, k5D, k5E, \
+ k2B, k14, k1A, k08, k15, k17, k1C, k18, k0C, k12, k13, k2F, k30, k4C, k4D, k4E, k5F, k60, k61, k57, \
+ k39, k04, k16, k07, k09, k0A, k0B, k0D, k0E, k0F, k33, k34, k32, k28, k5C, k5D, k5E, \
kE1, k1D, k1B, k06, k19, k05, k11, k10, k36, k37, k38, k87, kE5, k52, k59, k5A, k5B, k58, \
kE0, kE3, kE2, k8B, k2C, k8A, k88, kE6, kE7, k65, kE4, k50, k51, k4F, k62, k63 \
) { \
@@ -213,8 +213,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{ k30, XXX, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, k3F }, \
{ k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4A, k4B, k4C, k4D, k4E, k4F }, \
{ k50, k51, k52, k53, k54, k55, k56, k57, k58, k59, k5A, k5B, k5C, k5D, k5E, k5F }, \
- { k60, k61, k62, k63, XXX, k65, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX,}, \
- { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX,}, \
+ { k60, k61, k62, k63, XXX, k65, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \
+ { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \
{ XXX, XXX, XXX, XXX, XXX, XXX, XXX, k87, k88, k89, k8A, k8B, XXX, XXX, XXX, XXX }, \
{ XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \
{ XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \
diff --git a/keyboards/draculad/config.h b/keyboards/draculad/config.h
index abcdc76b4b..3060f801c6 100644
--- a/keyboards/draculad/config.h
+++ b/keyboards/draculad/config.h
@@ -61,7 +61,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define ENCODERS_PAD_A {B2 , B4}
#define ENCODERS_PAD_B {B6 , B5}
-#define ENCODER_RESOLUTIONS { 4, 4, 4, 1}
+#define ENCODER_RESOLUTIONS { 4, 4 }
+#define ENCODER_RESOLUTIONS_RIGHT { 4, 1 }
#define UNUSED_PINS
#define EE_HANDS
diff --git a/keyboards/evyd13/wasdat/matrix.c b/keyboards/evyd13/wasdat/matrix.c
index c97dd84694..60a1ea235a 100644
--- a/keyboards/evyd13/wasdat/matrix.c
+++ b/keyboards/evyd13/wasdat/matrix.c
@@ -24,27 +24,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
-/* col 0: C7
- * col 1: B6
- * col 2: C6
- * col 3: B4
- * col 4: B5
- * col 5: D7
+/* Columns 6-12 use a 74HC138 3-to-8 demultiplexer.
*
- * These columns use a 74HC138 3 to 8 bit demultiplexer.
- * A2 A1 A0
- * col / pin: PD0 PD1 PD2
- * 6: 1 1 1
- * 7: 1 1 0
- * 8: 1 0 1
- * 9: 1 0 0
- * 10: 0 1 1
- * 11: 0 1 0
- * 12: 0 0 1
+ * 0: C7
+ * 1: B6
+ * 2: C6
+ * 3: B4
+ * 4: B5
+ * 5: D7
*
- * col 13: D3
- * col 14: B7
- * col 15: B3
+ * A2 A1 A0
+ * D0 D1 D2
+ * 6: 1 1 1
+ * 7: 1 1 0
+ * 8: 1 0 1
+ * 9: 1 0 0
+ * 10: 0 1 1
+ * 11: 0 1 0
+ * 12: 0 0 1
+ *
+ * 13: D3
+ * 14: B7
+ * 15: B3
*/
static void select_col(uint8_t col) {
if (col_pins[col] != NO_PIN) {
@@ -117,10 +118,10 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
}
void matrix_init_custom(void) {
- // initialize key pins
- init_pins();
// initialize demultiplexer
sn74x138_init();
+ // initialize key pins
+ init_pins();
}
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
diff --git a/keyboards/evyd13/wasdat_code/config.h b/keyboards/evyd13/wasdat_code/config.h
index ae009c1c29..a8b5c032ca 100644
--- a/keyboards/evyd13/wasdat_code/config.h
+++ b/keyboards/evyd13/wasdat_code/config.h
@@ -41,22 +41,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#define MATRIX_ROW_PINS { E6, C7, C6, B6, B5, B4, D7, D6 }
-#define MATRIX_COL_PINS { }
+#define MATRIX_COL_PINS { F7, F5, F6, F1, F4, F0, NO_PIN, D5, D3, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN } // Columns 6 and 9-15 controlled by demux
#define UNUSED_PINS
-/* COL2ROW, ROW2COL*/
-#define DIODE_DIRECTION ROW2COL
+#define SN74X138_ADDRESS_PINS { D2, D1, D0 }
+#define SN74X138_E3_PIN D4
// For QMK DFU
#define QMK_ESC_OUTPUT E6
#define QMK_ESC_INPUT F0
#define QMK_LED B1
-/*
- * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
- */
-//#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
-
#define LED_NUM_LOCK_PIN B3
#define LED_CAPS_LOCK_PIN B1
#define LED_SCROLL_LOCK_PIN B2
diff --git a/keyboards/evyd13/wasdat_code/matrix.c b/keyboards/evyd13/wasdat_code/matrix.c
index 7844db7ab7..f30ea3355a 100644
--- a/keyboards/evyd13/wasdat_code/matrix.c
+++ b/keyboards/evyd13/wasdat_code/matrix.c
@@ -14,280 +14,70 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include <stdint.h>
#include <stdbool.h>
-#include "wait.h"
-#include "util.h"
#include "matrix.h"
-#include "debounce.h"
#include "quantum.h"
+#include "sn74x138.h"
-#ifdef DIRECT_PINS
-static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS;
-#elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW)
static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
-//static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
-#endif
-
-// matrix code
-
-#ifdef DIRECT_PINS
-
-static void init_pins(void) {
- for (int row = 0; row < MATRIX_ROWS; row++) {
- for (int col = 0; col < MATRIX_COLS; col++) {
- pin_t pin = direct_pins[row][col];
- if (pin != NO_PIN) {
- setPinInputHigh(pin);
- }
- }
- }
-}
-
-static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
- matrix_row_t last_row_value = current_matrix[current_row];
- current_matrix[current_row] = 0;
-
- for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
- pin_t pin = direct_pins[current_row][col_index];
- if (pin != NO_PIN) {
- current_matrix[current_row] |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index);
- }
- }
-
- return (last_row_value != current_matrix[current_row]);
-}
-
-#elif (DIODE_DIRECTION == COL2ROW)
-
-static void select_row(uint8_t row) {
- setPinOutput(row_pins[row]);
- writePinLow(row_pins[row]);
-}
-
-static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); }
-
-static void unselect_rows(void) {
- for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
- setPinInputHigh(row_pins[x]);
- }
-}
-
-static void init_pins(void) {
- unselect_rows();
- for (uint8_t x = 0; x < MATRIX_COLS; x++) {
- setPinInputHigh(col_pins[x]);
- }
-}
-
-static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
- // Store last value of row prior to reading
- matrix_row_t last_row_value = current_matrix[current_row];
-
- // Clear data in matrix row
- current_matrix[current_row] = 0;
-
- // Select row and wait for row selecton to stabilize
- select_row(current_row);
- wait_us(30);
-
- // For each col...
- for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
-
- // Select the col pin to read (active low)
- uint8_t pin_state = readPin(col_pins[col_index]);
-
- // Populate the matrix row with the state of the col pin
- current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index);
- }
-
- // Unselect row
- unselect_row(current_row);
-
- return (last_row_value != current_matrix[current_row]);
-}
-
-#elif (DIODE_DIRECTION == ROW2COL)
-
-/* Cols 0 - 15
- * col 0: F7
- * col 1: F5
- * col 2: F6
- * col 3: F1
- * col 4: F4
- * col 5: F0
- * These columns use a 74HC237D 3 to 8 bit demultiplexer. D4 is the enable pin, must be set high to use it.
- * A0 A1 A2
- * col / pin: PD2 PD1 PD0
- * 6: 1 1 1
- * col 7: D3
- * col 8: B7
- * 9: 0 1 1
- * 10: 1 0 1
- * 11: 0 0 1
- * 12: 1 1 0
- * 13: 0 1 0
- * 14: 1 0 0
- * 15: 0 0 0
+static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
+
+/* Columns 6 and 9-15 use a 74HC138 3-to-8 demultiplexer.
+ * D4 is the enable pin, must be set high to use it.
+ *
+ * 0: F7
+ * 1: F5
+ * 2: F6
+ * 3: F1
+ * 4: F4
+ * 5: F0
+ *
+ * A2 A1 A0
+ * D0 D1 D2
+ * 6: 1 1 1
+ *
+ * 7: D5
+ * 8: D3
+ *
+ * 9: 1 1 0
+ * 10: 1 0 1
+ * 11: 1 0 0
+ * 12: 0 1 1
+ * 13: 0 1 0
+ * 14: 0 0 1
+ * 15: 0 0 0
*/
static void select_col(uint8_t col) {
- switch (col) {
- case 0:
- writePinLow(F7);
- break;
- case 1:
- writePinLow(F5);
- break;
- case 2:
- writePinLow(F6);
- break;
- case 3:
- writePinLow(F1);
- break;
- case 4:
- writePinLow(F4);
- break;
- case 5:
- writePinLow(F0);
- break;
- case 6:
- writePinHigh(D4);
- writePinHigh(D2);
- writePinHigh(D1);
- writePinHigh(D0);
- break;
- case 7:
- writePinLow(D5);
- break;
- case 8:
- writePinLow(D3);
- break;
- case 9:
- writePinHigh(D4);
- writePinHigh(D1);
- writePinHigh(D0);
- break;
- case 10:
- writePinHigh(D4);
- writePinHigh(D2);
- writePinHigh(D0);
- break;
- case 11:
- writePinHigh(D4);
- writePinHigh(D0);
- break;
- case 12:
- writePinHigh(D4);
- writePinHigh(D2);
- writePinHigh(D1);
- break;
- case 13:
- writePinHigh(D4);
- writePinHigh(D1);
- break;
- case 14:
- writePinHigh(D4);
- writePinHigh(D2);
- break;
- case 15:
- writePinHigh(D4);
- break;
+ if (col_pins[col] != NO_PIN) {
+ writePinLow(col_pins[col]);
+ } else {
+ sn74x138_set_addr((col == 6) ? 7 : 15 - col);
+ sn74x138_set_enabled(true);
}
}
static void unselect_col(uint8_t col) {
- switch (col) {
- case 0:
- writePinHigh(F7);
- break;
- case 1:
- writePinHigh(F5);
- break;
- case 2:
- writePinHigh(F6);
- break;
- case 3:
- writePinHigh(F1);
- break;
- case 4:
- writePinHigh(F4);
- break;
- case 5:
- writePinHigh(F0);
- break;
- case 6:
- writePinLow(D4);
- writePinLow(D2);
- writePinLow(D1);
- writePinLow(D0);
- break;
- case 7:
- writePinHigh(D5);
- break;
- case 8:
- writePinHigh(D3);
- break;
- case 9:
- writePinLow(D4);
- writePinLow(D2);
- writePinLow(D1);
- writePinLow(D0);
- break;
- case 10:
- writePinLow(D4);
- writePinLow(D2);
- writePinLow(D1);
- writePinLow(D0);
- break;
- case 11:
- writePinLow(D4);
- writePinLow(D2);
- writePinLow(D1);
- writePinLow(D0);
- break;
- case 12:
- writePinLow(D4);
- writePinLow(D2);
- writePinLow(D1);
- writePinLow(D0);
- break;
- case 13:
- writePinLow(D4);
- writePinLow(D2);
- writePinLow(D1);
- writePinLow(D0);
- break;
- case 14:
- writePinLow(D4);
- writePinLow(D2);
- writePinLow(D1);
- writePinLow(D0);
- break;
- case 15:
- writePinLow(D4);
- writePinLow(D2);
- writePinLow(D1);
- writePinLow(D0);
- break;
+ if (col_pins[col] != NO_PIN) {
+ setPinOutput(col_pins[col]);
+ writePinHigh(col_pins[col]);
+ } else {
+ sn74x138_set_enabled(false);
}
}
static void unselect_cols(void) {
- //Native
- writePinHigh(F7);
- writePinHigh(F5);
- writePinHigh(F6);
- writePinHigh(F1);
- writePinHigh(F4);
- writePinHigh(F0);
- writePinHigh(D3);
- writePinHigh(D5);
+ // Native
+ for (uint8_t x = 0; x < MATRIX_COLS; x++) {
+ if (col_pins[x] != NO_PIN) {
+ setPinOutput(col_pins[x]);
+ writePinHigh(col_pins[x]);
+ }
+ }
- //Demultiplexer
- writePinLow(D4);
- writePinLow(D2);
- writePinLow(D1);
- writePinLow(D0);
+ // Demultiplexer
+ sn74x138_set_enabled(false);
}
static void init_pins(void) {
@@ -295,27 +85,14 @@ static void init_pins(void) {
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
setPinInputHigh(row_pins[x]);
}
- setPinOutput(D0);
- setPinOutput(D1);
- setPinOutput(D2);
- setPinOutput(D3);
- setPinOutput(F7);
- setPinOutput(F5);
- setPinOutput(F6);
- setPinOutput(F1);
- setPinOutput(F4);
- setPinOutput(F0);
- setPinOutput(D3);
- setPinOutput(D5);
- setPinOutput(D4);
}
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
bool matrix_changed = false;
- // Select col and wait for col selecton to stabilize
+ // Select col and wait for col selection to stabilize
select_col(current_col);
- wait_us(30);
+ matrix_io_delay();
// For each row...
for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
@@ -343,9 +120,9 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
return matrix_changed;
}
-#endif
-
void matrix_init_custom(void) {
+ // initialize demultiplexer
+ sn74x138_init();
// initialize key pins
init_pins();
}
@@ -353,17 +130,10 @@ void matrix_init_custom(void) {
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
bool changed = false;
-#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW)
- // Set row, read cols
- for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
- changed |= read_cols_on_row(current_matrix, current_row);
- }
-#elif (DIODE_DIRECTION == ROW2COL)
// Set col, read rows
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
changed |= read_rows_on_col(current_matrix, current_col);
}
-#endif
return changed;
}
diff --git a/keyboards/evyd13/wasdat_code/rules.mk b/keyboards/evyd13/wasdat_code/rules.mk
index 6fd1fce10e..b37dfa459c 100644
--- a/keyboards/evyd13/wasdat_code/rules.mk
+++ b/keyboards/evyd13/wasdat_code/rules.mk
@@ -18,6 +18,7 @@ RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
CUSTOM_MATRIX = lite
-SRC += matrix.c
+VPATH += drivers/gpio
+SRC += matrix.c sn74x138.c
LAYOUTS = fullsize_ansi fullsize_iso tkl_ansi tkl_iso
diff --git a/keyboards/gboards/gergoplex/config.h b/keyboards/gboards/gergoplex/config.h
index a6d8d6b1be..6a73ccc4ea 100644
--- a/keyboards/gboards/gergoplex/config.h
+++ b/keyboards/gboards/gergoplex/config.h
@@ -44,8 +44,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COL_PINS { B1, B2, B3, D2, D3 }
#define UNUSED_PINS
#define IGNORE_MOD_TAP_INTERRUPT
-#define COMBO_ALLOW_ACTION_KEYS
-#define COMBO_VARIABLE_LEN
#define IS_COMMAND() (get_mods() == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) || get_mods() == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)))
diff --git a/keyboards/gboards/gergoplex/keymaps/colemak-dhm/config.h b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/config.h
new file mode 100644
index 0000000000..1b30cc73b3
--- /dev/null
+++ b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/config.h
@@ -0,0 +1,4 @@
+#pragma once
+
+#define COMBO_ALLOW_ACTION_KEYS
+#define COMBO_VARIABLE_LEN
diff --git a/keyboards/gboards/gergoplex/keymaps/colemak-dhm/rules.mk b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/rules.mk
index e882b8008d..620cab16c0 100644
--- a/keyboards/gboards/gergoplex/keymaps/colemak-dhm/rules.mk
+++ b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/rules.mk
@@ -10,6 +10,7 @@ DEBUG_MATRIX = no
CONSOLE_ENABLE = no
#Combos!
+COMBO_ENABLE = yes
VPATH += keyboards/gboards/
ifeq ($(strip $(DEBUG_MATRIX)), yes)
diff --git a/keyboards/gboards/gergoplex/keymaps/default/config.h b/keyboards/gboards/gergoplex/keymaps/default/config.h
new file mode 100644
index 0000000000..1b30cc73b3
--- /dev/null
+++ b/keyboards/gboards/gergoplex/keymaps/default/config.h
@@ -0,0 +1,4 @@
+#pragma once
+
+#define COMBO_ALLOW_ACTION_KEYS
+#define COMBO_VARIABLE_LEN
diff --git a/keyboards/gboards/gergoplex/keymaps/default/rules.mk b/keyboards/gboards/gergoplex/keymaps/default/rules.mk
index e882b8008d..620cab16c0 100644
--- a/keyboards/gboards/gergoplex/keymaps/default/rules.mk
+++ b/keyboards/gboards/gergoplex/keymaps/default/rules.mk
@@ -10,6 +10,7 @@ DEBUG_MATRIX = no
CONSOLE_ENABLE = no
#Combos!
+COMBO_ENABLE = yes
VPATH += keyboards/gboards/
ifeq ($(strip $(DEBUG_MATRIX)), yes)
diff --git a/keyboards/gboards/gergoplex/keymaps/georgepetri/config.h b/keyboards/gboards/gergoplex/keymaps/georgepetri/config.h
index d3fe5b8145..f66c334b85 100644
--- a/keyboards/gboards/gergoplex/keymaps/georgepetri/config.h
+++ b/keyboards/gboards/gergoplex/keymaps/georgepetri/config.h
@@ -25,3 +25,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#undef DEBOUNCE
#define DEBOUNCE 25
+#define COMBO_ALLOW_ACTION_KEYS
+#define COMBO_VARIABLE_LEN
diff --git a/keyboards/gboards/gergoplex/keymaps/georgepetri/rules.mk b/keyboards/gboards/gergoplex/keymaps/georgepetri/rules.mk
index e4064d4932..74d02c23bd 100644
--- a/keyboards/gboards/gergoplex/keymaps/georgepetri/rules.mk
+++ b/keyboards/gboards/gergoplex/keymaps/georgepetri/rules.mk
@@ -10,6 +10,7 @@ DEBUG_MATRIX = no
CONSOLE_ENABLE = no
#Combos!
+COMBO_ENABLE = yes
VPATH += keyboards/gboards/
ifeq ($(strip $(DEBUG_MATRIX)), yes)
diff --git a/keyboards/gboards/gergoplex/keymaps/tgrosinger/config.h b/keyboards/gboards/gergoplex/keymaps/tgrosinger/config.h
new file mode 100644
index 0000000000..1b30cc73b3
--- /dev/null
+++ b/keyboards/gboards/gergoplex/keymaps/tgrosinger/config.h
@@ -0,0 +1,4 @@
+#pragma once
+
+#define COMBO_ALLOW_ACTION_KEYS
+#define COMBO_VARIABLE_LEN
diff --git a/keyboards/gboards/gergoplex/keymaps/tgrosinger/rules.mk b/keyboards/gboards/gergoplex/keymaps/tgrosinger/rules.mk
index e882b8008d..620cab16c0 100644
--- a/keyboards/gboards/gergoplex/keymaps/tgrosinger/rules.mk
+++ b/keyboards/gboards/gergoplex/keymaps/tgrosinger/rules.mk
@@ -10,6 +10,7 @@ DEBUG_MATRIX = no
CONSOLE_ENABLE = no
#Combos!
+COMBO_ENABLE = yes
VPATH += keyboards/gboards/
ifeq ($(strip $(DEBUG_MATRIX)), yes)
diff --git a/keyboards/gboards/gergoplex/rules.mk b/keyboards/gboards/gergoplex/rules.mk
index 5cd5a7721c..31a7d6bae8 100644
--- a/keyboards/gboards/gergoplex/rules.mk
+++ b/keyboards/gboards/gergoplex/rules.mk
@@ -16,7 +16,6 @@ NKRO_ENABLE = yes # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
-COMBO_ENABLE = yes
CUSTOM_MATRIX = yes
LAYOUTS = split_3x5_3
diff --git a/keyboards/ramonimbao/squishyfrl/chconf.h b/keyboards/gmmk/pro/ansi/keymaps/andrewcharnley/config.h
index ce018f56a7..aee1ba39d5 100644
--- a/keyboards/ramonimbao/squishyfrl/chconf.h
+++ b/keyboards/gmmk/pro/ansi/keymaps/andrewcharnley/config.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 QMK
+/* Copyright 2021 Andrew Charnley
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,11 +14,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#pragma once
-#define CH_CFG_ST_TIMEDELTA 0
+#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT
+#define RGBLIGHT_DEFAULT_SAT 0
+#define RGB_DISABLE_WHEN_USB_SUSPENDED
+#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-#include_next <chconf.h>
diff --git a/keyboards/gmmk/pro/ansi/keymaps/andrewcharnley/keymap.c b/keyboards/gmmk/pro/ansi/keymaps/andrewcharnley/keymap.c
new file mode 100644
index 0000000000..d044008a23
--- /dev/null
+++ b/keyboards/gmmk/pro/ansi/keymaps/andrewcharnley/keymap.c
@@ -0,0 +1,87 @@
+/* Copyright 2021 Andrew Charnley
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include QMK_KEYBOARD_H
+
+// Windows key changed to second FN key. Use KC_LGUI to revert.
+
+enum userspace_layers {
+ QWERTY,
+ FNLAYER
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ // The FN key by default maps to a momentary toggle to layer 1 to provide access to the RESET key (to put the board into bootloader mode). Without
+ // this mapping, you have to open the case to hit the button on the bottom of the PCB (near the USB cable attachment) while plugging in the USB
+ // cable to get the board into bootloader mode - definitely not fun when you're working on your QMK builds. Remove this and put it back to KC_RGUI
+ // if that's your preference.
+ //
+ // To put the keyboard in bootloader mode, use FN+backslash. If you accidentally put it into bootloader, you can just unplug the USB cable and
+ // it'll be back to normal when you plug it back in.
+
+ [QWERTY] = LAYOUT(
+ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_MUTE,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP,
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END,
+ KC_LCTL, MO(FNLAYER), KC_LALT, KC_SPC, KC_RALT, MO(FNLAYER),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
+ ),
+
+ [FNLAYER] = LAYOUT(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MEDIA_PLAY_PAUSE,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET , _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAD, _______
+ ),
+};
+
+bool encoder_update_user(uint8_t index, bool clockwise) {
+ if(IS_LAYER_ON(FNLAYER)) {
+ if (clockwise) {
+ tap_code(KC_MEDIA_NEXT_TRACK);
+ } else {
+ tap_code(KC_MEDIA_PREV_TRACK);
+ }
+ } else {
+ if (clockwise) {
+ tap_code(KC_VOLU);
+ } else {
+ tap_code(KC_VOLD);
+ }
+ }
+ return false;
+}
+
+static uint8_t val;
+
+void keyboard_post_init_user(void) {
+
+ val = rgb_matrix_get_val();
+}
+
+void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
+
+ if (host_keyboard_led_state().caps_lock) {
+ rgb_matrix_set_color_all(val,0,0);
+ } else {
+ rgb_matrix_set_color_all(val, val, val);
+ val = rgb_matrix_get_val();
+ }
+}
diff --git a/keyboards/gmmk/pro/ansi/keymaps/andrewcharnley/readme.md b/keyboards/gmmk/pro/ansi/keymaps/andrewcharnley/readme.md
new file mode 100644
index 0000000000..e064edd83a
--- /dev/null
+++ b/keyboards/gmmk/pro/ansi/keymaps/andrewcharnley/readme.md
@@ -0,0 +1,18 @@
+# Description
+A keymap designed to be functional for development purposes - no flashing lights or gimmicks. PRTSC and DEL key in the top right corner.
+Solid backlight that changes red if CAPS is on and reverts back afterwards. Brightness retained in both cases.
+Backlight is disabled on suspend and restored upon wake-up.
+The 'Windows' key is a second FN key. This makes it more natural to use the encoder wheel (good luck trying to do it with one hand).
+
+Compile using `qmk compile -kb gmmk/pro/ansi -km andrewcharnley`
+
+# Encoder
+FN + Encoder scroll = media next/prev
+FN + Encoder press = media pause
+default encoder behavior = volume up/down
+
+# Function Layer
+FN + Up = increase brightness
+FN + Down = decrease brightness
+FN + Backslash = bootloader
+
diff --git a/keyboards/handwired/battleship_gamepad/battleship_gamepad.c b/keyboards/handwired/battleship_gamepad/battleship_gamepad.c
index 918a3852d0..2c9de15a9f 100644
--- a/keyboards/handwired/battleship_gamepad/battleship_gamepad.c
+++ b/keyboards/handwired/battleship_gamepad/battleship_gamepad.c
@@ -15,8 +15,6 @@
*/
#include "battleship_gamepad.h"
-#include "joystick.h"
-#include "analog.h"
/* joystick config */
joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT] = {
diff --git a/keyboards/handwired/misterdeck/keymaps/default/keymap.c b/keyboards/handwired/misterdeck/keymaps/default/keymap.c
index 217d25551c..b8ed3cb9d9 100644
--- a/keyboards/handwired/misterdeck/keymaps/default/keymap.c
+++ b/keyboards/handwired/misterdeck/keymaps/default/keymap.c
@@ -16,8 +16,6 @@
#include QMK_KEYBOARD_H
-#include "joystick.h"
-
enum layer_names {
NORMAL_LAYER = 0
};
diff --git a/keyboards/handwired/misterdeck/keymaps/nobuttons/keymap.c b/keyboards/handwired/misterdeck/keymaps/nobuttons/keymap.c
index d4c52be35d..5c69d2bc21 100644
--- a/keyboards/handwired/misterdeck/keymaps/nobuttons/keymap.c
+++ b/keyboards/handwired/misterdeck/keymaps/nobuttons/keymap.c
@@ -16,8 +16,6 @@
#include QMK_KEYBOARD_H
-#include "joystick.h"
-
enum layer_names {
NORMAL_LAYER = 0
};
diff --git a/keyboards/handwired/ms_sculpt_mobile/astar/config.h b/keyboards/handwired/ms_sculpt_mobile/astar/config.h
new file mode 100644
index 0000000000..c34b86acb2
--- /dev/null
+++ b/keyboards/handwired/ms_sculpt_mobile/astar/config.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#define PRODUCT sculpt mobile astar
+
+#define MATRIX_ROW_PINS { D7, C6, D4, D0, D1, D3, D2, E2 }
+#define MATRIX_COL_PINS { B4, B5, E6, B7, B6, D6, C7, F7, F6, F4, F5, F1, F0, D5, B0, B1, B2, B3 }
diff --git a/keyboards/handwired/ms_sculpt_mobile/astar/rules.mk b/keyboards/handwired/ms_sculpt_mobile/astar/rules.mk
new file mode 100644
index 0000000000..cf663a7ed6
--- /dev/null
+++ b/keyboards/handwired/ms_sculpt_mobile/astar/rules.mk
@@ -0,0 +1,5 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = caterina
diff --git a/keyboards/handwired/ms_sculpt_mobile/config.h b/keyboards/handwired/ms_sculpt_mobile/config.h
index 13f5a588b6..df478e6d8a 100644
--- a/keyboards/handwired/ms_sculpt_mobile/config.h
+++ b/keyboards/handwired/ms_sculpt_mobile/config.h
@@ -29,23 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROWS 8
#define MATRIX_COLS 18
-#ifdef ASTAR
-#define PRODUCT sculpt mobile astar
- /*0 1 2 3 4 5 6 7 8 */
-#define MATRIX_ROW_PINS {D7, C6, D4, D0, D1, D3, D2, E2}
-/* A B C D E F G H I J K L M N O P Q R */
-#define MATRIX_COL_PINS {B4, B5, E6, B7, B6, D6, C7, F7, F6, F4,F5, F1,F0, D5, B0, B1, B2, B3}
-
-#else
-#define PRODUCT sculpt mobile teensypp
-/* 0 1 2 3 4 5 6 7 */
-#define MATRIX_ROW_PINS { F7,F6,F4,F5,F3,F2,F1,F0}
-/* A B C D E F G H I J K L M N O P Q R */
-#define MATRIX_COL_PINS { B7, D0, D1, D2, D3, D4, D5, D6, D7, E0,E1,C1, C0, C3, C2, C5, C4,C7}
-#define UNUSED_PINS { B6,B5,B4,B3,B2,B1,B0 }
-
-#endif
-
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION ROW2COL
diff --git a/keyboards/handwired/ms_sculpt_mobile/info.json b/keyboards/handwired/ms_sculpt_mobile/info.json
index 98137e84f8..1c171af8f3 100644
--- a/keyboards/handwired/ms_sculpt_mobile/info.json
+++ b/keyboards/handwired/ms_sculpt_mobile/info.json
@@ -1,94 +1,99 @@
{
- "keyboard_name": "MS Sculpt Mobile",
- "url": "",
- "maintainer": "qmk",
- "layouts": {
- "LAYOUT": {
- "layout": [
- {"label":"Esc", "x":0, "y":0},
- {"label":"F1", "x":1, "y":0},
- {"label":"F2", "x":2, "y":0},
- {"label":"F3", "x":3, "y":0},
- {"label":"F4", "x":4, "y":0},
- {"label":"F5", "x":5, "y":0},
- {"label":"F6", "x":6, "y":0},
- {"label":"F7", "x":7, "y":0},
- {"label":"F8", "x":8, "y":0},
- {"label":"F9", "x":9, "y":0},
- {"label":"F10", "x":10, "y":0},
- {"label":"F11", "x":11, "y":0},
- {"label":"F12", "x":12, "y":0},
- {"label":"PrtSc", "x":13, "y":0},
- {"label":"Home", "x":14, "y":0},
- {"label":"End", "x":15, "y":0},
- {"label":"`", "x":0, "y":1},
- {"label":"1", "x":1, "y":1},
- {"label":"2", "x":2, "y":1},
- {"label":"3", "x":3, "y":1},
- {"label":"4", "x":4, "y":1},
- {"label":"5", "x":5, "y":1},
- {"label":"6", "x":6, "y":1},
- {"label":"7", "x":7, "y":1},
- {"label":"8", "x":8, "y":1},
- {"label":"9", "x":9, "y":1},
- {"label":"0", "x":10, "y":1},
- {"label":"-", "x":11, "y":1},
- {"label":"=", "x":12, "y":1},
- {"label":"Backspace", "x":13, "y":1, "w":2},
- {"label":"Del", "x":15, "y":1, "h":1.6},
- {"label":"Tab", "x":0, "y":2, "w":1.5},
- {"label":"Q", "x":1.5, "y":2},
- {"label":"W", "x":2.5, "y":2},
- {"label":"E", "x":3.5, "y":2},
- {"label":"R", "x":4.5, "y":2},
- {"label":"T", "x":5.5, "y":2},
- {"label":"Y", "x":6.5, "y":2},
- {"label":"U", "x":7.5, "y":2},
- {"label":"I", "x":8.5, "y":2},
- {"label":"O", "x":9.5, "y":2},
- {"label":"P", "x":10.5, "y":2},
- {"label":"[", "x":11.5, "y":2},
- {"label":"]", "x":12.5, "y":2},
- {"label":"\\", "x":13.5, "y":2, "w":1.5},
- {"label":"Caps Lock", "x":0, "y":3, "w":1.75},
- {"label":"A", "x":1.75, "y":3},
- {"label":"S", "x":2.75, "y":3},
- {"label":"D", "x":3.75, "y":3},
- {"label":"F", "x":4.75, "y":3},
- {"label":"G", "x":5.75, "y":3},
- {"label":"H", "x":6.75, "y":3},
- {"label":"J", "x":7.75, "y":3},
- {"label":"K", "x":8.75, "y":3},
- {"label":"L", "x":9.75, "y":3},
- {"label":";", "x":10.75, "y":3},
- {"label":"'", "x":11.75, "y":3},
- {"label":"Enter", "x":12.75, "y":3, "w":2.25},
- {"label":"PgUp", "x":15, "y":2.6, "h":1.2},
- {"label":"LShift", "x":0, "y":4, "w":2.25},
- {"label":"Z", "x":2.25, "y":4},
- {"label":"X", "x":3.25, "y":4},
- {"label":"C", "x":4.25, "y":4},
- {"label":"V", "x":5.25, "y":4},
- {"label":"B", "x":6.25, "y":4},
- {"label":"N", "x":7.25, "y":4},
- {"label":"M", "x":8.25, "y":4},
- {"label":",", "x":9.25, "y":4},
- {"label":".", "x":10.25, "y":4},
- {"label":"/", "x":11.25, "y":4},
- {"label":"RShift", "x":12.25, "y":4, "w":1.75},
- {"label":"Up", "x":14, "y":4},
- {"label":"PgDn", "x":15, "y":3.8, "h":1.2},
- {"label":"LCtrl", "x":0, "y":5, "w":1.25},
- {"label":"LWin", "x":1.25, "y":5, "w":1.25},
- {"label":"LAlt", "x":2.5, "y":5, "w":1.25},
- {"label":"Space", "x":3.75, "y":5, "w":5.5},
- {"label":"RAlt", "x":9.25, "y":5, "w":1.25},
- {"label":"Fn", "x":10.5, "y":5, "w":1.25},
- {"label":"RCtrl", "x":11.75, "y":5, "w":1.25},
- {"label":"Left", "x":13, "y":5},
- {"label":"Down", "x":14, "y":5},
- {"label":"Right", "x":15, "y":5}
- ]
+ "keyboard_name": "MS Sculpt Mobile",
+ "url": "",
+ "maintainer": "qmk",
+ "layouts": {
+ "LAYOUT": {
+ "layout": [
+ {"x": 0, "y": 0},
+ {"x": 1, "y": 0},
+ {"x": 2, "y": 0},
+ {"x": 3, "y": 0},
+ {"x": 4, "y": 0},
+ {"x": 5, "y": 0},
+ {"x": 6, "y": 0},
+ {"x": 7, "y": 0},
+ {"x": 8, "y": 0},
+ {"x": 9, "y": 0},
+ {"x": 10, "y": 0},
+ {"x": 11, "y": 0},
+ {"x": 12, "y": 0},
+ {"x": 13, "y": 0},
+ {"x": 14, "y": 0},
+ {"x": 15, "y": 0},
+
+ {"x": 0, "y": 1},
+ {"x": 1, "y": 1},
+ {"x": 2, "y": 1},
+ {"x": 3, "y": 1},
+ {"x": 4, "y": 1},
+ {"x": 5, "y": 1},
+ {"x": 6, "y": 1},
+ {"x": 7, "y": 1},
+ {"x": 8, "y": 1},
+ {"x": 9, "y": 1},
+ {"x": 10, "y": 1},
+ {"x": 11, "y": 1},
+ {"x": 12, "y": 1},
+ {"x": 13, "y": 1, "w": 2},
+ {"x": 15, "y": 1, "h": 1.6},
+
+ {"x": 0, "y": 2, "w": 1.5},
+ {"x": 1.5, "y": 2},
+ {"x": 2.5, "y": 2},
+ {"x": 3.5, "y": 2},
+ {"x": 4.5, "y": 2},
+ {"x": 5.5, "y": 2},
+ {"x": 6.5, "y": 2},
+ {"x": 7.5, "y": 2},
+ {"x": 8.5, "y": 2},
+ {"x": 9.5, "y": 2},
+ {"x": 10.5, "y": 2},
+ {"x": 11.5, "y": 2},
+ {"x": 12.5, "y": 2},
+ {"x": 13.5, "y": 2, "w": 1.5},
+
+ {"x": 0, "y": 3, "w": 1.75},
+ {"x": 1.75, "y": 3},
+ {"x": 2.75, "y": 3},
+ {"x": 3.75, "y": 3},
+ {"x": 4.75, "y": 3},
+ {"x": 5.75, "y": 3},
+ {"x": 6.75, "y": 3},
+ {"x": 7.75, "y": 3},
+ {"x": 8.75, "y": 3},
+ {"x": 9.75, "y": 3},
+ {"x": 10.75, "y": 3},
+ {"x": 11.75, "y": 3},
+ {"x": 12.75, "y": 3, "w": 2.25},
+ {"x": 15, "y": 2.6, "h": 1.2},
+
+ {"x": 0, "y": 4, "w": 2.25},
+ {"x": 2.25, "y": 4},
+ {"x": 3.25, "y": 4},
+ {"x": 4.25, "y": 4},
+ {"x": 5.25, "y": 4},
+ {"x": 6.25, "y": 4},
+ {"x": 7.25, "y": 4},
+ {"x": 8.25, "y": 4},
+ {"x": 9.25, "y": 4},
+ {"x": 10.25, "y": 4},
+ {"x": 11.25, "y": 4},
+ {"x": 12.25, "y": 4, "w": 1.75},
+ {"x": 14, "y": 4},
+ {"x": 15, "y": 3.8, "h": 1.2},
+
+ {"x": 0, "y": 5, "w": 1.25},
+ {"x": 1.25, "y": 5, "w": 1.25},
+ {"x": 2.5, "y": 5, "w": 1.25},
+ {"x": 3.75, "y": 5, "w": 5.5},
+ {"x": 9.25, "y": 5, "w": 1.25},
+ {"x": 10.5, "y": 5, "w": 1.25},
+ {"x": 11.75, "y": 5, "w": 1.25},
+ {"x": 13, "y": 5},
+ {"x": 14, "y": 5},
+ {"x": 15, "y": 5}
+ ]
+ }
}
- }
}
diff --git a/keyboards/handwired/ms_sculpt_mobile/keymaps/default/rules.mk b/keyboards/handwired/ms_sculpt_mobile/keymaps/default/rules.mk
index 3224016bbe..a9c1087a2a 100644
--- a/keyboards/handwired/ms_sculpt_mobile/keymaps/default/rules.mk
+++ b/keyboards/handwired/ms_sculpt_mobile/keymaps/default/rules.mk
@@ -1,9 +1,3 @@
-BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
-MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
-EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
-CONSOLE_ENABLE = no # Console for debug(+400)
-COMMAND_ENABLE = yes # Commands for debug and configuration
+MOUSEKEY_ENABLE = yes
+CONSOLE_ENABLE = no
NKRO_ENABLE = yes
-BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
-AUDIO_ENABLE = no # Audio output
-RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
diff --git a/keyboards/handwired/ms_sculpt_mobile/readme.md b/keyboards/handwired/ms_sculpt_mobile/readme.md
index 98fd1f8d1a..0345ded36b 100644
--- a/keyboards/handwired/ms_sculpt_mobile/readme.md
+++ b/keyboards/handwired/ms_sculpt_mobile/readme.md
@@ -46,8 +46,6 @@ The Astar mini has all pins exposed , so you can do 18x8
If you want a speaker, LEDs, etc., you'll need to free up a pin. I recommend joining columns
R and L to the same pin.
-Building - add ASTAR=1 to the compile line or leave out for teensy2++
-
Make example for this keyboard (after setting up your build environment):
make handwired/ms_sculpt_mobile:default
diff --git a/keyboards/handwired/ms_sculpt_mobile/rules.mk b/keyboards/handwired/ms_sculpt_mobile/rules.mk
index 6498fa6c76..6fd84c8244 100644
--- a/keyboards/handwired/ms_sculpt_mobile/rules.mk
+++ b/keyboards/handwired/ms_sculpt_mobile/rules.mk
@@ -1,26 +1,14 @@
-# MCU name
-ifdef ASTAR
- MCU = atmega32u4
- CFLAGS = -D ASTAR
-else
- MCU = at90usb1286
-endif
-
-# Bootloader selection
-ifdef ASTAR
- BOOTLOADER = caterina
-else
- BOOTLOADER = atmel-dfu
-endif
-
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
-MOUSEKEY_ENABLE = no # Mouse keys
+MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = no # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
+
+DEFAULT_FOLDER = handwired/ms_sculpt_mobile/teensy2pp
diff --git a/keyboards/handwired/ms_sculpt_mobile/teensy2pp/config.h b/keyboards/handwired/ms_sculpt_mobile/teensy2pp/config.h
new file mode 100644
index 0000000000..a69d3fd3b0
--- /dev/null
+++ b/keyboards/handwired/ms_sculpt_mobile/teensy2pp/config.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#define PRODUCT sculpt mobile teensypp
+
+#define MATRIX_ROW_PINS { F7, F6, F4, F5, F3, F2, F1, F0 }
+#define MATRIX_COL_PINS { B7, D0, D1, D2, D3, D4, D5, D6, D7, E0, E1, C1, C0, C3, C2, C5, C4, C7 }
diff --git a/keyboards/handwired/ms_sculpt_mobile/teensy2pp/rules.mk b/keyboards/handwired/ms_sculpt_mobile/teensy2pp/rules.mk
new file mode 100644
index 0000000000..149471682d
--- /dev/null
+++ b/keyboards/handwired/ms_sculpt_mobile/teensy2pp/rules.mk
@@ -0,0 +1,5 @@
+# MCU name
+MCU = at90usb1286
+
+# Bootloader selection
+BOOTLOADER = halfkay
diff --git a/keyboards/handwired/onekey/blackpill_f401/blackpill_f401.c b/keyboards/handwired/onekey/blackpill_f401/blackpill_f401.c
deleted file mode 100644
index 1287614a8b..0000000000
--- a/keyboards/handwired/onekey/blackpill_f401/blackpill_f401.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright 2020 Sergey Vlasov (sigprof)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include QMK_KEYBOARD_H
-
-void board_init(void) {
- // B9 is configured as I2C1_SDA_PIN in the board file; that function must be
- // disabled before using B7 as I2C1_SDA.
- setPinInputHigh(B9);
-}
diff --git a/keyboards/handwired/onekey/bluepill/chconf.h b/keyboards/handwired/onekey/bluepill/chconf.h
deleted file mode 100644
index 63236f2c2c..0000000000
--- a/keyboards/handwired/onekey/bluepill/chconf.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/handwired/onekey/bluepill/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
diff --git a/keyboards/handwired/onekey/keymaps/hardware_id/keymap.c b/keyboards/handwired/onekey/keymaps/hardware_id/keymap.c
new file mode 100644
index 0000000000..bcec8b3ca1
--- /dev/null
+++ b/keyboards/handwired/onekey/keymaps/hardware_id/keymap.c
@@ -0,0 +1,28 @@
+#include QMK_KEYBOARD_H
+#include "hardware_id.h"
+#include <stdio.h>
+enum custom_keycodes {
+ DUMP_ID = SAFE_RANGE,
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ LAYOUT_ortho_1x1(DUMP_ID)
+};
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case DUMP_ID:
+ if (record->event.pressed) {
+ hardware_id_t id = get_hardware_id();
+ char buffer[100];
+ sprintf(buffer, "ID:%lu:%lu:%lu:%lu\n", id.data[0], id.data[1], id.data[2], id.data[3]);
+#ifdef CONSOLE_ENABLE
+ printf(buffer);
+#else
+ send_string(buffer);
+#endif
+ }
+ break;
+ }
+ return false;
+};
diff --git a/keyboards/handwired/onekey/keymaps/joystick/keymap.c b/keyboards/handwired/onekey/keymaps/joystick/keymap.c
index f427b9d77d..7a2f138b28 100644
--- a/keyboards/handwired/onekey/keymaps/joystick/keymap.c
+++ b/keyboards/handwired/onekey/keymaps/joystick/keymap.c
@@ -1,7 +1,5 @@
#include QMK_KEYBOARD_H
-#include "joystick.h"
-
#ifndef ADC_PIN
# define ADC_PIN F6
#endif
diff --git a/keyboards/handwired/onekey/keymaps/reboot/keymap.c b/keyboards/handwired/onekey/keymaps/reboot/keymap.c
new file mode 100644
index 0000000000..c3d147a76c
--- /dev/null
+++ b/keyboards/handwired/onekey/keymaps/reboot/keymap.c
@@ -0,0 +1,5 @@
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ LAYOUT_ortho_1x1(QK_REBOOT)
+};
diff --git a/keyboards/handwired/pill60/bluepill/chconf.h b/keyboards/handwired/pill60/bluepill/chconf.h
deleted file mode 100644
index c92d2a276d..0000000000
--- a/keyboards/handwired/pill60/bluepill/chconf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/handwired/pill60/bluepill/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/keyboards/handwired/sono1/stm32f103/chconf.h b/keyboards/handwired/sono1/stm32f103/chconf.h
deleted file mode 100644
index 63236f2c2c..0000000000
--- a/keyboards/handwired/sono1/stm32f103/chconf.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/handwired/onekey/bluepill/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
diff --git a/keyboards/handwired/t111/chconf.h b/keyboards/handwired/t111/chconf.h
deleted file mode 100644
index 962653ec4c..0000000000
--- a/keyboards/handwired/t111/chconf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/handwired/t111/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/keyboards/handwired/uthol/rev3/rev3.c b/keyboards/handwired/uthol/rev3/rev3.c
index 2ababdfbe8..6c06387ee8 100644
--- a/keyboards/handwired/uthol/rev3/rev3.c
+++ b/keyboards/handwired/uthol/rev3/rev3.c
@@ -16,5 +16,3 @@
*/
#include QMK_KEYBOARD_H
-
-void board_init(void) { setPinInputHigh(B9); }
diff --git a/keyboards/handwired/wakizashi40/config.h b/keyboards/handwired/wakizashi40/config.h
index 78f85f2197..e9976616ec 100644
--- a/keyboards/handwired/wakizashi40/config.h
+++ b/keyboards/handwired/wakizashi40/config.h
@@ -17,4 +17,3 @@
#pragma once
#include "config_common.h"
-#define DYNAMIC_KEYMAP_LAYER_COUNT 12
diff --git a/keyboards/handwired/wakizashi40/info.json b/keyboards/handwired/wakizashi40/info.json
index 58eadb29e6..b97d61171b 100644
--- a/keyboards/handwired/wakizashi40/info.json
+++ b/keyboards/handwired/wakizashi40/info.json
@@ -1,9 +1,9 @@
{
- "manufacturer": "fumbucker",
+ "manufacturer": "xia0",
"keyboard_name": "Wakizashi 40",
- "maintainer": "fumbucker",
+ "maintainer": "xia0",
"debounce": 5,
- "processor": "at90usb1286",
+ "processor": "atmega32u4",
"diode_direction": "COL2ROW",
"features": {
"audio": false,
@@ -20,8 +20,8 @@
"unicode": false
},
"matrix_pins": {
- "cols": ["C5", "C4", "D2", "D3", "D4", "D5", "C6", "D7", "B0", "B1", "B2", "B3", "B4"],
- "rows": ["C0", "C1", "C2", "C3"]
+ "cols": ["F4", "F6", "F7", "B1", "B3", "B2", "B6", "B5", "B4", "E6", "D7", "C6", "D4"],
+ "rows": ["D3", "D2", "D1", "D0"]
},
"usb": {
"vid": "0x6662",
diff --git a/keyboards/handwired/wakizashi40/keymaps/via/keymap.c b/keyboards/handwired/wakizashi40/keymaps/via/keymap.c
index d456b8b40a..fb9d37ac20 100644
--- a/keyboards/handwired/wakizashi40/keymaps/via/keymap.c
+++ b/keyboards/handwired/wakizashi40/keymaps/via/keymap.c
@@ -16,77 +16,27 @@
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-
- [0] = LAYOUT_all(
- KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
- MO(3), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
- KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_ESC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
- KC_LCTL, KC_LGUI, KC_LALT, LT(1, KC_SPC), LT(2, KC_SPC), KC_LALT, KC_MENU, KC_LCTL),
-
- [1] = LAYOUT_all(
- KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F5, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
- MO(11), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_TRNS, KC_EQL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_SPC, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS),
-
- [2] = LAYOUT_all(
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS,
- MO(11), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_TRNS, KC_QUOT,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_SPC, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS),
-
- [3] = LAYOUT_all(
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_QUOT,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
-
- [4] = LAYOUT_all(
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
-
- [5] = LAYOUT_all(
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
-
- [6] = LAYOUT_all(
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
-
- [7] = LAYOUT_all(
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
-
- [8] = LAYOUT_all(
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
-
- [9] = LAYOUT_all(
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
-
- [10] = LAYOUT_all(
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
-
- [11] = LAYOUT_all(
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
-
+ [0] = LAYOUT_all(
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
+ MO(3), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_ESC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
+ KC_LCTL, KC_LGUI, KC_LALT, LT(1, KC_SPC), LT(2, KC_SPC), KC_LALT, KC_MENU, KC_LCTL),
+
+ [1] = LAYOUT_all(
+ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F5, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
+ MO(3), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_TRNS, KC_EQL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_SPC, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ [2] = LAYOUT_all(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS,
+ MO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_TRNS, KC_QUOT,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_SPC, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ [3] = LAYOUT_all(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_QUOT,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
};
diff --git a/keyboards/handwired/wakizashi40/readme.md b/keyboards/handwired/wakizashi40/readme.md
index d94a75651c..8bb6c2aebc 100644
--- a/keyboards/handwired/wakizashi40/readme.md
+++ b/keyboards/handwired/wakizashi40/readme.md
@@ -1,12 +1,12 @@
# Wakizashi 40
-![Wakizashi40](https://cdn.thingiverse.com/renders/51/50/81/13/a9/7078248666f70b422127c6662cf79563_preview_featured.jpg)
+![Wakizashi40](https://i.imgur.com/TVTfa0X.jpg)
Reverse stagger 40% keyboard based on the Katana 60.
-* Keyboard Maintainer: [fumbucker](https://github.com/xia0)
-* Hardware Supported: Teensy2++
-* Hardware Availability: [thingiverse](https://www.thingiverse.com/thing:3467930)
+* Keyboard Maintainer: [xia0](https://github.com/xia0)
+* Hardware Supported: ATmega32u4
+* Hardware Availability: [prusaprinters.org](https://www.prusaprinters.org/prints/128575-wakizashi-40-keyboard)
Make example for this keyboard (after setting up your build environment):
@@ -16,4 +16,6 @@ See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools)
## Bootloader
-* **Keycode in layout**: Press the key mapped to `RESET` if it is available (Capslock + R).
+* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
+* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
+* **Keycode in layout**: Press the key mapped to `RESET` if it is available
diff --git a/keyboards/handwired/xealous/info.json b/keyboards/handwired/xealous/info.json
index 7113c311f2..9cd634a210 100644
--- a/keyboards/handwired/xealous/info.json
+++ b/keyboards/handwired/xealous/info.json
@@ -3,7 +3,7 @@
"url": "",
"maintainer": "alex-ong",
"layouts": {
- "LAYOUT_ANSI_DEFAULT": {
+ "LAYOUT": {
"layout": [
{"label":"Esc", "x":0, "y":0},
{"label":"1", "x":1, "y":0},
@@ -25,11 +25,7 @@
{"label":"Q", "x":1.5, "y":1},
{"label":"W", "x":2.5, "y":1},
{"label":"E", "x":3.5, "y":1},
- {
- "label": "R",
- "x": 4.5,
- "y": 1
- },
+ {"label":"R", "x": 4.5,"y":1},
{"label":"T", "x":5.5, "y":1},
{"label":"Y", "x":6.5, "y":1},
@@ -73,15 +69,14 @@
{"label":"Ctrl", "x":0, "y":4, "w":1.25},
{"label":"Win", "x":1.25, "y":4, "w":1.25},
{"label":"Alt", "x":2.5, "y":4, "w":1.25},
- {"x":3.75, "y":4, "w":2.75},
- {"x":6.5, "y":4, "w":1.25},
+ {"x":3.75, "y":4, "w":1.25},
+ {"x":5, "y":4, "w":2.25},
- {"x":7.75, "y":4, "w":1.25},
- {"x":9, "y":4, "w":2.0},
- {"label":"Alt", "x":11, "y":4},
- {"label":"Win", "x":12, "y":4},
- {"label":"Menu", "x":13, "y":4},
- {"label":"Ctrl", "x":14, "y":4}
+ {"x":7.25, "y":4, "w":2.75},
+ {"label":"Alt", "x":10, "y":4, "w":1.25},
+ {"label":"Win", "x":11.25, "y":4, "w":1.25},
+ {"label":"Menu", "x":12.5, "y":4, "w":1.25},
+ {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}
]
}
}
diff --git a/keyboards/handwired/xealous/keymaps/default/keymap.c b/keyboards/handwired/xealous/keymaps/default/keymap.c
index bf7caef622..c0ce72214d 100644
--- a/keyboards/handwired/xealous/keymaps/default/keymap.c
+++ b/keyboards/handwired/xealous/keymaps/default/keymap.c
@@ -27,7 +27,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------'
*/
/* Layer 0: Qwerty */
- [_QWERTY] = LAYOUT_split60(
+ [_QWERTY] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
FN, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
@@ -50,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
/* Layer 1: Numpad */
- [_NUMPAD] = LAYOUT_split60(
+ [_NUMPAD] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, KC_NLCK, KC_PSLS, KC_PAST, KC_MINUS, _______, _______, KC_BSPC,
_______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PLUS, _______, _______, KC_BSLS,
_______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_BSPC, _______, _______,
@@ -73,7 +73,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
/* Layer 2: RAISE */
- [_FN] = LAYOUT_split60(
+ [_FN] = LAYOUT(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL,
KC_CAPS, KC_PGUP, KC_UP, KC_PGDN, _______, _______, _______, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, _______,
_______, KC_LEFT, KC_DOWN,KC_RIGHT, _______, KC_HOME, KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT, KC_INS, KC_DEL, _______,
@@ -96,6 +96,3 @@ layer_state_t default_layer_state_set_kb(layer_state_t state) {
return state;
}
#endif
-
-void led_set_keymap(uint8_t usb_led) {
-}
diff --git a/keyboards/handwired/xealous/rev1/rev1.h b/keyboards/handwired/xealous/rev1/rev1.h
index 88e5ef376e..ce8d68c2c1 100644
--- a/keyboards/handwired/xealous/rev1/rev1.h
+++ b/keyboards/handwired/xealous/rev1/rev1.h
@@ -22,5 +22,3 @@
{ R30, R31, R32, R33, R34, R35, XXX, XXX }, \
{ R40, R41, R42, R43, R44, XXX, XXX, XXX } \
}
-
-#define LAYOUT_split60 LAYOUT
diff --git a/keyboards/handwired/z150/chconf.h b/keyboards/handwired/z150/chconf.h
deleted file mode 100644
index 975667df0e..0000000000
--- a/keyboards/handwired/z150/chconf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/handwired/z150/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/keyboards/helix/local_drivers/i2c.c b/keyboards/helix/local_drivers/i2c.c
deleted file mode 100644
index 9221429e96..0000000000
--- a/keyboards/helix/local_drivers/i2c.c
+++ /dev/null
@@ -1,159 +0,0 @@
-#include <util/twi.h>
-#include <avr/io.h>
-#include <stdlib.h>
-#include <avr/interrupt.h>
-#include <util/twi.h>
-#include <stdbool.h>
-#include "i2c.h"
-
-// Limits the amount of we wait for any one i2c transaction.
-// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
-// 9 bits, a single transaction will take around 90μs to complete.
-//
-// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
-// poll loop takes at least 8 clock cycles to execute
-#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
-
-#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
-
-volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
-
-static volatile uint8_t slave_buffer_pos;
-static volatile bool slave_has_register_set = false;
-
-// Wait for an i2c operation to finish
-inline static
-void i2c_delay(void) {
- uint16_t lim = 0;
- while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
- lim++;
-
- // easier way, but will wait slightly longer
- // _delay_us(100);
-}
-
-// Setup twi to run at 100kHz or 400kHz (see ./i2c.h SCL_CLOCK)
-void i2c_master_init(void) {
- // no prescaler
- TWSR = 0;
- // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
- // Check datasheets for more info.
- TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
-}
-
-// Start a transaction with the given i2c slave address. The direction of the
-// transfer is set with I2C_READ and I2C_WRITE.
-// returns: 0 => success
-// 1 => error
-uint8_t i2c_master_start(uint8_t address) {
- TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA);
-
- i2c_delay();
-
- // check that we started successfully
- if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
- return 1;
-
- TWDR = address;
- TWCR = (1<<TWINT) | (1<<TWEN);
-
- i2c_delay();
-
- if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
- return 1; // slave did not acknowledge
- else
- return 0; // success
-}
-
-
-// Finish the i2c transaction.
-void i2c_master_stop(void) {
- TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
-
- uint16_t lim = 0;
- while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
- lim++;
-}
-
-// Write one byte to the i2c slave.
-// returns 0 => slave ACK
-// 1 => slave NACK
-uint8_t i2c_master_write(uint8_t data) {
- TWDR = data;
- TWCR = (1<<TWINT) | (1<<TWEN);
-
- i2c_delay();
-
- // check if the slave acknowledged us
- return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
-}
-
-// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
-// if ack=0 the acknowledge bit is not set.
-// returns: byte read from i2c device
-uint8_t i2c_master_read(int ack) {
- TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
-
- i2c_delay();
- return TWDR;
-}
-
-void i2c_reset_state(void) {
- TWCR = 0;
-}
-
-void i2c_slave_init(uint8_t address) {
- TWAR = address << 0; // slave i2c address
- // TWEN - twi enable
- // TWEA - enable address acknowledgement
- // TWINT - twi interrupt flag
- // TWIE - enable the twi interrupt
- TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
-}
-
-ISR(TWI_vect);
-
-ISR(TWI_vect) {
- uint8_t ack = 1;
- switch(TW_STATUS) {
- case TW_SR_SLA_ACK:
- // this device has been addressed as a slave receiver
- slave_has_register_set = false;
- break;
-
- case TW_SR_DATA_ACK:
- // this device has received data as a slave receiver
- // The first byte that we receive in this transaction sets the location
- // of the read/write location of the slaves memory that it exposes over
- // i2c. After that, bytes will be written at slave_buffer_pos, incrementing
- // slave_buffer_pos after each write.
- if(!slave_has_register_set) {
- slave_buffer_pos = TWDR;
- // don't acknowledge the master if this memory loctaion is out of bounds
- if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
- ack = 0;
- slave_buffer_pos = 0;
- }
- slave_has_register_set = true;
- } else {
- i2c_slave_buffer[slave_buffer_pos] = TWDR;
- BUFFER_POS_INC();
- }
- break;
-
- case TW_ST_SLA_ACK:
- case TW_ST_DATA_ACK:
- // master has addressed this device as a slave transmitter and is
- // requesting data.
- TWDR = i2c_slave_buffer[slave_buffer_pos];
- BUFFER_POS_INC();
- break;
-
- case TW_BUS_ERROR: // something went wrong, reset twi state
- TWCR = 0;
- default:
- break;
- }
- // Reset everything, so we are ready for the next TWI interrupt
- TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
-}
diff --git a/keyboards/helix/local_drivers/i2c.h b/keyboards/helix/local_drivers/i2c.h
deleted file mode 100644
index 710662c7ab..0000000000
--- a/keyboards/helix/local_drivers/i2c.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#pragma once
-
-#include <stdint.h>
-
-#ifndef F_CPU
-#define F_CPU 16000000UL
-#endif
-
-#define I2C_READ 1
-#define I2C_WRITE 0
-
-#define I2C_ACK 1
-#define I2C_NACK 0
-
-#define SLAVE_BUFFER_SIZE 0x10
-
-// i2c SCL clock frequency 400kHz
-#define SCL_CLOCK 400000L
-
-extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
-
-void i2c_master_init(void);
-uint8_t i2c_master_start(uint8_t address);
-void i2c_master_stop(void);
-uint8_t i2c_master_write(uint8_t data);
-uint8_t i2c_master_read(int);
-void i2c_reset_state(void);
-void i2c_slave_init(uint8_t address);
-
-
-static inline unsigned char i2c_start_read(unsigned char addr) {
- return i2c_master_start((addr << 1) | I2C_READ);
-}
-
-static inline unsigned char i2c_start_write(unsigned char addr) {
- return i2c_master_start((addr << 1) | I2C_WRITE);
-}
-
-// from SSD1306 scrips
-extern unsigned char i2c_rep_start(unsigned char addr);
-extern void i2c_start_wait(unsigned char addr);
-extern unsigned char i2c_readAck(void);
-extern unsigned char i2c_readNak(void);
-extern unsigned char i2c_read(unsigned char ack);
-
-#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
diff --git a/keyboards/helix/local_drivers/serial.c b/keyboards/helix/local_drivers/serial.c
deleted file mode 100644
index 674c42d593..0000000000
--- a/keyboards/helix/local_drivers/serial.c
+++ /dev/null
@@ -1,589 +0,0 @@
-/*
- * WARNING: be careful changing this code, it is very timing dependent
- *
- * 2018-10-28 checked
- * avr-gcc 4.9.2
- * avr-gcc 5.4.0
- * avr-gcc 7.3.0
- */
-
-#ifndef F_CPU
-#define F_CPU 16000000
-#endif
-
-#include <avr/io.h>
-#include <avr/interrupt.h>
-#include <util/delay.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include "serial.h"
-
-#ifdef SOFT_SERIAL_PIN
-
-#ifdef __AVR_ATmega32U4__
- // if using ATmega32U4 I2C, can not use PD0 and PD1 in soft serial.
- #ifdef USE_I2C
- #if SOFT_SERIAL_PIN == D0 || SOFT_SERIAL_PIN == D1
- #error Using ATmega32U4 I2C, so can not use PD0, PD1
- #endif
- #endif
-
- #if SOFT_SERIAL_PIN >= D0 && SOFT_SERIAL_PIN <= D3
- #define SERIAL_PIN_DDR DDRD
- #define SERIAL_PIN_PORT PORTD
- #define SERIAL_PIN_INPUT PIND
- #if SOFT_SERIAL_PIN == D0
- #define SERIAL_PIN_MASK _BV(PD0)
- #define EIMSK_BIT _BV(INT0)
- #define EICRx_BIT (~(_BV(ISC00) | _BV(ISC01)))
- #define SERIAL_PIN_INTERRUPT INT0_vect
- #elif SOFT_SERIAL_PIN == D1
- #define SERIAL_PIN_MASK _BV(PD1)
- #define EIMSK_BIT _BV(INT1)
- #define EICRx_BIT (~(_BV(ISC10) | _BV(ISC11)))
- #define SERIAL_PIN_INTERRUPT INT1_vect
- #elif SOFT_SERIAL_PIN == D2
- #define SERIAL_PIN_MASK _BV(PD2)
- #define EIMSK_BIT _BV(INT2)
- #define EICRx_BIT (~(_BV(ISC20) | _BV(ISC21)))
- #define SERIAL_PIN_INTERRUPT INT2_vect
- #elif SOFT_SERIAL_PIN == D3
- #define SERIAL_PIN_MASK _BV(PD3)
- #define EIMSK_BIT _BV(INT3)
- #define EICRx_BIT (~(_BV(ISC30) | _BV(ISC31)))
- #define SERIAL_PIN_INTERRUPT INT3_vect
- #endif
- #elif SOFT_SERIAL_PIN == E6
- #define SERIAL_PIN_DDR DDRE
- #define SERIAL_PIN_PORT PORTE
- #define SERIAL_PIN_INPUT PINE
- #define SERIAL_PIN_MASK _BV(PE6)
- #define EIMSK_BIT _BV(INT6)
- #define EICRx_BIT (~(_BV(ISC60) | _BV(ISC61)))
- #define SERIAL_PIN_INTERRUPT INT6_vect
- #else
- #error invalid SOFT_SERIAL_PIN value
- #endif
-
-#else
- #error serial.c now support ATmega32U4 only
-#endif
-
-//////////////// for backward compatibility ////////////////////////////////
-#if !defined(SERIAL_USE_SINGLE_TRANSACTION) && !defined(SERIAL_USE_MULTI_TRANSACTION)
-/* --- USE OLD API (compatible with let's split serial.c) */
- #if SERIAL_SLAVE_BUFFER_LENGTH > 0
- uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
- #endif
- #if SERIAL_MASTER_BUFFER_LENGTH > 0
- uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
- #endif
- uint8_t volatile status0 = 0;
-
-SSTD_t transactions[] = {
- { (uint8_t *)&status0,
- #if SERIAL_MASTER_BUFFER_LENGTH > 0
- sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
- #else
- 0, (uint8_t *)NULL,
- #endif
- #if SERIAL_SLAVE_BUFFER_LENGTH > 0
- sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
- #else
- 0, (uint8_t *)NULL,
- #endif
- }
-};
-
-void serial_master_init(void)
-{ soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); }
-
-void serial_slave_init(void)
-{ soft_serial_target_init(transactions, TID_LIMIT(transactions)); }
-
-// 0 => no error
-// 1 => slave did not respond
-// 2 => checksum error
-int serial_update_buffers()
-{
- int result;
- result = soft_serial_transaction();
- return result;
-}
-
-#endif // end of OLD API (compatible with let's split serial.c)
-////////////////////////////////////////////////////////////////////////////
-
-#define ALWAYS_INLINE __attribute__((always_inline))
-#define NO_INLINE __attribute__((noinline))
-#define _delay_sub_us(x) __builtin_avr_delay_cycles(x)
-
-// parity check
-#define ODD_PARITY 1
-#define EVEN_PARITY 0
-#define PARITY EVEN_PARITY
-
-#ifdef SERIAL_DELAY
- // custom setup in config.h
- // #define TID_SEND_ADJUST 2
- // #define SERIAL_DELAY 6 // micro sec
- // #define READ_WRITE_START_ADJUST 30 // cycles
- // #define READ_WRITE_WIDTH_ADJUST 8 // cycles
-#else
-// ============ Standard setups ============
-
-#ifndef SELECT_SOFT_SERIAL_SPEED
-#define SELECT_SOFT_SERIAL_SPEED 1
-// 0: about 189kbps
-// 1: about 137kbps (default)
-// 2: about 75kbps
-// 3: about 39kbps
-// 4: about 26kbps
-// 5: about 20kbps
-#endif
-
-#if __GNUC__ < 6
- #define TID_SEND_ADJUST 14
-#else
- #define TID_SEND_ADJUST 2
-#endif
-
-#if SELECT_SOFT_SERIAL_SPEED == 0
- // Very High speed
- #define SERIAL_DELAY 4 // micro sec
- #if __GNUC__ < 6
- #define READ_WRITE_START_ADJUST 33 // cycles
- #define READ_WRITE_WIDTH_ADJUST 3 // cycles
- #else
- #define READ_WRITE_START_ADJUST 34 // cycles
- #define READ_WRITE_WIDTH_ADJUST 7 // cycles
- #endif
-#elif SELECT_SOFT_SERIAL_SPEED == 1
- // High speed
- #define SERIAL_DELAY 6 // micro sec
- #if __GNUC__ < 6
- #define READ_WRITE_START_ADJUST 30 // cycles
- #define READ_WRITE_WIDTH_ADJUST 3 // cycles
- #else
- #define READ_WRITE_START_ADJUST 33 // cycles
- #define READ_WRITE_WIDTH_ADJUST 7 // cycles
- #endif
-#elif SELECT_SOFT_SERIAL_SPEED == 2
- // Middle speed
- #define SERIAL_DELAY 12 // micro sec
- #define READ_WRITE_START_ADJUST 30 // cycles
- #if __GNUC__ < 6
- #define READ_WRITE_WIDTH_ADJUST 3 // cycles
- #else
- #define READ_WRITE_WIDTH_ADJUST 7 // cycles
- #endif
-#elif SELECT_SOFT_SERIAL_SPEED == 3
- // Low speed
- #define SERIAL_DELAY 24 // micro sec
- #define READ_WRITE_START_ADJUST 30 // cycles
- #if __GNUC__ < 6
- #define READ_WRITE_WIDTH_ADJUST 3 // cycles
- #else
- #define READ_WRITE_WIDTH_ADJUST 7 // cycles
- #endif
-#elif SELECT_SOFT_SERIAL_SPEED == 4
- // Very Low speed
- #define SERIAL_DELAY 36 // micro sec
- #define READ_WRITE_START_ADJUST 30 // cycles
- #if __GNUC__ < 6
- #define READ_WRITE_WIDTH_ADJUST 3 // cycles
- #else
- #define READ_WRITE_WIDTH_ADJUST 7 // cycles
- #endif
-#elif SELECT_SOFT_SERIAL_SPEED == 5
- // Ultra Low speed
- #define SERIAL_DELAY 48 // micro sec
- #define READ_WRITE_START_ADJUST 30 // cycles
- #if __GNUC__ < 6
- #define READ_WRITE_WIDTH_ADJUST 3 // cycles
- #else
- #define READ_WRITE_WIDTH_ADJUST 7 // cycles
- #endif
-#else
-#error invalid SELECT_SOFT_SERIAL_SPEED value
-#endif /* SELECT_SOFT_SERIAL_SPEED */
-#endif /* SERIAL_DELAY */
-
-#define SERIAL_DELAY_HALF1 (SERIAL_DELAY/2)
-#define SERIAL_DELAY_HALF2 (SERIAL_DELAY - SERIAL_DELAY/2)
-
-#define SLAVE_INT_WIDTH_US 1
-#ifndef SERIAL_USE_MULTI_TRANSACTION
- #define SLAVE_INT_RESPONSE_TIME SERIAL_DELAY
-#else
- #define SLAVE_INT_ACK_WIDTH_UNIT 2
- #define SLAVE_INT_ACK_WIDTH 4
-#endif
-
-static SSTD_t *Transaction_table = NULL;
-static uint8_t Transaction_table_size = 0;
-
-inline static void serial_delay(void) ALWAYS_INLINE;
-inline static
-void serial_delay(void) {
- _delay_us(SERIAL_DELAY);
-}
-
-inline static void serial_delay_half1(void) ALWAYS_INLINE;
-inline static
-void serial_delay_half1(void) {
- _delay_us(SERIAL_DELAY_HALF1);
-}
-
-inline static void serial_delay_half2(void) ALWAYS_INLINE;
-inline static
-void serial_delay_half2(void) {
- _delay_us(SERIAL_DELAY_HALF2);
-}
-
-inline static void serial_output(void) ALWAYS_INLINE;
-inline static
-void serial_output(void) {
- SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
-}
-
-// make the serial pin an input with pull-up resistor
-inline static void serial_input_with_pullup(void) ALWAYS_INLINE;
-inline static
-void serial_input_with_pullup(void) {
- SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK;
- SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
-}
-
-inline static uint8_t serial_read_pin(void) ALWAYS_INLINE;
-inline static
-uint8_t serial_read_pin(void) {
- return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
-}
-
-inline static void serial_low(void) ALWAYS_INLINE;
-inline static
-void serial_low(void) {
- SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
-}
-
-inline static void serial_high(void) ALWAYS_INLINE;
-inline static
-void serial_high(void) {
- SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
-}
-
-void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size)
-{
- Transaction_table = sstd_table;
- Transaction_table_size = (uint8_t)sstd_table_size;
- serial_output();
- serial_high();
-}
-
-void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size)
-{
- Transaction_table = sstd_table;
- Transaction_table_size = (uint8_t)sstd_table_size;
- serial_input_with_pullup();
-
- // Enable INT0-INT3,INT6
- EIMSK |= EIMSK_BIT;
-#if SERIAL_PIN_MASK == _BV(PE6)
- // Trigger on falling edge of INT6
- EICRB &= EICRx_BIT;
-#else
- // Trigger on falling edge of INT0-INT3
- EICRA &= EICRx_BIT;
-#endif
-}
-
-// Used by the sender to synchronize timing with the reciver.
-static void sync_recv(void) NO_INLINE;
-static
-void sync_recv(void) {
- for (uint8_t i = 0; i < SERIAL_DELAY*5 && serial_read_pin(); i++ ) {
- }
- // This shouldn't hang if the target disconnects because the
- // serial line will float to high if the target does disconnect.
- while (!serial_read_pin());
-}
-
-// Used by the reciver to send a synchronization signal to the sender.
-static void sync_send(void) NO_INLINE;
-static
-void sync_send(void) {
- serial_low();
- serial_delay();
- serial_high();
-}
-
-// Reads a byte from the serial line
-static uint8_t serial_read_chunk(uint8_t *pterrcount, uint8_t bit) NO_INLINE;
-static uint8_t serial_read_chunk(uint8_t *pterrcount, uint8_t bit) {
- uint8_t byte, i, p, pb;
-
- _delay_sub_us(READ_WRITE_START_ADJUST);
- for( i = 0, byte = 0, p = PARITY; i < bit; i++ ) {
- serial_delay_half1(); // read the middle of pulses
- if( serial_read_pin() ) {
- byte = (byte << 1) | 1; p ^= 1;
- } else {
- byte = (byte << 1) | 0; p ^= 0;
- }
- _delay_sub_us(READ_WRITE_WIDTH_ADJUST);
- serial_delay_half2();
- }
- /* recive parity bit */
- serial_delay_half1(); // read the middle of pulses
- pb = serial_read_pin();
- _delay_sub_us(READ_WRITE_WIDTH_ADJUST);
- serial_delay_half2();
-
- *pterrcount += (p != pb)? 1 : 0;
-
- return byte;
-}
-
-// Sends a byte with MSB ordering
-void serial_write_chunk(uint8_t data, uint8_t bit) NO_INLINE;
-void serial_write_chunk(uint8_t data, uint8_t bit) {
- uint8_t b, p;
- for( p = PARITY, b = 1<<(bit-1); b ; b >>= 1) {
- if(data & b) {
- serial_high(); p ^= 1;
- } else {
- serial_low(); p ^= 0;
- }
- serial_delay();
- }
- /* send parity bit */
- if(p & 1) { serial_high(); }
- else { serial_low(); }
- serial_delay();
-
- serial_low(); // sync_send() / senc_recv() need raise edge
-}
-
-static void serial_send_packet(uint8_t *buffer, uint8_t size) NO_INLINE;
-static
-void serial_send_packet(uint8_t *buffer, uint8_t size) {
- for (uint8_t i = 0; i < size; ++i) {
- uint8_t data;
- data = buffer[i];
- sync_send();
- serial_write_chunk(data,8);
- }
-}
-
-static uint8_t serial_recive_packet(uint8_t *buffer, uint8_t size) NO_INLINE;
-static
-uint8_t serial_recive_packet(uint8_t *buffer, uint8_t size) {
- uint8_t pecount = 0;
- for (uint8_t i = 0; i < size; ++i) {
- uint8_t data;
- sync_recv();
- data = serial_read_chunk(&pecount, 8);
- buffer[i] = data;
- }
- return pecount == 0;
-}
-
-inline static
-void change_sender2reciver(void) {
- sync_send(); //0
- serial_delay_half1(); //1
- serial_low(); //2
- serial_input_with_pullup(); //2
- serial_delay_half1(); //3
-}
-
-inline static
-void change_reciver2sender(void) {
- sync_recv(); //0
- serial_delay(); //1
- serial_low(); //3
- serial_output(); //3
- serial_delay_half1(); //4
-}
-
-static inline uint8_t nibble_bits_count(uint8_t bits)
-{
- bits = (bits & 0x5) + (bits >> 1 & 0x5);
- bits = (bits & 0x3) + (bits >> 2 & 0x3);
- return bits;
-}
-
-// interrupt handle to be used by the target device
-ISR(SERIAL_PIN_INTERRUPT) {
-
-#ifndef SERIAL_USE_MULTI_TRANSACTION
- serial_low();
- serial_output();
- SSTD_t *trans = Transaction_table;
-#else
- // recive transaction table index
- uint8_t tid, bits;
- uint8_t pecount = 0;
- sync_recv();
- bits = serial_read_chunk(&pecount,7);
- tid = bits>>3;
- bits = (bits&7) != nibble_bits_count(tid);
- if( bits || pecount> 0 || tid > Transaction_table_size ) {
- return;
- }
- serial_delay_half1();
-
- serial_high(); // response step1 low->high
- serial_output();
- _delay_sub_us(SLAVE_INT_ACK_WIDTH_UNIT*SLAVE_INT_ACK_WIDTH);
- SSTD_t *trans = &Transaction_table[tid];
- serial_low(); // response step2 ack high->low
-#endif
-
- // target send phase
- if( trans->target2initiator_buffer_size > 0 )
- serial_send_packet((uint8_t *)trans->target2initiator_buffer,
- trans->target2initiator_buffer_size);
- // target switch to input
- change_sender2reciver();
-
- // target recive phase
- if( trans->initiator2target_buffer_size > 0 ) {
- if (serial_recive_packet((uint8_t *)trans->initiator2target_buffer,
- trans->initiator2target_buffer_size) ) {
- *trans->status = TRANSACTION_ACCEPTED;
- } else {
- *trans->status = TRANSACTION_DATA_ERROR;
- }
- } else {
- *trans->status = TRANSACTION_ACCEPTED;
- }
-
- sync_recv(); //weit initiator output to high
-}
-
-/////////
-// start transaction by initiator
-//
-// int soft_serial_transaction(int sstd_index)
-//
-// Returns:
-// TRANSACTION_END
-// TRANSACTION_NO_RESPONSE
-// TRANSACTION_DATA_ERROR
-// this code is very time dependent, so we need to disable interrupts
-#ifndef SERIAL_USE_MULTI_TRANSACTION
-int soft_serial_transaction(void) {
- SSTD_t *trans = Transaction_table;
-#else
-int soft_serial_transaction(int sstd_index) {
- if( sstd_index > Transaction_table_size )
- return TRANSACTION_TYPE_ERROR;
- SSTD_t *trans = &Transaction_table[sstd_index];
-#endif
- cli();
-
- // signal to the target that we want to start a transaction
- serial_output();
- serial_low();
- _delay_us(SLAVE_INT_WIDTH_US);
-
-#ifndef SERIAL_USE_MULTI_TRANSACTION
- // wait for the target response
- serial_input_with_pullup();
- _delay_us(SLAVE_INT_RESPONSE_TIME);
-
- // check if the target is present
- if (serial_read_pin()) {
- // target failed to pull the line low, assume not present
- serial_output();
- serial_high();
- *trans->status = TRANSACTION_NO_RESPONSE;
- sei();
- return TRANSACTION_NO_RESPONSE;
- }
-
-#else
- // send transaction table index
- int tid = (sstd_index<<3) | (7 & nibble_bits_count(sstd_index));
- sync_send();
- _delay_sub_us(TID_SEND_ADJUST);
- serial_write_chunk(tid, 7);
- serial_delay_half1();
-
- // wait for the target response (step1 low->high)
- serial_input_with_pullup();
- while( !serial_read_pin() ) {
- _delay_sub_us(2);
- }
-
- // check if the target is present (step2 high->low)
- for( int i = 0; serial_read_pin(); i++ ) {
- if (i > SLAVE_INT_ACK_WIDTH + 1) {
- // slave failed to pull the line low, assume not present
- serial_output();
- serial_high();
- *trans->status = TRANSACTION_NO_RESPONSE;
- sei();
- return TRANSACTION_NO_RESPONSE;
- }
- _delay_sub_us(SLAVE_INT_ACK_WIDTH_UNIT);
- }
-#endif
-
- // initiator recive phase
- // if the target is present syncronize with it
- if( trans->target2initiator_buffer_size > 0 ) {
- if (!serial_recive_packet((uint8_t *)trans->target2initiator_buffer,
- trans->target2initiator_buffer_size) ) {
- serial_output();
- serial_high();
- *trans->status = TRANSACTION_DATA_ERROR;
- sei();
- return TRANSACTION_DATA_ERROR;
- }
- }
-
- // initiator switch to output
- change_reciver2sender();
-
- // initiator send phase
- if( trans->initiator2target_buffer_size > 0 ) {
- serial_send_packet((uint8_t *)trans->initiator2target_buffer,
- trans->initiator2target_buffer_size);
- }
-
- // always, release the line when not in use
- sync_send();
-
- *trans->status = TRANSACTION_END;
- sei();
- return TRANSACTION_END;
-}
-
-#ifdef SERIAL_USE_MULTI_TRANSACTION
-int soft_serial_get_and_clean_status(int sstd_index) {
- SSTD_t *trans = &Transaction_table[sstd_index];
- cli();
- int retval = *trans->status;
- *trans->status = 0;;
- sei();
- return retval;
-}
-#endif
-
-#endif
-
-// Helix serial.c history
-// 2018-1-29 fork from let's split and add PD2, modify sync_recv() (#2308, bceffdefc)
-// 2018-6-28 bug fix master to slave comm and speed up (#3255, 1038bbef4)
-// (adjusted with avr-gcc 4.9.2)
-// 2018-7-13 remove USE_SERIAL_PD2 macro (#3374, f30d6dd78)
-// (adjusted with avr-gcc 4.9.2)
-// 2018-8-11 add support multi-type transaction (#3608, feb5e4aae)
-// (adjusted with avr-gcc 4.9.2)
-// 2018-10-21 fix serial and RGB animation conflict (#4191, 4665e4fff)
-// (adjusted with avr-gcc 7.3.0)
-// 2018-10-28 re-adjust compiler depend value of delay (#4269, 8517f8a66)
-// (adjusted with avr-gcc 5.4.0, 7.3.0)
diff --git a/keyboards/helix/local_drivers/serial.h b/keyboards/helix/local_drivers/serial.h
deleted file mode 100644
index b4dcdafe57..0000000000
--- a/keyboards/helix/local_drivers/serial.h
+++ /dev/null
@@ -1,86 +0,0 @@
-#pragma once
-
-#include <stdbool.h>
-
-// /////////////////////////////////////////////////////////////////
-// Need Soft Serial defines in config.h
-// /////////////////////////////////////////////////////////////////
-// ex.
-// #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6
-// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5
-// // 1: about 137kbps (default)
-// // 2: about 75kbps
-// // 3: about 39kbps
-// // 4: about 26kbps
-// // 5: about 20kbps
-//
-// //// USE OLD API (compatible with let's split serial.c)
-// ex.
-// #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
-// #define SERIAL_MASTER_BUFFER_LENGTH 1
-//
-// //// USE NEW API
-// //// USE simple API (using signle-type transaction function)
-// #define SERIAL_USE_SINGLE_TRANSACTION
-// //// USE flexible API (using multi-type transaction function)
-// #define SERIAL_USE_MULTI_TRANSACTION
-//
-// /////////////////////////////////////////////////////////////////
-
-
-//////////////// for backward compatibility ////////////////////////////////
-#if !defined(SERIAL_USE_SINGLE_TRANSACTION) && !defined(SERIAL_USE_MULTI_TRANSACTION)
-/* --- USE OLD API (compatible with let's split serial.c) */
- #if SERIAL_SLAVE_BUFFER_LENGTH > 0
- extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
- #endif
- #if SERIAL_MASTER_BUFFER_LENGTH > 0
- extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
- #endif
-
- void serial_master_init(void);
- void serial_slave_init(void);
- int serial_update_buffers(void);
-
-#endif // end of USE OLD API
-////////////////////////////////////////////////////////////////////////////
-
-// Soft Serial Transaction Descriptor
-typedef struct _SSTD_t {
- uint8_t *status;
- uint8_t initiator2target_buffer_size;
- uint8_t *initiator2target_buffer;
- uint8_t target2initiator_buffer_size;
- uint8_t *target2initiator_buffer;
-} SSTD_t;
-#define TID_LIMIT( table ) (sizeof(table) / sizeof(SSTD_t))
-
-// initiator is transaction start side
-void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size);
-// target is interrupt accept side
-void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size);
-
-// initiator resullt
-#define TRANSACTION_END 0
-#define TRANSACTION_NO_RESPONSE 0x1
-#define TRANSACTION_DATA_ERROR 0x2
-#define TRANSACTION_TYPE_ERROR 0x4
-#ifndef SERIAL_USE_MULTI_TRANSACTION
-int soft_serial_transaction(void);
-#else
-int soft_serial_transaction(int sstd_index);
-#endif
-
-// target status
-// *SSTD_t.status has
-// initiator:
-// TRANSACTION_END
-// or TRANSACTION_NO_RESPONSE
-// or TRANSACTION_DATA_ERROR
-// target:
-// TRANSACTION_DATA_ERROR
-// or TRANSACTION_ACCEPTED
-#define TRANSACTION_ACCEPTED 0x8
-#ifdef SERIAL_USE_MULTI_TRANSACTION
-int soft_serial_get_and_clean_status(int sstd_index);
-#endif
diff --git a/keyboards/helix/local_drivers/ssd1306.c b/keyboards/helix/local_drivers/ssd1306.c
deleted file mode 100644
index 1cfb38037c..0000000000
--- a/keyboards/helix/local_drivers/ssd1306.c
+++ /dev/null
@@ -1,341 +0,0 @@
-
-#ifdef SSD1306OLED
-
-#include "ssd1306.h"
-#include "i2c.h"
-#include <string.h>
-#include "print.h"
-#ifndef LOCAL_GLCDFONT
-#include "common/glcdfont.c"
-#else
-#include "helixfont.h"
-#endif
-#ifdef PROTOCOL_LUFA
-#include "lufa.h"
-#endif
-#include "sendchar.h"
-#include "timer.h"
-
-struct CharacterMatrix display;
-
-// Set this to 1 to help diagnose early startup problems
-// when testing power-on with ble. Turn it off otherwise,
-// as the latency of printing most of the debug info messes
-// with the matrix scan, causing keys to drop.
-#define DEBUG_TO_SCREEN 0
-
-//static uint16_t last_battery_update;
-//static uint32_t vbat;
-//#define BatteryUpdateInterval 10000 /* milliseconds */
-
-// 'last_flush' is declared as uint16_t,
-// so this must be less than 65535
-#define ScreenOffInterval 60000 /* milliseconds */
-#if DEBUG_TO_SCREEN
-static uint8_t displaying;
-#endif
-static uint16_t last_flush;
-
-static bool force_dirty = true;
-
-// Write command sequence.
-// Returns true on success.
-static inline bool _send_cmd1(uint8_t cmd) {
- bool res = false;
-
- if (i2c_start_write(SSD1306_ADDRESS)) {
- xprintf("failed to start write to %d\n", SSD1306_ADDRESS);
- goto done;
- }
-
- if (i2c_master_write(0x0 /* command byte follows */)) {
- print("failed to write control byte\n");
-
- goto done;
- }
-
- if (i2c_master_write(cmd)) {
- xprintf("failed to write command %d\n", cmd);
- goto done;
- }
- res = true;
-done:
- i2c_master_stop();
- return res;
-}
-
-// Write 2-byte command sequence.
-// Returns true on success
-static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) {
- if (!_send_cmd1(cmd)) {
- return false;
- }
- return _send_cmd1(opr);
-}
-
-// Write 3-byte command sequence.
-// Returns true on success
-static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) {
- if (!_send_cmd1(cmd)) {
- return false;
- }
- if (!_send_cmd1(opr1)) {
- return false;
- }
- return _send_cmd1(opr2);
-}
-
-#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;}
-#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;}
-#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;}
-
-static void clear_display(void) {
- matrix_clear(&display);
-
- // Clear all of the display bits (there can be random noise
- // in the RAM on startup)
- send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1);
- send_cmd3(ColumnAddr, 0, DisplayWidth - 1);
-
- if (i2c_start_write(SSD1306_ADDRESS)) {
- goto done;
- }
- if (i2c_master_write(0x40)) {
- // Data mode
- goto done;
- }
- for (uint8_t row = 0; row < MatrixRows; ++row) {
- for (uint8_t col = 0; col < DisplayWidth; ++col) {
- i2c_master_write(0);
- }
- }
-
- display.dirty = false;
-
-done:
- i2c_master_stop();
-}
-
-#if DEBUG_TO_SCREEN
-#undef sendchar
-static int8_t capture_sendchar(uint8_t c) {
- sendchar(c);
- iota_gfx_write_char(c);
-
- if (!displaying) {
- iota_gfx_flush();
- }
- return 0;
-}
-#endif
-
-bool iota_gfx_init(bool rotate) {
- bool success = false;
-
- i2c_master_init();
- send_cmd1(DisplayOff);
- send_cmd2(SetDisplayClockDiv, 0x80);
- send_cmd2(SetMultiPlex, DisplayHeight - 1);
-
- send_cmd2(SetDisplayOffset, 0);
-
-
- send_cmd1(SetStartLine | 0x0);
- send_cmd2(SetChargePump, 0x14 /* Enable */);
- send_cmd2(SetMemoryMode, 0 /* horizontal addressing */);
-
- if(rotate){
- // the following Flip the display orientation 180 degrees
- send_cmd1(SegRemap);
- send_cmd1(ComScanInc);
- }else{
- // Flips the display orientation 0 degrees
- send_cmd1(SegRemap | 0x1);
- send_cmd1(ComScanDec);
- }
-
- send_cmd2(SetComPins, 0x2);
- send_cmd2(SetContrast, 0x8f);
- send_cmd2(SetPreCharge, 0xf1);
- send_cmd2(SetVComDetect, 0x40);
- send_cmd1(DisplayAllOnResume);
- send_cmd1(NormalDisplay);
- send_cmd1(DeActivateScroll);
- send_cmd1(DisplayOn);
-
- send_cmd2(SetContrast, 0); // Dim
-
- clear_display();
-
- success = true;
-
- iota_gfx_flush();
-
-#if DEBUG_TO_SCREEN
- print_set_sendchar(capture_sendchar);
-#endif
-
-done:
- return success;
-}
-
-bool iota_gfx_off(void) {
- bool success = false;
-
- send_cmd1(DisplayOff);
- success = true;
-
-done:
- return success;
-}
-
-bool iota_gfx_on(void) {
- bool success = false;
-
- send_cmd1(DisplayOn);
- success = true;
-
-done:
- return success;
-}
-
-void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) {
- *matrix->cursor = c;
- ++matrix->cursor;
-
- if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) {
- // We went off the end; scroll the display upwards by one line
- memmove(&matrix->display[0], &matrix->display[1],
- MatrixCols * (MatrixRows - 1));
- matrix->cursor = &matrix->display[MatrixRows - 1][0];
- memset(matrix->cursor, ' ', MatrixCols);
- }
-}
-
-void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) {
- matrix->dirty = true;
-
- if (c == '\n') {
- // Clear to end of line from the cursor and then move to the
- // start of the next line
- uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols;
-
- while (cursor_col++ < MatrixCols) {
- matrix_write_char_inner(matrix, ' ');
- }
- return;
- }
-
- matrix_write_char_inner(matrix, c);
-}
-
-void iota_gfx_write_char(uint8_t c) {
- matrix_write_char(&display, c);
-}
-
-void matrix_write(struct CharacterMatrix *matrix, const char *data) {
- const char *end = data + strlen(data);
- while (data < end) {
- matrix_write_char(matrix, *data);
- ++data;
- }
-}
-
-void iota_gfx_write(const char *data) {
- matrix_write(&display, data);
-}
-
-void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
- while (true) {
- uint8_t c = pgm_read_byte(data);
- if (c == 0) {
- return;
- }
- matrix_write_char(matrix, c);
- ++data;
- }
-}
-
-void iota_gfx_write_P(const char *data) {
- matrix_write_P(&display, data);
-}
-
-void matrix_clear(struct CharacterMatrix *matrix) {
- memset(matrix->display, ' ', sizeof(matrix->display));
- matrix->cursor = &matrix->display[0][0];
- matrix->dirty = true;
-}
-
-void iota_gfx_clear_screen(void) {
- matrix_clear(&display);
-}
-
-void matrix_render(struct CharacterMatrix *matrix) {
- last_flush = timer_read();
- iota_gfx_on();
-#if DEBUG_TO_SCREEN
- ++displaying;
-#endif
-
- // Move to the home position
- send_cmd3(PageAddr, 0, MatrixRows - 1);
- send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1);
-
- if (i2c_start_write(SSD1306_ADDRESS)) {
- goto done;
- }
- if (i2c_master_write(0x40)) {
- // Data mode
- goto done;
- }
-
- for (uint8_t row = 0; row < MatrixRows; ++row) {
- for (uint8_t col = 0; col < MatrixCols; ++col) {
- const uint8_t *glyph = font + (matrix->display[row][col] * FontWidth);
-
- for (uint8_t glyphCol = 0; glyphCol < FontWidth; ++glyphCol) {
- uint8_t colBits = pgm_read_byte(glyph + glyphCol);
- i2c_master_write(colBits);
- }
-
- // 1 column of space between chars (it's not included in the glyph)
- //i2c_master_write(0);
- }
- }
-
- matrix->dirty = false;
-
-done:
- i2c_master_stop();
-#if DEBUG_TO_SCREEN
- --displaying;
-#endif
-}
-
-void iota_gfx_flush(void) {
- matrix_render(&display);
-}
-
-__attribute__ ((weak))
-void iota_gfx_task_user(void) {
-}
-
-void iota_gfx_task(void) {
- iota_gfx_task_user();
-
- if (display.dirty|| force_dirty) {
- iota_gfx_flush();
- force_dirty = false;
- }
-
- if (timer_elapsed(last_flush) > ScreenOffInterval) {
- iota_gfx_off();
- }
-}
-
-bool process_record_gfx(uint16_t keycode, keyrecord_t *record) {
- force_dirty = true;
- return true;
-}
-
-#endif
diff --git a/keyboards/helix/local_drivers/ssd1306.h b/keyboards/helix/local_drivers/ssd1306.h
deleted file mode 100644
index a7527f4ebc..0000000000
--- a/keyboards/helix/local_drivers/ssd1306.h
+++ /dev/null
@@ -1,89 +0,0 @@
-#pragma once
-
-#include <stdbool.h>
-#include <stdio.h>
-#include "action.h"
-
-enum ssd1306_cmds {
- DisplayOff = 0xAE,
- DisplayOn = 0xAF,
-
- SetContrast = 0x81,
- DisplayAllOnResume = 0xA4,
-
- DisplayAllOn = 0xA5,
- NormalDisplay = 0xA6,
- InvertDisplay = 0xA7,
- SetDisplayOffset = 0xD3,
- SetComPins = 0xda,
- SetVComDetect = 0xdb,
- SetDisplayClockDiv = 0xD5,
- SetPreCharge = 0xd9,
- SetMultiPlex = 0xa8,
- SetLowColumn = 0x00,
- SetHighColumn = 0x10,
- SetStartLine = 0x40,
-
- SetMemoryMode = 0x20,
- ColumnAddr = 0x21,
- PageAddr = 0x22,
-
- ComScanInc = 0xc0,
- ComScanDec = 0xc8,
- SegRemap = 0xa0,
- SetChargePump = 0x8d,
- ExternalVcc = 0x01,
- SwitchCapVcc = 0x02,
-
- ActivateScroll = 0x2f,
- DeActivateScroll = 0x2e,
- SetVerticalScrollArea = 0xa3,
- RightHorizontalScroll = 0x26,
- LeftHorizontalScroll = 0x27,
- VerticalAndRightHorizontalScroll = 0x29,
- VerticalAndLeftHorizontalScroll = 0x2a,
-};
-
-// Controls the SSD1306 128x32 OLED display via i2c
-
-#ifndef SSD1306_ADDRESS
-#define SSD1306_ADDRESS 0x3C
-#endif
-
-#define DisplayHeight 32
-#define DisplayWidth 128
-
-#define FontHeight 8
-#define FontWidth 6
-
-#define MatrixRows (DisplayHeight / FontHeight)
-#define MatrixCols (DisplayWidth / FontWidth)
-
-struct CharacterMatrix {
- uint8_t display[MatrixRows][MatrixCols];
- uint8_t *cursor;
- bool dirty;
-};
-
-extern struct CharacterMatrix display;
-
-bool iota_gfx_init(bool rotate);
-void iota_gfx_task(void);
-bool iota_gfx_off(void);
-bool iota_gfx_on(void);
-void iota_gfx_flush(void);
-void iota_gfx_write_char(uint8_t c);
-void iota_gfx_write(const char *data);
-void iota_gfx_write_P(const char *data);
-void iota_gfx_clear_screen(void);
-
-void iota_gfx_task_user(void);
-
-void matrix_clear(struct CharacterMatrix *matrix);
-void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c);
-void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c);
-void matrix_write(struct CharacterMatrix *matrix, const char *data);
-void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
-void matrix_render(struct CharacterMatrix *matrix);
-
-bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
diff --git a/keyboards/helix/rev2/config.h b/keyboards/helix/rev2/config.h
index 577edba56b..8c6210bae4 100644
--- a/keyboards/helix/rev2/config.h
+++ b/keyboards/helix/rev2/config.h
@@ -45,12 +45,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MASTER_RIGHT
// #define EE_HANDS
-// Helix keyboard OLED support
-// see ./local_features.mk: OLED_SELECT=local
-#ifdef OLED_LOCAL_ENABLE
- #define SSD1306OLED
-#endif
-
#define OLED_UPDATE_INTERVAL 50
/* Select rows configuration */
diff --git a/keyboards/helix/rev2/custom/matrix.c b/keyboards/helix/rev2/custom/matrix.c
deleted file mode 100644
index 5221d7fd4e..0000000000
--- a/keyboards/helix/rev2/custom/matrix.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
-Copyright 2012 Jun Wako <wakojun@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
- * scan matrix
- */
-#include <stdint.h>
-#include <stdbool.h>
-#include <string.h>
-#include <avr/io.h>
-#include <avr/wdt.h>
-#include <avr/interrupt.h>
-#include <util/delay.h>
-#include "print.h"
-#include "debug.h"
-#include "util.h"
-#include "matrix.h"
-#include "split_util.h"
-#include "quantum.h"
-
-#ifdef USE_MATRIX_I2C
-# include "i2c.h"
-#else // USE_SERIAL
-# include "split_scomm.h"
-#endif
-
-#ifndef DEBOUNCE
-# define DEBOUNCE 5
-#endif
-
-#define ERROR_DISCONNECT_COUNT 5
-
-static uint8_t debouncing = DEBOUNCE;
-static const int ROWS_PER_HAND = MATRIX_ROWS/2;
-static uint8_t error_count = 0;
-
-static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
-static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
-
-/* matrix state(1:on, 0:off) */
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-static matrix_row_t read_cols(void);
-static void init_cols(void);
-static void unselect_rows(void);
-static void select_row(uint8_t row);
-static uint8_t matrix_master_scan(void);
-
-
-__attribute__ ((weak))
-void matrix_init_kb(void) {
- matrix_init_user();
-}
-
-__attribute__ ((weak))
-void matrix_scan_kb(void) {
- matrix_scan_user();
-}
-
-__attribute__ ((weak))
-void matrix_init_user(void) {
-}
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {
-}
-
-inline
-uint8_t matrix_rows(void)
-{
- return MATRIX_ROWS;
-}
-
-inline
-uint8_t matrix_cols(void)
-{
- return MATRIX_COLS;
-}
-
-void matrix_init(void)
-{
- split_keyboard_setup();
-
- // initialize row and col
- unselect_rows();
- init_cols();
-
- setPinOutput(B0);
- setPinOutput(D5);
- writePinHigh(B0);
- writePinHigh(D5);
-
- // initialize matrix state: all keys off
- for (uint8_t i=0; i < MATRIX_ROWS; i++) {
- matrix[i] = 0;
- matrix_debouncing[i] = 0;
- }
-
- matrix_init_quantum();
-}
-
-uint8_t _matrix_scan(void)
-{
- // Right hand is stored after the left in the matirx so, we need to offset it
- int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
-
- for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
- select_row(i);
- _delay_us(30); // without this wait read unstable value.
- matrix_row_t cols = read_cols();
- if (matrix_debouncing[i+offset] != cols) {
- matrix_debouncing[i+offset] = cols;
- debouncing = DEBOUNCE;
- }
- unselect_rows();
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
- matrix[i+offset] = matrix_debouncing[i+offset];
- }
- }
- }
-
- return 1;
-}
-
-#ifdef USE_MATRIX_I2C
-
-// Get rows from other half over i2c
-int i2c_transaction(void) {
- int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
-
- int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
- if (err) goto i2c_error;
-
- // start of matrix stored at 0x00
- err = i2c_master_write(0x00);
- if (err) goto i2c_error;
-
- // Start read
- err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
- if (err) goto i2c_error;
-
- if (!err) {
- int i;
- for (i = 0; i < ROWS_PER_HAND-1; ++i) {
- matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
- }
- matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
- i2c_master_stop();
- } else {
-i2c_error: // the cable is disconnceted, or something else went wrong
- i2c_reset_state();
- return err;
- }
-
- return 0;
-}
-
-#else // USE_SERIAL
-
-int serial_transaction(int master_changed) {
- int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
-#ifdef SERIAL_USE_MULTI_TRANSACTION
- int ret=serial_update_buffers(master_changed);
-#else
- int ret=serial_update_buffers();
-#endif
- if (ret ) {
- if(ret==2) writePinLow(B0);
- return 1;
- }
- writePinHigh(B0);
- memcpy(&matrix[slaveOffset],
- (void *)serial_slave_buffer, sizeof(serial_slave_buffer));
- return 0;
-}
-#endif
-
-uint8_t matrix_scan(void)
-{
- if (is_helix_master()) {
- matrix_master_scan();
- }else{
- matrix_slave_scan();
- int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
- memcpy(&matrix[offset],
- (void *)serial_master_buffer, sizeof(serial_master_buffer));
- matrix_scan_quantum();
- }
- return 1;
-}
-
-
-uint8_t matrix_master_scan(void) {
-
- int ret = _matrix_scan();
- int mchanged = 1;
-
-#ifndef KEYBOARD_helix_rev1
- int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
-
-#ifdef USE_MATRIX_I2C
-// for (int i = 0; i < ROWS_PER_HAND; ++i) {
- /* i2c_slave_buffer[i] = matrix[offset+i]; */
-// i2c_slave_buffer[i] = matrix[offset+i];
-// }
-#else // USE_SERIAL
- #ifdef SERIAL_USE_MULTI_TRANSACTION
- mchanged = memcmp((void *)serial_master_buffer,
- &matrix[offset], sizeof(serial_master_buffer));
- #endif
- memcpy((void *)serial_master_buffer,
- &matrix[offset], sizeof(serial_master_buffer));
-#endif
-#endif
-
-#ifdef USE_MATRIX_I2C
- if( i2c_transaction() ) {
-#else // USE_SERIAL
- if( serial_transaction(mchanged) ) {
-#endif
- // turn on the indicator led when halves are disconnected
- writePinLow(D5);
-
- error_count++;
-
- if (error_count > ERROR_DISCONNECT_COUNT) {
- // reset other half if disconnected
- int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- matrix[slaveOffset+i] = 0;
- }
- }
- } else {
- // turn off the indicator led on no error
- writePinHigh(D5);
- error_count = 0;
- }
- matrix_scan_quantum();
- return ret;
-}
-
-void matrix_slave_scan(void) {
- _matrix_scan();
-
- int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
-
-#ifdef USE_MATRIX_I2C
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- /* i2c_slave_buffer[i] = matrix[offset+i]; */
- i2c_slave_buffer[i] = matrix[offset+i];
- }
-#else // USE_SERIAL
- #ifdef SERIAL_USE_MULTI_TRANSACTION
- int change = 0;
- #endif
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- #ifdef SERIAL_USE_MULTI_TRANSACTION
- if( serial_slave_buffer[i] != matrix[offset+i] )
- change = 1;
- #endif
- serial_slave_buffer[i] = matrix[offset+i];
- }
- #ifdef SERIAL_USE_MULTI_TRANSACTION
- slave_buffer_change_count += change;
- #endif
-#endif
-}
-
-inline
-bool matrix_is_on(uint8_t row, uint8_t col)
-{
- return (matrix[row] & ((matrix_row_t)1<<col));
-}
-
-inline
-matrix_row_t matrix_get_row(uint8_t row)
-{
- return matrix[row];
-}
-
-void matrix_print(void)
-{
- print("\nr/c 0123456789ABCDEF\n");
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- print_hex8(row); print(": ");
- print_bin_reverse16(matrix_get_row(row));
- print("\n");
- }
-}
-
-static void init_cols(void)
-{
- for(int x = 0; x < MATRIX_COLS; x++) {
- _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF);
- _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF);
- }
-}
-
-static matrix_row_t read_cols(void)
-{
- matrix_row_t result = 0;
- for(int x = 0; x < MATRIX_COLS; x++) {
- result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x);
- }
- return result;
-}
-
-static void unselect_rows(void)
-{
- for(int x = 0; x < ROWS_PER_HAND; x++) {
- _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF);
- _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF);
- }
-}
-
-static void select_row(uint8_t row)
-{
- _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF);
- _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF);
-}
diff --git a/keyboards/helix/rev2/custom/split_scomm.c b/keyboards/helix/rev2/custom/split_scomm.c
deleted file mode 100644
index 378781b98c..0000000000
--- a/keyboards/helix/rev2/custom/split_scomm.c
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifdef USE_SERIAL
-#ifdef SERIAL_USE_MULTI_TRANSACTION
-/* --- USE flexible API (using multi-type transaction function) --- */
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <stddef.h>
-#include "split_scomm.h"
-#include "serial.h"
-#ifdef CONSOLE_ENABLE
- #include "print.h"
-#endif
-
-uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
-uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
-uint8_t volatile status_com = 0;
-uint8_t volatile status1 = 0;
-uint8_t slave_buffer_change_count = 0;
-uint8_t s_change_old = 0xff;
-uint8_t s_change_new = 0xff;
-
-SSTD_t transactions[] = {
-#define GET_SLAVE_STATUS 0
- /* master buffer not changed, only recive slave_buffer_change_count */
- { (uint8_t *)&status_com,
- 0, NULL,
- sizeof(slave_buffer_change_count), &slave_buffer_change_count,
- },
-#define PUT_MASTER_GET_SLAVE_STATUS 1
- /* master buffer changed need send, and recive slave_buffer_change_count */
- { (uint8_t *)&status_com,
- sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
- sizeof(slave_buffer_change_count), &slave_buffer_change_count,
- },
-#define GET_SLAVE_BUFFER 2
- /* recive serial_slave_buffer */
- { (uint8_t *)&status1,
- 0, NULL,
- sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
- }
-};
-
-void serial_master_init(void)
-{
- soft_serial_initiator_init(transactions, TID_LIMIT(transactions));
-}
-
-void serial_slave_init(void)
-{
- soft_serial_target_init(transactions, TID_LIMIT(transactions));
-}
-
-// 0 => no error
-// 1 => slave did not respond
-// 2 => checksum error
-int serial_update_buffers(int master_update)
-{
- int status, smatstatus;
- static int need_retry = 0;
-
- if( s_change_old != s_change_new ) {
- smatstatus = soft_serial_transaction(GET_SLAVE_BUFFER);
- if( smatstatus == TRANSACTION_END ) {
- s_change_old = s_change_new;
-#ifdef CONSOLE_ENABLE
- uprintf("slave matrix = %b %b %b %b %b\n",
- serial_slave_buffer[0], serial_slave_buffer[1],
- serial_slave_buffer[2], serial_slave_buffer[3],
- serial_slave_buffer[4] );
-#endif
- }
- } else {
- // serial_slave_buffer dosen't change
- smatstatus = TRANSACTION_END; // dummy status
- }
-
- if( !master_update && !need_retry) {
- status = soft_serial_transaction(GET_SLAVE_STATUS);
- } else {
- status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS);
- }
- if( status == TRANSACTION_END ) {
- s_change_new = slave_buffer_change_count;
- need_retry = 0;
- } else {
- need_retry = 1;
- }
- return smatstatus;
-}
-
-#endif // SERIAL_USE_MULTI_TRANSACTION
-#endif /* USE_SERIAL */
diff --git a/keyboards/helix/rev2/custom/split_scomm.h b/keyboards/helix/rev2/custom/split_scomm.h
deleted file mode 100644
index 16887eb74f..0000000000
--- a/keyboards/helix/rev2/custom/split_scomm.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#pragma once
-
-#ifndef SERIAL_USE_MULTI_TRANSACTION
-/* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */
-#include "serial.h"
-
-#else
-/* --- USE flexible API (using multi-type transaction function) --- */
-// Buffers for master - slave communication
-#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
-#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
-
-extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
-extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
-extern uint8_t slave_buffer_change_count;
-
-void serial_master_init(void);
-void serial_slave_init(void);
-int serial_update_buffers(int master_changed);
-
-#endif
diff --git a/keyboards/helix/rev2/custom/split_util.c b/keyboards/helix/rev2/custom/split_util.c
deleted file mode 100644
index ab40315487..0000000000
--- a/keyboards/helix/rev2/custom/split_util.c
+++ /dev/null
@@ -1,109 +0,0 @@
-#include <avr/io.h>
-#include <avr/wdt.h>
-#include <avr/power.h>
-#include <avr/interrupt.h>
-#include <util/delay.h>
-#include <avr/eeprom.h>
-#include "split_util.h"
-#include "matrix.h"
-#include "keyboard.h"
-#include "wait.h"
-
-#ifdef USE_MATRIX_I2C
-# include "i2c.h"
-#else
-# include "split_scomm.h"
-#endif
-
-#ifdef EE_HANDS
-# include "eeconfig.h"
-#endif
-
-#ifndef SPLIT_USB_TIMEOUT
-# define SPLIT_USB_TIMEOUT 2000
-#endif
-
-#ifndef SPLIT_USB_TIMEOUT_POLL
-# define SPLIT_USB_TIMEOUT_POLL 10
-#endif
-
-volatile bool isLeftHand = true;
-
-bool waitForUsb(void) {
- for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) {
- // This will return true if a USB connection has been established
- if (UDADDR & _BV(ADDEN)) {
- return true;
- }
- wait_ms(SPLIT_USB_TIMEOUT_POLL);
- }
-
- // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow
- (USBCON &= ~(_BV(USBE) | _BV(OTGPADE)));
-
- return false;
-}
-
-
-bool is_keyboard_left(void) {
-#if defined(SPLIT_HAND_PIN)
- // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand
- setPinInput(SPLIT_HAND_PIN);
- return readPin(SPLIT_HAND_PIN);
-#elif defined(EE_HANDS)
- return eeconfig_read_handedness();
-#elif defined(MASTER_RIGHT)
- return !is_helix_master();
-#endif
-
- return is_helix_master();
-}
-
-bool is_helix_master(void) {
- static enum { UNKNOWN, MASTER, SLAVE } usbstate = UNKNOWN;
-
- // only check once, as this is called often
- if (usbstate == UNKNOWN) {
-#if defined(SPLIT_USB_DETECT)
- usbstate = waitForUsb() ? MASTER : SLAVE;
-#elif defined(__AVR__)
- USBCON |= (1 << OTGPADE); // enables VBUS pad
- wait_us(5);
-
- usbstate = (USBSTA & (1 << VBUS)) ? MASTER : SLAVE; // checks state of VBUS
-#else
- usbstate = MASTER;
-#endif
- }
-
- return (usbstate == MASTER);
-}
-
-static void keyboard_master_setup(void) {
-
-#ifdef USE_MATRIX_I2C
- i2c_master_init();
-#else
- serial_master_init();
-#endif
-}
-
-static void keyboard_slave_setup(void) {
-
-#ifdef USE_MATRIX_I2C
- i2c_slave_init(SLAVE_I2C_ADDRESS);
-#else
- serial_slave_init();
-#endif
-}
-
-void split_keyboard_setup(void) {
- isLeftHand = is_keyboard_left();
-
- if (is_helix_master()) {
- keyboard_master_setup();
- } else {
- keyboard_slave_setup();
- }
- sei();
-}
diff --git a/keyboards/helix/rev2/custom/split_util.h b/keyboards/helix/rev2/custom/split_util.h
deleted file mode 100644
index 3b1d4249f5..0000000000
--- a/keyboards/helix/rev2/custom/split_util.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#pragma once
-
-#ifdef SPLIT_KEYBOARD
-# error This is helix local split_util.h.
-# error This header file is used only when SPLIT_KEYBOARD=no.
-#endif
-
-#include <stdbool.h>
-#include "eeconfig.h"
-
-#define SLAVE_I2C_ADDRESS 0x32
-
-extern volatile bool isLeftHand;
-
-// slave version of matix scan, defined in matrix.c
-void matrix_slave_scan(void);
-
-void split_keyboard_setup(void);
-bool is_helix_master(void);
-
-void matrix_master_OLED_init (void);
diff --git a/keyboards/helix/rev2/keymaps/default/oled_display.c b/keyboards/helix/rev2/keymaps/default/oled_display.c
index 824d2e4d86..ad5558869f 100644
--- a/keyboards/helix/rev2/keymaps/default/oled_display.c
+++ b/keyboards/helix/rev2/keymaps/default/oled_display.c
@@ -18,10 +18,6 @@
#include <string.h>
#include QMK_KEYBOARD_H
-#ifdef SSD1306OLED
- #include "ssd1306.h"
-#endif
-
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
@@ -35,10 +31,15 @@ enum layer_number {
_ADJUST
};
-//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
-#if defined(SSD1306OLED) || defined(OLED_ENABLE)
+//assign the right code to your layers for OLED display
+#define L_BASE 0
+#define L_LOWER (1<<_LOWER)
+#define L_RAISE (1<<_RAISE)
+#define L_ADJUST (1<<_ADJUST)
+#define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER)
-# if defined(OLED_ENABLE)
+//OLED update loop
+#ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (is_keyboard_master()) {
return OLED_ROTATION_0;
@@ -46,12 +47,120 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_180;
}
}
-# else
-# define oled_write(data,flag) matrix_write(matrix, data)
-# define oled_write_P(data,flag) matrix_write_P(matrix, data)
+
+static void render_rgbled_status(bool full) {
+# ifdef RGBLIGHT_ENABLE
+ char buf[30];
+ if (RGBLIGHT_MODES > 1 && rgblight_is_enabled()) {
+ if (full) {
+ snprintf(buf, sizeof(buf), " LED %2d: %d,%d,%d ",
+ rgblight_get_mode(),
+ rgblight_get_hue()/RGBLIGHT_HUE_STEP,
+ rgblight_get_sat()/RGBLIGHT_SAT_STEP,
+ rgblight_get_val()/RGBLIGHT_VAL_STEP);
+ } else {
+ snprintf(buf, sizeof(buf), "[%2d] ", rgblight_get_mode());
+ }
+ oled_write(buf, false);
+ }
# endif
+}
+
+static void render_layer_status(void) {
+ // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
+ char buf[10];
+ oled_write_P(PSTR("Layer: "), false);
+ switch (layer_state) {
+ case L_BASE:
+ oled_write_P(PSTR("Default"), false);
+ break;
+ case L_RAISE:
+ oled_write_P(PSTR("Raise"), false);
+ break;
+ case L_LOWER:
+ oled_write_P(PSTR("Lower"), false);
+ break;
+ case L_ADJUST:
+ case L_ADJUST_TRI:
+ oled_write_P(PSTR("Adjust"), false);
+ break;
+ default:
+ oled_write_P(PSTR("Undef-"), false);
+ snprintf(buf,sizeof(buf), "%ld", layer_state);
+ oled_write(buf, false);
+ }
+ oled_write_P(PSTR("\n"), false);
+}
+
+void render_status(void) {
+ // Render to mode icon
+ static const char os_logo[][2][3] PROGMEM = {{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
+ if (is_mac_mode()) {
+ oled_write_P(os_logo[0][0], false);
+ oled_write_P(PSTR("\n"), false);
+ oled_write_P(os_logo[0][1], false);
+ } else {
+ oled_write_P(os_logo[1][0], false);
+ oled_write_P(PSTR("\n"), false);
+ oled_write_P(os_logo[1][1], false);
+ }
+
+ oled_write_P(PSTR(" "), false);
+ render_layer_status();
+
+ // Host Keyboard LED Status
+ led_t led_state = host_keyboard_led_state();
+ oled_write_P(led_state.num_lock ? PSTR("NUMLOCK") : PSTR(" "), false);
+ oled_write_P(led_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false);
+ oled_write_P(led_state.scroll_lock ? PSTR("SCLK") : PSTR(" "), false);
+ oled_advance_page(true);
+ render_rgbled_status(true);
+ oled_write_P(PSTR("\n"), false);
+}
+
+bool oled_task_user(void) {
+
+# if DEBUG_TO_SCREEN
+ if (debug_enable) {
+ return;
+ }
+# endif
+
+ if (is_keyboard_master()) {
+ render_status();
+ } else {
+ render_helix_logo();
+ render_rgbled_status(false);
+ render_layer_status();
+ }
+ return false;
+}
+#endif // end of OLED_ENABLE
+
+//SSD1306 OLED update loop
+/*
+ The following code is left as a sample to help you transition from SSD1306OLED to OLED_ENABLE.
+
+ * `matrix_write(matrix, data)` is replaced by `oled_write(data, false)`.
+ * `matrix_write_P(matrix, data)` is replaced by `oled_write_P(data, false)`.
+ * It is no longer necessary to call `iota_gfx_task()`.
+ * `matrix_update()` are no longer needed.
+ * `iota_gfx_task_user()` is no longer needed. Instead, `bool oled_task_user(void)` is provided.
+
+ 以下のコードは、SSD1306OLED から OLED_ENABLE に移行する助けになるようにサンプルとして残してあります。
+
+ * `matrix_write(matrix, data)` は、`oled_write(data, false)` に書き換えます。
+ * `matrix_write_P(matrix, data)` は、`oled_write_P(data, false)` に書き換えます。
+ * `iota_gfx_task()` を呼び出す必要はなくなります。
+ * `matrix_update()` は不要になります。
+ * `iota_gfx_task_user()` は不要になります。代りに `bool oled_task_user(void)` を用意します。
+ */
+
+#ifdef SSD1306OLED
+#include "ssd1306.h"
+#define oled_write(data,flag) matrix_write(matrix, data)
+#define oled_write_P(data,flag) matrix_write_P(matrix, data)
-# ifdef SSD1306OLED
void matrix_scan_user(void) {
iota_gfx_task(); // this is what updates the display continuously
}
@@ -63,16 +172,7 @@ void matrix_update(struct CharacterMatrix *dest,
dest->dirty = true;
}
}
-# endif
-
-//assign the right code to your layers for OLED display
-#define L_BASE 0
-#define L_LOWER (1<<_LOWER)
-#define L_RAISE (1<<_RAISE)
-#define L_ADJUST (1<<_ADJUST)
-#define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER)
-# ifdef SSD1306OLED
static void render_logo(struct CharacterMatrix *matrix) {
static const char helix_logo[] PROGMEM ={
@@ -82,13 +182,8 @@ static void render_logo(struct CharacterMatrix *matrix) {
0};
oled_write_P(helix_logo, false);
}
-# endif
-# ifdef SSD1306OLED
static void render_rgbled_status(bool full, struct CharacterMatrix *matrix) {
-# else
-static void render_rgbled_status(bool full) {
-# endif
# ifdef RGBLIGHT_ENABLE
char buf[30];
if (RGBLIGHT_MODES > 1 && rgblight_is_enabled()) {
@@ -106,11 +201,7 @@ static void render_rgbled_status(bool full) {
# endif
}
-# ifdef SSD1306OLED
static void render_layer_status(struct CharacterMatrix *matrix) {
-# else
-static void render_layer_status(void) {
-# endif
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
char buf[10];
oled_write_P(PSTR("Layer: "), false);
@@ -136,11 +227,7 @@ static void render_layer_status(void) {
oled_write_P(PSTR("\n"), false);
}
-# ifdef SSD1306OLED
void render_status(struct CharacterMatrix *matrix) {
-# else
-void render_status(void) {
-# endif
// Render to mode icon
static const char os_logo[][2][3] PROGMEM = {{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
if (is_mac_mode()) {
@@ -154,11 +241,7 @@ void render_status(void) {
}
oled_write_P(PSTR(" "), false);
-# ifdef SSD1306OLED
render_layer_status(matrix);
-# else
- render_layer_status();
-# endif
// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
@@ -166,35 +249,28 @@ void render_status(void) {
oled_write_P(led_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCLK") : PSTR(" "), false);
oled_write_P(PSTR("\n"), false);
-# ifdef SSD1306OLED
render_rgbled_status(true, matrix);
-# else
- render_rgbled_status(true);
- oled_write_P(PSTR("\n"), false);
-# endif
}
-
-# ifdef SSD1306OLED
-# if OLED_UPDATE_INTERVAL > 0
+# if OLED_UPDATE_INTERVAL > 0
uint16_t oled_update_timeout;
-# endif
+# endif
void iota_gfx_task_user(void) {
struct CharacterMatrix matrix;
-# if DEBUG_TO_SCREEN
+# if DEBUG_TO_SCREEN
if (debug_enable) {
return;
}
-# endif
+# endif
-#if OLED_UPDATE_INTERVAL > 0
+# if OLED_UPDATE_INTERVAL > 0
if (timer_elapsed(oled_update_timeout) < OLED_UPDATE_INTERVAL) {
return;
}
oled_update_timeout = timer_read();
-#endif
+# endif
matrix_clear(&matrix);
if (is_keyboard_master()) {
render_status(&matrix);
@@ -205,23 +281,5 @@ void iota_gfx_task_user(void) {
}
matrix_update(&display, &matrix);
}
-# else
-bool oled_task_user(void) {
-# if DEBUG_TO_SCREEN
- if (debug_enable) {
- return;
- }
-# endif
-
- if (is_keyboard_master()) {
- render_status();
- } else {
- render_helix_logo();
- render_rgbled_status(false);
- render_layer_status();
- }
- return false;
-}
-# endif
-#endif
+#endif // end of SSD1306OLED
diff --git a/keyboards/helix/rev2/local_features.mk b/keyboards/helix/rev2/local_features.mk
index c6f818bf39..34fd699a65 100644
--- a/keyboards/helix/rev2/local_features.mk
+++ b/keyboards/helix/rev2/local_features.mk
@@ -40,24 +40,6 @@ ifneq ($(strip $(HELIX)),)
SHOW_HELIX_OPTIONS = yes
endif
-ifneq ($(strip $(SPLIT_KEYBOARD)), yes)
- # In the very near future, all keymaps will be compatible with split_common and this block will be removed.
- SRC += local_drivers/serial.c
- KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
-
- # A workaround until #7089 is merged.
- # serial.c must not be compiled with the -lto option.
- # The current LIB_SRC has a side effect with the -fno-lto option, so use it.
- LIB_SRC += local_drivers/serial.c
-
- CUSTOM_MATRIX = yes
-
- SRC += rev2/custom/matrix.c
- SRC += rev2/custom/split_util.c
- SRC += rev2/custom/split_scomm.c
- KEYBOARD_PATHS += $(HELIX_TOP_DIR)/rev2/custom
-endif
-
########
# convert Helix-specific options (that represent combinations of standard options)
# into QMK standard options.
@@ -88,44 +70,17 @@ ifeq ($(strip $(LED_ANIMATIONS)), yes)
endif
ifeq ($(strip $(OLED_ENABLE)), yes)
- ifeq ($(strip $(OLED_SELECT)),core)
- OLED_ENABLE = yes
- OLED_DRIVER = SSD1306
- ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
- OPT_DEFS += -DOLED_FONT_H=\<helixfont.h\>
- else
- OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\"
- endif
+ OLED_DRIVER = SSD1306
+ ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
+ OPT_DEFS += -DOLED_FONT_H=\<helixfont.h\>
else
-
- # In the very near future, all keymaps will be compatible with QMK standard oled_driver and this block will be removed.
- ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
- $(info Helix/rev2: The following combinations are not supported.)
- $(info - SPLIT_KEYBOARD = $(SPLIT_KEYBOARD)) # yes
- $(info - OLED_ENABLE = $(OLED_ENABLE)) # yes
- $(info - OLED_SELECT = $(OLED_SELECT)) # local
- $(info Force : OLED_ENABLE = no)
- $(info .)
- OLED_ENABLE = no
- endif
- ifeq ($(strip $(OLED_ENABLE)), yes)
- OLED_ENABLE = no # disable OLED in TOP/common_features.mk
- OLED_LOCAL_ENABLE = yes
- SRC += local_drivers/i2c.c
- SRC += local_drivers/ssd1306.c
- KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
- OPT_DEFS += -DOLED_LOCAL_ENABLE
- ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
- OPT_DEFS += -DLOCAL_GLCDFONT
- endif
- endif
+ OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\"
endif
endif
ifneq ($(strip $(SHOW_HELIX_OPTIONS)),)
$(info Helix Spacific Build Options)
$(info - OLED_ENABLE = $(OLED_ENABLE))
- $(info - OLED_SELECT = $(OLED_SELECT))
$(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE))
$(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE))
$(info - LED_ANIMATIONS = $(LED_ANIMATIONS))
diff --git a/keyboards/helix/rev2/override_helix_options.mk b/keyboards/helix/rev2/override_helix_options.mk-maintenance
index 56dee8ce78..56dee8ce78 100644
--- a/keyboards/helix/rev2/override_helix_options.mk
+++ b/keyboards/helix/rev2/override_helix_options.mk-maintenance
diff --git a/keyboards/helix/rev2/rev2.c b/keyboards/helix/rev2/rev2.c
index ba29f3c7de..2bbe9a28e2 100644
--- a/keyboards/helix/rev2/rev2.c
+++ b/keyboards/helix/rev2/rev2.c
@@ -20,14 +20,6 @@
// for the old keymap.c.
uint8_t is_master = false;
-#ifdef SSD1306OLED
-#include "ssd1306.h"
-
-bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
- return process_record_gfx(keycode,record) && process_record_user(keycode, record);
-}
-#endif
-
bool is_mac_mode(void) {
// This is the opposite of the QMK standard, but we'll leave it for backwards compatibility.
return keymap_config.swap_lalt_lgui == false;
@@ -59,12 +51,6 @@ void keyboard_post_init_kb(void) {
keyboard_post_init_user();
}
-#if defined(SPLIT_KEYBOARD) && defined(SSD1306OLED)
-void matrix_slave_scan_user(void) {
- matrix_scan_user();
-}
-#endif
-
#ifdef OLED_ENABLE
void render_helix_logo(void) {
static const char helix_logo[] PROGMEM ={
@@ -82,7 +68,7 @@ bool oled_task_kb(void) {
oled_write_P(led_state.num_lock ? PSTR("NUMLOCK") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCLK") : PSTR(" "), false);
- oled_write_P(PSTR("\n"), false);
+ oled_advance_page(true);
render_helix_logo();
}
return false;
diff --git a/keyboards/helix/rev2/rules.mk b/keyboards/helix/rev2/rules.mk
index 5ed92ff0ad..dce8b9d3ea 100644
--- a/keyboards/helix/rev2/rules.mk
+++ b/keyboards/helix/rev2/rules.mk
@@ -1,6 +1,6 @@
KEYBOARD_LOCAL_FEATURES_MK := $(dir $(lastword $(MAKEFILE_LIST)))local_features.mk
-# SPLIT_KEYBOARD = yes
+SPLIT_KEYBOARD = yes
# Helix Spacific Build Options default values
HELIX_ROWS = 5 # Helix Rows is 4 or 5
@@ -10,8 +10,3 @@ LED_BACK_ENABLE = no # LED backlight (Enable WS2812 RGB underlight.)
LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight.)
LED_ANIMATIONS = yes # LED animations
IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
-
-# If OLED_ENABLE is 'yes'
-# If OLED_SELECT is 'core', use QMK standard oled_dirver.c.
-# If OLED_SELECT is other than 'core', use helix/local_drivers/ssd1306.c.
-OLED_SELECT = local
diff --git a/keyboards/hhkb/jp/info.json b/keyboards/hhkb/jp/info.json
index b9064880dd..ee9d1de53a 100644
--- a/keyboards/hhkb/jp/info.json
+++ b/keyboards/hhkb/jp/info.json
@@ -3,7 +3,7 @@
"url": "",
"maintainer": "qmk",
"layouts": {
- "LAYOUT_JP": {
+ "LAYOUT_jp": {
"layout": [
{ "label": "Esc", "x": 0, "y": 0 },
{ "label": "!", "x": 1, "y": 0 },
diff --git a/keyboards/hhkb/jp/jp.h b/keyboards/hhkb/jp/jp.h
index a95796f25f..b243e5546c 100644
--- a/keyboards/hhkb/jp/jp.h
+++ b/keyboards/hhkb/jp/jp.h
@@ -2,7 +2,7 @@
#include "quantum.h"
-#define LAYOUT_JP( \
+#define LAYOUT_jp( \
K02, K32, K62, K22, K12, K52, K72, KA2, K92, K82, KB2, KE2, KF2, KD2, KC2, \
K03, K63, K23, K13, K53, K73, KA3, K93, K83, KB3, KE3, KF3, KD3, \
K06, K66, K26, K16, K56, K76, KA6, K96, K86, KB6, KE6, KF6, KD6, KC6, \
diff --git a/keyboards/hhkb/jp/keymaps/bakingpy/keymap.c b/keyboards/hhkb/jp/keymaps/bakingpy/keymap.c
index 04d79f9247..cea713dbf2 100644
--- a/keyboards/hhkb/jp/keymaps/bakingpy/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/bakingpy/keymap.c
@@ -1,14 +1,14 @@
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [0] = LAYOUT_JP(
+ [0] = LAYOUT_jp(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_DEL, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_BSLS,
MO(1), KC_GRV, KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_BSPC, KC_RGUI, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
- [1] = LAYOUT_JP(
+ [1] = LAYOUT_jp(
KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
_______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
diff --git a/keyboards/hhkb/jp/keymaps/default/keymap.c b/keyboards/hhkb/jp/keymaps/default/keymap.c
index 1c7d677ccf..a704ee5647 100644
--- a/keyboards/hhkb/jp/keymaps/default/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/default/keymap.c
@@ -29,14 +29,14 @@
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [0] = LAYOUT_JP(
+ [0] = LAYOUT_jp(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_JYEN, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_UP, KC_RSFT,
MO(1), KC_ZKHK, KC_LGUI, KC_LALT, KC_MHEN, KC_SPC, KC_HENK, KC_KANA, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
- [1] = LAYOUT_JP(
+ [1] = LAYOUT_jp(
KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
_______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
diff --git a/keyboards/hhkb/jp/keymaps/default_mac/keymap.c b/keyboards/hhkb/jp/keymaps/default_mac/keymap.c
index 17127690f4..df08341fa4 100644
--- a/keyboards/hhkb/jp/keymaps/default_mac/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/default_mac/keymap.c
@@ -29,14 +29,14 @@
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [0] = LAYOUT_JP(
+ [0] = LAYOUT_jp(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_JYEN, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_UP, KC_RSFT,
MO(1), KC_GRV, KC_LALT, KC_LGUI, KC_MHEN, KC_SPC, KC_HENK, KC_RGUI, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
- [1] = LAYOUT_JP(
+ [1] = LAYOUT_jp(
KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
_______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
diff --git a/keyboards/hhkb/jp/keymaps/dhertz/keymap.c b/keyboards/hhkb/jp/keymaps/dhertz/keymap.c
index 951af069b0..4c01457464 100644
--- a/keyboards/hhkb/jp/keymaps/dhertz/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/dhertz/keymap.c
@@ -15,7 +15,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |NCt|| #|Alt|CmT|CmT| LyrSpc |CGv|Iso|Gui|CSL||Rig|Dow|Lef|
* `-----------------------------------------------------------'
*/
- [0] = LAYOUT_JP(
+ [0] = LAYOUT_jp(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,KC_MINS, KC_EQL, KC_DEL,KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,
SRCH_CTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_NUHS, KC_ENT,
@@ -36,7 +36,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | || ~| |CAD| | |CmH| | | || | | |
* `-----------------------------------------------------------'
*/
- [1] = LAYOUT_JP(
+ [1] = LAYOUT_jp(
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,
CMD_SPC,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
@@ -57,7 +57,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | || ~| | | | | | | | ||Hom|PgD|End|
* `-----------------------------------------------------------'
*/
- [2] = LAYOUT_JP(
+ [2] = LAYOUT_jp(
KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS,KC_DEL,
KC_CAPS, DF(0), DF(1),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_SLCK,KC_PAUS, KC_UP,KC_TRNS,
KC_TRNS, KC_VOLD,KC_VOLU,KC_MUTE,KC_TRNS,KC_TRNS,KC_TRNS,KC_BSPC, KC_DEL,CMD_SFT_L,KC_LEFT,KC_RGHT,KC_TRNS,KC_PENT,
diff --git a/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c b/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c
index 4ebdcf86da..2bec6bb4c6 100644
--- a/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c
@@ -29,14 +29,14 @@
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [0] = LAYOUT_JP(
+ [0] = LAYOUT_jp(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_GRAVE, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_DEL, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_BSLS,
KC_BSPC, KC_ZKHK, KC_LGUI, KC_LALT, MO(1), KC_SPC, KC_BSPC, KC_RSFT, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
- [1] = LAYOUT_JP(
+ [1] = LAYOUT_jp(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
KC_CAPS, KC_MEDIA_PREV_TRACK, KC_MEDIA_PLAY_PAUSE, KC_MEDIA_NEXT_TRACK, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
_______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PSCR, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_LEFT, KC_RGHT, _______, KC_PENT,
diff --git a/keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c
index 0d4a24c60d..ebbe13393b 100644
--- a/keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c
@@ -26,7 +26,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
| ||Ctl|Alt|Cmd| | Spc | | | | ||Lft|Dwn|Rgh|
`-----------------------------------------------------------'
*/
- [BASE] = LAYOUT_JP(
+ [BASE] = LAYOUT_jp(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_JYEN, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT,
@@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
`-----------------------------------------------------------'
*/
- [HHKB] = LAYOUT_JP(
+ [HHKB] = LAYOUT_jp(
KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
_______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
@@ -67,7 +67,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
| || | | | | | | | | || | | |
`-----------------------------------------------------------'
*/
- [MIRROR] = LAYOUT_JP(
+ [MIRROR] = LAYOUT_jp(
_______, KC_0, KC_9, KC_8, KC_7, KC_6, KC_5, KC_4, KC_3, KC_2, KC_1, _______, _______, _______, _______,
_______, KC_P, KC_O, KC_I, KC_U, KC_Y, KC_T, KC_R, KC_E, KC_W, KC_Q, _______, _______,
_______, KC_SCLN, KC_L, KC_K, KC_J, KC_H, KC_G, KC_F, KC_D, KC_S, KC_A, _______, _______, _______,
diff --git a/keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c b/keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c
index c893495efe..b4eec44547 100644
--- a/keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c
@@ -28,21 +28,21 @@ enum
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [ZER] = LAYOUT_JP(
+ [ZER] = LAYOUT_jp(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_INS, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_GRV, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_BSLS, KC_UP, KC_RSFT,
MO(HDN), KC_LCTL, KC_LALT, KC_LGUI, MO(HDN), KC_SPC, SFT_BSP, MO(HDN), MO(OSY), KC_NO, KC_LEFT, KC_DOWN, KC_RGHT),
- [HDN] = LAYOUT_JP(
+ [HDN] = LAYOUT_jp(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_DEL,
_______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, _______,
_______, KC_TILD, KC_GRV, KC_BSLS, KC_PIPE, KC_MINS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TILD, KC_GRV, _______, _______,
_______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, _______, KC_ENT, _______, _______, _______, _______, KC_PGUP, _______,
_______, _______, _______, _______, _______, KC_UNDS, KC_DEL, _______, _______, _______, KC_HOME, KC_PGDN, KC_END),
- [OSY] = LAYOUT_JP(
+ [OSY] = LAYOUT_jp(
_______, _______, _______, SCRNS3, SCRNS4, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
diff --git a/keyboards/hhkb/jp/keymaps/sh_jp/keymap.c b/keyboards/hhkb/jp/keymaps/sh_jp/keymap.c
index 097a017525..e13838007b 100644
--- a/keyboards/hhkb/jp/keymaps/sh_jp/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/sh_jp/keymap.c
@@ -10,34 +10,34 @@ enum
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [DVOR] = LAYOUT_JP(
+ [DVOR] = LAYOUT_jp(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_JYEN, KC_BSPC,
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL,
KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_BSLS, KC_ENT,
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RO, KC_UP, KC_RSFT,
MO(FUNC), KC_ZKHK, KC_LALT, MO(NEW_CMD), MO(SYMB), MT(MOD_LSFT, KC_SPC), MO(SYMB), KC_TAB, KC_RGUI, TG(QWER), KC_LEFT, KC_DOWN, KC_RGHT),
- [QWER] = LAYOUT_JP(
+ [QWER] = LAYOUT_jp(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_JYEN, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_UP, KC_RSFT,
MO(FUNC), KC_ZKHK, KC_LALT, MO(NEW_CMD), MO(SYMB), MT(MOD_LSFT, KC_SPC), MO(SYMB), KC_TAB, KC_RGUI, _______, KC_LEFT, KC_DOWN, KC_RGHT),
- [NEW_CMD] = LAYOUT_JP(
+ [NEW_CMD] = LAYOUT_jp(
_______, LGUI(KC_1), LGUI(KC_2), LGUI(KC_3), LGUI(KC_4), LGUI(KC_5), LGUI(KC_6), LGUI(KC_7), LGUI(KC_8), LGUI(KC_9), LGUI(KC_0), _______, _______, _______, LGUI(KC_BSPC),
_______, LGUI(KC_Q), LGUI(KC_W), LGUI(KC_E), LGUI(KC_R), LGUI(KC_T), LGUI(KC_Y), LGUI(KC_U), LGUI(KC_I), LGUI(KC_O), LGUI(KC_P), LGUI(KC_LBRC), LGUI(KC_RBRC),
_______, LGUI(KC_A), LGUI(KC_S), LGUI(KC_D), LGUI(KC_F), LGUI(KC_G), LGUI(KC_H), LGUI(KC_J), LGUI(KC_K), LGUI(KC_L), _______, _______, _______, _______,
LGUI(KC_LSFT), LGUI(KC_Z), LGUI(KC_X), LGUI(KC_C), LGUI(KC_V), LGUI(KC_B), LGUI(KC_N), LGUI(KC_M), LGUI(KC_COMM), LGUI(KC_DOT), LGUI(KC_SLSH), _______, _______, _______,
_______, _______, _______, _______, _______, LGUI(KC_SPC), _______, _______, _______, _______, LGUI(KC_LEFT), LGUI(KC_DOWN), LGUI(KC_RGHT)),
- [SYMB] = LAYOUT_JP(
+ [SYMB] = LAYOUT_jp(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, KC_LBRC, KC_RBRC, _______, _______, LSFT(KC_LBRC), LSFT(KC_RBRC), _______, _______, _______, _______,
_______, LSFT(KC_1), LSFT(KC_2), LSFT(KC_3), LSFT(KC_4), LSFT(KC_5), LSFT(KC_6), LSFT(KC_7), LSFT(KC_8), LSFT(KC_9), LSFT(KC_0), _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
- [FUNC] = LAYOUT_JP(
+ [FUNC] = LAYOUT_jp(
KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
_______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
diff --git a/keyboards/hhkb/jp/keymaps/via/keymap.c b/keyboards/hhkb/jp/keymaps/via/keymap.c
index 64323309bb..8f23cfcd2d 100644
--- a/keyboards/hhkb/jp/keymaps/via/keymap.c
+++ b/keyboards/hhkb/jp/keymaps/via/keymap.c
@@ -29,21 +29,21 @@
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [0] = LAYOUT_JP(
+ [0] = LAYOUT_jp(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_JYEN, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_UP, KC_RSFT,
MO(1), KC_ZKHK, KC_LGUI, KC_LALT, KC_MHEN, KC_SPC, KC_HENK, KC_KANA, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
- [1] = LAYOUT_JP(
+ [1] = LAYOUT_jp(
KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
_______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
_______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
- [2] = LAYOUT_JP(
+ [2] = LAYOUT_jp(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
diff --git a/keyboards/hnahkb/vn66/rules.mk b/keyboards/hnahkb/vn66/rules.mk
index f1c1ec985e..542b79b4d8 100644
--- a/keyboards/hnahkb/vn66/rules.mk
+++ b/keyboards/hnahkb/vn66/rules.mk
@@ -17,5 +17,6 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
ENCODER_ENABLE = yes
+LTO_ENABLE = yes
LAYOUTS = 66_ansi 66_iso
diff --git a/keyboards/horrortroll/handwired_k552/rules.mk b/keyboards/horrortroll/handwired_k552/rules.mk
index 5df510cd44..f29c92f64c 100644
--- a/keyboards/horrortroll/handwired_k552/rules.mk
+++ b/keyboards/horrortroll/handwired_k552/rules.mk
@@ -20,6 +20,7 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
NO_USB_STARTUP_CHECK = yes
+LTO_ENABLE = yes
# RGB Matrix enabled
RGB_MATRIX_ENABLE = yes
diff --git a/keyboards/input_club/ergodox_infinity/mcuconf.h b/keyboards/input_club/ergodox_infinity/mcuconf.h
index f6730b99ca..e4dfa75186 100644
--- a/keyboards/input_club/ergodox_infinity/mcuconf.h
+++ b/keyboards/input_club/ergodox_infinity/mcuconf.h
@@ -62,7 +62,7 @@
/* Need to redefine this, since the default is for K20x */
/* This is for Teensy LC; you should comment it out (or change to 5)
* for Teensy 3.x */
-#define KINETIS_USB_USB0_IRQ_PRIORITY 2
+#define KINETIS_USB_USB0_IRQ_PRIORITY 5
/*
* SPI driver system settings.
diff --git a/keyboards/kabedon/kabedon98e/chconf.h b/keyboards/kabedon/kabedon98e/chconf.h
deleted file mode 100644
index f07706dfda..0000000000
--- a/keyboards/kabedon/kabedon98e/chconf.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/keyboards/kabedon/kabedon98e/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
diff --git a/keyboards/absinthe/absinthe.c b/keyboards/keyhive/absinthe/absinthe.c
index 502139ed0c..502139ed0c 100644
--- a/keyboards/absinthe/absinthe.c
+++ b/keyboards/keyhive/absinthe/absinthe.c
diff --git a/keyboards/absinthe/absinthe.h b/keyboards/keyhive/absinthe/absinthe.h
index 890aff643e..890aff643e 100644
--- a/keyboards/absinthe/absinthe.h
+++ b/keyboards/keyhive/absinthe/absinthe.h
diff --git a/keyboards/absinthe/config.h b/keyboards/keyhive/absinthe/config.h
index d6acd350cc..d6acd350cc 100644
--- a/keyboards/absinthe/config.h
+++ b/keyboards/keyhive/absinthe/config.h
diff --git a/keyboards/absinthe/info.json b/keyboards/keyhive/absinthe/info.json
index f92e9e10ee..f92e9e10ee 100644
--- a/keyboards/absinthe/info.json
+++ b/keyboards/keyhive/absinthe/info.json
diff --git a/keyboards/absinthe/keymaps/ansi/keymap.c b/keyboards/keyhive/absinthe/keymaps/ansi/keymap.c
index 2177f18146..2177f18146 100644
--- a/keyboards/absinthe/keymaps/ansi/keymap.c
+++ b/keyboards/keyhive/absinthe/keymaps/ansi/keymap.c
diff --git a/keyboards/absinthe/keymaps/ansi/readme.md b/keyboards/keyhive/absinthe/keymaps/ansi/readme.md
index e88d0cf9dd..e88d0cf9dd 100644
--- a/keyboards/absinthe/keymaps/ansi/readme.md
+++ b/keyboards/keyhive/absinthe/keymaps/ansi/readme.md
diff --git a/keyboards/absinthe/keymaps/default/keymap.c b/keyboards/keyhive/absinthe/keymaps/default/keymap.c
index e5c74366c0..e5c74366c0 100644
--- a/keyboards/absinthe/keymaps/default/keymap.c
+++ b/keyboards/keyhive/absinthe/keymaps/default/keymap.c
diff --git a/keyboards/absinthe/keymaps/default/readme.md b/keyboards/keyhive/absinthe/keymaps/default/readme.md
index f9ec78d7b4..f9ec78d7b4 100644
--- a/keyboards/absinthe/keymaps/default/readme.md
+++ b/keyboards/keyhive/absinthe/keymaps/default/readme.md
diff --git a/keyboards/absinthe/keymaps/via/keymap.c b/keyboards/keyhive/absinthe/keymaps/via/keymap.c
index 797d14226d..797d14226d 100644
--- a/keyboards/absinthe/keymaps/via/keymap.c
+++ b/keyboards/keyhive/absinthe/keymaps/via/keymap.c
diff --git a/keyboards/absinthe/keymaps/via/rules.mk b/keyboards/keyhive/absinthe/keymaps/via/rules.mk
index eb5b445ddf..eb5b445ddf 100644
--- a/keyboards/absinthe/keymaps/via/rules.mk
+++ b/keyboards/keyhive/absinthe/keymaps/via/rules.mk
diff --git a/keyboards/absinthe/readme.md b/keyboards/keyhive/absinthe/readme.md
index f99d3649f2..518e13e8f0 100644
--- a/keyboards/absinthe/readme.md
+++ b/keyboards/keyhive/absinthe/readme.md
@@ -10,6 +10,6 @@ A budget-friendly F-rowless TKL with a rotary encoder
Make example for this keyboard (after setting up your build environment):
- make absinthe:default
+ make keyhive/absinthe:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/absinthe/rules.mk b/keyboards/keyhive/absinthe/rules.mk
index 5b1bf3cdf3..5b1bf3cdf3 100644
--- a/keyboards/absinthe/rules.mk
+++ b/keyboards/keyhive/absinthe/rules.mk
diff --git a/keyboards/ergosaurus/config.h b/keyboards/keyhive/ergosaurus/config.h
index 41f9a09311..41f9a09311 100644
--- a/keyboards/ergosaurus/config.h
+++ b/keyboards/keyhive/ergosaurus/config.h
diff --git a/keyboards/ergosaurus/ergosaurus.c b/keyboards/keyhive/ergosaurus/ergosaurus.c
index 4c31455128..4c31455128 100644
--- a/keyboards/ergosaurus/ergosaurus.c
+++ b/keyboards/keyhive/ergosaurus/ergosaurus.c
diff --git a/keyboards/ergosaurus/ergosaurus.h b/keyboards/keyhive/ergosaurus/ergosaurus.h
index cef594993d..cef594993d 100644
--- a/keyboards/ergosaurus/ergosaurus.h
+++ b/keyboards/keyhive/ergosaurus/ergosaurus.h
diff --git a/keyboards/ergosaurus/info.json b/keyboards/keyhive/ergosaurus/info.json
index 8048896be2..8048896be2 100644
--- a/keyboards/ergosaurus/info.json
+++ b/keyboards/keyhive/ergosaurus/info.json
diff --git a/keyboards/ergosaurus/keymaps/default/keymap.c b/keyboards/keyhive/ergosaurus/keymaps/default/keymap.c
index 42cf9082e4..42cf9082e4 100644
--- a/keyboards/ergosaurus/keymaps/default/keymap.c
+++ b/keyboards/keyhive/ergosaurus/keymaps/default/keymap.c
diff --git a/keyboards/ergosaurus/keymaps/default/readme.md b/keyboards/keyhive/ergosaurus/keymaps/default/readme.md
index acd1216c79..acd1216c79 100644
--- a/keyboards/ergosaurus/keymaps/default/readme.md
+++ b/keyboards/keyhive/ergosaurus/keymaps/default/readme.md
diff --git a/keyboards/ergosaurus/keymaps/via/keymap.c b/keyboards/keyhive/ergosaurus/keymaps/via/keymap.c
index 5ae73bfd47..5ae73bfd47 100644
--- a/keyboards/ergosaurus/keymaps/via/keymap.c
+++ b/keyboards/keyhive/ergosaurus/keymaps/via/keymap.c
diff --git a/keyboards/ergosaurus/keymaps/via/rules.mk b/keyboards/keyhive/ergosaurus/keymaps/via/rules.mk
index 36b7ba9cbc..36b7ba9cbc 100644
--- a/keyboards/ergosaurus/keymaps/via/rules.mk
+++ b/keyboards/keyhive/ergosaurus/keymaps/via/rules.mk
diff --git a/keyboards/ergosaurus/readme.md b/keyboards/keyhive/ergosaurus/readme.md
index cb1a02318b..ed01f650f3 100644
--- a/keyboards/ergosaurus/readme.md
+++ b/keyboards/keyhive/ergosaurus/readme.md
@@ -10,6 +10,6 @@ An Arduino Pro Micro driven Alice-clone PCB. Supports all Alice-style cases, giv
Make example for this keyboard (after setting up your build environment):
- make ergosaurus:default
+ make keyhive/ergosaurus:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/ergosaurus/rules.mk b/keyboards/keyhive/ergosaurus/rules.mk
index a00db322a6..a00db322a6 100644
--- a/keyboards/ergosaurus/rules.mk
+++ b/keyboards/keyhive/ergosaurus/rules.mk
diff --git a/keyboards/honeycomb/config.h b/keyboards/keyhive/honeycomb/config.h
index 6780c2d41b..6780c2d41b 100755
--- a/keyboards/honeycomb/config.h
+++ b/keyboards/keyhive/honeycomb/config.h
diff --git a/keyboards/honeycomb/honeycomb.c b/keyboards/keyhive/honeycomb/honeycomb.c
index 603400c7a3..603400c7a3 100755
--- a/keyboards/honeycomb/honeycomb.c
+++ b/keyboards/keyhive/honeycomb/honeycomb.c
diff --git a/keyboards/honeycomb/honeycomb.h b/keyboards/keyhive/honeycomb/honeycomb.h
index ec54b59f20..ec54b59f20 100755
--- a/keyboards/honeycomb/honeycomb.h
+++ b/keyboards/keyhive/honeycomb/honeycomb.h
diff --git a/keyboards/honeycomb/info.json b/keyboards/keyhive/honeycomb/info.json
index b11ece332b..b11ece332b 100644
--- a/keyboards/honeycomb/info.json
+++ b/keyboards/keyhive/honeycomb/info.json
diff --git a/keyboards/honeycomb/keymaps/default/keymap.c b/keyboards/keyhive/honeycomb/keymaps/default/keymap.c
index d0a5961873..d0a5961873 100755
--- a/keyboards/honeycomb/keymaps/default/keymap.c
+++ b/keyboards/keyhive/honeycomb/keymaps/default/keymap.c
diff --git a/keyboards/honeycomb/matrix.c b/keyboards/keyhive/honeycomb/matrix.c
index 9a87ca9a2e..9a87ca9a2e 100755
--- a/keyboards/honeycomb/matrix.c
+++ b/keyboards/keyhive/honeycomb/matrix.c
diff --git a/keyboards/honeycomb/readme.md b/keyboards/keyhive/honeycomb/readme.md
index 955f0ac7a2..611aa63880 100755
--- a/keyboards/honeycomb/readme.md
+++ b/keyboards/keyhive/honeycomb/readme.md
@@ -8,13 +8,13 @@ These configuration files use a completely different 'matrix scan' system than o
Run the following command in your terminal:
```
-make honeycomb:default
+make keyhive/honeycomb:default
# or use this to automatically flash the controller
-make honeycomb:default:avrdude
+make keyhive/honeycomb:default:avrdude
```
Follow the QMK guide for this or ask in Discord.
### Other Keymaps
-Because this is a totally custom macropad, it is recommended that you copy the `default/` folder, rename it as desired, and modify the `keymap.c` to your liking. \ No newline at end of file
+Because this is a totally custom macropad, it is recommended that you copy the `default/` folder, rename it as desired, and modify the `keymap.c` to your liking.
diff --git a/keyboards/honeycomb/rules.mk b/keyboards/keyhive/honeycomb/rules.mk
index 420e409e43..420e409e43 100755
--- a/keyboards/honeycomb/rules.mk
+++ b/keyboards/keyhive/honeycomb/rules.mk
diff --git a/keyboards/lattice60/config.h b/keyboards/keyhive/lattice60/config.h
index c1e067287b..c1e067287b 100644
--- a/keyboards/lattice60/config.h
+++ b/keyboards/keyhive/lattice60/config.h
diff --git a/keyboards/lattice60/info.json b/keyboards/keyhive/lattice60/info.json
index 824884ecbd..824884ecbd 100644
--- a/keyboards/lattice60/info.json
+++ b/keyboards/keyhive/lattice60/info.json
diff --git a/keyboards/lattice60/keymaps/default/config.h b/keyboards/keyhive/lattice60/keymaps/default/config.h
index 88d9334765..88d9334765 100644
--- a/keyboards/lattice60/keymaps/default/config.h
+++ b/keyboards/keyhive/lattice60/keymaps/default/config.h
diff --git a/keyboards/lattice60/keymaps/default/keymap.c b/keyboards/keyhive/lattice60/keymaps/default/keymap.c
index a5102070ea..a5102070ea 100644
--- a/keyboards/lattice60/keymaps/default/keymap.c
+++ b/keyboards/keyhive/lattice60/keymaps/default/keymap.c
diff --git a/keyboards/lattice60/keymaps/default/readme.md b/keyboards/keyhive/lattice60/keymaps/default/readme.md
index bde2ba9b41..bde2ba9b41 100644
--- a/keyboards/lattice60/keymaps/default/readme.md
+++ b/keyboards/keyhive/lattice60/keymaps/default/readme.md
diff --git a/keyboards/lattice60/keymaps/default_hhkb/config.h b/keyboards/keyhive/lattice60/keymaps/default_hhkb/config.h
index 88d9334765..88d9334765 100644
--- a/keyboards/lattice60/keymaps/default_hhkb/config.h
+++ b/keyboards/keyhive/lattice60/keymaps/default_hhkb/config.h
diff --git a/keyboards/lattice60/keymaps/default_hhkb/keymap.c b/keyboards/keyhive/lattice60/keymaps/default_hhkb/keymap.c
index ccdc10ab32..ccdc10ab32 100644
--- a/keyboards/lattice60/keymaps/default_hhkb/keymap.c
+++ b/keyboards/keyhive/lattice60/keymaps/default_hhkb/keymap.c
diff --git a/keyboards/lattice60/keymaps/default_hhkb/readme.md b/keyboards/keyhive/lattice60/keymaps/default_hhkb/readme.md
index 734ba74b9e..734ba74b9e 100644
--- a/keyboards/lattice60/keymaps/default_hhkb/readme.md
+++ b/keyboards/keyhive/lattice60/keymaps/default_hhkb/readme.md
diff --git a/keyboards/lattice60/keymaps/emdarcher/config.h b/keyboards/keyhive/lattice60/keymaps/emdarcher/config.h
index 88d9334765..88d9334765 100644
--- a/keyboards/lattice60/keymaps/emdarcher/config.h
+++ b/keyboards/keyhive/lattice60/keymaps/emdarcher/config.h
diff --git a/keyboards/lattice60/keymaps/emdarcher/keymap.c b/keyboards/keyhive/lattice60/keymaps/emdarcher/keymap.c
index 099e8e9203..099e8e9203 100644
--- a/keyboards/lattice60/keymaps/emdarcher/keymap.c
+++ b/keyboards/keyhive/lattice60/keymaps/emdarcher/keymap.c
diff --git a/keyboards/lattice60/keymaps/emdarcher/readme.md b/keyboards/keyhive/lattice60/keymaps/emdarcher/readme.md
index 812351af48..812351af48 100644
--- a/keyboards/lattice60/keymaps/emdarcher/readme.md
+++ b/keyboards/keyhive/lattice60/keymaps/emdarcher/readme.md
diff --git a/keyboards/lattice60/lattice60.c b/keyboards/keyhive/lattice60/lattice60.c
index 6cc0ea42fb..6cc0ea42fb 100644
--- a/keyboards/lattice60/lattice60.c
+++ b/keyboards/keyhive/lattice60/lattice60.c
diff --git a/keyboards/lattice60/lattice60.h b/keyboards/keyhive/lattice60/lattice60.h
index d9f5f37dea..d9f5f37dea 100644
--- a/keyboards/lattice60/lattice60.h
+++ b/keyboards/keyhive/lattice60/lattice60.h
diff --git a/keyboards/lattice60/readme.md b/keyboards/keyhive/lattice60/readme.md
index f5a3dc5942..92fe6198e0 100644
--- a/keyboards/lattice60/readme.md
+++ b/keyboards/keyhive/lattice60/readme.md
@@ -10,12 +10,12 @@ A HHKB layout keyboard using only through-hole components.
Make example for this keyboard (after setting up your build environment):
- make lattice60:default
+ make keyhive/lattice60:default
To activate the USBasploader bootloader, hold the BOOT button down during power on or reset. LED2 should light up to indicate that the bootloader is active.
Flash the firmware using the `make` command with the `flash` parameter, example below:
- make lattice60:default:flash
+ make keyhive/lattice60:default:flash
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/lattice60/rules.mk b/keyboards/keyhive/lattice60/rules.mk
index 8539f9f439..8539f9f439 100644
--- a/keyboards/lattice60/rules.mk
+++ b/keyboards/keyhive/lattice60/rules.mk
diff --git a/keyboards/navi10/.noci b/keyboards/keyhive/navi10/.noci
index e69de29bb2..e69de29bb2 100644
--- a/keyboards/navi10/.noci
+++ b/keyboards/keyhive/navi10/.noci
diff --git a/keyboards/navi10/info.json b/keyboards/keyhive/navi10/info.json
index e3fc49fbed..e3fc49fbed 100644
--- a/keyboards/navi10/info.json
+++ b/keyboards/keyhive/navi10/info.json
diff --git a/keyboards/navi10/keymaps/default/keymap.c b/keyboards/keyhive/navi10/keymaps/default/keymap.c
index d1b3127760..d1b3127760 100644
--- a/keyboards/navi10/keymaps/default/keymap.c
+++ b/keyboards/keyhive/navi10/keymaps/default/keymap.c
diff --git a/keyboards/navi10/keymaps/default/readme.md b/keyboards/keyhive/navi10/keymaps/default/readme.md
index 9e54a3f20a..9e54a3f20a 100644
--- a/keyboards/navi10/keymaps/default/readme.md
+++ b/keyboards/keyhive/navi10/keymaps/default/readme.md
diff --git a/keyboards/mt980/keymaps/walker/rules.mk b/keyboards/keyhive/navi10/keymaps/default/rules.mk
index e5ddcae8d9..e5ddcae8d9 100644
--- a/keyboards/mt980/keymaps/walker/rules.mk
+++ b/keyboards/keyhive/navi10/keymaps/default/rules.mk
diff --git a/keyboards/navi10/keymaps/devdev/config.h b/keyboards/keyhive/navi10/keymaps/devdev/config.h
index dba45a5f24..dba45a5f24 100644
--- a/keyboards/navi10/keymaps/devdev/config.h
+++ b/keyboards/keyhive/navi10/keymaps/devdev/config.h
diff --git a/keyboards/navi10/keymaps/devdev/keymap.c b/keyboards/keyhive/navi10/keymaps/devdev/keymap.c
index b0d43ebc69..b0d43ebc69 100644
--- a/keyboards/navi10/keymaps/devdev/keymap.c
+++ b/keyboards/keyhive/navi10/keymaps/devdev/keymap.c
diff --git a/keyboards/navi10/keymaps/devdev/rules.mk b/keyboards/keyhive/navi10/keymaps/devdev/rules.mk
index 1c1ed316a0..1c1ed316a0 100644
--- a/keyboards/navi10/keymaps/devdev/rules.mk
+++ b/keyboards/keyhive/navi10/keymaps/devdev/rules.mk
diff --git a/keyboards/navi10/keymaps/emdarcher/keymap.c b/keyboards/keyhive/navi10/keymaps/emdarcher/keymap.c
index 40efed48d5..40efed48d5 100644
--- a/keyboards/navi10/keymaps/emdarcher/keymap.c
+++ b/keyboards/keyhive/navi10/keymaps/emdarcher/keymap.c
diff --git a/keyboards/navi10/keymaps/emdarcher/readme.md b/keyboards/keyhive/navi10/keymaps/emdarcher/readme.md
index b4ae6d75ff..b4ae6d75ff 100644
--- a/keyboards/navi10/keymaps/emdarcher/readme.md
+++ b/keyboards/keyhive/navi10/keymaps/emdarcher/readme.md
diff --git a/keyboards/navi10/keymaps/default/rules.mk b/keyboards/keyhive/navi10/keymaps/emdarcher/rules.mk
index e5ddcae8d9..e5ddcae8d9 100644
--- a/keyboards/navi10/keymaps/default/rules.mk
+++ b/keyboards/keyhive/navi10/keymaps/emdarcher/rules.mk
diff --git a/keyboards/navi10/readme.md b/keyboards/keyhive/navi10/readme.md
index 58a94711f2..06f54b73dd 100644
--- a/keyboards/navi10/readme.md
+++ b/keyboards/keyhive/navi10/readme.md
@@ -10,10 +10,10 @@ A simple and fun navigation cluster macropad with exposed components.
Make example for this keyboard (after setting up your build environment):
- make navi10:default
+ make keyhive/navi10:default
Make example for a specific revision (ex. rev2):
- make navi10/rev2:default
+ make keyhive/navi10/rev2:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/navi10/rev0/.noci b/keyboards/keyhive/navi10/rev0/.noci
index e69de29bb2..e69de29bb2 100644
--- a/keyboards/navi10/rev0/.noci
+++ b/keyboards/keyhive/navi10/rev0/.noci
diff --git a/keyboards/navi10/rev0/config.h b/keyboards/keyhive/navi10/rev0/config.h
index 22a985c280..22a985c280 100644
--- a/keyboards/navi10/rev0/config.h
+++ b/keyboards/keyhive/navi10/rev0/config.h
diff --git a/keyboards/navi10/rev0/rev0.c b/keyboards/keyhive/navi10/rev0/rev0.c
index f6c1f362ca..f6c1f362ca 100644
--- a/keyboards/navi10/rev0/rev0.c
+++ b/keyboards/keyhive/navi10/rev0/rev0.c
diff --git a/keyboards/navi10/rev0/rev0.h b/keyboards/keyhive/navi10/rev0/rev0.h
index b162d14425..b162d14425 100644
--- a/keyboards/navi10/rev0/rev0.h
+++ b/keyboards/keyhive/navi10/rev0/rev0.h
diff --git a/keyboards/navi10/rev0/rules.mk b/keyboards/keyhive/navi10/rev0/rules.mk
index 52a1cbb711..52a1cbb711 100644
--- a/keyboards/navi10/rev0/rules.mk
+++ b/keyboards/keyhive/navi10/rev0/rules.mk
diff --git a/keyboards/navi10/rev2/.noci b/keyboards/keyhive/navi10/rev2/.noci
index e69de29bb2..e69de29bb2 100644
--- a/keyboards/navi10/rev2/.noci
+++ b/keyboards/keyhive/navi10/rev2/.noci
diff --git a/keyboards/navi10/rev2/config.h b/keyboards/keyhive/navi10/rev2/config.h
index 1dfb210b03..1dfb210b03 100644
--- a/keyboards/navi10/rev2/config.h
+++ b/keyboards/keyhive/navi10/rev2/config.h
diff --git a/keyboards/navi10/rev2/rev2.c b/keyboards/keyhive/navi10/rev2/rev2.c
index fed0e03897..fed0e03897 100644
--- a/keyboards/navi10/rev2/rev2.c
+++ b/keyboards/keyhive/navi10/rev2/rev2.c
diff --git a/keyboards/navi10/rev2/rev2.h b/keyboards/keyhive/navi10/rev2/rev2.h
index b162d14425..b162d14425 100644
--- a/keyboards/navi10/rev2/rev2.h
+++ b/keyboards/keyhive/navi10/rev2/rev2.h
diff --git a/keyboards/navi10/rev2/rules.mk b/keyboards/keyhive/navi10/rev2/rules.mk
index 52a1cbb711..52a1cbb711 100644
--- a/keyboards/navi10/rev2/rules.mk
+++ b/keyboards/keyhive/navi10/rev2/rules.mk
diff --git a/keyboards/navi10/rev3/config.h b/keyboards/keyhive/navi10/rev3/config.h
index 205535273a..205535273a 100644
--- a/keyboards/navi10/rev3/config.h
+++ b/keyboards/keyhive/navi10/rev3/config.h
diff --git a/keyboards/navi10/rev3/rev3.c b/keyboards/keyhive/navi10/rev3/rev3.c
index 2b0355aa36..2b0355aa36 100644
--- a/keyboards/navi10/rev3/rev3.c
+++ b/keyboards/keyhive/navi10/rev3/rev3.c
diff --git a/keyboards/navi10/rev3/rev3.h b/keyboards/keyhive/navi10/rev3/rev3.h
index b162d14425..b162d14425 100644
--- a/keyboards/navi10/rev3/rev3.h
+++ b/keyboards/keyhive/navi10/rev3/rev3.h
diff --git a/keyboards/navi10/rev3/rules.mk b/keyboards/keyhive/navi10/rev3/rules.mk
index 52a1cbb711..52a1cbb711 100644
--- a/keyboards/navi10/rev3/rules.mk
+++ b/keyboards/keyhive/navi10/rev3/rules.mk
diff --git a/keyboards/keyhive/navi10/rules.mk b/keyboards/keyhive/navi10/rules.mk
new file mode 100644
index 0000000000..6ebb2d0ceb
--- /dev/null
+++ b/keyboards/keyhive/navi10/rules.mk
@@ -0,0 +1 @@
+DEFAULT_FOLDER = keyhive/navi10/rev3
diff --git a/keyboards/opus/config.h b/keyboards/keyhive/opus/config.h
index 52ed10bc5a..52ed10bc5a 100644
--- a/keyboards/opus/config.h
+++ b/keyboards/keyhive/opus/config.h
diff --git a/keyboards/opus/info.json b/keyboards/keyhive/opus/info.json
index 1b2da11367..1b2da11367 100644
--- a/keyboards/opus/info.json
+++ b/keyboards/keyhive/opus/info.json
diff --git a/keyboards/opus/keymaps/default/keymap.c b/keyboards/keyhive/opus/keymaps/default/keymap.c
index aaa1a899a2..aaa1a899a2 100644
--- a/keyboards/opus/keymaps/default/keymap.c
+++ b/keyboards/keyhive/opus/keymaps/default/keymap.c
diff --git a/keyboards/opus/keymaps/default/readme.md b/keyboards/keyhive/opus/keymaps/default/readme.md
index ba3f26edac..ba3f26edac 100644
--- a/keyboards/opus/keymaps/default/readme.md
+++ b/keyboards/keyhive/opus/keymaps/default/readme.md
diff --git a/keyboards/opus/keymaps/thefoxcodes/config.h b/keyboards/keyhive/opus/keymaps/thefoxcodes/config.h
index 824ec5bd18..824ec5bd18 100644
--- a/keyboards/opus/keymaps/thefoxcodes/config.h
+++ b/keyboards/keyhive/opus/keymaps/thefoxcodes/config.h
diff --git a/keyboards/opus/keymaps/thefoxcodes/keymap.c b/keyboards/keyhive/opus/keymaps/thefoxcodes/keymap.c
index e0adb2af32..e0adb2af32 100644
--- a/keyboards/opus/keymaps/thefoxcodes/keymap.c
+++ b/keyboards/keyhive/opus/keymaps/thefoxcodes/keymap.c
diff --git a/keyboards/opus/keymaps/thefoxcodes/readme.md b/keyboards/keyhive/opus/keymaps/thefoxcodes/readme.md
index c1d2a0b9ec..c1d2a0b9ec 100644
--- a/keyboards/opus/keymaps/thefoxcodes/readme.md
+++ b/keyboards/keyhive/opus/keymaps/thefoxcodes/readme.md
diff --git a/keyboards/opus/keymaps/thefoxcodes/rules.mk b/keyboards/keyhive/opus/keymaps/thefoxcodes/rules.mk
index 1ba2fa8fbe..1ba2fa8fbe 100644
--- a/keyboards/opus/keymaps/thefoxcodes/rules.mk
+++ b/keyboards/keyhive/opus/keymaps/thefoxcodes/rules.mk
diff --git a/keyboards/opus/opus.c b/keyboards/keyhive/opus/opus.c
index 5a188cf8a0..5a188cf8a0 100644
--- a/keyboards/opus/opus.c
+++ b/keyboards/keyhive/opus/opus.c
diff --git a/keyboards/opus/opus.h b/keyboards/keyhive/opus/opus.h
index ec82c5bc9a..ec82c5bc9a 100644
--- a/keyboards/opus/opus.h
+++ b/keyboards/keyhive/opus/opus.h
diff --git a/keyboards/opus/readme.md b/keyboards/keyhive/opus/readme.md
index aebe3162d4..8a1adf4d18 100644
--- a/keyboards/opus/readme.md
+++ b/keyboards/keyhive/opus/readme.md
@@ -10,6 +10,6 @@ The columns are angled to follow the natural angle of the hand.
Make example for this keyboard (after setting up your build environment):
- make opus:default
+ make keyhive/opus:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/opus/rules.mk b/keyboards/keyhive/opus/rules.mk
index 515ca5621f..515ca5621f 100644
--- a/keyboards/opus/rules.mk
+++ b/keyboards/keyhive/opus/rules.mk
diff --git a/keyboards/smallice/config.h b/keyboards/keyhive/smallice/config.h
index 5ebafba42d..5ebafba42d 100644
--- a/keyboards/smallice/config.h
+++ b/keyboards/keyhive/smallice/config.h
diff --git a/keyboards/smallice/info.json b/keyboards/keyhive/smallice/info.json
index 24ce4cce22..24ce4cce22 100644
--- a/keyboards/smallice/info.json
+++ b/keyboards/keyhive/smallice/info.json
diff --git a/keyboards/smallice/keymaps/default/keymap.c b/keyboards/keyhive/smallice/keymaps/default/keymap.c
index d4a5fad42b..d4a5fad42b 100644
--- a/keyboards/smallice/keymaps/default/keymap.c
+++ b/keyboards/keyhive/smallice/keymaps/default/keymap.c
diff --git a/keyboards/smallice/keymaps/default/readme.md b/keyboards/keyhive/smallice/keymaps/default/readme.md
index e0c573662c..e0c573662c 100644
--- a/keyboards/smallice/keymaps/default/readme.md
+++ b/keyboards/keyhive/smallice/keymaps/default/readme.md
diff --git a/keyboards/smallice/keymaps/via/keymap.c b/keyboards/keyhive/smallice/keymaps/via/keymap.c
index d9f5d58d65..d9f5d58d65 100644
--- a/keyboards/smallice/keymaps/via/keymap.c
+++ b/keyboards/keyhive/smallice/keymaps/via/keymap.c
diff --git a/keyboards/smallice/keymaps/via/readme.md b/keyboards/keyhive/smallice/keymaps/via/readme.md
index af98163f94..af98163f94 100644
--- a/keyboards/smallice/keymaps/via/readme.md
+++ b/keyboards/keyhive/smallice/keymaps/via/readme.md
diff --git a/keyboards/smallice/keymaps/via/rules.mk b/keyboards/keyhive/smallice/keymaps/via/rules.mk
index 43061db1dd..43061db1dd 100644
--- a/keyboards/smallice/keymaps/via/rules.mk
+++ b/keyboards/keyhive/smallice/keymaps/via/rules.mk
diff --git a/keyboards/smallice/readme.md b/keyboards/keyhive/smallice/readme.md
index 70ac44cf74..2276b38a9e 100644
--- a/keyboards/smallice/readme.md
+++ b/keyboards/keyhive/smallice/readme.md
@@ -10,7 +10,7 @@ A 40% alice-like keyboard with an arrow cluster.
Make example for this keyboard (after setting up your build environment):
- make smallice:default
+ make keyhive/smallice:default
### Flash
diff --git a/keyboards/smallice/rules.mk b/keyboards/keyhive/smallice/rules.mk
index 1f52c37154..1f52c37154 100644
--- a/keyboards/smallice/rules.mk
+++ b/keyboards/keyhive/smallice/rules.mk
diff --git a/keyboards/smallice/smallice.c b/keyboards/keyhive/smallice/smallice.c
index c7d65e27ab..c7d65e27ab 100644
--- a/keyboards/smallice/smallice.c
+++ b/keyboards/keyhive/smallice/smallice.c
diff --git a/keyboards/smallice/smallice.h b/keyboards/keyhive/smallice/smallice.h
index 12d4356795..12d4356795 100644
--- a/keyboards/smallice/smallice.h
+++ b/keyboards/keyhive/smallice/smallice.h
diff --git a/keyboards/southpole/config.h b/keyboards/keyhive/southpole/config.h
index 5603829c47..5603829c47 100644
--- a/keyboards/southpole/config.h
+++ b/keyboards/keyhive/southpole/config.h
diff --git a/keyboards/southpole/info.json b/keyboards/keyhive/southpole/info.json
index 9781fd35ab..9781fd35ab 100644
--- a/keyboards/southpole/info.json
+++ b/keyboards/keyhive/southpole/info.json
diff --git a/keyboards/southpole/keymaps/default/keymap.c b/keyboards/keyhive/southpole/keymaps/default/keymap.c
index 2777f00b5b..2777f00b5b 100644
--- a/keyboards/southpole/keymaps/default/keymap.c
+++ b/keyboards/keyhive/southpole/keymaps/default/keymap.c
diff --git a/keyboards/southpole/keymaps/foobeard/keymap.c b/keyboards/keyhive/southpole/keymaps/foobeard/keymap.c
index ef2710d0a3..ef2710d0a3 100644
--- a/keyboards/southpole/keymaps/foobeard/keymap.c
+++ b/keyboards/keyhive/southpole/keymaps/foobeard/keymap.c
diff --git a/keyboards/southpole/readme.md b/keyboards/keyhive/southpole/readme.md
index 4ea99ad349..3f0cbc3a92 100644
--- a/keyboards/southpole/readme.md
+++ b/keyboards/keyhive/southpole/readme.md
@@ -8,6 +8,6 @@ Hardware Supported: Teensy 2.0
Make example for this keyboard (after setting up your build environment):
- make southpole:default
+ make keyhive/southpole:default
-See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). \ No newline at end of file
+See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/southpole/rules.mk b/keyboards/keyhive/southpole/rules.mk
index 278ee36f23..278ee36f23 100644
--- a/keyboards/southpole/rules.mk
+++ b/keyboards/keyhive/southpole/rules.mk
diff --git a/keyboards/southpole/southpole.c b/keyboards/keyhive/southpole/southpole.c
index f345893fb5..f345893fb5 100644
--- a/keyboards/southpole/southpole.c
+++ b/keyboards/keyhive/southpole/southpole.c
diff --git a/keyboards/southpole/southpole.h b/keyboards/keyhive/southpole/southpole.h
index 99cf2ce7b5..99cf2ce7b5 100644
--- a/keyboards/southpole/southpole.h
+++ b/keyboards/keyhive/southpole/southpole.h
diff --git a/keyboards/uno/config.h b/keyboards/keyhive/uno/config.h
index 0128ee2d5d..0128ee2d5d 100644
--- a/keyboards/uno/config.h
+++ b/keyboards/keyhive/uno/config.h
diff --git a/keyboards/uno/info.json b/keyboards/keyhive/uno/info.json
index d426f9e426..d426f9e426 100644
--- a/keyboards/uno/info.json
+++ b/keyboards/keyhive/uno/info.json
diff --git a/keyboards/uno/keymaps/copypasta/keymap.c b/keyboards/keyhive/uno/keymaps/copypasta/keymap.c
index 74e5f62fc5..74e5f62fc5 100644
--- a/keyboards/uno/keymaps/copypasta/keymap.c
+++ b/keyboards/keyhive/uno/keymaps/copypasta/keymap.c
diff --git a/keyboards/uno/keymaps/copypasta/readme.md b/keyboards/keyhive/uno/keymaps/copypasta/readme.md
index 1ad009c16c..1ad009c16c 100644
--- a/keyboards/uno/keymaps/copypasta/readme.md
+++ b/keyboards/keyhive/uno/keymaps/copypasta/readme.md
diff --git a/keyboards/uno/keymaps/default/keymap.c b/keyboards/keyhive/uno/keymaps/default/keymap.c
index 43c885c800..43c885c800 100644
--- a/keyboards/uno/keymaps/default/keymap.c
+++ b/keyboards/keyhive/uno/keymaps/default/keymap.c
diff --git a/keyboards/uno/keymaps/default/readme.md b/keyboards/keyhive/uno/keymaps/default/readme.md
index d783a80acc..d783a80acc 100644
--- a/keyboards/uno/keymaps/default/readme.md
+++ b/keyboards/keyhive/uno/keymaps/default/readme.md
diff --git a/keyboards/uno/keymaps/demo/keymap.c b/keyboards/keyhive/uno/keymaps/demo/keymap.c
index cd3c3dadef..cd3c3dadef 100644
--- a/keyboards/uno/keymaps/demo/keymap.c
+++ b/keyboards/keyhive/uno/keymaps/demo/keymap.c
diff --git a/keyboards/uno/keymaps/demo/readme.md b/keyboards/keyhive/uno/keymaps/demo/readme.md
index ec91247861..ec91247861 100644
--- a/keyboards/uno/keymaps/demo/readme.md
+++ b/keyboards/keyhive/uno/keymaps/demo/readme.md
diff --git a/keyboards/uno/readme.md b/keyboards/keyhive/uno/readme.md
index b60ef23e97..23776115f3 100644
--- a/keyboards/uno/readme.md
+++ b/keyboards/keyhive/uno/readme.md
@@ -14,19 +14,19 @@ If it *does not* support a rotary encoder, use rev1. The following examples use
Make example for this keyboard (after setting up your build environment; make
sure to change `rev2` to your Uno's version):
- make uno/rev2:default
+ make keyhive/uno/rev2:default
Flashing example for this keyboard (change `rev2` to `rev1` if needed):
- make uno/rev2:default:flash
+ make keyhive/uno/rev2:default:flash
If you prefer to use the `qmk` tool:
- qmk compile -kb uno/rev2 -km default
+ qmk compile -kb keyhive/uno/rev2 -km default
Create your own keymap with:
- qmk new-keymap -kb uno/rev2
+ qmk new-keymap -kb keyhive/uno/rev2
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/uno/rev1/config.h b/keyboards/keyhive/uno/rev1/config.h
index 11c84ad2ab..11c84ad2ab 100644
--- a/keyboards/uno/rev1/config.h
+++ b/keyboards/keyhive/uno/rev1/config.h
diff --git a/keyboards/uno/rev1/rev1.h b/keyboards/keyhive/uno/rev1/rev1.h
index 691bdd1dc3..691bdd1dc3 100644
--- a/keyboards/uno/rev1/rev1.h
+++ b/keyboards/keyhive/uno/rev1/rev1.h
diff --git a/keyboards/uno/rev1/rules.mk b/keyboards/keyhive/uno/rev1/rules.mk
index 7180be7497..7180be7497 100644
--- a/keyboards/uno/rev1/rules.mk
+++ b/keyboards/keyhive/uno/rev1/rules.mk
diff --git a/keyboards/uno/rev2/config.h b/keyboards/keyhive/uno/rev2/config.h
index 37ea08c017..37ea08c017 100644
--- a/keyboards/uno/rev2/config.h
+++ b/keyboards/keyhive/uno/rev2/config.h
diff --git a/keyboards/uno/rev2/rev2.h b/keyboards/keyhive/uno/rev2/rev2.h
index 691bdd1dc3..691bdd1dc3 100644
--- a/keyboards/uno/rev2/rev2.h
+++ b/keyboards/keyhive/uno/rev2/rev2.h
diff --git a/keyboards/uno/rev2/rules.mk b/keyboards/keyhive/uno/rev2/rules.mk
index 1ce2738442..1ce2738442 100644
--- a/keyboards/uno/rev2/rules.mk
+++ b/keyboards/keyhive/uno/rev2/rules.mk
diff --git a/keyboards/keyhive/uno/rules.mk b/keyboards/keyhive/uno/rules.mk
new file mode 100644
index 0000000000..3220994593
--- /dev/null
+++ b/keyboards/keyhive/uno/rules.mk
@@ -0,0 +1 @@
+DEFAULT_FOLDER = keyhive/uno/rev1
diff --git a/keyboards/uno/uno.c b/keyboards/keyhive/uno/uno.c
index 5ffb28865b..5ffb28865b 100644
--- a/keyboards/uno/uno.c
+++ b/keyboards/keyhive/uno/uno.c
diff --git a/keyboards/uno/uno.h b/keyboards/keyhive/uno/uno.h
index bb3248e293..e25dc25f73 100644
--- a/keyboards/uno/uno.h
+++ b/keyboards/keyhive/uno/uno.h
@@ -18,8 +18,8 @@
#include "quantum.h"
-#if defined(KEYBOARD_uno_rev1)
+#if defined(KEYBOARD_keyhive_uno_rev1)
# include "rev1.h"
-#elif defined(KEYBOARD_uno_rev2)
+#elif defined(KEYBOARD_keyhive_uno_rev2)
# include "rev2.h"
#endif
diff --git a/keyboards/ut472/config.h b/keyboards/keyhive/ut472/config.h
index dc8f7f7555..dc8f7f7555 100644
--- a/keyboards/ut472/config.h
+++ b/keyboards/keyhive/ut472/config.h
diff --git a/keyboards/ut472/info.json b/keyboards/keyhive/ut472/info.json
index fe60c5b7f7..fe60c5b7f7 100644
--- a/keyboards/ut472/info.json
+++ b/keyboards/keyhive/ut472/info.json
diff --git a/keyboards/ut472/keymaps/annihilator6000/UT472_Annihilator6000_Configurator_file.json b/keyboards/keyhive/ut472/keymaps/annihilator6000/UT472_Annihilator6000_Configurator_file.json
index 45569d5588..45569d5588 100755
--- a/keyboards/ut472/keymaps/annihilator6000/UT472_Annihilator6000_Configurator_file.json
+++ b/keyboards/keyhive/ut472/keymaps/annihilator6000/UT472_Annihilator6000_Configurator_file.json
diff --git a/keyboards/ut472/keymaps/annihilator6000/config.h b/keyboards/keyhive/ut472/keymaps/annihilator6000/config.h
index 023c753c27..023c753c27 100644
--- a/keyboards/ut472/keymaps/annihilator6000/config.h
+++ b/keyboards/keyhive/ut472/keymaps/annihilator6000/config.h
diff --git a/keyboards/ut472/keymaps/annihilator6000/keymap.c b/keyboards/keyhive/ut472/keymaps/annihilator6000/keymap.c
index c4453279d2..c4453279d2 100644
--- a/keyboards/ut472/keymaps/annihilator6000/keymap.c
+++ b/keyboards/keyhive/ut472/keymaps/annihilator6000/keymap.c
diff --git a/keyboards/ut472/keymaps/annihilator6000/readme.md b/keyboards/keyhive/ut472/keymaps/annihilator6000/readme.md
index 59469b7b55..59469b7b55 100644
--- a/keyboards/ut472/keymaps/annihilator6000/readme.md
+++ b/keyboards/keyhive/ut472/keymaps/annihilator6000/readme.md
diff --git a/keyboards/ut472/keymaps/default/keymap.c b/keyboards/keyhive/ut472/keymaps/default/keymap.c
index e303f2220c..e303f2220c 100644
--- a/keyboards/ut472/keymaps/default/keymap.c
+++ b/keyboards/keyhive/ut472/keymaps/default/keymap.c
diff --git a/keyboards/ut472/keymaps/default/readme.md b/keyboards/keyhive/ut472/keymaps/default/readme.md
index e3dcee467e..e3dcee467e 100644
--- a/keyboards/ut472/keymaps/default/readme.md
+++ b/keyboards/keyhive/ut472/keymaps/default/readme.md
diff --git a/keyboards/ut472/keymaps/hvp/config.h b/keyboards/keyhive/ut472/keymaps/hvp/config.h
index ea23adfab5..ea23adfab5 100644
--- a/keyboards/ut472/keymaps/hvp/config.h
+++ b/keyboards/keyhive/ut472/keymaps/hvp/config.h
diff --git a/keyboards/ut472/keymaps/hvp/keymap.c b/keyboards/keyhive/ut472/keymaps/hvp/keymap.c
index 80d2d036bd..80d2d036bd 100644
--- a/keyboards/ut472/keymaps/hvp/keymap.c
+++ b/keyboards/keyhive/ut472/keymaps/hvp/keymap.c
diff --git a/keyboards/ut472/keymaps/hvp/readme.md b/keyboards/keyhive/ut472/keymaps/hvp/readme.md
index a249201ded..a249201ded 100644
--- a/keyboards/ut472/keymaps/hvp/readme.md
+++ b/keyboards/keyhive/ut472/keymaps/hvp/readme.md
diff --git a/keyboards/ut472/keymaps/hvp/rules.mk b/keyboards/keyhive/ut472/keymaps/hvp/rules.mk
index 1ba2fa8fbe..1ba2fa8fbe 100644
--- a/keyboards/ut472/keymaps/hvp/rules.mk
+++ b/keyboards/keyhive/ut472/keymaps/hvp/rules.mk
diff --git a/keyboards/ut472/keymaps/stefanopace/config.h b/keyboards/keyhive/ut472/keymaps/stefanopace/config.h
index d16927d3c9..d16927d3c9 100644
--- a/keyboards/ut472/keymaps/stefanopace/config.h
+++ b/keyboards/keyhive/ut472/keymaps/stefanopace/config.h
diff --git a/keyboards/ut472/keymaps/stefanopace/keymap.c b/keyboards/keyhive/ut472/keymaps/stefanopace/keymap.c
index 7cc3b70082..7cc3b70082 100644
--- a/keyboards/ut472/keymaps/stefanopace/keymap.c
+++ b/keyboards/keyhive/ut472/keymaps/stefanopace/keymap.c
diff --git a/keyboards/ut472/keymaps/stefanopace/readme.md b/keyboards/keyhive/ut472/keymaps/stefanopace/readme.md
index 63cef0934c..63cef0934c 100644
--- a/keyboards/ut472/keymaps/stefanopace/readme.md
+++ b/keyboards/keyhive/ut472/keymaps/stefanopace/readme.md
diff --git a/keyboards/ut472/keymaps/stefanopace/rules.mk b/keyboards/keyhive/ut472/keymaps/stefanopace/rules.mk
index d941780558..d941780558 100644
--- a/keyboards/ut472/keymaps/stefanopace/rules.mk
+++ b/keyboards/keyhive/ut472/keymaps/stefanopace/rules.mk
diff --git a/keyboards/ut472/keymaps/tucznak/config.h b/keyboards/keyhive/ut472/keymaps/tucznak/config.h
index b3d402337a..b3d402337a 100644
--- a/keyboards/ut472/keymaps/tucznak/config.h
+++ b/keyboards/keyhive/ut472/keymaps/tucznak/config.h
diff --git a/keyboards/ut472/keymaps/tucznak/keymap.c b/keyboards/keyhive/ut472/keymaps/tucznak/keymap.c
index 7fbbd0e76e..7fbbd0e76e 100644
--- a/keyboards/ut472/keymaps/tucznak/keymap.c
+++ b/keyboards/keyhive/ut472/keymaps/tucznak/keymap.c
diff --git a/keyboards/ut472/keymaps/tucznak/readme.md b/keyboards/keyhive/ut472/keymaps/tucznak/readme.md
index 95180bc392..95180bc392 100644
--- a/keyboards/ut472/keymaps/tucznak/readme.md
+++ b/keyboards/keyhive/ut472/keymaps/tucznak/readme.md
diff --git a/keyboards/ut472/keymaps/tucznak/rules.mk b/keyboards/keyhive/ut472/keymaps/tucznak/rules.mk
index d394c719f8..d394c719f8 100644
--- a/keyboards/ut472/keymaps/tucznak/rules.mk
+++ b/keyboards/keyhive/ut472/keymaps/tucznak/rules.mk
diff --git a/keyboards/ut472/keymaps/via/keymap.c b/keyboards/keyhive/ut472/keymaps/via/keymap.c
index fe3eff802e..fe3eff802e 100644
--- a/keyboards/ut472/keymaps/via/keymap.c
+++ b/keyboards/keyhive/ut472/keymaps/via/keymap.c
diff --git a/keyboards/melody96/keymaps/via/rules.mk b/keyboards/keyhive/ut472/keymaps/via/rules.mk
index 36b7ba9cbc..36b7ba9cbc 100644
--- a/keyboards/melody96/keymaps/via/rules.mk
+++ b/keyboards/keyhive/ut472/keymaps/via/rules.mk
diff --git a/keyboards/ut472/readme.md b/keyboards/keyhive/ut472/readme.md
index 25f40d783a..b2a13b38cc 100644
--- a/keyboards/ut472/readme.md
+++ b/keyboards/keyhive/ut472/readme.md
@@ -11,7 +11,7 @@ or purchased at keyhive.xyz
To create a hex file for the UT47.2, run:
- make ut472:default
+ make keyhive/ut472:default
## Layout
diff --git a/keyboards/ut472/rules.mk b/keyboards/keyhive/ut472/rules.mk
index 9c7d75a344..9c7d75a344 100644
--- a/keyboards/ut472/rules.mk
+++ b/keyboards/keyhive/ut472/rules.mk
diff --git a/keyboards/ut472/ut472.c b/keyboards/keyhive/ut472/ut472.c
index 637922171a..637922171a 100644
--- a/keyboards/ut472/ut472.c
+++ b/keyboards/keyhive/ut472/ut472.c
diff --git a/keyboards/ut472/ut472.h b/keyboards/keyhive/ut472/ut472.h
index 391392896a..391392896a 100644
--- a/keyboards/ut472/ut472.h
+++ b/keyboards/keyhive/ut472/ut472.h
diff --git a/keyboards/lime/keymaps/default/keymap.c b/keyboards/lime/keymaps/default/keymap.c
index 2d904d36db..eade4d4183 100644
--- a/keyboards/lime/keymaps/default/keymap.c
+++ b/keyboards/lime/keymaps/default/keymap.c
@@ -17,7 +17,6 @@
#include QMK_KEYBOARD_H
#ifdef JOYSTICK_ENABLE
-# include "joystick.h"
# include "analog.h"
#endif
diff --git a/keyboards/matrix/abelx/mcuconf.h b/keyboards/matrix/abelx/mcuconf.h
index a22ce51c4c..a2fd42b8c4 100644
--- a/keyboards/matrix/abelx/mcuconf.h
+++ b/keyboards/matrix/abelx/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -169,7 +169,6 @@
/*
* PWM driver system settings.
*/
-#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
diff --git a/keyboards/mechlovin/hex4b/rev2/chconf.h b/keyboards/mechlovin/hex4b/rev2/chconf.h
deleted file mode 100644
index fe716d6552..0000000000
--- a/keyboards/mechlovin/hex4b/rev2/chconf.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/keyboards/mechwild/obe/obe.c b/keyboards/mechwild/obe/obe.c
index 8612764ae5..195d4a7679 100644
--- a/keyboards/mechwild/obe/obe.c
+++ b/keyboards/mechwild/obe/obe.c
@@ -16,12 +16,6 @@
#include "obe.h"
-void board_init(void) {
- // B9 is configured as I2C1_SDA in the board file; that function must be
- // disabled before using B7 as I2C1_SDA.
- setPinInputHigh(B9);
-}
-
#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
diff --git a/keyboards/mechwild/waka60/waka60.c b/keyboards/mechwild/waka60/waka60.c
index 1b6eec1f44..180d0a6786 100644
--- a/keyboards/mechwild/waka60/waka60.c
+++ b/keyboards/mechwild/waka60/waka60.c
@@ -15,11 +15,7 @@
*/
#include "waka60.h"
-void board_init(void) {
- // B9 is configured as I2C1_SDA in the board file; that function must be
- // disabled before using B7 as I2C1_SDA.
- setPinInputHigh(B9);
-}
+
#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
diff --git a/keyboards/mlego/m65/rev1/chconf.h b/keyboards/mlego/m65/rev1/chconf.h
deleted file mode 100644
index 3ca88e0d2a..0000000000
--- a/keyboards/mlego/m65/rev1/chconf.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright 2021-2022 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/m65/rev1/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
diff --git a/keyboards/mlego/m65/rev2/chconf.h b/keyboards/mlego/m65/rev2/chconf.h
deleted file mode 100644
index 3ca88e0d2a..0000000000
--- a/keyboards/mlego/m65/rev2/chconf.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright 2021-2022 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/m65/rev1/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
diff --git a/keyboards/mode/m65ha_alpha/m65ha_alpha.c b/keyboards/mode/m65ha_alpha/m65ha_alpha.c
index 93e0c06b73..4160ffed95 100644
--- a/keyboards/mode/m65ha_alpha/m65ha_alpha.c
+++ b/keyboards/mode/m65ha_alpha/m65ha_alpha.c
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "m65ha_alpha.h"
void board_init(void) {
- setPinInput(B9);
setPinInput(B10);
}
diff --git a/keyboards/mode/m65hi_alpha/m65hi_alpha.c b/keyboards/mode/m65hi_alpha/m65hi_alpha.c
index db0ab7ca9a..42c88ba354 100644
--- a/keyboards/mode/m65hi_alpha/m65hi_alpha.c
+++ b/keyboards/mode/m65hi_alpha/m65hi_alpha.c
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "m65hi_alpha.h"
void board_init(void) {
- setPinInput(B9);
setPinInput(B10);
}
diff --git a/keyboards/mode/m65s/m65s.c b/keyboards/mode/m65s/m65s.c
index 298fc94140..467fc53a0e 100644
--- a/keyboards/mode/m65s/m65s.c
+++ b/keyboards/mode/m65s/m65s.c
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "m65s.h"
void board_init(void) {
- setPinInput(B9);
setPinInput(B10);
}
diff --git a/keyboards/mode/m75h/m75h.c b/keyboards/mode/m75h/m75h.c
index 3306a6538b..e480ea2834 100644
--- a/keyboards/mode/m75h/m75h.c
+++ b/keyboards/mode/m75h/m75h.c
@@ -18,6 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "m75h.h"
void board_init(void) {
- setPinInput(B9);
setPinInput(B10);
}
diff --git a/keyboards/mode/m75s/m75s.c b/keyboards/mode/m75s/m75s.c
index e0424a6a64..bd323a435b 100644
--- a/keyboards/mode/m75s/m75s.c
+++ b/keyboards/mode/m75s/m75s.c
@@ -18,6 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "m75s.h"
void board_init(void) {
- setPinInput(B9);
setPinInput(B10);
}
diff --git a/keyboards/moonlander/config.h b/keyboards/moonlander/config.h
index bd06c5006d..9930e64063 100644
--- a/keyboards/moonlander/config.h
+++ b/keyboards/moonlander/config.h
@@ -159,7 +159,6 @@
# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 16383
# define DYNAMIC_KEYMAP_LAYER_COUNT 8
#endif
-#define VIA_QMK_RGBLIGHT_ENABLE
#define AUDIO_PIN A5
#define AUDIO_PIN_ALT A4
diff --git a/keyboards/wheatfield/blocked65/blocked65.c b/keyboards/mt/blocked65/blocked65.c
index 81da8005b0..81da8005b0 100644
--- a/keyboards/wheatfield/blocked65/blocked65.c
+++ b/keyboards/mt/blocked65/blocked65.c
diff --git a/keyboards/wheatfield/blocked65/blocked65.h b/keyboards/mt/blocked65/blocked65.h
index 09fe673a66..09fe673a66 100644
--- a/keyboards/wheatfield/blocked65/blocked65.h
+++ b/keyboards/mt/blocked65/blocked65.h
diff --git a/keyboards/wheatfield/blocked65/config.h b/keyboards/mt/blocked65/config.h
index 86e574feed..86e574feed 100644
--- a/keyboards/wheatfield/blocked65/config.h
+++ b/keyboards/mt/blocked65/config.h
diff --git a/keyboards/wheatfield/blocked65/info.json b/keyboards/mt/blocked65/info.json
index aea7165abc..aea7165abc 100644
--- a/keyboards/wheatfield/blocked65/info.json
+++ b/keyboards/mt/blocked65/info.json
diff --git a/keyboards/wheatfield/blocked65/keymaps/default/keymap.c b/keyboards/mt/blocked65/keymaps/default/keymap.c
index c38a103101..c38a103101 100644
--- a/keyboards/wheatfield/blocked65/keymaps/default/keymap.c
+++ b/keyboards/mt/blocked65/keymaps/default/keymap.c
diff --git a/keyboards/wheatfield/blocked65/keymaps/via/keymap.c b/keyboards/mt/blocked65/keymaps/via/keymap.c
index 7c35725c0b..7c35725c0b 100644
--- a/keyboards/wheatfield/blocked65/keymaps/via/keymap.c
+++ b/keyboards/mt/blocked65/keymaps/via/keymap.c
diff --git a/keyboards/wheatfield/blocked65/keymaps/via/rules.mk b/keyboards/mt/blocked65/keymaps/via/rules.mk
index 1e5b99807c..1e5b99807c 100644
--- a/keyboards/wheatfield/blocked65/keymaps/via/rules.mk
+++ b/keyboards/mt/blocked65/keymaps/via/rules.mk
diff --git a/keyboards/wheatfield/blocked65/readme.md b/keyboards/mt/blocked65/readme.md
index 42cf5b24e2..71e3238390 100644
--- a/keyboards/wheatfield/blocked65/readme.md
+++ b/keyboards/mt/blocked65/readme.md
@@ -8,6 +8,6 @@ A 65% PCB sold via TaoBao, commonly sold as part of the Canoe clone referred to
Make example for this keyboard (after setting up your build environment):
- make wheatfield/blocked65:default
+ make mt/blocked65:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/wheatfield/blocked65/rules.mk b/keyboards/mt/blocked65/rules.mk
index 5dab5b3a15..5dab5b3a15 100644
--- a/keyboards/wheatfield/blocked65/rules.mk
+++ b/keyboards/mt/blocked65/rules.mk
diff --git a/keyboards/mt40/config.h b/keyboards/mt/mt40/config.h
index 6626b24f3a..6626b24f3a 100644
--- a/keyboards/mt40/config.h
+++ b/keyboards/mt/mt40/config.h
diff --git a/keyboards/mt40/info.json b/keyboards/mt/mt40/info.json
index 48a2b9233b..48a2b9233b 100644
--- a/keyboards/mt40/info.json
+++ b/keyboards/mt/mt40/info.json
diff --git a/keyboards/mt40/keymaps/default/config.h b/keyboards/mt/mt40/keymaps/default/config.h
index 6c3e30ef7b..6c3e30ef7b 100644
--- a/keyboards/mt40/keymaps/default/config.h
+++ b/keyboards/mt/mt40/keymaps/default/config.h
diff --git a/keyboards/mt40/keymaps/default/keymap.c b/keyboards/mt/mt40/keymaps/default/keymap.c
index 0feadbfb74..0feadbfb74 100644
--- a/keyboards/mt40/keymaps/default/keymap.c
+++ b/keyboards/mt/mt40/keymaps/default/keymap.c
diff --git a/keyboards/mt40/keymaps/default/readme.md b/keyboards/mt/mt40/keymaps/default/readme.md
index 033b75fa29..033b75fa29 100644
--- a/keyboards/mt40/keymaps/default/readme.md
+++ b/keyboards/mt/mt40/keymaps/default/readme.md
diff --git a/keyboards/mt40/mt40.c b/keyboards/mt/mt40/mt40.c
index dd079e7d81..dd079e7d81 100644
--- a/keyboards/mt40/mt40.c
+++ b/keyboards/mt/mt40/mt40.c
diff --git a/keyboards/mt40/mt40.h b/keyboards/mt/mt40/mt40.h
index dc0de22b28..dc0de22b28 100644
--- a/keyboards/mt40/mt40.h
+++ b/keyboards/mt/mt40/mt40.h
diff --git a/keyboards/mt40/readme.md b/keyboards/mt/mt40/readme.md
index 5fc82d89a7..632cefdb73 100644
--- a/keyboards/mt40/readme.md
+++ b/keyboards/mt/mt40/readme.md
@@ -10,10 +10,10 @@ A 40% Ortholinear Keyboard
Make example for this keyboard (after setting up your build environment):
- make mt40:default
+ make mt/mt40:default
Flashing example for this keyboard ([after setting up the bootloadHID flashing environment](https://docs.qmk.fm/#/flashing_bootloadhid))
- make mt40:default:flash
+ make mt/mt40:default:flash
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/mt40/rules.mk b/keyboards/mt/mt40/rules.mk
index 3024f40149..3024f40149 100644
--- a/keyboards/mt40/rules.mk
+++ b/keyboards/mt/mt40/rules.mk
diff --git a/keyboards/mt64rgb/config.h b/keyboards/mt/mt64rgb/config.h
index ea7659b471..ea7659b471 100644
--- a/keyboards/mt64rgb/config.h
+++ b/keyboards/mt/mt64rgb/config.h
diff --git a/keyboards/mt64rgb/info.json b/keyboards/mt/mt64rgb/info.json
index 840863bc24..840863bc24 100644
--- a/keyboards/mt64rgb/info.json
+++ b/keyboards/mt/mt64rgb/info.json
diff --git a/keyboards/mt64rgb/keymaps/default/keymap.c b/keyboards/mt/mt64rgb/keymaps/default/keymap.c
index 84f3b1d35e..84f3b1d35e 100644
--- a/keyboards/mt64rgb/keymaps/default/keymap.c
+++ b/keyboards/mt/mt64rgb/keymaps/default/keymap.c
diff --git a/keyboards/mt64rgb/keymaps/default/readme.md b/keyboards/mt/mt64rgb/keymaps/default/readme.md
index 5508f7df16..5508f7df16 100644
--- a/keyboards/mt64rgb/keymaps/default/readme.md
+++ b/keyboards/mt/mt64rgb/keymaps/default/readme.md
diff --git a/keyboards/mt64rgb/keymaps/via/keymap.c b/keyboards/mt/mt64rgb/keymaps/via/keymap.c
index 7a9a2c1441..7a9a2c1441 100644
--- a/keyboards/mt64rgb/keymaps/via/keymap.c
+++ b/keyboards/mt/mt64rgb/keymaps/via/keymap.c
diff --git a/keyboards/mt64rgb/keymaps/via/rules.mk b/keyboards/mt/mt64rgb/keymaps/via/rules.mk
index ca9fed0e6b..ca9fed0e6b 100644
--- a/keyboards/mt64rgb/keymaps/via/rules.mk
+++ b/keyboards/mt/mt64rgb/keymaps/via/rules.mk
diff --git a/keyboards/mt64rgb/mt64rgb.c b/keyboards/mt/mt64rgb/mt64rgb.c
index f0c444e8fa..f0c444e8fa 100644
--- a/keyboards/mt64rgb/mt64rgb.c
+++ b/keyboards/mt/mt64rgb/mt64rgb.c
diff --git a/keyboards/mt64rgb/mt64rgb.h b/keyboards/mt/mt64rgb/mt64rgb.h
index dac98dfeb1..dac98dfeb1 100644
--- a/keyboards/mt64rgb/mt64rgb.h
+++ b/keyboards/mt/mt64rgb/mt64rgb.h
diff --git a/keyboards/mt64rgb/readme.md b/keyboards/mt/mt64rgb/readme.md
index dcc9412368..23fcd5ebe7 100644
--- a/keyboards/mt64rgb/readme.md
+++ b/keyboards/mt/mt64rgb/readme.md
@@ -11,6 +11,6 @@ It supports an ANSI-based 64-key layout, with hotswap sockets and per-key RGB ba
Make example for this keyboard (after setting up your build environment):
- make mt64rgb:default
+ make mt/mt64rgb:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/mt64rgb/rules.mk b/keyboards/mt/mt64rgb/rules.mk
index 56724f822a..56724f822a 100644
--- a/keyboards/mt64rgb/rules.mk
+++ b/keyboards/mt/mt64rgb/rules.mk
diff --git a/keyboards/mt84/config.h b/keyboards/mt/mt84/config.h
index bde8919ba7..bde8919ba7 100644
--- a/keyboards/mt84/config.h
+++ b/keyboards/mt/mt84/config.h
diff --git a/keyboards/mt84/info.json b/keyboards/mt/mt84/info.json
index aaded30962..aaded30962 100644
--- a/keyboards/mt84/info.json
+++ b/keyboards/mt/mt84/info.json
diff --git a/keyboards/mt84/keymaps/default/config.h b/keyboards/mt/mt84/keymaps/default/config.h
index dd687cad58..dd687cad58 100644
--- a/keyboards/mt84/keymaps/default/config.h
+++ b/keyboards/mt/mt84/keymaps/default/config.h
diff --git a/keyboards/mt84/keymaps/default/keymap.c b/keyboards/mt/mt84/keymaps/default/keymap.c
index bb7d5b447f..bb7d5b447f 100644
--- a/keyboards/mt84/keymaps/default/keymap.c
+++ b/keyboards/mt/mt84/keymaps/default/keymap.c
diff --git a/keyboards/mt84/keymaps/via/keymap.c b/keyboards/mt/mt84/keymaps/via/keymap.c
index 3a92e9b94e..3a92e9b94e 100644
--- a/keyboards/mt84/keymaps/via/keymap.c
+++ b/keyboards/mt/mt84/keymaps/via/keymap.c
diff --git a/keyboards/mt84/keymaps/via/rules.mk b/keyboards/mt/mt84/keymaps/via/rules.mk
index ca9fed0e6b..ca9fed0e6b 100644
--- a/keyboards/mt84/keymaps/via/rules.mk
+++ b/keyboards/mt/mt84/keymaps/via/rules.mk
diff --git a/keyboards/mt84/mt84.c b/keyboards/mt/mt84/mt84.c
index e15a1ff951..e15a1ff951 100644
--- a/keyboards/mt84/mt84.c
+++ b/keyboards/mt/mt84/mt84.c
diff --git a/keyboards/mt84/mt84.h b/keyboards/mt/mt84/mt84.h
index d3de007c94..d3de007c94 100644
--- a/keyboards/mt84/mt84.h
+++ b/keyboards/mt/mt84/mt84.h
diff --git a/keyboards/mt84/readme.md b/keyboards/mt/mt84/readme.md
index 17e1de2f5c..f26521ad6a 100644
--- a/keyboards/mt84/readme.md
+++ b/keyboards/mt/mt84/readme.md
@@ -12,11 +12,11 @@ It supports standard 84-key layout, with hotswap sockets and per-key RGB backlig
Make example for this keyboard (after setting up your build environment):
- make mt84:default
+ make mt/mt84:default
Flashing example for this keyboard:
- make mt84:default:flash
+ make mt/mt84:default:flash
To put the board into bootloader mode, either press the reset button on the bottom the PCB or hold Space+B while plugging it in.
diff --git a/keyboards/mt84/rules.mk b/keyboards/mt/mt84/rules.mk
index 0543099445..0543099445 100644
--- a/keyboards/mt84/rules.mk
+++ b/keyboards/mt/mt84/rules.mk
diff --git a/keyboards/mt980/config.h b/keyboards/mt/mt980/config.h
index ff6c5807df..ff6c5807df 100644
--- a/keyboards/mt980/config.h
+++ b/keyboards/mt/mt980/config.h
diff --git a/keyboards/mt980/info.json b/keyboards/mt/mt980/info.json
index be89ec8fc0..be89ec8fc0 100644
--- a/keyboards/mt980/info.json
+++ b/keyboards/mt/mt980/info.json
diff --git a/keyboards/mt980/keymaps/default/keymap.c b/keyboards/mt/mt980/keymaps/default/keymap.c
index 504233a983..504233a983 100644
--- a/keyboards/mt980/keymaps/default/keymap.c
+++ b/keyboards/mt/mt980/keymaps/default/keymap.c
diff --git a/keyboards/mt980/keymaps/walker/config.h b/keyboards/mt/mt980/keymaps/walker/config.h
index 0bd3959938..0bd3959938 100644
--- a/keyboards/mt980/keymaps/walker/config.h
+++ b/keyboards/mt/mt980/keymaps/walker/config.h
diff --git a/keyboards/mt980/keymaps/walker/keymap.c b/keyboards/mt/mt980/keymaps/walker/keymap.c
index 83a3fb8167..83a3fb8167 100644
--- a/keyboards/mt980/keymaps/walker/keymap.c
+++ b/keyboards/mt/mt980/keymaps/walker/keymap.c
diff --git a/keyboards/navi10/keymaps/emdarcher/rules.mk b/keyboards/mt/mt980/keymaps/walker/rules.mk
index e5ddcae8d9..e5ddcae8d9 100644
--- a/keyboards/navi10/keymaps/emdarcher/rules.mk
+++ b/keyboards/mt/mt980/keymaps/walker/rules.mk
diff --git a/keyboards/mt980/mt980.c b/keyboards/mt/mt980/mt980.c
index 69f7cc491a..69f7cc491a 100644
--- a/keyboards/mt980/mt980.c
+++ b/keyboards/mt/mt980/mt980.c
diff --git a/keyboards/mt980/mt980.h b/keyboards/mt/mt980/mt980.h
index d9804b3392..d9804b3392 100644
--- a/keyboards/mt980/mt980.h
+++ b/keyboards/mt/mt980/mt980.h
diff --git a/keyboards/mt980/readme.md b/keyboards/mt/mt980/readme.md
index 7bc27c93a5..5e702de714 100644
--- a/keyboards/mt980/readme.md
+++ b/keyboards/mt/mt980/readme.md
@@ -8,7 +8,7 @@ Hardware Availability: Taobao store https://shop110310565.taobao.com
Make example for this keyboard (after setting up your build environment):
- make mt980:default
+ make mt/mt980:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/mt980/rules.mk b/keyboards/mt/mt980/rules.mk
index 2ca5686493..2ca5686493 100644
--- a/keyboards/mt980/rules.mk
+++ b/keyboards/mt/mt980/rules.mk
diff --git a/keyboards/wheatfield/split75/config.h b/keyboards/mt/split75/config.h
index 63c9492c31..63c9492c31 100644
--- a/keyboards/wheatfield/split75/config.h
+++ b/keyboards/mt/split75/config.h
diff --git a/keyboards/wheatfield/split75/info.json b/keyboards/mt/split75/info.json
index 1d0609a378..1d0609a378 100644
--- a/keyboards/wheatfield/split75/info.json
+++ b/keyboards/mt/split75/info.json
diff --git a/keyboards/wheatfield/split75/keymaps/art/keymap.c b/keyboards/mt/split75/keymaps/art/keymap.c
index c10059bb7d..c10059bb7d 100644
--- a/keyboards/wheatfield/split75/keymaps/art/keymap.c
+++ b/keyboards/mt/split75/keymaps/art/keymap.c
diff --git a/keyboards/wheatfield/split75/keymaps/art/rules.mk b/keyboards/mt/split75/keymaps/art/rules.mk
index 5f8cb68ad0..5f8cb68ad0 100644
--- a/keyboards/wheatfield/split75/keymaps/art/rules.mk
+++ b/keyboards/mt/split75/keymaps/art/rules.mk
diff --git a/keyboards/wheatfield/split75/keymaps/default/keymap.c b/keyboards/mt/split75/keymaps/default/keymap.c
index 320aaeb5da..320aaeb5da 100644
--- a/keyboards/wheatfield/split75/keymaps/default/keymap.c
+++ b/keyboards/mt/split75/keymaps/default/keymap.c
diff --git a/keyboards/wheatfield/split75/keymaps/iso/keymap.c b/keyboards/mt/split75/keymaps/iso/keymap.c
index aca261b1d1..aca261b1d1 100644
--- a/keyboards/wheatfield/split75/keymaps/iso/keymap.c
+++ b/keyboards/mt/split75/keymaps/iso/keymap.c
diff --git a/keyboards/wheatfield/split75/matrix.c b/keyboards/mt/split75/matrix.c
index 9e86bfc376..9e86bfc376 100644
--- a/keyboards/wheatfield/split75/matrix.c
+++ b/keyboards/mt/split75/matrix.c
diff --git a/keyboards/wheatfield/split75/readme.md b/keyboards/mt/split75/readme.md
index ec8c7ee9ea..360ad55239 100644
--- a/keyboards/wheatfield/split75/readme.md
+++ b/keyboards/mt/split75/readme.md
@@ -13,11 +13,11 @@ Original work performed by Michael L. Walker, all credit goes to him. I've tidie
Make example for this keyboard (after setting up your build environment):
- make wheatfield/split75:default
+ make mt/split75:default
Flashing example for this keyboard ([after setting up the bootloadHID flashing environment](https://docs.qmk.fm/#/flashing_bootloadhid))
- make wheatfield/split75:default:flash
+ make mt/split75:default:flash
or
diff --git a/keyboards/wheatfield/split75/rules.mk b/keyboards/mt/split75/rules.mk
index 4aed5ab586..4aed5ab586 100644
--- a/keyboards/wheatfield/split75/rules.mk
+++ b/keyboards/mt/split75/rules.mk
diff --git a/keyboards/wheatfield/split75/split75.c b/keyboards/mt/split75/split75.c
index b8a3fe6c28..b8a3fe6c28 100644
--- a/keyboards/wheatfield/split75/split75.c
+++ b/keyboards/mt/split75/split75.c
diff --git a/keyboards/wheatfield/split75/split75.h b/keyboards/mt/split75/split75.h
index 93da3e7b83..93da3e7b83 100644
--- a/keyboards/wheatfield/split75/split75.h
+++ b/keyboards/mt/split75/split75.h
diff --git a/keyboards/navi10/rules.mk b/keyboards/navi10/rules.mk
deleted file mode 100644
index cc08312b77..0000000000
--- a/keyboards/navi10/rules.mk
+++ /dev/null
@@ -1 +0,0 @@
-DEFAULT_FOLDER = navi10/rev3
diff --git a/keyboards/ramonimbao/squishytkl/chconf.h b/keyboards/ramonimbao/squishytkl/chconf.h
deleted file mode 100644
index ce018f56a7..0000000000
--- a/keyboards/ramonimbao/squishytkl/chconf.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
diff --git a/keyboards/rart/rartlice/chconf.h b/keyboards/rart/rartlice/chconf.h
deleted file mode 100644
index 0a89eb248c..0000000000
--- a/keyboards/rart/rartlice/chconf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/rart/rartlice/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/keyboards/reviung/reviung34/info.json b/keyboards/reviung/reviung34/info.json
index ecd89d4742..6e727a4ff3 100755
--- a/keyboards/reviung/reviung34/info.json
+++ b/keyboards/reviung/reviung34/info.json
@@ -40,6 +40,43 @@
{"label":"K34", "x":4, "y":3},
{"label":"K38", "x":6, "y":3, "w":2}
]
+ },
+ "LAYOUT_reviung34_2u": {
+ "layout": [
+ {"label":"K00", "x":0, "y":0},
+ {"label":"K01", "x":1, "y":0},
+ {"label":"K02", "x":2, "y":0},
+ {"label":"K03", "x":3, "y":0},
+ {"label":"K04", "x":4, "y":0},
+ {"label":"K05", "x":6, "y":0},
+ {"label":"K06", "x":7, "y":0},
+ {"label":"K07", "x":8, "y":0},
+ {"label":"K08", "x":9, "y":0},
+ {"label":"K35", "x":10, "y":0},
+ {"label":"K10", "x":0, "y":1},
+ {"label":"K11", "x":1, "y":1},
+ {"label":"K12", "x":2, "y":1},
+ {"label":"K13", "x":3, "y":1},
+ {"label":"K14", "x":4, "y":1},
+ {"label":"K15", "x":6, "y":1},
+ {"label":"K16", "x":7, "y":1},
+ {"label":"K17", "x":8, "y":1},
+ {"label":"K18", "x":9, "y":1},
+ {"label":"K36", "x":10, "y":1},
+ {"label":"K20", "x":0, "y":2},
+ {"label":"K21", "x":1, "y":2},
+ {"label":"K22", "x":2, "y":2},
+ {"label":"K23", "x":3, "y":2},
+ {"label":"K24", "x":4, "y":2},
+ {"label":"K25", "x":6, "y":2},
+ {"label":"K26", "x":7, "y":2},
+ {"label":"K27", "x":8, "y":2},
+ {"label":"K28", "x":9, "y":2},
+ {"label":"K37", "x":10, "y":2},
+ {"label":"K32", "x":2, "y":3},
+ {"label":"K34", "x":3, "y":3, "w":2},
+ {"label":"K38", "x":6, "y":3, "w":2}
+ ]
}
}
}
diff --git a/keyboards/reviung/reviung34/keymaps/default_2uL/keymap.c b/keyboards/reviung/reviung34/keymaps/default_2u/keymap.c
index 767c0ff4c6..9f586b333c 100755
--- a/keyboards/reviung/reviung34/keymaps/default_2uL/keymap.c
+++ b/keyboards/reviung/reviung34/keymaps/default_2u/keymap.c
@@ -35,28 +35,28 @@ enum layer_names {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [_BASE] = LAYOUT_reviung34_2uL(
+ [_BASE] = LAYOUT_reviung34_2u(
CT_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT,
SF_Z, AL_X, KC_C, KC_V, KC_B, KC_N, KC_M, CT_CM, AL_DT, SF_SS,
KC_TAB, LOWER, RA_SP
),
- [_LOWER] = LAYOUT_reviung34_2uL(
+ [_LOWER] = LAYOUT_reviung34_2u(
KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN,
KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_SCLN,
KC_LSFT, KC_ESC, KC_LGUI, KC_LALT, KC_QUOT, KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_BSPC,
_______, _______, _______
),
- [_RAISE] = LAYOUT_reviung34_2uL(
+ [_RAISE] = LAYOUT_reviung34_2u(
KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,
KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, XXXXXXX, XXXXXXX, KC_GRV, KC_TILD, KC_COLN,
KC_LSFT, KC_ESC, KC_RGUI, KC_LALT, KC_DQUO, KC_TAB, XXXXXXX, KC_RCTL, KC_RALT, KC_DEL,
_______, _______, _______
),
- [_ADJUST] = LAYOUT_reviung34_2uL(
+ [_ADJUST] = LAYOUT_reviung34_2u(
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PSCR,
KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_F11, KC_F12, KC_CAPS, XXXXXXX, XXXXXXX, RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
diff --git a/keyboards/reviung/reviung34/keymaps/default_2uL/readme.md b/keyboards/reviung/reviung34/keymaps/default_2u/readme.md
index 2e4619fae8..2e4619fae8 100755
--- a/keyboards/reviung/reviung34/keymaps/default_2uL/readme.md
+++ b/keyboards/reviung/reviung34/keymaps/default_2u/readme.md
diff --git a/keyboards/reviung/reviung34/keymaps/default_rgb2u/keymap.c b/keyboards/reviung/reviung34/keymaps/default_rgb2u/keymap.c
index f4f1d3be50..d5a5a2223b 100755
--- a/keyboards/reviung/reviung34/keymaps/default_rgb2u/keymap.c
+++ b/keyboards/reviung/reviung34/keymaps/default_rgb2u/keymap.c
@@ -34,28 +34,28 @@ enum layer_names {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [_BASE] = LAYOUT_reviung34_2uL(
+ [_BASE] = LAYOUT_reviung34_2u(
CT_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT,
SF_Z, AL_X, KC_C, KC_V, KC_B, KC_N, KC_M, CT_CM, AL_DT, SF_SS,
LOWER, KC_SPC, RAISE
),
- [_LOWER] = LAYOUT_reviung34_2uL(
+ [_LOWER] = LAYOUT_reviung34_2u(
KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN,
KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_SCLN,
KC_LSFT, KC_ESC, KC_LGUI, KC_LALT, KC_QUOT, KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_BSPC,
_______, _______, _______
),
- [_RAISE] = LAYOUT_reviung34_2uL(
+ [_RAISE] = LAYOUT_reviung34_2u(
KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,
KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, XXXXXXX, XXXXXXX, KC_GRV, KC_TILD, KC_COLN,
KC_LSFT, KC_ESC, KC_RGUI, KC_LALT, KC_DQUO, KC_TAB, XXXXXXX, KC_RCTL, KC_RALT, KC_DEL,
_______, _______, _______
),
- [_ADJUST] = LAYOUT_reviung34_2uL(
+ [_ADJUST] = LAYOUT_reviung34_2u(
RGB_VAI, RGB_SAI, RGB_HUI, RGB_MOD, RGB_TOG, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5,
RGB_VAD, RGB_SAD, RGB_HUD, RGB_RMOD,XXXXXXX, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET, KC_F11, KC_F12, KC_CAPS, XXXXXXX, KC_PSCR,
diff --git a/keyboards/reviung/reviung34/reviung34.h b/keyboards/reviung/reviung34/reviung34.h
index 8385e5c8c2..1ab783ec36 100755
--- a/keyboards/reviung/reviung34/reviung34.h
+++ b/keyboards/reviung/reviung34/reviung34.h
@@ -38,7 +38,7 @@
{ KC_NO, KC_NO, K32, K33, K34, K35, K36, K37, K38 } \
}
-#define LAYOUT_reviung34_2uL( \
+#define LAYOUT_reviung34_2u( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K35, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K36, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K37, \
diff --git a/keyboards/sofle/keyhive/config.h b/keyboards/sofle/keyhive/config.h
index c934754e65..93048f3cd1 100755
--- a/keyboards/sofle/keyhive/config.h
+++ b/keyboards/sofle/keyhive/config.h
@@ -42,11 +42,12 @@
#define DEBOUNCE 5
// Encoder support
-#define ENCODERS_PAD_A { F5 }
-#define ENCODERS_PAD_B { F4 }
-#define ENCODERS_PAD_A_RIGHT { F4 }
-#define ENCODERS_PAD_B_RIGHT { F5 }
-#define ENCODER_RESOLUTIONS { 4, 2 } // Left encoder seems to have double-output issue but right does not.
+#define ENCODERS_PAD_A { F5 }
+#define ENCODERS_PAD_B { F4 }
+#define ENCODERS_PAD_A_RIGHT { F4 }
+#define ENCODERS_PAD_B_RIGHT { F5 }
+#define ENCODER_RESOLUTIONS { 4 }
+#define ENCODER_RESOLUTIONS_RIGHT { 2 } // Left encoder seems to have double-output issue but right does not.
#define TAP_CODE_DELAY 10
diff --git a/keyboards/sowbug/68keys/config.h b/keyboards/sowbug/68keys/config.h
index 0aad9a4574..0721302dbe 100644
--- a/keyboards/sowbug/68keys/config.h
+++ b/keyboards/sowbug/68keys/config.h
@@ -26,7 +26,6 @@
#define DEVICE_VER 0x0001
#define MANUFACTURER github.com/sowbug
#define PRODUCT 68-key keyboard
-#define DESCRIPTION A 68-key keyboard based on 68keys.io
// key matrix size
#define MATRIX_ROWS 5
diff --git a/keyboards/sowbug/ansi_tkl/config.h b/keyboards/sowbug/ansi_tkl/config.h
index 505453b72b..44e82bbac7 100644
--- a/keyboards/sowbug/ansi_tkl/config.h
+++ b/keyboards/sowbug/ansi_tkl/config.h
@@ -26,7 +26,6 @@
#define DEVICE_VER 0x0001
#define MANUFACTURER github.com/sowbug
#define PRODUCT ANSI TKL
-#define DESCRIPTION A tenkeyless ANSI-layout keyboard
// key matrix size
#define MATRIX_ROWS 6
diff --git a/keyboards/tkc/portico68v2/config.h b/keyboards/tkc/portico68v2/config.h
index 486863d702..dea6180958 100644
--- a/keyboards/tkc/portico68v2/config.h
+++ b/keyboards/tkc/portico68v2/config.h
@@ -79,8 +79,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# define ENABLE_RGB_MATRIX_HUE_PENDULUM
# define ENABLE_RGB_MATRIX_HUE_WAVE
# define ENABLE_RGB_MATRIX_PIXEL_RAIN
-# define ENABLE_RGB_MATRIX_PIXEL_FLOW
-# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL
+//# define ENABLE_RGB_MATRIX_PIXEL_FLOW
+//# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL
// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined
# define ENABLE_RGB_MATRIX_TYPING_HEATMAP
# define ENABLE_RGB_MATRIX_DIGITAL_RAIN
diff --git a/keyboards/tronguylabs/m122_3270/bluepill/chconf.h b/keyboards/tronguylabs/m122_3270/bluepill/chconf.h
deleted file mode 100644
index c7a982aedd..0000000000
--- a/keyboards/tronguylabs/m122_3270/bluepill/chconf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/handwired/onekey/bluepill/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/keyboards/unicomp/spacesaver_m_pre_2013/overnumpad_1xb/config.h b/keyboards/unicomp/spacesaver_m_pre_2013/overnumpad_1xb/config.h
index 7bd5b224df..597d287b07 100644
--- a/keyboards/unicomp/spacesaver_m_pre_2013/overnumpad_1xb/config.h
+++ b/keyboards/unicomp/spacesaver_m_pre_2013/overnumpad_1xb/config.h
@@ -23,7 +23,6 @@
#define DEVICE_VER 0x0001
#define MANUFACTURER Unicomp/Purdea Andrei
#define PRODUCT Unicomp Spacesaver M
-#define DESCRIPTION QMK firmware for the Unicomp Spacesaver M keyboard with a replacement Overnumpad controller
#define SERIAL_NUMBER "purdea.ro:overnumpad_controller"
/* key matrix size */
diff --git a/keyboards/uno/rules.mk b/keyboards/uno/rules.mk
deleted file mode 100644
index 367faedeaf..0000000000
--- a/keyboards/uno/rules.mk
+++ /dev/null
@@ -1 +0,0 @@
-DEFAULT_FOLDER = uno/rev1
diff --git a/keyboards/at101_bh/at101_bh.c b/keyboards/viktus/at101_bh/at101_bh.c
index 3b519373b0..3b519373b0 100644
--- a/keyboards/at101_bh/at101_bh.c
+++ b/keyboards/viktus/at101_bh/at101_bh.c
diff --git a/keyboards/at101_bh/at101_bh.h b/keyboards/viktus/at101_bh/at101_bh.h
index 54655cf60e..54655cf60e 100644
--- a/keyboards/at101_bh/at101_bh.h
+++ b/keyboards/viktus/at101_bh/at101_bh.h
diff --git a/keyboards/at101_bh/config.h b/keyboards/viktus/at101_bh/config.h
index 8c81fab916..8c81fab916 100644
--- a/keyboards/at101_bh/config.h
+++ b/keyboards/viktus/at101_bh/config.h
diff --git a/keyboards/at101_bh/info.json b/keyboards/viktus/at101_bh/info.json
index 9fdac129f5..9fdac129f5 100644
--- a/keyboards/at101_bh/info.json
+++ b/keyboards/viktus/at101_bh/info.json
diff --git a/keyboards/at101_bh/keymaps/default/keymap.c b/keyboards/viktus/at101_bh/keymaps/default/keymap.c
index 1962dd7479..1962dd7479 100644
--- a/keyboards/at101_bh/keymaps/default/keymap.c
+++ b/keyboards/viktus/at101_bh/keymaps/default/keymap.c
diff --git a/keyboards/at101_bh/readme.md b/keyboards/viktus/at101_bh/readme.md
index 8a9ce2496f..d9d7b4dafa 100644
--- a/keyboards/at101_bh/readme.md
+++ b/keyboards/viktus/at101_bh/readme.md
@@ -10,6 +10,6 @@ Hardware Availability: https://deskthority.net/group-buys-f50/programmable-vinta
Make example for this keyboard (after setting up your build environment):
- make at101_bh:default
+ make viktus/at101_bh:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/at101_bh/rules.mk b/keyboards/viktus/at101_bh/rules.mk
index 16dc2697bb..16dc2697bb 100644
--- a/keyboards/at101_bh/rules.mk
+++ b/keyboards/viktus/at101_bh/rules.mk
diff --git a/keyboards/omnikey_bh/config.h b/keyboards/viktus/omnikey_bh/config.h
index 7d170077a9..7d170077a9 100644
--- a/keyboards/omnikey_bh/config.h
+++ b/keyboards/viktus/omnikey_bh/config.h
diff --git a/keyboards/omnikey_bh/info.json b/keyboards/viktus/omnikey_bh/info.json
index 93b6aeefd8..93b6aeefd8 100644
--- a/keyboards/omnikey_bh/info.json
+++ b/keyboards/viktus/omnikey_bh/info.json
diff --git a/keyboards/omnikey_bh/keymaps/default/keymap.c b/keyboards/viktus/omnikey_bh/keymaps/default/keymap.c
index 671c04a36b..671c04a36b 100644
--- a/keyboards/omnikey_bh/keymaps/default/keymap.c
+++ b/keyboards/viktus/omnikey_bh/keymaps/default/keymap.c
diff --git a/keyboards/omnikey_bh/omnikey_bh.c b/keyboards/viktus/omnikey_bh/omnikey_bh.c
index c2f52f30c3..c2f52f30c3 100644
--- a/keyboards/omnikey_bh/omnikey_bh.c
+++ b/keyboards/viktus/omnikey_bh/omnikey_bh.c
diff --git a/keyboards/omnikey_bh/omnikey_bh.h b/keyboards/viktus/omnikey_bh/omnikey_bh.h
index f36184f390..f36184f390 100644
--- a/keyboards/omnikey_bh/omnikey_bh.h
+++ b/keyboards/viktus/omnikey_bh/omnikey_bh.h
diff --git a/keyboards/omnikey_bh/readme.md b/keyboards/viktus/omnikey_bh/readme.md
index 7de22f29a4..55cf72bf87 100644
--- a/keyboards/omnikey_bh/readme.md
+++ b/keyboards/viktus/omnikey_bh/readme.md
@@ -9,6 +9,6 @@ Hardware Availability: https://deskthority.net/group-buys-f50/omnikey-replacemen
Make example for this keyboard (after setting up your build environment):
- make omnikey_bh:default
+ make viktus/omnikey_bh:default
See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
diff --git a/keyboards/omnikey_bh/rules.mk b/keyboards/viktus/omnikey_bh/rules.mk
index 65e353ad15..65e353ad15 100644
--- a/keyboards/omnikey_bh/rules.mk
+++ b/keyboards/viktus/omnikey_bh/rules.mk
diff --git a/keyboards/viktus/sp_mini/config.h b/keyboards/viktus/sp_mini/config.h
index a0671c97f3..bce8a4cc4c 100644
--- a/keyboards/viktus/sp_mini/config.h
+++ b/keyboards/viktus/sp_mini/config.h
@@ -35,7 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// wiring of each half
#define MATRIX_ROW_PINS { F0, B5, B4, D7, D6 }
-#define MATRIX_COL_PINS { B6, C6, C7, D4, D2, D3, D5 } // no B7 on left hand
+#define MATRIX_COL_PINS { B6, C6, C7, D4, D2, D3, D5, NO_PIN } // no B7 on left hand
#define MATRIX_ROW_PINS_RIGHT { F0, B5, B4, D7, D6 }
#define MATRIX_COL_PINS_RIGHT { B6, C6, C7, D4, D2, D3, D5, B7 }
@@ -78,7 +78,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define ENCODERS_PAD_A_RIGHT {F4}
//#define ENCODERS_PAD_B_RIGHT {F1}
-#define ENCODER_RESOLUTIONS { 8, 8 }
+#define ENCODER_RESOLUTIONS { 8 }
/*
* Feature disable options
diff --git a/keyboards/z150_bh/config.h b/keyboards/viktus/z150_bh/config.h
index 0bfbe3228f..0bfbe3228f 100644
--- a/keyboards/z150_bh/config.h
+++ b/keyboards/viktus/z150_bh/config.h
diff --git a/keyboards/z150_bh/info.json b/keyboards/viktus/z150_bh/info.json
index 3339baee89..3339baee89 100644
--- a/keyboards/z150_bh/info.json
+++ b/keyboards/viktus/z150_bh/info.json
diff --git a/keyboards/z150_bh/keymaps/default/keymap.c b/keyboards/viktus/z150_bh/keymaps/default/keymap.c
index 9ca75dd285..9ca75dd285 100644
--- a/keyboards/z150_bh/keymaps/default/keymap.c
+++ b/keyboards/viktus/z150_bh/keymaps/default/keymap.c
diff --git a/keyboards/z150_bh/keymaps/default_tkl/keymap.c b/keyboards/viktus/z150_bh/keymaps/default_tkl/keymap.c
index fa1f7e47b9..fa1f7e47b9 100644
--- a/keyboards/z150_bh/keymaps/default_tkl/keymap.c
+++ b/keyboards/viktus/z150_bh/keymaps/default_tkl/keymap.c
diff --git a/keyboards/z150_bh/readme.md b/keyboards/viktus/z150_bh/readme.md
index a1d4845808..6975d8f1d0 100644
--- a/keyboards/z150_bh/readme.md
+++ b/keyboards/viktus/z150_bh/readme.md
@@ -9,6 +9,6 @@ Hardware Availability: [Deskthority Group Buy](https://deskthority.net/group-buy
Make example for this keyboard (after setting up your build environment):
- make z150_bh:default
+ make viktus/z150_bh:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/z150_bh/rules.mk b/keyboards/viktus/z150_bh/rules.mk
index 65e353ad15..65e353ad15 100644
--- a/keyboards/z150_bh/rules.mk
+++ b/keyboards/viktus/z150_bh/rules.mk
diff --git a/keyboards/z150_bh/z150_bh.c b/keyboards/viktus/z150_bh/z150_bh.c
index b75a1ff198..b75a1ff198 100644
--- a/keyboards/z150_bh/z150_bh.c
+++ b/keyboards/viktus/z150_bh/z150_bh.c
diff --git a/keyboards/z150_bh/z150_bh.h b/keyboards/viktus/z150_bh/z150_bh.h
index f97ac1c035..f97ac1c035 100644
--- a/keyboards/z150_bh/z150_bh.h
+++ b/keyboards/viktus/z150_bh/z150_bh.h
diff --git a/keyboards/xelus/ninjin/config.h b/keyboards/xelus/ninjin/config.h
index cbaca37b5e..4dd40210a6 100644
--- a/keyboards/xelus/ninjin/config.h
+++ b/keyboards/xelus/ninjin/config.h
@@ -22,7 +22,6 @@
#define DEVICE_VER 0x0001
#define MANUFACTURER Xelus
#define PRODUCT Ninjin
-#define DESCRIPTION Ninjin
/* key matrix size */
#define MATRIX_ROWS 6
diff --git a/keyboards/melody96/config.h b/keyboards/ymdk/melody96/config.h
index 45e7e680c1..45e7e680c1 100644
--- a/keyboards/melody96/config.h
+++ b/keyboards/ymdk/melody96/config.h
diff --git a/keyboards/melody96/info.json b/keyboards/ymdk/melody96/info.json
index 7db60fa7d4..7db60fa7d4 100644
--- a/keyboards/melody96/info.json
+++ b/keyboards/ymdk/melody96/info.json
diff --git a/keyboards/melody96/keymaps/crilith/keymap.c b/keyboards/ymdk/melody96/keymaps/crilith/keymap.c
index 40ae691435..40ae691435 100644
--- a/keyboards/melody96/keymaps/crilith/keymap.c
+++ b/keyboards/ymdk/melody96/keymaps/crilith/keymap.c
diff --git a/keyboards/melody96/keymaps/default/keymap.c b/keyboards/ymdk/melody96/keymaps/default/keymap.c
index 3ed6f3068b..3ed6f3068b 100644
--- a/keyboards/melody96/keymaps/default/keymap.c
+++ b/keyboards/ymdk/melody96/keymaps/default/keymap.c
diff --git a/keyboards/melody96/keymaps/default_96_with60_split_num0/keymap.c b/keyboards/ymdk/melody96/keymaps/default_96_with60_split_num0/keymap.c
index 5dc26b150d..5dc26b150d 100644
--- a/keyboards/melody96/keymaps/default_96_with60_split_num0/keymap.c
+++ b/keyboards/ymdk/melody96/keymaps/default_96_with60_split_num0/keymap.c
diff --git a/keyboards/melody96/keymaps/dvz/config.h b/keyboards/ymdk/melody96/keymaps/dvz/config.h
index be786464bc..be786464bc 100644
--- a/keyboards/melody96/keymaps/dvz/config.h
+++ b/keyboards/ymdk/melody96/keymaps/dvz/config.h
diff --git a/keyboards/melody96/keymaps/dvz/keymap.c b/keyboards/ymdk/melody96/keymaps/dvz/keymap.c
index cea3970e18..cea3970e18 100644
--- a/keyboards/melody96/keymaps/dvz/keymap.c
+++ b/keyboards/ymdk/melody96/keymaps/dvz/keymap.c
diff --git a/keyboards/melody96/keymaps/dvz/readme.md b/keyboards/ymdk/melody96/keymaps/dvz/readme.md
index d82055244e..d82055244e 100644
--- a/keyboards/melody96/keymaps/dvz/readme.md
+++ b/keyboards/ymdk/melody96/keymaps/dvz/readme.md
diff --git a/keyboards/melody96/keymaps/dvz/rules.mk b/keyboards/ymdk/melody96/keymaps/dvz/rules.mk
index a1e85f13f4..a1e85f13f4 100644
--- a/keyboards/melody96/keymaps/dvz/rules.mk
+++ b/keyboards/ymdk/melody96/keymaps/dvz/rules.mk
diff --git a/keyboards/melody96/keymaps/konstantin/config.h b/keyboards/ymdk/melody96/keymaps/konstantin/config.h
index 4b511eb848..4b511eb848 100644
--- a/keyboards/melody96/keymaps/konstantin/config.h
+++ b/keyboards/ymdk/melody96/keymaps/konstantin/config.h
diff --git a/keyboards/melody96/keymaps/konstantin/keymap.c b/keyboards/ymdk/melody96/keymaps/konstantin/keymap.c
index 1ee7ca1e77..1ee7ca1e77 100644
--- a/keyboards/melody96/keymaps/konstantin/keymap.c
+++ b/keyboards/ymdk/melody96/keymaps/konstantin/keymap.c
diff --git a/keyboards/melody96/keymaps/konstantin/rules.mk b/keyboards/ymdk/melody96/keymaps/konstantin/rules.mk
index b315c8e6b9..b315c8e6b9 100644
--- a/keyboards/melody96/keymaps/konstantin/rules.mk
+++ b/keyboards/ymdk/melody96/keymaps/konstantin/rules.mk
diff --git a/keyboards/melody96/keymaps/via/keymap.c b/keyboards/ymdk/melody96/keymaps/via/keymap.c
index c02fa785a8..c02fa785a8 100644
--- a/keyboards/melody96/keymaps/via/keymap.c
+++ b/keyboards/ymdk/melody96/keymaps/via/keymap.c
diff --git a/keyboards/ut472/keymaps/via/rules.mk b/keyboards/ymdk/melody96/keymaps/via/rules.mk
index 36b7ba9cbc..36b7ba9cbc 100644
--- a/keyboards/ut472/keymaps/via/rules.mk
+++ b/keyboards/ymdk/melody96/keymaps/via/rules.mk
diff --git a/keyboards/melody96/keymaps/zunger/config.h b/keyboards/ymdk/melody96/keymaps/zunger/config.h
index cc06440e0d..cc06440e0d 100644
--- a/keyboards/melody96/keymaps/zunger/config.h
+++ b/keyboards/ymdk/melody96/keymaps/zunger/config.h
diff --git a/keyboards/melody96/keymaps/zunger/keymap.c b/keyboards/ymdk/melody96/keymaps/zunger/keymap.c
index d0d2698b7a..d0d2698b7a 100644
--- a/keyboards/melody96/keymaps/zunger/keymap.c
+++ b/keyboards/ymdk/melody96/keymaps/zunger/keymap.c
diff --git a/keyboards/melody96/keymaps/zunger/readme.md b/keyboards/ymdk/melody96/keymaps/zunger/readme.md
index 3eb64a2e73..3eb64a2e73 100644
--- a/keyboards/melody96/keymaps/zunger/readme.md
+++ b/keyboards/ymdk/melody96/keymaps/zunger/readme.md
diff --git a/keyboards/melody96/keymaps/zunger/rules.mk b/keyboards/ymdk/melody96/keymaps/zunger/rules.mk
index a61cfa33fa..a61cfa33fa 100644
--- a/keyboards/melody96/keymaps/zunger/rules.mk
+++ b/keyboards/ymdk/melody96/keymaps/zunger/rules.mk
diff --git a/keyboards/melody96/melody96.c b/keyboards/ymdk/melody96/melody96.c
index 44e813586b..44e813586b 100644
--- a/keyboards/melody96/melody96.c
+++ b/keyboards/ymdk/melody96/melody96.c
diff --git a/keyboards/melody96/melody96.h b/keyboards/ymdk/melody96/melody96.h
index 3d3bc6070c..3d3bc6070c 100644
--- a/keyboards/melody96/melody96.h
+++ b/keyboards/ymdk/melody96/melody96.h
diff --git a/keyboards/melody96/readme.md b/keyboards/ymdk/melody96/readme.md
index 16338e9ed3..a6bf470b32 100644
--- a/keyboards/melody96/readme.md
+++ b/keyboards/ymdk/melody96/readme.md
@@ -10,7 +10,7 @@
Make example for this keyboard (after setting up your build environment):
- make melody96:default
+ make ymdk/melody96:default
Flashing example for this keyboard:
diff --git a/keyboards/melody96/rules.mk b/keyboards/ymdk/melody96/rules.mk
index b27013f863..b27013f863 100644
--- a/keyboards/melody96/rules.mk
+++ b/keyboards/ymdk/melody96/rules.mk
diff --git a/keyboards/zvecr/split_blackpill/chconf.h b/keyboards/zvecr/split_blackpill/chconf.h
deleted file mode 100644
index e98ee9d790..0000000000
--- a/keyboards/zvecr/split_blackpill/chconf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2020 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * This file was auto-generated by:
- * `qmk chibios-confmigrate -i keyboards/zvecr/split_blackpill/chconf.h -r platforms/chibios/common/configs/chconf.h`
- */
-
-#pragma once
-
-#define CH_CFG_ST_TIMEDELTA 0
-
-#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
-
-#include_next <chconf.h>
-
diff --git a/lib/chibios b/lib/chibios
-Subproject d7b9d1c87f724bd7c8cd1486d6d0dc3ba52e0d5
+Subproject 257302333c31f1f710800c2b97acf3550de043e
diff --git a/lib/chibios-contrib b/lib/chibios-contrib
-Subproject d1c2126d1cd867c50127da84425805e225df855
+Subproject 2a6b73ff51baf89083a220b6692a04ca2cae875
diff --git a/lib/python/qmk/cli/__init__.py b/lib/python/qmk/cli/__init__.py
index 5f65e677e5..85baa238a8 100644
--- a/lib/python/qmk/cli/__init__.py
+++ b/lib/python/qmk/cli/__init__.py
@@ -16,7 +16,8 @@ import_names = {
# A mapping of package name to importable name
'pep8-naming': 'pep8ext_naming',
'pyusb': 'usb.core',
- 'qmk-dotty-dict': 'dotty_dict'
+ 'qmk-dotty-dict': 'dotty_dict',
+ 'pillow': 'PIL'
}
safe_commands = [
@@ -67,6 +68,7 @@ subcommands = [
'qmk.cli.multibuild',
'qmk.cli.new.keyboard',
'qmk.cli.new.keymap',
+ 'qmk.cli.painter',
'qmk.cli.pyformat',
'qmk.cli.pytest',
'qmk.cli.via2json',
diff --git a/lib/python/qmk/cli/format/c.py b/lib/python/qmk/cli/format/c.py
index 8eb7fa1ed0..a58aef3fbc 100644
--- a/lib/python/qmk/cli/format/c.py
+++ b/lib/python/qmk/cli/format/c.py
@@ -9,7 +9,7 @@ from milc import cli
from qmk.path import normpath
from qmk.c_parse import c_source_files
-c_file_suffixes = ('c', 'h', 'cpp')
+c_file_suffixes = ('c', 'h', 'cpp', 'hpp')
core_dirs = ('drivers', 'quantum', 'tests', 'tmk_core', 'platforms')
ignored = ('tmk_core/protocol/usb_hid', 'platforms/chibios/boards')
diff --git a/lib/python/qmk/cli/generate/api.py b/lib/python/qmk/cli/generate/api.py
index 285bd90eb5..0596b3f22b 100755
--- a/lib/python/qmk/cli/generate/api.py
+++ b/lib/python/qmk/cli/generate/api.py
@@ -1,7 +1,7 @@
"""This script automates the generation of the QMK API data.
"""
from pathlib import Path
-from shutil import copyfile
+import shutil
import json
from milc import cli
@@ -12,28 +12,42 @@ from qmk.json_encoders import InfoJSONEncoder
from qmk.json_schema import json_load
from qmk.keyboard import find_readme, list_keyboards
+TEMPLATE_PATH = Path('data/templates/api/')
+BUILD_API_PATH = Path('.build/api_data/')
+
@cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Don't write the data to disk.")
+@cli.argument('-f', '--filter', arg_only=True, action='append', default=[], help="Filter the list of keyboards based on partial name matches the supplied value. May be passed multiple times.")
@cli.subcommand('Creates a new keymap for the keyboard of your choosing', hidden=False if cli.config.user.developer else True)
def generate_api(cli):
"""Generates the QMK API data.
"""
- api_data_dir = Path('api_data')
- v1_dir = api_data_dir / 'v1'
+ if BUILD_API_PATH.exists():
+ shutil.rmtree(BUILD_API_PATH)
+
+ shutil.copytree(TEMPLATE_PATH, BUILD_API_PATH)
+
+ v1_dir = BUILD_API_PATH / 'v1'
keyboard_all_file = v1_dir / 'keyboards.json' # A massive JSON containing everything
keyboard_list_file = v1_dir / 'keyboard_list.json' # A simple list of keyboard targets
keyboard_aliases_file = v1_dir / 'keyboard_aliases.json' # A list of historical keyboard names and their new name
keyboard_metadata_file = v1_dir / 'keyboard_metadata.json' # All the data configurator/via needs for initialization
usb_file = v1_dir / 'usb.json' # A mapping of USB VID/PID -> keyboard target
- if not api_data_dir.exists():
- api_data_dir.mkdir()
+ # Filter down when required
+ keyboard_list = list_keyboards()
+ if cli.args.filter:
+ kb_list = []
+ for keyboard_name in keyboard_list:
+ if any(i in keyboard_name for i in cli.args.filter):
+ kb_list.append(keyboard_name)
+ keyboard_list = kb_list
kb_all = {}
usb_list = {}
# Generate and write keyboard specific JSON files
- for keyboard_name in list_keyboards():
+ for keyboard_name in keyboard_list:
kb_all[keyboard_name] = info_json(keyboard_name)
keyboard_dir = v1_dir / 'keyboards' / keyboard_name
keyboard_info = keyboard_dir / 'info.json'
@@ -47,7 +61,7 @@ def generate_api(cli):
cli.log.debug('Wrote file %s', keyboard_info)
if keyboard_readme_src:
- copyfile(keyboard_readme_src, keyboard_readme)
+ shutil.copyfile(keyboard_readme_src, keyboard_readme)
cli.log.debug('Copied %s -> %s', keyboard_readme_src, keyboard_readme)
if 'usb' in kb_all[keyboard_name]:
diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py
index fdc76b23d4..893892c479 100755
--- a/lib/python/qmk/cli/generate/config_h.py
+++ b/lib/python/qmk/cli/generate/config_h.py
@@ -5,10 +5,9 @@ from pathlib import Path
from dotty_dict import dotty
from milc import cli
-from qmk.info import info_json
-from qmk.json_schema import json_load, validate
+from qmk.info import info_json, keymap_json_config
+from qmk.json_schema import json_load
from qmk.keyboard import keyboard_completer, keyboard_folder
-from qmk.keymap import locate_keymap
from qmk.commands import dump_lines
from qmk.path import normpath
from qmk.constants import GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE
@@ -84,7 +83,7 @@ def generate_config_items(kb_info_json, config_h_lines):
for config_key, info_dict in info_config_map.items():
info_key = info_dict['info_key']
- key_type = info_dict.get('value_type', 'str')
+ key_type = info_dict.get('value_type', 'raw')
to_config = info_dict.get('to_config', True)
if not to_config:
@@ -95,7 +94,12 @@ def generate_config_items(kb_info_json, config_h_lines):
except KeyError:
continue
- if key_type.startswith('array'):
+ if key_type.startswith('array.array'):
+ config_h_lines.append('')
+ config_h_lines.append(f'#ifndef {config_key}')
+ config_h_lines.append(f'# define {config_key} {{ {", ".join(["{" + ",".join(list(map(str, x))) + "}" for x in config_value])} }}')
+ config_h_lines.append(f'#endif // {config_key}')
+ elif key_type.startswith('array'):
config_h_lines.append('')
config_h_lines.append(f'#ifndef {config_key}')
config_h_lines.append(f'# define {config_key} {{ {", ".join(map(str, config_value))} }}')
@@ -112,6 +116,11 @@ def generate_config_items(kb_info_json, config_h_lines):
config_h_lines.append(f'#ifndef {key}')
config_h_lines.append(f'# define {key} {value}')
config_h_lines.append(f'#endif // {key}')
+ elif key_type == 'str':
+ config_h_lines.append('')
+ config_h_lines.append(f'#ifndef {config_key}')
+ config_h_lines.append(f'# define {config_key} "{config_value}"')
+ config_h_lines.append(f'#endif // {config_key}')
elif key_type == 'bcd_version':
(major, minor, revision) = config_value.split('.')
config_h_lines.append('')
@@ -175,10 +184,7 @@ def generate_config_h(cli):
"""
# Determine our keyboard/keymap
if cli.args.keymap:
- km = locate_keymap(cli.args.keyboard, cli.args.keymap)
- km_json = json_load(km)
- validate(km_json, 'qmk.keymap.v1')
- kb_info_json = dotty(km_json.get('config', {}))
+ kb_info_json = dotty(keymap_json_config(cli.args.keyboard, cli.args.keymap))
else:
kb_info_json = dotty(info_json(cli.args.keyboard))
diff --git a/lib/python/qmk/cli/generate/docs.py b/lib/python/qmk/cli/generate/docs.py
index 74112d834d..eb3099e138 100644
--- a/lib/python/qmk/cli/generate/docs.py
+++ b/lib/python/qmk/cli/generate/docs.py
@@ -10,6 +10,7 @@ DOCS_PATH = Path('docs/')
BUILD_PATH = Path('.build/')
BUILD_DOCS_PATH = BUILD_PATH / 'docs'
DOXYGEN_PATH = BUILD_PATH / 'doxygen'
+MOXYGEN_PATH = BUILD_DOCS_PATH / 'internals'
@cli.subcommand('Build QMK documentation.', hidden=False if cli.config.user.developer else True)
@@ -34,10 +35,10 @@ def generate_docs(cli):
'stdin': DEVNULL,
}
- cli.log.info('Generating internal docs...')
+ cli.log.info('Generating docs...')
# Generate internal docs
cli.run(['doxygen', 'Doxyfile'], **args)
- cli.run(['moxygen', '-q', '-g', '-o', BUILD_DOCS_PATH / 'internals_%s.md', DOXYGEN_PATH / 'xml'], **args)
+ cli.run(['moxygen', '-q', '-g', '-o', MOXYGEN_PATH / '%s.md', DOXYGEN_PATH / 'xml'], **args)
- cli.log.info('Successfully generated internal docs to %s.', BUILD_DOCS_PATH)
+ cli.log.info('Successfully generated docs to %s.', BUILD_DOCS_PATH)
diff --git a/lib/python/qmk/cli/generate/rules_mk.py b/lib/python/qmk/cli/generate/rules_mk.py
index 29a1130f99..9623d00fb5 100755
--- a/lib/python/qmk/cli/generate/rules_mk.py
+++ b/lib/python/qmk/cli/generate/rules_mk.py
@@ -5,10 +5,9 @@ from pathlib import Path
from dotty_dict import dotty
from milc import cli
-from qmk.info import info_json
-from qmk.json_schema import json_load, validate
+from qmk.info import info_json, keymap_json_config
+from qmk.json_schema import json_load
from qmk.keyboard import keyboard_completer, keyboard_folder
-from qmk.keymap import locate_keymap
from qmk.commands import dump_lines
from qmk.path import normpath
from qmk.constants import GPL2_HEADER_SH_LIKE, GENERATED_HEADER_SH_LIKE
@@ -21,7 +20,7 @@ def process_mapping_rule(kb_info_json, rules_key, info_dict):
return None
info_key = info_dict['info_key']
- key_type = info_dict.get('value_type', 'str')
+ key_type = info_dict.get('value_type', 'raw')
try:
rules_value = kb_info_json[info_key]
@@ -34,6 +33,8 @@ def process_mapping_rule(kb_info_json, rules_key, info_dict):
return f'{rules_key} ?= {"yes" if rules_value else "no"}'
elif key_type == 'mapping':
return '\n'.join([f'{key} ?= {value}' for key, value in rules_value.items()])
+ elif key_type == 'str':
+ return f'{rules_key} ?= "{rules_value}"'
return f'{rules_key} ?= {rules_value}'
@@ -49,10 +50,7 @@ def generate_rules_mk(cli):
"""
# Determine our keyboard/keymap
if cli.args.keymap:
- km = locate_keymap(cli.args.keyboard, cli.args.keymap)
- km_json = json_load(km)
- validate(km_json, 'qmk.keymap.v1')
- kb_info_json = dotty(km_json.get('config', {}))
+ kb_info_json = dotty(keymap_json_config(cli.args.keyboard, cli.args.keymap))
else:
kb_info_json = dotty(info_json(cli.args.keyboard))
diff --git a/lib/python/qmk/cli/info.py b/lib/python/qmk/cli/info.py
index 3131d4b53f..fa5729bcc9 100755
--- a/lib/python/qmk/cli/info.py
+++ b/lib/python/qmk/cli/info.py
@@ -11,8 +11,8 @@ from qmk.json_encoders import InfoJSONEncoder
from qmk.constants import COL_LETTERS, ROW_LETTERS
from qmk.decorators import automagic_keyboard, automagic_keymap
from qmk.keyboard import keyboard_completer, keyboard_folder, render_layouts, render_layout, rules_mk
+from qmk.info import info_json, keymap_json
from qmk.keymap import locate_keymap
-from qmk.info import info_json
from qmk.path import is_keyboard
UNICODE_SUPPORT = sys.stdout.encoding.lower().startswith('utf')
@@ -135,7 +135,7 @@ def print_parsed_rules_mk(keyboard_name):
@cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Keyboard to show info for.')
-@cli.argument('-km', '--keymap', help='Show the layers for a JSON keymap too.')
+@cli.argument('-km', '--keymap', help='Keymap to show info for (Optional).')
@cli.argument('-l', '--layouts', action='store_true', help='Render the layouts.')
@cli.argument('-m', '--matrix', action='store_true', help='Render the layouts with matrix information.')
@cli.argument('-f', '--format', default='friendly', arg_only=True, help='Format to display the data in (friendly, text, json) (Default: friendly).')
@@ -161,8 +161,15 @@ def info(cli):
print_parsed_rules_mk(cli.config.info.keyboard)
return False
+ # default keymap stored in config file should be ignored
+ if cli.config_source.info.keymap == 'config_file':
+ cli.config_source.info.keymap = None
+
# Build the info.json file
- kb_info_json = info_json(cli.config.info.keyboard)
+ if cli.config.info.keymap:
+ kb_info_json = keymap_json(cli.config.info.keyboard, cli.config.info.keymap)
+ else:
+ kb_info_json = info_json(cli.config.info.keyboard)
# Output in the requested format
if cli.args.format == 'json':
@@ -178,11 +185,12 @@ def info(cli):
cli.log.error('Unknown format: %s', cli.args.format)
return False
+ # Output requested extras
if cli.config.info.layouts:
show_layouts(kb_info_json, title_caps)
if cli.config.info.matrix:
show_matrix(kb_info_json, title_caps)
- if cli.config_source.info.keymap and cli.config_source.info.keymap != 'config_file':
+ if cli.config.info.keymap:
show_keymap(kb_info_json, title_caps)
diff --git a/lib/python/qmk/cli/new/keyboard.py b/lib/python/qmk/cli/new/keyboard.py
index 1cdfe53206..8d4def1bef 100644
--- a/lib/python/qmk/cli/new/keyboard.py
+++ b/lib/python/qmk/cli/new/keyboard.py
@@ -14,7 +14,7 @@ from qmk.git import git_get_username
from qmk.json_schema import load_jsonschema
from qmk.path import keyboard
from qmk.json_encoders import InfoJSONEncoder
-from qmk.json_schema import deep_update
+from qmk.json_schema import deep_update, json_load
from qmk.constants import MCU2BOOTLOADER
COMMUNITY = Path('layouts/default/')
@@ -23,13 +23,14 @@ TEMPLATE = Path('data/templates/keyboard/')
# defaults
schema = dotty(load_jsonschema('keyboard'))
mcu_types = sorted(schema["properties.processor.enum"], key=str.casefold)
+dev_boards = sorted(schema["properties.development_board.enum"], key=str.casefold)
available_layouts = sorted([x.name for x in COMMUNITY.iterdir() if x.is_dir()])
def mcu_type(mcu):
"""Callable for argparse validation.
"""
- if mcu not in mcu_types:
+ if mcu not in (dev_boards + mcu_types):
raise ValueError
return mcu
@@ -176,14 +177,14 @@ https://docs.qmk.fm/#/compatible_microcontrollers
MCU? """
# remove any options strictly used for compatibility
- filtered_mcu = [x for x in mcu_types if not any(xs in x for xs in ['cortex', 'unknown'])]
+ filtered_mcu = [x for x in (dev_boards + mcu_types) if not any(xs in x for xs in ['cortex', 'unknown'])]
return choice(prompt, filtered_mcu, default=filtered_mcu.index("atmega32u4"))
@cli.argument('-kb', '--keyboard', help='Specify the name for the new keyboard directory', arg_only=True, type=keyboard_name)
@cli.argument('-l', '--layout', help='Community layout to bootstrap with', arg_only=True, type=layout_type)
-@cli.argument('-t', '--type', help='Specify the keyboard MCU type', arg_only=True, type=mcu_type)
+@cli.argument('-t', '--type', help='Specify the keyboard MCU type (or "development_board" preset)', arg_only=True, type=mcu_type)
@cli.argument('-u', '--username', help='Specify your username (default from Git config)', dest='name')
@cli.argument('-n', '--realname', help='Specify your real name if you want to use that. Defaults to username', arg_only=True)
@cli.subcommand('Creates a new keyboard directory')
@@ -198,7 +199,6 @@ def new_keyboard(cli):
real_name = cli.args.realname or cli.config.new_keyboard.name if cli.args.realname or cli.config.new_keyboard.name else prompt_name(user_name)
default_layout = cli.args.layout if cli.args.layout else prompt_layout()
mcu = cli.args.type if cli.args.type else prompt_mcu()
- bootloader = select_default_bootloader(mcu)
if not validate_keyboard_name(kb_name):
cli.log.error('Keyboard names must contain only {fg_cyan}lowercase a-z{fg_reset}, {fg_cyan}0-9{fg_reset}, and {fg_cyan}_{fg_reset}! Please choose a different name.')
@@ -208,6 +208,16 @@ def new_keyboard(cli):
cli.log.error(f'Keyboard {{fg_cyan}}{kb_name}{{fg_reset}} already exists! Please choose a different name.')
return 1
+ # Preprocess any development_board presets
+ if mcu in dev_boards:
+ defaults_map = json_load(Path('data/mappings/defaults.json'))
+ board = defaults_map['development_board'][mcu]
+
+ mcu = board['processor']
+ bootloader = board['bootloader']
+ else:
+ bootloader = select_default_bootloader(mcu)
+
tokens = { # Comment here is to force multiline formatting
'YEAR': str(date.today().year),
'KEYBOARD': kb_name,
diff --git a/lib/python/qmk/cli/painter/__init__.py b/lib/python/qmk/cli/painter/__init__.py
new file mode 100644
index 0000000000..d1a225346c
--- /dev/null
+++ b/lib/python/qmk/cli/painter/__init__.py
@@ -0,0 +1,2 @@
+from . import convert_graphics
+from . import make_font
diff --git a/lib/python/qmk/cli/painter/convert_graphics.py b/lib/python/qmk/cli/painter/convert_graphics.py
new file mode 100644
index 0000000000..bbc30d26ff
--- /dev/null
+++ b/lib/python/qmk/cli/painter/convert_graphics.py
@@ -0,0 +1,86 @@
+"""This script tests QGF functionality.
+"""
+import re
+import datetime
+from io import BytesIO
+from qmk.path import normpath
+from qmk.painter import render_header, render_source, render_license, render_bytes, valid_formats
+from milc import cli
+from PIL import Image
+
+
+@cli.argument('-v', '--verbose', arg_only=True, action='store_true', help='Turns on verbose output.')
+@cli.argument('-i', '--input', required=True, help='Specify input graphic file.')
+@cli.argument('-o', '--output', default='', help='Specify output directory. Defaults to same directory as input.')
+@cli.argument('-f', '--format', required=True, help='Output format, valid types: %s' % (', '.join(valid_formats.keys())))
+@cli.argument('-r', '--no-rle', arg_only=True, action='store_true', help='Disables the use of RLE when encoding images.')
+@cli.argument('-d', '--no-deltas', arg_only=True, action='store_true', help='Disables the use of delta frames when encoding animations.')
+@cli.subcommand('Converts an input image to something QMK understands')
+def painter_convert_graphics(cli):
+ """Converts an image file to a format that Quantum Painter understands.
+
+ This command uses the `qmk.painter` module to generate a Quantum Painter image defintion from an image. The generated definitions are written to a files next to the input -- `INPUT.c` and `INPUT.h`.
+ """
+ # Work out the input file
+ if cli.args.input != '-':
+ cli.args.input = normpath(cli.args.input)
+
+ # Error checking
+ if not cli.args.input.exists():
+ cli.log.error('Input image file does not exist!')
+ cli.print_usage()
+ return False
+
+ # Work out the output directory
+ if len(cli.args.output) == 0:
+ cli.args.output = cli.args.input.parent
+ cli.args.output = normpath(cli.args.output)
+
+ # Ensure we have a valid format
+ if cli.args.format not in valid_formats.keys():
+ cli.log.error('Output format %s is invalid. Allowed values: %s' % (cli.args.format, ', '.join(valid_formats.keys())))
+ cli.print_usage()
+ return False
+
+ # Work out the encoding parameters
+ format = valid_formats[cli.args.format]
+
+ # Load the input image
+ input_img = Image.open(cli.args.input)
+
+ # Convert the image to QGF using PIL
+ out_data = BytesIO()
+ input_img.save(out_data, "QGF", use_deltas=(not cli.args.no_deltas), use_rle=(not cli.args.no_rle), qmk_format=format, verbose=cli.args.verbose)
+ out_bytes = out_data.getvalue()
+
+ # Work out the text substitutions for rendering the output data
+ subs = {
+ 'generated_type': 'image',
+ 'var_prefix': 'gfx',
+ 'generator_command': f'qmk painter-convert-graphics -i {cli.args.input.name} -f {cli.args.format}',
+ 'year': datetime.date.today().strftime("%Y"),
+ 'input_file': cli.args.input.name,
+ 'sane_name': re.sub(r"[^a-zA-Z0-9]", "_", cli.args.input.stem),
+ 'byte_count': len(out_bytes),
+ 'bytes_lines': render_bytes(out_bytes),
+ 'format': cli.args.format,
+ }
+
+ # Render the license
+ subs.update({'license': render_license(subs)})
+
+ # Render and write the header file
+ header_text = render_header(subs)
+ header_file = cli.args.output / (cli.args.input.stem + ".qgf.h")
+ with open(header_file, 'w') as header:
+ print(f"Writing {header_file}...")
+ header.write(header_text)
+ header.close()
+
+ # Render and write the source file
+ source_text = render_source(subs)
+ source_file = cli.args.output / (cli.args.input.stem + ".qgf.c")
+ with open(source_file, 'w') as source:
+ print(f"Writing {source_file}...")
+ source.write(source_text)
+ source.close()
diff --git a/lib/python/qmk/cli/painter/make_font.py b/lib/python/qmk/cli/painter/make_font.py
new file mode 100644
index 0000000000..0762843fd3
--- /dev/null
+++ b/lib/python/qmk/cli/painter/make_font.py
@@ -0,0 +1,87 @@
+"""This script automates the conversion of font files into a format QMK firmware understands.
+"""
+
+import re
+import datetime
+from io import BytesIO
+from qmk.path import normpath
+from qmk.painter_qff import QFFFont
+from qmk.painter import render_header, render_source, render_license, render_bytes, valid_formats
+from milc import cli
+
+
+@cli.argument('-f', '--font', required=True, help='Specify input font file.')
+@cli.argument('-o', '--output', required=True, help='Specify output image path.')
+@cli.argument('-s', '--size', default=12, help='Specify font size. Default 12.')
+@cli.argument('-n', '--no-ascii', arg_only=True, action='store_true', help='Disables output of the full ASCII character set (0x20..0x7E), exporting only the glyphs specified.')
+@cli.argument('-u', '--unicode-glyphs', default='', help='Also generate the specified unicode glyphs.')
+@cli.argument('-a', '--no-aa', arg_only=True, action='store_true', help='Disable anti-aliasing on fonts.')
+@cli.subcommand('Converts an input font to something QMK understands')
+def painter_make_font_image(cli):
+ # Create the font object
+ font = QFFFont(cli)
+ # Read from the input file
+ cli.args.font = normpath(cli.args.font)
+ font.generate_image(cli.args.font, cli.args.size, include_ascii_glyphs=(not cli.args.no_ascii), unicode_glyphs=cli.args.unicode_glyphs, use_aa=(False if cli.args.no_aa else True))
+ # Render out the data
+ font.save_to_image(normpath(cli.args.output))
+
+
+@cli.argument('-i', '--input', help='Specify input graphic file.')
+@cli.argument('-o', '--output', default='', help='Specify output directory. Defaults to same directory as input.')
+@cli.argument('-n', '--no-ascii', arg_only=True, action='store_true', help='Disables output of the full ASCII character set (0x20..0x7E), exporting only the glyphs specified.')
+@cli.argument('-u', '--unicode-glyphs', default='', help='Also generate the specified unicode glyphs.')
+@cli.argument('-f', '--format', required=True, help='Output format, valid types: %s' % (', '.join(valid_formats.keys())))
+@cli.argument('-r', '--no-rle', arg_only=True, action='store_true', help='Disable the use of RLE to minimise converted image size.')
+@cli.subcommand('Converts an input font image to something QMK firmware understands')
+def painter_convert_font_image(cli):
+ # Work out the format
+ format = valid_formats[cli.args.format]
+
+ # Create the font object
+ font = QFFFont(cli.log)
+
+ # Read from the input file
+ cli.args.input = normpath(cli.args.input)
+ font.read_from_image(cli.args.input, include_ascii_glyphs=(not cli.args.no_ascii), unicode_glyphs=cli.args.unicode_glyphs)
+
+ # Work out the output directory
+ if len(cli.args.output) == 0:
+ cli.args.output = cli.args.input.parent
+ cli.args.output = normpath(cli.args.output)
+
+ # Render out the data
+ out_data = BytesIO()
+ font.save_to_qff(format, (False if cli.args.no_rle else True), out_data)
+
+ # Work out the text substitutions for rendering the output data
+ subs = {
+ 'generated_type': 'font',
+ 'var_prefix': 'font',
+ 'generator_command': f'qmk painter-convert-font-image -i {cli.args.input.name} -f {cli.args.format}',
+ 'year': datetime.date.today().strftime("%Y"),
+ 'input_file': cli.args.input.name,
+ 'sane_name': re.sub(r"[^a-zA-Z0-9]", "_", cli.args.input.stem),
+ 'byte_count': out_data.getbuffer().nbytes,
+ 'bytes_lines': render_bytes(out_data.getbuffer().tobytes()),
+ 'format': cli.args.format,
+ }
+
+ # Render the license
+ subs.update({'license': render_license(subs)})
+
+ # Render and write the header file
+ header_text = render_header(subs)
+ header_file = cli.args.output / (cli.args.input.stem + ".qff.h")
+ with open(header_file, 'w') as header:
+ print(f"Writing {header_file}...")
+ header.write(header_text)
+ header.close()
+
+ # Render and write the source file
+ source_text = render_source(subs)
+ source_file = cli.args.output / (cli.args.input.stem + ".qff.c")
+ with open(source_file, 'w') as source:
+ print(f"Writing {source_file}...")
+ source.write(source_text)
+ source.close()
diff --git a/lib/python/qmk/cli/pytest.py b/lib/python/qmk/cli/pytest.py
index b7b17f0e9d..5c9c173caa 100644
--- a/lib/python/qmk/cli/pytest.py
+++ b/lib/python/qmk/cli/pytest.py
@@ -12,8 +12,7 @@ from milc import cli
def pytest(cli):
"""Run several linting/testing commands.
"""
- nose2 = cli.run(['nose2', '-v', '-t'
- 'lib/python', *cli.args.test], capture_output=False, stdin=DEVNULL)
+ nose2 = cli.run(['nose2', '-v', '-t', 'lib/python', *cli.args.test], capture_output=False, stdin=DEVNULL)
flake8 = cli.run(['flake8', 'lib/python'], capture_output=False, stdin=DEVNULL)
return flake8.returncode | nose2.returncode
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py
index d0bd00beb7..9c0a5dce56 100644
--- a/lib/python/qmk/commands.py
+++ b/lib/python/qmk/commands.py
@@ -228,7 +228,7 @@ def dump_lines(output_file, lines, quiet=True):
output_file.parent.mkdir(parents=True, exist_ok=True)
if output_file.exists():
output_file.replace(output_file.parent / (output_file.name + '.bak'))
- output_file.write_text(generated)
+ output_file.write_text(generated, encoding='utf-8')
if not quiet:
cli.log.info(f'Wrote {output_file.name} to {output_file}.')
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py
index fd8a3062b7..49d1054519 100644
--- a/lib/python/qmk/info.py
+++ b/lib/python/qmk/info.py
@@ -8,10 +8,11 @@ from dotty_dict import dotty
from milc import cli
from qmk.constants import CHIBIOS_PROCESSORS, LUFA_PROCESSORS, VUSB_PROCESSORS
-from qmk.c_parse import find_layouts
+from qmk.c_parse import find_layouts, parse_config_h_file
from qmk.json_schema import deep_update, json_load, validate
from qmk.keyboard import config_h, rules_mk
-from qmk.keymap import list_keymaps
+from qmk.keymap import list_keymaps, locate_keymap
+from qmk.commands import parse_configurator_json
from qmk.makefile import parse_rules_mk_file
from qmk.math import compute
@@ -68,8 +69,9 @@ def info_json(keyboard):
# Merge in the data from info.json, config.h, and rules.mk
info_data = merge_info_jsons(keyboard, info_data)
- info_data = _extract_rules_mk(info_data)
- info_data = _extract_config_h(info_data)
+ info_data = _process_defaults(info_data)
+ info_data = _extract_rules_mk(info_data, rules_mk(str(keyboard)))
+ info_data = _extract_config_h(info_data, config_h(str(keyboard)))
# Ensure that we have matrix row and column counts
info_data = _matrix_size(info_data)
@@ -166,28 +168,46 @@ def _extract_pins(pins):
return [_pin_name(pin) for pin in pins.split(',')]
-def _extract_direct_matrix(direct_pins):
- """
+def _extract_2d_array(raw):
+ """Return a 2d array of strings
"""
- direct_pin_array = []
+ out_array = []
- while direct_pins[-1] != '}':
- direct_pins = direct_pins[:-1]
+ while raw[-1] != '}':
+ raw = raw[:-1]
- for row in direct_pins.split('},{'):
+ for row in raw.split('},{'):
if row.startswith('{'):
row = row[1:]
if row.endswith('}'):
row = row[:-1]
- direct_pin_array.append([])
+ out_array.append([])
+
+ for val in row.split(','):
+ out_array[-1].append(val)
+
+ return out_array
+
+
+def _extract_2d_int_array(raw):
+ """Return a 2d array of ints
+ """
+ ret = _extract_2d_array(raw)
+
+ return [list(map(int, x)) for x in ret]
+
- for pin in row.split(','):
- if pin == 'NO_PIN':
- pin = None
+def _extract_direct_matrix(direct_pins):
+ """extract direct_matrix
+ """
+ direct_pin_array = _extract_2d_array(direct_pins)
- direct_pin_array[-1].append(pin)
+ for i in range(len(direct_pin_array)):
+ for j in range(len(direct_pin_array[i])):
+ if direct_pin_array[i][j] == 'NO_PIN':
+ direct_pin_array[i][j] = None
return direct_pin_array
@@ -205,6 +225,21 @@ def _extract_audio(info_data, config_c):
info_data['audio'] = {'pins': audio_pins}
+def _extract_secure_unlock(info_data, config_c):
+ """Populate data about the secure unlock sequence
+ """
+ unlock = config_c.get('SECURE_UNLOCK_SEQUENCE', '').replace(' ', '')[1:-1]
+ if unlock:
+ unlock_array = _extract_2d_int_array(unlock)
+ if 'secure' not in info_data:
+ info_data['secure'] = {}
+
+ if 'unlock_sequence' in info_data['secure']:
+ _log_warning(info_data, 'Secure unlock sequence is specified in both config.h (SECURE_UNLOCK_SEQUENCE) and info.json (secure.unlock_sequence) (Value: %s), the config.h value wins.' % info_data['secure']['unlock_sequence'])
+
+ info_data['secure']['unlock_sequence'] = unlock_array
+
+
def _extract_split_main(info_data, config_c):
"""Populate data about the split configuration
"""
@@ -270,14 +305,16 @@ def _extract_split_transport(info_data, config_c):
info_data['split']['transport']['protocol'] = 'i2c'
- elif 'protocol' not in info_data.get('split', {}).get('transport', {}):
+ # Ignore transport defaults if "SPLIT_KEYBOARD" is unset
+ elif 'enabled' in info_data.get('split', {}):
if 'split' not in info_data:
info_data['split'] = {}
if 'transport' not in info_data['split']:
info_data['split']['transport'] = {}
- info_data['split']['transport']['protocol'] = 'serial'
+ if 'protocol' not in info_data['split']['transport']:
+ info_data['split']['transport']['protocol'] = 'serial'
def _extract_split_right_pins(info_data, config_c):
@@ -400,18 +437,16 @@ def _extract_device_version(info_data):
info_data['usb']['device_version'] = f'{major}.{minor}.{revision}'
-def _extract_config_h(info_data):
+def _extract_config_h(info_data, config_c):
"""Pull some keyboard information from existing config.h files
"""
- config_c = config_h(info_data['keyboard_folder'])
-
# Pull in data from the json map
dotty_info = dotty(info_data)
info_config_map = json_load(Path('data/mappings/info_config.json'))
for config_key, info_dict in info_config_map.items():
info_key = info_dict['info_key']
- key_type = info_dict.get('value_type', 'str')
+ key_type = info_dict.get('value_type', 'raw')
try:
if config_key in config_c and info_dict.get('to_json', True):
@@ -443,6 +478,9 @@ def _extract_config_h(info_data):
elif key_type == 'int':
dotty_info[info_key] = int(config_c[config_key])
+ elif key_type == 'str':
+ dotty_info[info_key] = config_c[config_key].strip('"')
+
elif key_type == 'bcd_version':
major = int(config_c[config_key][2:4])
minor = int(config_c[config_key][4])
@@ -461,6 +499,7 @@ def _extract_config_h(info_data):
# Pull data that easily can't be mapped in json
_extract_matrix_info(info_data, config_c)
_extract_audio(info_data, config_c)
+ _extract_secure_unlock(info_data, config_c)
_extract_split_main(info_data, config_c)
_extract_split_transport(info_data, config_c)
_extract_split_right_pins(info_data, config_c)
@@ -469,10 +508,21 @@ def _extract_config_h(info_data):
return info_data
-def _extract_rules_mk(info_data):
+def _process_defaults(info_data):
+ """Process any additional defaults based on currently discovered information
+ """
+ defaults_map = json_load(Path('data/mappings/defaults.json'))
+ for default_type in defaults_map.keys():
+ thing_map = defaults_map[default_type]
+ if default_type in info_data:
+ for key, value in thing_map.get(info_data[default_type], {}).items():
+ info_data[key] = value
+ return info_data
+
+
+def _extract_rules_mk(info_data, rules):
"""Pull some keyboard information from existing rules.mk files
"""
- rules = rules_mk(info_data['keyboard_folder'])
info_data['processor'] = rules.get('MCU', info_data.get('processor', 'atmega32u4'))
if info_data['processor'] in CHIBIOS_PROCESSORS:
@@ -491,7 +541,7 @@ def _extract_rules_mk(info_data):
for rules_key, info_dict in info_rules_map.items():
info_key = info_dict['info_key']
- key_type = info_dict.get('value_type', 'str')
+ key_type = info_dict.get('value_type', 'raw')
try:
if rules_key in rules and info_dict.get('to_json', True):
@@ -523,6 +573,9 @@ def _extract_rules_mk(info_data):
elif key_type == 'int':
dotty_info[info_key] = int(rules[rules_key])
+ elif key_type == 'str':
+ dotty_info[info_key] = rules[rules_key].strip('"')
+
else:
dotty_info[info_key] = rules[rules_key]
@@ -760,3 +813,36 @@ def find_info_json(keyboard):
# Return a list of the info.json files that actually exist
return [info_json for info_json in info_jsons if info_json.exists()]
+
+
+def keymap_json_config(keyboard, keymap):
+ """Extract keymap level config
+ """
+ keymap_folder = locate_keymap(keyboard, keymap).parent
+
+ km_info_json = parse_configurator_json(keymap_folder / 'keymap.json')
+ return km_info_json.get('config', {})
+
+
+def keymap_json(keyboard, keymap):
+ """Generate the info.json data for a specific keymap.
+ """
+ keymap_folder = locate_keymap(keyboard, keymap).parent
+
+ # Files to scan
+ keymap_config = keymap_folder / 'config.h'
+ keymap_rules = keymap_folder / 'rules.mk'
+ keymap_file = keymap_folder / 'keymap.json'
+
+ # Build the info.json file
+ kb_info_json = info_json(keyboard)
+
+ # Merge in the data from keymap.json
+ km_info_json = keymap_json_config(keyboard, keymap) if keymap_file.exists() else {}
+ deep_update(kb_info_json, km_info_json)
+
+ # Merge in the data from config.h, and rules.mk
+ _extract_rules_mk(kb_info_json, parse_rules_mk_file(keymap_rules))
+ _extract_config_h(kb_info_json, parse_config_h_file(keymap_config))
+
+ return kb_info_json
diff --git a/lib/python/qmk/json_schema.py b/lib/python/qmk/json_schema.py
index 2b48782fbb..682346113e 100644
--- a/lib/python/qmk/json_schema.py
+++ b/lib/python/qmk/json_schema.py
@@ -68,7 +68,11 @@ def create_validator(schema):
schema_store = compile_schema_store()
resolver = jsonschema.RefResolver.from_schema(schema_store[schema], store=schema_store)
- return jsonschema.Draft7Validator(schema_store[schema], resolver=resolver).validate
+ # TODO: Remove this after the jsonschema>=4 requirement had time to reach users
+ try:
+ return jsonschema.Draft202012Validator(schema_store[schema], resolver=resolver).validate
+ except AttributeError:
+ return jsonschema.Draft7Validator(schema_store[schema], resolver=resolver).validate
def validate(data, schema):
diff --git a/lib/python/qmk/painter.py b/lib/python/qmk/painter.py
new file mode 100644
index 0000000000..d0cc1dddec
--- /dev/null
+++ b/lib/python/qmk/painter.py
@@ -0,0 +1,268 @@
+"""Functions that help us work with Quantum Painter's file formats.
+"""
+import math
+import re
+from string import Template
+from PIL import Image, ImageOps
+
+# The list of valid formats Quantum Painter supports
+valid_formats = {
+ 'pal256': {
+ 'image_format': 'IMAGE_FORMAT_PALETTE',
+ 'bpp': 8,
+ 'has_palette': True,
+ 'num_colors': 256,
+ 'image_format_byte': 0x07, # see qp_internal_formats.h
+ },
+ 'pal16': {
+ 'image_format': 'IMAGE_FORMAT_PALETTE',
+ 'bpp': 4,
+ 'has_palette': True,
+ 'num_colors': 16,
+ 'image_format_byte': 0x06, # see qp_internal_formats.h
+ },
+ 'pal4': {
+ 'image_format': 'IMAGE_FORMAT_PALETTE',
+ 'bpp': 2,
+ 'has_palette': True,
+ 'num_colors': 4,
+ 'image_format_byte': 0x05, # see qp_internal_formats.h
+ },
+ 'pal2': {
+ 'image_format': 'IMAGE_FORMAT_PALETTE',
+ 'bpp': 1,
+ 'has_palette': True,
+ 'num_colors': 2,
+ 'image_format_byte': 0x04, # see qp_internal_formats.h
+ },
+ 'mono256': {
+ 'image_format': 'IMAGE_FORMAT_GRAYSCALE',
+ 'bpp': 8,
+ 'has_palette': False,
+ 'num_colors': 256,
+ 'image_format_byte': 0x03, # see qp_internal_formats.h
+ },
+ 'mono16': {
+ 'image_format': 'IMAGE_FORMAT_GRAYSCALE',
+ 'bpp': 4,
+ 'has_palette': False,
+ 'num_colors': 16,
+ 'image_format_byte': 0x02, # see qp_internal_formats.h
+ },
+ 'mono4': {
+ 'image_format': 'IMAGE_FORMAT_GRAYSCALE',
+ 'bpp': 2,
+ 'has_palette': False,
+ 'num_colors': 4,
+ 'image_format_byte': 0x01, # see qp_internal_formats.h
+ },
+ 'mono2': {
+ 'image_format': 'IMAGE_FORMAT_GRAYSCALE',
+ 'bpp': 1,
+ 'has_palette': False,
+ 'num_colors': 2,
+ 'image_format_byte': 0x00, # see qp_internal_formats.h
+ }
+}
+
+license_template = """\
+// Copyright ${year} QMK -- generated source code only, ${generated_type} retains original copyright
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+// This file was auto-generated by `${generator_command}`
+"""
+
+
+def render_license(subs):
+ license_txt = Template(license_template)
+ return license_txt.substitute(subs)
+
+
+header_file_template = """\
+${license}
+#pragma once
+
+#include <qp.h>
+
+extern const uint32_t ${var_prefix}_${sane_name}_length;
+extern const uint8_t ${var_prefix}_${sane_name}[${byte_count}];
+"""
+
+
+def render_header(subs):
+ header_txt = Template(header_file_template)
+ return header_txt.substitute(subs)
+
+
+source_file_template = """\
+${license}
+#include <qp.h>
+
+const uint32_t ${var_prefix}_${sane_name}_length = ${byte_count};
+
+// clang-format off
+const uint8_t ${var_prefix}_${sane_name}[${byte_count}] = {
+${bytes_lines}
+};
+// clang-format on
+"""
+
+
+def render_source(subs):
+ source_txt = Template(source_file_template)
+ return source_txt.substitute(subs)
+
+
+def render_bytes(bytes, newline_after=16):
+ lines = ''
+ for n in range(len(bytes)):
+ if n % newline_after == 0 and n > 0 and n != len(bytes):
+ lines = lines + "\n "
+ elif n == 0:
+ lines = lines + " "
+ lines = lines + " 0x{0:02X},".format(bytes[n])
+ return lines.rstrip()
+
+
+def clean_output(str):
+ str = re.sub(r'\r', '', str)
+ str = re.sub(r'[\n]{3,}', r'\n\n', str)
+ return str
+
+
+def rescale_byte(val, maxval):
+ """Rescales a byte value to the supplied range, i.e. [0,255] -> [0,maxval].
+ """
+ return int(round(val * maxval / 255.0))
+
+
+def convert_requested_format(im, format):
+ """Convert an image to the requested format.
+ """
+
+ # Work out the requested format
+ ncolors = format["num_colors"]
+ image_format = format["image_format"]
+
+ # Ensure we have a valid number of colors for the palette
+ if ncolors <= 0 or ncolors > 256 or (ncolors & (ncolors - 1) != 0):
+ raise ValueError("Number of colors must be 2, 4, 16, or 256.")
+
+ # Work out where we're getting the bytes from
+ if image_format == 'IMAGE_FORMAT_GRAYSCALE':
+ # If mono, convert input to grayscale, then to RGB, then grab the raw bytes corresponding to the intensity of the red channel
+ im = ImageOps.grayscale(im)
+ im = im.convert("RGB")
+ elif image_format == 'IMAGE_FORMAT_PALETTE':
+ # If color, convert input to RGB, palettize based on the supplied number of colors, then get the raw palette bytes
+ im = im.convert("RGB")
+ im = im.convert("P", palette=Image.ADAPTIVE, colors=ncolors)
+
+ return im
+
+
+def convert_image_bytes(im, format):
+ """Convert the supplied image to the equivalent bytes required by the QMK firmware.
+ """
+
+ # Work out the requested format
+ ncolors = format["num_colors"]
+ image_format = format["image_format"]
+ shifter = int(math.log2(ncolors))
+ pixels_per_byte = int(8 / math.log2(ncolors))
+ (width, height) = im.size
+ expected_byte_count = ((width * height) + (pixels_per_byte - 1)) // pixels_per_byte
+
+ if image_format == 'IMAGE_FORMAT_GRAYSCALE':
+ # Take the red channel
+ image_bytes = im.tobytes("raw", "R")
+ image_bytes_len = len(image_bytes)
+
+ # No palette
+ palette = None
+
+ bytearray = []
+ for x in range(expected_byte_count):
+ byte = 0
+ for n in range(pixels_per_byte):
+ byte_offset = x * pixels_per_byte + n
+ if byte_offset < image_bytes_len:
+ # If mono, each input byte is a grayscale [0,255] pixel -- rescale to the range we want then pack together
+ byte = byte | (rescale_byte(image_bytes[byte_offset], ncolors - 1) << int(n * shifter))
+ bytearray.append(byte)
+
+ elif image_format == 'IMAGE_FORMAT_PALETTE':
+ # Convert each pixel to the palette bytes
+ image_bytes = im.tobytes("raw", "P")
+ image_bytes_len = len(image_bytes)
+
+ # Export the palette
+ palette = []
+ pal = im.getpalette()
+ for n in range(0, ncolors * 3, 3):
+ palette.append((pal[n + 0], pal[n + 1], pal[n + 2]))
+
+ bytearray = []
+ for x in range(expected_byte_count):
+ byte = 0
+ for n in range(pixels_per_byte):
+ byte_offset = x * pixels_per_byte + n
+ if byte_offset < image_bytes_len:
+ # If color, each input byte is the index into the color palette -- pack them together
+ byte = byte | ((image_bytes[byte_offset] & (ncolors - 1)) << int(n * shifter))
+ bytearray.append(byte)
+
+ if len(bytearray) != expected_byte_count:
+ raise Exception(f"Wrong byte count, was {len(bytearray)}, expected {expected_byte_count}")
+
+ return (palette, bytearray)
+
+
+def compress_bytes_qmk_rle(bytearray):
+ debug_dump = False
+ output = []
+ temp = []
+ repeat = False
+
+ def append_byte(c):
+ if debug_dump:
+ print('Appending byte:', '0x{0:02X}'.format(int(c)), '=', c)
+ output.append(c)
+
+ def append_range(r):
+ append_byte(127 + len(r))
+ if debug_dump:
+ print('Appending {0} byte(s):'.format(len(r)), '[', ', '.join(['{0:02X}'.format(e) for e in r]), ']')
+ output.extend(r)
+
+ for n in range(0, len(bytearray) + 1):
+ end = True if n == len(bytearray) else False
+ if not end:
+ c = bytearray[n]
+ temp.append(c)
+ if len(temp) <= 1:
+ continue
+
+ if debug_dump:
+ print('Temp buffer state {0:3d} bytes:'.format(len(temp)), '[', ', '.join(['{0:02X}'.format(e) for e in temp]), ']')
+
+ if repeat:
+ if temp[-1] != temp[-2]:
+ repeat = False
+ if not repeat or len(temp) == 128 or end:
+ append_byte(len(temp) if end else len(temp) - 1)
+ append_byte(temp[0])
+ temp = [temp[-1]]
+ repeat = False
+ else:
+ if len(temp) >= 2 and temp[-1] == temp[-2]:
+ repeat = True
+ if len(temp) > 2:
+ append_range(temp[0:(len(temp) - 2)])
+ temp = [temp[-1], temp[-1]]
+ continue
+ if len(temp) == 128 or end:
+ append_range(temp)
+ temp = []
+ repeat = False
+ return output
diff --git a/lib/python/qmk/painter_qff.py b/lib/python/qmk/painter_qff.py
new file mode 100644
index 0000000000..746bb166e5
--- /dev/null
+++ b/lib/python/qmk/painter_qff.py
@@ -0,0 +1,401 @@
+# Copyright 2021 Nick Brassel (@tzarc)
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# Quantum Font File "QFF" Font File Format.
+# See https://docs.qmk.fm/#/quantum_painter_qff for more information.
+
+from pathlib import Path
+from typing import Dict, Any
+from colorsys import rgb_to_hsv
+from PIL import Image, ImageDraw, ImageFont, ImageChops
+from PIL._binary import o8, o16le as o16, o32le as o32
+from qmk.painter_qgf import QGFBlockHeader, QGFFramePaletteDescriptorV1
+from milc.attrdict import AttrDict
+import qmk.painter
+
+
+def o24(i):
+ return o16(i & 0xFFFF) + o8((i & 0xFF0000) >> 16)
+
+
+########################################################################################################################
+
+
+class QFFGlyphInfo(AttrDict):
+ def __init__(self, *args, **kwargs):
+ super().__init__()
+
+ for n, value in enumerate(args):
+ self[f'arg:{n}'] = value
+
+ for key, value in kwargs.items():
+ self[key] = value
+
+ def write(self, fp, include_code_point):
+ if include_code_point is True:
+ fp.write(o24(ord(self.code_point)))
+
+ value = ((self.data_offset << 6) & 0xFFFFC0) | (self.w & 0x3F)
+ fp.write(o24(value))
+
+
+########################################################################################################################
+
+
+class QFFFontDescriptor:
+ type_id = 0x00
+ length = 20
+ magic = 0x464651
+
+ def __init__(self):
+ self.header = QGFBlockHeader()
+ self.header.type_id = QFFFontDescriptor.type_id
+ self.header.length = QFFFontDescriptor.length
+ self.version = 1
+ self.total_file_size = 0
+ self.line_height = 0
+ self.has_ascii_table = False
+ self.unicode_glyph_count = 0
+ self.format = 0xFF
+ self.flags = 0
+ self.compression = 0xFF
+ self.transparency_index = 0xFF # TODO: Work out how to retrieve the transparent palette entry from the PIL gif loader
+
+ def write(self, fp):
+ self.header.write(fp)
+ fp.write(
+ b'' # start off with empty bytes...
+ + o24(QFFFontDescriptor.magic) # magic
+ + o8(self.version) # version
+ + o32(self.total_file_size) # file size
+ + o32((~self.total_file_size) & 0xFFFFFFFF) # negated file size
+ + o8(self.line_height) # line height
+ + o8(1 if self.has_ascii_table is True else 0) # whether or not we have an ascii table present
+ + o16(self.unicode_glyph_count & 0xFFFF) # number of unicode glyphs present
+ + o8(self.format) # format
+ + o8(self.flags) # flags
+ + o8(self.compression) # compression
+ + o8(self.transparency_index) # transparency index
+ )
+
+ @property
+ def is_transparent(self):
+ return (self.flags & 0x01) == 0x01
+
+ @is_transparent.setter
+ def is_transparent(self, val):
+ if val:
+ self.flags |= 0x01
+ else:
+ self.flags &= ~0x01
+
+
+########################################################################################################################
+
+
+class QFFAsciiGlyphTableV1:
+ type_id = 0x01
+ length = 95 * 3 # We have 95 glyphs: [0x20...0x7E]
+
+ def __init__(self):
+ self.header = QGFBlockHeader()
+ self.header.type_id = QFFAsciiGlyphTableV1.type_id
+ self.header.length = QFFAsciiGlyphTableV1.length
+
+ # Each glyph is key=code_point, value=QFFGlyphInfo
+ self.glyphs = {}
+
+ def add_glyph(self, glyph: QFFGlyphInfo):
+ self.glyphs[ord(glyph.code_point)] = glyph
+
+ def write(self, fp):
+ self.header.write(fp)
+
+ for n in range(0x20, 0x7F):
+ self.glyphs[n].write(fp, False)
+
+
+########################################################################################################################
+
+
+class QFFUnicodeGlyphTableV1:
+ type_id = 0x02
+
+ def __init__(self):
+ self.header = QGFBlockHeader()
+ self.header.type_id = QFFUnicodeGlyphTableV1.type_id
+ self.header.length = 0
+
+ # Each glyph is key=code_point, value=QFFGlyphInfo
+ self.glyphs = {}
+
+ def add_glyph(self, glyph: QFFGlyphInfo):
+ self.glyphs[ord(glyph.code_point)] = glyph
+
+ def write(self, fp):
+ self.header.length = len(self.glyphs.keys()) * 6
+ self.header.write(fp)
+
+ for n in sorted(self.glyphs.keys()):
+ self.glyphs[n].write(fp, True)
+
+
+########################################################################################################################
+
+
+class QFFFontDataDescriptorV1:
+ type_id = 0x04
+
+ def __init__(self):
+ self.header = QGFBlockHeader()
+ self.header.type_id = QFFFontDataDescriptorV1.type_id
+ self.data = []
+
+ def write(self, fp):
+ self.header.length = len(self.data)
+ self.header.write(fp)
+ fp.write(bytes(self.data))
+
+
+########################################################################################################################
+
+
+def _generate_font_glyphs_list(use_ascii, unicode_glyphs):
+ # The set of glyphs that we want to generate images for
+ glyphs = {}
+
+ # Add ascii charset if requested
+ if use_ascii is True:
+ for c in range(0x20, 0x7F): # does not include 0x7F!
+ glyphs[chr(c)] = True
+
+ # Append any extra unicode glyphs
+ unicode_glyphs = list(unicode_glyphs)
+ for c in unicode_glyphs:
+ glyphs[c] = True
+
+ return sorted(glyphs.keys())
+
+
+class QFFFont:
+ def __init__(self, logger):
+ self.logger = logger
+ self.image = None
+ self.glyph_data = {}
+ self.glyph_height = 0
+ return
+
+ def _extract_glyphs(self, format):
+ total_data_size = 0
+ total_rle_data_size = 0
+
+ converted_img = qmk.painter.convert_requested_format(self.image, format)
+ (self.palette, _) = qmk.painter.convert_image_bytes(converted_img, format)
+
+ # Work out how many bytes used for RLE vs. non-RLE
+ for _, glyph_entry in self.glyph_data.items():
+ glyph_img = converted_img.crop((glyph_entry.x, 1, glyph_entry.x + glyph_entry.w, 1 + self.glyph_height))
+ (_, this_glyph_image_bytes) = qmk.painter.convert_image_bytes(glyph_img, format)
+ this_glyph_rle_bytes = qmk.painter.compress_bytes_qmk_rle(this_glyph_image_bytes)
+ total_data_size += len(this_glyph_image_bytes)
+ total_rle_data_size += len(this_glyph_rle_bytes)
+ glyph_entry['image_uncompressed_bytes'] = this_glyph_image_bytes
+ glyph_entry['image_compressed_bytes'] = this_glyph_rle_bytes
+
+ return (total_data_size, total_rle_data_size)
+
+ def _parse_image(self, img, include_ascii_glyphs: bool = True, unicode_glyphs: str = ''):
+ # Clear out any existing font metadata
+ self.image = None
+ # Each glyph is key=code_point, value={ x: ?, w: ? }
+ self.glyph_data = {}
+ self.glyph_height = 0
+
+ # Work out the list of glyphs required
+ glyphs = _generate_font_glyphs_list(include_ascii_glyphs, unicode_glyphs)
+
+ # Work out the geometry
+ (width, height) = img.size
+
+ # Work out the glyph offsets/widths
+ glyph_pixel_offsets = []
+ glyph_pixel_widths = []
+ pixels = img.load()
+
+ # Run through the markers and work out where each glyph starts/stops
+ glyph_split_color = pixels[0, 0] # top left pixel is the marker color we're going to use to split each glyph
+ glyph_pixel_offsets.append(0)
+ last_offset = 0
+ for x in range(1, width):
+ if pixels[x, 0] == glyph_split_color:
+ glyph_pixel_offsets.append(x)
+ glyph_pixel_widths.append(x - last_offset)
+ last_offset = x
+ glyph_pixel_widths.append(width - last_offset)
+
+ # Make sure the number of glyphs we're attempting to generate matches the input image
+ if len(glyph_pixel_offsets) != len(glyphs):
+ self.logger.error('The number of glyphs to generate doesn\'t match the number of detected glyphs in the input image.')
+ return
+
+ # Set up the required metadata for each glyph
+ for n in range(0, len(glyph_pixel_offsets)):
+ self.glyph_data[glyphs[n]] = QFFGlyphInfo(code_point=glyphs[n], x=glyph_pixel_offsets[n], w=glyph_pixel_widths[n])
+
+ # Parsing was successful, keep the image in this instance
+ self.image = img
+ self.glyph_height = height - 1 # subtract the line with the markers
+
+ def generate_image(self, ttf_file: Path, font_size: int, include_ascii_glyphs: bool = True, unicode_glyphs: str = '', include_before_left: bool = False, use_aa: bool = True):
+ # Load the font
+ font = ImageFont.truetype(str(ttf_file), int(font_size))
+ # Work out the max font size
+ max_font_size = font.font.ascent + abs(font.font.descent)
+ # Work out the list of glyphs required
+ glyphs = _generate_font_glyphs_list(include_ascii_glyphs, unicode_glyphs)
+
+ baseline_offset = 9999999
+ total_glyph_width = 0
+ max_glyph_height = -1
+
+ # Measure each glyph to determine the overall baseline offset required
+ for glyph in glyphs:
+ (ls_l, ls_t, ls_r, ls_b) = font.getbbox(glyph, anchor='ls')
+ glyph_width = (ls_r - ls_l) if include_before_left else (ls_r)
+ glyph_height = font.getbbox(glyph, anchor='la')[3]
+ if max_glyph_height < glyph_height:
+ max_glyph_height = glyph_height
+ total_glyph_width += glyph_width
+ if baseline_offset > ls_t:
+ baseline_offset = ls_t
+
+ # Create the output image
+ img = Image.new("RGB", (total_glyph_width + 1, max_font_size * 2 + 1), (0, 0, 0, 255))
+ cur_x_pos = 0
+
+ # Loop through each glyph...
+ for glyph in glyphs:
+ # Work out this glyph's bounding box
+ (ls_l, ls_t, ls_r, ls_b) = font.getbbox(glyph, anchor='ls')
+ glyph_width = (ls_r - ls_l) if include_before_left else (ls_r)
+ glyph_height = ls_b - ls_t
+ x_offset = -ls_l
+ y_offset = ls_t - baseline_offset
+
+ # Draw each glyph to its own image so we don't get anti-aliasing applied to the final image when straddling edges
+ glyph_img = Image.new("RGB", (glyph_width, max_font_size), (0, 0, 0, 255))
+ glyph_draw = ImageDraw.Draw(glyph_img)
+ if not use_aa:
+ glyph_draw.fontmode = "1"
+ glyph_draw.text((x_offset, y_offset), glyph, font=font, anchor='lt')
+
+ # Place the glyph-specific image in the correct location overall
+ img.paste(glyph_img, (cur_x_pos, 1))
+
+ # Set up the marker for start of each glyph
+ pixels = img.load()
+ pixels[cur_x_pos, 0] = (255, 0, 255)
+
+ # Increment for the next glyph's position
+ cur_x_pos += glyph_width
+
+ # Add the ending marker so that the difference/crop works
+ pixels = img.load()
+ pixels[cur_x_pos, 0] = (255, 0, 255)
+
+ # Determine the usable font area
+ dummy_img = Image.new("RGB", (total_glyph_width + 1, max_font_size + 1), (0, 0, 0, 255))
+ bbox = ImageChops.difference(img, dummy_img).getbbox()
+ bbox = (bbox[0], bbox[1], bbox[2] - 1, bbox[3]) # remove the unused end-marker
+
+ # Crop and re-parse the resulting image to ensure we're generating the correct format
+ self._parse_image(img.crop(bbox), include_ascii_glyphs, unicode_glyphs)
+
+ def save_to_image(self, img_file: Path):
+ # Drop out if there's no image loaded
+ if self.image is None:
+ self.logger.error('No image is loaded.')
+ return
+
+ # Save the image to the supplied file
+ self.image.save(str(img_file))
+
+ def read_from_image(self, img_file: Path, include_ascii_glyphs: bool = True, unicode_glyphs: str = ''):
+ # Load and parse the supplied image file
+ self._parse_image(Image.open(str(img_file)), include_ascii_glyphs, unicode_glyphs)
+ return
+
+ def save_to_qff(self, format: Dict[str, Any], use_rle: bool, fp):
+ # Drop out if there's no image loaded
+ if self.image is None:
+ self.logger.error('No image is loaded.')
+ return
+
+ # Work out if we want to use RLE at all, skipping it if it's not any smaller (it's applied per-glyph)
+ (total_data_size, total_rle_data_size) = self._extract_glyphs(format)
+ if use_rle:
+ use_rle = (total_rle_data_size < total_data_size)
+
+ # For each glyph, work out which image data we want to use and append it to the image buffer, recording the byte-wise offset
+ img_buffer = bytes()
+ for _, glyph_entry in self.glyph_data.items():
+ glyph_entry['data_offset'] = len(img_buffer)
+ glyph_img_bytes = glyph_entry.image_compressed_bytes if use_rle else glyph_entry.image_uncompressed_bytes
+ img_buffer += bytes(glyph_img_bytes)
+
+ font_descriptor = QFFFontDescriptor()
+ ascii_table = QFFAsciiGlyphTableV1()
+ unicode_table = QFFUnicodeGlyphTableV1()
+ data_descriptor = QFFFontDataDescriptorV1()
+ data_descriptor.data = img_buffer
+
+ # Check if we have all the ASCII glyphs present
+ include_ascii_glyphs = all([chr(n) in self.glyph_data for n in range(0x20, 0x7F)])
+
+ # Helper for populating the blocks
+ for code_point, glyph_entry in self.glyph_data.items():
+ if ord(code_point) >= 0x20 and ord(code_point) <= 0x7E and include_ascii_glyphs:
+ ascii_table.add_glyph(glyph_entry)
+ else:
+ unicode_table.add_glyph(glyph_entry)
+
+ # Configure the font descriptor
+ font_descriptor.line_height = self.glyph_height
+ font_descriptor.has_ascii_table = include_ascii_glyphs
+ font_descriptor.unicode_glyph_count = len(unicode_table.glyphs.keys())
+ font_descriptor.is_transparent = False
+ font_descriptor.format = format['image_format_byte']
+ font_descriptor.compression = 0x01 if use_rle else 0x00
+
+ # Write a dummy font descriptor -- we'll have to come back and write it properly once we've rendered out everything else
+ font_descriptor_location = fp.tell()
+ font_descriptor.write(fp)
+
+ # Write out the ASCII table if required
+ if font_descriptor.has_ascii_table:
+ ascii_table.write(fp)
+
+ # Write out the unicode table if required
+ if font_descriptor.unicode_glyph_count > 0:
+ unicode_table.write(fp)
+
+ # Write out the palette if required
+ if format['has_palette']:
+ palette_descriptor = QGFFramePaletteDescriptorV1()
+
+ # Helper to convert from RGB888 to the QMK "dialect" of HSV888
+ def rgb888_to_qmk_hsv888(e):
+ hsv = rgb_to_hsv(e[0] / 255.0, e[1] / 255.0, e[2] / 255.0)
+ return (int(hsv[0] * 255.0), int(hsv[1] * 255.0), int(hsv[2] * 255.0))
+
+ # Convert all palette entries to HSV888 and write to the output
+ palette_descriptor.palette_entries = list(map(rgb888_to_qmk_hsv888, self.palette))
+ palette_descriptor.write(fp)
+
+ # Write out the image data
+ data_descriptor.write(fp)
+
+ # Now fix up the overall font descriptor, then write it in the correct location
+ font_descriptor.total_file_size = fp.tell()
+ fp.seek(font_descriptor_location, 0)
+ font_descriptor.write(fp)
diff --git a/lib/python/qmk/painter_qgf.py b/lib/python/qmk/painter_qgf.py
new file mode 100644
index 0000000000..71ce1f5a02
--- /dev/null
+++ b/lib/python/qmk/painter_qgf.py
@@ -0,0 +1,408 @@
+# Copyright 2021 Nick Brassel (@tzarc)
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# Quantum Graphics File "QGF" Image File Format.
+# See https://docs.qmk.fm/#/quantum_painter_qgf for more information.
+
+from colorsys import rgb_to_hsv
+from types import FunctionType
+from PIL import Image, ImageFile, ImageChops
+from PIL._binary import o8, o16le as o16, o32le as o32
+import qmk.painter
+
+
+def o24(i):
+ return o16(i & 0xFFFF) + o8((i & 0xFF0000) >> 16)
+
+
+########################################################################################################################
+
+
+class QGFBlockHeader:
+ block_size = 5
+
+ def write(self, fp):
+ fp.write(b'' # start off with empty bytes...
+ + o8(self.type_id) # block type id
+ + o8((~self.type_id) & 0xFF) # negated block type id
+ + o24(self.length) # blob length
+ )
+
+
+########################################################################################################################
+
+
+class QGFGraphicsDescriptor:
+ type_id = 0x00
+ length = 18
+ magic = 0x464751
+
+ def __init__(self):
+ self.header = QGFBlockHeader()
+ self.header.type_id = QGFGraphicsDescriptor.type_id
+ self.header.length = QGFGraphicsDescriptor.length
+ self.version = 1
+ self.total_file_size = 0
+ self.image_width = 0
+ self.image_height = 0
+ self.frame_count = 0
+
+ def write(self, fp):
+ self.header.write(fp)
+ fp.write(
+ b'' # start off with empty bytes...
+ + o24(QGFGraphicsDescriptor.magic) # magic
+ + o8(self.version) # version
+ + o32(self.total_file_size) # file size
+ + o32((~self.total_file_size) & 0xFFFFFFFF) # negated file size
+ + o16(self.image_width) # width
+ + o16(self.image_height) # height
+ + o16(self.frame_count) # frame count
+ )
+
+
+########################################################################################################################
+
+
+class QGFFrameOffsetDescriptorV1:
+ type_id = 0x01
+
+ def __init__(self, frame_count):
+ self.header = QGFBlockHeader()
+ self.header.type_id = QGFFrameOffsetDescriptorV1.type_id
+ self.frame_offsets = [0xFFFFFFFF] * frame_count
+ self.frame_count = frame_count
+
+ def write(self, fp):
+ self.header.length = len(self.frame_offsets) * 4
+ self.header.write(fp)
+ for offset in self.frame_offsets:
+ fp.write(b'' # start off with empty bytes...
+ + o32(offset) # offset
+ )
+
+
+########################################################################################################################
+
+
+class QGFFrameDescriptorV1:
+ type_id = 0x02
+ length = 6
+
+ def __init__(self):
+ self.header = QGFBlockHeader()
+ self.header.type_id = QGFFrameDescriptorV1.type_id
+ self.header.length = QGFFrameDescriptorV1.length
+ self.format = 0xFF
+ self.flags = 0
+ self.compression = 0xFF
+ self.transparency_index = 0xFF # TODO: Work out how to retrieve the transparent palette entry from the PIL gif loader
+ self.delay = 1000 # Placeholder until it gets read from the animation
+
+ def write(self, fp):
+ self.header.write(fp)
+ fp.write(b'' # start off with empty bytes...
+ + o8(self.format) # format
+ + o8(self.flags) # flags
+ + o8(self.compression) # compression
+ + o8(self.transparency_index) # transparency index
+ + o16(self.delay) # delay
+ )
+
+ @property
+ def is_transparent(self):
+ return (self.flags & 0x01) == 0x01
+
+ @is_transparent.setter
+ def is_transparent(self, val):
+ if val:
+ self.flags |= 0x01
+ else:
+ self.flags &= ~0x01
+
+ @property
+ def is_delta(self):
+ return (self.flags & 0x02) == 0x02
+
+ @is_delta.setter
+ def is_delta(self, val):
+ if val:
+ self.flags |= 0x02
+ else:
+ self.flags &= ~0x02
+
+
+########################################################################################################################
+
+
+class QGFFramePaletteDescriptorV1:
+ type_id = 0x03
+
+ def __init__(self):
+ self.header = QGFBlockHeader()
+ self.header.type_id = QGFFramePaletteDescriptorV1.type_id
+ self.header.length = 0
+ self.palette_entries = [(0xFF, 0xFF, 0xFF)] * 4
+
+ def write(self, fp):
+ self.header.length = len(self.palette_entries) * 3
+ self.header.write(fp)
+ for entry in self.palette_entries:
+ fp.write(b'' # start off with empty bytes...
+ + o8(entry[0]) # h
+ + o8(entry[1]) # s
+ + o8(entry[2]) # v
+ )
+
+
+########################################################################################################################
+
+
+class QGFFrameDeltaDescriptorV1:
+ type_id = 0x04
+ length = 8
+
+ def __init__(self):
+ self.header = QGFBlockHeader()
+ self.header.type_id = QGFFrameDeltaDescriptorV1.type_id
+ self.header.length = QGFFrameDeltaDescriptorV1.length
+ self.left = 0
+ self.top = 0
+ self.right = 0
+ self.bottom = 0
+
+ def write(self, fp):
+ self.header.write(fp)
+ fp.write(b'' # start off with empty bytes...
+ + o16(self.left) # left
+ + o16(self.top) # top
+ + o16(self.right) # right
+ + o16(self.bottom) # bottom
+ )
+
+
+########################################################################################################################
+
+
+class QGFFrameDataDescriptorV1:
+ type_id = 0x05
+
+ def __init__(self):
+ self.header = QGFBlockHeader()
+ self.header.type_id = QGFFrameDataDescriptorV1.type_id
+ self.data = []
+
+ def write(self, fp):
+ self.header.length = len(self.data)
+ self.header.write(fp)
+ fp.write(bytes(self.data))
+
+
+########################################################################################################################
+
+
+class QGFImageFile(ImageFile.ImageFile):
+
+ format = "QGF"
+ format_description = "Quantum Graphics File Format"
+
+ def _open(self):
+ raise NotImplementedError("Reading QGF files is not supported")
+
+
+########################################################################################################################
+
+
+def _accept(prefix):
+ """Helper method used by PIL to work out if it can parse an input file.
+
+ Currently unimplemented.
+ """
+ return False
+
+
+def _save(im, fp, filename):
+ """Helper method used by PIL to write to an output file.
+ """
+ # Work out from the parameters if we need to do anything special
+ encoderinfo = im.encoderinfo.copy()
+ append_images = list(encoderinfo.get("append_images", []))
+ verbose = encoderinfo.get("verbose", False)
+ use_deltas = encoderinfo.get("use_deltas", True)
+ use_rle = encoderinfo.get("use_rle", True)
+
+ # Helper for inline verbose prints
+ def vprint(s):
+ if verbose:
+ print(s)
+
+ # Helper to iterate through all frames in the input image
+ def _for_all_frames(x: FunctionType):
+ frame_num = 0
+ last_frame = None
+ for frame in [im] + append_images:
+ # Get number of of frames in this image
+ nfr = getattr(frame, "n_frames", 1)
+ for idx in range(nfr):
+ frame.seek(idx)
+ frame.load()
+ copy = frame.copy().convert("RGB")
+ x(frame_num, copy, last_frame)
+ last_frame = copy
+ frame_num += 1
+
+ # Collect all the frame sizes
+ frame_sizes = []
+ _for_all_frames(lambda idx, frame, last_frame: frame_sizes.append(frame.size))
+
+ # Make sure all frames are the same size
+ if len(list(set(frame_sizes))) != 1:
+ raise ValueError("Mismatching sizes on frames")
+
+ # Write out the initial graphics descriptor (and write a dummy value), so that we can come back and fill in the
+ # correct values once we've written all the frames to the output
+ graphics_descriptor_location = fp.tell()
+ graphics_descriptor = QGFGraphicsDescriptor()
+ graphics_descriptor.frame_count = len(frame_sizes)
+ graphics_descriptor.image_width = frame_sizes[0][0]
+ graphics_descriptor.image_height = frame_sizes[0][1]
+ vprint(f'{"Graphics descriptor block":26s} {fp.tell():5d}d / {fp.tell():04X}h')
+ graphics_descriptor.write(fp)
+
+ # Work out the frame offset descriptor location (and write a dummy value), so that we can come back and fill in the
+ # correct offsets once we've written all the frames to the output
+ frame_offset_location = fp.tell()
+ frame_offsets = QGFFrameOffsetDescriptorV1(graphics_descriptor.frame_count)
+ vprint(f'{"Frame offsets block":26s} {fp.tell():5d}d / {fp.tell():04X}h')
+ frame_offsets.write(fp)
+
+ # Helper function to save each frame to the output file
+ def _write_frame(idx, frame, last_frame):
+ # If we replace the frame we're going to output with a delta, we can override it here
+ this_frame = frame
+ location = (0, 0)
+ size = frame.size
+
+ # Work out the format we're going to use
+ format = encoderinfo["qmk_format"]
+
+ # Convert the original frame so we can do comparisons
+ converted = qmk.painter.convert_requested_format(this_frame, format)
+ graphic_data = qmk.painter.convert_image_bytes(converted, format)
+
+ # Convert the raw data to RLE-encoded if requested
+ raw_data = graphic_data[1]
+ if use_rle:
+ rle_data = qmk.painter.compress_bytes_qmk_rle(graphic_data[1])
+ use_raw_this_frame = not use_rle or len(raw_data) <= len(rle_data)
+ image_data = raw_data if use_raw_this_frame else rle_data
+
+ # Work out if a delta frame is smaller than injecting it directly
+ use_delta_this_frame = False
+ if use_deltas and last_frame is not None:
+ # If we want to use deltas, then find the difference
+ diff = ImageChops.difference(frame, last_frame)
+
+ # Get the bounding box of those differences
+ bbox = diff.getbbox()
+
+ # If we have a valid bounding box...
+ if bbox:
+ # ...create the delta frame by cropping the original.
+ delta_frame = frame.crop(bbox)
+ delta_location = (bbox[0], bbox[1])
+ delta_size = (bbox[2] - bbox[0], bbox[3] - bbox[1])
+
+ # Convert the delta frame to the requested format
+ delta_converted = qmk.painter.convert_requested_format(delta_frame, format)
+ delta_graphic_data = qmk.painter.convert_image_bytes(delta_converted, format)
+
+ # Work out how large the delta frame is going to be with compression etc.
+ delta_raw_data = delta_graphic_data[1]
+ if use_rle:
+ delta_rle_data = qmk.painter.compress_bytes_qmk_rle(delta_graphic_data[1])
+ delta_use_raw_this_frame = not use_rle or len(delta_raw_data) <= len(delta_rle_data)
+ delta_image_data = delta_raw_data if delta_use_raw_this_frame else delta_rle_data
+
+ # If the size of the delta frame (plus delta descriptor) is smaller than the original, use that instead
+ # This ensures that if a non-delta is overall smaller in size, we use that in preference due to flash
+ # sizing constraints.
+ if (len(delta_image_data) + QGFFrameDeltaDescriptorV1.length) < len(image_data):
+ # Copy across all the delta equivalents so that the rest of the processing acts on those
+ this_frame = delta_frame
+ location = delta_location
+ size = delta_size
+ converted = delta_converted
+ graphic_data = delta_graphic_data
+ raw_data = delta_raw_data
+ rle_data = delta_rle_data
+ use_raw_this_frame = delta_use_raw_this_frame
+ image_data = delta_image_data
+ use_delta_this_frame = True
+
+ # Write out the frame descriptor
+ frame_offsets.frame_offsets[idx] = fp.tell()
+ vprint(f'{f"Frame {idx:3d} base":26s} {fp.tell():5d}d / {fp.tell():04X}h')
+ frame_descriptor = QGFFrameDescriptorV1()
+ frame_descriptor.is_delta = use_delta_this_frame
+ frame_descriptor.is_transparent = False
+ frame_descriptor.format = format['image_format_byte']
+ frame_descriptor.compression = 0x00 if use_raw_this_frame else 0x01 # See qp.h, painter_compression_t
+ frame_descriptor.delay = frame.info['duration'] if 'duration' in frame.info else 1000 # If we're not an animation, just pretend we're delaying for 1000ms
+ frame_descriptor.write(fp)
+
+ # Write out the palette if required
+ if format['has_palette']:
+ palette = graphic_data[0]
+ palette_descriptor = QGFFramePaletteDescriptorV1()
+
+ # Helper to convert from RGB888 to the QMK "dialect" of HSV888
+ def rgb888_to_qmk_hsv888(e):
+ hsv = rgb_to_hsv(e[0] / 255.0, e[1] / 255.0, e[2] / 255.0)
+ return (int(hsv[0] * 255.0), int(hsv[1] * 255.0), int(hsv[2] * 255.0))
+
+ # Convert all palette entries to HSV888 and write to the output
+ palette_descriptor.palette_entries = list(map(rgb888_to_qmk_hsv888, palette))
+ vprint(f'{f"Frame {idx:3d} palette":26s} {fp.tell():5d}d / {fp.tell():04X}h')
+ palette_descriptor.write(fp)
+
+ # Write out the delta info if required
+ if use_delta_this_frame:
+ # Set up the rendering location of where the delta frame should be situated
+ delta_descriptor = QGFFrameDeltaDescriptorV1()
+ delta_descriptor.left = location[0]
+ delta_descriptor.top = location[1]
+ delta_descriptor.right = location[0] + size[0]
+ delta_descriptor.bottom = location[1] + size[1]
+
+ # Write the delta frame to the output
+ vprint(f'{f"Frame {idx:3d} delta":26s} {fp.tell():5d}d / {fp.tell():04X}h')
+ delta_descriptor.write(fp)
+
+ # Write out the data for this frame to the output
+ data_descriptor = QGFFrameDataDescriptorV1()
+ data_descriptor.data = image_data
+ vprint(f'{f"Frame {idx:3d} data":26s} {fp.tell():5d}d / {fp.tell():04X}h')
+ data_descriptor.write(fp)
+
+ # Iterate over each if the input frames, writing it to the output in the process
+ _for_all_frames(_write_frame)
+
+ # Go back and update the graphics descriptor now that we can determine the final file size
+ graphics_descriptor.total_file_size = fp.tell()
+ fp.seek(graphics_descriptor_location, 0)
+ graphics_descriptor.write(fp)
+
+ # Go back and update the frame offsets now that they're written to the file
+ fp.seek(frame_offset_location, 0)
+ frame_offsets.write(fp)
+
+
+########################################################################################################################
+
+# Register with PIL so that it knows about the QGF format
+Image.register_open(QGFImageFile.format, QGFImageFile, _accept)
+Image.register_save(QGFImageFile.format, _save)
+Image.register_save_all(QGFImageFile.format, _save)
+Image.register_extension(QGFImageFile.format, f".{QGFImageFile.format.lower()}")
+Image.register_mime(QGFImageFile.format, f"image/{QGFImageFile.format.lower()}")
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py
index 55e69175e6..d40d4bf573 100644
--- a/lib/python/qmk/tests/test_cli_commands.py
+++ b/lib/python/qmk/tests/test_cli_commands.py
@@ -244,7 +244,7 @@ def test_clean():
def test_generate_api():
- result = check_subcommand('generate-api', '--dry-run')
+ result = check_subcommand('generate-api', '--dry-run', '--filter', 'handwired/pytest')
check_returncode(result)
@@ -259,7 +259,7 @@ def test_generate_config_h():
result = check_subcommand('generate-config-h', '-kb', 'handwired/pytest/basic')
check_returncode(result)
assert '# define DEVICE_VER 0x0001' in result.stdout
- assert '# define DESCRIPTION handwired/pytest/basic' in result.stdout
+ assert '# define DESCRIPTION "handwired/pytest/basic"' in result.stdout
assert '# define DIODE_DIRECTION COL2ROW' in result.stdout
assert '# define MANUFACTURER none' in result.stdout
assert '# define PRODUCT pytest' in result.stdout
diff --git a/platforms/arm_atsam/pin_defs.h b/platforms/arm_atsam/_pin_defs.h
index 5b50b23910..5b50b23910 100644
--- a/platforms/arm_atsam/pin_defs.h
+++ b/platforms/arm_atsam/_pin_defs.h
diff --git a/platforms/arm_atsam/bootloaders/md_boot.c b/platforms/arm_atsam/bootloaders/md_boot.c
index 32cf850448..1cf7aec62c 100644
--- a/platforms/arm_atsam/bootloaders/md_boot.c
+++ b/platforms/arm_atsam/bootloaders/md_boot.c
@@ -63,3 +63,7 @@ void bootloader_jump(void) {
while (1)
; // Wait on timeout
}
+
+__attribute__((weak)) void mcu_reset(void) {
+ NVIC_SystemReset();
+}
diff --git a/platforms/arm_atsam/hardware_id.c b/platforms/arm_atsam/hardware_id.c
new file mode 100644
index 0000000000..8b3b35a492
--- /dev/null
+++ b/platforms/arm_atsam/hardware_id.c
@@ -0,0 +1,9 @@
+// Copyright 2022 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "hardware_id.h"
+
+hardware_id_t get_hardware_id(void) {
+ hardware_id_t id = {0};
+ return id;
+}
diff --git a/platforms/avr/pin_defs.h b/platforms/avr/_pin_defs.h
index 3889704a87..3889704a87 100644
--- a/platforms/avr/pin_defs.h
+++ b/platforms/avr/_pin_defs.h
diff --git a/platforms/avr/bootloaders/bootloadhid.c b/platforms/avr/bootloaders/bootloadhid.c
index ae58760d7d..b91dca6d27 100644
--- a/platforms/avr/bootloaders/bootloadhid.c
+++ b/platforms/avr/bootloaders/bootloadhid.c
@@ -31,3 +31,10 @@ __attribute__((weak)) void bootloader_jump(void) {
for (;;)
;
}
+
+__attribute__((weak)) void mcu_reset(void) {
+ // watchdog reset
+ wdt_enable(WDTO_250MS);
+ for (;;)
+ ;
+}
diff --git a/platforms/avr/bootloaders/caterina.c b/platforms/avr/bootloaders/caterina.c
index 82a16a3765..2b5f613d6d 100644
--- a/platforms/avr/bootloaders/caterina.c
+++ b/platforms/avr/bootloaders/caterina.c
@@ -37,3 +37,12 @@ __attribute__((weak)) void bootloader_jump(void) {
while (1) {
}
}
+
+__attribute__((weak)) void mcu_reset(void) {
+ // setup watchdog timeout
+ wdt_enable(WDTO_60MS);
+
+ // wait for watchdog timer to trigger
+ while (1) {
+ }
+}
diff --git a/platforms/avr/bootloaders/custom.c b/platforms/avr/bootloaders/custom.c
index 624fbe242a..72b19f6671 100644
--- a/platforms/avr/bootloaders/custom.c
+++ b/platforms/avr/bootloaders/custom.c
@@ -15,5 +15,14 @@
*/
#include "bootloader.h"
+#include <avr/wdt.h>
__attribute__((weak)) void bootloader_jump(void) {}
+__attribute__((weak)) void mcu_reset(void) {
+ // setup watchdog timeout
+ wdt_enable(WDTO_60MS);
+
+ // wait for watchdog timer to trigger
+ while (1) {
+ }
+}
diff --git a/platforms/avr/bootloaders/dfu.c b/platforms/avr/bootloaders/dfu.c
index 06b2c8963a..dbbb5f4ab6 100644
--- a/platforms/avr/bootloaders/dfu.c
+++ b/platforms/avr/bootloaders/dfu.c
@@ -34,8 +34,15 @@ __attribute__((weak)) void bootloader_jump(void) {
UCSR1B = 0;
_delay_ms(5); // 5 seems to work fine
- // watchdog reset
reset_key = BOOTLOADER_RESET_KEY;
+ // watchdog reset
+ wdt_enable(WDTO_250MS);
+ for (;;)
+ ;
+}
+
+__attribute__((weak)) void mcu_reset(void) {
+ // watchdog reset
wdt_enable(WDTO_250MS);
for (;;)
;
diff --git a/platforms/avr/bootloaders/halfkay.c b/platforms/avr/bootloaders/halfkay.c
index 651696f988..402f5f2778 100644
--- a/platforms/avr/bootloaders/halfkay.c
+++ b/platforms/avr/bootloaders/halfkay.c
@@ -17,6 +17,7 @@
#include "bootloader.h"
#include <avr/interrupt.h>
+#include <avr/wdt.h>
#include <util/delay.h>
__attribute__((weak)) void bootloader_jump(void) {
@@ -126,3 +127,12 @@ __attribute__((weak)) void bootloader_jump(void) {
asm volatile("jmp 0x1FC00");
#endif
}
+
+__attribute__((weak)) void mcu_reset(void) {
+ // setup watchdog timeout
+ wdt_enable(WDTO_60MS);
+
+ // wait for watchdog timer to trigger
+ while (1) {
+ }
+}
diff --git a/platforms/avr/bootloaders/usbasploader.c b/platforms/avr/bootloaders/usbasploader.c
index 008bd16069..333010eefa 100644
--- a/platforms/avr/bootloaders/usbasploader.c
+++ b/platforms/avr/bootloaders/usbasploader.c
@@ -54,3 +54,12 @@ __attribute__((weak)) void bootloader_jump(void) {
#endif
[bootaddrme] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 8) & 0xff), [bootaddrlo] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 0) & 0xff));
}
+
+__attribute__((weak)) void mcu_reset(void) {
+ // setup watchdog timeout
+ wdt_enable(WDTO_15MS);
+
+ // wait for watchdog timer to trigger
+ while (1) {
+ }
+}
diff --git a/platforms/avr/drivers/hd44780.c b/platforms/avr/drivers/hd44780.c
deleted file mode 100644
index f15d7d0da8..0000000000
--- a/platforms/avr/drivers/hd44780.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/****************************************************************************
- Title: HD44780U LCD library
- Author: Peter Fleury <pfleury@gmx.ch> http://tinyurl.com/peterfleury
- License: GNU General Public License Version 3
- File: $Id: lcd.c,v 1.15.2.2 2015/01/17 12:16:05 peter Exp $
- Software: AVR-GCC 3.3
- Target: any AVR device, memory mapped mode only for AT90S4414/8515/Mega
-
- DESCRIPTION
- Basic routines for interfacing a HD44780U-based text lcd display
-
- Originally based on Volker Oth's lcd library,
- changed lcd_init(), added additional constants for lcd_command(),
- added 4-bit I/O mode, improved and optimized code.
-
- Library can be operated in memory mapped mode (LCD_IO_MODE=0) or in
- 4-bit IO port mode (LCD_IO_MODE=1). 8-bit IO port mode not supported.
-
- Memory mapped mode compatible with Kanda STK200, but supports also
- generation of R/W signal through A8 address line.
-
- USAGE
- See the C include lcd.h file for a description of each function
-
-*****************************************************************************/
-#include <inttypes.h>
-#include <avr/io.h>
-#include <avr/pgmspace.h>
-#include <util/delay.h>
-#include "hd44780.h"
-
-/*
-** constants/macros
-*/
-#define DDR(x) (*(&x - 1)) /* address of data direction register of port x */
-#if defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__)
-/* on ATmega64/128 PINF is on port 0x00 and not 0x60 */
-# define PIN(x) (&PORTF == &(x) ? _SFR_IO8(0x00) : (*(&x - 2)))
-#else
-# define PIN(x) (*(&x - 2)) /* address of input register of port x */
-#endif
-
-#if LCD_IO_MODE
-# define lcd_e_delay() _delay_us(LCD_DELAY_ENABLE_PULSE)
-# define lcd_e_high() LCD_E_PORT |= _BV(LCD_E_PIN);
-# define lcd_e_low() LCD_E_PORT &= ~_BV(LCD_E_PIN);
-# define lcd_e_toggle() toggle_e()
-# define lcd_rw_high() LCD_RW_PORT |= _BV(LCD_RW_PIN)
-# define lcd_rw_low() LCD_RW_PORT &= ~_BV(LCD_RW_PIN)
-# define lcd_rs_high() LCD_RS_PORT |= _BV(LCD_RS_PIN)
-# define lcd_rs_low() LCD_RS_PORT &= ~_BV(LCD_RS_PIN)
-#endif
-
-#if LCD_IO_MODE
-# if LCD_LINES == 1
-# define LCD_FUNCTION_DEFAULT LCD_FUNCTION_4BIT_1LINE
-# else
-# define LCD_FUNCTION_DEFAULT LCD_FUNCTION_4BIT_2LINES
-# endif
-#else
-# if LCD_LINES == 1
-# define LCD_FUNCTION_DEFAULT LCD_FUNCTION_8BIT_1LINE
-# else
-# define LCD_FUNCTION_DEFAULT LCD_FUNCTION_8BIT_2LINES
-# endif
-#endif
-
-#if LCD_CONTROLLER_KS0073
-# if LCD_LINES == 4
-
-# define KS0073_EXTENDED_FUNCTION_REGISTER_ON 0x2C /* |0|010|1100 4-bit mode, extension-bit RE = 1 */
-# define KS0073_EXTENDED_FUNCTION_REGISTER_OFF 0x28 /* |0|010|1000 4-bit mode, extension-bit RE = 0 */
-# define KS0073_4LINES_MODE 0x09 /* |0|000|1001 4 lines mode */
-
-# endif
-#endif
-
-/*
-** function prototypes
-*/
-#if LCD_IO_MODE
-static void toggle_e(void);
-#endif
-
-/*
-** local functions
-*/
-
-/*************************************************************************
-delay for a minimum of <us> microseconds
-the number of loops is calculated at compile-time from MCU clock frequency
-*************************************************************************/
-#define delay(us) _delay_us(us)
-
-#if LCD_IO_MODE
-/* toggle Enable Pin to initiate write */
-static void toggle_e(void) {
- lcd_e_high();
- lcd_e_delay();
- lcd_e_low();
-}
-#endif
-
-/*************************************************************************
-Low-level function to write byte to LCD controller
-Input: data byte to write to LCD
- rs 1: write data
- 0: write instruction
-Returns: none
-*************************************************************************/
-#if LCD_IO_MODE
-static void lcd_write(uint8_t data, uint8_t rs) {
- unsigned char dataBits;
-
- if (rs) { /* write data (RS=1, RW=0) */
- lcd_rs_high();
- } else { /* write instruction (RS=0, RW=0) */
- lcd_rs_low();
- }
- lcd_rw_low(); /* RW=0 write mode */
-
- if ((&LCD_DATA0_PORT == &LCD_DATA1_PORT) && (&LCD_DATA1_PORT == &LCD_DATA2_PORT) && (&LCD_DATA2_PORT == &LCD_DATA3_PORT) && (LCD_DATA0_PIN == 0) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3)) {
- /* configure data pins as output */
- DDR(LCD_DATA0_PORT) |= 0x0F;
-
- /* output high nibble first */
- dataBits = LCD_DATA0_PORT & 0xF0;
- LCD_DATA0_PORT = dataBits | ((data >> 4) & 0x0F);
- lcd_e_toggle();
-
- /* output low nibble */
- LCD_DATA0_PORT = dataBits | (data & 0x0F);
- lcd_e_toggle();
-
- /* all data pins high (inactive) */
- LCD_DATA0_PORT = dataBits | 0x0F;
- } else {
- /* configure data pins as output */
- DDR(LCD_DATA0_PORT) |= _BV(LCD_DATA0_PIN);
- DDR(LCD_DATA1_PORT) |= _BV(LCD_DATA1_PIN);
- DDR(LCD_DATA2_PORT) |= _BV(LCD_DATA2_PIN);
- DDR(LCD_DATA3_PORT) |= _BV(LCD_DATA3_PIN);
-
- /* output high nibble first */
- LCD_DATA3_PORT &= ~_BV(LCD_DATA3_PIN);
- LCD_DATA2_PORT &= ~_BV(LCD_DATA2_PIN);
- LCD_DATA1_PORT &= ~_BV(LCD_DATA1_PIN);
- LCD_DATA0_PORT &= ~_BV(LCD_DATA0_PIN);
- if (data & 0x80) LCD_DATA3_PORT |= _BV(LCD_DATA3_PIN);
- if (data & 0x40) LCD_DATA2_PORT |= _BV(LCD_DATA2_PIN);
- if (data & 0x20) LCD_DATA1_PORT |= _BV(LCD_DATA1_PIN);
- if (data & 0x10) LCD_DATA0_PORT |= _BV(LCD_DATA0_PIN);
- lcd_e_toggle();
-
- /* output low nibble */
- LCD_DATA3_PORT &= ~_BV(LCD_DATA3_PIN);
- LCD_DATA2_PORT &= ~_BV(LCD_DATA2_PIN);
- LCD_DATA1_PORT &= ~_BV(LCD_DATA1_PIN);
- LCD_DATA0_PORT &= ~_BV(LCD_DATA0_PIN);
- if (data & 0x08) LCD_DATA3_PORT |= _BV(LCD_DATA3_PIN);
- if (data & 0x04) LCD_DATA2_PORT |= _BV(LCD_DATA2_PIN);
- if (data & 0x02) LCD_DATA1_PORT |= _BV(LCD_DATA1_PIN);
- if (data & 0x01) LCD_DATA0_PORT |= _BV(LCD_DATA0_PIN);
- lcd_e_toggle();
-
- /* all data pins high (inactive) */
- LCD_DATA0_PORT |= _BV(LCD_DATA0_PIN);
- LCD_DATA1_PORT |= _BV(LCD_DATA1_PIN);
- LCD_DATA2_PORT |= _BV(LCD_DATA2_PIN);
- LCD_DATA3_PORT |= _BV(LCD_DATA3_PIN);
- }
-}
-#else
-# define lcd_write(d, rs) \
- if (rs) \
- *(volatile uint8_t *)(LCD_IO_DATA) = d; \
- else \
- *(volatile uint8_t *)(LCD_IO_FUNCTION) = d;
-/* rs==0 -> write instruction to LCD_IO_FUNCTION */
-/* rs==1 -> write data to LCD_IO_DATA */
-#endif
-
-/*************************************************************************
-Low-level function to read byte from LCD controller
-Input: rs 1: read data
- 0: read busy flag / address counter
-Returns: byte read from LCD controller
-*************************************************************************/
-#if LCD_IO_MODE
-static uint8_t lcd_read(uint8_t rs) {
- uint8_t data;
-
- if (rs)
- lcd_rs_high(); /* RS=1: read data */
- else
- lcd_rs_low(); /* RS=0: read busy flag */
- lcd_rw_high(); /* RW=1 read mode */
-
- if ((&LCD_DATA0_PORT == &LCD_DATA1_PORT) && (&LCD_DATA1_PORT == &LCD_DATA2_PORT) && (&LCD_DATA2_PORT == &LCD_DATA3_PORT) && (LCD_DATA0_PIN == 0) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3)) {
- DDR(LCD_DATA0_PORT) &= 0xF0; /* configure data pins as input */
-
- lcd_e_high();
- lcd_e_delay();
- data = PIN(LCD_DATA0_PORT) << 4; /* read high nibble first */
- lcd_e_low();
-
- lcd_e_delay(); /* Enable 500ns low */
-
- lcd_e_high();
- lcd_e_delay();
- data |= PIN(LCD_DATA0_PORT) & 0x0F; /* read low nibble */
- lcd_e_low();
- } else {
- /* configure data pins as input */
- DDR(LCD_DATA0_PORT) &= ~_BV(LCD_DATA0_PIN);
- DDR(LCD_DATA1_PORT) &= ~_BV(LCD_DATA1_PIN);
- DDR(LCD_DATA2_PORT) &= ~_BV(LCD_DATA2_PIN);
- DDR(LCD_DATA3_PORT) &= ~_BV(LCD_DATA3_PIN);
-
- /* read high nibble first */
- lcd_e_high();
- lcd_e_delay();
- data = 0;
- if (PIN(LCD_DATA0_PORT) & _BV(LCD_DATA0_PIN)) data |= 0x10;
- if (PIN(LCD_DATA1_PORT) & _BV(LCD_DATA1_PIN)) data |= 0x20;
- if (PIN(LCD_DATA2_PORT) & _BV(LCD_DATA2_PIN)) data |= 0x40;
- if (PIN(LCD_DATA3_PORT) & _BV(LCD_DATA3_PIN)) data |= 0x80;
- lcd_e_low();
-
- lcd_e_delay(); /* Enable 500ns low */
-
- /* read low nibble */
- lcd_e_high();
- lcd_e_delay();
- if (PIN(LCD_DATA0_PORT) & _BV(LCD_DATA0_PIN)) data |= 0x01;
- if (PIN(LCD_DATA1_PORT) & _BV(LCD_DATA1_PIN)) data |= 0x02;
- if (PIN(LCD_DATA2_PORT) & _BV(LCD_DATA2_PIN)) data |= 0x04;
- if (PIN(LCD_DATA3_PORT) & _BV(LCD_DATA3_PIN)) data |= 0x08;
- lcd_e_low();
- }
- return data;
-}
-#else
-# define lcd_read(rs) (rs) ? *(volatile uint8_t *)(LCD_IO_DATA + LCD_IO_READ) : *(volatile uint8_t *)(LCD_IO_FUNCTION + LCD_IO_READ)
-/* rs==0 -> read instruction from LCD_IO_FUNCTION */
-/* rs==1 -> read data from LCD_IO_DATA */
-#endif
-
-/*************************************************************************
-loops while lcd is busy, returns address counter
-*************************************************************************/
-static uint8_t lcd_waitbusy(void)
-
-{
- register uint8_t c;
-
- /* wait until busy flag is cleared */
- while ((c = lcd_read(0)) & (1 << LCD_BUSY)) {
- }
-
- /* the address counter is updated 4us after the busy flag is cleared */
- delay(LCD_DELAY_BUSY_FLAG);
-
- /* now read the address counter */
- return (lcd_read(0)); // return address counter
-
-} /* lcd_waitbusy */
-
-/*************************************************************************
-Move cursor to the start of next line or to the first line if the cursor
-is already on the last line.
-*************************************************************************/
-static inline void lcd_newline(uint8_t pos) {
- register uint8_t addressCounter;
-
-#if LCD_LINES == 1
- addressCounter = 0;
-#endif
-#if LCD_LINES == 2
- if (pos < (LCD_START_LINE2))
- addressCounter = LCD_START_LINE2;
- else
- addressCounter = LCD_START_LINE1;
-#endif
-#if LCD_LINES == 4
-# if KS0073_4LINES_MODE
- if (pos < LCD_START_LINE2)
- addressCounter = LCD_START_LINE2;
- else if ((pos >= LCD_START_LINE2) && (pos < LCD_START_LINE3))
- addressCounter = LCD_START_LINE3;
- else if ((pos >= LCD_START_LINE3) && (pos < LCD_START_LINE4))
- addressCounter = LCD_START_LINE4;
- else
- addressCounter = LCD_START_LINE1;
-# else
- if (pos < LCD_START_LINE3)
- addressCounter = LCD_START_LINE2;
- else if ((pos >= LCD_START_LINE2) && (pos < LCD_START_LINE4))
- addressCounter = LCD_START_LINE3;
- else if ((pos >= LCD_START_LINE3) && (pos < LCD_START_LINE2))
- addressCounter = LCD_START_LINE4;
- else
- addressCounter = LCD_START_LINE1;
-# endif
-#endif
- lcd_command((1 << LCD_DDRAM) + addressCounter);
-
-} /* lcd_newline */
-
-/*
-** PUBLIC FUNCTIONS
-*/
-
-/*************************************************************************
-Send LCD controller instruction command
-Input: instruction to send to LCD controller, see HD44780 data sheet
-Returns: none
-*************************************************************************/
-void lcd_command(uint8_t cmd) {
- lcd_waitbusy();
- lcd_write(cmd, 0);
-}
-
-/*************************************************************************
-Send data byte to LCD controller
-Input: data to send to LCD controller, see HD44780 data sheet
-Returns: none
-*************************************************************************/
-void lcd_data(uint8_t data) {
- lcd_waitbusy();
- lcd_write(data, 1);
-}
-
-/*************************************************************************
-Set cursor to specified position
-Input: x horizontal position (0: left most position)
- y vertical position (0: first line)
-Returns: none
-*************************************************************************/
-void lcd_gotoxy(uint8_t x, uint8_t y) {
-#if LCD_LINES == 1
- lcd_command((1 << LCD_DDRAM) + LCD_START_LINE1 + x);
-#endif
-#if LCD_LINES == 2
- if (y == 0)
- lcd_command((1 << LCD_DDRAM) + LCD_START_LINE1 + x);
- else
- lcd_command((1 << LCD_DDRAM) + LCD_START_LINE2 + x);
-#endif
-#if LCD_LINES == 4
- if (y == 0)
- lcd_command((1 << LCD_DDRAM) + LCD_START_LINE1 + x);
- else if (y == 1)
- lcd_command((1 << LCD_DDRAM) + LCD_START_LINE2 + x);
- else if (y == 2)
- lcd_command((1 << LCD_DDRAM) + LCD_START_LINE3 + x);
- else /* y==3 */
- lcd_command((1 << LCD_DDRAM) + LCD_START_LINE4 + x);
-#endif
-
-} /* lcd_gotoxy */
-
-/*************************************************************************
-*************************************************************************/
-int lcd_getxy(void) {
- return lcd_waitbusy();
-}
-
-/*************************************************************************
-Clear display and set cursor to home position
-*************************************************************************/
-void lcd_clrscr(void) {
- lcd_command(1 << LCD_CLR);
-}
-
-/*************************************************************************
-Set cursor to home position
-*************************************************************************/
-void lcd_home(void) {
- lcd_command(1 << LCD_HOME);
-}
-
-/*************************************************************************
-Display character at current cursor position
-Input: character to be displayed
-Returns: none
-*************************************************************************/
-void lcd_putc(char c) {
- uint8_t pos;
-
- pos = lcd_waitbusy(); // read busy-flag and address counter
- if (c == '\n') {
- lcd_newline(pos);
- } else {
-#if LCD_WRAP_LINES == 1
-# if LCD_LINES == 1
- if (pos == LCD_START_LINE1 + LCD_DISP_LENGTH) {
- lcd_write((1 << LCD_DDRAM) + LCD_START_LINE1, 0);
- }
-# elif LCD_LINES == 2
- if (pos == LCD_START_LINE1 + LCD_DISP_LENGTH) {
- lcd_write((1 << LCD_DDRAM) + LCD_START_LINE2, 0);
- } else if (pos == LCD_START_LINE2 + LCD_DISP_LENGTH) {
- lcd_write((1 << LCD_DDRAM) + LCD_START_LINE1, 0);
- }
-# elif LCD_LINES == 4
- if (pos == LCD_START_LINE1 + LCD_DISP_LENGTH) {
- lcd_write((1 << LCD_DDRAM) + LCD_START_LINE2, 0);
- } else if (pos == LCD_START_LINE2 + LCD_DISP_LENGTH) {
- lcd_write((1 << LCD_DDRAM) + LCD_START_LINE3, 0);
- } else if (pos == LCD_START_LINE3 + LCD_DISP_LENGTH) {
- lcd_write((1 << LCD_DDRAM) + LCD_START_LINE4, 0);
- } else if (pos == LCD_START_LINE4 + LCD_DISP_LENGTH) {
- lcd_write((1 << LCD_DDRAM) + LCD_START_LINE1, 0);
- }
-# endif
- lcd_waitbusy();
-#endif
- lcd_write(c, 1);
- }
-
-} /* lcd_putc */
-
-/*************************************************************************
-Display string without auto linefeed
-Input: string to be displayed
-Returns: none
-*************************************************************************/
-void lcd_puts(const char *s)
-/* print string on lcd (no auto linefeed) */
-{
- register char c;
-
- while ((c = *s++)) {
- lcd_putc(c);
- }
-
-} /* lcd_puts */
-
-/*************************************************************************
-Display string from program memory without auto linefeed
-Input: string from program memory be be displayed
-Returns: none
-*************************************************************************/
-void lcd_puts_p(const char *progmem_s)
-/* print string from program memory on lcd (no auto linefeed) */
-{
- register char c;
-
- while ((c = pgm_read_byte(progmem_s++))) {
- lcd_putc(c);
- }
-
-} /* lcd_puts_p */
-
-/*************************************************************************
-Initialize display and select type of cursor
-Input: dispAttr LCD_DISP_OFF display off
- LCD_DISP_ON display on, cursor off
- LCD_DISP_ON_CURSOR display on, cursor on
- LCD_DISP_CURSOR_BLINK display on, cursor on flashing
-Returns: none
-*************************************************************************/
-void lcd_init(uint8_t dispAttr) {
-#if LCD_IO_MODE
- /*
- * Initialize LCD to 4 bit I/O mode
- */
-
- if ((&LCD_DATA0_PORT == &LCD_DATA1_PORT) && (&LCD_DATA1_PORT == &LCD_DATA2_PORT) && (&LCD_DATA2_PORT == &LCD_DATA3_PORT) && (&LCD_RS_PORT == &LCD_DATA0_PORT) && (&LCD_RW_PORT == &LCD_DATA0_PORT) && (&LCD_E_PORT == &LCD_DATA0_PORT) && (LCD_DATA0_PIN == 0) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3) && (LCD_RS_PIN == 4) && (LCD_RW_PIN == 5) && (LCD_E_PIN == 6)) {
- /* configure all port bits as output (all LCD lines on same port) */
- DDR(LCD_DATA0_PORT) |= 0x7F;
- } else if ((&LCD_DATA0_PORT == &LCD_DATA1_PORT) && (&LCD_DATA1_PORT == &LCD_DATA2_PORT) && (&LCD_DATA2_PORT == &LCD_DATA3_PORT) && (LCD_DATA0_PIN == 0) && (LCD_DATA1_PIN == 1) && (LCD_DATA2_PIN == 2) && (LCD_DATA3_PIN == 3)) {
- /* configure all port bits as output (all LCD data lines on same port, but control lines on different ports) */
- DDR(LCD_DATA0_PORT) |= 0x0F;
- DDR(LCD_RS_PORT) |= _BV(LCD_RS_PIN);
- DDR(LCD_RW_PORT) |= _BV(LCD_RW_PIN);
- DDR(LCD_E_PORT) |= _BV(LCD_E_PIN);
- } else {
- /* configure all port bits as output (LCD data and control lines on different ports */
- DDR(LCD_RS_PORT) |= _BV(LCD_RS_PIN);
- DDR(LCD_RW_PORT) |= _BV(LCD_RW_PIN);
- DDR(LCD_E_PORT) |= _BV(LCD_E_PIN);
- DDR(LCD_DATA0_PORT) |= _BV(LCD_DATA0_PIN);
- DDR(LCD_DATA1_PORT) |= _BV(LCD_DATA1_PIN);
- DDR(LCD_DATA2_PORT) |= _BV(LCD_DATA2_PIN);
- DDR(LCD_DATA3_PORT) |= _BV(LCD_DATA3_PIN);
- }
- delay(LCD_DELAY_BOOTUP); /* wait 16ms or more after power-on */
-
- /* initial write to lcd is 8bit */
- LCD_DATA1_PORT |= _BV(LCD_DATA1_PIN); // LCD_FUNCTION>>4;
- LCD_DATA0_PORT |= _BV(LCD_DATA0_PIN); // LCD_FUNCTION_8BIT>>4;
- lcd_e_toggle();
- delay(LCD_DELAY_INIT); /* delay, busy flag can't be checked here */
-
- /* repeat last command */
- lcd_e_toggle();
- delay(LCD_DELAY_INIT_REP); /* delay, busy flag can't be checked here */
-
- /* repeat last command a third time */
- lcd_e_toggle();
- delay(LCD_DELAY_INIT_REP); /* delay, busy flag can't be checked here */
-
- /* now configure for 4bit mode */
- LCD_DATA0_PORT &= ~_BV(LCD_DATA0_PIN); // LCD_FUNCTION_4BIT_1LINE>>4
- lcd_e_toggle();
- delay(LCD_DELAY_INIT_4BIT); /* some displays need this additional delay */
-
- /* from now the LCD only accepts 4 bit I/O, we can use lcd_command() */
-#else
- /*
- * Initialize LCD to 8 bit memory mapped mode
- */
-
- /* enable external SRAM (memory mapped lcd) and one wait state */
- MCUCR = _BV(SRE) | _BV(SRW);
-
- /* reset LCD */
- delay(LCD_DELAY_BOOTUP); /* wait 16ms after power-on */
- lcd_write(LCD_FUNCTION_8BIT_1LINE, 0); /* function set: 8bit interface */
- delay(LCD_DELAY_INIT); /* wait 5ms */
- lcd_write(LCD_FUNCTION_8BIT_1LINE, 0); /* function set: 8bit interface */
- delay(LCD_DELAY_INIT_REP); /* wait 64us */
- lcd_write(LCD_FUNCTION_8BIT_1LINE, 0); /* function set: 8bit interface */
- delay(LCD_DELAY_INIT_REP); /* wait 64us */
-#endif
-
-#if KS0073_4LINES_MODE
- /* Display with KS0073 controller requires special commands for enabling 4 line mode */
- lcd_command(KS0073_EXTENDED_FUNCTION_REGISTER_ON);
- lcd_command(KS0073_4LINES_MODE);
- lcd_command(KS0073_EXTENDED_FUNCTION_REGISTER_OFF);
-#else
- lcd_command(LCD_FUNCTION_DEFAULT); /* function set: display lines */
-#endif
- lcd_command(LCD_DISP_OFF); /* display off */
- lcd_clrscr(); /* display clear */
- lcd_command(LCD_MODE_DEFAULT); /* set entry mode */
- lcd_command(dispAttr); /* display/cursor control */
-
-} /* lcd_init */
diff --git a/platforms/avr/drivers/hd44780.h b/platforms/avr/drivers/hd44780.h
deleted file mode 100644
index 08e60f8a44..0000000000
--- a/platforms/avr/drivers/hd44780.h
+++ /dev/null
@@ -1,348 +0,0 @@
-/*************************************************************************
- Title : C include file for the HD44780U LCD library (lcd.c)
- Author: Peter Fleury <pfleury@gmx.ch> http://tinyurl.com/peterfleury
- License: GNU General Public License Version 3
- File: $Id: lcd.h,v 1.14.2.4 2015/01/20 17:16:07 peter Exp $
- Software: AVR-GCC 4.x
- Hardware: any AVR device, memory mapped mode only for AVR with
- memory mapped interface (AT90S8515/ATmega8515/ATmega128)
-***************************************************************************/
-
-/**
- @mainpage
- Collection of libraries for AVR-GCC
- @author Peter Fleury pfleury@gmx.ch http://tinyurl.com/peterfleury
- @copyright (C) 2015 Peter Fleury, GNU General Public License Version 3
-
- @file
- @defgroup pfleury_lcd LCD library <lcd.h>
- @code #include <lcd.h> @endcode
-
- @brief Basic routines for interfacing a HD44780U-based character LCD display
-
- LCD character displays can be found in many devices, like espresso machines, laser printers.
- The Hitachi HD44780 controller and its compatible controllers like Samsung KS0066U have become an industry standard for these types of displays.
-
- This library allows easy interfacing with a HD44780 compatible display and can be
- operated in memory mapped mode (LCD_IO_MODE defined as 0 in the include file lcd.h.) or in
- 4-bit IO port mode (LCD_IO_MODE defined as 1). 8-bit IO port mode is not supported.
-
- Memory mapped mode is compatible with old Kanda STK200 starter kit, but also supports
- generation of R/W signal through A8 address line.
-
- @see The chapter <a href=" http://homepage.hispeed.ch/peterfleury/avr-lcd44780.html" target="_blank">Interfacing a HD44780 Based LCD to an AVR</a>
- on my home page, which shows example circuits how to connect an LCD to an AVR controller.
-
- @author Peter Fleury pfleury@gmx.ch http://tinyurl.com/peterfleury
-
- @version 2.0
-
- @copyright (C) 2015 Peter Fleury, GNU General Public License Version 3
-
-*/
-
-#pragma once
-
-#include <inttypes.h>
-#include <avr/pgmspace.h>
-
-#if (__GNUC__ * 100 + __GNUC_MINOR__) < 405
-# error "This library requires AVR-GCC 4.5 or later, update to newer AVR-GCC compiler !"
-#endif
-
-/**@{*/
-
-/*
- * LCD and target specific definitions below can be defined in a separate include file with name lcd_definitions.h instead modifying this file
- * by adding -D_LCD_DEFINITIONS_FILE to the CDEFS section in the Makefile
- * All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h
- */
-#ifdef _LCD_DEFINITIONS_FILE
-# include "lcd_definitions.h"
-#endif
-
-/**
- * @name Definition for LCD controller type
- * Use 0 for HD44780 controller, change to 1 for displays with KS0073 controller.
- */
-#ifndef LCD_CONTROLLER_KS0073
-# define LCD_CONTROLLER_KS0073 0 /**< Use 0 for HD44780 controller, 1 for KS0073 controller */
-#endif
-
-/**
- * @name Definitions for Display Size
- * Change these definitions to adapt setting to your display
- *
- * These definitions can be defined in a separate include file \b lcd_definitions.h instead modifying this file by
- * adding -D_LCD_DEFINITIONS_FILE to the CDEFS section in the Makefile.
- * All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h
- *
- */
-#ifndef LCD_LINES
-# define LCD_LINES 2 /**< number of visible lines of the display */
-#endif
-#ifndef LCD_DISP_LENGTH
-# define LCD_DISP_LENGTH 16 /**< visibles characters per line of the display */
-#endif
-#ifndef LCD_LINE_LENGTH
-# define LCD_LINE_LENGTH 0x40 /**< internal line length of the display */
-#endif
-#ifndef LCD_START_LINE1
-# define LCD_START_LINE1 0x00 /**< DDRAM address of first char of line 1 */
-#endif
-#ifndef LCD_START_LINE2
-# define LCD_START_LINE2 0x40 /**< DDRAM address of first char of line 2 */
-#endif
-#ifndef LCD_START_LINE3
-# define LCD_START_LINE3 0x14 /**< DDRAM address of first char of line 3 */
-#endif
-#ifndef LCD_START_LINE4
-# define LCD_START_LINE4 0x54 /**< DDRAM address of first char of line 4 */
-#endif
-#ifndef LCD_WRAP_LINES
-# define LCD_WRAP_LINES 0 /**< 0: no wrap, 1: wrap at end of visibile line */
-#endif
-
-/**
- * @name Definitions for 4-bit IO mode
- *
- * The four LCD data lines and the three control lines RS, RW, E can be on the
- * same port or on different ports.
- * Change LCD_RS_PORT, LCD_RW_PORT, LCD_E_PORT if you want the control lines on
- * different ports.
- *
- * Normally the four data lines should be mapped to bit 0..3 on one port, but it
- * is possible to connect these data lines in different order or even on different
- * ports by adapting the LCD_DATAx_PORT and LCD_DATAx_PIN definitions.
- *
- * Adjust these definitions to your target.\n
- * These definitions can be defined in a separate include file \b lcd_definitions.h instead modifying this file by
- * adding \b -D_LCD_DEFINITIONS_FILE to the \b CDEFS section in the Makefile.
- * All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h
- *
- */
-#define LCD_IO_MODE 1 /**< 0: memory mapped mode, 1: IO port mode */
-
-#if LCD_IO_MODE
-
-# ifndef LCD_PORT
-# define LCD_PORT PORTA /**< port for the LCD lines */
-# endif
-# ifndef LCD_DATA0_PORT
-# define LCD_DATA0_PORT LCD_PORT /**< port for 4bit data bit 0 */
-# endif
-# ifndef LCD_DATA1_PORT
-# define LCD_DATA1_PORT LCD_PORT /**< port for 4bit data bit 1 */
-# endif
-# ifndef LCD_DATA2_PORT
-# define LCD_DATA2_PORT LCD_PORT /**< port for 4bit data bit 2 */
-# endif
-# ifndef LCD_DATA3_PORT
-# define LCD_DATA3_PORT LCD_PORT /**< port for 4bit data bit 3 */
-# endif
-# ifndef LCD_DATA0_PIN
-# define LCD_DATA0_PIN 4 /**< pin for 4bit data bit 0 */
-# endif
-# ifndef LCD_DATA1_PIN
-# define LCD_DATA1_PIN 5 /**< pin for 4bit data bit 1 */
-# endif
-# ifndef LCD_DATA2_PIN
-# define LCD_DATA2_PIN 6 /**< pin for 4bit data bit 2 */
-# endif
-# ifndef LCD_DATA3_PIN
-# define LCD_DATA3_PIN 7 /**< pin for 4bit data bit 3 */
-# endif
-# ifndef LCD_RS_PORT
-# define LCD_RS_PORT LCD_PORT /**< port for RS line */
-# endif
-# ifndef LCD_RS_PIN
-# define LCD_RS_PIN 3 /**< pin for RS line */
-# endif
-# ifndef LCD_RW_PORT
-# define LCD_RW_PORT LCD_PORT /**< port for RW line */
-# endif
-# ifndef LCD_RW_PIN
-# define LCD_RW_PIN 2 /**< pin for RW line */
-# endif
-# ifndef LCD_E_PORT
-# define LCD_E_PORT LCD_PORT /**< port for Enable line */
-# endif
-# ifndef LCD_E_PIN
-# define LCD_E_PIN 1 /**< pin for Enable line */
-# endif
-
-#elif defined(__AVR_AT90S4414__) || defined(__AVR_AT90S8515__) || defined(__AVR_ATmega64__) || defined(__AVR_ATmega8515__) || defined(__AVR_ATmega103__) || defined(__AVR_ATmega128__) || defined(__AVR_ATmega161__) || defined(__AVR_ATmega162__)
-/*
- * memory mapped mode is only supported when the device has an external data memory interface
- */
-# define LCD_IO_DATA 0xC000 /* A15=E=1, A14=RS=1 */
-# define LCD_IO_FUNCTION 0x8000 /* A15=E=1, A14=RS=0 */
-# define LCD_IO_READ 0x0100 /* A8 =R/W=1 (R/W: 1=Read, 0=Write */
-
-#else
-# error "external data memory interface not available for this device, use 4-bit IO port mode"
-
-#endif
-
-/**
- * @name Definitions of delays
- * Used to calculate delay timers.
- * Adapt the F_CPU define in the Makefile to the clock frequency in Hz of your target
- *
- * These delay times can be adjusted, if some displays require different delays.\n
- * These definitions can be defined in a separate include file \b lcd_definitions.h instead modifying this file by
- * adding \b -D_LCD_DEFINITIONS_FILE to the \b CDEFS section in the Makefile.
- * All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h
- */
-#ifndef LCD_DELAY_BOOTUP
-# define LCD_DELAY_BOOTUP 16000 /**< delay in micro seconds after power-on */
-#endif
-#ifndef LCD_DELAY_INIT
-# define LCD_DELAY_INIT 5000 /**< delay in micro seconds after initialization command sent */
-#endif
-#ifndef LCD_DELAY_INIT_REP
-# define LCD_DELAY_INIT_REP 64 /**< delay in micro seconds after initialization command repeated */
-#endif
-#ifndef LCD_DELAY_INIT_4BIT
-# define LCD_DELAY_INIT_4BIT 64 /**< delay in micro seconds after setting 4-bit mode */
-#endif
-#ifndef LCD_DELAY_BUSY_FLAG
-# define LCD_DELAY_BUSY_FLAG 4 /**< time in micro seconds the address counter is updated after busy flag is cleared */
-#endif
-#ifndef LCD_DELAY_ENABLE_PULSE
-# define LCD_DELAY_ENABLE_PULSE 1 /**< enable signal pulse width in micro seconds */
-#endif
-
-/**
- * @name Definitions for LCD command instructions
- * The constants define the various LCD controller instructions which can be passed to the
- * function lcd_command(), see HD44780 data sheet for a complete description.
- */
-
-/* instruction register bit positions, see HD44780U data sheet */
-#define LCD_CLR 0 /* DB0: clear display */
-#define LCD_HOME 1 /* DB1: return to home position */
-#define LCD_ENTRY_MODE 2 /* DB2: set entry mode */
-#define LCD_ENTRY_INC 1 /* DB1: 1=increment, 0=decrement */
-#define LCD_ENTRY_SHIFT 0 /* DB2: 1=display shift on */
-#define LCD_ON 3 /* DB3: turn lcd/cursor on */
-#define LCD_ON_DISPLAY 2 /* DB2: turn display on */
-#define LCD_ON_CURSOR 1 /* DB1: turn cursor on */
-#define LCD_ON_BLINK 0 /* DB0: blinking cursor ? */
-#define LCD_MOVE 4 /* DB4: move cursor/display */
-#define LCD_MOVE_DISP 3 /* DB3: move display (0-> cursor) ? */
-#define LCD_MOVE_RIGHT 2 /* DB2: move right (0-> left) ? */
-#define LCD_FUNCTION 5 /* DB5: function set */
-#define LCD_FUNCTION_8BIT 4 /* DB4: set 8BIT mode (0->4BIT mode) */
-#define LCD_FUNCTION_2LINES 3 /* DB3: two lines (0->one line) */
-#define LCD_FUNCTION_10DOTS 2 /* DB2: 5x10 font (0->5x7 font) */
-#define LCD_CGRAM 6 /* DB6: set CG RAM address */
-#define LCD_DDRAM 7 /* DB7: set DD RAM address */
-#define LCD_BUSY 7 /* DB7: LCD is busy */
-
-/* set entry mode: display shift on/off, dec/inc cursor move direction */
-#define LCD_ENTRY_DEC 0x04 /* display shift off, dec cursor move dir */
-#define LCD_ENTRY_DEC_SHIFT 0x05 /* display shift on, dec cursor move dir */
-#define LCD_ENTRY_INC_ 0x06 /* display shift off, inc cursor move dir */
-#define LCD_ENTRY_INC_SHIFT 0x07 /* display shift on, inc cursor move dir */
-
-/* display on/off, cursor on/off, blinking char at cursor position */
-#define LCD_DISP_OFF 0x08 /* display off */
-#define LCD_DISP_ON 0x0C /* display on, cursor off */
-#define LCD_DISP_ON_BLINK 0x0D /* display on, cursor off, blink char */
-#define LCD_DISP_ON_CURSOR 0x0E /* display on, cursor on */
-#define LCD_DISP_ON_CURSOR_BLINK 0x0F /* display on, cursor on, blink char */
-
-/* move cursor/shift display */
-#define LCD_MOVE_CURSOR_LEFT 0x10 /* move cursor left (decrement) */
-#define LCD_MOVE_CURSOR_RIGHT 0x14 /* move cursor right (increment) */
-#define LCD_MOVE_DISP_LEFT 0x18 /* shift display left */
-#define LCD_MOVE_DISP_RIGHT 0x1C /* shift display right */
-
-/* function set: set interface data length and number of display lines */
-#define LCD_FUNCTION_4BIT_1LINE 0x20 /* 4-bit interface, single line, 5x7 dots */
-#define LCD_FUNCTION_4BIT_2LINES 0x28 /* 4-bit interface, dual line, 5x7 dots */
-#define LCD_FUNCTION_8BIT_1LINE 0x30 /* 8-bit interface, single line, 5x7 dots */
-#define LCD_FUNCTION_8BIT_2LINES 0x38 /* 8-bit interface, dual line, 5x7 dots */
-
-#define LCD_MODE_DEFAULT ((1 << LCD_ENTRY_MODE) | (1 << LCD_ENTRY_INC))
-
-/**
- * @name Functions
- */
-
-/**
- @brief Initialize display and select type of cursor
- @param dispAttr \b LCD_DISP_OFF display off\n
- \b LCD_DISP_ON display on, cursor off\n
- \b LCD_DISP_ON_CURSOR display on, cursor on\n
- \b LCD_DISP_ON_CURSOR_BLINK display on, cursor on flashing
- @return none
-*/
-extern void lcd_init(uint8_t dispAttr);
-
-/**
- @brief Clear display and set cursor to home position
- @return none
-*/
-extern void lcd_clrscr(void);
-
-/**
- @brief Set cursor to home position
- @return none
-*/
-extern void lcd_home(void);
-
-/**
- @brief Set cursor to specified position
-
- @param x horizontal position\n (0: left most position)
- @param y vertical position\n (0: first line)
- @return none
-*/
-extern void lcd_gotoxy(uint8_t x, uint8_t y);
-
-/**
- @brief Display character at current cursor position
- @param c character to be displayed
- @return none
-*/
-extern void lcd_putc(char c);
-
-/**
- @brief Display string without auto linefeed
- @param s string to be displayed
- @return none
-*/
-extern void lcd_puts(const char *s);
-
-/**
- @brief Display string from program memory without auto linefeed
- @param progmem_s string from program memory be be displayed
- @return none
- @see lcd_puts_P
-*/
-extern void lcd_puts_p(const char *progmem_s);
-
-/**
- @brief Send LCD controller instruction command
- @param cmd instruction to send to LCD controller, see HD44780 data sheet
- @return none
-*/
-extern void lcd_command(uint8_t cmd);
-
-/**
- @brief Send data byte to LCD controller
-
- Similar to lcd_putc(), but without interpreting LF
- @param data byte to send to LCD controller, see HD44780 data sheet
- @return none
-*/
-extern void lcd_data(uint8_t data);
-
-/**
- @brief macros for automatically storing string constant in program memory
-*/
-#define lcd_puts_P(__s) lcd_puts_p(PSTR(__s))
-
-/**@}*/
diff --git a/platforms/avr/hardware_id.c b/platforms/avr/hardware_id.c
new file mode 100644
index 0000000000..b61f0d92df
--- /dev/null
+++ b/platforms/avr/hardware_id.c
@@ -0,0 +1,19 @@
+// Copyright 2022 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+// For some reason this bit is undocumented for some AVR parts and not defined in their avr-libc IO headers
+// See https://stackoverflow.com/questions/12350914/how-to-read-atmega-32-signature-row
+#ifndef SIGRD
+# define SIGRD 5
+#endif // SIGRD
+
+#include <avr/boot.h>
+#include "hardware_id.h"
+
+hardware_id_t get_hardware_id(void) {
+ hardware_id_t id = {0};
+ for (uint8_t i = 0; i < 10; i += 1) {
+ ((uint8_t*)&id)[i] = boot_signature_byte_get(i + 0x0E);
+ }
+ return id;
+}
diff --git a/platforms/avr/platform.c b/platforms/avr/platform.c
index 3e35b4fe4c..37decb6ec8 100644
--- a/platforms/avr/platform.c
+++ b/platforms/avr/platform.c
@@ -16,6 +16,17 @@
#include "platform_deps.h"
+static void disable_jtag(void) {
+// To use PF4-7 (PC2-5 on ATmega32A), disable JTAG by writing JTD bit twice within four cycles.
+#if (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
+ MCUCR |= _BV(JTD);
+ MCUCR |= _BV(JTD);
+#elif defined(__AVR_ATmega32A__)
+ MCUCSR |= _BV(JTD);
+ MCUCSR |= _BV(JTD);
+#endif
+}
+
void platform_setup(void) {
- // do nothing
+ disable_jtag();
}
diff --git a/platforms/avr/platform.mk b/platforms/avr/platform.mk
index 4d9cafaeef..0374e2e058 100644
--- a/platforms/avr/platform.mk
+++ b/platforms/avr/platform.mk
@@ -18,6 +18,13 @@ COMPILEFLAGS += -ffunction-sections
COMPILEFLAGS += -fdata-sections
COMPILEFLAGS += -fpack-struct
COMPILEFLAGS += -fshort-enums
+COMPILEFLAGS += -mcall-prologues
+
+# Linker relaxation is only possible if
+# link time optimizations are not enabled.
+ifeq ($(strip $(LTO_ENABLE)), no)
+ COMPILEFLAGS += -mrelax
+endif
ASFLAGS += $(AVR_ASFLAGS)
@@ -28,7 +35,16 @@ CFLAGS += -fno-strict-aliasing
CXXFLAGS += $(COMPILEFLAGS)
CXXFLAGS += -fno-exceptions -std=c++11
-LDFLAGS +=-Wl,--gc-sections
+LDFLAGS += -Wl,--gc-sections
+
+# Use AVR's libc minimal printf implementation which has less features
+# and thus can shave ~400 bytes. Usually we use the xprintf
+# implementation but keyboards that use s(n)printf automatically
+# pull in the AVR libc implementation, which is ~900 bytes heavy.
+AVR_USE_MINIMAL_PRINTF ?= no
+ifeq ($(strip $(AVR_USE_MINIMAL_PRINTF)), yes)
+ LDFLAGS += -Wl,--whole-archive -lprintf_min -Wl,--no-whole-archive
+endif
OPT_DEFS += -DF_CPU=$(F_CPU)UL
diff --git a/platforms/bootloader.h b/platforms/bootloader.h
index 25ebd95288..77c6c80287 100644
--- a/platforms/bootloader.h
+++ b/platforms/bootloader.h
@@ -19,3 +19,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* give code for your bootloader to come up if needed */
void bootloader_jump(void);
+void mcu_reset(void);
diff --git a/platforms/chibios/_pin_defs.h b/platforms/chibios/_pin_defs.h
new file mode 100644
index 0000000000..0d96e2fc3b
--- /dev/null
+++ b/platforms/chibios/_pin_defs.h
@@ -0,0 +1,289 @@
+/* Copyright 2021 QMK
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#if defined(MCU_KINETIS)
+// TODO: including this avoids "error: expected identifier before '(' token" errors
+// here just to please KINETIS builds...
+# include <hal.h>
+#endif
+
+#define A0 PAL_LINE(GPIOA, 0)
+#define A1 PAL_LINE(GPIOA, 1)
+#define A2 PAL_LINE(GPIOA, 2)
+#define A3 PAL_LINE(GPIOA, 3)
+#define A4 PAL_LINE(GPIOA, 4)
+#define A5 PAL_LINE(GPIOA, 5)
+#define A6 PAL_LINE(GPIOA, 6)
+#define A7 PAL_LINE(GPIOA, 7)
+#define A8 PAL_LINE(GPIOA, 8)
+#define A9 PAL_LINE(GPIOA, 9)
+#define A10 PAL_LINE(GPIOA, 10)
+#define A11 PAL_LINE(GPIOA, 11)
+#define A12 PAL_LINE(GPIOA, 12)
+#define A13 PAL_LINE(GPIOA, 13)
+#define A14 PAL_LINE(GPIOA, 14)
+#define A15 PAL_LINE(GPIOA, 15)
+#define A16 PAL_LINE(GPIOA, 16)
+#define A17 PAL_LINE(GPIOA, 17)
+#define A18 PAL_LINE(GPIOA, 18)
+#define A19 PAL_LINE(GPIOA, 19)
+#define A20 PAL_LINE(GPIOA, 20)
+#define A21 PAL_LINE(GPIOA, 21)
+#define A22 PAL_LINE(GPIOA, 22)
+#define A23 PAL_LINE(GPIOA, 23)
+#define A24 PAL_LINE(GPIOA, 24)
+#define A25 PAL_LINE(GPIOA, 25)
+#define A26 PAL_LINE(GPIOA, 26)
+#define A27 PAL_LINE(GPIOA, 27)
+#define A28 PAL_LINE(GPIOA, 28)
+#define A29 PAL_LINE(GPIOA, 29)
+#define A30 PAL_LINE(GPIOA, 30)
+#define A31 PAL_LINE(GPIOA, 31)
+#define A32 PAL_LINE(GPIOA, 32)
+#define B0 PAL_LINE(GPIOB, 0)
+#define B1 PAL_LINE(GPIOB, 1)
+#define B2 PAL_LINE(GPIOB, 2)
+#define B3 PAL_LINE(GPIOB, 3)
+#define B4 PAL_LINE(GPIOB, 4)
+#define B5 PAL_LINE(GPIOB, 5)
+#define B6 PAL_LINE(GPIOB, 6)
+#define B7 PAL_LINE(GPIOB, 7)
+#define B8 PAL_LINE(GPIOB, 8)
+#define B9 PAL_LINE(GPIOB, 9)
+#define B10 PAL_LINE(GPIOB, 10)
+#define B11 PAL_LINE(GPIOB, 11)
+#define B12 PAL_LINE(GPIOB, 12)
+#define B13 PAL_LINE(GPIOB, 13)
+#define B14 PAL_LINE(GPIOB, 14)
+#define B15 PAL_LINE(GPIOB, 15)
+#define B16 PAL_LINE(GPIOB, 16)
+#define B17 PAL_LINE(GPIOB, 17)
+#define B18 PAL_LINE(GPIOB, 18)
+#define B19 PAL_LINE(GPIOB, 19)
+#define B20 PAL_LINE(GPIOB, 20)
+#define B21 PAL_LINE(GPIOB, 21)
+#define B22 PAL_LINE(GPIOB, 22)
+#define B23 PAL_LINE(GPIOB, 23)
+#define B24 PAL_LINE(GPIOB, 24)
+#define B25 PAL_LINE(GPIOB, 25)
+#define B26 PAL_LINE(GPIOB, 26)
+#define B27 PAL_LINE(GPIOB, 27)
+#define B28 PAL_LINE(GPIOB, 28)
+#define B29 PAL_LINE(GPIOB, 29)
+#define B30 PAL_LINE(GPIOB, 30)
+#define B31 PAL_LINE(GPIOB, 31)
+#define B32 PAL_LINE(GPIOB, 32)
+#define C0 PAL_LINE(GPIOC, 0)
+#define C1 PAL_LINE(GPIOC, 1)
+#define C2 PAL_LINE(GPIOC, 2)
+#define C3 PAL_LINE(GPIOC, 3)
+#define C4 PAL_LINE(GPIOC, 4)
+#define C5 PAL_LINE(GPIOC, 5)
+#define C6 PAL_LINE(GPIOC, 6)
+#define C7 PAL_LINE(GPIOC, 7)
+#define C8 PAL_LINE(GPIOC, 8)
+#define C9 PAL_LINE(GPIOC, 9)
+#define C10 PAL_LINE(GPIOC, 10)
+#define C11 PAL_LINE(GPIOC, 11)
+#define C12 PAL_LINE(GPIOC, 12)
+#define C13 PAL_LINE(GPIOC, 13)
+#define C14 PAL_LINE(GPIOC, 14)
+#define C15 PAL_LINE(GPIOC, 15)
+#define C16 PAL_LINE(GPIOC, 16)
+#define C17 PAL_LINE(GPIOC, 17)
+#define C18 PAL_LINE(GPIOC, 18)
+#define C19 PAL_LINE(GPIOC, 19)
+#define C20 PAL_LINE(GPIOC, 20)
+#define C21 PAL_LINE(GPIOC, 21)
+#define C22 PAL_LINE(GPIOC, 22)
+#define C23 PAL_LINE(GPIOC, 23)
+#define C24 PAL_LINE(GPIOC, 24)
+#define C25 PAL_LINE(GPIOC, 25)
+#define C26 PAL_LINE(GPIOC, 26)
+#define C27 PAL_LINE(GPIOC, 27)
+#define C28 PAL_LINE(GPIOC, 28)
+#define C29 PAL_LINE(GPIOC, 29)
+#define C30 PAL_LINE(GPIOC, 30)
+#define C31 PAL_LINE(GPIOC, 31)
+#define C32 PAL_LINE(GPIOC, 32)
+#define D0 PAL_LINE(GPIOD, 0)
+#define D1 PAL_LINE(GPIOD, 1)
+#define D2 PAL_LINE(GPIOD, 2)
+#define D3 PAL_LINE(GPIOD, 3)
+#define D4 PAL_LINE(GPIOD, 4)
+#define D5 PAL_LINE(GPIOD, 5)
+#define D6 PAL_LINE(GPIOD, 6)
+#define D7 PAL_LINE(GPIOD, 7)
+#define D8 PAL_LINE(GPIOD, 8)
+#define D9 PAL_LINE(GPIOD, 9)
+#define D10 PAL_LINE(GPIOD, 10)
+#define D11 PAL_LINE(GPIOD, 11)
+#define D12 PAL_LINE(GPIOD, 12)
+#define D13 PAL_LINE(GPIOD, 13)
+#define D14 PAL_LINE(GPIOD, 14)
+#define D15 PAL_LINE(GPIOD, 15)
+#define D16 PAL_LINE(GPIOD, 16)
+#define D17 PAL_LINE(GPIOD, 17)
+#define D18 PAL_LINE(GPIOD, 18)
+#define D19 PAL_LINE(GPIOD, 19)
+#define D20 PAL_LINE(GPIOD, 20)
+#define D21 PAL_LINE(GPIOD, 21)
+#define D22 PAL_LINE(GPIOD, 22)
+#define D23 PAL_LINE(GPIOD, 23)
+#define D24 PAL_LINE(GPIOD, 24)
+#define D25 PAL_LINE(GPIOD, 25)
+#define D26 PAL_LINE(GPIOD, 26)
+#define D27 PAL_LINE(GPIOD, 27)
+#define D28 PAL_LINE(GPIOD, 28)
+#define D29 PAL_LINE(GPIOD, 29)
+#define D30 PAL_LINE(GPIOD, 30)
+#define D31 PAL_LINE(GPIOD, 31)
+#define D32 PAL_LINE(GPIOD, 32)
+#define E0 PAL_LINE(GPIOE, 0)
+#define E1 PAL_LINE(GPIOE, 1)
+#define E2 PAL_LINE(GPIOE, 2)
+#define E3 PAL_LINE(GPIOE, 3)
+#define E4 PAL_LINE(GPIOE, 4)
+#define E5 PAL_LINE(GPIOE, 5)
+#define E6 PAL_LINE(GPIOE, 6)
+#define E7 PAL_LINE(GPIOE, 7)
+#define E8 PAL_LINE(GPIOE, 8)
+#define E9 PAL_LINE(GPIOE, 9)
+#define E10 PAL_LINE(GPIOE, 10)
+#define E11 PAL_LINE(GPIOE, 11)
+#define E12 PAL_LINE(GPIOE, 12)
+#define E13 PAL_LINE(GPIOE, 13)
+#define E14 PAL_LINE(GPIOE, 14)
+#define E15 PAL_LINE(GPIOE, 15)
+#define E16 PAL_LINE(GPIOE, 16)
+#define E17 PAL_LINE(GPIOE, 17)
+#define E18 PAL_LINE(GPIOE, 18)
+#define E19 PAL_LINE(GPIOE, 19)
+#define E20 PAL_LINE(GPIOE, 20)
+#define E21 PAL_LINE(GPIOE, 21)
+#define E22 PAL_LINE(GPIOE, 22)
+#define E23 PAL_LINE(GPIOE, 23)
+#define E24 PAL_LINE(GPIOE, 24)
+#define E25 PAL_LINE(GPIOE, 25)
+#define E26 PAL_LINE(GPIOE, 26)
+#define E27 PAL_LINE(GPIOE, 27)
+#define E28 PAL_LINE(GPIOE, 28)
+#define E29 PAL_LINE(GPIOE, 29)
+#define E30 PAL_LINE(GPIOE, 30)
+#define E31 PAL_LINE(GPIOE, 31)
+#define E32 PAL_LINE(GPIOE, 32)
+#define F0 PAL_LINE(GPIOF, 0)
+#define F1 PAL_LINE(GPIOF, 1)
+#define F2 PAL_LINE(GPIOF, 2)
+#define F3 PAL_LINE(GPIOF, 3)
+#define F4 PAL_LINE(GPIOF, 4)
+#define F5 PAL_LINE(GPIOF, 5)
+#define F6 PAL_LINE(GPIOF, 6)
+#define F7 PAL_LINE(GPIOF, 7)
+#define F8 PAL_LINE(GPIOF, 8)
+#define F9 PAL_LINE(GPIOF, 9)
+#define F10 PAL_LINE(GPIOF, 10)
+#define F11 PAL_LINE(GPIOF, 11)
+#define F12 PAL_LINE(GPIOF, 12)
+#define F13 PAL_LINE(GPIOF, 13)
+#define F14 PAL_LINE(GPIOF, 14)
+#define F15 PAL_LINE(GPIOF, 15)
+#define G0 PAL_LINE(GPIOG, 0)
+#define G1 PAL_LINE(GPIOG, 1)
+#define G2 PAL_LINE(GPIOG, 2)
+#define G3 PAL_LINE(GPIOG, 3)
+#define G4 PAL_LINE(GPIOG, 4)
+#define G5 PAL_LINE(GPIOG, 5)
+#define G6 PAL_LINE(GPIOG, 6)
+#define G7 PAL_LINE(GPIOG, 7)
+#define G8 PAL_LINE(GPIOG, 8)
+#define G9 PAL_LINE(GPIOG, 9)
+#define G10 PAL_LINE(GPIOG, 10)
+#define G11 PAL_LINE(GPIOG, 11)
+#define G12 PAL_LINE(GPIOG, 12)
+#define G13 PAL_LINE(GPIOG, 13)
+#define G14 PAL_LINE(GPIOG, 14)
+#define G15 PAL_LINE(GPIOG, 15)
+#define H0 PAL_LINE(GPIOH, 0)
+#define H1 PAL_LINE(GPIOH, 1)
+#define H2 PAL_LINE(GPIOH, 2)
+#define H3 PAL_LINE(GPIOH, 3)
+#define H4 PAL_LINE(GPIOH, 4)
+#define H5 PAL_LINE(GPIOH, 5)
+#define H6 PAL_LINE(GPIOH, 6)
+#define H7 PAL_LINE(GPIOH, 7)
+#define H8 PAL_LINE(GPIOH, 8)
+#define H9 PAL_LINE(GPIOH, 9)
+#define H10 PAL_LINE(GPIOH, 10)
+#define H11 PAL_LINE(GPIOH, 11)
+#define H12 PAL_LINE(GPIOH, 12)
+#define H13 PAL_LINE(GPIOH, 13)
+#define H14 PAL_LINE(GPIOH, 14)
+#define H15 PAL_LINE(GPIOH, 15)
+#define I0 PAL_LINE(GPIOI, 0)
+#define I1 PAL_LINE(GPIOI, 1)
+#define I2 PAL_LINE(GPIOI, 2)
+#define I3 PAL_LINE(GPIOI, 3)
+#define I4 PAL_LINE(GPIOI, 4)
+#define I5 PAL_LINE(GPIOI, 5)
+#define I6 PAL_LINE(GPIOI, 6)
+#define I7 PAL_LINE(GPIOI, 7)
+#define I8 PAL_LINE(GPIOI, 8)
+#define I9 PAL_LINE(GPIOI, 9)
+#define I10 PAL_LINE(GPIOI, 10)
+#define I11 PAL_LINE(GPIOI, 11)
+#define I12 PAL_LINE(GPIOI, 12)
+#define I13 PAL_LINE(GPIOI, 13)
+#define I14 PAL_LINE(GPIOI, 14)
+#define I15 PAL_LINE(GPIOI, 15)
+#define J0 PAL_LINE(GPIOJ, 0)
+#define J1 PAL_LINE(GPIOJ, 1)
+#define J2 PAL_LINE(GPIOJ, 2)
+#define J3 PAL_LINE(GPIOJ, 3)
+#define J4 PAL_LINE(GPIOJ, 4)
+#define J5 PAL_LINE(GPIOJ, 5)
+#define J6 PAL_LINE(GPIOJ, 6)
+#define J7 PAL_LINE(GPIOJ, 7)
+#define J8 PAL_LINE(GPIOJ, 8)
+#define J9 PAL_LINE(GPIOJ, 9)
+#define J10 PAL_LINE(GPIOJ, 10)
+#define J11 PAL_LINE(GPIOJ, 11)
+#define J12 PAL_LINE(GPIOJ, 12)
+#define J13 PAL_LINE(GPIOJ, 13)
+#define J14 PAL_LINE(GPIOJ, 14)
+#define J15 PAL_LINE(GPIOJ, 15)
+// Keyboards can `#define KEYBOARD_REQUIRES_GPIOK` if they need to access GPIO-K pins. These conflict with a whole
+// bunch of layout definitions, so it's intentionally left out unless absolutely required -- in that case, the
+// keyboard designer should use a different symbol when defining their layout macros.
+#ifdef KEYBOARD_REQUIRES_GPIOK
+# define K0 PAL_LINE(GPIOK, 0)
+# define K1 PAL_LINE(GPIOK, 1)
+# define K2 PAL_LINE(GPIOK, 2)
+# define K3 PAL_LINE(GPIOK, 3)
+# define K4 PAL_LINE(GPIOK, 4)
+# define K5 PAL_LINE(GPIOK, 5)
+# define K6 PAL_LINE(GPIOK, 6)
+# define K7 PAL_LINE(GPIOK, 7)
+# define K8 PAL_LINE(GPIOK, 8)
+# define K9 PAL_LINE(GPIOK, 9)
+# define K10 PAL_LINE(GPIOK, 10)
+# define K11 PAL_LINE(GPIOK, 11)
+# define K12 PAL_LINE(GPIOK, 12)
+# define K13 PAL_LINE(GPIOK, 13)
+# define K14 PAL_LINE(GPIOK, 14)
+# define K15 PAL_LINE(GPIOK, 15)
+#endif
diff --git a/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/board.h b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/board.h
index 30af6b0c86..78dcbac05c 100644
--- a/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/board.h
+++ b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/board.h
@@ -17,4 +17,61 @@
#include_next "board.h"
+// Force B9 as input to align with qmk defaults
+#undef VAL_GPIOB_MODER
+#define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \
+ PIN_MODE_INPUT(GPIOB_PIN1) | \
+ PIN_MODE_INPUT(GPIOB_PIN2) | \
+ PIN_MODE_ALTERNATE(GPIOB_SWO) | \
+ PIN_MODE_INPUT(GPIOB_PIN4) | \
+ PIN_MODE_INPUT(GPIOB_PIN5) | \
+ PIN_MODE_INPUT(GPIOB_LSM303DLHC_SCL) | \
+ PIN_MODE_INPUT(GPIOB_PIN7) | \
+ PIN_MODE_INPUT(GPIOB_PIN8) | \
+ PIN_MODE_INPUT(GPIOB_LSM303DLHC_SDA) | \
+ PIN_MODE_ALTERNATE(GPIOB_MP45DT02_CLK_IN) |\
+ PIN_MODE_INPUT(GPIOB_PIN11) | \
+ PIN_MODE_INPUT(GPIOB_PIN12) | \
+ PIN_MODE_INPUT(GPIOB_PIN13) | \
+ PIN_MODE_INPUT(GPIOB_PIN14) | \
+ PIN_MODE_INPUT(GPIOB_PIN15))
+
+#undef VAL_GPIOB_PUPDR
+#define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN1) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN2) | \
+ PIN_PUPDR_PULLUP(GPIOB_SWO) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN4) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN5) | \
+ PIN_PUPDR_PULLUP(GPIOB_LSM303DLHC_SCL) |\
+ PIN_PUPDR_PULLUP(GPIOB_PIN7) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN8) | \
+ PIN_PUPDR_PULLUP(GPIOB_LSM303DLHC_SDA) |\
+ PIN_PUPDR_FLOATING(GPIOB_MP45DT02_CLK_IN) |\
+ PIN_PUPDR_PULLUP(GPIOB_PIN11) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN12) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN13) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN14) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN15))
+
+#undef VAL_GPIOB_AFRL
+#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN1, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN2, 0U) | \
+ PIN_AFIO_AF(GPIOB_SWO, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN4, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN5, 0U) | \
+ PIN_AFIO_AF(GPIOB_LSM303DLHC_SCL, 0) | \
+ PIN_AFIO_AF(GPIOB_PIN7, 0U))
+
+#undef VAL_GPIOB_AFRH
+#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0U) | \
+ PIN_AFIO_AF(GPIOB_LSM303DLHC_SDA, 0) | \
+ PIN_AFIO_AF(GPIOB_MP45DT02_CLK_IN, 5U) |\
+ PIN_AFIO_AF(GPIOB_PIN11, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN12, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN13, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN14, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN15, 0U))
+
#undef STM32_HSE_BYPASS
diff --git a/platforms/chibios/boards/GENERIC_STM32_F303XC/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F303XC/configs/mcuconf.h
index c6f5a8ac52..e0af4a276b 100644
--- a/platforms/chibios/boards/GENERIC_STM32_F303XC/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_STM32_F303XC/configs/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -186,7 +186,6 @@
/*
* PWM driver system settings.
*/
-#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
diff --git a/platforms/chibios/boards/GENERIC_STM32_F401XC/board/board.mk b/platforms/chibios/boards/GENERIC_STM32_F401XC/board/board.mk
new file mode 100644
index 0000000000..fddf7dace4
--- /dev/null
+++ b/platforms/chibios/boards/GENERIC_STM32_F401XC/board/board.mk
@@ -0,0 +1,9 @@
+# List of all the board related files.
+BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_STM32F401C_DISCOVERY/board.c
+
+# Required include directories
+BOARDINC = $(CHIBIOS)/os/hal/boards/ST_STM32F401C_DISCOVERY
+
+# Shared variables
+ALLCSRC += $(BOARDSRC)
+ALLINC += $(BOARDINC)
diff --git a/platforms/chibios/boards/GENERIC_STM32_F401XC/configs/board.h b/platforms/chibios/boards/GENERIC_STM32_F401XC/configs/board.h
new file mode 100644
index 0000000000..78dcbac05c
--- /dev/null
+++ b/platforms/chibios/boards/GENERIC_STM32_F401XC/configs/board.h
@@ -0,0 +1,77 @@
+/* Copyright 2020 Nick Brassel (tzarc)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#include_next "board.h"
+
+// Force B9 as input to align with qmk defaults
+#undef VAL_GPIOB_MODER
+#define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \
+ PIN_MODE_INPUT(GPIOB_PIN1) | \
+ PIN_MODE_INPUT(GPIOB_PIN2) | \
+ PIN_MODE_ALTERNATE(GPIOB_SWO) | \
+ PIN_MODE_INPUT(GPIOB_PIN4) | \
+ PIN_MODE_INPUT(GPIOB_PIN5) | \
+ PIN_MODE_INPUT(GPIOB_LSM303DLHC_SCL) | \
+ PIN_MODE_INPUT(GPIOB_PIN7) | \
+ PIN_MODE_INPUT(GPIOB_PIN8) | \
+ PIN_MODE_INPUT(GPIOB_LSM303DLHC_SDA) | \
+ PIN_MODE_ALTERNATE(GPIOB_MP45DT02_CLK_IN) |\
+ PIN_MODE_INPUT(GPIOB_PIN11) | \
+ PIN_MODE_INPUT(GPIOB_PIN12) | \
+ PIN_MODE_INPUT(GPIOB_PIN13) | \
+ PIN_MODE_INPUT(GPIOB_PIN14) | \
+ PIN_MODE_INPUT(GPIOB_PIN15))
+
+#undef VAL_GPIOB_PUPDR
+#define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN1) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN2) | \
+ PIN_PUPDR_PULLUP(GPIOB_SWO) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN4) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN5) | \
+ PIN_PUPDR_PULLUP(GPIOB_LSM303DLHC_SCL) |\
+ PIN_PUPDR_PULLUP(GPIOB_PIN7) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN8) | \
+ PIN_PUPDR_PULLUP(GPIOB_LSM303DLHC_SDA) |\
+ PIN_PUPDR_FLOATING(GPIOB_MP45DT02_CLK_IN) |\
+ PIN_PUPDR_PULLUP(GPIOB_PIN11) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN12) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN13) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN14) | \
+ PIN_PUPDR_PULLUP(GPIOB_PIN15))
+
+#undef VAL_GPIOB_AFRL
+#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN1, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN2, 0U) | \
+ PIN_AFIO_AF(GPIOB_SWO, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN4, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN5, 0U) | \
+ PIN_AFIO_AF(GPIOB_LSM303DLHC_SCL, 0) | \
+ PIN_AFIO_AF(GPIOB_PIN7, 0U))
+
+#undef VAL_GPIOB_AFRH
+#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0U) | \
+ PIN_AFIO_AF(GPIOB_LSM303DLHC_SDA, 0) | \
+ PIN_AFIO_AF(GPIOB_MP45DT02_CLK_IN, 5U) |\
+ PIN_AFIO_AF(GPIOB_PIN11, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN12, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN13, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN14, 0U) | \
+ PIN_AFIO_AF(GPIOB_PIN15, 0U))
+
+#undef STM32_HSE_BYPASS
diff --git a/platforms/chibios/boards/GENERIC_STM32_F401XC/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_F401XC/configs/config.h
new file mode 100644
index 0000000000..e06ca0b725
--- /dev/null
+++ b/platforms/chibios/boards/GENERIC_STM32_F401XC/configs/config.h
@@ -0,0 +1,22 @@
+/* Copyright 2020 Nick Brassel (tzarc)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#define BOARD_OTG_NOVBUSSENS 1
+
+#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
+# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
+#endif
diff --git a/platforms/chibios/boards/GENERIC_STM32_F401XC/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F401XC/configs/mcuconf.h
new file mode 100644
index 0000000000..24cec7137d
--- /dev/null
+++ b/platforms/chibios/boards/GENERIC_STM32_F401XC/configs/mcuconf.h
@@ -0,0 +1,244 @@
+/*
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#ifndef MCUCONF_H
+#define MCUCONF_H
+
+/*
+ * STM32F4xx drivers configuration.
+ * The following settings override the default settings present in
+ * the various device driver implementation headers.
+ * Note that the settings for each driver only have effect if the whole
+ * driver is enabled in halconf.h.
+ *
+ * IRQ priorities:
+ * 15...0 Lowest...Highest.
+ *
+ * DMA priorities:
+ * 0...3 Lowest...Highest.
+ */
+
+#define STM32F4xx_MCUCONF
+#define STM32F401_MCUCONF
+
+/*
+ * HAL driver system settings.
+ */
+#define STM32_NO_INIT FALSE
+#define STM32_PVD_ENABLE FALSE
+#define STM32_PLS STM32_PLS_LEV0
+#define STM32_BKPRAM_ENABLE FALSE
+#define STM32_HSI_ENABLED TRUE
+#define STM32_LSI_ENABLED TRUE
+#define STM32_HSE_ENABLED TRUE
+#define STM32_LSE_ENABLED FALSE
+#define STM32_CLOCK48_REQUIRED TRUE
+#define STM32_SW STM32_SW_PLL
+#define STM32_PLLSRC STM32_PLLSRC_HSE
+#define STM32_PLLM_VALUE 4
+#define STM32_PLLN_VALUE 168
+#define STM32_PLLP_VALUE 4
+#define STM32_PLLQ_VALUE 7
+#define STM32_HPRE STM32_HPRE_DIV1
+#define STM32_PPRE1 STM32_PPRE1_DIV2
+#define STM32_PPRE2 STM32_PPRE2_DIV1
+#define STM32_RTCSEL STM32_RTCSEL_LSI
+#define STM32_RTCPRE_VALUE 8
+#define STM32_MCO1SEL STM32_MCO1SEL_HSI
+#define STM32_MCO1PRE STM32_MCO1PRE_DIV1
+#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
+#define STM32_MCO2PRE STM32_MCO2PRE_DIV5
+#define STM32_I2SSRC STM32_I2SSRC_CKIN
+#define STM32_PLLI2SN_VALUE 192
+#define STM32_PLLI2SR_VALUE 5
+
+/*
+ * IRQ system settings.
+ */
+#define STM32_IRQ_EXTI0_PRIORITY 6
+#define STM32_IRQ_EXTI1_PRIORITY 6
+#define STM32_IRQ_EXTI2_PRIORITY 6
+#define STM32_IRQ_EXTI3_PRIORITY 6
+#define STM32_IRQ_EXTI4_PRIORITY 6
+#define STM32_IRQ_EXTI5_9_PRIORITY 6
+#define STM32_IRQ_EXTI10_15_PRIORITY 6
+#define STM32_IRQ_EXTI16_PRIORITY 6
+#define STM32_IRQ_EXTI17_PRIORITY 15
+#define STM32_IRQ_EXTI18_PRIORITY 6
+#define STM32_IRQ_EXTI19_PRIORITY 6
+#define STM32_IRQ_EXTI20_PRIORITY 6
+#define STM32_IRQ_EXTI21_PRIORITY 15
+#define STM32_IRQ_EXTI22_PRIORITY 15
+
+#define STM32_IRQ_TIM1_BRK_TIM9_PRIORITY 7
+#define STM32_IRQ_TIM1_UP_TIM10_PRIORITY 7
+#define STM32_IRQ_TIM1_TRGCO_TIM11_PRIORITY 7
+#define STM32_IRQ_TIM1_CC_PRIORITY 7
+#define STM32_IRQ_TIM2_PRIORITY 7
+#define STM32_IRQ_TIM3_PRIORITY 7
+#define STM32_IRQ_TIM4_PRIORITY 7
+#define STM32_IRQ_TIM5_PRIORITY 7
+
+#define STM32_IRQ_USART1_PRIORITY 12
+#define STM32_IRQ_USART2_PRIORITY 12
+#define STM32_IRQ_USART6_PRIORITY 12
+
+/*
+ * ADC driver system settings.
+ */
+#define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4
+#define STM32_ADC_USE_ADC1 FALSE
+#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
+#define STM32_ADC_ADC1_DMA_PRIORITY 2
+#define STM32_ADC_IRQ_PRIORITY 6
+#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6
+
+/*
+ * GPT driver system settings.
+ */
+#define STM32_GPT_USE_TIM1 FALSE
+#define STM32_GPT_USE_TIM2 FALSE
+#define STM32_GPT_USE_TIM3 FALSE
+#define STM32_GPT_USE_TIM4 FALSE
+#define STM32_GPT_USE_TIM5 FALSE
+#define STM32_GPT_USE_TIM9 FALSE
+#define STM32_GPT_USE_TIM10 FALSE
+#define STM32_GPT_USE_TIM11 FALSE
+
+/*
+ * I2C driver system settings.
+ */
+#define STM32_I2C_USE_I2C1 FALSE
+#define STM32_I2C_USE_I2C2 FALSE
+#define STM32_I2C_USE_I2C3 FALSE
+#define STM32_I2C_BUSY_TIMEOUT 50
+#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
+#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
+#define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
+#define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
+#define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
+#define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
+#define STM32_I2C_I2C1_IRQ_PRIORITY 5
+#define STM32_I2C_I2C2_IRQ_PRIORITY 5
+#define STM32_I2C_I2C3_IRQ_PRIORITY 5
+#define STM32_I2C_I2C1_DMA_PRIORITY 3
+#define STM32_I2C_I2C2_DMA_PRIORITY 3
+#define STM32_I2C_I2C3_DMA_PRIORITY 3
+#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
+
+/*
+ * I2S driver system settings.
+ */
+#define STM32_I2S_USE_SPI2 FALSE
+#define STM32_I2S_USE_SPI3 FALSE
+#define STM32_I2S_SPI2_IRQ_PRIORITY 10
+#define STM32_I2S_SPI3_IRQ_PRIORITY 10
+#define STM32_I2S_SPI2_DMA_PRIORITY 1
+#define STM32_I2S_SPI3_DMA_PRIORITY 1
+#define STM32_I2S_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
+#define STM32_I2S_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
+#define STM32_I2S_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
+#define STM32_I2S_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
+#define STM32_I2S_DMA_ERROR_HOOK(i2sp) osalSysHalt("DMA failure")
+
+/*
+ * ICU driver system settings.
+ */
+#define STM32_ICU_USE_TIM1 FALSE
+#define STM32_ICU_USE_TIM2 FALSE
+#define STM32_ICU_USE_TIM3 FALSE
+#define STM32_ICU_USE_TIM4 FALSE
+#define STM32_ICU_USE_TIM5 FALSE
+#define STM32_ICU_USE_TIM9 FALSE
+#define STM32_ICU_USE_TIM10 FALSE
+#define STM32_ICU_USE_TIM11 FALSE
+
+/*
+ * PWM driver system settings.
+ */
+#define STM32_PWM_USE_TIM1 FALSE
+#define STM32_PWM_USE_TIM2 FALSE
+#define STM32_PWM_USE_TIM3 FALSE
+#define STM32_PWM_USE_TIM4 FALSE
+#define STM32_PWM_USE_TIM5 FALSE
+#define STM32_PWM_USE_TIM9 FALSE
+#define STM32_PWM_USE_TIM10 FALSE
+#define STM32_PWM_USE_TIM11 FALSE
+
+/*
+ * SERIAL driver system settings.
+ */
+#define STM32_SERIAL_USE_USART1 FALSE
+#define STM32_SERIAL_USE_USART2 FALSE
+#define STM32_SERIAL_USE_USART6 FALSE
+
+/*
+ * SPI driver system settings.
+ */
+#define STM32_SPI_USE_SPI1 FALSE
+#define STM32_SPI_USE_SPI2 FALSE
+#define STM32_SPI_USE_SPI3 FALSE
+#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)
+#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
+#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
+#define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
+#define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
+#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
+#define STM32_SPI_SPI1_DMA_PRIORITY 1
+#define STM32_SPI_SPI2_DMA_PRIORITY 1
+#define STM32_SPI_SPI3_DMA_PRIORITY 1
+#define STM32_SPI_SPI1_IRQ_PRIORITY 10
+#define STM32_SPI_SPI2_IRQ_PRIORITY 10
+#define STM32_SPI_SPI3_IRQ_PRIORITY 10
+#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
+
+/*
+ * ST driver system settings.
+ */
+#define STM32_ST_IRQ_PRIORITY 8
+#define STM32_ST_USE_TIMER 2
+
+/*
+ * UART driver system settings.
+ */
+#define STM32_UART_USE_USART1 FALSE
+#define STM32_UART_USE_USART2 FALSE
+#define STM32_UART_USE_USART6 FALSE
+#define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
+#define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
+#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
+#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
+#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
+#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
+#define STM32_UART_USART1_DMA_PRIORITY 0
+#define STM32_UART_USART2_DMA_PRIORITY 0
+#define STM32_UART_USART6_DMA_PRIORITY 0
+#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
+
+/*
+ * USB driver system settings.
+ */
+#define STM32_USB_USE_OTG1 TRUE
+#define STM32_USB_OTG1_IRQ_PRIORITY 14
+#define STM32_USB_OTG1_RX_FIFO_SIZE 512
+#define STM32_USB_HOST_WAKEUP_DURATION 2
+
+/*
+ * WDG driver system settings.
+ */
+#define STM32_WDG_USE_IWDG FALSE
+
+#endif /* MCUCONF_H */
diff --git a/platforms/chibios/boards/GENERIC_STM32_F405XG/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F405XG/configs/mcuconf.h
index 908a580a91..394e750256 100644
--- a/platforms/chibios/boards/GENERIC_STM32_F405XG/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_STM32_F405XG/configs/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -86,6 +86,28 @@
#define STM32_IRQ_EXTI21_PRIORITY 15
#define STM32_IRQ_EXTI22_PRIORITY 15
+#define STM32_IRQ_TIM1_BRK_TIM9_PRIORITY 7
+#define STM32_IRQ_TIM1_UP_TIM10_PRIORITY 7
+#define STM32_IRQ_TIM1_TRGCO_TIM11_PRIORITY 7
+#define STM32_IRQ_TIM1_CC_PRIORITY 7
+#define STM32_IRQ_TIM2_PRIORITY 7
+#define STM32_IRQ_TIM3_PRIORITY 7
+#define STM32_IRQ_TIM4_PRIORITY 7
+#define STM32_IRQ_TIM5_PRIORITY 7
+#define STM32_IRQ_TIM6_PRIORITY 7
+#define STM32_IRQ_TIM7_PRIORITY 7
+#define STM32_IRQ_TIM8_BRK_TIM12_PRIORITY 7
+#define STM32_IRQ_TIM8_UP_TIM13_PRIORITY 7
+#define STM32_IRQ_TIM8_TRGCO_TIM14_PRIORITY 7
+#define STM32_IRQ_TIM8_CC_PRIORITY 7
+
+#define STM32_IRQ_USART1_PRIORITY 12
+#define STM32_IRQ_USART2_PRIORITY 12
+#define STM32_IRQ_USART3_PRIORITY 12
+#define STM32_IRQ_UART4_PRIORITY 12
+#define STM32_IRQ_UART5_PRIORITY 12
+#define STM32_IRQ_USART6_PRIORITY 12
+
/*
* ADC driver system settings.
*/
@@ -137,21 +159,11 @@
#define STM32_GPT_USE_TIM7 FALSE
#define STM32_GPT_USE_TIM8 FALSE
#define STM32_GPT_USE_TIM9 FALSE
+#define STM32_GPT_USE_TIM10 FALSE
#define STM32_GPT_USE_TIM11 FALSE
#define STM32_GPT_USE_TIM12 FALSE
+#define STM32_GPT_USE_TIM13 FALSE
#define STM32_GPT_USE_TIM14 FALSE
-#define STM32_GPT_TIM1_IRQ_PRIORITY 7
-#define STM32_GPT_TIM2_IRQ_PRIORITY 7
-#define STM32_GPT_TIM3_IRQ_PRIORITY 7
-#define STM32_GPT_TIM4_IRQ_PRIORITY 7
-#define STM32_GPT_TIM5_IRQ_PRIORITY 7
-#define STM32_GPT_TIM6_IRQ_PRIORITY 7
-#define STM32_GPT_TIM7_IRQ_PRIORITY 7
-#define STM32_GPT_TIM8_IRQ_PRIORITY 7
-#define STM32_GPT_TIM9_IRQ_PRIORITY 7
-#define STM32_GPT_TIM11_IRQ_PRIORITY 7
-#define STM32_GPT_TIM12_IRQ_PRIORITY 7
-#define STM32_GPT_TIM14_IRQ_PRIORITY 7
/*
* I2C driver system settings.
@@ -199,13 +211,11 @@
#define STM32_ICU_USE_TIM5 FALSE
#define STM32_ICU_USE_TIM8 FALSE
#define STM32_ICU_USE_TIM9 FALSE
-#define STM32_ICU_TIM1_IRQ_PRIORITY 7
-#define STM32_ICU_TIM2_IRQ_PRIORITY 7
-#define STM32_ICU_TIM3_IRQ_PRIORITY 7
-#define STM32_ICU_TIM4_IRQ_PRIORITY 7
-#define STM32_ICU_TIM5_IRQ_PRIORITY 7
-#define STM32_ICU_TIM8_IRQ_PRIORITY 7
-#define STM32_ICU_TIM9_IRQ_PRIORITY 7
+#define STM32_ICU_USE_TIM10 FALSE
+#define STM32_ICU_USE_TIM11 FALSE
+#define STM32_ICU_USE_TIM12 FALSE
+#define STM32_ICU_USE_TIM13 FALSE
+#define STM32_ICU_USE_TIM14 FALSE
/*
* MAC driver system settings.
@@ -221,7 +231,6 @@
/*
* PWM driver system settings.
*/
-#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
@@ -229,13 +238,11 @@
#define STM32_PWM_USE_TIM5 FALSE
#define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_USE_TIM9 FALSE
-#define STM32_PWM_TIM1_IRQ_PRIORITY 7
-#define STM32_PWM_TIM2_IRQ_PRIORITY 7
-#define STM32_PWM_TIM3_IRQ_PRIORITY 7
-#define STM32_PWM_TIM4_IRQ_PRIORITY 7
-#define STM32_PWM_TIM5_IRQ_PRIORITY 7
-#define STM32_PWM_TIM8_IRQ_PRIORITY 7
-#define STM32_PWM_TIM9_IRQ_PRIORITY 7
+#define STM32_PWM_USE_TIM10 FALSE
+#define STM32_PWM_USE_TIM11 FALSE
+#define STM32_PWM_USE_TIM12 FALSE
+#define STM32_PWM_USE_TIM13 FALSE
+#define STM32_PWM_USE_TIM14 FALSE
/*
* RTC driver system settings.
@@ -265,12 +272,6 @@
#define STM32_SERIAL_USE_UART4 FALSE
#define STM32_SERIAL_USE_UART5 FALSE
#define STM32_SERIAL_USE_USART6 FALSE
-#define STM32_SERIAL_USART1_PRIORITY 12
-#define STM32_SERIAL_USART2_PRIORITY 12
-#define STM32_SERIAL_USART3_PRIORITY 12
-#define STM32_SERIAL_UART4_PRIORITY 12
-#define STM32_SERIAL_UART5_PRIORITY 12
-#define STM32_SERIAL_USART6_PRIORITY 12
/*
* SPI driver system settings.
@@ -319,12 +320,6 @@
#define STM32_UART_UART5_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
-#define STM32_UART_USART1_IRQ_PRIORITY 12
-#define STM32_UART_USART2_IRQ_PRIORITY 12
-#define STM32_UART_USART3_IRQ_PRIORITY 12
-#define STM32_UART_UART4_IRQ_PRIORITY 12
-#define STM32_UART_UART5_IRQ_PRIORITY 12
-#define STM32_UART_USART6_IRQ_PRIORITY 12
#define STM32_UART_USART1_DMA_PRIORITY 0
#define STM32_UART_USART2_DMA_PRIORITY 0
#define STM32_UART_USART3_DMA_PRIORITY 0
diff --git a/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h
index 928ee56c71..07399ad2f7 100644
--- a/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -86,6 +86,28 @@
#define STM32_IRQ_EXTI21_PRIORITY 15
#define STM32_IRQ_EXTI22_PRIORITY 15
+#define STM32_IRQ_TIM1_BRK_TIM9_PRIORITY 7
+#define STM32_IRQ_TIM1_UP_TIM10_PRIORITY 7
+#define STM32_IRQ_TIM1_TRGCO_TIM11_PRIORITY 7
+#define STM32_IRQ_TIM1_CC_PRIORITY 7
+#define STM32_IRQ_TIM2_PRIORITY 7
+#define STM32_IRQ_TIM3_PRIORITY 7
+#define STM32_IRQ_TIM4_PRIORITY 7
+#define STM32_IRQ_TIM5_PRIORITY 7
+#define STM32_IRQ_TIM6_PRIORITY 7
+#define STM32_IRQ_TIM7_PRIORITY 7
+#define STM32_IRQ_TIM8_BRK_TIM12_PRIORITY 7
+#define STM32_IRQ_TIM8_UP_TIM13_PRIORITY 7
+#define STM32_IRQ_TIM8_TRGCO_TIM14_PRIORITY 7
+#define STM32_IRQ_TIM8_CC_PRIORITY 7
+
+#define STM32_IRQ_USART1_PRIORITY 12
+#define STM32_IRQ_USART2_PRIORITY 12
+#define STM32_IRQ_USART3_PRIORITY 12
+#define STM32_IRQ_UART4_PRIORITY 12
+#define STM32_IRQ_UART5_PRIORITY 12
+#define STM32_IRQ_USART6_PRIORITY 12
+
/*
* ADC driver system settings.
*/
@@ -137,21 +159,11 @@
#define STM32_GPT_USE_TIM7 FALSE
#define STM32_GPT_USE_TIM8 FALSE
#define STM32_GPT_USE_TIM9 FALSE
+#define STM32_GPT_USE_TIM10 FALSE
#define STM32_GPT_USE_TIM11 FALSE
#define STM32_GPT_USE_TIM12 FALSE
+#define STM32_GPT_USE_TIM13 FALSE
#define STM32_GPT_USE_TIM14 FALSE
-#define STM32_GPT_TIM1_IRQ_PRIORITY 7
-#define STM32_GPT_TIM2_IRQ_PRIORITY 7
-#define STM32_GPT_TIM3_IRQ_PRIORITY 7
-#define STM32_GPT_TIM4_IRQ_PRIORITY 7
-#define STM32_GPT_TIM5_IRQ_PRIORITY 7
-#define STM32_GPT_TIM6_IRQ_PRIORITY 7
-#define STM32_GPT_TIM7_IRQ_PRIORITY 7
-#define STM32_GPT_TIM8_IRQ_PRIORITY 7
-#define STM32_GPT_TIM9_IRQ_PRIORITY 7
-#define STM32_GPT_TIM11_IRQ_PRIORITY 7
-#define STM32_GPT_TIM12_IRQ_PRIORITY 7
-#define STM32_GPT_TIM14_IRQ_PRIORITY 7
/*
* I2C driver system settings.
@@ -199,13 +211,11 @@
#define STM32_ICU_USE_TIM5 FALSE
#define STM32_ICU_USE_TIM8 FALSE
#define STM32_ICU_USE_TIM9 FALSE
-#define STM32_ICU_TIM1_IRQ_PRIORITY 7
-#define STM32_ICU_TIM2_IRQ_PRIORITY 7
-#define STM32_ICU_TIM3_IRQ_PRIORITY 7
-#define STM32_ICU_TIM4_IRQ_PRIORITY 7
-#define STM32_ICU_TIM5_IRQ_PRIORITY 7
-#define STM32_ICU_TIM8_IRQ_PRIORITY 7
-#define STM32_ICU_TIM9_IRQ_PRIORITY 7
+#define STM32_ICU_USE_TIM10 FALSE
+#define STM32_ICU_USE_TIM11 FALSE
+#define STM32_ICU_USE_TIM12 FALSE
+#define STM32_ICU_USE_TIM13 FALSE
+#define STM32_ICU_USE_TIM14 FALSE
/*
* MAC driver system settings.
@@ -221,7 +231,6 @@
/*
* PWM driver system settings.
*/
-#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
@@ -229,13 +238,11 @@
#define STM32_PWM_USE_TIM5 FALSE
#define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_USE_TIM9 FALSE
-#define STM32_PWM_TIM1_IRQ_PRIORITY 7
-#define STM32_PWM_TIM2_IRQ_PRIORITY 7
-#define STM32_PWM_TIM3_IRQ_PRIORITY 7
-#define STM32_PWM_TIM4_IRQ_PRIORITY 7
-#define STM32_PWM_TIM5_IRQ_PRIORITY 7
-#define STM32_PWM_TIM8_IRQ_PRIORITY 7
-#define STM32_PWM_TIM9_IRQ_PRIORITY 7
+#define STM32_PWM_USE_TIM10 FALSE
+#define STM32_PWM_USE_TIM11 FALSE
+#define STM32_PWM_USE_TIM12 FALSE
+#define STM32_PWM_USE_TIM13 FALSE
+#define STM32_PWM_USE_TIM14 FALSE
/*
* RTC driver system settings.
@@ -265,12 +272,6 @@
#define STM32_SERIAL_USE_UART4 FALSE
#define STM32_SERIAL_USE_UART5 FALSE
#define STM32_SERIAL_USE_USART6 FALSE
-#define STM32_SERIAL_USART1_PRIORITY 12
-#define STM32_SERIAL_USART2_PRIORITY 12
-#define STM32_SERIAL_USART3_PRIORITY 12
-#define STM32_SERIAL_UART4_PRIORITY 12
-#define STM32_SERIAL_UART5_PRIORITY 12
-#define STM32_SERIAL_USART6_PRIORITY 12
/*
* SPI driver system settings.
@@ -319,12 +320,6 @@
#define STM32_UART_UART5_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
-#define STM32_UART_USART1_IRQ_PRIORITY 12
-#define STM32_UART_USART2_IRQ_PRIORITY 12
-#define STM32_UART_USART3_IRQ_PRIORITY 12
-#define STM32_UART_UART4_IRQ_PRIORITY 12
-#define STM32_UART_UART5_IRQ_PRIORITY 12
-#define STM32_UART_USART6_IRQ_PRIORITY 12
#define STM32_UART_USART1_DMA_PRIORITY 0
#define STM32_UART_USART2_DMA_PRIORITY 0
#define STM32_UART_USART3_DMA_PRIORITY 0
diff --git a/platforms/chibios/boards/GENERIC_STM32_F411XE/board/board.mk b/platforms/chibios/boards/GENERIC_STM32_F411XE/board/board.mk
new file mode 100644
index 0000000000..bb00b1a2b0
--- /dev/null
+++ b/platforms/chibios/boards/GENERIC_STM32_F411XE/board/board.mk
@@ -0,0 +1,9 @@
+# List of all the board related files.
+BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_F411RE/board.c
+
+# Required include directories
+BOARDINC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_F411RE
+
+# Shared variables
+ALLCSRC += $(BOARDSRC)
+ALLINC += $(BOARDINC)
diff --git a/platforms/chibios/boards/GENERIC_STM32_F411XE/configs/board.h b/platforms/chibios/boards/GENERIC_STM32_F411XE/configs/board.h
new file mode 100644
index 0000000000..30af6b0c86
--- /dev/null
+++ b/platforms/chibios/boards/GENERIC_STM32_F411XE/configs/board.h
@@ -0,0 +1,20 @@
+/* Copyright 2020 Nick Brassel (tzarc)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#include_next "board.h"
+
+#undef STM32_HSE_BYPASS
diff --git a/platforms/chibios/boards/GENERIC_STM32_F411XE/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_F411XE/configs/config.h
new file mode 100644
index 0000000000..e06ca0b725
--- /dev/null
+++ b/platforms/chibios/boards/GENERIC_STM32_F411XE/configs/config.h
@@ -0,0 +1,22 @@
+/* Copyright 2020 Nick Brassel (tzarc)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#define BOARD_OTG_NOVBUSSENS 1
+
+#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
+# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
+#endif
diff --git a/platforms/chibios/boards/GENERIC_STM32_F411XE/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F411XE/configs/mcuconf.h
new file mode 100644
index 0000000000..e1d45ca487
--- /dev/null
+++ b/platforms/chibios/boards/GENERIC_STM32_F411XE/configs/mcuconf.h
@@ -0,0 +1,252 @@
+/*
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#ifndef MCUCONF_H
+#define MCUCONF_H
+
+/*
+ * STM32F4xx drivers configuration.
+ * The following settings override the default settings present in
+ * the various device driver implementation headers.
+ * Note that the settings for each driver only have effect if the whole
+ * driver is enabled in halconf.h.
+ *
+ * IRQ priorities:
+ * 15...0 Lowest...Highest.
+ *
+ * DMA priorities:
+ * 0...3 Lowest...Highest.
+ */
+
+#define STM32F4xx_MCUCONF
+#define STM32F411_MCUCONF
+
+/*
+ * HAL driver system settings.
+ */
+#define STM32_NO_INIT FALSE
+#define STM32_PVD_ENABLE FALSE
+#define STM32_PLS STM32_PLS_LEV0
+#define STM32_BKPRAM_ENABLE FALSE
+#define STM32_HSI_ENABLED TRUE
+#define STM32_LSI_ENABLED TRUE
+#define STM32_HSE_ENABLED TRUE
+#define STM32_LSE_ENABLED FALSE
+#define STM32_CLOCK48_REQUIRED TRUE
+#define STM32_SW STM32_SW_PLL
+#define STM32_PLLSRC STM32_PLLSRC_HSE
+#define STM32_PLLM_VALUE 4
+#define STM32_PLLN_VALUE 96
+#define STM32_PLLP_VALUE 2
+#define STM32_PLLQ_VALUE 4
+#define STM32_HPRE STM32_HPRE_DIV1
+#define STM32_PPRE1 STM32_PPRE1_DIV2
+#define STM32_PPRE2 STM32_PPRE2_DIV1
+#define STM32_RTCSEL STM32_RTCSEL_LSI
+#define STM32_RTCPRE_VALUE 8
+#define STM32_MCO1SEL STM32_MCO1SEL_HSI
+#define STM32_MCO1PRE STM32_MCO1PRE_DIV1
+#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
+#define STM32_MCO2PRE STM32_MCO2PRE_DIV5
+#define STM32_I2SSRC STM32_I2SSRC_CKIN
+#define STM32_PLLI2SN_VALUE 192
+#define STM32_PLLI2SR_VALUE 5
+
+/*
+ * IRQ system settings.
+ */
+#define STM32_IRQ_EXTI0_PRIORITY 6
+#define STM32_IRQ_EXTI1_PRIORITY 6
+#define STM32_IRQ_EXTI2_PRIORITY 6
+#define STM32_IRQ_EXTI3_PRIORITY 6
+#define STM32_IRQ_EXTI4_PRIORITY 6
+#define STM32_IRQ_EXTI5_9_PRIORITY 6
+#define STM32_IRQ_EXTI10_15_PRIORITY 6
+#define STM32_IRQ_EXTI16_PRIORITY 6
+#define STM32_IRQ_EXTI17_PRIORITY 15
+#define STM32_IRQ_EXTI18_PRIORITY 6
+#define STM32_IRQ_EXTI19_PRIORITY 6
+#define STM32_IRQ_EXTI20_PRIORITY 6
+#define STM32_IRQ_EXTI21_PRIORITY 15
+#define STM32_IRQ_EXTI22_PRIORITY 15
+
+#define STM32_IRQ_TIM1_BRK_TIM9_PRIORITY 7
+#define STM32_IRQ_TIM1_UP_TIM10_PRIORITY 7
+#define STM32_IRQ_TIM1_TRGCO_TIM11_PRIORITY 7
+#define STM32_IRQ_TIM1_CC_PRIORITY 7
+#define STM32_IRQ_TIM2_PRIORITY 7
+#define STM32_IRQ_TIM3_PRIORITY 7
+#define STM32_IRQ_TIM4_PRIORITY 7
+#define STM32_IRQ_TIM5_PRIORITY 7
+
+#define STM32_IRQ_USART1_PRIORITY 12
+#define STM32_IRQ_USART2_PRIORITY 12
+#define STM32_IRQ_USART6_PRIORITY 12
+
+/*
+ * ADC driver system settings.
+ */
+#define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4
+#define STM32_ADC_USE_ADC1 FALSE
+#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
+#define STM32_ADC_ADC1_DMA_PRIORITY 2
+#define STM32_ADC_IRQ_PRIORITY 6
+#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6
+
+/*
+ * GPT driver system settings.
+ */
+#define STM32_GPT_USE_TIM1 FALSE
+#define STM32_GPT_USE_TIM2 FALSE
+#define STM32_GPT_USE_TIM3 FALSE
+#define STM32_GPT_USE_TIM4 FALSE
+#define STM32_GPT_USE_TIM5 FALSE
+#define STM32_GPT_USE_TIM9 FALSE
+#define STM32_GPT_USE_TIM10 FALSE
+#define STM32_GPT_USE_TIM11 FALSE
+
+/*
+ * I2C driver system settings.
+ */
+#define STM32_I2C_USE_I2C1 FALSE
+#define STM32_I2C_USE_I2C2 FALSE
+#define STM32_I2C_USE_I2C3 FALSE
+#define STM32_I2C_BUSY_TIMEOUT 50
+#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
+#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
+#define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
+#define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
+#define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
+#define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
+#define STM32_I2C_I2C1_IRQ_PRIORITY 5
+#define STM32_I2C_I2C2_IRQ_PRIORITY 5
+#define STM32_I2C_I2C3_IRQ_PRIORITY 5
+#define STM32_I2C_I2C1_DMA_PRIORITY 3
+#define STM32_I2C_I2C2_DMA_PRIORITY 3
+#define STM32_I2C_I2C3_DMA_PRIORITY 3
+#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
+
+/*
+ * I2S driver system settings.
+ */
+#define STM32_I2S_USE_SPI2 FALSE
+#define STM32_I2S_USE_SPI3 FALSE
+#define STM32_I2S_SPI2_IRQ_PRIORITY 10
+#define STM32_I2S_SPI3_IRQ_PRIORITY 10
+#define STM32_I2S_SPI2_DMA_PRIORITY 1
+#define STM32_I2S_SPI3_DMA_PRIORITY 1
+#define STM32_I2S_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
+#define STM32_I2S_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
+#define STM32_I2S_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
+#define STM32_I2S_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
+#define STM32_I2S_DMA_ERROR_HOOK(i2sp) osalSysHalt("DMA failure")
+
+/*
+ * ICU driver system settings.
+ */
+#define STM32_ICU_USE_TIM1 FALSE
+#define STM32_ICU_USE_TIM2 FALSE
+#define STM32_ICU_USE_TIM3 FALSE
+#define STM32_ICU_USE_TIM4 FALSE
+#define STM32_ICU_USE_TIM5 FALSE
+#define STM32_ICU_USE_TIM9 FALSE
+#define STM32_ICU_USE_TIM10 FALSE
+#define STM32_ICU_USE_TIM11 FALSE
+
+/*
+ * PWM driver system settings.
+ */
+#define STM32_PWM_USE_TIM1 FALSE
+#define STM32_PWM_USE_TIM2 FALSE
+#define STM32_PWM_USE_TIM3 FALSE
+#define STM32_PWM_USE_TIM4 FALSE
+#define STM32_PWM_USE_TIM5 FALSE
+#define STM32_PWM_USE_TIM9 FALSE
+#define STM32_PWM_USE_TIM10 FALSE
+#define STM32_PWM_USE_TIM11 FALSE
+
+/*
+ * RTC driver system settings.
+ */
+#define STM32_RTC_PRESA_VALUE 32
+#define STM32_RTC_PRESS_VALUE 1024
+#define STM32_RTC_CR_INIT 0
+#define STM32_RTC_TAMPCR_INIT 0
+
+/*
+ * SERIAL driver system settings.
+ */
+#define STM32_SERIAL_USE_USART1 FALSE
+#define STM32_SERIAL_USE_USART2 FALSE
+#define STM32_SERIAL_USE_USART6 FALSE
+
+/*
+ * SPI driver system settings.
+ */
+#define STM32_SPI_USE_SPI1 FALSE
+#define STM32_SPI_USE_SPI2 FALSE
+#define STM32_SPI_USE_SPI3 FALSE
+#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)
+#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
+#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
+#define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
+#define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
+#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
+#define STM32_SPI_SPI1_DMA_PRIORITY 1
+#define STM32_SPI_SPI2_DMA_PRIORITY 1
+#define STM32_SPI_SPI3_DMA_PRIORITY 1
+#define STM32_SPI_SPI1_IRQ_PRIORITY 10
+#define STM32_SPI_SPI2_IRQ_PRIORITY 10
+#define STM32_SPI_SPI3_IRQ_PRIORITY 10
+#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
+
+/*
+ * ST driver system settings.
+ */
+#define STM32_ST_IRQ_PRIORITY 8
+#define STM32_ST_USE_TIMER 2
+
+/*
+ * UART driver system settings.
+ */
+#define STM32_UART_USE_USART1 FALSE
+#define STM32_UART_USE_USART2 FALSE
+#define STM32_UART_USE_USART6 FALSE
+#define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
+#define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
+#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
+#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
+#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
+#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
+#define STM32_UART_USART1_DMA_PRIORITY 0
+#define STM32_UART_USART2_DMA_PRIORITY 0
+#define STM32_UART_USART6_DMA_PRIORITY 0
+#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
+
+/*
+ * USB driver system settings.
+ */
+#define STM32_USB_USE_OTG1 TRUE
+#define STM32_USB_OTG1_IRQ_PRIORITY 14
+#define STM32_USB_OTG1_RX_FIFO_SIZE 512
+#define STM32_USB_HOST_WAKEUP_DURATION 2
+
+/*
+ * WDG driver system settings.
+ */
+#define STM32_WDG_USE_IWDG FALSE
+
+#endif /* MCUCONF_H */
diff --git a/platforms/chibios/boards/GENERIC_STM32_G431XB/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_G431XB/configs/mcuconf.h
index d115028300..fd00280115 100644
--- a/platforms/chibios/boards/GENERIC_STM32_G431XB/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_STM32_G431XB/configs/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -39,6 +39,7 @@
* HAL driver system settings.
*/
#define STM32_NO_INIT FALSE
+#define STM32_CLOCK_DYNAMIC FALSE
#define STM32_VOS STM32_VOS_RANGE1
#define STM32_PWR_BOOST TRUE
#define STM32_PWR_CR2 (PWR_CR2_PLS_LEV0)
@@ -227,7 +228,6 @@
/*
* PWM driver system settings.
*/
-#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
@@ -240,6 +240,13 @@
/*
* RTC driver system settings.
*/
+#define STM32_RTC_PRESA_VALUE 32
+#define STM32_RTC_PRESS_VALUE 1024
+#define STM32_RTC_CR_INIT 0
+#define STM32_TAMP_CR1_INIT 0
+#define STM32_TAMP_CR2_INIT 0
+#define STM32_TAMP_FLTCR_INIT 0
+#define STM32_TAMP_IER_INIT 0
/*
* SDC driver system settings.
@@ -255,6 +262,15 @@
#define STM32_SERIAL_USE_LPUART1 FALSE
/*
+ * SIO driver system settings.
+ */
+#define STM32_SIO_USE_USART1 FALSE
+#define STM32_SIO_USE_USART2 FALSE
+#define STM32_SIO_USE_USART3 FALSE
+#define STM32_SIO_USE_UART4 FALSE
+#define STM32_SIO_USE_LPUART1 FALSE
+
+/*
* SPI driver system settings.
*/
#define STM32_SPI_USE_SPI1 FALSE
diff --git a/platforms/chibios/boards/GENERIC_STM32_G474XE/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_G474XE/configs/mcuconf.h
index 5710e2cb45..d6385da624 100644
--- a/platforms/chibios/boards/GENERIC_STM32_G474XE/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_STM32_G474XE/configs/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -41,6 +41,7 @@
* HAL driver system settings.
*/
#define STM32_NO_INIT FALSE
+#define STM32_CLOCK_DYNAMIC FALSE
#define STM32_VOS STM32_VOS_RANGE1
#define STM32_PWR_BOOST TRUE
#define STM32_PWR_CR2 (PWR_CR2_PLS_LEV0)
@@ -274,7 +275,6 @@
/*
* PWM driver system settings.
*/
-#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
@@ -289,6 +289,13 @@
/*
* RTC driver system settings.
*/
+#define STM32_RTC_PRESA_VALUE 32
+#define STM32_RTC_PRESS_VALUE 1024
+#define STM32_RTC_CR_INIT 0
+#define STM32_TAMP_CR1_INIT 0
+#define STM32_TAMP_CR2_INIT 0
+#define STM32_TAMP_FLTCR_INIT 0
+#define STM32_TAMP_IER_INIT 0
/*
* SDC driver system settings.
@@ -305,6 +312,16 @@
#define STM32_SERIAL_USE_LPUART1 FALSE
/*
+ * SIO driver system settings.
+ */
+#define STM32_SIO_USE_USART1 FALSE
+#define STM32_SIO_USE_USART2 FALSE
+#define STM32_SIO_USE_USART3 FALSE
+#define STM32_SIO_USE_UART4 FALSE
+#define STM32_SIO_USE_UART5 FALSE
+#define STM32_SIO_USE_LPUART1 FALSE
+
+/*
* SPI driver system settings.
*/
#define STM32_SPI_USE_SPI1 FALSE
@@ -383,5 +400,6 @@
*/
#define STM32_WSPI_USE_QUADSPI1 FALSE
#define STM32_WSPI_QUADSPI1_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
+#define STM32_WSPI_QUADSPI1_PRESCALER_VALUE 1
#endif /* MCUCONF_H */
diff --git a/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/board.h b/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/board.h
index 2e37d95fe3..de5f85acdd 100644
--- a/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/board.h
+++ b/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/board.h
@@ -18,7 +18,4 @@
#include_next "board.h"
#undef STM32L432xx
-
-// Pretend that we're an L443xx as the ChibiOS definitions for L4x2/L4x3 mistakenly don't enable GPIOH, I2C2, or SPI2.
-// Until ChibiOS upstream is fixed, this should be kept at L443, as nothing in QMK currently utilises the crypto peripheral on the L443.
-#define STM32L443xx
+#define STM32L422xx
diff --git a/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/config.h
index fc9055ccfb..d67de4cfe2 100644
--- a/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/config.h
+++ b/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/config.h
@@ -18,8 +18,6 @@
/* It is chip dependent, the correct number can be looked up by checking against ST's application note AN2606.
*/
-#define PAL_STM32_OSPEED_HIGHEST PAL_STM32_OSPEED_HIGH
-
#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif
diff --git a/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/mcuconf.h
index 8ad5a8da21..47f1598b74 100644
--- a/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -32,12 +32,7 @@
#define MCUCONF_H
#define STM32L4xx_MCUCONF
-#define STM32L412_MCUCONF
#define STM32L422_MCUCONF
-#define STM32L432_MCUCONF
-#define STM32L433_MCUCONF
-#define STM32L442_MCUCONF
-#define STM32L443_MCUCONF
/*
* HAL driver system settings.
@@ -52,16 +47,13 @@
#define STM32_HSE_ENABLED FALSE
#define STM32_LSE_ENABLED FALSE
#define STM32_MSIPLL_ENABLED FALSE
-#define STM32_ADC_CLOCK_ENABLED TRUE
-#define STM32_USB_CLOCK_ENABLED TRUE
-#define STM32_SAI1_CLOCK_ENABLED TRUE
-#define STM32_SAI2_CLOCK_ENABLED TRUE
#define STM32_MSIRANGE STM32_MSIRANGE_4M
#define STM32_MSISRANGE STM32_MSISRANGE_4M
#define STM32_SW STM32_SW_PLL
#define STM32_PLLSRC STM32_PLLSRC_HSI16
#define STM32_PLLM_VALUE 4
#define STM32_PLLN_VALUE 80
+#define STM32_PLLPDIV_VALUE 0
#define STM32_PLLP_VALUE 7
#define STM32_PLLQ_VALUE 4
#define STM32_PLLR_VALUE 4
@@ -73,29 +65,22 @@
#define STM32_MCOPRE STM32_MCOPRE_DIV1
#define STM32_LSCOSEL STM32_LSCOSEL_NOCLOCK
#define STM32_PLLSAI1N_VALUE 72
+#define STM32_PLLSAI1PDIV_VALUE 6
#define STM32_PLLSAI1P_VALUE 7
#define STM32_PLLSAI1Q_VALUE 6
#define STM32_PLLSAI1R_VALUE 6
-#define STM32_PLLSAI2N_VALUE 72
-#define STM32_PLLSAI2P_VALUE 7
-#define STM32_PLLSAI2R_VALUE 6
/*
* Peripherals clock sources.
*/
#define STM32_USART1SEL STM32_USART1SEL_SYSCLK
#define STM32_USART2SEL STM32_USART2SEL_SYSCLK
-#define STM32_USART3SEL STM32_USART3SEL_SYSCLK
-#define STM32_UART4SEL STM32_UART4SEL_SYSCLK
-#define STM32_UART5SEL STM32_UART5SEL_SYSCLK
#define STM32_LPUART1SEL STM32_LPUART1SEL_SYSCLK
#define STM32_I2C1SEL STM32_I2C1SEL_SYSCLK
-#define STM32_I2C2SEL STM32_I2C2SEL_SYSCLK
#define STM32_I2C3SEL STM32_I2C3SEL_SYSCLK
#define STM32_LPTIM1SEL STM32_LPTIM1SEL_PCLK1
#define STM32_LPTIM2SEL STM32_LPTIM2SEL_PCLK1
#define STM32_SAI1SEL STM32_SAI1SEL_OFF
-#define STM32_SAI2SEL STM32_SAI2SEL_OFF
#define STM32_CLK48SEL STM32_CLK48SEL_HSI48
#define STM32_ADCSEL STM32_ADCSEL_SYSCLK
#define STM32_SWPMI1SEL STM32_SWPMI1SEL_PCLK1
@@ -127,7 +112,6 @@
#define STM32_IRQ_USART1_PRIORITY 12
#define STM32_IRQ_USART2_PRIORITY 12
-#define STM32_IRQ_USART3_PRIORITY 12
#define STM32_IRQ_LPUART1_PRIORITY 12
/*
@@ -137,29 +121,15 @@
#define STM32_ADC_USE_ADC1 FALSE
#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(1, 1)
#define STM32_ADC_ADC1_DMA_PRIORITY 2
+#define STM32_ADC_USE_ADC2 FALSE
+#define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
+#define STM32_ADC_ADC2_DMA_PRIORITY 2
#define STM32_ADC_ADC12_IRQ_PRIORITY 5
#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 5
+#define STM32_ADC_ADC2_DMA_IRQ_PRIORITY 5
#define STM32_ADC_ADC123_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV1
#define STM32_ADC_ADC123_PRESC ADC_CCR_PRESC_DIV2
-/*
- * CAN driver system settings.
- */
-#define STM32_CAN_USE_CAN1 FALSE
-#define STM32_CAN_CAN1_IRQ_PRIORITY 11
-
-/*
- * DAC driver system settings.
- */
-#define STM32_DAC_DUAL_MODE FALSE
-#define STM32_DAC_USE_DAC1_CH1 FALSE
-#define STM32_DAC_USE_DAC1_CH2 FALSE
-#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10
-#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10
-#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2
-#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2
-#define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
-#define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
/*
* GPT driver system settings.
@@ -198,7 +168,6 @@
/*
* PWM driver system settings.
*/
-#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM15 FALSE
@@ -218,23 +187,22 @@
#define STM32_SERIAL_USE_USART1 FALSE
#define STM32_SERIAL_USE_USART2 FALSE
#define STM32_SERIAL_USE_LPUART1 FALSE
-#define STM32_SERIAL_USART1_PRIORITY 12
-#define STM32_SERIAL_USART2_PRIORITY 12
-#define STM32_SERIAL_LPUART1_PRIORITY 12
+
+/*
+ * SIO driver system settings.
+ */
+#define STM32_SIO_USE_USART1 FALSE
+#define STM32_SIO_USE_USART2 FALSE
+#define STM32_SIO_USE_LPUART1 FALSE
/*
* SPI driver system settings.
*/
#define STM32_SPI_USE_SPI1 FALSE
-#define STM32_SPI_USE_SPI3 FALSE
#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
-#define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
-#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
#define STM32_SPI_SPI1_DMA_PRIORITY 1
-#define STM32_SPI_SPI3_DMA_PRIORITY 1
#define STM32_SPI_SPI1_IRQ_PRIORITY 10
-#define STM32_SPI_SPI3_IRQ_PRIORITY 10
#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
/*
diff --git a/platforms/chibios/boards/GENERIC_STM32_L432XC/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_L432XC/configs/config.h
index b1838b30a8..839d031ca4 100644
--- a/platforms/chibios/boards/GENERIC_STM32_L432XC/configs/config.h
+++ b/platforms/chibios/boards/GENERIC_STM32_L432XC/configs/config.h
@@ -2,9 +2,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
-// Fixup equivalent usages within QMK as the base board definitions only go up to high
-#define PAL_STM32_OSPEED_HIGHEST PAL_STM32_OSPEED_HIGH
-
#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif
diff --git a/platforms/chibios/boards/GENERIC_STM32_L432XC/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_L432XC/configs/mcuconf.h
index 707134d49e..be64b04812 100644
--- a/platforms/chibios/boards/GENERIC_STM32_L432XC/configs/mcuconf.h
+++ b/platforms/chibios/boards/GENERIC_STM32_L432XC/configs/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -33,7 +33,6 @@
#define STM32L4xx_MCUCONF
#define STM32L432_MCUCONF
-#define STM32L433_MCUCONF
/*
* HAL driver system settings.
@@ -183,7 +182,6 @@
/*
* PWM driver system settings.
*/
-#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM15 FALSE
@@ -203,9 +201,13 @@
#define STM32_SERIAL_USE_USART1 FALSE
#define STM32_SERIAL_USE_USART2 FALSE
#define STM32_SERIAL_USE_LPUART1 FALSE
-#define STM32_SERIAL_USART1_PRIORITY 12
-#define STM32_SERIAL_USART2_PRIORITY 12
-#define STM32_SERIAL_LPUART1_PRIORITY 12
+
+/*
+ * SIO driver system settings.
+ */
+#define STM32_SIO_USE_USART1 FALSE
+#define STM32_SIO_USE_USART2 FALSE
+#define STM32_SIO_USE_LPUART1 FALSE
/*
* SPI driver system settings.
diff --git a/platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h
index fc9055ccfb..d67de4cfe2 100644
--- a/platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h
+++ b/platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h
@@ -18,8 +18,6 @@
/* It is chip dependent, the correct number can be looked up by checking against ST's application note AN2606.
*/
-#define PAL_STM32_OSPEED_HIGHEST PAL_STM32_OSPEED_HIGH
-
#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif
diff --git a/platforms/chibios/boards/QMK_PROTON_C/configs/chconf.h b/platforms/chibios/boards/QMK_PROTON_C/configs/chconf.h
index f812332960..cc10304a3f 100644
--- a/platforms/chibios/boards/QMK_PROTON_C/configs/chconf.h
+++ b/platforms/chibios/boards/QMK_PROTON_C/configs/chconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -29,7 +29,27 @@
#define CHCONF_H
#define _CHIBIOS_RT_CONF_
-#define _CHIBIOS_RT_CONF_VER_6_1_
+#define _CHIBIOS_RT_CONF_VER_7_0_
+
+/*===========================================================================*/
+/**
+ * @name System settings
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Handling of instances.
+ * @note If enabled then threads assigned to various instances can
+ * interact each other using the same synchronization objects.
+ * If disabled then each OS instance is a separate world, no
+ * direct interactions are handled by the OS.
+ */
+#if !defined(CH_CFG_SMP_MODE)
+#define CH_CFG_SMP_MODE FALSE
+#endif
+
+/** @} */
/*===========================================================================*/
/**
@@ -161,6 +181,16 @@
#endif
/**
+ * @brief Time Stamps APIs.
+ * @details If enabled then the time stamps APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_TIMESTAMP)
+#define CH_CFG_USE_TIMESTAMP TRUE
+#endif
+
+/**
* @brief Threads registry APIs.
* @details If enabled then the registry APIs are included in the kernel.
*
@@ -631,7 +661,7 @@
* @details User fields added to the end of the @p ch_system_t structure.
*/
#define CH_CFG_SYSTEM_EXTRA_FIELDS \
- /* Add threads custom fields here.*/
+ /* Add system custom fields here.*/
/**
* @brief System initialization hook.
@@ -639,7 +669,23 @@
* just before interrupts are enabled globally.
*/
#define CH_CFG_SYSTEM_INIT_HOOK() { \
- /* Add threads initialization code here.*/ \
+ /* Add system initialization code here.*/ \
+}
+
+/**
+ * @brief OS instance structure extension.
+ * @details User fields added to the end of the @p os_instance_t structure.
+ */
+#define CH_CFG_OS_INSTANCE_EXTRA_FIELDS \
+ /* Add OS instance custom fields here.*/
+
+/**
+ * @brief OS instance initialization hook.
+ *
+ * @param[in] oip pointer to the @p os_instance_t structure
+ */
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+ /* Add OS instance initialization code here.*/ \
}
/**
@@ -655,6 +701,8 @@
*
* @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs.
+ *
+ * @param[in] tp pointer to the @p thread_t structure
*/
#define CH_CFG_THREAD_INIT_HOOK(tp) { \
/* Add threads initialization code here.*/ \
@@ -663,6 +711,8 @@
/**
* @brief Threads finalization hook.
* @details User finalization code added to the @p chThdExit() API.
+ *
+ * @param[in] tp pointer to the @p thread_t structure
*/
#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
/* Add threads finalization code here.*/ \
@@ -671,6 +721,9 @@
/**
* @brief Context switch hook.
* @details This hook is invoked just before switching between threads.
+ *
+ * @param[in] ntp thread being switched in
+ * @param[in] otp thread being switched out
*/
#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
/* Context switch code here.*/ \
@@ -745,6 +798,14 @@
/* Trace code here.*/ \
}
+/**
+ * @brief Runtime Faults Collection Unit hook.
+ * @details This hook is invoked each time new faults are collected and stored.
+ */
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+ /* Faults handling code here.*/ \
+}
+
/** @} */
/*===========================================================================*/
diff --git a/platforms/chibios/boards/QMK_PROTON_C/configs/halconf.h b/platforms/chibios/boards/QMK_PROTON_C/configs/halconf.h
index d7a639a6d0..8367328a04 100644
--- a/platforms/chibios/boards/QMK_PROTON_C/configs/halconf.h
+++ b/platforms/chibios/boards/QMK_PROTON_C/configs/halconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
#define HALCONF_H
#define _CHIBIOS_HAL_CONF_
-#define _CHIBIOS_HAL_CONF_VER_7_1_
+#define _CHIBIOS_HAL_CONF_VER_8_0_
#include <mcuconf.h>
@@ -416,6 +416,26 @@
#endif
/*===========================================================================*/
+/* SIO driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Default bit rate.
+ * @details Configuration parameter, this is the baud rate selected for the
+ * default configuration.
+ */
+#if !defined(SIO_DEFAULT_BITRATE) || defined(__DOXYGEN__)
+#define SIO_DEFAULT_BITRATE 38400
+#endif
+
+/**
+ * @brief Support for thread synchronization API.
+ */
+#if !defined(SIO_USE_SYNCHRONIZATION) || defined(__DOXYGEN__)
+#define SIO_USE_SYNCHRONIZATION TRUE
+#endif
+
+/*===========================================================================*/
/* SERIAL_USB driver related setting. */
/*===========================================================================*/
@@ -451,11 +471,10 @@
#endif
/**
- * @brief Enables circular transfers APIs.
- * @note Disabling this option saves both code and data space.
+ * @brief Inserts an assertion on function errors before returning.
*/
-#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
-#define SPI_USE_CIRCULAR FALSE
+#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__)
+#define SPI_USE_ASSERT_ON_ERROR TRUE
#endif
/**
diff --git a/platforms/chibios/boards/QMK_PROTON_C/configs/mcuconf.h b/platforms/chibios/boards/QMK_PROTON_C/configs/mcuconf.h
index 4d7b586c08..cab4c29cf6 100644
--- a/platforms/chibios/boards/QMK_PROTON_C/configs/mcuconf.h
+++ b/platforms/chibios/boards/QMK_PROTON_C/configs/mcuconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -186,7 +186,6 @@
/*
* PWM driver system settings.
*/
-#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 TRUE
diff --git a/platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.c b/platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.c
index 8a34e81f25..cba977da77 100644
--- a/platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.c
+++ b/platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.c
@@ -16,9 +16,6 @@
#include <hal.h>
-// Value to place in RTC backup register 10 for persistent bootloader mode
-#define RTC_BOOTLOADER_FLAG 0x424C
-
/**
* @brief PAL setup.
* @details Digital I/O ports static configuration as defined in @p board.h.
diff --git a/platforms/chibios/boards/STM32_F103_STM32DUINO/configs/chconf.h b/platforms/chibios/boards/STM32_F103_STM32DUINO/configs/chconf.h
new file mode 100644
index 0000000000..0349c11dcc
--- /dev/null
+++ b/platforms/chibios/boards/STM32_F103_STM32DUINO/configs/chconf.h
@@ -0,0 +1,8 @@
+// Copyright 2022 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#define CH_CFG_ST_TIMEDELTA 0
+
+#include_next <chconf.h>
diff --git a/platforms/chibios/boards/STM32_F103_STM32DUINO/configs/config.h b/platforms/chibios/boards/STM32_F103_STM32DUINO/configs/config.h
new file mode 100644
index 0000000000..d8b852cab7
--- /dev/null
+++ b/platforms/chibios/boards/STM32_F103_STM32DUINO/configs/config.h
@@ -0,0 +1,9 @@
+// Copyright 2022 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+#pragma once
+
+// Value to place in RTC backup register 10 for persistent bootloader mode
+#define RTC_BOOTLOADER_FLAG 0x424C
+
+// Value to place in RTC backup register 10 for instant reboot mode
+#define RTC_BOOTLOADER_JUST_UPLOADED 0x424D
diff --git a/platforms/chibios/boards/common/configs/chconf.h b/platforms/chibios/boards/common/configs/chconf.h
index 18ad609ca1..5db836e37c 100644
--- a/platforms/chibios/boards/common/configs/chconf.h
+++ b/platforms/chibios/boards/common/configs/chconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -29,7 +29,27 @@
#define CHCONF_H
#define _CHIBIOS_RT_CONF_
-#define _CHIBIOS_RT_CONF_VER_6_1_
+#define _CHIBIOS_RT_CONF_VER_7_0_
+
+/*===========================================================================*/
+/**
+ * @name System settings
+ * @{
+ */
+/*===========================================================================*/
+
+/**
+ * @brief Handling of instances.
+ * @note If enabled then threads assigned to various instances can
+ * interact each other using the same synchronization objects.
+ * If disabled then each OS instance is a separate world, no
+ * direct interactions are handled by the OS.
+ */
+#if !defined(CH_CFG_SMP_MODE)
+#define CH_CFG_SMP_MODE FALSE
+#endif
+
+/** @} */
/*===========================================================================*/
/**
@@ -161,6 +181,16 @@
#endif
/**
+ * @brief Time Stamps APIs.
+ * @details If enabled then the time stamps APIs are included in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_TIMESTAMP)
+#define CH_CFG_USE_TIMESTAMP TRUE
+#endif
+
+/**
* @brief Threads registry APIs.
* @details If enabled then the registry APIs are included in the kernel.
*
@@ -631,7 +661,7 @@
* @details User fields added to the end of the @p ch_system_t structure.
*/
#define CH_CFG_SYSTEM_EXTRA_FIELDS \
- /* Add threads custom fields here.*/
+ /* Add system custom fields here.*/
/**
* @brief System initialization hook.
@@ -639,7 +669,23 @@
* just before interrupts are enabled globally.
*/
#define CH_CFG_SYSTEM_INIT_HOOK() { \
- /* Add threads initialization code here.*/ \
+ /* Add system initialization code here.*/ \
+}
+
+/**
+ * @brief OS instance structure extension.
+ * @details User fields added to the end of the @p os_instance_t structure.
+ */
+#define CH_CFG_OS_INSTANCE_EXTRA_FIELDS \
+ /* Add OS instance custom fields here.*/
+
+/**
+ * @brief OS instance initialization hook.
+ *
+ * @param[in] oip pointer to the @p os_instance_t structure
+ */
+#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) { \
+ /* Add OS instance initialization code here.*/ \
}
/**
@@ -655,6 +701,8 @@
*
* @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs.
+ *
+ * @param[in] tp pointer to the @p thread_t structure
*/
#define CH_CFG_THREAD_INIT_HOOK(tp) { \
/* Add threads initialization code here.*/ \
@@ -663,6 +711,8 @@
/**
* @brief Threads finalization hook.
* @details User finalization code added to the @p chThdExit() API.
+ *
+ * @param[in] tp pointer to the @p thread_t structure
*/
#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
/* Add threads finalization code here.*/ \
@@ -671,6 +721,9 @@
/**
* @brief Context switch hook.
* @details This hook is invoked just before switching between threads.
+ *
+ * @param[in] ntp thread being switched in
+ * @param[in] otp thread being switched out
*/
#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
/* Context switch code here.*/ \
@@ -745,6 +798,14 @@
/* Trace code here.*/ \
}
+/**
+ * @brief Runtime Faults Collection Unit hook.
+ * @details This hook is invoked each time new faults are collected and stored.
+ */
+#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) { \
+ /* Faults handling code here.*/ \
+}
+
/** @} */
/*===========================================================================*/
diff --git a/platforms/chibios/boards/common/configs/halconf.h b/platforms/chibios/boards/common/configs/halconf.h
index c80f67ee27..1805a77438 100644
--- a/platforms/chibios/boards/common/configs/halconf.h
+++ b/platforms/chibios/boards/common/configs/halconf.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
#define HALCONF_H
#define _CHIBIOS_HAL_CONF_
-#define _CHIBIOS_HAL_CONF_VER_7_1_
+#define _CHIBIOS_HAL_CONF_VER_8_0_
#include <mcuconf.h>
@@ -416,6 +416,26 @@
#endif
/*===========================================================================*/
+/* SIO driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Default bit rate.
+ * @details Configuration parameter, this is the baud rate selected for the
+ * default configuration.
+ */
+#if !defined(SIO_DEFAULT_BITRATE) || defined(__DOXYGEN__)
+#define SIO_DEFAULT_BITRATE 38400
+#endif
+
+/**
+ * @brief Support for thread synchronization API.
+ */
+#if !defined(SIO_USE_SYNCHRONIZATION) || defined(__DOXYGEN__)
+#define SIO_USE_SYNCHRONIZATION TRUE
+#endif
+
+/*===========================================================================*/
/* SERIAL_USB driver related setting. */
/*===========================================================================*/
@@ -451,11 +471,10 @@
#endif
/**
- * @brief Enables circular transfers APIs.
- * @note Disabling this option saves both code and data space.
+ * @brief Inserts an assertion on function errors before returning.
*/
-#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
-#define SPI_USE_CIRCULAR FALSE
+#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__)
+#define SPI_USE_ASSERT_ON_ERROR TRUE
#endif
/**
diff --git a/platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xC_tinyuf2.ld b/platforms/chibios/boards/common/ld/STM32F401xC_tinyuf2.ld
index f4e487dc8f..f4e487dc8f 100644
--- a/platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xC_tinyuf2.ld
+++ b/platforms/chibios/boards/common/ld/STM32F401xC_tinyuf2.ld
diff --git a/platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xE_tinyuf2.ld b/platforms/chibios/boards/common/ld/STM32F401xE_tinyuf2.ld
index 895d13fa32..895d13fa32 100644
--- a/platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xE_tinyuf2.ld
+++ b/platforms/chibios/boards/common/ld/STM32F401xE_tinyuf2.ld
diff --git a/platforms/chibios/boards/BLACKPILL_STM32_F411/ld/STM32F411xC_tinyuf2.ld b/platforms/chibios/boards/common/ld/STM32F411xC_tinyuf2.ld
index 82253d3de5..82253d3de5 100644
--- a/platforms/chibios/boards/BLACKPILL_STM32_F411/ld/STM32F411xC_tinyuf2.ld
+++ b/platforms/chibios/boards/common/ld/STM32F411xC_tinyuf2.ld
diff --git a/platforms/chibios/boards/BLACKPILL_STM32_F411/ld/STM32F411xE_tinyuf2.ld b/platforms/chibios/boards/common/ld/STM32F411xE_tinyuf2.ld
index 1656c67bf7..1656c67bf7 100644
--- a/platforms/chibios/boards/BLACKPILL_STM32_F411/ld/STM32F411xE_tinyuf2.ld
+++ b/platforms/chibios/boards/common/ld/STM32F411xE_tinyuf2.ld
diff --git a/platforms/chibios/bootloaders/custom.c b/platforms/chibios/bootloaders/custom.c
index bba9fc4637..6c5a433953 100644
--- a/platforms/chibios/bootloaders/custom.c
+++ b/platforms/chibios/bootloaders/custom.c
@@ -17,5 +17,6 @@
#include "bootloader.h"
__attribute__((weak)) void bootloader_jump(void) {}
+__attribute__((weak)) void mcu_reset(void) {}
__attribute__((weak)) void enter_bootloader_mode_if_requested(void) {}
diff --git a/platforms/chibios/bootloaders/gd32v_dfu.c b/platforms/chibios/bootloaders/gd32v_dfu.c
index baa7d1f882..100fc472f8 100644
--- a/platforms/chibios/bootloaders/gd32v_dfu.c
+++ b/platforms/chibios/bootloaders/gd32v_dfu.c
@@ -36,5 +36,12 @@ __attribute__((weak)) void bootloader_jump(void) {
*DBGMCU_CMD = DBGMCU_CMD_RESET;
}
+__attribute__((weak)) void mcu_reset(void) {
+ // Confirmed by karlk90, there is no actual reset to bootloader.
+ // This just resets the controller.
+ *DBGMCU_KEY = DBGMCU_KEY_UNLOCK;
+ *DBGMCU_CMD = DBGMCU_CMD_RESET;
+}
+
/* Jumping to bootloader is not possible from user code. */
void enter_bootloader_mode_if_requested(void) {}
diff --git a/platforms/chibios/bootloaders/halfkay.c b/platforms/chibios/bootloaders/halfkay.c
index 168c2abc23..aa11e6c5f4 100644
--- a/platforms/chibios/bootloaders/halfkay.c
+++ b/platforms/chibios/bootloaders/halfkay.c
@@ -23,3 +23,5 @@ __attribute__((weak)) void bootloader_jump(void) {
wait_ms(100);
__BKPT(0);
}
+
+__attribute__((weak)) void mcu_reset(void) {}
diff --git a/platforms/chibios/bootloaders/kiibohd.c b/platforms/chibios/bootloaders/kiibohd.c
index 911e807092..09a4d49b78 100644
--- a/platforms/chibios/bootloaders/kiibohd.c
+++ b/platforms/chibios/bootloaders/kiibohd.c
@@ -30,3 +30,4 @@ __attribute__((weak)) void bootloader_jump(void) {
// request reset
SCB->AIRCR = SCB_AIRCR_VECTKEY_WRITEMAGIC | SCB_AIRCR_SYSRESETREQ_Msk;
}
+__attribute__((weak)) void mcu_reset(void) {}
diff --git a/platforms/chibios/bootloaders/stm32_dfu.c b/platforms/chibios/bootloaders/stm32_dfu.c
index 0e74111367..ff866bd2bc 100644
--- a/platforms/chibios/bootloaders/stm32_dfu.c
+++ b/platforms/chibios/bootloaders/stm32_dfu.c
@@ -61,6 +61,9 @@ __attribute__((weak)) void bootloader_jump(void) {
NVIC_SystemReset();
}
+__attribute__((weak)) void mcu_reset(void) {
+ NVIC_SystemReset();
+}
// not needed at all, but if anybody attempts to invoke it....
void enter_bootloader_mode_if_requested(void) {}
@@ -76,6 +79,10 @@ __attribute__((weak)) void bootloader_jump(void) {
NVIC_SystemReset();
}
+__attribute__((weak)) void mcu_reset(void) {
+ NVIC_SystemReset();
+}
+
void enter_bootloader_mode_if_requested(void) {
unsigned long *check = MAGIC_ADDR;
if (*check == BOOTLOADER_MAGIC) {
diff --git a/platforms/chibios/bootloaders/stm32duino.c b/platforms/chibios/bootloaders/stm32duino.c
index 53d3ba0adb..e2db7fa16c 100644
--- a/platforms/chibios/bootloaders/stm32duino.c
+++ b/platforms/chibios/bootloaders/stm32duino.c
@@ -21,3 +21,8 @@
__attribute__((weak)) void bootloader_jump(void) {
NVIC_SystemReset();
}
+
+__attribute__((weak)) void mcu_reset(void) {
+ BKP->DR10 = RTC_BOOTLOADER_JUST_UPLOADED;
+ NVIC_SystemReset();
+} \ No newline at end of file
diff --git a/platforms/chibios/bootloaders/tinyuf2.c b/platforms/chibios/bootloaders/tinyuf2.c
index 9ffca5dec8..e08855b6c4 100644
--- a/platforms/chibios/bootloaders/tinyuf2.c
+++ b/platforms/chibios/bootloaders/tinyuf2.c
@@ -25,6 +25,10 @@
extern uint32_t _board_dfu_dbl_tap[];
#define DBL_TAP_REG _board_dfu_dbl_tap[0]
+__attribute__((weak)) void mcu_reset(void) {
+ NVIC_SystemReset();
+}
+
__attribute__((weak)) void bootloader_jump(void) {
DBL_TAP_REG = DBL_TAP_MAGIC;
NVIC_SystemReset();
diff --git a/platforms/chibios/bootloaders/wb32_dfu.c b/platforms/chibios/bootloaders/wb32_dfu.c
new file mode 100644
index 0000000000..d021b0863b
--- /dev/null
+++ b/platforms/chibios/bootloaders/wb32_dfu.c
@@ -0,0 +1,53 @@
+/* Copyright 2021 QMK
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "bootloader.h"
+
+#include <ch.h>
+#include <hal.h>
+#include "wait.h"
+
+extern uint32_t __ram0_end__;
+
+/* This code should be checked whether it runs correctly on platforms */
+#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0))
+#define BOOTLOADER_MAGIC 0xDEADBEEF
+#define MAGIC_ADDR (unsigned long *)(SYMVAL(__ram0_end__) - 4)
+
+__attribute__((weak)) void bootloader_jump(void) {
+ *MAGIC_ADDR = BOOTLOADER_MAGIC; // set magic flag => reset handler will jump into boot loader
+ NVIC_SystemReset();
+}
+
+void enter_bootloader_mode_if_requested(void) {
+ unsigned long *check = MAGIC_ADDR;
+ if (*check == BOOTLOADER_MAGIC) {
+ *check = 0;
+ __set_CONTROL(0);
+ __set_MSP(*(__IO uint32_t *)WB32_BOOTLOADER_ADDRESS);
+ __enable_irq();
+
+ typedef void (*BootJump_t)(void);
+ BootJump_t boot_jump = *(BootJump_t *)(WB32_BOOTLOADER_ADDRESS + 4);
+ boot_jump();
+ while (1)
+ ;
+ }
+}
+
+__attribute__((weak)) void mcu_reset(void) {
+ NVIC_SystemReset();
+}
diff --git a/platforms/chibios/converters/promicro_to_proton_c/_pin_defs.h b/platforms/chibios/converters/promicro_to_proton_c/_pin_defs.h
new file mode 100644
index 0000000000..ad1a81692e
--- /dev/null
+++ b/platforms/chibios/converters/promicro_to_proton_c/_pin_defs.h
@@ -0,0 +1,41 @@
+// Copyright 2022 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+// Left side (front)
+#define D3 PAL_LINE(GPIOA, 9)
+#define D2 PAL_LINE(GPIOA, 10)
+// GND
+// GND
+#define D1 PAL_LINE(GPIOB, 7)
+#define D0 PAL_LINE(GPIOB, 6)
+#define D4 PAL_LINE(GPIOB, 5)
+#define C6 PAL_LINE(GPIOB, 4)
+#define D7 PAL_LINE(GPIOB, 3)
+#define E6 PAL_LINE(GPIOB, 2)
+#define B4 PAL_LINE(GPIOB, 1)
+#define B5 PAL_LINE(GPIOB, 0)
+
+// Right side (front)
+// RAW
+// GND
+// RESET
+// VCC
+#define F4 PAL_LINE(GPIOA, 2)
+#define F5 PAL_LINE(GPIOA, 1)
+#define F6 PAL_LINE(GPIOA, 0)
+#define F7 PAL_LINE(GPIOB, 8)
+#define B1 PAL_LINE(GPIOB, 13)
+#define B3 PAL_LINE(GPIOB, 14)
+#define B2 PAL_LINE(GPIOB, 15)
+#define B6 PAL_LINE(GPIOB, 9)
+
+// LEDs (only D5/C13 uses an actual LED)
+#ifdef CONVERT_TO_PROTON_C_RXLED
+# define D5 PAL_LINE(GPIOC, 14)
+# define B0 PAL_LINE(GPIOC, 13)
+#else
+# define D5 PAL_LINE(GPIOC, 13)
+# define B0 PAL_LINE(GPIOC, 14)
+#endif
diff --git a/platforms/chibios/boards/QMK_PROTON_C/convert_to_proton_c.mk b/platforms/chibios/converters/promicro_to_proton_c/converter.mk
index 0618154678..406adae32c 100644
--- a/platforms/chibios/boards/QMK_PROTON_C/convert_to_proton_c.mk
+++ b/platforms/chibios/converters/promicro_to_proton_c/converter.mk
@@ -1,9 +1,7 @@
# Proton C MCU settings for converting AVR projects
-TARGET := $(TARGET)_proton_c
MCU := STM32F303
BOARD := QMK_PROTON_C
BOOTLOADER := stm32-dfu
-OPT_DEFS += -DCONVERT_TO_PROTON_C
# These are defaults based on what has been implemented for ARM boards
AUDIO_ENABLE ?= yes
diff --git a/platforms/chibios/drivers/serial.c b/platforms/chibios/drivers/serial.c
index bb7b3c0554..0cff057d1d 100644
--- a/platforms/chibios/drivers/serial.c
+++ b/platforms/chibios/drivers/serial.c
@@ -5,6 +5,7 @@
#include "quantum.h"
#include "serial.h"
#include "wait.h"
+#include "synchronization_util.h"
#include <hal.h>
@@ -86,7 +87,10 @@ static THD_FUNCTION(Thread1, arg) {
chRegSetThreadName("blinker");
while (true) {
palWaitLineTimeout(SOFT_SERIAL_PIN, TIME_INFINITE);
+
+ split_shared_memory_lock();
interrupt_handler(NULL);
+ split_shared_memory_unlock();
}
}
@@ -205,14 +209,9 @@ void interrupt_handler(void *arg) {
chSysUnlockFromISR();
}
-/////////
-// start transaction by initiator
-//
-// bool soft_serial_transaction(int sstd_index)
-//
-// this code is very time dependent, so we need to disable interrupts
-bool soft_serial_transaction(int sstd_index) {
+static inline bool initiate_transaction(uint8_t sstd_index) {
if (sstd_index > NUM_TOTAL_TRANSACTIONS) return false;
+
split_transaction_desc_t *trans = &split_transaction_table[sstd_index];
// TODO: remove extra delay between transactions
@@ -239,8 +238,7 @@ bool soft_serial_transaction(int sstd_index) {
return false;
}
- // if the slave is present syncronize with it
-
+ // if the slave is present synchronize with it
uint8_t checksum = 0;
// send data to the slave
serial_write_byte(sstd_index); // first chunk is transaction id
@@ -286,3 +284,16 @@ bool soft_serial_transaction(int sstd_index) {
chSysUnlock();
return true;
}
+
+/////////
+// start transaction by initiator
+//
+// bool soft_serial_transaction(int sstd_index)
+//
+// this code is very time dependent, so we need to disable interrupts
+bool soft_serial_transaction(int sstd_index) {
+ split_shared_memory_lock();
+ bool result = initiate_transaction((uint8_t)sstd_index);
+ split_shared_memory_unlock();
+ return result;
+}
diff --git a/platforms/chibios/drivers/serial_usart.c b/platforms/chibios/drivers/serial_usart.c
index 85c64214d1..e9fa4af7a3 100644
--- a/platforms/chibios/drivers/serial_usart.c
+++ b/platforms/chibios/drivers/serial_usart.c
@@ -15,6 +15,7 @@
*/
#include "serial_usart.h"
+#include "synchronization_util.h"
#if defined(SERIAL_USART_CONFIG)
static SerialConfig serial_config = SERIAL_USART_CONFIG;
@@ -173,6 +174,7 @@ static THD_FUNCTION(SlaveThread, arg) {
* Parts of failed transactions or spurious bytes could still be in it. */
usart_clear();
}
+ split_shared_memory_unlock();
}
}
@@ -200,6 +202,7 @@ static inline bool react_to_transactions(void) {
return false;
}
+ split_shared_memory_lock();
split_transaction_desc_t* trans = &split_transaction_table[sstd_index];
/* Send back the handshake which is XORed as a simple checksum,
@@ -254,7 +257,12 @@ bool soft_serial_transaction(int index) {
/* Clear the receive queue, to start with a clean slate.
* Parts of failed transactions or spurious bytes could still be in it. */
usart_clear();
- return initiate_transaction((uint8_t)index);
+
+ split_shared_memory_lock();
+ bool result = initiate_transaction((uint8_t)index);
+ split_shared_memory_unlock();
+
+ return result;
}
/**
diff --git a/platforms/chibios/drivers/ws2812_spi.c b/platforms/chibios/drivers/ws2812_spi.c
index 76191db165..01d8148875 100644
--- a/platforms/chibios/drivers/ws2812_spi.c
+++ b/platforms/chibios/drivers/ws2812_spi.c
@@ -139,7 +139,33 @@ void ws2812_init(void) {
#endif // WS2812_SPI_SCK_PIN
// TODO: more dynamic baudrate
- static const SPIConfig spicfg = {WS2812_SPI_BUFFER_MODE, NULL, PAL_PORT(RGB_DI_PIN), PAL_PAD(RGB_DI_PIN), WS2812_SPI_DIVISOR_CR1_BR_X};
+ static const SPIConfig spicfg = {
+#ifndef HAL_LLD_SELECT_SPI_V2
+// HAL_SPI_V1
+# if SPI_SUPPORTS_CIRCULAR == TRUE
+ WS2812_SPI_BUFFER_MODE,
+# endif
+ NULL, // end_cb
+ PAL_PORT(RGB_DI_PIN),
+ PAL_PAD(RGB_DI_PIN),
+ WS2812_SPI_DIVISOR_CR1_BR_X,
+ 0
+#else
+ // HAL_SPI_V2
+# if SPI_SUPPORTS_CIRCULAR == TRUE
+ WS2812_SPI_BUFFER_MODE,
+# endif
+# if SPI_SUPPORTS_SLAVE_MODE == TRUE
+ false,
+# endif
+ NULL, // data_cb
+ NULL, // error_cb
+ PAL_PORT(RGB_DI_PIN),
+ PAL_PAD(RGB_DI_PIN),
+ WS2812_SPI_DIVISOR_CR1_BR_X,
+ 0
+#endif
+ };
spiAcquireBus(&WS2812_SPI); /* Acquire ownership of the bus. */
spiStart(&WS2812_SPI, &spicfg); /* Setup transfer parameters. */
diff --git a/platforms/chibios/eeprom_stm32_defs.h b/platforms/chibios/eeprom_stm32_defs.h
index a6ceb41355..57d0440330 100644
--- a/platforms/chibios/eeprom_stm32_defs.h
+++ b/platforms/chibios/eeprom_stm32_defs.h
@@ -25,7 +25,7 @@
# ifndef FEE_PAGE_COUNT
# define FEE_PAGE_COUNT 2 // How many pages are used
# endif
-# elif defined(STM32F103xE) || defined(STM32F303xC) || defined(STM32F072xB) || defined(STM32F070xB)
+# elif defined(STM32F103xE) || defined(STM32F303xC) || defined(STM32F303xE) || defined(STM32F072xB) || defined(STM32F070xB)
# ifndef FEE_PAGE_SIZE
# define FEE_PAGE_SIZE 0x800 // Page size = 2KByte
# endif
@@ -51,7 +51,7 @@
# define FEE_MCU_FLASH_SIZE 128 // Size in Kb
# elif defined(STM32F303xC) || defined(STM32F401xC)
# define FEE_MCU_FLASH_SIZE 256 // Size in Kb
-# elif defined(STM32F103xE) || defined(STM32F401xE) || defined(STM32F411xE)
+# elif defined(STM32F103xE) || defined(STM32F303xE) || defined(STM32F401xE) || defined(STM32F411xE)
# define FEE_MCU_FLASH_SIZE 512 // Size in Kb
# elif defined(STM32F405xG)
# define FEE_MCU_FLASH_SIZE 1024 // Size in Kb
diff --git a/platforms/chibios/flash.mk b/platforms/chibios/flash.mk
index 6ee53172d2..a91ef2cf35 100644
--- a/platforms/chibios/flash.mk
+++ b/platforms/chibios/flash.mk
@@ -40,6 +40,18 @@ endef
dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter
$(call EXEC_DFU_UTIL)
+define EXEC_UF2_UTIL_DEPLOY
+ if ! $(UF2CONV) --deploy $(BUILD_DIR)/$(TARGET).uf2 2>/dev/null; then \
+ printf "$(MSG_BOOTLOADER_NOT_FOUND_QUICK_RETRY)" ;\
+ sleep $(BOOTLOADER_RETRY_TIME) ;\
+ while ! $(UF2CONV) --deploy $(BUILD_DIR)/$(TARGET).uf2 2>/dev/null; do \
+ printf "." ;\
+ sleep $(BOOTLOADER_RETRY_TIME) ;\
+ done ;\
+ printf "\n" ;\
+ fi
+endef
+
# TODO: Remove once ARM has a way to configure EECONFIG_HANDEDNESS
# within the emulated eeprom via dfu-util or another tool
ifneq (,$(filter $(MAKECMDGOALS),dfu-util-split-left))
@@ -90,6 +102,8 @@ ifneq ($(strip $(PROGRAM_CMD)),)
$(UNSYNC_OUTPUT_CMD) && $(PROGRAM_CMD)
else ifeq ($(strip $(BOOTLOADER)),kiibohd)
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_DFU_UTIL)
+else ifeq ($(strip $(BOOTLOADER)),tinyuf2)
+ $(UNSYNC_OUTPUT_CMD) && $(call EXEC_UF2_UTIL_DEPLOY)
else ifeq ($(strip $(MCU_FAMILY)),KINETIS)
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_TEENSY)
else ifeq ($(strip $(MCU_FAMILY)),MIMXRT1062)
diff --git a/platforms/chibios/gpio.h b/platforms/chibios/gpio.h
index eb44a18f9c..80551abac5 100644
--- a/platforms/chibios/gpio.h
+++ b/platforms/chibios/gpio.h
@@ -31,7 +31,14 @@ typedef ioline_t pin_t;
#define writePinHigh(pin) palSetLine(pin)
#define writePinLow(pin) palClearLine(pin)
-#define writePin(pin, level) ((level) ? (writePinHigh(pin)) : (writePinLow(pin)))
+#define writePin(pin, level) \
+ do { \
+ if (level) { \
+ writePinHigh(pin); \
+ } else { \
+ writePinLow(pin); \
+ } \
+ } while (0)
#define readPin(pin) palReadLine(pin)
diff --git a/platforms/chibios/hardware_id.c b/platforms/chibios/hardware_id.c
new file mode 100644
index 0000000000..888a275465
--- /dev/null
+++ b/platforms/chibios/hardware_id.c
@@ -0,0 +1,15 @@
+// Copyright 2022 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <ch.h>
+#include "hardware_id.h"
+
+hardware_id_t get_hardware_id(void) {
+ hardware_id_t id = {0};
+#ifdef UID_BASE
+ id.data[0] = (uint32_t)(*((uint32_t *)UID_BASE));
+ id.data[1] = (uint32_t)(*((uint32_t *)(UID_BASE + 4)));
+ id.data[1] = (uint32_t)(*((uint32_t *)(UID_BASE + 8)));
+#endif
+ return id;
+}
diff --git a/platforms/chibios/pin_defs.h b/platforms/chibios/pin_defs.h
deleted file mode 100644
index c03f8de0c2..0000000000
--- a/platforms/chibios/pin_defs.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/* Copyright 2021 QMK
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#pragma once
-
-// Defines mapping for Proton C replacement
-#ifdef CONVERT_TO_PROTON_C
-// Left side (front)
-# define D3 PAL_LINE(GPIOA, 9)
-# define D2 PAL_LINE(GPIOA, 10)
-// GND
-// GND
-# define D1 PAL_LINE(GPIOB, 7)
-# define D0 PAL_LINE(GPIOB, 6)
-# define D4 PAL_LINE(GPIOB, 5)
-# define C6 PAL_LINE(GPIOB, 4)
-# define D7 PAL_LINE(GPIOB, 3)
-# define E6 PAL_LINE(GPIOB, 2)
-# define B4 PAL_LINE(GPIOB, 1)
-# define B5 PAL_LINE(GPIOB, 0)
-
-// Right side (front)
-// RAW
-// GND
-// RESET
-// VCC
-# define F4 PAL_LINE(GPIOA, 2)
-# define F5 PAL_LINE(GPIOA, 1)
-# define F6 PAL_LINE(GPIOA, 0)
-# define F7 PAL_LINE(GPIOB, 8)
-# define B1 PAL_LINE(GPIOB, 13)
-# define B3 PAL_LINE(GPIOB, 14)
-# define B2 PAL_LINE(GPIOB, 15)
-# define B6 PAL_LINE(GPIOB, 9)
-
-// LEDs (only D5/C13 uses an actual LED)
-# ifdef CONVERT_TO_PROTON_C_RXLED
-# define D5 PAL_LINE(GPIOC, 14)
-# define B0 PAL_LINE(GPIOC, 13)
-# else
-# define D5 PAL_LINE(GPIOC, 13)
-# define B0 PAL_LINE(GPIOC, 14)
-# endif
-#else
-# define A0 PAL_LINE(GPIOA, 0)
-# define A1 PAL_LINE(GPIOA, 1)
-# define A2 PAL_LINE(GPIOA, 2)
-# define A3 PAL_LINE(GPIOA, 3)
-# define A4 PAL_LINE(GPIOA, 4)
-# define A5 PAL_LINE(GPIOA, 5)
-# define A6 PAL_LINE(GPIOA, 6)
-# define A7 PAL_LINE(GPIOA, 7)
-# define A8 PAL_LINE(GPIOA, 8)
-# define A9 PAL_LINE(GPIOA, 9)
-# define A10 PAL_LINE(GPIOA, 10)
-# define A11 PAL_LINE(GPIOA, 11)
-# define A12 PAL_LINE(GPIOA, 12)
-# define A13 PAL_LINE(GPIOA, 13)
-# define A14 PAL_LINE(GPIOA, 14)
-# define A15 PAL_LINE(GPIOA, 15)
-# define A16 PAL_LINE(GPIOA, 16)
-# define A17 PAL_LINE(GPIOA, 17)
-# define A18 PAL_LINE(GPIOA, 18)
-# define A19 PAL_LINE(GPIOA, 19)
-# define A20 PAL_LINE(GPIOA, 20)
-# define A21 PAL_LINE(GPIOA, 21)
-# define A22 PAL_LINE(GPIOA, 22)
-# define A23 PAL_LINE(GPIOA, 23)
-# define A24 PAL_LINE(GPIOA, 24)
-# define A25 PAL_LINE(GPIOA, 25)
-# define A26 PAL_LINE(GPIOA, 26)
-# define A27 PAL_LINE(GPIOA, 27)
-# define A28 PAL_LINE(GPIOA, 28)
-# define A29 PAL_LINE(GPIOA, 29)
-# define A30 PAL_LINE(GPIOA, 30)
-# define A31 PAL_LINE(GPIOA, 31)
-# define A32 PAL_LINE(GPIOA, 32)
-# define B0 PAL_LINE(GPIOB, 0)
-# define B1 PAL_LINE(GPIOB, 1)
-# define B2 PAL_LINE(GPIOB, 2)
-# define B3 PAL_LINE(GPIOB, 3)
-# define B4 PAL_LINE(GPIOB, 4)
-# define B5 PAL_LINE(GPIOB, 5)
-# define B6 PAL_LINE(GPIOB, 6)
-# define B7 PAL_LINE(GPIOB, 7)
-# define B8 PAL_LINE(GPIOB, 8)
-# define B9 PAL_LINE(GPIOB, 9)
-# define B10 PAL_LINE(GPIOB, 10)
-# define B11 PAL_LINE(GPIOB, 11)
-# define B12 PAL_LINE(GPIOB, 12)
-# define B13 PAL_LINE(GPIOB, 13)
-# define B14 PAL_LINE(GPIOB, 14)
-# define B15 PAL_LINE(GPIOB, 15)
-# define B16 PAL_LINE(GPIOB, 16)
-# define B17 PAL_LINE(GPIOB, 17)
-# define B18 PAL_LINE(GPIOB, 18)
-# define B19 PAL_LINE(GPIOB, 19)
-# define B20 PAL_LINE(GPIOB, 20)
-# define B21 PAL_LINE(GPIOB, 21)
-# define B22 PAL_LINE(GPIOB, 22)
-# define B23 PAL_LINE(GPIOB, 23)
-# define B24 PAL_LINE(GPIOB, 24)
-# define B25 PAL_LINE(GPIOB, 25)
-# define B26 PAL_LINE(GPIOB, 26)
-# define B27 PAL_LINE(GPIOB, 27)
-# define B28 PAL_LINE(GPIOB, 28)
-# define B29 PAL_LINE(GPIOB, 29)
-# define B30 PAL_LINE(GPIOB, 30)
-# define B31 PAL_LINE(GPIOB, 31)
-# define B32 PAL_LINE(GPIOB, 32)
-# define C0 PAL_LINE(GPIOC, 0)
-# define C1 PAL_LINE(GPIOC, 1)
-# define C2 PAL_LINE(GPIOC, 2)
-# define C3 PAL_LINE(GPIOC, 3)
-# define C4 PAL_LINE(GPIOC, 4)
-# define C5 PAL_LINE(GPIOC, 5)
-# define C6 PAL_LINE(GPIOC, 6)
-# define C7 PAL_LINE(GPIOC, 7)
-# define C8 PAL_LINE(GPIOC, 8)
-# define C9 PAL_LINE(GPIOC, 9)
-# define C10 PAL_LINE(GPIOC, 10)
-# define C11 PAL_LINE(GPIOC, 11)
-# define C12 PAL_LINE(GPIOC, 12)
-# define C13 PAL_LINE(GPIOC, 13)
-# define C14 PAL_LINE(GPIOC, 14)
-# define C15 PAL_LINE(GPIOC, 15)
-# define C16 PAL_LINE(GPIOC, 16)
-# define C17 PAL_LINE(GPIOC, 17)
-# define C18 PAL_LINE(GPIOC, 18)
-# define C19 PAL_LINE(GPIOC, 19)
-# define C20 PAL_LINE(GPIOC, 20)
-# define C21 PAL_LINE(GPIOC, 21)
-# define C22 PAL_LINE(GPIOC, 22)
-# define C23 PAL_LINE(GPIOC, 23)
-# define C24 PAL_LINE(GPIOC, 24)
-# define C25 PAL_LINE(GPIOC, 25)
-# define C26 PAL_LINE(GPIOC, 26)
-# define C27 PAL_LINE(GPIOC, 27)
-# define C28 PAL_LINE(GPIOC, 28)
-# define C29 PAL_LINE(GPIOC, 29)
-# define C30 PAL_LINE(GPIOC, 30)
-# define C31 PAL_LINE(GPIOC, 31)
-# define C32 PAL_LINE(GPIOC, 32)
-# define D0 PAL_LINE(GPIOD, 0)
-# define D1 PAL_LINE(GPIOD, 1)
-# define D2 PAL_LINE(GPIOD, 2)
-# define D3 PAL_LINE(GPIOD, 3)
-# define D4 PAL_LINE(GPIOD, 4)
-# define D5 PAL_LINE(GPIOD, 5)
-# define D6 PAL_LINE(GPIOD, 6)
-# define D7 PAL_LINE(GPIOD, 7)
-# define D8 PAL_LINE(GPIOD, 8)
-# define D9 PAL_LINE(GPIOD, 9)
-# define D10 PAL_LINE(GPIOD, 10)
-# define D11 PAL_LINE(GPIOD, 11)
-# define D12 PAL_LINE(GPIOD, 12)
-# define D13 PAL_LINE(GPIOD, 13)
-# define D14 PAL_LINE(GPIOD, 14)
-# define D15 PAL_LINE(GPIOD, 15)
-# define D16 PAL_LINE(GPIOD, 16)
-# define D17 PAL_LINE(GPIOD, 17)
-# define D18 PAL_LINE(GPIOD, 18)
-# define D19 PAL_LINE(GPIOD, 19)
-# define D20 PAL_LINE(GPIOD, 20)
-# define D21 PAL_LINE(GPIOD, 21)
-# define D22 PAL_LINE(GPIOD, 22)
-# define D23 PAL_LINE(GPIOD, 23)
-# define D24 PAL_LINE(GPIOD, 24)
-# define D25 PAL_LINE(GPIOD, 25)
-# define D26 PAL_LINE(GPIOD, 26)
-# define D27 PAL_LINE(GPIOD, 27)
-# define D28 PAL_LINE(GPIOD, 28)
-# define D29 PAL_LINE(GPIOD, 29)
-# define D30 PAL_LINE(GPIOD, 30)
-# define D31 PAL_LINE(GPIOD, 31)
-# define D32 PAL_LINE(GPIOD, 32)
-# define E0 PAL_LINE(GPIOE, 0)
-# define E1 PAL_LINE(GPIOE, 1)
-# define E2 PAL_LINE(GPIOE, 2)
-# define E3 PAL_LINE(GPIOE, 3)
-# define E4 PAL_LINE(GPIOE, 4)
-# define E5 PAL_LINE(GPIOE, 5)
-# define E6 PAL_LINE(GPIOE, 6)
-# define E7 PAL_LINE(GPIOE, 7)
-# define E8 PAL_LINE(GPIOE, 8)
-# define E9 PAL_LINE(GPIOE, 9)
-# define E10 PAL_LINE(GPIOE, 10)
-# define E11 PAL_LINE(GPIOE, 11)
-# define E12 PAL_LINE(GPIOE, 12)
-# define E13 PAL_LINE(GPIOE, 13)
-# define E14 PAL_LINE(GPIOE, 14)
-# define E15 PAL_LINE(GPIOE, 15)
-# define E16 PAL_LINE(GPIOE, 16)
-# define E17 PAL_LINE(GPIOE, 17)
-# define E18 PAL_LINE(GPIOE, 18)
-# define E19 PAL_LINE(GPIOE, 19)
-# define E20 PAL_LINE(GPIOE, 20)
-# define E21 PAL_LINE(GPIOE, 21)
-# define E22 PAL_LINE(GPIOE, 22)
-# define E23 PAL_LINE(GPIOE, 23)
-# define E24 PAL_LINE(GPIOE, 24)
-# define E25 PAL_LINE(GPIOE, 25)
-# define E26 PAL_LINE(GPIOE, 26)
-# define E27 PAL_LINE(GPIOE, 27)
-# define E28 PAL_LINE(GPIOE, 28)
-# define E29 PAL_LINE(GPIOE, 29)
-# define E30 PAL_LINE(GPIOE, 30)
-# define E31 PAL_LINE(GPIOE, 31)
-# define E32 PAL_LINE(GPIOE, 32)
-# define F0 PAL_LINE(GPIOF, 0)
-# define F1 PAL_LINE(GPIOF, 1)
-# define F2 PAL_LINE(GPIOF, 2)
-# define F3 PAL_LINE(GPIOF, 3)
-# define F4 PAL_LINE(GPIOF, 4)
-# define F5 PAL_LINE(GPIOF, 5)
-# define F6 PAL_LINE(GPIOF, 6)
-# define F7 PAL_LINE(GPIOF, 7)
-# define F8 PAL_LINE(GPIOF, 8)
-# define F9 PAL_LINE(GPIOF, 9)
-# define F10 PAL_LINE(GPIOF, 10)
-# define F11 PAL_LINE(GPIOF, 11)
-# define F12 PAL_LINE(GPIOF, 12)
-# define F13 PAL_LINE(GPIOF, 13)
-# define F14 PAL_LINE(GPIOF, 14)
-# define F15 PAL_LINE(GPIOF, 15)
-# define G0 PAL_LINE(GPIOG, 0)
-# define G1 PAL_LINE(GPIOG, 1)
-# define G2 PAL_LINE(GPIOG, 2)
-# define G3 PAL_LINE(GPIOG, 3)
-# define G4 PAL_LINE(GPIOG, 4)
-# define G5 PAL_LINE(GPIOG, 5)
-# define G6 PAL_LINE(GPIOG, 6)
-# define G7 PAL_LINE(GPIOG, 7)
-# define G8 PAL_LINE(GPIOG, 8)
-# define G9 PAL_LINE(GPIOG, 9)
-# define G10 PAL_LINE(GPIOG, 10)
-# define G11 PAL_LINE(GPIOG, 11)
-# define G12 PAL_LINE(GPIOG, 12)
-# define G13 PAL_LINE(GPIOG, 13)
-# define G14 PAL_LINE(GPIOG, 14)
-# define G15 PAL_LINE(GPIOG, 15)
-# define H0 PAL_LINE(GPIOH, 0)
-# define H1 PAL_LINE(GPIOH, 1)
-# define H2 PAL_LINE(GPIOH, 2)
-# define H3 PAL_LINE(GPIOH, 3)
-# define H4 PAL_LINE(GPIOH, 4)
-# define H5 PAL_LINE(GPIOH, 5)
-# define H6 PAL_LINE(GPIOH, 6)
-# define H7 PAL_LINE(GPIOH, 7)
-# define H8 PAL_LINE(GPIOH, 8)
-# define H9 PAL_LINE(GPIOH, 9)
-# define H10 PAL_LINE(GPIOH, 10)
-# define H11 PAL_LINE(GPIOH, 11)
-# define H12 PAL_LINE(GPIOH, 12)
-# define H13 PAL_LINE(GPIOH, 13)
-# define H14 PAL_LINE(GPIOH, 14)
-# define H15 PAL_LINE(GPIOH, 15)
-# define I0 PAL_LINE(GPIOI, 0)
-# define I1 PAL_LINE(GPIOI, 1)
-# define I2 PAL_LINE(GPIOI, 2)
-# define I3 PAL_LINE(GPIOI, 3)
-# define I4 PAL_LINE(GPIOI, 4)
-# define I5 PAL_LINE(GPIOI, 5)
-# define I6 PAL_LINE(GPIOI, 6)
-# define I7 PAL_LINE(GPIOI, 7)
-# define I8 PAL_LINE(GPIOI, 8)
-# define I9 PAL_LINE(GPIOI, 9)
-# define I10 PAL_LINE(GPIOI, 10)
-# define I11 PAL_LINE(GPIOI, 11)
-# define I12 PAL_LINE(GPIOI, 12)
-# define I13 PAL_LINE(GPIOI, 13)
-# define I14 PAL_LINE(GPIOI, 14)
-# define I15 PAL_LINE(GPIOI, 15)
-# define J0 PAL_LINE(GPIOJ, 0)
-# define J1 PAL_LINE(GPIOJ, 1)
-# define J2 PAL_LINE(GPIOJ, 2)
-# define J3 PAL_LINE(GPIOJ, 3)
-# define J4 PAL_LINE(GPIOJ, 4)
-# define J5 PAL_LINE(GPIOJ, 5)
-# define J6 PAL_LINE(GPIOJ, 6)
-# define J7 PAL_LINE(GPIOJ, 7)
-# define J8 PAL_LINE(GPIOJ, 8)
-# define J9 PAL_LINE(GPIOJ, 9)
-# define J10 PAL_LINE(GPIOJ, 10)
-# define J11 PAL_LINE(GPIOJ, 11)
-# define J12 PAL_LINE(GPIOJ, 12)
-# define J13 PAL_LINE(GPIOJ, 13)
-# define J14 PAL_LINE(GPIOJ, 14)
-# define J15 PAL_LINE(GPIOJ, 15)
-// Keyboards can `#define KEYBOARD_REQUIRES_GPIOK` if they need to access GPIO-K pins. These conflict with a whole
-// bunch of layout definitions, so it's intentionally left out unless absolutely required -- in that case, the
-// keyboard designer should use a different symbol when defining their layout macros.
-# ifdef KEYBOARD_REQUIRES_GPIOK
-# define K0 PAL_LINE(GPIOK, 0)
-# define K1 PAL_LINE(GPIOK, 1)
-# define K2 PAL_LINE(GPIOK, 2)
-# define K3 PAL_LINE(GPIOK, 3)
-# define K4 PAL_LINE(GPIOK, 4)
-# define K5 PAL_LINE(GPIOK, 5)
-# define K6 PAL_LINE(GPIOK, 6)
-# define K7 PAL_LINE(GPIOK, 7)
-# define K8 PAL_LINE(GPIOK, 8)
-# define K9 PAL_LINE(GPIOK, 9)
-# define K10 PAL_LINE(GPIOK, 10)
-# define K11 PAL_LINE(GPIOK, 11)
-# define K12 PAL_LINE(GPIOK, 12)
-# define K13 PAL_LINE(GPIOK, 13)
-# define K14 PAL_LINE(GPIOK, 14)
-# define K15 PAL_LINE(GPIOK, 15)
-# endif
-#endif
diff --git a/platforms/chibios/platform.mk b/platforms/chibios/platform.mk
index 6fd1fd83f5..21751f23fd 100644
--- a/platforms/chibios/platform.mk
+++ b/platforms/chibios/platform.mk
@@ -39,7 +39,6 @@ ifeq ($(strip $(MCU)), risc-v)
STARTUP_MK = $(CHIBIOS_CONTRIB)/os/common/startup/RISCV-ECLIC/compilers/GCC/mk/startup_$(MCU_STARTUP).mk
PORT_V = $(CHIBIOS_CONTRIB)/os/common/ports/RISCV-ECLIC/compilers/GCC/mk/port.mk
RULESPATH = $(CHIBIOS_CONTRIB)/os/common/startup/RISCV-ECLIC/compilers/GCC
- PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/GD/GD32VF103/platform.mk
else
# ARM Support
CHIBIOS_PORT ?=
@@ -82,10 +81,15 @@ ifeq ("$(PLATFORM_NAME)","")
PLATFORM_NAME = platform
endif
+# If no MCU port name was specified, use the family instead
+ifeq ("$(MCU_PORT_NAME)","")
+ MCU_PORT_NAME = $(MCU_FAMILY)
+endif
+
ifeq ("$(wildcard $(PLATFORM_MK))","")
- PLATFORM_MK = $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/$(PLATFORM_NAME).mk
+ PLATFORM_MK = $(CHIBIOS)/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)/$(PLATFORM_NAME).mk
ifeq ("$(wildcard $(PLATFORM_MK))","")
- PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/$(PLATFORM_NAME).mk
+ PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)/$(PLATFORM_NAME).mk
endif
endif
@@ -261,7 +265,8 @@ PLATFORM_SRC = \
$(STREAMSSRC) \
$(CHIBIOS)/os/various/syscalls.c \
$(PLATFORM_COMMON_DIR)/syscall-fallbacks.c \
- $(PLATFORM_COMMON_DIR)/wait.c
+ $(PLATFORM_COMMON_DIR)/wait.c \
+ $(PLATFORM_COMMON_DIR)/synchronization_util.c
# Ensure the ASM files are not subjected to LTO -- it'll strip out interrupt handlers otherwise.
QUANTUM_LIB_SRC += $(STARTUPASM) $(PORTASM) $(OSALASM) $(PLATFORMASM)
@@ -416,6 +421,9 @@ LDFLAGS += $(SHARED_LDFLAGS) $(SHARED_LDSYMBOLS) $(TOOLCHAIN_LDFLAGS) $(TOOLCHA
# Tell QMK that we are hosting it on ChibiOS.
OPT_DEFS += -DPROTOCOL_CHIBIOS
+# ChibiOS supports synchronization primitives like a Mutex
+OPT_DEFS += -DPLATFORM_SUPPORTS_SYNCHRONIZATION
+
# Workaround to stop ChibiOS from complaining about new GCC -- it's been fixed for 7/8/9 already
OPT_DEFS += -DPORT_IGNORE_GCC_VERSION_CHECK=1
diff --git a/platforms/chibios/synchronization_util.c b/platforms/chibios/synchronization_util.c
new file mode 100644
index 0000000000..bc4a4e621f
--- /dev/null
+++ b/platforms/chibios/synchronization_util.c
@@ -0,0 +1,26 @@
+// Copyright 2022 Stefan Kerkmann
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "synchronization_util.h"
+#include "ch.h"
+
+#if defined(SPLIT_KEYBOARD)
+static MUTEX_DECL(SPLIT_SHARED_MEMORY_MUTEX);
+
+/**
+ * @brief Acquire exclusive access to the split keyboard shared memory, by
+ * locking the mutex guarding it. If the mutex is already held, the calling
+ * thread will be suspended until the mutex currently owning thread releases the
+ * mutex again.
+ */
+void split_shared_memory_lock(void) {
+ chMtxLock(&SPLIT_SHARED_MEMORY_MUTEX);
+}
+
+/**
+ * @brief Release the split shared memory mutex that has been acquired before.
+ */
+void split_shared_memory_unlock(void) {
+ chMtxUnlock(&SPLIT_SHARED_MEMORY_MUTEX);
+}
+#endif
diff --git a/platforms/chibios/timer.c b/platforms/chibios/timer.c
index e3bdfdcc37..5e01ea6372 100644
--- a/platforms/chibios/timer.c
+++ b/platforms/chibios/timer.c
@@ -40,7 +40,7 @@ static virtual_timer_t update_timer;
# define UPDATE_INTERVAL (((sysinterval_t)1) << (CH_CFG_ST_RESOLUTION - 1))
// VT callback function to keep the overflow bits of the system tick counter updated.
-static void update_fn(void *arg) {
+static void update_fn(struct ch_virtual_timer *timer, void *arg) {
(void)arg;
chSysLockFromISR();
get_system_time_ticks();
diff --git a/platforms/chibios/wait.c b/platforms/chibios/wait.c
index 56fd6ffcec..88cb5e6d54 100644
--- a/platforms/chibios/wait.c
+++ b/platforms/chibios/wait.c
@@ -31,7 +31,7 @@ void wait_us(uint16_t duration) {
* Only use this timer on the main thread;
* other threads need to use their own timer.
*/
- if (chThdGetSelfX() == &ch.mainthread && duration < (1ULL << (sizeof(gptcnt_t) * 8))) {
+ if (chThdGetSelfX() == &(currcore->mainthread) && duration < (1ULL << (sizeof(gptcnt_t) * 8))) {
gptStart(&WAIT_US_TIMER, &gpt_cfg);
gptPolledDelay(&WAIT_US_TIMER, duration);
} else {
diff --git a/platforms/common.mk b/platforms/common.mk
index 2a1fc8d377..693bdc8cf0 100644
--- a/platforms/common.mk
+++ b/platforms/common.mk
@@ -2,6 +2,7 @@ PLATFORM_COMMON_DIR = $(PLATFORM_PATH)/$(PLATFORM_KEY)
TMK_COMMON_SRC += \
$(PLATFORM_PATH)/suspend.c \
+ $(PLATFORM_COMMON_DIR)/hardware_id.c \
$(PLATFORM_COMMON_DIR)/platform.c \
$(PLATFORM_COMMON_DIR)/suspend.c \
$(PLATFORM_COMMON_DIR)/timer.c \
diff --git a/platforms/hardware_id.h b/platforms/hardware_id.h
new file mode 100644
index 0000000000..0c161863d6
--- /dev/null
+++ b/platforms/hardware_id.h
@@ -0,0 +1,18 @@
+// Copyright 2022 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <stdint.h>
+
+/** \brief Storage for a hardware ID
+ *
+ * Ensure this is sized to cover all hardware scenarios
+ */
+typedef struct hardware_id_t {
+ uint32_t data[4];
+} hardware_id_t;
+
+/** \brief Query the devices "unique" ID
+ */
+hardware_id_t get_hardware_id(void);
diff --git a/platforms/pin_defs.h b/platforms/pin_defs.h
index ea730138f2..341fe89b6e 100644
--- a/platforms/pin_defs.h
+++ b/platforms/pin_defs.h
@@ -18,6 +18,6 @@
// useful for direct pin mapping
#define NO_PIN (pin_t)(~0)
-#if __has_include_next("pin_defs.h")
-# include_next "pin_defs.h" /* Include the platforms pin_defs.h */
+#if __has_include("_pin_defs.h")
+# include "_pin_defs.h" /* Include the platforms pin defs */
#endif
diff --git a/platforms/synchronization_util.h b/platforms/synchronization_util.h
new file mode 100644
index 0000000000..3730f271db
--- /dev/null
+++ b/platforms/synchronization_util.h
@@ -0,0 +1,14 @@
+// Copyright 2022 Stefan Kerkmann
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#if defined(PLATFORM_SUPPORTS_SYNCHRONIZATION)
+# if defined(SPLIT_KEYBOARD)
+void split_shared_memory_lock(void);
+void split_shared_memory_unlock(void);
+# endif
+#else
+inline void split_shared_memory_lock(void){};
+inline void split_shared_memory_unlock(void){};
+#endif
diff --git a/platforms/test/bootloaders/none.c b/platforms/test/bootloaders/none.c
index 5155d9ff04..e88a79ae05 100644
--- a/platforms/test/bootloaders/none.c
+++ b/platforms/test/bootloaders/none.c
@@ -17,3 +17,4 @@
#include "bootloader.h"
void bootloader_jump(void) {}
+void mcu_reset(void) {}
diff --git a/platforms/test/hardware_id.c b/platforms/test/hardware_id.c
new file mode 100644
index 0000000000..8b3b35a492
--- /dev/null
+++ b/platforms/test/hardware_id.c
@@ -0,0 +1,9 @@
+// Copyright 2022 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "hardware_id.h"
+
+hardware_id_t get_hardware_id(void) {
+ hardware_id_t id = {0};
+ return id;
+}
diff --git a/quantum/action.c b/quantum/action.c
index 3efed443a3..4e81a5466f 100644
--- a/quantum/action.c
+++ b/quantum/action.c
@@ -14,9 +14,18 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <limits.h>
+
+#ifdef DEBUG_ACTION
+# include "debug.h"
+#else
+# include "nodebug.h"
+#endif
+
#include "host.h"
#include "keycode.h"
#include "keyboard.h"
+#include "keymap.h"
#include "mousekey.h"
#include "programmable_button.h"
#include "command.h"
@@ -32,12 +41,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "backlight.h"
#endif
-#ifdef DEBUG_ACTION
-# include "debug.h"
-#else
-# include "nodebug.h"
-#endif
-
#ifdef POINTING_DEVICE_ENABLE
# include "pointing_device.h"
#endif
@@ -89,6 +92,7 @@ void action_exec(keyevent_t event) {
}
#ifdef SWAP_HANDS_ENABLE
+ // Swap hands handles both keys and encoders, if ENCODER_MAP_ENABLE is defined.
if (!IS_NOEVENT(event)) {
process_hand_swap(&event);
}
@@ -97,7 +101,7 @@ void action_exec(keyevent_t event) {
keyrecord_t record = {.event = event};
#ifndef NO_ACTION_ONESHOT
- if (!keymap_config.oneshot_disable) {
+ if (keymap_config.oneshot_enable) {
# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
if (has_oneshot_layer_timed_out()) {
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
@@ -136,27 +140,65 @@ void action_exec(keyevent_t event) {
}
#ifdef SWAP_HANDS_ENABLE
+extern const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS];
+# ifdef ENCODER_MAP_ENABLE
+extern const uint8_t PROGMEM encoder_hand_swap_config[NUM_ENCODERS];
+# endif // ENCODER_MAP_ENABLE
+
bool swap_hands = false;
bool swap_held = false;
+bool should_swap_hands(size_t index, uint8_t *swap_state, bool pressed) {
+ size_t array_index = index / (CHAR_BIT);
+ size_t bit_index = index % (CHAR_BIT);
+ uint8_t bit_val = 1 << bit_index;
+ bool do_swap = pressed ? swap_hands : swap_state[array_index] & bit_val;
+ return do_swap;
+}
+
+void set_swap_hands_state(size_t index, uint8_t *swap_state, bool on) {
+ size_t array_index = index / (CHAR_BIT);
+ size_t bit_index = index % (CHAR_BIT);
+ uint8_t bit_val = 1 << bit_index;
+ if (on) {
+ swap_state[array_index] |= bit_val;
+ } else {
+ swap_state[array_index] &= ~bit_val;
+ }
+}
+
/** \brief Process Hand Swap
*
* FIXME: Needs documentation.
*/
void process_hand_swap(keyevent_t *event) {
- static swap_state_row_t swap_state[MATRIX_ROWS];
-
- keypos_t pos = event->key;
- swap_state_row_t col_bit = (swap_state_row_t)1 << pos.col;
- bool do_swap = event->pressed ? swap_hands : swap_state[pos.row] & (col_bit);
-
- if (do_swap) {
- event->key.row = pgm_read_byte(&hand_swap_config[pos.row][pos.col].row);
- event->key.col = pgm_read_byte(&hand_swap_config[pos.row][pos.col].col);
- swap_state[pos.row] |= col_bit;
- } else {
- swap_state[pos.row] &= ~(col_bit);
+ keypos_t pos = event->key;
+ if (pos.row < MATRIX_ROWS && pos.col < MATRIX_COLS) {
+ static uint8_t matrix_swap_state[((MATRIX_ROWS * MATRIX_COLS) + (CHAR_BIT)-1) / (CHAR_BIT)];
+ size_t index = (size_t)(pos.row * MATRIX_COLS) + pos.col;
+ bool do_swap = should_swap_hands(index, matrix_swap_state, event->pressed);
+ if (do_swap) {
+ event->key.row = pgm_read_byte(&hand_swap_config[pos.row][pos.col].row);
+ event->key.col = pgm_read_byte(&hand_swap_config[pos.row][pos.col].col);
+ set_swap_hands_state(index, matrix_swap_state, true);
+ } else {
+ set_swap_hands_state(index, matrix_swap_state, false);
+ }
+ }
+# ifdef ENCODER_MAP_ENABLE
+ else if (pos.row == KEYLOC_ENCODER_CW || pos.row == KEYLOC_ENCODER_CCW) {
+ static uint8_t encoder_swap_state[((NUM_ENCODERS) + (CHAR_BIT)-1) / (CHAR_BIT)];
+ size_t index = pos.col;
+ bool do_swap = should_swap_hands(index, encoder_swap_state, event->pressed);
+ if (do_swap) {
+ event->key.row = pos.row;
+ event->key.col = pgm_read_byte(&encoder_hand_swap_config[pos.col]);
+ set_swap_hands_state(index, encoder_swap_state, true);
+ } else {
+ set_swap_hands_state(index, encoder_swap_state, false);
+ }
}
+# endif // ENCODER_MAP_ENABLE
}
#endif
@@ -216,7 +258,7 @@ void process_record(keyrecord_t *record) {
if (!process_record_quantum(record)) {
#ifndef NO_ACTION_ONESHOT
- if (is_oneshot_layer_active() && record->event.pressed && !keymap_config.oneshot_disable) {
+ if (is_oneshot_layer_active() && record->event.pressed && keymap_config.oneshot_enable) {
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
}
#endif
@@ -281,7 +323,7 @@ void process_action(keyrecord_t *record, action_t action) {
# ifdef SWAP_HANDS_ENABLE
&& !(action.kind.id == ACT_SWAP_HANDS && action.swap.code == OP_SH_ONESHOT)
# endif
- && !keymap_config.oneshot_disable) {
+ && keymap_config.oneshot_enable) {
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
do_release_oneshot = !is_oneshot_layer_active();
}
@@ -325,7 +367,7 @@ void process_action(keyrecord_t *record, action_t action) {
# ifndef NO_ACTION_ONESHOT
case MODS_ONESHOT:
// Oneshot modifier
- if (keymap_config.oneshot_disable) {
+ if (!keymap_config.oneshot_enable) {
if (event.pressed) {
if (mods) {
if (IS_MOD(action.key.code) || action.key.code == KC_NO) {
@@ -362,7 +404,7 @@ void process_action(keyrecord_t *record, action_t action) {
} else if (tap_count == ONESHOT_TAP_TOGGLE) {
dprint("MODS_TAP: Toggling oneshot");
clear_oneshot_mods();
- set_oneshot_locked_mods(mods);
+ set_oneshot_locked_mods(mods | get_oneshot_locked_mods());
register_mods(mods);
# endif
} else {
@@ -376,8 +418,8 @@ void process_action(keyrecord_t *record, action_t action) {
// Retain Oneshot mods
# if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1
if (mods & get_mods()) {
- clear_oneshot_locked_mods();
clear_oneshot_mods();
+ set_oneshot_locked_mods(~mods & get_oneshot_locked_mods());
unregister_mods(mods);
}
} else if (tap_count == ONESHOT_TAP_TOGGLE) {
@@ -571,7 +613,7 @@ void process_action(keyrecord_t *record, action_t action) {
# ifndef NO_ACTION_ONESHOT
case OP_ONESHOT:
// Oneshot modifier
- if (keymap_config.oneshot_disable) {
+ if (!keymap_config.oneshot_enable) {
if (event.pressed) {
layer_on(action.layer_tap.val);
} else {
@@ -581,7 +623,6 @@ void process_action(keyrecord_t *record, action_t action) {
# if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1
do_release_oneshot = false;
if (event.pressed) {
- del_mods(get_oneshot_locked_mods());
if (get_oneshot_layer_state() == ONESHOT_TOGGLED) {
reset_oneshot_layer();
layer_off(action.layer_tap.val);
@@ -591,10 +632,8 @@ void process_action(keyrecord_t *record, action_t action) {
set_oneshot_layer(action.layer_tap.val, ONESHOT_START);
}
} else {
- add_mods(get_oneshot_locked_mods());
if (tap_count >= ONESHOT_TAP_TOGGLE) {
reset_oneshot_layer();
- clear_oneshot_locked_mods();
set_oneshot_layer(action.layer_tap.val, ONESHOT_TOGGLED);
} else {
clear_oneshot_layer_state(ONESHOT_PRESSED);
diff --git a/quantum/action_layer.c b/quantum/action_layer.c
index e20eedee40..473e0e948d 100644
--- a/quantum/action_layer.c
+++ b/quantum/action_layer.c
@@ -1,8 +1,5 @@
+#include <limits.h>
#include <stdint.h>
-#include "keyboard.h"
-#include "action.h"
-#include "util.h"
-#include "action_layer.h"
#ifdef DEBUG_ACTION
# include "debug.h"
@@ -10,6 +7,12 @@
# include "nodebug.h"
#endif
+#include "keyboard.h"
+#include "keymap.h"
+#include "action.h"
+#include "util.h"
+#include "action_layer.h"
+
/** \brief Default Layer State
*/
layer_state_t default_layer_state = 0;
@@ -223,19 +226,20 @@ void layer_debug(void) {
/** \brief source layer cache
*/
-uint8_t source_layers_cache[(MATRIX_ROWS * MATRIX_COLS + 7) / 8][MAX_LAYER_BITS] = {{0}};
+uint8_t source_layers_cache[((MATRIX_ROWS * MATRIX_COLS) + (CHAR_BIT)-1) / (CHAR_BIT)][MAX_LAYER_BITS] = {{0}};
+# ifdef ENCODER_MAP_ENABLE
+uint8_t encoder_source_layers_cache[(NUM_ENCODERS + (CHAR_BIT)-1) / (CHAR_BIT)][MAX_LAYER_BITS] = {{0}};
+# endif // ENCODER_MAP_ENABLE
-/** \brief update source layers cache
+/** \brief update source layers cache impl
*
- * Updates the cached keys when changing layers
+ * Updates the supplied cache when changing layers
*/
-void update_source_layers_cache(keypos_t key, uint8_t layer) {
- const uint8_t key_number = key.col + (key.row * MATRIX_COLS);
- const uint8_t storage_row = key_number / 8;
- const uint8_t storage_bit = key_number % 8;
-
+void update_source_layers_cache_impl(uint8_t layer, uint16_t entry_number, uint8_t cache[][MAX_LAYER_BITS]) {
+ const uint16_t storage_idx = entry_number / (CHAR_BIT);
+ const uint8_t storage_bit = entry_number % (CHAR_BIT);
for (uint8_t bit_number = 0; bit_number < MAX_LAYER_BITS; bit_number++) {
- source_layers_cache[storage_row][bit_number] ^= (-((layer & (1U << bit_number)) != 0) ^ source_layers_cache[storage_row][bit_number]) & (1U << storage_bit);
+ cache[storage_idx][bit_number] ^= (-((layer & (1U << bit_number)) != 0) ^ cache[storage_idx][bit_number]) & (1U << storage_bit);
}
}
@@ -243,18 +247,52 @@ void update_source_layers_cache(keypos_t key, uint8_t layer) {
*
* reads the cached keys stored when the layer was changed
*/
-uint8_t read_source_layers_cache(keypos_t key) {
- const uint8_t key_number = key.col + (key.row * MATRIX_COLS);
- const uint8_t storage_row = key_number / 8;
- const uint8_t storage_bit = key_number % 8;
- uint8_t layer = 0;
+uint8_t read_source_layers_cache_impl(uint16_t entry_number, uint8_t cache[][MAX_LAYER_BITS]) {
+ const uint16_t storage_idx = entry_number / (CHAR_BIT);
+ const uint8_t storage_bit = entry_number % (CHAR_BIT);
+ uint8_t layer = 0;
for (uint8_t bit_number = 0; bit_number < MAX_LAYER_BITS; bit_number++) {
- layer |= ((source_layers_cache[storage_row][bit_number] & (1U << storage_bit)) != 0) << bit_number;
+ layer |= ((cache[storage_idx][bit_number] & (1U << storage_bit)) != 0) << bit_number;
}
return layer;
}
+
+/** \brief update encoder source layers cache
+ *
+ * Updates the cached encoders when changing layers
+ */
+void update_source_layers_cache(keypos_t key, uint8_t layer) {
+ if (key.row < MATRIX_ROWS && key.col < MATRIX_COLS) {
+ const uint16_t entry_number = (uint16_t)(key.row * MATRIX_COLS) + key.col;
+ update_source_layers_cache_impl(layer, entry_number, source_layers_cache);
+ }
+# ifdef ENCODER_MAP_ENABLE
+ else if (key.row == KEYLOC_ENCODER_CW || key.row == KEYLOC_ENCODER_CCW) {
+ const uint16_t entry_number = key.col;
+ update_source_layers_cache_impl(layer, entry_number, encoder_source_layers_cache);
+ }
+# endif // ENCODER_MAP_ENABLE
+}
+
+/** \brief read source layers cache
+ *
+ * reads the cached keys stored when the layer was changed
+ */
+uint8_t read_source_layers_cache(keypos_t key) {
+ if (key.row < MATRIX_ROWS && key.col < MATRIX_COLS) {
+ const uint16_t entry_number = (uint16_t)(key.row * MATRIX_COLS) + key.col;
+ return read_source_layers_cache_impl(entry_number, source_layers_cache);
+ }
+# ifdef ENCODER_MAP_ENABLE
+ else if (key.row == KEYLOC_ENCODER_CW || key.row == KEYLOC_ENCODER_CCW) {
+ const uint16_t entry_number = key.col;
+ return read_source_layers_cache_impl(entry_number, encoder_source_layers_cache);
+ }
+# endif // ENCODER_MAP_ENABLE
+ return 0;
+}
#endif
/** \brief Store or get action (FIXME: Needs better summary)
diff --git a/quantum/action_tapping.c b/quantum/action_tapping.c
index 6f8b4f8c56..3c8b5678b7 100644
--- a/quantum/action_tapping.c
+++ b/quantum/action_tapping.c
@@ -1,10 +1,5 @@
#include <stdint.h>
#include <stdbool.h>
-#include "action.h"
-#include "action_layer.h"
-#include "action_tapping.h"
-#include "keycode.h"
-#include "timer.h"
#ifdef DEBUG_ACTION
# include "debug.h"
@@ -12,6 +7,12 @@
# include "nodebug.h"
#endif
+#include "action.h"
+#include "action_layer.h"
+#include "action_tapping.h"
+#include "keycode.h"
+#include "timer.h"
+
#ifndef NO_ACTION_TAPPING
# define IS_TAPPING() !IS_NOEVENT(tapping_key.event)
@@ -23,17 +24,20 @@
# else
# define IS_TAPPING_RECORD(r) (IS_TAPPING() && KEYEQ(tapping_key.event.key, (r->event.key)) && tapping_key.keycode == r->keycode)
# endif
+# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < GET_TAPPING_TERM(get_record_keycode(&tapping_key, false), &tapping_key))
+# ifdef DYNAMIC_TAPPING_TERM_ENABLE
uint16_t g_tapping_term = TAPPING_TERM;
+# endif
+# ifdef TAPPING_TERM_PER_KEY
__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
+# ifdef DYNAMIC_TAPPING_TERM_ENABLE
return g_tapping_term;
+# else
+ return TAPPING_TERM;
+# endif
}
-
-# ifdef TAPPING_TERM_PER_KEY
-# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term(get_record_keycode(&tapping_key, false), &tapping_key))
-# else
-# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < g_tapping_term)
# endif
# ifdef TAPPING_FORCE_HOLD_PER_KEY
@@ -164,15 +168,7 @@ bool process_tapping(keyrecord_t *keyp) {
else if (
(
(
- (
-# ifdef TAPPING_TERM_PER_KEY
- get_tapping_term(tapping_keycode, &tapping_key)
-# else
- g_tapping_term
-# endif
- >= 500
- )
-
+ GET_TAPPING_TERM(tapping_keycode, &tapping_key) >= 500
# ifdef PERMISSIVE_HOLD_PER_KEY
|| get_permissive_hold(tapping_keycode, &tapping_key)
# elif defined(PERMISSIVE_HOLD)
diff --git a/quantum/action_tapping.h b/quantum/action_tapping.h
index b2feb6850c..9b64c93120 100644
--- a/quantum/action_tapping.h
+++ b/quantum/action_tapping.h
@@ -44,3 +44,11 @@ bool get_retro_tapping(uint16_t keycode, keyrecord_t *record);
#ifdef DYNAMIC_TAPPING_TERM_ENABLE
extern uint16_t g_tapping_term;
#endif
+
+#ifdef TAPPING_TERM_PER_KEY
+# define GET_TAPPING_TERM(keycode, record) get_tapping_term(keycode, record)
+#elif defined(DYNAMIC_TAPPING_TERM_ENABLE)
+# define GET_TAPPING_TERM(keycode, record) g_tapping_term
+#else
+# define GET_TAPPING_TERM(keycode, record) (TAPPING_TERM)
+#endif
diff --git a/quantum/action_util.c b/quantum/action_util.c
index 4ea0bf61fb..738410a4ac 100644
--- a/quantum/action_util.c
+++ b/quantum/action_util.c
@@ -155,7 +155,7 @@ void clear_oneshot_swaphands(void) {
* FIXME: needs doc
*/
void set_oneshot_layer(uint8_t layer, uint8_t state) {
- if (!keymap_config.oneshot_disable) {
+ if (keymap_config.oneshot_enable) {
oneshot_layer_data = layer << 3 | state;
layer_on(layer);
# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
@@ -184,7 +184,7 @@ void reset_oneshot_layer(void) {
void clear_oneshot_layer_state(oneshot_fullfillment_t state) {
uint8_t start_state = oneshot_layer_data;
oneshot_layer_data &= ~state;
- if ((!get_oneshot_layer_state() && start_state != oneshot_layer_data) && !keymap_config.oneshot_disable) {
+ if ((!get_oneshot_layer_state() && start_state != oneshot_layer_data) && keymap_config.oneshot_enable) {
layer_off(get_oneshot_layer());
reset_oneshot_layer();
}
@@ -202,8 +202,8 @@ bool is_oneshot_layer_active(void) {
* FIXME: needs doc
*/
void oneshot_set(bool active) {
- if (keymap_config.oneshot_disable != active) {
- keymap_config.oneshot_disable = active;
+ if (keymap_config.oneshot_enable != active) {
+ keymap_config.oneshot_enable = active;
eeconfig_update_keymap(keymap_config.raw);
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
dprintf("Oneshot: active: %d\n", active);
@@ -215,7 +215,7 @@ void oneshot_set(bool active) {
* FIXME: needs doc
*/
void oneshot_toggle(void) {
- oneshot_set(!keymap_config.oneshot_disable);
+ oneshot_set(!keymap_config.oneshot_enable);
}
/** \brief enable oneshot
@@ -235,7 +235,7 @@ void oneshot_disable(void) {
}
bool is_oneshot_enabled(void) {
- return keymap_config.oneshot_disable;
+ return keymap_config.oneshot_enable;
}
#endif
@@ -413,7 +413,7 @@ void del_oneshot_mods(uint8_t mods) {
* FIXME: needs doc
*/
void set_oneshot_mods(uint8_t mods) {
- if (!keymap_config.oneshot_disable) {
+ if (keymap_config.oneshot_enable) {
if (oneshot_mods != mods) {
# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
oneshot_time = timer_read();
diff --git a/quantum/backlight/backlight_avr.c b/quantum/backlight/backlight_avr.c
index f3a0252270..474e0a86f5 100644
--- a/quantum/backlight/backlight_avr.c
+++ b/quantum/backlight/backlight_avr.c
@@ -405,14 +405,18 @@ ISR(TIMERx_OVF_vect)
uint16_t interval = (uint16_t)get_breathing_period() * breathing_ISR_frequency / BREATHING_STEPS;
// resetting after one period to prevent ugly reset at overflow.
breathing_counter = (breathing_counter + 1) % (get_breathing_period() * breathing_ISR_frequency);
- uint8_t index = breathing_counter / interval % BREATHING_STEPS;
+ uint8_t index = breathing_counter / interval;
+ // limit index to max step value
+ if (index >= BREATHING_STEPS) {
+ index = BREATHING_STEPS - 1;
+ }
if (((breathing_halt == BREATHING_HALT_ON) && (index == BREATHING_STEPS / 2)) || ((breathing_halt == BREATHING_HALT_OFF) && (index == BREATHING_STEPS - 1))) {
breathing_interrupt_disable();
}
// Set PWM to a brightnessvalue scaled to the configured resolution
- set_pwm(cie_lightness(rescale_limit_val(scale_backlight((uint16_t)pgm_read_byte(&breathing_table[index]) * ICRx / 255))));
+ set_pwm(cie_lightness(rescale_limit_val(scale_backlight((uint32_t)pgm_read_byte(&breathing_table[index]) * ICRx / 255))));
}
#endif // BACKLIGHT_BREATHING
diff --git a/quantum/caps_word.c b/quantum/caps_word.c
new file mode 100644
index 0000000000..5b83659f28
--- /dev/null
+++ b/quantum/caps_word.c
@@ -0,0 +1,80 @@
+// Copyright 2021-2022 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "caps_word.h"
+
+/** @brief True when Caps Word is active. */
+static bool caps_word_active = false;
+
+#if CAPS_WORD_IDLE_TIMEOUT > 0
+// Constrain timeout to a sensible range. With 16-bit timers, the longest
+// timeout possible is 32768 ms, rounded here to 30000 ms = half a minute.
+# if CAPS_WORD_IDLE_TIMEOUT < 100 || CAPS_WORD_IDLE_TIMEOUT > 30000
+# error "CAPS_WORD_IDLE_TIMEOUT must be between 100 and 30000 ms"
+# endif
+
+/** @brief Deadline for idle timeout. */
+static uint16_t idle_timer = 0;
+
+void caps_word_task(void) {
+ if (caps_word_active && timer_expired(timer_read(), idle_timer)) {
+ caps_word_off();
+ }
+}
+
+void caps_word_reset_idle_timer(void) {
+ idle_timer = timer_read() + CAPS_WORD_IDLE_TIMEOUT;
+}
+#endif // CAPS_WORD_IDLE_TIMEOUT > 0
+
+void caps_word_on(void) {
+ if (caps_word_active) {
+ return;
+ }
+
+ clear_mods();
+#ifndef NO_ACTION_ONESHOT
+ clear_oneshot_mods();
+#endif // NO_ACTION_ONESHOT
+#if CAPS_WORD_IDLE_TIMEOUT > 0
+ caps_word_reset_idle_timer();
+#endif // CAPS_WORD_IDLE_TIMEOUT > 0
+
+ caps_word_active = true;
+ caps_word_set_user(true);
+}
+
+void caps_word_off(void) {
+ if (!caps_word_active) {
+ return;
+ }
+
+ unregister_weak_mods(MOD_MASK_SHIFT); // Make sure weak shift is off.
+ caps_word_active = false;
+ caps_word_set_user(false);
+}
+
+void caps_word_toggle(void) {
+ if (caps_word_active) {
+ caps_word_off();
+ } else {
+ caps_word_on();
+ }
+}
+
+bool is_caps_word_on(void) {
+ return caps_word_active;
+}
+
+__attribute__((weak)) void caps_word_set_user(bool active) {}
diff --git a/quantum/caps_word.h b/quantum/caps_word.h
new file mode 100644
index 0000000000..b83f73371e
--- /dev/null
+++ b/quantum/caps_word.h
@@ -0,0 +1,43 @@
+// Copyright 2021-2022 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#pragma once
+
+#include "quantum.h"
+
+#ifndef CAPS_WORD_IDLE_TIMEOUT
+# define CAPS_WORD_IDLE_TIMEOUT 5000 // Default timeout of 5 seconds.
+#endif // CAPS_WORD_IDLE_TIMEOUT
+
+#if CAPS_WORD_IDLE_TIMEOUT > 0
+/** @brief Matrix scan task for Caps Word feature */
+void caps_word_task(void);
+
+/** @brief Resets timer for Caps Word idle timeout. */
+void caps_word_reset_idle_timer(void);
+#else
+static inline void caps_word_task(void) {}
+#endif // CAPS_WORD_IDLE_TIMEOUT > 0
+
+void caps_word_on(void); /**< Activates Caps Word. */
+void caps_word_off(void); /**< Deactivates Caps Word. */
+void caps_word_toggle(void); /**< Toggles Caps Word. */
+bool is_caps_word_on(void); /**< Gets whether currently active. */
+
+/**
+ * @brief Caps Word set callback.
+ *
+ * @param active True if Caps Word is active, false otherwise
+ */
+void caps_word_set_user(bool active);
diff --git a/quantum/dynamic_keymap.c b/quantum/dynamic_keymap.c
index f070375ff3..fc1c55784d 100644
--- a/quantum/dynamic_keymap.c
+++ b/quantum/dynamic_keymap.c
@@ -21,6 +21,12 @@
#include "dynamic_keymap.h"
#include "via.h" // for default VIA_EEPROM_ADDR_END
+#ifdef ENCODER_ENABLE
+# include "encoder.h"
+#else
+# define NUM_ENCODERS 0
+#endif
+
#ifndef DYNAMIC_KEYMAP_LAYER_COUNT
# define DYNAMIC_KEYMAP_LAYER_COUNT 4
#endif
@@ -58,20 +64,28 @@
# endif
#endif
-// Dynamic macro starts after dynamic keymaps
-#ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
-# define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2))
+// Dynamic encoders starts after dynamic keymaps
+#ifndef DYNAMIC_KEYMAP_ENCODER_EEPROM_ADDR
+# define DYNAMIC_KEYMAP_ENCODER_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2))
#endif
+// Dynamic macro starts after dynamic encoders, but only when using ENCODER_MAP
+#ifdef ENCODER_MAP_ENABLE
+# ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
+# define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_ENCODER_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * NUM_ENCODERS * 2 * 2))
+# endif // DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
+#else // ENCODER_MAP_ENABLE
+# ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
+# define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_ENCODER_EEPROM_ADDR)
+# endif // DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
+#endif // ENCODER_MAP_ENABLE
+
// Sanity check that dynamic keymaps fit in available EEPROM
// If there's not 100 bytes available for macros, then something is wrong.
// The keyboard should override DYNAMIC_KEYMAP_LAYER_COUNT to reduce it,
// or DYNAMIC_KEYMAP_EEPROM_MAX_ADDR to increase it, *only if* the microcontroller has
// more than the default.
-#if DYNAMIC_KEYMAP_EEPROM_MAX_ADDR - DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR < 100
-# pragma message STR(DYNAMIC_KEYMAP_EEPROM_MAX_ADDR - DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR) " < 100"
-# error Dynamic keymaps are configured to use more EEPROM than is available.
-#endif
+_Static_assert((DYNAMIC_KEYMAP_EEPROM_MAX_ADDR) - (DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR) >= 100, "Dynamic keymaps are configured to use more EEPROM than is available.");
// Dynamic macros are stored after the keymaps and use what is available
// up to and including DYNAMIC_KEYMAP_EEPROM_MAX_ADDR.
@@ -89,6 +103,7 @@ void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t c
}
uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column) {
+ if (layer >= DYNAMIC_KEYMAP_LAYER_COUNT || row >= MATRIX_ROWS || column >= MATRIX_COLS) return KC_NO;
void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column);
// Big endian, so we can read/write EEPROM directly from host if we want
uint16_t keycode = eeprom_read_byte(address) << 8;
@@ -97,12 +112,36 @@ uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column)
}
void dynamic_keymap_set_keycode(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode) {
+ if (layer >= DYNAMIC_KEYMAP_LAYER_COUNT || row >= MATRIX_ROWS || column >= MATRIX_COLS) return;
void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column);
// Big endian, so we can read/write EEPROM directly from host if we want
eeprom_update_byte(address, (uint8_t)(keycode >> 8));
eeprom_update_byte(address + 1, (uint8_t)(keycode & 0xFF));
}
+#ifdef ENCODER_MAP_ENABLE
+void *dynamic_keymap_encoder_to_eeprom_address(uint8_t layer, uint8_t encoder_id) {
+ return ((void *)DYNAMIC_KEYMAP_ENCODER_EEPROM_ADDR) + (layer * NUM_ENCODERS * 2 * 2) + (encoder_id * 2 * 2);
+}
+
+uint16_t dynamic_keymap_get_encoder(uint8_t layer, uint8_t encoder_id, bool clockwise) {
+ if (layer >= DYNAMIC_KEYMAP_LAYER_COUNT || encoder_id >= NUM_ENCODERS) return KC_NO;
+ void *address = dynamic_keymap_encoder_to_eeprom_address(layer, encoder_id);
+ // Big endian, so we can read/write EEPROM directly from host if we want
+ uint16_t keycode = ((uint16_t)eeprom_read_byte(address + (clockwise ? 0 : 2))) << 8;
+ keycode |= eeprom_read_byte(address + (clockwise ? 0 : 2) + 1);
+ return keycode;
+}
+
+void dynamic_keymap_set_encoder(uint8_t layer, uint8_t encoder_id, bool clockwise, uint16_t keycode) {
+ if (layer >= DYNAMIC_KEYMAP_LAYER_COUNT || encoder_id >= NUM_ENCODERS) return;
+ void *address = dynamic_keymap_encoder_to_eeprom_address(layer, encoder_id);
+ // Big endian, so we can read/write EEPROM directly from host if we want
+ eeprom_update_byte(address + (clockwise ? 0 : 2), (uint8_t)(keycode >> 8));
+ eeprom_update_byte(address + (clockwise ? 0 : 2) + 1, (uint8_t)(keycode & 0xFF));
+}
+#endif // ENCODER_MAP_ENABLE
+
void dynamic_keymap_reset(void) {
// Reset the keymaps in EEPROM to what is in flash.
// All keyboards using dynamic keymaps should define a layout
@@ -113,6 +152,12 @@ void dynamic_keymap_reset(void) {
dynamic_keymap_set_keycode(layer, row, column, pgm_read_word(&keymaps[layer][row][column]));
}
}
+#ifdef ENCODER_MAP_ENABLE
+ for (int encoder = 0; encoder < NUM_ENCODERS; encoder++) {
+ dynamic_keymap_set_encoder(layer, encoder, true, pgm_read_word(&encoder_map[layer][encoder][0]));
+ dynamic_keymap_set_encoder(layer, encoder, false, pgm_read_word(&encoder_map[layer][encoder][1]));
+ }
+#endif // ENCODER_MAP_ENABLE
}
}
@@ -148,9 +193,15 @@ void dynamic_keymap_set_buffer(uint16_t offset, uint16_t size, uint8_t *data) {
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) {
if (layer < DYNAMIC_KEYMAP_LAYER_COUNT && key.row < MATRIX_ROWS && key.col < MATRIX_COLS) {
return dynamic_keymap_get_keycode(layer, key.row, key.col);
- } else {
- return KC_NO;
}
+#ifdef ENCODER_MAP_ENABLE
+ else if (layer < DYNAMIC_KEYMAP_LAYER_COUNT && key.row == KEYLOC_ENCODER_CW && key.col < NUM_ENCODERS) {
+ return dynamic_keymap_get_encoder(layer, key.col, true);
+ } else if (layer < DYNAMIC_KEYMAP_LAYER_COUNT && key.row == KEYLOC_ENCODER_CCW && key.col < NUM_ENCODERS) {
+ return dynamic_keymap_get_encoder(layer, key.col, false);
+ }
+#endif // ENCODER_MAP_ENABLE
+ return KC_NO;
}
uint8_t dynamic_keymap_macro_get_count(void) {
diff --git a/quantum/dynamic_keymap.h b/quantum/dynamic_keymap.h
index 55676172b6..459b48d07a 100644
--- a/quantum/dynamic_keymap.h
+++ b/quantum/dynamic_keymap.h
@@ -22,7 +22,11 @@ uint8_t dynamic_keymap_get_layer_count(void);
void * dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column);
uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column);
void dynamic_keymap_set_keycode(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode);
-void dynamic_keymap_reset(void);
+#ifdef ENCODER_MAP_ENABLE
+uint16_t dynamic_keymap_get_encoder(uint8_t layer, uint8_t encoder_id, bool clockwise);
+void dynamic_keymap_set_encoder(uint8_t layer, uint8_t encoder_id, bool clockwise, uint16_t keycode);
+#endif // ENCODER_MAP_ENABLE
+void dynamic_keymap_reset(void);
// These get/set the keycodes as stored in the EEPROM buffer
// Data is big-endian 16-bit values (the keycodes)
// Order is by layer/row/column
diff --git a/quantum/eeconfig.c b/quantum/eeconfig.c
index 14cd5887f4..0ff9996ca4 100644
--- a/quantum/eeconfig.c
+++ b/quantum/eeconfig.c
@@ -46,7 +46,7 @@ void eeconfig_init_quantum(void) {
eeprom_update_byte(EECONFIG_DEFAULT_LAYER, 0);
default_layer_state = 0;
eeprom_update_byte(EECONFIG_KEYMAP_LOWER_BYTE, 0);
- eeprom_update_byte(EECONFIG_KEYMAP_UPPER_BYTE, 0);
+ eeprom_update_byte(EECONFIG_KEYMAP_UPPER_BYTE, 0x4);
eeprom_update_byte(EECONFIG_MOUSEKEY_ACCEL, 0);
eeprom_update_byte(EECONFIG_BACKLIGHT, 0);
eeprom_update_byte(EECONFIG_AUDIO, 0xFF); // On by default
diff --git a/quantum/eeconfig.h b/quantum/eeconfig.h
index f3cd1867ab..565a0dbe5b 100644
--- a/quantum/eeconfig.h
+++ b/quantum/eeconfig.h
@@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdbool.h>
#ifndef EECONFIG_MAGIC_NUMBER
-# define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEE9 // When changing, decrement this value to avoid future re-init issues
+# define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEE8 // When changing, decrement this value to avoid future re-init issues
#endif
#define EECONFIG_MAGIC_NUMBER_OFF (uint16_t)0xFFFF
diff --git a/quantum/encoder.c b/quantum/encoder.c
index 438c7d8564..105bed0147 100644
--- a/quantum/encoder.c
+++ b/quantum/encoder.c
@@ -23,6 +23,10 @@
// for memcpy
#include <string.h>
+#ifndef ENCODER_MAP_KEY_DELAY
+# define ENCODER_MAP_KEY_DELAY 2
+#endif
+
#if !defined(ENCODER_RESOLUTIONS) && !defined(ENCODER_RESOLUTION)
# define ENCODER_RESOLUTION 4
#endif
@@ -31,11 +35,13 @@
# error "No encoder pads defined by ENCODERS_PAD_A and ENCODERS_PAD_B"
#endif
-#define NUMBER_OF_ENCODERS (sizeof(encoders_pad_a) / sizeof(pin_t))
-static pin_t encoders_pad_a[] = ENCODERS_PAD_A;
-static pin_t encoders_pad_b[] = ENCODERS_PAD_B;
+extern volatile bool isLeftHand;
+
+static pin_t encoders_pad_a[NUM_ENCODERS_MAX_PER_SIDE] = ENCODERS_PAD_A;
+static pin_t encoders_pad_b[NUM_ENCODERS_MAX_PER_SIDE] = ENCODERS_PAD_B;
+
#ifdef ENCODER_RESOLUTIONS
-static uint8_t encoder_resolutions[] = ENCODER_RESOLUTIONS;
+static uint8_t encoder_resolutions[NUM_ENCODERS] = ENCODER_RESOLUTIONS;
#endif
#ifndef ENCODER_DIRECTION_FLIP
@@ -47,18 +53,20 @@ static uint8_t encoder_resolutions[] = ENCODER_RESOLUTIONS;
#endif
static int8_t encoder_LUT[] = {0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0};
-static uint8_t encoder_state[NUMBER_OF_ENCODERS] = {0};
-static int8_t encoder_pulses[NUMBER_OF_ENCODERS] = {0};
+static uint8_t encoder_state[NUM_ENCODERS] = {0};
+static int8_t encoder_pulses[NUM_ENCODERS] = {0};
+// encoder counts
+static uint8_t thisCount;
#ifdef SPLIT_KEYBOARD
-// right half encoders come over as second set of encoders
-static uint8_t encoder_value[NUMBER_OF_ENCODERS * 2] = {0};
-// row offsets for each hand
+// encoder offsets for each hand
static uint8_t thisHand, thatHand;
-#else
-static uint8_t encoder_value[NUMBER_OF_ENCODERS] = {0};
+// encoder counts for each hand
+static uint8_t thatCount;
#endif
+static uint8_t encoder_value[NUM_ENCODERS] = {0};
+
__attribute__((weak)) void encoder_wait_pullup_charge(void) {
wait_us(100);
}
@@ -72,46 +80,83 @@ __attribute__((weak)) bool encoder_update_kb(uint8_t index, bool clockwise) {
}
void encoder_init(void) {
+#ifdef SPLIT_KEYBOARD
+ thisHand = isLeftHand ? 0 : NUM_ENCODERS_LEFT;
+ thatHand = NUM_ENCODERS_LEFT - thisHand;
+ thisCount = isLeftHand ? NUM_ENCODERS_LEFT : NUM_ENCODERS_RIGHT;
+ thatCount = isLeftHand ? NUM_ENCODERS_RIGHT : NUM_ENCODERS_LEFT;
+#else // SPLIT_KEYBOARD
+ thisCount = NUM_ENCODERS;
+#endif
+
+#ifdef ENCODER_TESTS
+ // Annoying that we have to clear out values during initialisation here, but
+ // because all the arrays are static locals, rerunning tests in the same
+ // executable doesn't reset any of these. Kinda crappy having test-only code
+ // here, but it's the simplest solution.
+ memset(encoder_value, 0, sizeof(encoder_value));
+ memset(encoder_state, 0, sizeof(encoder_state));
+ memset(encoder_pulses, 0, sizeof(encoder_pulses));
+ static const pin_t encoders_pad_a_left[] = ENCODERS_PAD_A;
+ static const pin_t encoders_pad_b_left[] = ENCODERS_PAD_B;
+ for (uint8_t i = 0; i < thisCount; i++) {
+ encoders_pad_a[i] = encoders_pad_a_left[i];
+ encoders_pad_b[i] = encoders_pad_b_left[i];
+ }
+#endif
+
#if defined(SPLIT_KEYBOARD) && defined(ENCODERS_PAD_A_RIGHT) && defined(ENCODERS_PAD_B_RIGHT)
+ // Re-initialise the pads if it's the right-hand side
if (!isLeftHand) {
- const pin_t encoders_pad_a_right[] = ENCODERS_PAD_A_RIGHT;
- const pin_t encoders_pad_b_right[] = ENCODERS_PAD_B_RIGHT;
-# if defined(ENCODER_RESOLUTIONS_RIGHT)
- const uint8_t encoder_resolutions_right[] = ENCODER_RESOLUTIONS_RIGHT;
-# endif
- for (uint8_t i = 0; i < NUMBER_OF_ENCODERS; i++) {
+ static const pin_t encoders_pad_a_right[] = ENCODERS_PAD_A_RIGHT;
+ static const pin_t encoders_pad_b_right[] = ENCODERS_PAD_B_RIGHT;
+ for (uint8_t i = 0; i < thisCount; i++) {
encoders_pad_a[i] = encoders_pad_a_right[i];
encoders_pad_b[i] = encoders_pad_b_right[i];
-# if defined(ENCODER_RESOLUTIONS_RIGHT)
- encoder_resolutions[i] = encoder_resolutions_right[i];
-# endif
}
}
-#endif
+#endif // defined(SPLIT_KEYBOARD) && defined(ENCODERS_PAD_A_RIGHT) && defined(ENCODERS_PAD_B_RIGHT)
- for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {
+ // Encoder resolutions is handled purely master-side, so concatenate the two arrays
+#if defined(SPLIT_KEYBOARD) && defined(ENCODER_RESOLUTIONS)
+# if defined(ENCODER_RESOLUTIONS_RIGHT)
+ static const uint8_t encoder_resolutions_right[NUM_ENCODERS_RIGHT] = ENCODER_RESOLUTIONS_RIGHT;
+# else // defined(ENCODER_RESOLUTIONS_RIGHT)
+ static const uint8_t encoder_resolutions_right[NUM_ENCODERS_RIGHT] = ENCODER_RESOLUTIONS;
+# endif // defined(ENCODER_RESOLUTIONS_RIGHT)
+ for (uint8_t i = 0; i < NUM_ENCODERS_RIGHT; i++) {
+ encoder_resolutions[NUM_ENCODERS_LEFT + i] = encoder_resolutions_right[i];
+ }
+#endif // defined(SPLIT_KEYBOARD) && defined(ENCODER_RESOLUTIONS)
+
+ for (uint8_t i = 0; i < thisCount; i++) {
setPinInputHigh(encoders_pad_a[i]);
setPinInputHigh(encoders_pad_b[i]);
}
encoder_wait_pullup_charge();
- for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {
+ for (uint8_t i = 0; i < thisCount; i++) {
encoder_state[i] = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1);
}
+}
-#ifdef SPLIT_KEYBOARD
- thisHand = isLeftHand ? 0 : NUMBER_OF_ENCODERS;
- thatHand = NUMBER_OF_ENCODERS - thisHand;
-#endif
+#ifdef ENCODER_MAP_ENABLE
+static void encoder_exec_mapping(uint8_t index, bool clockwise) {
+ // The delays below cater for Windows and its wonderful requirements.
+ action_exec(clockwise ? ENCODER_CW_EVENT(index, true) : ENCODER_CCW_EVENT(index, true));
+ wait_ms(ENCODER_MAP_KEY_DELAY);
+ action_exec(clockwise ? ENCODER_CW_EVENT(index, false) : ENCODER_CCW_EVENT(index, false));
+ wait_ms(ENCODER_MAP_KEY_DELAY);
}
+#endif // ENCODER_MAP_ENABLE
static bool encoder_update(uint8_t index, uint8_t state) {
bool changed = false;
uint8_t i = index;
#ifdef ENCODER_RESOLUTIONS
- uint8_t resolution = encoder_resolutions[i];
+ const uint8_t resolution = encoder_resolutions[i];
#else
- uint8_t resolution = ENCODER_RESOLUTION;
+ const uint8_t resolution = ENCODER_RESOLUTION;
#endif
#ifdef SPLIT_KEYBOARD
@@ -121,12 +166,20 @@ static bool encoder_update(uint8_t index, uint8_t state) {
if (encoder_pulses[i] >= resolution) {
encoder_value[index]++;
changed = true;
+#ifdef ENCODER_MAP_ENABLE
+ encoder_exec_mapping(index, ENCODER_COUNTER_CLOCKWISE);
+#else // ENCODER_MAP_ENABLE
encoder_update_kb(index, ENCODER_COUNTER_CLOCKWISE);
+#endif // ENCODER_MAP_ENABLE
}
if (encoder_pulses[i] <= -resolution) { // direction is arbitrary here, but this clockwise
encoder_value[index]--;
changed = true;
+#ifdef ENCODER_MAP_ENABLE
+ encoder_exec_mapping(index, ENCODER_CLOCKWISE);
+#else // ENCODER_MAP_ENABLE
encoder_update_kb(index, ENCODER_CLOCKWISE);
+#endif // ENCODER_MAP_ENABLE
}
encoder_pulses[i] %= resolution;
#ifdef ENCODER_DEFAULT_POS
@@ -139,10 +192,13 @@ static bool encoder_update(uint8_t index, uint8_t state) {
bool encoder_read(void) {
bool changed = false;
- for (uint8_t i = 0; i < NUMBER_OF_ENCODERS; i++) {
- encoder_state[i] <<= 2;
- encoder_state[i] |= (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1);
- changed |= encoder_update(i, encoder_state[i]);
+ for (uint8_t i = 0; i < thisCount; i++) {
+ uint8_t new_status = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1);
+ if ((encoder_state[i] & 0x3) != new_status) {
+ encoder_state[i] <<= 2;
+ encoder_state[i] |= new_status;
+ changed |= encoder_update(i, encoder_state[i]);
+ }
}
return changed;
}
@@ -150,26 +206,34 @@ bool encoder_read(void) {
#ifdef SPLIT_KEYBOARD
void last_encoder_activity_trigger(void);
-void encoder_state_raw(uint8_t* slave_state) {
- memcpy(slave_state, &encoder_value[thisHand], sizeof(uint8_t) * NUMBER_OF_ENCODERS);
+void encoder_state_raw(uint8_t *slave_state) {
+ memcpy(slave_state, &encoder_value[thisHand], sizeof(uint8_t) * thisCount);
}
-void encoder_update_raw(uint8_t* slave_state) {
+void encoder_update_raw(uint8_t *slave_state) {
bool changed = false;
- for (uint8_t i = 0; i < NUMBER_OF_ENCODERS; i++) {
- uint8_t index = i + thatHand;
- int8_t delta = slave_state[i] - encoder_value[index];
+ for (uint8_t i = 0; i < thatCount; i++) { // Note inverted logic -- we want the opposite side
+ const uint8_t index = i + thatHand;
+ int8_t delta = slave_state[i] - encoder_value[index];
while (delta > 0) {
delta--;
encoder_value[index]++;
changed = true;
+# ifdef ENCODER_MAP_ENABLE
+ encoder_exec_mapping(index, ENCODER_COUNTER_CLOCKWISE);
+# else // ENCODER_MAP_ENABLE
encoder_update_kb(index, ENCODER_COUNTER_CLOCKWISE);
+# endif // ENCODER_MAP_ENABLE
}
while (delta < 0) {
delta++;
encoder_value[index]--;
changed = true;
+# ifdef ENCODER_MAP_ENABLE
+ encoder_exec_mapping(index, ENCODER_CLOCKWISE);
+# else // ENCODER_MAP_ENABLE
encoder_update_kb(index, ENCODER_CLOCKWISE);
+# endif // ENCODER_MAP_ENABLE
}
}
diff --git a/quantum/encoder.h b/quantum/encoder.h
index 25dc77721d..82f95b4931 100644
--- a/quantum/encoder.h
+++ b/quantum/encoder.h
@@ -18,6 +18,7 @@
#pragma once
#include "quantum.h"
+#include "util.h"
void encoder_init(void);
bool encoder_read(void);
@@ -26,6 +27,37 @@ bool encoder_update_kb(uint8_t index, bool clockwise);
bool encoder_update_user(uint8_t index, bool clockwise);
#ifdef SPLIT_KEYBOARD
+
void encoder_state_raw(uint8_t* slave_state);
void encoder_update_raw(uint8_t* slave_state);
-#endif
+
+# if defined(ENCODERS_PAD_A_RIGHT)
+# define NUM_ENCODERS_LEFT (sizeof(((pin_t[])ENCODERS_PAD_A)) / sizeof(pin_t))
+# define NUM_ENCODERS_RIGHT (sizeof(((pin_t[])ENCODERS_PAD_A_RIGHT)) / sizeof(pin_t))
+# else
+# define NUM_ENCODERS_LEFT (sizeof(((pin_t[])ENCODERS_PAD_A)) / sizeof(pin_t))
+# define NUM_ENCODERS_RIGHT NUM_ENCODERS_LEFT
+# endif
+# define NUM_ENCODERS (NUM_ENCODERS_LEFT + NUM_ENCODERS_RIGHT)
+
+#else // SPLIT_KEYBOARD
+
+# define NUM_ENCODERS (sizeof(((pin_t[])ENCODERS_PAD_A)) / sizeof(pin_t))
+# define NUM_ENCODERS_LEFT NUM_ENCODERS
+# define NUM_ENCODERS_RIGHT 0
+
+#endif // SPLIT_KEYBOARD
+
+#ifndef NUM_ENCODERS
+# define NUM_ENCODERS 0
+# define NUM_ENCODERS_LEFT 0
+# define NUM_ENCODERS_RIGHT 0
+#endif // NUM_ENCODERS
+
+#define NUM_ENCODERS_MAX_PER_SIDE MAX(NUM_ENCODERS_LEFT, NUM_ENCODERS_RIGHT)
+
+#ifdef ENCODER_MAP_ENABLE
+# define ENCODER_CCW_CW(ccw, cw) \
+ { (cw), (ccw) }
+extern const uint16_t encoder_map[][NUM_ENCODERS][2];
+#endif // ENCODER_MAP_ENABLE
diff --git a/quantum/encoder/tests/config_mock.h b/quantum/encoder/tests/config_mock.h
new file mode 100644
index 0000000000..703dcaf103
--- /dev/null
+++ b/quantum/encoder/tests/config_mock.h
@@ -0,0 +1,22 @@
+// Copyright 2022 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+#pragma once
+
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 1
+
+/* Here, "pins" from 0 to 31 are allowed. */
+#define ENCODERS_PAD_A \
+ { 0 }
+#define ENCODERS_PAD_B \
+ { 1 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mock.h"
+
+#ifdef __cplusplus
+};
+#endif
diff --git a/quantum/encoder/tests/config_mock_split_left_eq_right.h b/quantum/encoder/tests/config_mock_split_left_eq_right.h
new file mode 100644
index 0000000000..c80ac4d519
--- /dev/null
+++ b/quantum/encoder/tests/config_mock_split_left_eq_right.h
@@ -0,0 +1,26 @@
+// Copyright 2022 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+#pragma once
+
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 1
+
+/* Here, "pins" from 0 to 31 are allowed. */
+#define ENCODERS_PAD_A \
+ { 0, 2 }
+#define ENCODERS_PAD_B \
+ { 1, 3 }
+#define ENCODERS_PAD_A_RIGHT \
+ { 4, 6 }
+#define ENCODERS_PAD_B_RIGHT \
+ { 5, 7 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mock_split.h"
+
+#ifdef __cplusplus
+};
+#endif
diff --git a/quantum/encoder/tests/config_mock_split_left_gt_right.h b/quantum/encoder/tests/config_mock_split_left_gt_right.h
new file mode 100644
index 0000000000..91d5f3d605
--- /dev/null
+++ b/quantum/encoder/tests/config_mock_split_left_gt_right.h
@@ -0,0 +1,26 @@
+// Copyright 2022 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+#pragma once
+
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 1
+
+/* Here, "pins" from 0 to 31 are allowed. */
+#define ENCODERS_PAD_A \
+ { 0, 2, 4 }
+#define ENCODERS_PAD_B \
+ { 1, 3, 5 }
+#define ENCODERS_PAD_A_RIGHT \
+ { 6, 8 }
+#define ENCODERS_PAD_B_RIGHT \
+ { 7, 9 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mock_split.h"
+
+#ifdef __cplusplus
+};
+#endif
diff --git a/quantum/encoder/tests/config_mock_split_left_lt_right.h b/quantum/encoder/tests/config_mock_split_left_lt_right.h
new file mode 100644
index 0000000000..4108a184a6
--- /dev/null
+++ b/quantum/encoder/tests/config_mock_split_left_lt_right.h
@@ -0,0 +1,26 @@
+// Copyright 2022 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+#pragma once
+
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 1
+
+/* Here, "pins" from 0 to 31 are allowed. */
+#define ENCODERS_PAD_A \
+ { 0, 2 }
+#define ENCODERS_PAD_B \
+ { 1, 3 }
+#define ENCODERS_PAD_A_RIGHT \
+ { 4, 6, 8 }
+#define ENCODERS_PAD_B_RIGHT \
+ { 5, 7, 9 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mock_split.h"
+
+#ifdef __cplusplus
+};
+#endif
diff --git a/quantum/encoder/tests/config_mock_split_no_left.h b/quantum/encoder/tests/config_mock_split_no_left.h
new file mode 100644
index 0000000000..9db7fa7e41
--- /dev/null
+++ b/quantum/encoder/tests/config_mock_split_no_left.h
@@ -0,0 +1,26 @@
+// Copyright 2022 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+#pragma once
+
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 1
+
+/* Here, "pins" from 0 to 31 are allowed. */
+#define ENCODERS_PAD_A \
+ {}
+#define ENCODERS_PAD_B \
+ {}
+#define ENCODERS_PAD_A_RIGHT \
+ { 0, 2 }
+#define ENCODERS_PAD_B_RIGHT \
+ { 1, 3 }
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mock_split.h"
+
+#ifdef __cplusplus
+};
+#endif
diff --git a/quantum/encoder/tests/config_mock_split_no_right.h b/quantum/encoder/tests/config_mock_split_no_right.h
new file mode 100644
index 0000000000..14f18015e6
--- /dev/null
+++ b/quantum/encoder/tests/config_mock_split_no_right.h
@@ -0,0 +1,26 @@
+// Copyright 2022 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+#pragma once
+
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 1
+
+/* Here, "pins" from 0 to 31 are allowed. */
+#define ENCODERS_PAD_A \
+ { 0, 2 }
+#define ENCODERS_PAD_B \
+ { 1, 3 }
+#define ENCODERS_PAD_A_RIGHT \
+ {}
+#define ENCODERS_PAD_B_RIGHT \
+ {}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mock_split.h"
+
+#ifdef __cplusplus
+};
+#endif
diff --git a/quantum/encoder/tests/encoder_tests.cpp b/quantum/encoder/tests/encoder_tests.cpp
index 1888fdab8d..b7c18aeec0 100644
--- a/quantum/encoder/tests/encoder_tests.cpp
+++ b/quantum/encoder/tests/encoder_tests.cpp
@@ -30,12 +30,12 @@ struct update {
bool clockwise;
};
-uint8_t uidx = 0;
+uint8_t updates_array_idx = 0;
update updates[32];
bool encoder_update_kb(uint8_t index, bool clockwise) {
- updates[uidx % 32] = {index, clockwise};
- uidx++;
+ updates[updates_array_idx % 32] = {index, clockwise};
+ updates_array_idx++;
return true;
}
@@ -47,15 +47,15 @@ bool setAndRead(pin_t pin, bool val) {
class EncoderTest : public ::testing::Test {};
TEST_F(EncoderTest, TestInit) {
- uidx = 0;
+ updates_array_idx = 0;
encoder_init();
EXPECT_EQ(pinIsInputHigh[0], true);
EXPECT_EQ(pinIsInputHigh[1], true);
- EXPECT_EQ(uidx, 0);
+ EXPECT_EQ(updates_array_idx, 0);
}
TEST_F(EncoderTest, TestOneClockwise) {
- uidx = 0;
+ updates_array_idx = 0;
encoder_init();
// send 4 pulses. with resolution 4, that's one step and we should get 1 update.
setAndRead(0, false);
@@ -63,26 +63,26 @@ TEST_F(EncoderTest, TestOneClockwise) {
setAndRead(0, true);
setAndRead(1, true);
- EXPECT_EQ(uidx, 1);
+ EXPECT_EQ(updates_array_idx, 1);
EXPECT_EQ(updates[0].index, 0);
EXPECT_EQ(updates[0].clockwise, true);
}
TEST_F(EncoderTest, TestOneCounterClockwise) {
- uidx = 0;
+ updates_array_idx = 0;
encoder_init();
setAndRead(1, false);
setAndRead(0, false);
setAndRead(1, true);
setAndRead(0, true);
- EXPECT_EQ(uidx, 1);
+ EXPECT_EQ(updates_array_idx, 1);
EXPECT_EQ(updates[0].index, 0);
EXPECT_EQ(updates[0].clockwise, false);
}
TEST_F(EncoderTest, TestTwoClockwiseOneCC) {
- uidx = 0;
+ updates_array_idx = 0;
encoder_init();
setAndRead(0, false);
setAndRead(1, false);
@@ -97,7 +97,7 @@ TEST_F(EncoderTest, TestTwoClockwiseOneCC) {
setAndRead(1, true);
setAndRead(0, true);
- EXPECT_EQ(uidx, 3);
+ EXPECT_EQ(updates_array_idx, 3);
EXPECT_EQ(updates[0].index, 0);
EXPECT_EQ(updates[0].clockwise, true);
EXPECT_EQ(updates[1].index, 0);
@@ -107,38 +107,38 @@ TEST_F(EncoderTest, TestTwoClockwiseOneCC) {
}
TEST_F(EncoderTest, TestNoEarly) {
- uidx = 0;
+ updates_array_idx = 0;
encoder_init();
// send 3 pulses. with resolution 4, that's not enough for a step.
setAndRead(0, false);
setAndRead(1, false);
setAndRead(0, true);
- EXPECT_EQ(uidx, 0);
+ EXPECT_EQ(updates_array_idx, 0);
// now send last pulse
setAndRead(1, true);
- EXPECT_EQ(uidx, 1);
+ EXPECT_EQ(updates_array_idx, 1);
EXPECT_EQ(updates[0].index, 0);
EXPECT_EQ(updates[0].clockwise, true);
}
TEST_F(EncoderTest, TestHalfway) {
- uidx = 0;
+ updates_array_idx = 0;
encoder_init();
// go halfway
setAndRead(0, false);
setAndRead(1, false);
- EXPECT_EQ(uidx, 0);
+ EXPECT_EQ(updates_array_idx, 0);
// back off
setAndRead(1, true);
setAndRead(0, true);
- EXPECT_EQ(uidx, 0);
+ EXPECT_EQ(updates_array_idx, 0);
// go all the way
setAndRead(0, false);
setAndRead(1, false);
setAndRead(0, true);
setAndRead(1, true);
// should result in 1 update
- EXPECT_EQ(uidx, 1);
+ EXPECT_EQ(updates_array_idx, 1);
EXPECT_EQ(updates[0].index, 0);
EXPECT_EQ(updates[0].clockwise, true);
}
diff --git a/quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp b/quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp
new file mode 100644
index 0000000000..916e47b185
--- /dev/null
+++ b/quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp
@@ -0,0 +1,135 @@
+/* Copyright 2021 Balz Guenat
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "gtest/gtest.h"
+#include "gmock/gmock.h"
+#include <vector>
+#include <algorithm>
+#include <stdio.h>
+
+extern "C" {
+#include "encoder.h"
+#include "encoder/tests/mock_split.h"
+}
+
+struct update {
+ int8_t index;
+ bool clockwise;
+};
+
+uint8_t updates_array_idx = 0;
+update updates[32];
+
+bool isLeftHand;
+
+bool encoder_update_kb(uint8_t index, bool clockwise) {
+ if (!isLeftHand) {
+ // this method has no effect on slave half
+ printf("ignoring update on right hand (%d,%s)\n", index, clockwise ? "CW" : "CC");
+ return true;
+ }
+ updates[updates_array_idx % 32] = {index, clockwise};
+ updates_array_idx++;
+ return true;
+}
+
+bool setAndRead(pin_t pin, bool val) {
+ setPin(pin, val);
+ return encoder_read();
+}
+
+class EncoderSplitTestLeftEqRight : public ::testing::Test {
+ protected:
+ void SetUp() override {
+ updates_array_idx = 0;
+ for (int i = 0; i < 32; i++) {
+ pinIsInputHigh[i] = 0;
+ pins[i] = 0;
+ }
+ }
+};
+
+TEST_F(EncoderSplitTestLeftEqRight, TestInitLeft) {
+ isLeftHand = true;
+ encoder_init();
+ EXPECT_EQ(pinIsInputHigh[0], true);
+ EXPECT_EQ(pinIsInputHigh[1], true);
+ EXPECT_EQ(pinIsInputHigh[2], true);
+ EXPECT_EQ(pinIsInputHigh[3], true);
+ EXPECT_EQ(pinIsInputHigh[4], false);
+ EXPECT_EQ(pinIsInputHigh[5], false);
+ EXPECT_EQ(pinIsInputHigh[6], false);
+ EXPECT_EQ(pinIsInputHigh[7], false);
+ EXPECT_EQ(updates_array_idx, 0); // no updates received
+}
+
+TEST_F(EncoderSplitTestLeftEqRight, TestInitRight) {
+ isLeftHand = false;
+ encoder_init();
+ EXPECT_EQ(pinIsInputHigh[0], false);
+ EXPECT_EQ(pinIsInputHigh[1], false);
+ EXPECT_EQ(pinIsInputHigh[2], false);
+ EXPECT_EQ(pinIsInputHigh[3], false);
+ EXPECT_EQ(pinIsInputHigh[4], true);
+ EXPECT_EQ(pinIsInputHigh[5], true);
+ EXPECT_EQ(pinIsInputHigh[6], true);
+ EXPECT_EQ(pinIsInputHigh[7], true);
+ EXPECT_EQ(updates_array_idx, 0); // no updates received
+}
+
+TEST_F(EncoderSplitTestLeftEqRight, TestOneClockwiseLeft) {
+ isLeftHand = true;
+ encoder_init();
+ // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
+ setAndRead(0, false);
+ setAndRead(1, false);
+ setAndRead(0, true);
+ setAndRead(1, true);
+
+ EXPECT_EQ(updates_array_idx, 1); // one update received
+ EXPECT_EQ(updates[0].index, 0);
+ EXPECT_EQ(updates[0].clockwise, true);
+}
+
+TEST_F(EncoderSplitTestLeftEqRight, TestOneClockwiseRightSent) {
+ isLeftHand = false;
+ encoder_init();
+ // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
+ setAndRead(6, false);
+ setAndRead(7, false);
+ setAndRead(6, true);
+ setAndRead(7, true);
+
+ uint8_t slave_state[32] = {0};
+ encoder_state_raw(slave_state);
+
+ EXPECT_EQ(slave_state[0], 0);
+ EXPECT_EQ(slave_state[1], 0xFF);
+}
+
+TEST_F(EncoderSplitTestLeftEqRight, TestMultipleEncodersRightReceived) {
+ isLeftHand = true;
+ encoder_init();
+
+ uint8_t slave_state[32] = {1, 0xFF}; // First right encoder is CCW, Second right encoder CW
+ encoder_update_raw(slave_state);
+
+ EXPECT_EQ(updates_array_idx, 2); // two updates received, one for each changed item on the right side
+ EXPECT_EQ(updates[0].index, 2);
+ EXPECT_EQ(updates[0].clockwise, false);
+ EXPECT_EQ(updates[1].index, 3);
+ EXPECT_EQ(updates[1].clockwise, true);
+}
diff --git a/quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp b/quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp
new file mode 100644
index 0000000000..7b64bb2981
--- /dev/null
+++ b/quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp
@@ -0,0 +1,139 @@
+/* Copyright 2021 Balz Guenat
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "gtest/gtest.h"
+#include "gmock/gmock.h"
+#include <vector>
+#include <algorithm>
+#include <stdio.h>
+
+extern "C" {
+#include "encoder.h"
+#include "encoder/tests/mock_split.h"
+}
+
+struct update {
+ int8_t index;
+ bool clockwise;
+};
+
+uint8_t updates_array_idx = 0;
+update updates[32];
+
+bool isLeftHand;
+
+bool encoder_update_kb(uint8_t index, bool clockwise) {
+ if (!isLeftHand) {
+ // this method has no effect on slave half
+ printf("ignoring update on right hand (%d,%s)\n", index, clockwise ? "CW" : "CC");
+ return true;
+ }
+ updates[updates_array_idx % 32] = {index, clockwise};
+ updates_array_idx++;
+ return true;
+}
+
+bool setAndRead(pin_t pin, bool val) {
+ setPin(pin, val);
+ return encoder_read();
+}
+
+class EncoderSplitTestLeftGreaterThanRight : public ::testing::Test {
+ protected:
+ void SetUp() override {
+ updates_array_idx = 0;
+ for (int i = 0; i < 32; i++) {
+ pinIsInputHigh[i] = 0;
+ pins[i] = 0;
+ }
+ }
+};
+
+TEST_F(EncoderSplitTestLeftGreaterThanRight, TestInitLeft) {
+ isLeftHand = true;
+ encoder_init();
+ EXPECT_EQ(pinIsInputHigh[0], true);
+ EXPECT_EQ(pinIsInputHigh[1], true);
+ EXPECT_EQ(pinIsInputHigh[2], true);
+ EXPECT_EQ(pinIsInputHigh[3], true);
+ EXPECT_EQ(pinIsInputHigh[4], true);
+ EXPECT_EQ(pinIsInputHigh[5], true);
+ EXPECT_EQ(pinIsInputHigh[6], false);
+ EXPECT_EQ(pinIsInputHigh[7], false);
+ EXPECT_EQ(pinIsInputHigh[8], false);
+ EXPECT_EQ(pinIsInputHigh[9], false);
+ EXPECT_EQ(updates_array_idx, 0); // no updates received
+}
+
+TEST_F(EncoderSplitTestLeftGreaterThanRight, TestInitRight) {
+ isLeftHand = false;
+ encoder_init();
+ EXPECT_EQ(pinIsInputHigh[0], false);
+ EXPECT_EQ(pinIsInputHigh[1], false);
+ EXPECT_EQ(pinIsInputHigh[2], false);
+ EXPECT_EQ(pinIsInputHigh[3], false);
+ EXPECT_EQ(pinIsInputHigh[4], false);
+ EXPECT_EQ(pinIsInputHigh[5], false);
+ EXPECT_EQ(pinIsInputHigh[6], true);
+ EXPECT_EQ(pinIsInputHigh[7], true);
+ EXPECT_EQ(pinIsInputHigh[8], true);
+ EXPECT_EQ(pinIsInputHigh[9], true);
+ EXPECT_EQ(updates_array_idx, 0); // no updates received
+}
+
+TEST_F(EncoderSplitTestLeftGreaterThanRight, TestOneClockwiseLeft) {
+ isLeftHand = true;
+ encoder_init();
+ // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
+ setAndRead(0, false);
+ setAndRead(1, false);
+ setAndRead(0, true);
+ setAndRead(1, true);
+
+ EXPECT_EQ(updates_array_idx, 1); // one update received
+ EXPECT_EQ(updates[0].index, 0);
+ EXPECT_EQ(updates[0].clockwise, true);
+}
+
+TEST_F(EncoderSplitTestLeftGreaterThanRight, TestOneClockwiseRightSent) {
+ isLeftHand = false;
+ encoder_init();
+ // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
+ setAndRead(6, false);
+ setAndRead(7, false);
+ setAndRead(6, true);
+ setAndRead(7, true);
+
+ uint8_t slave_state[32] = {0};
+ encoder_state_raw(slave_state);
+
+ EXPECT_EQ(slave_state[0], 0xFF);
+ EXPECT_EQ(slave_state[1], 0);
+}
+
+TEST_F(EncoderSplitTestLeftGreaterThanRight, TestMultipleEncodersRightReceived) {
+ isLeftHand = true;
+ encoder_init();
+
+ uint8_t slave_state[32] = {1, 0xFF}; // First right encoder is CCW, Second right encoder no change, third right encoder CW
+ encoder_update_raw(slave_state);
+
+ EXPECT_EQ(updates_array_idx, 2); // two updates received, one for each changed item on the right side
+ EXPECT_EQ(updates[0].index, 3);
+ EXPECT_EQ(updates[0].clockwise, false);
+ EXPECT_EQ(updates[1].index, 4);
+ EXPECT_EQ(updates[1].clockwise, true);
+}
diff --git a/quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp b/quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp
new file mode 100644
index 0000000000..a6519c5762
--- /dev/null
+++ b/quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp
@@ -0,0 +1,139 @@
+/* Copyright 2021 Balz Guenat
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "gtest/gtest.h"
+#include "gmock/gmock.h"
+#include <vector>
+#include <algorithm>
+#include <stdio.h>
+
+extern "C" {
+#include "encoder.h"
+#include "encoder/tests/mock_split.h"
+}
+
+struct update {
+ int8_t index;
+ bool clockwise;
+};
+
+uint8_t updates_array_idx = 0;
+update updates[32];
+
+bool isLeftHand;
+
+bool encoder_update_kb(uint8_t index, bool clockwise) {
+ if (!isLeftHand) {
+ // this method has no effect on slave half
+ printf("ignoring update on right hand (%d,%s)\n", index, clockwise ? "CW" : "CC");
+ return true;
+ }
+ updates[updates_array_idx % 32] = {index, clockwise};
+ updates_array_idx++;
+ return true;
+}
+
+bool setAndRead(pin_t pin, bool val) {
+ setPin(pin, val);
+ return encoder_read();
+}
+
+class EncoderSplitTestLeftLessThanRight : public ::testing::Test {
+ protected:
+ void SetUp() override {
+ updates_array_idx = 0;
+ for (int i = 0; i < 32; i++) {
+ pinIsInputHigh[i] = 0;
+ pins[i] = 0;
+ }
+ }
+};
+
+TEST_F(EncoderSplitTestLeftLessThanRight, TestInitLeft) {
+ isLeftHand = true;
+ encoder_init();
+ EXPECT_EQ(pinIsInputHigh[0], true);
+ EXPECT_EQ(pinIsInputHigh[1], true);
+ EXPECT_EQ(pinIsInputHigh[2], true);
+ EXPECT_EQ(pinIsInputHigh[3], true);
+ EXPECT_EQ(pinIsInputHigh[4], false);
+ EXPECT_EQ(pinIsInputHigh[5], false);
+ EXPECT_EQ(pinIsInputHigh[6], false);
+ EXPECT_EQ(pinIsInputHigh[7], false);
+ EXPECT_EQ(pinIsInputHigh[8], false);
+ EXPECT_EQ(pinIsInputHigh[9], false);
+ EXPECT_EQ(updates_array_idx, 0); // no updates received
+}
+
+TEST_F(EncoderSplitTestLeftLessThanRight, TestInitRight) {
+ isLeftHand = false;
+ encoder_init();
+ EXPECT_EQ(pinIsInputHigh[0], false);
+ EXPECT_EQ(pinIsInputHigh[1], false);
+ EXPECT_EQ(pinIsInputHigh[2], false);
+ EXPECT_EQ(pinIsInputHigh[3], false);
+ EXPECT_EQ(pinIsInputHigh[4], true);
+ EXPECT_EQ(pinIsInputHigh[5], true);
+ EXPECT_EQ(pinIsInputHigh[6], true);
+ EXPECT_EQ(pinIsInputHigh[7], true);
+ EXPECT_EQ(pinIsInputHigh[8], true);
+ EXPECT_EQ(pinIsInputHigh[9], true);
+ EXPECT_EQ(updates_array_idx, 0); // no updates received
+}
+
+TEST_F(EncoderSplitTestLeftLessThanRight, TestOneClockwiseLeft) {
+ isLeftHand = true;
+ encoder_init();
+ // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
+ setAndRead(0, false);
+ setAndRead(1, false);
+ setAndRead(0, true);
+ setAndRead(1, true);
+
+ EXPECT_EQ(updates_array_idx, 1); // one update received
+ EXPECT_EQ(updates[0].index, 0);
+ EXPECT_EQ(updates[0].clockwise, true);
+}
+
+TEST_F(EncoderSplitTestLeftLessThanRight, TestOneClockwiseRightSent) {
+ isLeftHand = false;
+ encoder_init();
+ // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
+ setAndRead(6, false);
+ setAndRead(7, false);
+ setAndRead(6, true);
+ setAndRead(7, true);
+
+ uint8_t slave_state[32] = {0};
+ encoder_state_raw(slave_state);
+
+ EXPECT_EQ(slave_state[0], 0);
+ EXPECT_EQ(slave_state[1], 0xFF);
+}
+
+TEST_F(EncoderSplitTestLeftLessThanRight, TestMultipleEncodersRightReceived) {
+ isLeftHand = true;
+ encoder_init();
+
+ uint8_t slave_state[32] = {1, 0, 0xFF}; // First right encoder is CCW, Second right encoder no change, third right encoder CW
+ encoder_update_raw(slave_state);
+
+ EXPECT_EQ(updates_array_idx, 2); // two updates received, one for each changed item on the right side
+ EXPECT_EQ(updates[0].index, 2);
+ EXPECT_EQ(updates[0].clockwise, false);
+ EXPECT_EQ(updates[1].index, 4);
+ EXPECT_EQ(updates[1].clockwise, true);
+}
diff --git a/quantum/encoder/tests/encoder_tests_split.cpp b/quantum/encoder/tests/encoder_tests_split_no_left.cpp
index 25e52c83f9..b6b2d7e2d1 100644
--- a/quantum/encoder/tests/encoder_tests_split.cpp
+++ b/quantum/encoder/tests/encoder_tests_split_no_left.cpp
@@ -30,7 +30,7 @@ struct update {
bool clockwise;
};
-uint8_t uidx = 0;
+uint8_t updates_array_idx = 0;
update updates[32];
bool isLeftHand;
@@ -41,8 +41,8 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
printf("ignoring update on right hand (%d,%s)\n", index, clockwise ? "CW" : "CC");
return true;
}
- updates[uidx % 32] = {index, clockwise};
- uidx++;
+ updates[updates_array_idx % 32] = {index, clockwise};
+ updates_array_idx++;
return true;
}
@@ -51,10 +51,10 @@ bool setAndRead(pin_t pin, bool val) {
return encoder_read();
}
-class EncoderTest : public ::testing::Test {
+class EncoderSplitTestNoLeft : public ::testing::Test {
protected:
void SetUp() override {
- uidx = 0;
+ updates_array_idx = 0;
for (int i = 0; i < 32; i++) {
pinIsInputHigh[i] = 0;
pins[i] = 0;
@@ -62,27 +62,27 @@ class EncoderTest : public ::testing::Test {
}
};
-TEST_F(EncoderTest, TestInitLeft) {
+TEST_F(EncoderSplitTestNoLeft, TestInitLeft) {
isLeftHand = true;
encoder_init();
- EXPECT_EQ(pinIsInputHigh[0], true);
- EXPECT_EQ(pinIsInputHigh[1], true);
+ EXPECT_EQ(pinIsInputHigh[0], false);
+ EXPECT_EQ(pinIsInputHigh[1], false);
EXPECT_EQ(pinIsInputHigh[2], false);
EXPECT_EQ(pinIsInputHigh[3], false);
- EXPECT_EQ(uidx, 0);
+ EXPECT_EQ(updates_array_idx, 0); // no updates received
}
-TEST_F(EncoderTest, TestInitRight) {
+TEST_F(EncoderSplitTestNoLeft, TestInitRight) {
isLeftHand = false;
encoder_init();
- EXPECT_EQ(pinIsInputHigh[0], false);
- EXPECT_EQ(pinIsInputHigh[1], false);
+ EXPECT_EQ(pinIsInputHigh[0], true);
+ EXPECT_EQ(pinIsInputHigh[1], true);
EXPECT_EQ(pinIsInputHigh[2], true);
EXPECT_EQ(pinIsInputHigh[3], true);
- EXPECT_EQ(uidx, 0);
+ EXPECT_EQ(updates_array_idx, 0); // no updates received
}
-TEST_F(EncoderTest, TestOneClockwiseLeft) {
+TEST_F(EncoderSplitTestNoLeft, TestOneClockwiseLeft) {
isLeftHand = true;
encoder_init();
// send 4 pulses. with resolution 4, that's one step and we should get 1 update.
@@ -91,12 +91,10 @@ TEST_F(EncoderTest, TestOneClockwiseLeft) {
setAndRead(0, true);
setAndRead(1, true);
- EXPECT_EQ(uidx, 1);
- EXPECT_EQ(updates[0].index, 0);
- EXPECT_EQ(updates[0].clockwise, true);
+ EXPECT_EQ(updates_array_idx, 0); // no updates received
}
-TEST_F(EncoderTest, TestOneClockwiseRightSent) {
+TEST_F(EncoderSplitTestNoLeft, TestOneClockwiseRightSent) {
isLeftHand = false;
encoder_init();
// send 4 pulses. with resolution 4, that's one step and we should get 1 update.
@@ -105,39 +103,23 @@ TEST_F(EncoderTest, TestOneClockwiseRightSent) {
setAndRead(2, true);
setAndRead(3, true);
- uint8_t slave_state[2] = {0};
+ uint8_t slave_state[32] = {0};
encoder_state_raw(slave_state);
- EXPECT_EQ((int8_t)slave_state[0], -1);
+ EXPECT_EQ(slave_state[0], 0);
+ EXPECT_EQ(slave_state[1], 0xFF);
}
-/* this test will not work after the previous test.
- * this is due to encoder_value[1] already being set to -1 when simulating the right half.
- * When we now receive this update acting as the left half, there is no change.
- * This is hard to mock, as the static values inside encoder.c normally exist twice, once on each half,
- * but here, they only exist once.
- */
-
-// TEST_F(EncoderTest, TestOneClockwiseRightReceived) {
-// isLeftHand = true;
-// encoder_init();
-
-// uint8_t slave_state[2] = {255, 0};
-// encoder_update_raw(slave_state);
-
-// EXPECT_EQ(uidx, 1);
-// EXPECT_EQ(updates[0].index, 1);
-// EXPECT_EQ(updates[0].clockwise, true);
-// }
-
-TEST_F(EncoderTest, TestOneCounterClockwiseRightReceived) {
+TEST_F(EncoderSplitTestNoLeft, TestMultipleEncodersRightReceived) {
isLeftHand = true;
encoder_init();
- uint8_t slave_state[2] = {0, 0};
+ uint8_t slave_state[32] = {1, 0xFF}; // First right encoder is CCW, Second right encoder no change, third right encoder CW
encoder_update_raw(slave_state);
- EXPECT_EQ(uidx, 1);
- EXPECT_EQ(updates[0].index, 1);
+ EXPECT_EQ(updates_array_idx, 2); // two updates received, one for each changed item on the right side
+ EXPECT_EQ(updates[0].index, 0);
EXPECT_EQ(updates[0].clockwise, false);
+ EXPECT_EQ(updates[1].index, 1);
+ EXPECT_EQ(updates[1].clockwise, true);
}
diff --git a/quantum/encoder/tests/encoder_tests_split_no_right.cpp b/quantum/encoder/tests/encoder_tests_split_no_right.cpp
new file mode 100644
index 0000000000..fa0a7c18a8
--- /dev/null
+++ b/quantum/encoder/tests/encoder_tests_split_no_right.cpp
@@ -0,0 +1,118 @@
+/* Copyright 2021 Balz Guenat
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "gtest/gtest.h"
+#include "gmock/gmock.h"
+#include <vector>
+#include <algorithm>
+#include <stdio.h>
+
+extern "C" {
+#include "encoder.h"
+#include "encoder/tests/mock_split.h"
+}
+
+struct update {
+ int8_t index;
+ bool clockwise;
+};
+
+uint8_t updates_array_idx = 0;
+update updates[32];
+
+bool isLeftHand;
+
+bool encoder_update_kb(uint8_t index, bool clockwise) {
+ if (!isLeftHand) {
+ // this method has no effect on slave half
+ printf("ignoring update on right hand (%d,%s)\n", index, clockwise ? "CW" : "CC");
+ return true;
+ }
+ updates[updates_array_idx % 32] = {index, clockwise};
+ updates_array_idx++;
+ return true;
+}
+
+bool setAndRead(pin_t pin, bool val) {
+ setPin(pin, val);
+ return encoder_read();
+}
+
+class EncoderSplitTestNoRight : public ::testing::Test {
+ protected:
+ void SetUp() override {
+ updates_array_idx = 0;
+ for (int i = 0; i < 32; i++) {
+ pinIsInputHigh[i] = 0;
+ pins[i] = 0;
+ }
+ }
+};
+
+TEST_F(EncoderSplitTestNoRight, TestInitLeft) {
+ isLeftHand = true;
+ encoder_init();
+ EXPECT_EQ(pinIsInputHigh[0], true);
+ EXPECT_EQ(pinIsInputHigh[1], true);
+ EXPECT_EQ(pinIsInputHigh[2], true);
+ EXPECT_EQ(pinIsInputHigh[3], true);
+ EXPECT_EQ(updates_array_idx, 0); // no updates received
+}
+
+TEST_F(EncoderSplitTestNoRight, TestInitRight) {
+ isLeftHand = false;
+ encoder_init();
+ EXPECT_EQ(pinIsInputHigh[0], false);
+ EXPECT_EQ(pinIsInputHigh[1], false);
+ EXPECT_EQ(pinIsInputHigh[2], false);
+ EXPECT_EQ(pinIsInputHigh[3], false);
+ EXPECT_EQ(updates_array_idx, 0); // no updates received
+}
+
+TEST_F(EncoderSplitTestNoRight, TestOneClockwiseLeft) {
+ isLeftHand = true;
+ encoder_init();
+ // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
+ setAndRead(0, false);
+ setAndRead(1, false);
+ setAndRead(0, true);
+ setAndRead(1, true);
+
+ EXPECT_EQ(updates_array_idx, 1); // one updates received
+ EXPECT_EQ(updates[0].index, 0);
+ EXPECT_EQ(updates[0].clockwise, true);
+}
+
+TEST_F(EncoderSplitTestNoRight, TestOneClockwiseRightSent) {
+ isLeftHand = false;
+ encoder_init();
+
+ uint8_t slave_state[32] = {0xAA, 0xAA};
+ encoder_state_raw(slave_state);
+
+ EXPECT_EQ(slave_state[0], 0xAA);
+ EXPECT_EQ(slave_state[1], 0xAA);
+}
+
+TEST_F(EncoderSplitTestNoRight, TestMultipleEncodersRightReceived) {
+ isLeftHand = true;
+ encoder_init();
+
+ uint8_t slave_state[32] = {1, 0xFF}; // These values would trigger updates if there were encoders on the other side
+ encoder_update_raw(slave_state);
+
+ EXPECT_EQ(updates_array_idx, 0); // no updates received -- no right-hand encoders
+}
diff --git a/quantum/encoder/tests/mock.h b/quantum/encoder/tests/mock.h
index dbc25a0846..80c336b5ef 100644
--- a/quantum/encoder/tests/mock.h
+++ b/quantum/encoder/tests/mock.h
@@ -19,12 +19,6 @@
#include <stdint.h>
#include <stdbool.h>
-/* Here, "pins" from 0 to 31 are allowed. */
-#define ENCODERS_PAD_A \
- { 0 }
-#define ENCODERS_PAD_B \
- { 1 }
-
typedef uint8_t pin_t;
extern bool pins[];
diff --git a/quantum/encoder/tests/mock_split.h b/quantum/encoder/tests/mock_split.h
index 0ae62652f9..2fc12f1830 100644
--- a/quantum/encoder/tests/mock_split.h
+++ b/quantum/encoder/tests/mock_split.h
@@ -20,20 +20,10 @@
#include <stdbool.h>
#define SPLIT_KEYBOARD
-/* Here, "pins" from 0 to 31 are allowed. */
-#define ENCODERS_PAD_A \
- { 0 }
-#define ENCODERS_PAD_B \
- { 1 }
-#define ENCODERS_PAD_A_RIGHT \
- { 2 }
-#define ENCODERS_PAD_B_RIGHT \
- { 3 }
-
typedef uint8_t pin_t;
-extern bool isLeftHand;
-void encoder_state_raw(uint8_t* slave_state);
-void encoder_update_raw(uint8_t* slave_state);
+
+void encoder_state_raw(uint8_t* slave_state);
+void encoder_update_raw(uint8_t* slave_state);
extern bool pins[];
extern bool pinIsInputHigh[];
diff --git a/quantum/encoder/tests/rules.mk b/quantum/encoder/tests/rules.mk
index b826ce3aed..6a2611952c 100644
--- a/quantum/encoder/tests/rules.mk
+++ b/quantum/encoder/tests/rules.mk
@@ -1,13 +1,58 @@
-encoder_DEFS := -DENCODER_MOCK_SINGLE
+encoder_DEFS := -DENCODER_TESTS -DENCODER_ENABLE -DENCODER_MOCK_SINGLE
+encoder_CONFIG := $(QUANTUM_PATH)/encoder/tests/config_mock.h
encoder_SRC := \
+ platforms/test/timer.c \
$(QUANTUM_PATH)/encoder/tests/mock.c \
$(QUANTUM_PATH)/encoder/tests/encoder_tests.cpp \
$(QUANTUM_PATH)/encoder.c
-encoder_split_DEFS := -DENCODER_MOCK_SPLIT
+encoder_split_left_eq_right_DEFS := -DENCODER_TESTS -DENCODER_ENABLE -DENCODER_MOCK_SPLIT
+encoder_split_left_eq_right_INC := $(QUANTUM_PATH)/split_common
+encoder_split_left_eq_right_CONFIG := $(QUANTUM_PATH)/encoder/tests/config_mock_split_left_eq_right.h
-encoder_split_SRC := \
+encoder_split_left_eq_right_SRC := \
+ platforms/test/timer.c \
$(QUANTUM_PATH)/encoder/tests/mock_split.c \
- $(QUANTUM_PATH)/encoder/tests/encoder_tests_split.cpp \
+ $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_left_eq_right.cpp \
+ $(QUANTUM_PATH)/encoder.c
+
+encoder_split_left_gt_right_DEFS := -DENCODER_TESTS -DENCODER_ENABLE -DENCODER_MOCK_SPLIT
+encoder_split_left_gt_right_INC := $(QUANTUM_PATH)/split_common
+encoder_split_left_gt_right_CONFIG := $(QUANTUM_PATH)/encoder/tests/config_mock_split_left_gt_right.h
+
+encoder_split_left_gt_right_SRC := \
+ platforms/test/timer.c \
+ $(QUANTUM_PATH)/encoder/tests/mock_split.c \
+ $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_left_gt_right.cpp \
+ $(QUANTUM_PATH)/encoder.c
+
+encoder_split_left_lt_right_DEFS := -DENCODER_TESTS -DENCODER_ENABLE -DENCODER_MOCK_SPLIT
+encoder_split_left_lt_right_INC := $(QUANTUM_PATH)/split_common
+encoder_split_left_lt_right_CONFIG := $(QUANTUM_PATH)/encoder/tests/config_mock_split_left_lt_right.h
+
+encoder_split_left_lt_right_SRC := \
+ platforms/test/timer.c \
+ $(QUANTUM_PATH)/encoder/tests/mock_split.c \
+ $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_left_lt_right.cpp \
+ $(QUANTUM_PATH)/encoder.c
+
+encoder_split_no_left_DEFS := -DENCODER_TESTS -DENCODER_ENABLE -DENCODER_MOCK_SPLIT
+encoder_split_no_left_INC := $(QUANTUM_PATH)/split_common
+encoder_split_no_left_CONFIG := $(QUANTUM_PATH)/encoder/tests/config_mock_split_no_left.h
+
+encoder_split_no_left_SRC := \
+ platforms/test/timer.c \
+ $(QUANTUM_PATH)/encoder/tests/mock_split.c \
+ $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_no_left.cpp \
+ $(QUANTUM_PATH)/encoder.c
+
+encoder_split_no_right_DEFS := -DENCODER_TESTS -DENCODER_ENABLE -DENCODER_MOCK_SPLIT
+encoder_split_no_right_INC := $(QUANTUM_PATH)/split_common
+encoder_split_no_right_CONFIG := $(QUANTUM_PATH)/encoder/tests/config_mock_split_no_right.h
+
+encoder_split_no_right_SRC := \
+ platforms/test/timer.c \
+ $(QUANTUM_PATH)/encoder/tests/mock_split.c \
+ $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_no_right.cpp \
$(QUANTUM_PATH)/encoder.c
diff --git a/quantum/encoder/tests/testlist.mk b/quantum/encoder/tests/testlist.mk
index 1be9f4a054..6b2fd84d96 100644
--- a/quantum/encoder/tests/testlist.mk
+++ b/quantum/encoder/tests/testlist.mk
@@ -1,3 +1,7 @@
TEST_LIST += \
encoder \
- encoder_split
+ encoder_split_left_eq_right \
+ encoder_split_left_gt_right \
+ encoder_split_left_lt_right \
+ encoder_split_no_left \
+ encoder_split_no_right
diff --git a/quantum/joystick.c b/quantum/joystick.c
index 7b87201aef..86b2c64036 100644
--- a/quantum/joystick.c
+++ b/quantum/joystick.c
@@ -1,13 +1,38 @@
#include "joystick.h"
-joystick_t joystick_status = {.buttons = {0},
- .axes =
- {
+// clang-format off
+joystick_t joystick_status = {
+ .buttons = {0},
+ .axes = {
#if JOYSTICK_AXES_COUNT > 0
- 0
+ 0
#endif
- },
- .status = 0};
+ },
+ .status = 0
+};
+// clang-format on
// array defining the reading of analog values for each axis
__attribute__((weak)) joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT] = {};
+
+// to be implemented in the hid protocol library
+void send_joystick_packet(joystick_t *joystick);
+
+void joystick_flush(void) {
+ if ((joystick_status.status & JS_UPDATED) > 0) {
+ send_joystick_packet(&joystick_status);
+ joystick_status.status &= ~JS_UPDATED;
+ }
+}
+
+void register_joystick_button(uint8_t button) {
+ joystick_status.buttons[button / 8] |= 1 << (button % 8);
+ joystick_status.status |= JS_UPDATED;
+ joystick_flush();
+}
+
+void unregister_joystick_button(uint8_t button) {
+ joystick_status.buttons[button / 8] &= ~(1 << (button % 8));
+ joystick_status.status |= JS_UPDATED;
+ joystick_flush();
+}
diff --git a/quantum/joystick.h b/quantum/joystick.h
index 9156491aca..5d81b14ef2 100644
--- a/quantum/joystick.h
+++ b/quantum/joystick.h
@@ -1,15 +1,22 @@
#pragma once
-#include "quantum.h"
-
#include <stdint.h>
+#include "gpio.h"
#ifndef JOYSTICK_BUTTON_COUNT
# define JOYSTICK_BUTTON_COUNT 8
+#elif JOYSTICK_BUTTON_COUNT > 32
+# error Joystick feature only supports up to 32 buttons
#endif
#ifndef JOYSTICK_AXES_COUNT
# define JOYSTICK_AXES_COUNT 4
+#elif JOYSTICK_AXES_COUNT > 6
+# error Joystick feature only supports up to 6 axes
+#endif
+
+#if JOYSTICK_AXES_COUNT == 0 && JOYSTICK_BUTTON_COUNT == 0
+# error Joystick feature requires at least one axis or button
#endif
#ifndef JOYSTICK_AXES_RESOLUTION
@@ -58,5 +65,7 @@ typedef struct {
extern joystick_t joystick_status;
-// to be implemented in the hid protocol library
-void send_joystick_packet(joystick_t *joystick);
+void joystick_flush(void);
+
+void register_joystick_button(uint8_t button);
+void unregister_joystick_button(uint8_t button);
diff --git a/quantum/keyboard.c b/quantum/keyboard.c
index ce4f06ae69..a65f9d6d18 100644
--- a/quantum/keyboard.c
+++ b/quantum/keyboard.c
@@ -108,6 +108,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef BLUETOOTH_ENABLE
# include "outputselect.h"
#endif
+#ifdef CAPS_WORD_ENABLE
+# include "caps_word.h"
+#endif
static uint32_t last_input_modification_time = 0;
uint32_t last_input_activity_time(void) {
@@ -211,17 +214,6 @@ static inline bool has_ghost_in_row(uint8_t row, matrix_row_t rowdata) {
#endif
-void disable_jtag(void) {
-// To use PF4-7 (PC2-5 on ATmega32A), disable JTAG by writing JTD bit twice within four cycles.
-#if (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
- MCUCR |= _BV(JTD);
- MCUCR |= _BV(JTD);
-#elif defined(__AVR_ATmega32A__)
- MCUCSR |= _BV(JTD);
- MCUCSR |= _BV(JTD);
-#endif
-}
-
/** \brief matrix_setup
*
* FIXME: needs doc
@@ -263,9 +255,6 @@ __attribute__((weak)) void keyboard_post_init_kb(void) {
* FIXME: needs doc
*/
void keyboard_setup(void) {
-#ifndef NO_JTAG_DISABLE
- disable_jtag();
-#endif
print_set_sendchar(sendchar);
#ifdef EEPROM_DRIVER
eeprom_driver_init();
@@ -489,7 +478,7 @@ bool matrix_scan_task(void) {
// we can get here with some keys processed now.
if (!keys_processed)
#endif
- action_exec(TICK);
+ action_exec(TICK_EVENT);
MATRIX_LOOP_END:
@@ -562,6 +551,14 @@ void quantum_task(void) {
#ifdef AUTO_SHIFT_ENABLE
autoshift_matrix_scan();
#endif
+
+#ifdef CAPS_WORD_ENABLE
+ caps_word_task();
+#endif
+
+#ifdef SECURE_ENABLE
+ secure_task();
+#endif
}
/** \brief Keyboard task: Do keyboard routine jobs
diff --git a/quantum/keyboard.h b/quantum/keyboard.h
index e122b38264..fe0736a515 100644
--- a/quantum/keyboard.h
+++ b/quantum/keyboard.h
@@ -40,25 +40,47 @@ typedef struct {
/* equivalent test of keypos_t */
#define KEYEQ(keya, keyb) ((keya).row == (keyb).row && (keya).col == (keyb).col)
+/* special keypos_t entries */
+#define KEYLOC_TICK 255
+#define KEYLOC_COMBO 254
+#define KEYLOC_ENCODER_CW 253
+#define KEYLOC_ENCODER_CCW 252
+
/* Rules for No Event:
* 1) (time == 0) to handle (keyevent_t){} as empty event
* 2) Matrix(255, 255) to make TICK event available
*/
static inline bool IS_NOEVENT(keyevent_t event) {
- return event.time == 0 || (event.key.row == 255 && event.key.col == 255);
+ return event.time == 0 || (event.key.row == KEYLOC_TICK && event.key.col == KEYLOC_TICK);
+}
+static inline bool IS_KEYEVENT(keyevent_t event) {
+ return event.key.row < MATRIX_ROWS && event.key.col < MATRIX_COLS;
+}
+static inline bool IS_COMBOEVENT(keyevent_t event) {
+ return event.key.row == KEYLOC_COMBO;
+}
+static inline bool IS_ENCODEREVENT(keyevent_t event) {
+ return event.key.row == KEYLOC_ENCODER_CW || event.key.row == KEYLOC_ENCODER_CCW;
}
static inline bool IS_PRESSED(keyevent_t event) {
- return (!IS_NOEVENT(event) && event.pressed);
+ return !IS_NOEVENT(event) && event.pressed;
}
static inline bool IS_RELEASED(keyevent_t event) {
- return (!IS_NOEVENT(event) && !event.pressed);
+ return !IS_NOEVENT(event) && !event.pressed;
}
+/* Common keyevent object factory */
+#define MAKE_KEYPOS(row_num, col_num) ((keypos_t){.row = (row_num), .col = (col_num)})
+#define MAKE_KEYEVENT(row_num, col_num, press) ((keyevent_t){.key = MAKE_KEYPOS((row_num), (col_num)), .pressed = (press), .time = (timer_read() | 1)})
+
/* Tick event */
-#define TICK \
- (keyevent_t) { \
- .key = (keypos_t){.row = 255, .col = 255}, .pressed = false, .time = (timer_read() | 1) \
- }
+#define TICK_EVENT MAKE_KEYEVENT(KEYLOC_TICK, KEYLOC_TICK, false)
+
+#ifdef ENCODER_MAP_ENABLE
+/* Encoder events */
+# define ENCODER_CW_EVENT(enc_id, press) MAKE_KEYEVENT(KEYLOC_ENCODER_CW, (enc_id), (press))
+# define ENCODER_CCW_EVENT(enc_id, press) MAKE_KEYEVENT(KEYLOC_ENCODER_CCW, (enc_id), (press))
+#endif // ENCODER_MAP_ENABLE
/* it runs once at early stage of startup before keyboard_init. */
void keyboard_setup(void);
diff --git a/quantum/keycode_config.h b/quantum/keycode_config.h
index d7e334fdc8..a2cb025ed2 100644
--- a/quantum/keycode_config.h
+++ b/quantum/keycode_config.h
@@ -37,7 +37,7 @@ typedef union {
bool nkro : 1;
bool swap_lctl_lgui : 1;
bool swap_rctl_rgui : 1;
- bool oneshot_disable : 1;
+ bool oneshot_enable : 1;
};
} keymap_config_t;
diff --git a/quantum/keymap.h b/quantum/keymap.h
index 2ee2e1b576..d64b271efb 100644
--- a/quantum/keymap.h
+++ b/quantum/keymap.h
@@ -32,6 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #include "print.h"
#include "debug.h"
#include "keycode_config.h"
+#include "gpio.h" // for pin_t
// ChibiOS uses RESET in its FlagStatus enumeration
// Therefore define it as QK_BOOTLOADER here, to avoid name collision
@@ -49,3 +50,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+
+#ifdef ENCODER_MAP_ENABLE
+// Ensure we have a forward declaration for the encoder map
+# include "encoder.h"
+#endif
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index a91b2a0b36..c1940f0fd3 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -148,6 +148,15 @@ action_t action_for_keycode(uint16_t keycode) {
// translates key to keycode
__attribute__((weak)) uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) {
- // Read entire word (16bits)
- return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]);
+ if (key.row < MATRIX_ROWS && key.col < MATRIX_COLS) {
+ return pgm_read_word(&keymaps[layer][key.row][key.col]);
+ }
+#ifdef ENCODER_MAP_ENABLE
+ else if (key.row == KEYLOC_ENCODER_CW && key.col < NUM_ENCODERS) {
+ return pgm_read_word(&encoder_map[layer][key.col][0]);
+ } else if (key.row == KEYLOC_ENCODER_CCW && key.col < NUM_ENCODERS) {
+ return pgm_read_word(&encoder_map[layer][key.col][1]);
+ }
+#endif // ENCODER_MAP_ENABLE
+ return KC_NO;
}
diff --git a/quantum/main.c b/quantum/main.c
index faba668056..2d5911b708 100644
--- a/quantum/main.c
+++ b/quantum/main.c
@@ -43,10 +43,6 @@ void protocol_task(void) {
protocol_post_task();
}
-#ifdef DEFERRED_EXEC_ENABLE
-void deferred_exec_task(void);
-#endif // DEFERRED_EXEC_ENABLE
-
/** \brief Main
*
* FIXME: Needs doc
@@ -63,8 +59,15 @@ int main(void) {
while (true) {
protocol_task();
+#ifdef QUANTUM_PAINTER_ENABLE
+ // Run Quantum Painter animations
+ void qp_internal_animation_tick(void);
+ qp_internal_animation_tick();
+#endif
+
#ifdef DEFERRED_EXEC_ENABLE
// Run deferred executions
+ void deferred_exec_task(void);
deferred_exec_task();
#endif // DEFERRED_EXEC_ENABLE
diff --git a/quantum/mousekey.c b/quantum/mousekey.c
index 8bafbf977a..64d0e66682 100644
--- a/quantum/mousekey.c
+++ b/quantum/mousekey.c
@@ -16,6 +16,7 @@
*/
#include <stdint.h>
+#include <string.h>
#include "keycode.h"
#include "host.h"
#include "timer.h"
@@ -209,7 +210,7 @@ static uint8_t wheel_unit(void) {
void mousekey_task(void) {
// report cursor and scroll movement independently
- report_mouse_t const tmpmr = mouse_report;
+ report_mouse_t tmpmr = mouse_report;
mouse_report.x = 0;
mouse_report.y = 0;
@@ -251,8 +252,10 @@ void mousekey_task(void) {
}
}
- if (mouse_report.x || mouse_report.y || mouse_report.v || mouse_report.h) mousekey_send();
- mouse_report = tmpmr;
+ if (has_mouse_report_changed(&mouse_report, &tmpmr)) {
+ mousekey_send();
+ }
+ memcpy(&mouse_report, &tmpmr, sizeof(tmpmr));
}
void mousekey_on(uint8_t code) {
@@ -340,11 +343,11 @@ uint16_t w_intervals[mkspd_COUNT] = {MK_W_INTERVAL_UNMOD, MK_W_INTERVAL_0
void mousekey_task(void) {
// report cursor and scroll movement independently
- report_mouse_t const tmpmr = mouse_report;
- mouse_report.x = 0;
- mouse_report.y = 0;
- mouse_report.v = 0;
- mouse_report.h = 0;
+ report_mouse_t tmpmr = mouse_report;
+ mouse_report.x = 0;
+ mouse_report.y = 0;
+ mouse_report.v = 0;
+ mouse_report.h = 0;
if ((tmpmr.x || tmpmr.y) && timer_elapsed(last_timer_c) > c_intervals[mk_speed]) {
mouse_report.x = tmpmr.x;
@@ -355,8 +358,10 @@ void mousekey_task(void) {
mouse_report.h = tmpmr.h;
}
- if (mouse_report.x || mouse_report.y || mouse_report.v || mouse_report.h) mousekey_send();
- mouse_report = tmpmr;
+ if (has_mouse_report_changed(&mouse_report, &tmpmr)) {
+ mousekey_send();
+ }
+ memcpy(&mouse_report, &tmpmr, sizeof(tmpmr));
}
void adjust_speed(void) {
diff --git a/quantum/painter/qff.c b/quantum/painter/qff.c
new file mode 100644
index 0000000000..cd6af788f9
--- /dev/null
+++ b/quantum/painter/qff.c
@@ -0,0 +1,137 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+// Quantum Font File "QFF" File Format.
+// See https://docs.qmk.fm/#/quantum_painter_qff for more information.
+
+#include "qff.h"
+#include "qp_draw.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// QFF API
+
+bool qff_read_font_descriptor(qp_stream_t *stream, uint8_t *line_height, bool *has_ascii_table, uint16_t *num_unicode_glyphs, uint8_t *bpp, bool *has_palette, painter_compression_t *compression_scheme, uint32_t *total_bytes) {
+ // Seek to the start
+ qp_stream_setpos(stream, 0);
+
+ // Read and validate the font descriptor
+ qff_font_descriptor_v1_t font_descriptor;
+ if (qp_stream_read(&font_descriptor, sizeof(qff_font_descriptor_v1_t), 1, stream) != 1) {
+ qp_dprintf("Failed to read font_descriptor, expected length was not %d\n", (int)sizeof(qff_font_descriptor_v1_t));
+ return false;
+ }
+
+ // Make sure this block is valid
+ if (!qgf_validate_block_header(&font_descriptor.header, QFF_FONT_DESCRIPTOR_TYPEID, (sizeof(qff_font_descriptor_v1_t) - sizeof(qgf_block_header_v1_t)))) {
+ return false;
+ }
+
+ // Make sure the magic and version are correct
+ if (font_descriptor.magic != QFF_MAGIC || font_descriptor.qff_version != 0x01) {
+ qp_dprintf("Failed to validate font_descriptor, expected magic 0x%06X was 0x%06X, expected version = 0x%02X was 0x%02X\n", (int)QFF_MAGIC, (int)font_descriptor.magic, (int)0x01, (int)font_descriptor.qff_version);
+ return false;
+ }
+
+ // Make sure the file length is valid
+ if (font_descriptor.neg_total_file_size != ~font_descriptor.total_file_size) {
+ qp_dprintf("Failed to validate font_descriptor, expected negated length 0x%08X was 0x%08X\n", (int)(~font_descriptor.total_file_size), (int)font_descriptor.neg_total_file_size);
+ return false;
+ }
+
+ // Copy out the required info
+ if (line_height) {
+ *line_height = font_descriptor.line_height;
+ }
+ if (has_ascii_table) {
+ *has_ascii_table = font_descriptor.has_ascii_table;
+ }
+ if (num_unicode_glyphs) {
+ *num_unicode_glyphs = font_descriptor.num_unicode_glyphs;
+ }
+ if (bpp || has_palette) {
+ if (!qgf_parse_format(font_descriptor.format, bpp, has_palette)) {
+ return false;
+ }
+ }
+ if (compression_scheme) {
+ *compression_scheme = font_descriptor.compression_scheme;
+ }
+ if (total_bytes) {
+ *total_bytes = font_descriptor.total_file_size;
+ }
+
+ return true;
+}
+
+static bool qff_validate_ascii_descriptor(qp_stream_t *stream) {
+ // Read the raw descriptor
+ qff_ascii_glyph_table_v1_t ascii_descriptor;
+ if (qp_stream_read(&ascii_descriptor, sizeof(qff_ascii_glyph_table_v1_t), 1, stream) != 1) {
+ qp_dprintf("Failed to read ascii_descriptor, expected length was not %d\n", (int)sizeof(qff_ascii_glyph_table_v1_t));
+ return false;
+ }
+
+ // Make sure this block is valid
+ if (!qgf_validate_block_header(&ascii_descriptor.header, QFF_ASCII_GLYPH_DESCRIPTOR_TYPEID, (sizeof(qff_ascii_glyph_table_v1_t) - sizeof(qgf_block_header_v1_t)))) {
+ return false;
+ }
+
+ return true;
+}
+
+static bool qff_validate_unicode_descriptor(qp_stream_t *stream, uint16_t num_unicode_glyphs) {
+ // Read the raw descriptor
+ qff_unicode_glyph_table_v1_t unicode_descriptor;
+ if (qp_stream_read(&unicode_descriptor, sizeof(qff_unicode_glyph_table_v1_t), 1, stream) != 1) {
+ qp_dprintf("Failed to read unicode_descriptor, expected length was not %d\n", (int)sizeof(qff_unicode_glyph_table_v1_t));
+ return false;
+ }
+
+ // Make sure this block is valid
+ if (!qgf_validate_block_header(&unicode_descriptor.header, QFF_UNICODE_GLYPH_DESCRIPTOR_TYPEID, num_unicode_glyphs * 6)) {
+ return false;
+ }
+
+ // Skip the necessary amount of data to get to the next block
+ qp_stream_seek(stream, num_unicode_glyphs * sizeof(qff_unicode_glyph_v1_t), SEEK_CUR);
+
+ return true;
+}
+
+bool qff_validate_stream(qp_stream_t *stream) {
+ bool has_ascii_table;
+ uint16_t num_unicode_glyphs;
+
+ if (!qff_read_font_descriptor(stream, NULL, &has_ascii_table, &num_unicode_glyphs, NULL, NULL, NULL, NULL)) {
+ return false;
+ }
+
+ if (has_ascii_table) {
+ if (!qff_validate_ascii_descriptor(stream)) {
+ return false;
+ }
+ }
+
+ if (num_unicode_glyphs > 0) {
+ if (!qff_validate_unicode_descriptor(stream, num_unicode_glyphs)) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+uint32_t qff_get_total_size(qp_stream_t *stream) {
+ // Get the original location
+ uint32_t oldpos = qp_stream_tell(stream);
+
+ // Read the font descriptor, grabbing the size
+ uint32_t total_size;
+ if (!qff_read_font_descriptor(stream, NULL, NULL, NULL, NULL, NULL, NULL, &total_size)) {
+ return false;
+ }
+
+ // Restore the original location
+ qp_stream_setpos(stream, oldpos);
+ return total_size;
+}
diff --git a/quantum/painter/qff.h b/quantum/painter/qff.h
new file mode 100644
index 0000000000..6f1a1fd815
--- /dev/null
+++ b/quantum/painter/qff.h
@@ -0,0 +1,88 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+// Quantum Font File "QFF" File Format.
+// See https://docs.qmk.fm/#/quantum_painter_qff for more information.
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "qp_stream.h"
+#include "qp_internal.h"
+#include "qgf.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// QFF structures
+
+/////////////////////////////////////////
+// Font descriptor
+
+#define QFF_FONT_DESCRIPTOR_TYPEID 0x00
+
+typedef struct __attribute__((packed)) qff_font_descriptor_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x00, .neg_type_id = (~0x00), .length = 20 }
+ uint32_t magic : 24; // constant, equal to 0x464651 ("QFF")
+ uint8_t qff_version; // constant, equal to 0x01
+ uint32_t total_file_size; // total size of the entire file, starting at offset zero
+ uint32_t neg_total_file_size; // negated value of total_file_size, used for detecting parsing errors
+ uint8_t line_height; // glyph height in pixels
+ bool has_ascii_table; // whether the font has an ascii table of glyphs (0x20...0x7E)
+ uint16_t num_unicode_glyphs; // the number of glyphs in the unicode table -- no table specified if zero
+ qp_image_format_t format : 8; // Frame format, see qp.h.
+ uint8_t flags; // frame flags, see below.
+ uint8_t compression_scheme; // compression scheme, see below.
+ uint8_t transparency_index; // palette index used for transparent pixels (not yet implemented)
+} qff_font_descriptor_v1_t;
+
+_Static_assert(sizeof(qff_font_descriptor_v1_t) == (sizeof(qgf_block_header_v1_t) + 20), "qff_font_descriptor_v1_t must be 25 bytes in v1 of QFF");
+
+#define QFF_MAGIC 0x464651
+
+/////////////////////////////////////////
+// ASCII glyph table descriptor
+
+#define QFF_ASCII_GLYPH_DESCRIPTOR_TYPEID 0x01
+
+#define QFF_GLYPH_WIDTH_BITS 6
+#define QFF_GLYPH_WIDTH_MASK ((1 << QFF_GLYPH_WIDTH_BITS) - 1)
+#define QFF_GLYPH_OFFSET_BITS 18
+#define QFF_GLYPH_OFFSET_MASK (((1 << QFF_GLYPH_OFFSET_BITS) - 1) << QFF_GLYPH_WIDTH_BITS)
+
+typedef struct __attribute__((packed)) qff_ascii_glyph_v1_t {
+ uint32_t value : 24; // Uses QFF_GLYPH_*_(BITS|MASK) as bitfield ordering is compiler-defined
+} qff_ascii_glyph_v1_t;
+
+_Static_assert(sizeof(qff_ascii_glyph_v1_t) == 3, "qff_ascii_glyph_v1_t must be 3 bytes in v1 of QFF");
+
+typedef struct __attribute__((packed)) qff_ascii_glyph_table_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x01, .neg_type_id = (~0x01), .length = 285 }
+ qff_ascii_glyph_v1_t glyph[95]; // 95 glyphs, 0x20..0x7E
+} qff_ascii_glyph_table_v1_t;
+
+_Static_assert(sizeof(qff_ascii_glyph_table_v1_t) == (sizeof(qgf_block_header_v1_t) + (95 * sizeof(qff_ascii_glyph_v1_t))), "qff_ascii_glyph_table_v1_t must be 290 bytes in v1 of QFF");
+
+/////////////////////////////////////////
+// Unicode glyph table descriptor
+
+#define QFF_UNICODE_GLYPH_DESCRIPTOR_TYPEID 0x02
+
+typedef struct __attribute__((packed)) qff_unicode_glyph_v1_t {
+ uint32_t code_point : 24;
+ uint32_t value : 24; // Uses QFF_GLYPH_*_(BITS|MASK) as bitfield ordering is compiler-defined
+} qff_unicode_glyph_v1_t;
+
+_Static_assert(sizeof(qff_unicode_glyph_v1_t) == 6, "qff_unicode_glyph_v1_t must be 6 bytes in v1 of QFF");
+
+typedef struct __attribute__((packed)) qff_unicode_glyph_table_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x02, .neg_type_id = (~0x02), .length = (N * 6) }
+ qff_unicode_glyph_v1_t glyph[0]; // Extent of '0' signifies that this struct is immediately followed by the glyph data
+} qff_unicode_glyph_table_v1_t;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// QFF API
+
+bool qff_validate_stream(qp_stream_t *stream);
+uint32_t qff_get_total_size(qp_stream_t *stream);
+bool qff_read_font_descriptor(qp_stream_t *stream, uint8_t *line_height, bool *has_ascii_table, uint16_t *num_unicode_glyphs, uint8_t *bpp, bool *has_palette, painter_compression_t *compression_scheme, uint32_t *total_bytes);
diff --git a/quantum/painter/qgf.c b/quantum/painter/qgf.c
new file mode 100644
index 0000000000..834837105b
--- /dev/null
+++ b/quantum/painter/qgf.c
@@ -0,0 +1,292 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+// Quantum Graphics File "QGF" File Format.
+// See https://docs.qmk.fm/#/quantum_painter_qgf for more information.
+
+#include "qgf.h"
+#include "qp_draw.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// QGF API
+
+bool qgf_validate_block_header(qgf_block_header_v1_t *desc, uint8_t expected_typeid, int32_t expected_length) {
+ if (desc->type_id != expected_typeid || desc->neg_type_id != ((~expected_typeid) & 0xFF)) {
+ qp_dprintf("Failed to validate header, expected typeid 0x%02X, was 0x%02X, expected negated typeid 0x%02X, was 0x%02X\n", (int)expected_typeid, (int)desc->type_id, (int)((~desc->type_id) & 0xFF), (int)desc->neg_type_id);
+ return false;
+ }
+
+ if (expected_length >= 0 && desc->length != expected_length) {
+ qp_dprintf("Failed to validate header (typeid 0x%02X), expected length %d, was %d\n", (int)desc->type_id, (int)expected_length, (int)desc->length);
+ return false;
+ }
+
+ return true;
+}
+
+bool qgf_parse_format(qp_image_format_t format, uint8_t *bpp, bool *has_palette) {
+ // clang-format off
+ static const struct QP_PACKED {
+ uint8_t bpp;
+ bool has_palette;
+ } formats[] = {
+ [GRAYSCALE_1BPP] = {.bpp = 1, .has_palette = false},
+ [GRAYSCALE_2BPP] = {.bpp = 2, .has_palette = false},
+ [GRAYSCALE_4BPP] = {.bpp = 4, .has_palette = false},
+ [GRAYSCALE_8BPP] = {.bpp = 8, .has_palette = false},
+ [PALETTE_1BPP] = {.bpp = 1, .has_palette = true},
+ [PALETTE_2BPP] = {.bpp = 2, .has_palette = true},
+ [PALETTE_4BPP] = {.bpp = 4, .has_palette = true},
+ [PALETTE_8BPP] = {.bpp = 8, .has_palette = true},
+ };
+ // clang-format on
+
+ // Copy out the required info
+ if (format > PALETTE_8BPP) {
+ qp_dprintf("Failed to parse frame_descriptor, invalid format 0x%02X\n", (int)format);
+ return false;
+ }
+
+ // Copy out the required info
+ if (bpp) {
+ *bpp = formats[format].bpp;
+ }
+ if (has_palette) {
+ *has_palette = formats[format].has_palette;
+ }
+
+ return true;
+}
+
+bool qgf_parse_frame_descriptor(qgf_frame_v1_t *frame_descriptor, uint8_t *bpp, bool *has_palette, bool *is_delta, painter_compression_t *compression_scheme, uint16_t *delay) {
+ // Decode the format
+ qgf_parse_format(frame_descriptor->format, bpp, has_palette);
+
+ // Copy out the required info
+ if (is_delta) {
+ *is_delta = (frame_descriptor->flags & QGF_FRAME_FLAG_DELTA) == QGF_FRAME_FLAG_DELTA;
+ }
+ if (compression_scheme) {
+ *compression_scheme = frame_descriptor->compression_scheme;
+ }
+ if (delay) {
+ *delay = frame_descriptor->delay;
+ }
+
+ return true;
+}
+
+bool qgf_read_graphics_descriptor(qp_stream_t *stream, uint16_t *image_width, uint16_t *image_height, uint16_t *frame_count, uint32_t *total_bytes) {
+ // Seek to the start
+ qp_stream_setpos(stream, 0);
+
+ // Read and validate the graphics descriptor
+ qgf_graphics_descriptor_v1_t graphics_descriptor;
+ if (qp_stream_read(&graphics_descriptor, sizeof(qgf_graphics_descriptor_v1_t), 1, stream) != 1) {
+ qp_dprintf("Failed to read graphics_descriptor, expected length was not %d\n", (int)sizeof(qgf_graphics_descriptor_v1_t));
+ return false;
+ }
+
+ // Make sure this block is valid
+ if (!qgf_validate_block_header(&graphics_descriptor.header, QGF_GRAPHICS_DESCRIPTOR_TYPEID, (sizeof(qgf_graphics_descriptor_v1_t) - sizeof(qgf_block_header_v1_t)))) {
+ return false;
+ }
+
+ // Make sure the magic and version are correct
+ if (graphics_descriptor.magic != QGF_MAGIC || graphics_descriptor.qgf_version != 0x01) {
+ qp_dprintf("Failed to validate graphics_descriptor, expected magic 0x%06X was 0x%06X, expected version = 0x%02X was 0x%02X\n", (int)QGF_MAGIC, (int)graphics_descriptor.magic, (int)0x01, (int)graphics_descriptor.qgf_version);
+ return false;
+ }
+
+ // Make sure the file length is valid
+ if (graphics_descriptor.neg_total_file_size != ~graphics_descriptor.total_file_size) {
+ qp_dprintf("Failed to validate graphics_descriptor, expected negated length 0x%08X was 0x%08X\n", (int)(~graphics_descriptor.total_file_size), (int)graphics_descriptor.neg_total_file_size);
+ return false;
+ }
+
+ // Copy out the required info
+ if (image_width) {
+ *image_width = graphics_descriptor.image_width;
+ }
+ if (image_height) {
+ *image_height = graphics_descriptor.image_height;
+ }
+ if (frame_count) {
+ *frame_count = graphics_descriptor.frame_count;
+ }
+ if (total_bytes) {
+ *total_bytes = graphics_descriptor.total_file_size;
+ }
+
+ return true;
+}
+
+static bool qgf_read_frame_offset(qp_stream_t *stream, uint16_t frame_number, uint32_t *frame_offset) {
+ uint16_t frame_count;
+ if (!qgf_read_graphics_descriptor(stream, NULL, NULL, &frame_count, NULL)) {
+ return false;
+ }
+
+ // Read the frame offsets descriptor
+ qgf_frame_offsets_v1_t frame_offsets;
+ if (qp_stream_read(&frame_offsets, sizeof(qgf_frame_offsets_v1_t), 1, stream) != 1) {
+ qp_dprintf("Failed to read frame_offsets, expected length was not %d\n", (int)sizeof(qgf_frame_offsets_v1_t));
+ return false;
+ }
+
+ // Make sure this block is valid
+ if (!qgf_validate_block_header(&frame_offsets.header, QGF_FRAME_OFFSET_DESCRIPTOR_TYPEID, (frame_count * sizeof(uint32_t)))) {
+ return false;
+ }
+
+ if (frame_number >= frame_count) {
+ qp_dprintf("Invalid frame number, was %d but only %d frames in image\n", (int)frame_number, (int)frame_count);
+ return false;
+ }
+
+ // Skip the necessary amount of data to get to the requested frame offset
+ qp_stream_seek(stream, frame_number * sizeof(uint32_t), SEEK_CUR);
+
+ // Read the frame offset
+ uint32_t offset = 0;
+ if (qp_stream_read(&offset, sizeof(uint32_t), 1, stream) != 1) {
+ qp_dprintf("Failed to read frame offset, expected length was not %d\n", (int)sizeof(uint32_t));
+ return false;
+ }
+
+ // Copy out the required info
+ if (frame_offset) {
+ *frame_offset = offset;
+ }
+
+ return true;
+}
+
+void qgf_seek_to_frame_descriptor(qp_stream_t *stream, uint16_t frame_number) {
+ // Read the offset
+ uint32_t offset = 0;
+ qgf_read_frame_offset(stream, frame_number, &offset);
+
+ // Move to the offset
+ qp_stream_setpos(stream, offset);
+}
+
+bool qgf_validate_frame_descriptor(qp_stream_t *stream, uint16_t frame_number, uint8_t *bpp, bool *has_palette, bool *is_delta) {
+ // Seek to the correct location
+ qgf_seek_to_frame_descriptor(stream, frame_number);
+
+ // Read the raw descriptor
+ qgf_frame_v1_t frame_descriptor;
+ if (qp_stream_read(&frame_descriptor, sizeof(qgf_frame_v1_t), 1, stream) != 1) {
+ qp_dprintf("Failed to read frame_descriptor, expected length was not %d\n", (int)sizeof(qgf_frame_v1_t));
+ return false;
+ }
+
+ // Make sure this block is valid
+ if (!qgf_validate_block_header(&frame_descriptor.header, QGF_FRAME_DESCRIPTOR_TYPEID, (sizeof(qgf_frame_v1_t) - sizeof(qgf_block_header_v1_t)))) {
+ return false;
+ }
+
+ return qgf_parse_frame_descriptor(&frame_descriptor, bpp, has_palette, is_delta, NULL, NULL);
+}
+
+bool qgf_validate_palette_descriptor(qp_stream_t *stream, uint16_t frame_number, uint8_t bpp) {
+ // Read the palette descriptor
+ qgf_palette_v1_t palette_descriptor;
+ if (qp_stream_read(&palette_descriptor, sizeof(qgf_palette_v1_t), 1, stream) != 1) {
+ qp_dprintf("Failed to read palette_descriptor, expected length was not %d\n", (int)sizeof(qgf_palette_v1_t));
+ return false;
+ }
+
+ // Make sure this block is valid
+ uint32_t expected_length = (1 << bpp) * 3 * sizeof(uint8_t);
+ if (!qgf_validate_block_header(&palette_descriptor.header, QGF_FRAME_PALETTE_DESCRIPTOR_TYPEID, expected_length)) {
+ return false;
+ }
+
+ // Move forward in the stream to the next block
+ qp_stream_seek(stream, expected_length, SEEK_CUR);
+ return true;
+}
+
+bool qgf_validate_delta_descriptor(qp_stream_t *stream, uint16_t frame_number) {
+ // Read the delta descriptor
+ qgf_delta_v1_t delta_descriptor;
+ if (qp_stream_read(&delta_descriptor, sizeof(qgf_delta_v1_t), 1, stream) != 1) {
+ qp_dprintf("Failed to read delta_descriptor, expected length was not %d\n", (int)sizeof(qgf_delta_v1_t));
+ return false;
+ }
+
+ // Make sure this block is valid
+ if (!qgf_validate_block_header(&delta_descriptor.header, QGF_FRAME_DELTA_DESCRIPTOR_TYPEID, (sizeof(qgf_delta_v1_t) - sizeof(qgf_block_header_v1_t)))) {
+ return false;
+ }
+
+ return true;
+}
+
+bool qgf_validate_frame_data_descriptor(qp_stream_t *stream, uint16_t frame_number) {
+ // Read and validate the data block
+ qgf_data_v1_t data_descriptor;
+ if (qp_stream_read(&data_descriptor, sizeof(qgf_data_v1_t), 1, stream) != 1) {
+ qp_dprintf("Failed to read data_descriptor, expected length was not %d\n", (int)sizeof(qgf_data_v1_t));
+ return false;
+ }
+
+ if (!qgf_validate_block_header(&data_descriptor.header, QGF_FRAME_DATA_DESCRIPTOR_TYPEID, -1)) {
+ return false;
+ }
+
+ return true;
+}
+
+bool qgf_validate_stream(qp_stream_t *stream) {
+ uint16_t frame_count;
+ if (!qgf_read_graphics_descriptor(stream, NULL, NULL, &frame_count, NULL)) {
+ return false;
+ }
+
+ // Read and validate all the frames (automatically validates the frame offset descriptor in the process)
+ for (uint16_t i = 0; i < frame_count; ++i) {
+ // Validate the frame descriptor block
+ uint8_t bpp;
+ bool has_palette;
+ bool has_delta;
+ if (!qgf_validate_frame_descriptor(stream, i, &bpp, &has_palette, &has_delta)) {
+ return false;
+ }
+
+ // If we've got a palette block, check it
+ if (has_palette && !qgf_validate_palette_descriptor(stream, i, bpp)) {
+ return false;
+ }
+
+ // If we've got a delta block, check it
+ if (has_delta && !qgf_validate_delta_descriptor(stream, i)) {
+ return false;
+ }
+
+ // Check the data block
+ if (!qgf_validate_frame_data_descriptor(stream, i)) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+// Work out the total size of an image definition, assuming we can read far enough into the file
+uint32_t qgf_get_total_size(qp_stream_t *stream) {
+ // Get the original location
+ uint32_t oldpos = qp_stream_tell(stream);
+
+ // Read the graphics descriptor, grabbing the size
+ uint32_t total_size;
+ if (!qgf_read_graphics_descriptor(stream, NULL, NULL, NULL, &total_size)) {
+ return false;
+ }
+
+ // Restore the original location
+ qp_stream_setpos(stream, oldpos);
+ return total_size;
+}
diff --git a/quantum/painter/qgf.h b/quantum/painter/qgf.h
new file mode 100644
index 0000000000..54585edd04
--- /dev/null
+++ b/quantum/painter/qgf.h
@@ -0,0 +1,136 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+// Quantum Graphics File "QGF" File Format.
+// See https://docs.qmk.fm/#/quantum_painter_qgf for more information.
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "qp_stream.h"
+#include "qp_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// QGF structures
+
+/////////////////////////////////////////
+// Common block header
+
+typedef struct QP_PACKED qgf_block_header_v1_t {
+ uint8_t type_id; // See each respective block type below.
+ uint8_t neg_type_id; // Negated type ID, used for detecting parsing errors.
+ uint32_t length : 24; // 24-bit blob length, allowing for block sizes of a maximum of 16MB.
+} qgf_block_header_v1_t;
+
+_Static_assert(sizeof(qgf_block_header_v1_t) == 5, "qgf_block_header_v1_t must be 5 bytes in v1 of QGF");
+
+/////////////////////////////////////////
+// Graphics descriptor
+
+#define QGF_GRAPHICS_DESCRIPTOR_TYPEID 0x00
+
+typedef struct QP_PACKED qgf_graphics_descriptor_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x00, .neg_type_id = (~0x00), .length = 18 }
+ uint32_t magic : 24; // constant, equal to 0x464751 ("QGF")
+ uint8_t qgf_version; // constant, equal to 0x01
+ uint32_t total_file_size; // total size of the entire file, starting at offset zero
+ uint32_t neg_total_file_size; // negated value of total_file_size
+ uint16_t image_width; // in pixels
+ uint16_t image_height; // in pixels
+ uint16_t frame_count; // minimum of 1
+} qgf_graphics_descriptor_v1_t;
+
+_Static_assert(sizeof(qgf_graphics_descriptor_v1_t) == (sizeof(qgf_block_header_v1_t) + 18), "qgf_graphics_descriptor_v1_t must be 23 bytes in v1 of QGF");
+
+#define QGF_MAGIC 0x464751
+
+/////////////////////////////////////////
+// Frame offset descriptor
+
+#define QGF_FRAME_OFFSET_DESCRIPTOR_TYPEID 0x01
+
+typedef struct QP_PACKED qgf_frame_offsets_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x01, .neg_type_id = (~0x01), .length = (N * sizeof(uint32_t)) }
+ uint32_t offset[0]; // '0' signifies that this struct is immediately followed by the frame offsets
+} qgf_frame_offsets_v1_t;
+
+_Static_assert(sizeof(qgf_frame_offsets_v1_t) == sizeof(qgf_block_header_v1_t), "qgf_frame_offsets_v1_t must only contain qgf_block_header_v1_t in v1 of QGF");
+
+/////////////////////////////////////////
+// Frame descriptor
+
+#define QGF_FRAME_DESCRIPTOR_TYPEID 0x02
+
+typedef struct QP_PACKED qgf_frame_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x02, .neg_type_id = (~0x02), .length = 6 }
+ qp_image_format_t format : 8; // Frame format, see qp.h.
+ uint8_t flags; // Frame flags, see below.
+ painter_compression_t compression_scheme : 8; // Compression scheme, see qp.h.
+ uint8_t transparency_index; // palette index used for transparent pixels (not yet implemented)
+ uint16_t delay; // frame delay time for animations (in units of milliseconds)
+} qgf_frame_v1_t;
+
+_Static_assert(sizeof(qgf_frame_v1_t) == (sizeof(qgf_block_header_v1_t) + 6), "qgf_frame_v1_t must be 11 bytes in v1 of QGF");
+
+#define QGF_FRAME_FLAG_DELTA 0x02
+#define QGF_FRAME_FLAG_TRANSPARENT 0x01
+
+/////////////////////////////////////////
+// Frame palette descriptor
+
+#define QGF_FRAME_PALETTE_DESCRIPTOR_TYPEID 0x03
+
+typedef struct QP_PACKED qgf_palette_entry_v1_t {
+ uint8_t h; // hue component: `[0,360)` degrees is mapped to `[0,255]` uint8_t.
+ uint8_t s; // saturation component: `[0,1]` is mapped to `[0,255]` uint8_t.
+ uint8_t v; // value component: `[0,1]` is mapped to `[0,255]` uint8_t.
+} qgf_palette_entry_v1_t;
+
+_Static_assert(sizeof(qgf_palette_entry_v1_t) == 3, "Palette entry is not 3 bytes in size");
+
+typedef struct QP_PACKED qgf_palette_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x03, .neg_type_id = (~0x03), .length = (N * 3 * sizeof(uint8_t)) }
+ qgf_palette_entry_v1_t hsv[0]; // N * hsv, where N is the number of palette entries depending on the frame format in the descriptor
+} qgf_palette_v1_t;
+
+_Static_assert(sizeof(qgf_palette_v1_t) == sizeof(qgf_block_header_v1_t), "qgf_palette_v1_t must only contain qgf_block_header_v1_t in v1 of QGF");
+
+/////////////////////////////////////////
+// Frame delta descriptor
+
+#define QGF_FRAME_DELTA_DESCRIPTOR_TYPEID 0x04
+
+typedef struct QP_PACKED qgf_delta_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x04, .neg_type_id = (~0x04), .length = 8 }
+ uint16_t left; // The left pixel location to draw the delta image
+ uint16_t top; // The top pixel location to draw the delta image
+ uint16_t right; // The right pixel location to to draw the delta image
+ uint16_t bottom; // The bottom pixel location to to draw the delta image
+} qgf_delta_v1_t;
+
+_Static_assert(sizeof(qgf_delta_v1_t) == (sizeof(qgf_block_header_v1_t) + 8), "qgf_delta_v1_t must be 13 bytes in v1 of QGF");
+
+/////////////////////////////////////////
+// Frame data descriptor
+
+#define QGF_FRAME_DATA_DESCRIPTOR_TYPEID 0x05
+
+typedef struct QP_PACKED qgf_data_v1_t {
+ qgf_block_header_v1_t header; // = { .type_id = 0x05, .neg_type_id = (~0x05), .length = N }
+ uint8_t data[0]; // 0 signifies that this struct is immediately followed by the length of data specified in the header
+} qgf_data_v1_t;
+
+_Static_assert(sizeof(qgf_data_v1_t) == sizeof(qgf_block_header_v1_t), "qgf_data_v1_t must only contain qgf_block_header_v1_t in v1 of QGF");
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// QGF API
+
+uint32_t qgf_get_total_size(qp_stream_t *stream);
+bool qgf_validate_stream(qp_stream_t *stream);
+bool qgf_validate_block_header(qgf_block_header_v1_t *desc, uint8_t expected_typeid, int32_t expected_length);
+bool qgf_read_graphics_descriptor(qp_stream_t *stream, uint16_t *image_width, uint16_t *image_height, uint16_t *frame_count, uint32_t *total_bytes);
+bool qgf_parse_format(qp_image_format_t format, uint8_t *bpp, bool *has_palette);
+void qgf_seek_to_frame_descriptor(qp_stream_t *stream, uint16_t frame_number);
+bool qgf_parse_frame_descriptor(qgf_frame_v1_t *frame_descriptor, uint8_t *bpp, bool *has_palette, bool *is_delta, painter_compression_t *compression_scheme, uint16_t *delay);
diff --git a/quantum/painter/qp.c b/quantum/painter/qp.c
new file mode 100644
index 0000000000..e292ff6497
--- /dev/null
+++ b/quantum/painter/qp.c
@@ -0,0 +1,228 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <quantum.h>
+#include <utf8.h>
+
+#include "qp_internal.h"
+#include "qp_comms.h"
+#include "qp_draw.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Internal driver validation
+
+static bool validate_driver_vtable(struct painter_driver_t *driver) {
+ return (driver->driver_vtable && driver->driver_vtable->init && driver->driver_vtable->power && driver->driver_vtable->clear && driver->driver_vtable->viewport && driver->driver_vtable->pixdata && driver->driver_vtable->palette_convert && driver->driver_vtable->append_pixels) ? true : false;
+}
+
+static bool validate_comms_vtable(struct painter_driver_t *driver) {
+ return (driver->comms_vtable && driver->comms_vtable->comms_init && driver->comms_vtable->comms_start && driver->comms_vtable->comms_stop && driver->comms_vtable->comms_send) ? true : false;
+}
+
+static bool validate_driver_integrity(struct painter_driver_t *driver) {
+ return validate_driver_vtable(driver) && validate_comms_vtable(driver);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_init
+
+bool qp_init(painter_device_t device, painter_rotation_t rotation) {
+ qp_dprintf("qp_init: entry\n");
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+
+ driver->validate_ok = false;
+ if (!validate_driver_integrity(driver)) {
+ qp_dprintf("Failed to validate driver integrity in qp_init\n");
+ return false;
+ }
+
+ driver->validate_ok = true;
+
+ if (!qp_comms_init(device)) {
+ driver->validate_ok = false;
+ qp_dprintf("qp_init: fail (could not init comms)\n");
+ return false;
+ }
+
+ if (!qp_comms_start(device)) {
+ qp_dprintf("qp_init: fail (could not start comms)\n");
+ return false;
+ }
+
+ // Set the rotation before init
+ driver->rotation = rotation;
+
+ // Invoke init
+ bool ret = driver->driver_vtable->init(device, rotation);
+ qp_comms_stop(device);
+ qp_dprintf("qp_init: %s\n", ret ? "ok" : "fail");
+ return ret;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_power
+
+bool qp_power(painter_device_t device, bool power_on) {
+ qp_dprintf("qp_power: entry\n");
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_power: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ if (!qp_comms_start(device)) {
+ qp_dprintf("qp_power: fail (could not start comms)\n");
+ return false;
+ }
+
+ bool ret = driver->driver_vtable->power(device, power_on);
+ qp_comms_stop(device);
+ qp_dprintf("qp_power: %s\n", ret ? "ok" : "fail");
+ return ret;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_clear
+
+bool qp_clear(painter_device_t device) {
+ qp_dprintf("qp_clear: entry\n");
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_clear: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ if (!qp_comms_start(device)) {
+ qp_dprintf("qp_clear: fail (could not start comms)\n");
+ return false;
+ }
+
+ bool ret = driver->driver_vtable->clear(device);
+ qp_comms_stop(device);
+ qp_dprintf("qp_clear: %s\n", ret ? "ok" : "fail");
+ return ret;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_flush
+
+bool qp_flush(painter_device_t device) {
+ qp_dprintf("qp_flush: entry\n");
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_flush: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ if (!qp_comms_start(device)) {
+ qp_dprintf("qp_flush: fail (could not start comms)\n");
+ return false;
+ }
+
+ bool ret = driver->driver_vtable->flush(device);
+ qp_comms_stop(device);
+ qp_dprintf("qp_flush: %s\n", ret ? "ok" : "fail");
+ return ret;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_get_geometry
+
+void qp_get_geometry(painter_device_t device, uint16_t *width, uint16_t *height, painter_rotation_t *rotation, uint16_t *offset_x, uint16_t *offset_y) {
+ qp_dprintf("qp_geometry: entry\n");
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+
+ switch (driver->rotation) {
+ default:
+ case QP_ROTATION_0:
+ case QP_ROTATION_180:
+ if (width) {
+ *width = driver->panel_width;
+ }
+ if (height) {
+ *height = driver->panel_height;
+ }
+ break;
+ case QP_ROTATION_90:
+ case QP_ROTATION_270:
+ if (width) {
+ *width = driver->panel_height;
+ }
+ if (height) {
+ *height = driver->panel_width;
+ }
+ break;
+ }
+
+ if (rotation) {
+ *rotation = driver->rotation;
+ }
+
+ if (offset_x) {
+ *offset_x = driver->offset_x;
+ }
+
+ if (offset_y) {
+ *offset_y = driver->offset_y;
+ }
+
+ qp_dprintf("qp_geometry: ok\n");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_set_viewport_offsets
+
+void qp_set_viewport_offsets(painter_device_t device, uint16_t offset_x, uint16_t offset_y) {
+ qp_dprintf("qp_set_viewport_offsets: entry\n");
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+
+ driver->offset_x = offset_x;
+ driver->offset_y = offset_y;
+
+ qp_dprintf("qp_set_viewport_offsets: ok\n");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_viewport
+
+bool qp_viewport(painter_device_t device, uint16_t left, uint16_t top, uint16_t right, uint16_t bottom) {
+ qp_dprintf("qp_viewport: entry\n");
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_viewport: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ if (!qp_comms_start(device)) {
+ qp_dprintf("qp_viewport: fail (could not start comms)\n");
+ return false;
+ }
+
+ // Set the viewport
+ bool ret = driver->driver_vtable->viewport(device, left, top, right, bottom);
+ qp_dprintf("qp_viewport: %s\n", ret ? "ok" : "fail");
+ qp_comms_stop(device);
+ return ret;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_pixdata
+
+bool qp_pixdata(painter_device_t device, const void *pixel_data, uint32_t native_pixel_count) {
+ qp_dprintf("qp_pixdata: entry\n");
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_pixdata: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ if (!qp_comms_start(device)) {
+ qp_dprintf("qp_pixdata: fail (could not start comms)\n");
+ return false;
+ }
+
+ bool ret = driver->driver_vtable->pixdata(device, pixel_data, native_pixel_count);
+ qp_dprintf("qp_pixdata: %s\n", ret ? "ok" : "fail");
+ qp_comms_stop(device);
+ return ret;
+}
diff --git a/quantum/painter/qp.h b/quantum/painter/qp.h
new file mode 100644
index 0000000000..e1c14d156c
--- /dev/null
+++ b/quantum/painter/qp.h
@@ -0,0 +1,453 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "deferred_exec.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter global configurables (add to your keyboard's config.h)
+
+#ifndef QUANTUM_PAINTER_NUM_IMAGES
+/**
+ * @def This controls the maximum number of images that Quantum Painter can load at any one time. Images can be loaded
+ * using \ref qp_load_image_mem, and can be unloaded by calling \ref qp_close_image. Increasing this number in
+ * order to load more images increases the amount of RAM required. Image data is not held in RAM, just metadata.
+ */
+# define QUANTUM_PAINTER_NUM_IMAGES 8
+#endif // QUANTUM_PAINTER_NUM_IMAGES
+
+#ifndef QUANTUM_PAINTER_NUM_FONTS
+/**
+ * @def This controls the maximum number of fonts that Quantum Painter can load. Fonts can be loaded using
+ * \ref qp_load_font_mem, and can be unloaded by calling \ref qp_close_font. Increasing this number in order to
+ * load more fonts increases the amount of RAM required. Font data is not held in RAM, unless
+ * \ref QUANTUM_PAINTER_LOAD_FONTS_TO_RAM is set to TRUE.
+ */
+# define QUANTUM_PAINTER_NUM_FONTS 4
+#endif // QUANTUM_PAINTER_NUM_FONTS
+
+#ifndef QUANTUM_PAINTER_LOAD_FONTS_TO_RAM
+/**
+ * @def This controls whether or not fonts should be cached in RAM. Under normal circumstances, fonts can have quite
+ * random access patterns, and due to timing of flash memory or external storage, it may be a significant speedup
+ * moving the font into RAM before use. Defaults to "off", but if it's enabled it will fallback to reading from the
+ * original location if corresponding RAM could not be allocated (such as being too large).
+ */
+# define QUANTUM_PAINTER_LOAD_FONTS_TO_RAM FALSE
+#endif
+
+#ifndef QUANTUM_PAINTER_CONCURRENT_ANIMATIONS
+/**
+ * @def This controls the maximum number of animations that Quantum Painter can play simultaneously. Increasing this
+ * number in order to play more animations at the same time increases the amount of RAM required.
+ */
+# define QUANTUM_PAINTER_CONCURRENT_ANIMATIONS 4
+#endif // QUANTUM_PAINTER_CONCURRENT_ANIMATIONS
+
+#ifndef QUANTUM_PAINTER_PIXDATA_BUFFER_SIZE
+/**
+ * @def This controls the maximum size of the pixel data buffer used for single blocks of transmission. Larger buffers
+ * means more data is processed at one time, with less frequent transmissions, at the cost of RAM.
+ */
+# define QUANTUM_PAINTER_PIXDATA_BUFFER_SIZE 32
+#endif
+
+#ifndef QUANTUM_PAINTER_SUPPORTS_256_PALETTE
+/**
+ * @def This controls whether 256-color palettes are supported. This has relatively hefty requirements on RAM -- at
+ * least 1kB extra is required just to store the palette information, with more required for other metadata.
+ */
+# define QUANTUM_PAINTER_SUPPORTS_256_PALETTE FALSE
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter types
+
+/**
+ * @typedef A handle to a Quantum Painter device, such as an LCD or OLED. Most Quantum Painter APIs require this
+ * argument in order to perform operations on the display.
+ */
+typedef const void *painter_device_t;
+
+/**
+ * @typedef The desired rotation of a panel. Used as a parameter to \ref qp_init, and can be queried by
+ * \ref qp_get_geometry.
+ */
+typedef enum { QP_ROTATION_0, QP_ROTATION_90, QP_ROTATION_180, QP_ROTATION_270 } painter_rotation_t;
+
+/**
+ * @typedef A descriptor for a Quantum Painter image.
+ */
+typedef struct painter_image_desc_t {
+ uint16_t width; ///< Image width
+ uint16_t height; ///< Image height
+ uint16_t frame_count; ///< Number of frames in this image
+} painter_image_desc_t;
+
+/**
+ * @typedef A handle to a Quantum Painter image.
+ */
+typedef const painter_image_desc_t *painter_image_handle_t;
+
+/**
+ * @typedef A descriptor for a Quantum Painter font.
+ */
+typedef struct painter_font_desc_t {
+ uint8_t line_height; ///< The number of pixels in height for each line
+} painter_font_desc_t;
+
+/**
+ * @typedef A handle to a Quantum Painter font.
+ */
+typedef const painter_font_desc_t *painter_font_handle_t;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API
+
+/**
+ * Initialize a device and set its rotation.
+ *
+ * @param device[in] the handle of the device to initialize
+ * @param rotation[in] the rotation to use
+ * @return true if initialization succeeded
+ * @return false if initialization failed
+ */
+bool qp_init(painter_device_t device, painter_rotation_t rotation);
+
+/**
+ * Controls whether a display is on or off.
+ *
+ * @note If backlighting is used to control brightness (such as for an LCD), it will need to be handled external to
+ * Quantum Painter.
+ *
+ * @param device[in] the handle of the device to control
+ * @param power_on[in] whether or not the device should be on
+ * @return true if controlling the power state succeeded
+ * @return false if controlling the power state failed
+ */
+bool qp_power(painter_device_t device, bool power_on);
+
+/**
+ * Clears a device's screen.
+ *
+ * @param device[in] the handle of the device to control
+ * @return true if clearing the screen succeeded
+ * @return false if clearing the screen failed
+ */
+bool qp_clear(painter_device_t device);
+
+/**
+ * Transmits any outstanding data to the screen in order to persist all changes to the display.
+ *
+ * @note Drivers without internal framebuffers will likely ignore this API.
+ *
+ * @param device[in] the handle of the device to control
+ * @return true if flushing changes to the screen succeeded
+ * @return false if flushing changes to the screen failed
+ */
+bool qp_flush(painter_device_t device);
+
+/**
+ * Retrieves the size, rotation, and offsets for the display.
+ *
+ * @note Any arguments of NULL will be ignored.
+ *
+ * @param device[in] the handle of the device to control
+ * @param width[out] the device's width
+ * @param height[out] the device's height
+ * @param rotation[out] the device's rotation
+ * @param offset_x[out] the device's x-offset applied while drawing
+ * @param offset_y[out] the device's y-offset applied while drawing
+ */
+void qp_get_geometry(painter_device_t device, uint16_t *width, uint16_t *height, painter_rotation_t *rotation, uint16_t *offset_x, uint16_t *offset_y);
+
+/**
+ * Allows repositioning of the viewport if the panel geometry offsets are non-zero.
+ *
+ * @param device[in] the handle of the device to control
+ * @param offset_x[in] the device's x-offset applied while drawing
+ * @param offset_y[in] the device's y-offset applied while drawing
+ */
+void qp_set_viewport_offsets(painter_device_t device, uint16_t offset_x, uint16_t offset_y);
+
+/**
+ * Sets a pixel to the specified color.
+ *
+ * @param device[in] the handle of the device to control
+ * @param x[in] the x-position to draw onto the device
+ * @param y[in] the y-position to draw onto the device
+ * @param hue[in] the hue to use, with 0-360 mapped to 0-255
+ * @param sat[in] the saturation to use, with 0-100% mapped to 0-255
+ * @param val[in] the value to use, with 0-100% mapped to 0-255
+ * @return true if setting the pixel succeeded
+ * @return false if setting the pixel failed
+ */
+bool qp_setpixel(painter_device_t device, uint16_t x, uint16_t y, uint8_t hue, uint8_t sat, uint8_t val);
+
+/**
+ * Draws a line using the specified color.
+ *
+ * @param device[in] the handle of the device to control
+ * @param x0[in] the device's x-position to start
+ * @param y0[in] the device's y-position to start
+ * @param x1[in] the device's x-position to finish
+ * @param y1[in] the device's y-position to finish
+ * @param hue[in] the hue to use, with 0-360 mapped to 0-255
+ * @param sat[in] the saturation to use, with 0-100% mapped to 0-255
+ * @param val[in] the value to use, with 0-100% mapped to 0-255
+ * @return true if drawing the line succeeded
+ * @return false if drawing the line failed
+ */
+bool qp_line(painter_device_t device, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t hue, uint8_t sat, uint8_t val);
+
+/**
+ * Draws a rectangle using the specified color, optionally filled.
+ *
+ * @param device[in] the handle of the device to control
+ * @param left[in] the device's x-position to start
+ * @param top[in] the device's y-position to start
+ * @param right[in] the device's x-position to finish
+ * @param bottom[in] the device's y-position to finish
+ * @param hue[in] the hue to use, with 0-360 mapped to 0-255
+ * @param sat[in] the saturation to use, with 0-100% mapped to 0-255
+ * @param val[in] the value to use, with 0-100% mapped to 0-255
+ * @param filled[in] whether the rectangle should be filled
+ * @return true if drawing the rectangle succeeded
+ * @return false if drawing the rectangle failed
+ */
+bool qp_rect(painter_device_t device, uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint8_t hue, uint8_t sat, uint8_t val, bool filled);
+
+/**
+ * Draws a circle using the specified color, optionally filled.
+ *
+ * @param device[in] the handle of the device to control
+ * @param x[in] the x-position of the centre of the circle to draw onto the device
+ * @param y[in] the y-position of the centre of the circle to draw onto the device
+ * @param radius[in] the radius of the circle to draw
+ * @param hue[in] the hue to use, with 0-360 mapped to 0-255
+ * @param sat[in] the saturation to use, with 0-100% mapped to 0-255
+ * @param val[in] the value to use, with 0-100% mapped to 0-255
+ * @param filled[in] whether the circle should be filled
+ * @return true if drawing the circle succeeded
+ * @return false if drawing the circle failed
+ */
+bool qp_circle(painter_device_t device, uint16_t x, uint16_t y, uint16_t radius, uint8_t hue, uint8_t sat, uint8_t val, bool filled);
+
+/**
+ * Draws a ellipse using the specified color, optionally filled.
+ *
+ * @param device[in] the handle of the device to control
+ * @param x[in] the x-position of the centre of the ellipse to draw onto the device
+ * @param y[in] the y-position of the centre of the ellipse to draw onto the device
+ * @param sizex[in] the horizontal size of the ellipse
+ * @param sizey[in] the vertical size of the ellipse
+ * @param hue[in] the hue to use, with 0-360 mapped to 0-255
+ * @param sat[in] the saturation to use, with 0-100% mapped to 0-255
+ * @param val[in] the value to use, with 0-100% mapped to 0-255
+ * @param filled[in] whether the ellipse should be filled
+ * @return true if drawing the ellipse succeeded
+ * @return false if drawing the ellipse failed
+ */
+bool qp_ellipse(painter_device_t device, uint16_t x, uint16_t y, uint16_t sizex, uint16_t sizey, uint8_t hue, uint8_t sat, uint8_t val, bool filled);
+
+/**
+ * Sets up the location on the display to stream raw pixel data to the display, using \ref qp_pixdata.
+ *
+ * @note This is for advanced uses only, and should not be required for normal Quantum Painter functionality.
+ *
+ * @param device[in] the handle of the device to control
+ * @param left[in] the device's x-position to start
+ * @param top[in] the device's y-position to start
+ * @param right[in] the device's x-position to finish
+ * @param bottom[in] the device's y-position to finish
+ * @return true if setting the viewport succeeded
+ * @return false if setting the viewport failed
+ */
+bool qp_viewport(painter_device_t device, uint16_t left, uint16_t top, uint16_t right, uint16_t bottom);
+
+/**
+ * Streams raw pixel data (in the native panel format) to the area previously set by \ref qp_viewport.
+ *
+ * @note This is for advanced uses only, and should not be required for normal Quantum Painter functionality.
+ *
+ * @param device[in] the handle of the device to control
+ * @param pixel_data[in] pointer to buffer data
+ * @param native_pixel_count[in] the number of pixels to transmit
+ * @return true if streaming of data succeeded
+ * @return false if streaming of data failed
+ */
+bool qp_pixdata(painter_device_t device, const void *pixel_data, uint32_t native_pixel_count);
+
+/**
+ * Loads an image into memory.
+ *
+ * @note Images can be unloaded by calling \ref qp_close_image.
+ *
+ * @param buffer[in] the image data to load
+ * @return an image handle usable with \ref qp_drawimage, \ref qp_drawimage_recolor, \ref qp_animate, and
+ * \ref qp_animate_recolor.
+ * @return NULL if loading the image failed
+ */
+painter_image_handle_t qp_load_image_mem(const void *buffer);
+
+/**
+ * Closes an image handle when no longer in use.
+ *
+ * @param image[in] the handle of the image to unload
+ * @return true if unloading the image succeeded
+ * @return false if unloading the image failed
+ */
+bool qp_close_image(painter_image_handle_t image);
+
+/**
+ * Draws an image to the display.
+ *
+ * @param device[in] the handle of the device to control
+ * @param x[in] the x-position where the image should be drawn onto the device
+ * @param y[in] the y-position where the image should be drawn onto the device
+ * @param image[in] the handle of the image to draw
+ * @return true if drawing the image succeeded
+ * @return false if drawing the image failed
+ */
+bool qp_drawimage(painter_device_t device, uint16_t x, uint16_t y, painter_image_handle_t image);
+
+/**
+ * Draws an image to the display, recoloring monochrome images to the desired foreground/background.
+ *
+ * @param device[in] the handle of the device to control
+ * @param x[in] the x-position where the image should be drawn onto the device
+ * @param y[in] the y-position where the image should be drawn onto the device
+ * @param image[in] the handle of the image to draw
+ * @param hue_fg[in] the foreground hue to use, with 0-360 mapped to 0-255
+ * @param sat_fg[in] the foreground saturation to use, with 0-100% mapped to 0-255
+ * @param val_fg[in] the foreground value to use, with 0-100% mapped to 0-255
+ * @param hue_bg[in] the background hue to use, with 0-360 mapped to 0-255
+ * @param sat_bg[in] the background saturation to use, with 0-100% mapped to 0-255
+ * @param val_bg[in] the background value to use, with 0-100% mapped to 0-255
+ * @return true if drawing the image succeeded
+ * @return false if drawing the image failed
+ */
+bool qp_drawimage_recolor(painter_device_t device, uint16_t x, uint16_t y, painter_image_handle_t image, uint8_t hue_fg, uint8_t sat_fg, uint8_t val_fg, uint8_t hue_bg, uint8_t sat_bg, uint8_t val_bg);
+
+/**
+ * Draws an animation to the display.
+ *
+ * @param device[in] the handle of the device to control
+ * @param x[in] the x-position where the image should be drawn onto the device
+ * @param y[in] the y-position where the image should be drawn onto the device
+ * @param image[in] the handle of the image to draw
+ * @return the \ref deferred_token to use with \ref qp_stop_animation in order to stop animating
+ * @return INVALID_DEFERRED_TOKEN if animating the image failed
+ */
+deferred_token qp_animate(painter_device_t device, uint16_t x, uint16_t y, painter_image_handle_t image);
+
+/**
+ * Draws an animation to the display, recoloring monochrome images to the desired foreground/background.
+ *
+ * @param device[in] the handle of the device to control
+ * @param x[in] the x-position where the image should be drawn onto the device
+ * @param y[in] the y-position where the image should be drawn onto the device
+ * @param image[in] the handle of the image to draw
+ * @param hue_fg[in] the foreground hue to use, with 0-360 mapped to 0-255
+ * @param sat_fg[in] the foreground saturation to use, with 0-100% mapped to 0-255
+ * @param val_fg[in] the foreground value to use, with 0-100% mapped to 0-255
+ * @param hue_bg[in] the background hue to use, with 0-360 mapped to 0-255
+ * @param sat_bg[in] the background saturation to use, with 0-100% mapped to 0-255
+ * @param val_bg[in] the background value to use, with 0-100% mapped to 0-255
+ * @return the \ref deferred_token to use with \ref qp_stop_animation in order to stop animating
+ * @return INVALID_DEFERRED_TOKEN if animating the image failed
+ */
+deferred_token qp_animate_recolor(painter_device_t device, uint16_t x, uint16_t y, painter_image_handle_t image, uint8_t hue_fg, uint8_t sat_fg, uint8_t val_fg, uint8_t hue_bg, uint8_t sat_bg, uint8_t val_bg);
+
+/**
+ * Cancels a running animation.
+ *
+ * @param anim_token[in] the animation token returned by \ref qp_animate, or \ref qp_animate_recolor.
+ */
+void qp_stop_animation(deferred_token anim_token);
+
+/**
+ * Loads a font into memory.
+ *
+ * @note Fonts can be unloaded by calling \ref qp_close_font.
+ *
+ * @param buffer[in] the font data to load
+ * @return an image handle usable with \ref qp_textwidth, \ref qp_drawtext, and \ref qp_drawtext_recolor.
+ * @return NULL if loading the font failed
+ */
+painter_font_handle_t qp_load_font_mem(const void *buffer);
+
+/**
+ * Closes a font handle when no longer in use.
+ *
+ * @param font[in] the handle of the font to unload
+ * @return true if unloading the font succeeded
+ * @return false if unloading the font failed
+ */
+bool qp_close_font(painter_font_handle_t font);
+
+/**
+ * Measures the width (in pixels) of the supplied string, given the specified font.
+ *
+ * @param font[in] the handle of the font
+ * @param str[in] the string to measure
+ * @return the width (in pixels) needed to draw the specified string
+ */
+int16_t qp_textwidth(painter_font_handle_t font, const char *str);
+
+/**
+ * Draws text to the display.
+ *
+ * @param device[in] the handle of the device to control
+ * @param x[in] the x-position where the text should be drawn onto the device
+ * @param y[in] the y-position where the text should be drawn onto the device
+ * @param font[in] the handle of the font
+ * @param str[in] the string to draw
+ * @return the width (in pixels) used when drawing the specified string
+ */
+int16_t qp_drawtext(painter_device_t device, uint16_t x, uint16_t y, painter_font_handle_t font, const char *str);
+
+/**
+ * Draws text to the display, recoloring monochrome fonts to the desired foreground/background.
+ *
+ * @param device[in] the handle of the device to control
+ * @param x[in] the x-position where the text should be drawn onto the device
+ * @param y[in] the y-position where the text should be drawn onto the device
+ * @param font[in] the handle of the font
+ * @param str[in] the string to draw
+ * @param hue_fg[in] the foreground hue to use, with 0-360 mapped to 0-255
+ * @param sat_fg[in] the foreground saturation to use, with 0-100% mapped to 0-255
+ * @param val_fg[in] the foreground value to use, with 0-100% mapped to 0-255
+ * @param hue_bg[in] the background hue to use, with 0-360 mapped to 0-255
+ * @param sat_bg[in] the background saturation to use, with 0-100% mapped to 0-255
+ * @param val_bg[in] the background value to use, with 0-100% mapped to 0-255
+ * @return the width (in pixels) used when drawing the specified string
+ */
+int16_t qp_drawtext_recolor(painter_device_t device, uint16_t x, uint16_t y, painter_font_handle_t font, const char *str, uint8_t hue_fg, uint8_t sat_fg, uint8_t val_fg, uint8_t hue_bg, uint8_t sat_bg, uint8_t val_bg);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter Drivers
+
+#ifdef QUANTUM_PAINTER_ILI9163_ENABLE
+# include "qp_ili9163.h"
+#endif // QUANTUM_PAINTER_ILI9163_ENABLE
+
+#ifdef QUANTUM_PAINTER_ILI9341_ENABLE
+# include "qp_ili9341.h"
+#endif // QUANTUM_PAINTER_ILI9341_ENABLE
+
+#ifdef QUANTUM_PAINTER_ST7789_ENABLE
+# include "qp_st7789.h"
+#endif // QUANTUM_PAINTER_ST7789_ENABLE
+
+#ifdef QUANTUM_PAINTER_GC9A01_ENABLE
+# include "qp_gc9a01.h"
+#endif // QUANTUM_PAINTER_GC9A01_ENABLE
+
+#ifdef QUANTUM_PAINTER_SSD1351_ENABLE
+# include "qp_ssd1351.h"
+#endif // QUANTUM_PAINTER_SSD1351_ENABLE
diff --git a/quantum/painter/qp_comms.c b/quantum/painter/qp_comms.c
new file mode 100644
index 0000000000..dc17b49460
--- /dev/null
+++ b/quantum/painter/qp_comms.c
@@ -0,0 +1,72 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "qp_comms.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Base comms APIs
+
+bool qp_comms_init(painter_device_t device) {
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_comms_init: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ return driver->comms_vtable->comms_init(device);
+}
+
+bool qp_comms_start(painter_device_t device) {
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_comms_start: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ return driver->comms_vtable->comms_start(device);
+}
+
+void qp_comms_stop(painter_device_t device) {
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_comms_stop: fail (validation_ok == false)\n");
+ return;
+ }
+
+ driver->comms_vtable->comms_stop(device);
+}
+
+uint32_t qp_comms_send(painter_device_t device, const void *data, uint32_t byte_count) {
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_comms_send: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ return driver->comms_vtable->comms_send(device, data, byte_count);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Comms APIs that use a D/C pin
+
+void qp_comms_command(painter_device_t device, uint8_t cmd) {
+ struct painter_driver_t * driver = (struct painter_driver_t *)device;
+ struct painter_comms_with_command_vtable_t *comms_vtable = (struct painter_comms_with_command_vtable_t *)driver->comms_vtable;
+ comms_vtable->send_command(device, cmd);
+}
+
+void qp_comms_command_databyte(painter_device_t device, uint8_t cmd, uint8_t data) {
+ qp_comms_command(device, cmd);
+ qp_comms_send(device, &data, sizeof(data));
+}
+
+uint32_t qp_comms_command_databuf(painter_device_t device, uint8_t cmd, const void *data, uint32_t byte_count) {
+ qp_comms_command(device, cmd);
+ return qp_comms_send(device, data, byte_count);
+}
+
+void qp_comms_bulk_command_sequence(painter_device_t device, const uint8_t *sequence, size_t sequence_len) {
+ struct painter_driver_t * driver = (struct painter_driver_t *)device;
+ struct painter_comms_with_command_vtable_t *comms_vtable = (struct painter_comms_with_command_vtable_t *)driver->comms_vtable;
+ comms_vtable->bulk_command_sequence(device, sequence, sequence_len);
+}
diff --git a/quantum/painter/qp_comms.h b/quantum/painter/qp_comms.h
new file mode 100644
index 0000000000..8fbf25c201
--- /dev/null
+++ b/quantum/painter/qp_comms.h
@@ -0,0 +1,25 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <stdbool.h>
+#include <stdlib.h>
+
+#include "qp_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Base comms APIs
+
+bool qp_comms_init(painter_device_t device);
+bool qp_comms_start(painter_device_t device);
+void qp_comms_stop(painter_device_t device);
+uint32_t qp_comms_send(painter_device_t device, const void* data, uint32_t byte_count);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Comms APIs that use a D/C pin
+
+void qp_comms_command(painter_device_t device, uint8_t cmd);
+void qp_comms_command_databyte(painter_device_t device, uint8_t cmd, uint8_t data);
+uint32_t qp_comms_command_databuf(painter_device_t device, uint8_t cmd, const void* data, uint32_t byte_count);
+void qp_comms_bulk_command_sequence(painter_device_t device, const uint8_t* sequence, size_t sequence_len);
diff --git a/quantum/painter/qp_draw.h b/quantum/painter/qp_draw.h
new file mode 100644
index 0000000000..7094d80eaa
--- /dev/null
+++ b/quantum/painter/qp_draw.h
@@ -0,0 +1,85 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "qp_internal.h"
+#include "qp_stream.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter utility functions
+
+// Global variable used for native pixel data streaming.
+extern uint8_t qp_internal_global_pixdata_buffer[QUANTUM_PAINTER_PIXDATA_BUFFER_SIZE];
+
+// Check if the supplied bpp is capable of being rendered
+bool qp_internal_bpp_capable(uint8_t bits_per_pixel);
+
+// Returns the number of pixels that can fit in the pixdata buffer
+uint32_t qp_internal_num_pixels_in_buffer(painter_device_t device);
+
+// Fills the supplied buffer with equivalent native pixels matching the supplied HSV
+void qp_internal_fill_pixdata(painter_device_t device, uint32_t num_pixels, uint8_t hue, uint8_t sat, uint8_t val);
+
+// qp_setpixel internal implementation, but uses the global pixdata buffer with pre-converted native pixel. Only the first pixel is used.
+bool qp_internal_setpixel_impl(painter_device_t device, uint16_t x, uint16_t y);
+
+// qp_rect internal implementation, but uses the global pixdata buffer with pre-converted native pixels.
+bool qp_internal_fillrect_helper_impl(painter_device_t device, uint16_t l, uint16_t t, uint16_t r, uint16_t b);
+
+// Convert from input pixel data + palette to equivalent pixels
+typedef int16_t (*qp_internal_byte_input_callback)(void* cb_arg);
+typedef bool (*qp_internal_pixel_output_callback)(qp_pixel_t* palette, uint8_t index, void* cb_arg);
+bool qp_internal_decode_palette(painter_device_t device, uint32_t pixel_count, uint8_t bits_per_pixel, qp_internal_byte_input_callback input_callback, void* input_arg, qp_pixel_t* palette, qp_internal_pixel_output_callback output_callback, void* output_arg);
+bool qp_internal_decode_grayscale(painter_device_t device, uint32_t pixel_count, uint8_t bits_per_pixel, qp_internal_byte_input_callback input_callback, void* input_arg, qp_internal_pixel_output_callback output_callback, void* output_arg);
+bool qp_internal_decode_recolor(painter_device_t device, uint32_t pixel_count, uint8_t bits_per_pixel, qp_internal_byte_input_callback input_callback, void* input_arg, qp_pixel_t fg_hsv888, qp_pixel_t bg_hsv888, qp_internal_pixel_output_callback output_callback, void* output_arg);
+
+// Global variable used for interpolated pixel lookup table.
+#if QUANTUM_PAINTER_SUPPORTS_256_PALETTE
+extern qp_pixel_t qp_internal_global_pixel_lookup_table[256];
+#else
+extern qp_pixel_t qp_internal_global_pixel_lookup_table[16];
+#endif
+
+// Generates a color-interpolated lookup table based off the number of items, from foreground to background, for use with monochrome image rendering.
+// Returns true if a palette was created, false if the palette is reused.
+// As this uses a global, this may present a problem if using the same parameters but a different screen converts pixels -- use qp_internal_invalidate_palette() below to reset.
+bool qp_internal_interpolate_palette(qp_pixel_t fg_hsv888, qp_pixel_t bg_hsv888, int16_t steps);
+
+// Resets the global palette so that it can be regenerated. Only needed if the colors are identical, but a different display is used with a different internal pixel format.
+void qp_internal_invalidate_palette(void);
+
+// Helper shared between image and font rendering -- sets up the global palette to match the palette block specified in the asset. Expects the stream to be positioned at the start of the block header.
+bool qp_internal_load_qgf_palette(qp_stream_t* stream, uint8_t bpp);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter codec functions
+
+enum qp_internal_rle_mode_t {
+ MARKER_BYTE,
+ REPEATING_RUN,
+ NON_REPEATING_RUN,
+};
+
+struct qp_internal_byte_input_state {
+ painter_device_t device;
+ qp_stream_t* src_stream;
+ int16_t curr;
+ union {
+ // RLE-specific
+ struct {
+ enum qp_internal_rle_mode_t mode;
+ uint8_t remain; // number of bytes remaining in the current mode
+ } rle;
+ };
+};
+
+struct qp_internal_pixel_output_state {
+ painter_device_t device;
+ uint32_t pixel_write_pos;
+ uint32_t max_pixels;
+};
+
+bool qp_internal_pixel_appender(qp_pixel_t* palette, uint8_t index, void* cb_arg);
+
+qp_internal_byte_input_callback qp_internal_prepare_input_state(struct qp_internal_byte_input_state* input_state, painter_compression_t compression);
diff --git a/quantum/painter/qp_draw_circle.c b/quantum/painter/qp_draw_circle.c
new file mode 100644
index 0000000000..edaae35835
--- /dev/null
+++ b/quantum/painter/qp_draw_circle.c
@@ -0,0 +1,172 @@
+// Copyright 2021 Paul Cotter (@gr1mr3aver)
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "qp.h"
+#include "qp_internal.h"
+#include "qp_comms.h"
+#include "qp_draw.h"
+
+// Utilize 8-way symmetry to draw circles
+static bool qp_circle_helper_impl(painter_device_t device, uint16_t centerx, uint16_t centery, uint16_t offsetx, uint16_t offsety, bool filled) {
+ /*
+ Circles have the property of 8-way symmetry, so eight pixels can be drawn
+ for each computed [offsetx,offsety] given the center coordinates
+ represented by [centerx,centery].
+
+ For filled circles, we can draw horizontal lines between each pair of
+ pixels with the same final value of y.
+
+ Two special cases exist and have been optimized:
+ 1) offsetx == offsety (the final point), makes half the coordinates
+ equivalent, so we can omit them (and the corresponding fill lines)
+ 2) offsetx == 0 (the starting point) means that some horizontal lines
+ would be a single pixel in length, so we write individual pixels instead.
+ This also makes half the symmetrical points identical to their twins,
+ so we only need four points or two points and one line
+ */
+
+ int16_t xpx = ((int16_t)centerx) + ((int16_t)offsetx);
+ int16_t xmx = ((int16_t)centerx) - ((int16_t)offsetx);
+ int16_t xpy = ((int16_t)centerx) + ((int16_t)offsety);
+ int16_t xmy = ((int16_t)centerx) - ((int16_t)offsety);
+ int16_t ypx = ((int16_t)centery) + ((int16_t)offsetx);
+ int16_t ymx = ((int16_t)centery) - ((int16_t)offsetx);
+ int16_t ypy = ((int16_t)centery) + ((int16_t)offsety);
+ int16_t ymy = ((int16_t)centery) - ((int16_t)offsety);
+
+ if (offsetx == 0) {
+ if (!qp_internal_setpixel_impl(device, centerx, ypy)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, centerx, ymy)) {
+ return false;
+ }
+ if (filled) {
+ if (!qp_internal_fillrect_helper_impl(device, xpy, centery, xmy, centery)) {
+ return false;
+ }
+ } else {
+ if (!qp_internal_setpixel_impl(device, xpy, centery)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xmy, centery)) {
+ return false;
+ }
+ }
+ } else if (offsetx == offsety) {
+ if (filled) {
+ if (!qp_internal_fillrect_helper_impl(device, xpy, ypy, xmy, ypy)) {
+ return false;
+ }
+ if (!qp_internal_fillrect_helper_impl(device, xpy, ymy, xmy, ymy)) {
+ return false;
+ }
+ } else {
+ if (!qp_internal_setpixel_impl(device, xpy, ypy)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xmy, ypy)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xpy, ymy)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xmy, ymy)) {
+ return false;
+ }
+ }
+
+ } else {
+ if (filled) {
+ if (!qp_internal_fillrect_helper_impl(device, xpx, ypy, xmx, ypy)) {
+ return false;
+ }
+ if (!qp_internal_fillrect_helper_impl(device, xpx, ymy, xmx, ymy)) {
+ return false;
+ }
+ if (!qp_internal_fillrect_helper_impl(device, xpy, ypx, xmy, ypx)) {
+ return false;
+ }
+ if (!qp_internal_fillrect_helper_impl(device, xpy, ymx, xmy, ymx)) {
+ return false;
+ }
+ } else {
+ if (!qp_internal_setpixel_impl(device, xpx, ypy)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xmx, ypy)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xpx, ymy)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xmx, ymy)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xpy, ypx)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xmy, ypx)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xpy, ymx)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xmy, ymx)) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_circle
+
+bool qp_circle(painter_device_t device, uint16_t x, uint16_t y, uint16_t radius, uint8_t hue, uint8_t sat, uint8_t val, bool filled) {
+ qp_dprintf("qp_circle: entry\n");
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_circle: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ // plot the initial set of points for x, y and r
+ int16_t xcalc = 0;
+ int16_t ycalc = (int16_t)radius;
+ int16_t err = ((5 - (radius >> 2)) >> 2);
+
+ qp_internal_fill_pixdata(device, (radius * 2) + 1, hue, sat, val);
+
+ if (!qp_comms_start(device)) {
+ qp_dprintf("qp_circle: fail (could not start comms)\n");
+ return false;
+ }
+
+ bool ret = true;
+ if (!qp_circle_helper_impl(device, x, y, xcalc, ycalc, filled)) {
+ ret = false;
+ }
+
+ if (ret) {
+ while (xcalc < ycalc) {
+ xcalc++;
+ if (err < 0) {
+ err += (xcalc << 1) + 1;
+ } else {
+ ycalc--;
+ err += ((xcalc - ycalc) << 1) + 1;
+ }
+ if (!qp_circle_helper_impl(device, x, y, xcalc, ycalc, filled)) {
+ ret = false;
+ break;
+ }
+ }
+ }
+
+ qp_dprintf("qp_circle: %s\n", ret ? "ok" : "fail");
+ qp_comms_stop(device);
+ return ret;
+}
diff --git a/quantum/painter/qp_draw_codec.c b/quantum/painter/qp_draw_codec.c
new file mode 100644
index 0000000000..438dce3994
--- /dev/null
+++ b/quantum/painter/qp_draw_codec.c
@@ -0,0 +1,142 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "qp_internal.h"
+#include "qp_draw.h"
+#include "qp_comms.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Palette / Monochrome-format decoder
+
+static const qp_pixel_t qp_pixel_white = {.hsv888 = {.h = 0, .s = 0, .v = 255}};
+static const qp_pixel_t qp_pixel_black = {.hsv888 = {.h = 0, .s = 0, .v = 0}};
+
+bool qp_internal_bpp_capable(uint8_t bits_per_pixel) {
+#if !(QUANTUM_PAINTER_SUPPORTS_256_PALETTE)
+ if (bits_per_pixel > 4) {
+ qp_dprintf("qp_internal_decode_palette: image bpp greater than 4\n");
+ return false;
+ }
+#endif
+
+ if (bits_per_pixel > 8) {
+ qp_dprintf("qp_internal_decode_palette: image bpp greater than 8\n");
+ return false;
+ }
+
+ return true;
+}
+
+bool qp_internal_decode_palette(painter_device_t device, uint32_t pixel_count, uint8_t bits_per_pixel, qp_internal_byte_input_callback input_callback, void* input_arg, qp_pixel_t* palette, qp_internal_pixel_output_callback output_callback, void* output_arg) {
+ const uint8_t pixel_bitmask = (1 << bits_per_pixel) - 1;
+ const uint8_t pixels_per_byte = 8 / bits_per_pixel;
+ uint32_t remaining_pixels = pixel_count; // don't try to derive from byte_count, we may not use an entire byte
+ while (remaining_pixels > 0) {
+ uint8_t byteval = input_callback(input_arg);
+ if (byteval < 0) {
+ return false;
+ }
+ uint8_t loop_pixels = remaining_pixels < pixels_per_byte ? remaining_pixels : pixels_per_byte;
+ for (uint8_t q = 0; q < loop_pixels; ++q) {
+ if (!output_callback(palette, byteval & pixel_bitmask, output_arg)) {
+ return false;
+ }
+ byteval >>= bits_per_pixel;
+ }
+ remaining_pixels -= loop_pixels;
+ }
+ return true;
+}
+
+bool qp_internal_decode_grayscale(painter_device_t device, uint32_t pixel_count, uint8_t bits_per_pixel, qp_internal_byte_input_callback input_callback, void* input_arg, qp_internal_pixel_output_callback output_callback, void* output_arg) {
+ return qp_internal_decode_recolor(device, pixel_count, bits_per_pixel, input_callback, input_arg, qp_pixel_white, qp_pixel_black, output_callback, output_arg);
+}
+
+bool qp_internal_decode_recolor(painter_device_t device, uint32_t pixel_count, uint8_t bits_per_pixel, qp_internal_byte_input_callback input_callback, void* input_arg, qp_pixel_t fg_hsv888, qp_pixel_t bg_hsv888, qp_internal_pixel_output_callback output_callback, void* output_arg) {
+ struct painter_driver_t* driver = (struct painter_driver_t*)device;
+ int16_t steps = 1 << bits_per_pixel; // number of items we need to interpolate
+ if (qp_internal_interpolate_palette(fg_hsv888, bg_hsv888, steps)) {
+ if (!driver->driver_vtable->palette_convert(device, steps, qp_internal_global_pixel_lookup_table)) {
+ return false;
+ }
+ }
+
+ return qp_internal_decode_palette(device, pixel_count, bits_per_pixel, input_callback, input_arg, qp_internal_global_pixel_lookup_table, output_callback, output_arg);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Progressive pull of bytes, push of pixels
+
+static inline int16_t qp_drawimage_byte_uncompressed_decoder(void* cb_arg) {
+ struct qp_internal_byte_input_state* state = (struct qp_internal_byte_input_state*)cb_arg;
+ state->curr = qp_stream_get(state->src_stream);
+ return state->curr;
+}
+
+static inline int16_t qp_drawimage_byte_rle_decoder(void* cb_arg) {
+ struct qp_internal_byte_input_state* state = (struct qp_internal_byte_input_state*)cb_arg;
+
+ // Work out if we're parsing the initial marker byte
+ if (state->rle.mode == MARKER_BYTE) {
+ uint8_t c = qp_stream_get(state->src_stream);
+ if (c >= 128) {
+ state->rle.mode = NON_REPEATING_RUN; // non-repeated run
+ state->rle.remain = c - 127;
+ } else {
+ state->rle.mode = REPEATING_RUN; // repeated run
+ state->rle.remain = c;
+ }
+
+ state->curr = qp_stream_get(state->src_stream);
+ }
+
+ // Work out which byte we're returning
+ uint8_t c = state->curr;
+
+ // Decrement the counter of the bytes remaining
+ state->rle.remain--;
+
+ if (state->rle.remain > 0) {
+ // If we're in a non-repeating run, queue up the next byte
+ if (state->rle.mode == NON_REPEATING_RUN) {
+ state->curr = qp_stream_get(state->src_stream);
+ }
+ } else {
+ // Swap back to querying the marker byte mode
+ state->rle.mode = MARKER_BYTE;
+ }
+
+ return c;
+}
+
+bool qp_internal_pixel_appender(qp_pixel_t* palette, uint8_t index, void* cb_arg) {
+ struct qp_internal_pixel_output_state* state = (struct qp_internal_pixel_output_state*)cb_arg;
+ struct painter_driver_t* driver = (struct painter_driver_t*)state->device;
+
+ if (!driver->driver_vtable->append_pixels(state->device, qp_internal_global_pixdata_buffer, palette, state->pixel_write_pos++, 1, &index)) {
+ return false;
+ }
+
+ // If we've hit the transmit limit, send out the entire buffer and reset the write position
+ if (state->pixel_write_pos == state->max_pixels) {
+ if (!driver->driver_vtable->pixdata(state->device, qp_internal_global_pixdata_buffer, state->pixel_write_pos)) {
+ return false;
+ }
+ state->pixel_write_pos = 0;
+ }
+
+ return true;
+}
+
+qp_internal_byte_input_callback qp_internal_prepare_input_state(struct qp_internal_byte_input_state* input_state, painter_compression_t compression) {
+ switch (compression) {
+ case IMAGE_UNCOMPRESSED:
+ return qp_drawimage_byte_uncompressed_decoder;
+ case IMAGE_COMPRESSED_RLE:
+ input_state->rle.mode = MARKER_BYTE;
+ input_state->rle.remain = 0;
+ return qp_drawimage_byte_rle_decoder;
+ default:
+ return NULL;
+ }
+}
diff --git a/quantum/painter/qp_draw_core.c b/quantum/painter/qp_draw_core.c
new file mode 100644
index 0000000000..c31c734132
--- /dev/null
+++ b/quantum/painter/qp_draw_core.c
@@ -0,0 +1,294 @@
+// Copyright 2021-2022 Nick Brassel (@tzarc)
+// Copyright 2021 Paul Cotter (@gr1mr3aver)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "qp_internal.h"
+#include "qp_comms.h"
+#include "qp_draw.h"
+#include "qgf.h"
+
+_Static_assert((QUANTUM_PAINTER_PIXDATA_BUFFER_SIZE > 0) && (QUANTUM_PAINTER_PIXDATA_BUFFER_SIZE % 16) == 0, "QUANTUM_PAINTER_PIXDATA_BUFFER_SIZE needs to be a non-zero multiple of 16");
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Global variables
+//
+// NOTE: The variables in this section are intentionally outside a stack frame. They are able to be defined with larger
+// sizes than the normal stack frames would allow, and as such need to be external.
+//
+// **** DO NOT refactor this and decide to place the variables inside the function calling them -- you will ****
+// **** very likely get artifacts rendered to the screen as a result. ****
+//
+
+// Buffer used for transmitting native pixel data to the downstream device.
+uint8_t qp_internal_global_pixdata_buffer[QUANTUM_PAINTER_PIXDATA_BUFFER_SIZE];
+
+// Static buffer to contain a generated color palette
+static bool generated_palette = false;
+static int16_t generated_steps = -1;
+static qp_pixel_t interpolated_fg_hsv888;
+static qp_pixel_t interpolated_bg_hsv888;
+#if QUANTUM_PAINTER_SUPPORTS_256_PALETTE
+qp_pixel_t qp_internal_global_pixel_lookup_table[256];
+#else
+qp_pixel_t qp_internal_global_pixel_lookup_table[16];
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Helpers
+
+uint32_t qp_internal_num_pixels_in_buffer(painter_device_t device) {
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ return ((QUANTUM_PAINTER_PIXDATA_BUFFER_SIZE * 8) / driver->native_bits_per_pixel);
+}
+
+// qp_setpixel internal implementation, but accepts a buffer with pre-converted native pixel. Only the first pixel is used.
+bool qp_internal_setpixel_impl(painter_device_t device, uint16_t x, uint16_t y) {
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ return driver->driver_vtable->viewport(device, x, y, x, y) && driver->driver_vtable->pixdata(device, qp_internal_global_pixdata_buffer, 1);
+}
+
+// Fills the global native pixel buffer with equivalent pixels matching the supplied HSV
+void qp_internal_fill_pixdata(painter_device_t device, uint32_t num_pixels, uint8_t hue, uint8_t sat, uint8_t val) {
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ uint32_t pixels_in_pixdata = qp_internal_num_pixels_in_buffer(device);
+ num_pixels = QP_MIN(pixels_in_pixdata, num_pixels);
+
+ // Convert the color to native pixel format
+ qp_pixel_t color = {.hsv888 = {.h = hue, .s = sat, .v = val}};
+ driver->driver_vtable->palette_convert(device, 1, &color);
+
+ // Append the required number of pixels
+ uint8_t palette_idx = 0;
+ for (uint32_t i = 0; i < num_pixels; ++i) {
+ driver->driver_vtable->append_pixels(device, qp_internal_global_pixdata_buffer, &color, i, 1, &palette_idx);
+ }
+}
+
+// Resets the global palette so that it can be regenerated. Only needed if the colors are identical, but a different display is used with a different internal pixel format.
+void qp_internal_invalidate_palette(void) {
+ generated_palette = false;
+ generated_steps = -1;
+}
+
+// Interpolates between two colors to generate a palette
+bool qp_internal_interpolate_palette(qp_pixel_t fg_hsv888, qp_pixel_t bg_hsv888, int16_t steps) {
+ // Check if we need to generate a new palette -- if the input parameters match then assume the palette can stay unchanged.
+ // This may present a problem if using the same parameters but a different screen converts pixels -- use qp_internal_invalidate_palette() to reset.
+ if (generated_palette == true && generated_steps == steps && memcmp(&interpolated_fg_hsv888, &fg_hsv888, sizeof(fg_hsv888)) == 0 && memcmp(&interpolated_bg_hsv888, &bg_hsv888, sizeof(bg_hsv888)) == 0) {
+ // We already have the correct palette, no point regenerating it.
+ return false;
+ }
+
+ // Save the parameters so we know whether we can skip generation
+ generated_palette = true;
+ generated_steps = steps;
+ interpolated_fg_hsv888 = fg_hsv888;
+ interpolated_bg_hsv888 = bg_hsv888;
+
+ int16_t hue_fg = fg_hsv888.hsv888.h;
+ int16_t hue_bg = bg_hsv888.hsv888.h;
+
+ // Make sure we take the "shortest" route from one hue to the other
+ if ((hue_fg - hue_bg) >= 128) {
+ hue_bg += 256;
+ } else if ((hue_fg - hue_bg) <= -128) {
+ hue_bg -= 256;
+ }
+
+ // Interpolate each of the lookup table entries
+ for (int16_t i = 0; i < steps; ++i) {
+ qp_internal_global_pixel_lookup_table[i].hsv888.h = (uint8_t)((hue_fg - hue_bg) * i / (steps - 1) + hue_bg);
+ qp_internal_global_pixel_lookup_table[i].hsv888.s = (uint8_t)((fg_hsv888.hsv888.s - bg_hsv888.hsv888.s) * i / (steps - 1) + bg_hsv888.hsv888.s);
+ qp_internal_global_pixel_lookup_table[i].hsv888.v = (uint8_t)((fg_hsv888.hsv888.v - bg_hsv888.hsv888.v) * i / (steps - 1) + bg_hsv888.hsv888.v);
+
+ qp_dprintf("qp_internal_interpolate_palette: %3d of %d -- H: %3d, S: %3d, V: %3d\n", (int)(i + 1), (int)steps, (int)qp_internal_global_pixel_lookup_table[i].hsv888.h, (int)qp_internal_global_pixel_lookup_table[i].hsv888.s, (int)qp_internal_global_pixel_lookup_table[i].hsv888.v);
+ }
+
+ return true;
+}
+
+// Helper shared between image and font rendering -- sets up the global palette to match the palette block specified in the asset. Expects the stream to be positioned at the start of the block header.
+bool qp_internal_load_qgf_palette(qp_stream_t *stream, uint8_t bpp) {
+ qgf_palette_v1_t palette_descriptor;
+ if (qp_stream_read(&palette_descriptor, sizeof(qgf_palette_v1_t), 1, stream) != 1) {
+ qp_dprintf("Failed to read palette_descriptor, expected length was not %d\n", (int)sizeof(qgf_palette_v1_t));
+ return false;
+ }
+
+ // BPP determines the number of palette entries, each entry is a HSV888 triplet.
+ const uint16_t palette_entries = 1u << bpp;
+
+ // Ensure we aren't reusing any palette
+ qp_internal_invalidate_palette();
+
+ // Read the palette entries
+ for (uint16_t i = 0; i < palette_entries; ++i) {
+ // Read the palette entry
+ qgf_palette_entry_v1_t entry;
+ if (qp_stream_read(&entry, sizeof(qgf_palette_entry_v1_t), 1, stream) != 1) {
+ return false;
+ }
+
+ // Update the lookup table
+ qp_internal_global_pixel_lookup_table[i].hsv888.h = entry.h;
+ qp_internal_global_pixel_lookup_table[i].hsv888.s = entry.s;
+ qp_internal_global_pixel_lookup_table[i].hsv888.v = entry.v;
+
+ qp_dprintf("qp_internal_load_qgf_palette: %3d of %d -- H: %3d, S: %3d, V: %3d\n", (int)(i + 1), (int)palette_entries, (int)qp_internal_global_pixel_lookup_table[i].hsv888.h, (int)qp_internal_global_pixel_lookup_table[i].hsv888.s, (int)qp_internal_global_pixel_lookup_table[i].hsv888.v);
+ }
+
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_setpixel
+
+bool qp_setpixel(painter_device_t device, uint16_t x, uint16_t y, uint8_t hue, uint8_t sat, uint8_t val) {
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_setpixel: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ if (!qp_comms_start(device)) {
+ qp_dprintf("Failed to start comms in qp_setpixel\n");
+ return false;
+ }
+
+ qp_internal_fill_pixdata(device, 1, hue, sat, val);
+ bool ret = qp_internal_setpixel_impl(device, x, y);
+ qp_comms_stop(device);
+ qp_dprintf("qp_setpixel: %s\n", ret ? "ok" : "fail");
+ return ret;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_line
+
+bool qp_line(painter_device_t device, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t hue, uint8_t sat, uint8_t val) {
+ if (x0 == x1 || y0 == y1) {
+ qp_dprintf("qp_line(%d, %d, %d, %d): entry (deferring to qp_rect)\n", (int)x0, (int)y0, (int)x1, (int)y1);
+ bool ret = qp_rect(device, x0, y0, x1, y1, hue, sat, val, true);
+ qp_dprintf("qp_line(%d, %d, %d, %d): %s (deferred to qp_rect)\n", (int)x0, (int)y0, (int)x1, (int)y1, ret ? "ok" : "fail");
+ return ret;
+ }
+
+ qp_dprintf("qp_line(%d, %d, %d, %d): entry\n", (int)x0, (int)y0, (int)x1, (int)y1);
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_line: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ if (!qp_comms_start(device)) {
+ qp_dprintf("Failed to start comms in qp_line\n");
+ return false;
+ }
+
+ qp_internal_fill_pixdata(device, 1, hue, sat, val);
+
+ // draw angled line using Bresenham's algo
+ int16_t x = ((int16_t)x0);
+ int16_t y = ((int16_t)y0);
+ int16_t slopex = ((int16_t)x0) < ((int16_t)x1) ? 1 : -1;
+ int16_t slopey = ((int16_t)y0) < ((int16_t)y1) ? 1 : -1;
+ int16_t dx = abs(((int16_t)x1) - ((int16_t)x0));
+ int16_t dy = -abs(((int16_t)y1) - ((int16_t)y0));
+
+ int16_t e = dx + dy;
+ int16_t e2 = 2 * e;
+
+ bool ret = true;
+ while (x != x1 || y != y1) {
+ if (!qp_internal_setpixel_impl(device, x, y)) {
+ ret = false;
+ break;
+ }
+ e2 = 2 * e;
+ if (e2 >= dy) {
+ e += dy;
+ x += slopex;
+ }
+ if (e2 <= dx) {
+ e += dx;
+ y += slopey;
+ }
+ }
+ // draw the last pixel
+ if (!qp_internal_setpixel_impl(device, x, y)) {
+ ret = false;
+ }
+
+ qp_comms_stop(device);
+ qp_dprintf("qp_line(%d, %d, %d, %d): %s\n", (int)x0, (int)y0, (int)x1, (int)y1, ret ? "ok" : "fail");
+ return ret;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_rect
+
+bool qp_internal_fillrect_helper_impl(painter_device_t device, uint16_t left, uint16_t top, uint16_t right, uint16_t bottom) {
+ uint32_t pixels_in_pixdata = qp_internal_num_pixels_in_buffer(device);
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+
+ uint16_t l = QP_MIN(left, right);
+ uint16_t r = QP_MAX(left, right);
+ uint16_t t = QP_MIN(top, bottom);
+ uint16_t b = QP_MAX(top, bottom);
+ uint16_t w = r - l + 1;
+ uint16_t h = b - t + 1;
+
+ uint32_t remaining = w * h;
+ driver->driver_vtable->viewport(device, l, t, r, b);
+ while (remaining > 0) {
+ uint32_t transmit = QP_MIN(remaining, pixels_in_pixdata);
+ if (!driver->driver_vtable->pixdata(device, qp_internal_global_pixdata_buffer, transmit)) {
+ return false;
+ }
+ remaining -= transmit;
+ }
+ return true;
+}
+
+bool qp_rect(painter_device_t device, uint16_t left, uint16_t top, uint16_t right, uint16_t bottom, uint8_t hue, uint8_t sat, uint8_t val, bool filled) {
+ qp_dprintf("qp_rect(%d, %d, %d, %d): entry\n", (int)left, (int)top, (int)right, (int)bottom);
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_rect: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ // Cater for cases where people have submitted the coordinates backwards
+ uint16_t l = QP_MIN(left, right);
+ uint16_t r = QP_MAX(left, right);
+ uint16_t t = QP_MIN(top, bottom);
+ uint16_t b = QP_MAX(top, bottom);
+ uint16_t w = r - l + 1;
+ uint16_t h = b - t + 1;
+
+ bool ret = true;
+ if (!qp_comms_start(device)) {
+ qp_dprintf("Failed to start comms in qp_rect\n");
+ return false;
+ }
+
+ if (filled) {
+ // Fill up the pixdata buffer with the required number of native pixels
+ qp_internal_fill_pixdata(device, w * h, hue, sat, val);
+
+ // Perform the draw
+ ret = qp_internal_fillrect_helper_impl(device, l, t, r, b);
+ } else {
+ // Fill up the pixdata buffer with the required number of native pixels
+ qp_internal_fill_pixdata(device, QP_MAX(w, h), hue, sat, val);
+
+ // Draw 4x filled single-width rects to create an outline
+ if (!qp_internal_fillrect_helper_impl(device, l, t, r, t) || !qp_internal_fillrect_helper_impl(device, l, b, r, b) || !qp_internal_fillrect_helper_impl(device, l, t + 1, l, b - 1) || !qp_internal_fillrect_helper_impl(device, r, t + 1, r, b - 1)) {
+ ret = false;
+ }
+ }
+
+ qp_comms_stop(device);
+ qp_dprintf("qp_rect(%d, %d, %d, %d): %s\n", (int)l, (int)t, (int)r, (int)b, ret ? "ok" : "fail");
+ return ret;
+}
diff --git a/quantum/painter/qp_draw_ellipse.c b/quantum/painter/qp_draw_ellipse.c
new file mode 100644
index 0000000000..7f2f4abcfd
--- /dev/null
+++ b/quantum/painter/qp_draw_ellipse.c
@@ -0,0 +1,116 @@
+// Copyright 2021 Paul Cotter (@gr1mr3aver)
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "qp_internal.h"
+#include "qp_comms.h"
+#include "qp_draw.h"
+
+// Utilize 4-way symmetry to draw an ellipse
+static bool qp_ellipse_helper_impl(painter_device_t device, uint16_t centerx, uint16_t centery, uint16_t offsetx, uint16_t offsety, bool filled) {
+ /*
+ Ellipses have the property of 4-way symmetry, so four pixels can be drawn
+ for each computed [offsetx,offsety] given the center coordinates
+ represented by [centerx,centery].
+
+ For filled ellipses, we can draw horizontal lines between each pair of
+ pixels with the same final value of y.
+
+ When offsetx == 0 only two pixels can be drawn for filled or unfilled ellipses
+ */
+
+ int16_t xpx = ((int16_t)centerx) + ((int16_t)offsetx);
+ int16_t xmx = ((int16_t)centerx) - ((int16_t)offsetx);
+ int16_t ypy = ((int16_t)centery) + ((int16_t)offsety);
+ int16_t ymy = ((int16_t)centery) - ((int16_t)offsety);
+
+ if (offsetx == 0) {
+ if (!qp_internal_setpixel_impl(device, xpx, ypy)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xpx, ymy)) {
+ return false;
+ }
+ } else if (filled) {
+ if (!qp_internal_fillrect_helper_impl(device, xpx, ypy, xmx, ypy)) {
+ return false;
+ }
+ if (offsety > 0 && !qp_internal_fillrect_helper_impl(device, xpx, ymy, xmx, ymy)) {
+ return false;
+ }
+ } else {
+ if (!qp_internal_setpixel_impl(device, xpx, ypy)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xpx, ymy)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xmx, ypy)) {
+ return false;
+ }
+ if (!qp_internal_setpixel_impl(device, xmx, ymy)) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_ellipse
+
+bool qp_ellipse(painter_device_t device, uint16_t x, uint16_t y, uint16_t sizex, uint16_t sizey, uint8_t hue, uint8_t sat, uint8_t val, bool filled) {
+ qp_dprintf("qp_ellipse: entry\n");
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_ellipse: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ int16_t aa = ((int16_t)sizex) * ((int16_t)sizex);
+ int16_t bb = ((int16_t)sizey) * ((int16_t)sizey);
+ int16_t fa = 4 * ((int16_t)aa);
+ int16_t fb = 4 * ((int16_t)bb);
+
+ int16_t dx = 0;
+ int16_t dy = ((int16_t)sizey);
+
+ qp_internal_fill_pixdata(device, QP_MAX(sizex, sizey), hue, sat, val);
+
+ if (!qp_comms_start(device)) {
+ qp_dprintf("qp_ellipse: fail (could not start comms)\n");
+ return false;
+ }
+
+ bool ret = true;
+ for (int16_t delta = (2 * bb) + (aa * (1 - (2 * sizey))); bb * dx <= aa * dy; dx++) {
+ if (!qp_ellipse_helper_impl(device, x, y, dx, dy, filled)) {
+ ret = false;
+ break;
+ }
+ if (delta >= 0) {
+ delta += fa * (1 - dy);
+ dy--;
+ }
+ delta += bb * (4 * dx + 6);
+ }
+
+ dx = sizex;
+ dy = 0;
+
+ for (int16_t delta = (2 * aa) + (bb * (1 - (2 * sizex))); aa * dy <= bb * dx; dy++) {
+ if (!qp_ellipse_helper_impl(device, x, y, dx, dy, filled)) {
+ ret = false;
+ break;
+ }
+ if (delta >= 0) {
+ delta += fb * (1 - dx);
+ dx--;
+ }
+ delta += aa * (4 * dy + 6);
+ }
+
+ qp_dprintf("qp_ellipse: %s\n", ret ? "ok" : "fail");
+ qp_comms_stop(device);
+ return ret;
+}
diff --git a/quantum/painter/qp_draw_image.c b/quantum/painter/qp_draw_image.c
new file mode 100644
index 0000000000..5822758dce
--- /dev/null
+++ b/quantum/painter/qp_draw_image.c
@@ -0,0 +1,382 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "qp_internal.h"
+#include "qp_draw.h"
+#include "qp_comms.h"
+#include "qgf.h"
+#include "deferred_exec.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// QGF image handles
+
+typedef struct qgf_image_handle_t {
+ painter_image_desc_t base;
+ bool validate_ok;
+ union {
+ qp_stream_t stream;
+ qp_memory_stream_t mem_stream;
+#ifdef QP_STREAM_HAS_FILE_IO
+ qp_file_stream_t file_stream;
+#endif // QP_STREAM_HAS_FILE_IO
+ };
+} qgf_image_handle_t;
+
+static qgf_image_handle_t image_descriptors[QUANTUM_PAINTER_NUM_IMAGES] = {0};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_load_image_mem
+
+painter_image_handle_t qp_load_image_mem(const void *buffer) {
+ qp_dprintf("qp_load_image_mem: entry\n");
+ qgf_image_handle_t *image = NULL;
+
+ // Find a free slot
+ for (int i = 0; i < QUANTUM_PAINTER_NUM_IMAGES; ++i) {
+ if (!image_descriptors[i].validate_ok) {
+ image = &image_descriptors[i];
+ break;
+ }
+ }
+
+ // Drop out if not found
+ if (!image) {
+ qp_dprintf("qp_load_image_mem: fail (no free slot)\n");
+ return NULL;
+ }
+
+ // Assume we can read the graphics descriptor
+ image->mem_stream = qp_make_memory_stream((void *)buffer, sizeof(qgf_graphics_descriptor_v1_t));
+
+ // Update the length of the stream to match, and rewind to the start
+ image->mem_stream.length = qgf_get_total_size(&image->stream);
+ image->mem_stream.position = 0;
+
+ // Now that we know the length, validate the input data
+ if (!qgf_validate_stream(&image->stream)) {
+ qp_dprintf("qp_load_image_mem: fail (failed validation)\n");
+ return NULL;
+ }
+
+ // Fill out the QP image descriptor
+ qgf_read_graphics_descriptor(&image->stream, &image->base.width, &image->base.height, &image->base.frame_count, NULL);
+
+ // Validation success, we can return the handle
+ image->validate_ok = true;
+ qp_dprintf("qp_load_image_mem: ok\n");
+ return (painter_image_handle_t)image;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_close_image
+
+bool qp_close_image(painter_image_handle_t image) {
+ qgf_image_handle_t *qgf_image = (qgf_image_handle_t *)image;
+ if (!qgf_image->validate_ok) {
+ qp_dprintf("qp_close_image: fail (invalid image)\n");
+ return false;
+ }
+
+ // Free up this image for use elsewhere.
+ qgf_image->validate_ok = false;
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_drawimage
+
+bool qp_drawimage(painter_device_t device, uint16_t x, uint16_t y, painter_image_handle_t image) {
+ return qp_drawimage_recolor(device, x, y, image, 0, 0, 255, 0, 0, 0);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_drawimage_recolor
+
+typedef struct qgf_frame_info_t {
+ painter_compression_t compression_scheme;
+ uint8_t bpp;
+ bool has_palette;
+ bool is_delta;
+ uint16_t left;
+ uint16_t top;
+ uint16_t right;
+ uint16_t bottom;
+ uint16_t delay;
+} qgf_frame_info_t;
+
+static bool qp_drawimage_prepare_frame_for_stream_read(painter_device_t device, qgf_image_handle_t *qgf_image, uint16_t frame_number, qp_pixel_t fg_hsv888, qp_pixel_t bg_hsv888, qgf_frame_info_t *info) {
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+
+ // Drop out if we can't actually place the data we read out anywhere
+ if (!info) {
+ qp_dprintf("Failed to prepare stream for read, output info buffer unavailable\n");
+ return false;
+ }
+
+ // Seek to the frame
+ qgf_seek_to_frame_descriptor(&qgf_image->stream, frame_number);
+
+ // Read the frame descriptor
+ qgf_frame_v1_t frame_descriptor;
+ if (qp_stream_read(&frame_descriptor, sizeof(qgf_frame_v1_t), 1, &qgf_image->stream) != 1) {
+ qp_dprintf("Failed to read frame_descriptor, expected length was not %d\n", (int)sizeof(qgf_frame_v1_t));
+ return false;
+ }
+
+ // Parse out the frame info
+ if (!qgf_parse_frame_descriptor(&frame_descriptor, &info->bpp, &info->has_palette, &info->is_delta, &info->compression_scheme, &info->delay)) {
+ return false;
+ }
+
+ // Ensure we aren't reusing any palette
+ qp_internal_invalidate_palette();
+
+ if (!qp_internal_bpp_capable(info->bpp)) {
+ qp_dprintf("qp_drawimage_recolor: fail (image bpp too high (%d), check QUANTUM_PAINTER_SUPPORTS_256_PALETTE)\n", (int)info->bpp);
+ qp_comms_stop(device);
+ return false;
+ }
+
+ // Handle palette if needed
+ const uint16_t palette_entries = 1u << info->bpp;
+ bool needs_pixconvert = false;
+ if (info->has_palette) {
+ // Load the palette from the stream
+ if (!qp_internal_load_qgf_palette((qp_stream_t *)&qgf_image->stream, info->bpp)) {
+ return false;
+ }
+
+ needs_pixconvert = true;
+ } else {
+ // Interpolate from fg/bg
+ needs_pixconvert = qp_internal_interpolate_palette(fg_hsv888, bg_hsv888, palette_entries);
+ }
+
+ if (needs_pixconvert) {
+ // Convert the palette to native format
+ if (!driver->driver_vtable->palette_convert(device, palette_entries, qp_internal_global_pixel_lookup_table)) {
+ qp_dprintf("qp_drawimage_recolor: fail (could not convert pixels to native)\n");
+ qp_comms_stop(device);
+ return false;
+ }
+ }
+
+ // Handle delta if needed
+ if (info->is_delta) {
+ qgf_delta_v1_t delta_descriptor;
+ if (qp_stream_read(&delta_descriptor, sizeof(qgf_delta_v1_t), 1, &qgf_image->stream) != 1) {
+ qp_dprintf("Failed to read delta_descriptor, expected length was not %d\n", (int)sizeof(qgf_delta_v1_t));
+ return false;
+ }
+
+ info->left = delta_descriptor.left;
+ info->top = delta_descriptor.top;
+ info->right = delta_descriptor.right;
+ info->bottom = delta_descriptor.bottom;
+ }
+
+ // Read the data block
+ qgf_data_v1_t data_descriptor;
+ if (qp_stream_read(&data_descriptor, sizeof(qgf_data_v1_t), 1, &qgf_image->stream) != 1) {
+ qp_dprintf("Failed to read data_descriptor, expected length was not %d\n", (int)sizeof(qgf_data_v1_t));
+ return false;
+ }
+
+ // Stream is now at the point of being able to read pixdata
+ return true;
+}
+
+static bool qp_drawimage_recolor_impl(painter_device_t device, uint16_t x, uint16_t y, painter_image_handle_t image, int frame_number, qgf_frame_info_t *frame_info, qp_pixel_t fg_hsv888, qp_pixel_t bg_hsv888) {
+ qp_dprintf("qp_drawimage_recolor: entry\n");
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_drawimage_recolor: fail (validation_ok == false)\n");
+ return false;
+ }
+
+ qgf_image_handle_t *qgf_image = (qgf_image_handle_t *)image;
+ if (!qgf_image->validate_ok) {
+ qp_dprintf("qp_drawimage_recolor: fail (invalid image)\n");
+ return false;
+ }
+
+ // Read the frame info
+ if (!qp_drawimage_prepare_frame_for_stream_read(device, qgf_image, frame_number, fg_hsv888, bg_hsv888, frame_info)) {
+ qp_dprintf("qp_drawimage_recolor: fail (could not read frame %d)\n", frame_number);
+ return false;
+ }
+
+ if (!qp_comms_start(device)) {
+ qp_dprintf("qp_drawimage_recolor: fail (could not start comms)\n");
+ return false;
+ }
+
+ uint16_t l, t, r, b;
+ if (frame_info->is_delta) {
+ l = x + frame_info->left;
+ t = y + frame_info->top;
+ r = x + frame_info->right - 1;
+ b = y + frame_info->bottom - 1;
+ } else {
+ l = x;
+ t = y;
+ r = x + image->width - 1;
+ b = y + image->height - 1;
+ }
+ uint32_t pixel_count = ((uint32_t)(r - l + 1)) * (b - t + 1);
+
+ // Configure where we're going to be rendering to
+ if (!driver->driver_vtable->viewport(device, l, t, r, b)) {
+ qp_dprintf("qp_drawimage_recolor: fail (could not set viewport)\n");
+ qp_comms_stop(device);
+ return false;
+ }
+
+ // Set up the input state
+ struct qp_internal_byte_input_state input_state = {.device = device, .src_stream = &qgf_image->stream};
+ qp_internal_byte_input_callback input_callback = qp_internal_prepare_input_state(&input_state, frame_info->compression_scheme);
+ if (input_callback == NULL) {
+ qp_dprintf("qp_drawimage_recolor: fail (invalid image compression scheme)\n");
+ qp_comms_stop(device);
+ return false;
+ }
+
+ // Set up the output state
+ struct qp_internal_pixel_output_state output_state = {.device = device, .pixel_write_pos = 0, .max_pixels = qp_internal_num_pixels_in_buffer(device)};
+
+ // Decode the pixel data and stream to the display
+ bool ret = qp_internal_decode_palette(device, pixel_count, frame_info->bpp, input_callback, &input_state, qp_internal_global_pixel_lookup_table, qp_internal_pixel_appender, &output_state);
+
+ // Any leftovers need transmission as well.
+ if (ret && output_state.pixel_write_pos > 0) {
+ ret &= driver->driver_vtable->pixdata(device, qp_internal_global_pixdata_buffer, output_state.pixel_write_pos);
+ }
+
+ qp_dprintf("qp_drawimage_recolor: %s\n", ret ? "ok" : "fail");
+ qp_comms_stop(device);
+ return ret;
+}
+
+bool qp_drawimage_recolor(painter_device_t device, uint16_t x, uint16_t y, painter_image_handle_t image, uint8_t hue_fg, uint8_t sat_fg, uint8_t val_fg, uint8_t hue_bg, uint8_t sat_bg, uint8_t val_bg) {
+ qgf_frame_info_t frame_info = {0};
+ qp_pixel_t fg_hsv888 = {.hsv888 = {.h = hue_fg, .s = sat_fg, .v = val_fg}};
+ qp_pixel_t bg_hsv888 = {.hsv888 = {.h = hue_bg, .s = sat_bg, .v = val_bg}};
+ return qp_drawimage_recolor_impl(device, x, y, image, 0, &frame_info, fg_hsv888, bg_hsv888);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_animate
+
+deferred_token qp_animate(painter_device_t device, uint16_t x, uint16_t y, painter_image_handle_t image) {
+ return qp_animate_recolor(device, x, y, image, 0, 0, 255, 0, 0, 0);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_animate_recolor
+
+typedef struct animation_state_t {
+ painter_device_t device;
+ uint16_t x;
+ uint16_t y;
+ painter_image_handle_t image;
+ qp_pixel_t fg_hsv888;
+ qp_pixel_t bg_hsv888;
+ uint16_t frame_number;
+ deferred_token defer_token;
+} animation_state_t;
+
+static deferred_executor_t animation_executors[QUANTUM_PAINTER_CONCURRENT_ANIMATIONS] = {0};
+static animation_state_t animation_states[QUANTUM_PAINTER_CONCURRENT_ANIMATIONS] = {0};
+
+static deferred_token qp_render_animation_state(animation_state_t *state, uint16_t *delay_ms) {
+ qgf_frame_info_t frame_info = {0};
+ qp_dprintf("qp_render_animation_state: entry (frame #%d)\n", (int)state->frame_number);
+ bool ret = qp_drawimage_recolor_impl(state->device, state->x, state->y, state->image, state->frame_number, &frame_info, state->fg_hsv888, state->bg_hsv888);
+ if (ret) {
+ ++state->frame_number;
+ if (state->frame_number >= state->image->frame_count) {
+ state->frame_number = 0;
+ }
+ *delay_ms = frame_info.delay;
+ }
+ qp_dprintf("qp_render_animation_state: %s (delay %dms)\n", ret ? "ok" : "fail", (int)(*delay_ms));
+ return ret;
+}
+
+static uint32_t animation_callback(uint32_t trigger_time, void *cb_arg) {
+ animation_state_t *state = (animation_state_t *)cb_arg;
+ uint16_t delay_ms;
+ bool ret = qp_render_animation_state(state, &delay_ms);
+ if (!ret) {
+ // Setting the device to NULL clears the animation slot
+ state->device = NULL;
+ }
+ // If we're successful, keep animating -- returning 0 cancels the deferred execution
+ return ret ? delay_ms : 0;
+}
+
+deferred_token qp_animate_recolor(painter_device_t device, uint16_t x, uint16_t y, painter_image_handle_t image, uint8_t hue_fg, uint8_t sat_fg, uint8_t val_fg, uint8_t hue_bg, uint8_t sat_bg, uint8_t val_bg) {
+ qp_dprintf("qp_animate_recolor: entry\n");
+
+ animation_state_t *anim_state = NULL;
+ for (int i = 0; i < QUANTUM_PAINTER_CONCURRENT_ANIMATIONS; ++i) {
+ if (animation_states[i].device == NULL) {
+ anim_state = &animation_states[i];
+ break;
+ }
+ }
+
+ if (!anim_state) {
+ qp_dprintf("qp_animate_recolor: fail (could not find free animation slot)\n");
+ return INVALID_DEFERRED_TOKEN;
+ }
+
+ // Prepare the animation state
+ anim_state->device = device;
+ anim_state->x = x;
+ anim_state->y = y;
+ anim_state->image = image;
+ anim_state->fg_hsv888 = (qp_pixel_t){.hsv888 = {.h = hue_fg, .s = sat_fg, .v = val_fg}};
+ anim_state->bg_hsv888 = (qp_pixel_t){.hsv888 = {.h = hue_bg, .s = sat_bg, .v = val_bg}};
+ anim_state->frame_number = 0;
+
+ // Draw the first frame
+ uint16_t delay_ms;
+ if (!qp_render_animation_state(anim_state, &delay_ms)) {
+ anim_state->device = NULL; // disregard the allocated animation slot
+ qp_dprintf("qp_animate_recolor: fail (could not render first frame)\n");
+ return INVALID_DEFERRED_TOKEN;
+ }
+
+ // Set up the timer
+ anim_state->defer_token = defer_exec_advanced(animation_executors, QUANTUM_PAINTER_CONCURRENT_ANIMATIONS, delay_ms, animation_callback, anim_state);
+ if (anim_state->defer_token == INVALID_DEFERRED_TOKEN) {
+ anim_state->device = NULL; // disregard the allocated animation slot
+ qp_dprintf("qp_animate_recolor: fail (could not set up animation executor)\n");
+ return INVALID_DEFERRED_TOKEN;
+ }
+
+ qp_dprintf("qp_animate_recolor: ok (deferred token = %d)\n", (int)anim_state->defer_token);
+ return anim_state->defer_token;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_stop_animation
+
+void qp_stop_animation(deferred_token anim_token) {
+ for (int i = 0; i < QUANTUM_PAINTER_CONCURRENT_ANIMATIONS; ++i) {
+ if (animation_states[i].defer_token == anim_token) {
+ cancel_deferred_exec_advanced(animation_executors, QUANTUM_PAINTER_CONCURRENT_ANIMATIONS, anim_token);
+ animation_states[i].device = NULL;
+ return;
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter Core API: qp_internal_animation_tick
+
+void qp_internal_animation_tick(void) {
+ static uint32_t last_anim_exec = 0;
+ deferred_exec_advanced_task(animation_executors, QUANTUM_PAINTER_CONCURRENT_ANIMATIONS, &last_anim_exec);
+}
diff --git a/quantum/painter/qp_draw_text.c b/quantum/painter/qp_draw_text.c
new file mode 100644
index 0000000000..f99e082cad
--- /dev/null
+++ b/quantum/painter/qp_draw_text.c
@@ -0,0 +1,444 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <quantum.h>
+#include <utf8.h>
+
+#include "qp_internal.h"
+#include "qp_draw.h"
+#include "qp_comms.h"
+#include "qff.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// QFF font handles
+
+typedef struct qff_font_handle_t {
+ painter_font_desc_t base;
+ bool validate_ok;
+ bool has_ascii_table;
+ uint16_t num_unicode_glyphs;
+ uint8_t bpp;
+ bool has_palette;
+ painter_compression_t compression_scheme;
+ union {
+ qp_stream_t stream;
+ qp_memory_stream_t mem_stream;
+#ifdef QP_STREAM_HAS_FILE_IO
+ qp_file_stream_t file_stream;
+#endif // QP_STREAM_HAS_FILE_IO
+ };
+#if QUANTUM_PAINTER_LOAD_FONTS_TO_RAM
+ bool owns_buffer;
+ void *buffer;
+#endif // QUANTUM_PAINTER_LOAD_FONTS_TO_RAM
+} qff_font_handle_t;
+
+static qff_font_handle_t font_descriptors[QUANTUM_PAINTER_NUM_FONTS] = {0};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_load_font_mem
+
+painter_font_handle_t qp_load_font_mem(const void *buffer) {
+ qp_dprintf("qp_load_font_mem: entry\n");
+ qff_font_handle_t *font = NULL;
+
+ // Find a free slot
+ for (int i = 0; i < QUANTUM_PAINTER_NUM_FONTS; ++i) {
+ if (!font_descriptors[i].validate_ok) {
+ font = &font_descriptors[i];
+ break;
+ }
+ }
+
+ // Drop out if not found
+ if (!font) {
+ qp_dprintf("qp_load_font_mem: fail (no free slot)\n");
+ return NULL;
+ }
+
+ // Assume we can read the graphics descriptor
+ font->mem_stream = qp_make_memory_stream((void *)buffer, sizeof(qff_font_descriptor_v1_t));
+
+ // Update the length of the stream to match, and rewind to the start
+ font->mem_stream.length = qff_get_total_size(&font->stream);
+ font->mem_stream.position = 0;
+
+ // Now that we know the length, validate the input data
+ if (!qff_validate_stream(&font->stream)) {
+ qp_dprintf("qp_load_font_mem: fail (failed validation)\n");
+ return NULL;
+ }
+
+#if QUANTUM_PAINTER_LOAD_FONTS_TO_RAM
+ // Clear out any existing data
+ font->owns_buffer = false;
+ font->buffer = NULL;
+
+ void *ram_buffer = malloc(font->mem_stream.length);
+ if (ram_buffer == NULL) {
+ qp_dprintf("qp_load_font_mem: could not allocate enough RAM for font, falling back to original\n");
+ } else {
+ do {
+ // Copy the data into RAM
+ if (qp_stream_read(ram_buffer, 1, font->mem_stream.length, &font->mem_stream) != font->mem_stream.length) {
+ qp_dprintf("qp_load_font_mem: could not copy from flash to RAM, falling back to original\n");
+ break;
+ }
+
+ // Create the new stream with the new buffer
+ font->buffer = ram_buffer;
+ font->owns_buffer = true;
+ font->mem_stream = qp_make_memory_stream(font->buffer, font->mem_stream.length);
+ } while (0);
+ }
+
+ // Free the buffer if we were unable to recreate the RAM copy.
+ if (ram_buffer != NULL && !font->owns_buffer) {
+ free(ram_buffer);
+ }
+#endif // QUANTUM_PAINTER_LOAD_FONTS_TO_RAM
+
+ // Read the info (parsing already successful above, no need to check return value)
+ qff_read_font_descriptor(&font->stream, &font->base.line_height, &font->has_ascii_table, &font->num_unicode_glyphs, &font->bpp, &font->has_palette, &font->compression_scheme, NULL);
+
+ if (!qp_internal_bpp_capable(font->bpp)) {
+ qp_dprintf("qp_load_font_mem: fail (image bpp too high (%d), check QUANTUM_PAINTER_SUPPORTS_256_PALETTE)\n", (int)font->bpp);
+ qp_close_font((painter_font_handle_t)font);
+ return NULL;
+ }
+
+ // Validation success, we can return the handle
+ font->validate_ok = true;
+ qp_dprintf("qp_load_font_mem: ok\n");
+ return (painter_font_handle_t)font;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_close_font
+
+bool qp_close_font(painter_font_handle_t font) {
+ qff_font_handle_t *qff_font = (qff_font_handle_t *)font;
+ if (!qff_font->validate_ok) {
+ qp_dprintf("qp_close_font: fail (invalid font)\n");
+ return false;
+ }
+
+#if QUANTUM_PAINTER_LOAD_FONTS_TO_RAM
+ // Nuke the buffer, if required
+ if (qff_font->owns_buffer) {
+ free(qff_font->buffer);
+ qff_font->buffer = NULL;
+ qff_font->owns_buffer = false;
+ }
+#endif // QUANTUM_PAINTER_LOAD_FONTS_TO_RAM
+
+ // Free up this font for use elsewhere.
+ qff_font->validate_ok = false;
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Helpers
+
+// Callback to be invoked for each codepoint detected in the UTF8 input string
+typedef bool (*code_point_handler)(qff_font_handle_t *qff_font, uint32_t code_point, uint8_t width, uint8_t height, void *cb_arg);
+
+// Helper that sets up the palette (if required) and returns the offset in the stream that the data starts
+static inline bool qp_drawtext_prepare_font_for_render(painter_device_t device, qff_font_handle_t *qff_font, qp_pixel_t fg_hsv888, qp_pixel_t bg_hsv888, uint32_t *data_offset) {
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+
+ // Drop out if we can't actually place the data we read out anywhere
+ if (!data_offset) {
+ qp_dprintf("Failed to prepare stream for read, output info buffer unavailable\n");
+ return false;
+ }
+
+ // Work out where we're reading from
+ uint32_t offset = sizeof(qff_font_descriptor_v1_t);
+ if (qff_font->has_ascii_table) {
+ offset += sizeof(qff_ascii_glyph_table_v1_t);
+ }
+ if (qff_font->num_unicode_glyphs > 0) {
+ offset += sizeof(qff_unicode_glyph_table_v1_t) + (qff_font->num_unicode_glyphs * 6);
+ }
+
+ // Handle palette if needed
+ const uint16_t palette_entries = 1u << qff_font->bpp;
+ bool needs_pixconvert = false;
+ if (qff_font->has_palette) {
+ // If this font has a palette, we need to read it out and set up the pixel lookup table
+ qp_stream_setpos(&qff_font->stream, offset);
+ if (!qp_internal_load_qgf_palette(&qff_font->stream, qff_font->bpp)) {
+ return false;
+ }
+
+ // Skip this block, as far as offset calculations go
+ offset += sizeof(qgf_palette_v1_t) + (palette_entries * 3);
+ needs_pixconvert = true;
+ } else {
+ // Interpolate from fg/bg
+ int16_t palette_entries = 1 << qff_font->bpp;
+ needs_pixconvert = qp_internal_interpolate_palette(fg_hsv888, bg_hsv888, palette_entries);
+ }
+
+ if (needs_pixconvert) {
+ // Convert the palette to native format
+ if (!driver->driver_vtable->palette_convert(device, palette_entries, qp_internal_global_pixel_lookup_table)) {
+ qp_dprintf("qp_drawtext_recolor: fail (could not convert pixels to native)\n");
+ qp_comms_stop(device);
+ return false;
+ }
+ }
+
+ *data_offset = offset;
+ return true;
+}
+
+static inline bool qp_drawtext_prepare_glyph_for_render(qff_font_handle_t *qff_font, uint32_t code_point, uint8_t *width) {
+ if (code_point >= 0x20 && code_point < 0x7F && qff_font->has_ascii_table) {
+ // Do ascii table
+ qff_ascii_glyph_v1_t glyph_info;
+ uint32_t glyph_info_offset = sizeof(qff_font_descriptor_v1_t) // Skip the font descriptor
+ + sizeof(qgf_block_header_v1_t) // Skip the ascii table header
+ + (code_point - 0x20) * sizeof(qff_ascii_glyph_v1_t); // Jump direct to the data offset based on the glyph index
+ if (qp_stream_setpos(&qff_font->stream, glyph_info_offset) < 0) {
+ qp_dprintf("Failed to set stream position while reading ascii glyph info\n");
+ return false;
+ }
+
+ if (qp_stream_read(&glyph_info, sizeof(qff_ascii_glyph_v1_t), 1, &qff_font->stream) != 1) {
+ qp_dprintf("Failed to read glyph info\n");
+ return false;
+ }
+
+ uint8_t glyph_width = (uint8_t)(glyph_info.value & QFF_GLYPH_WIDTH_MASK);
+ uint32_t glyph_offset = ((glyph_info.value & QFF_GLYPH_OFFSET_MASK) >> QFF_GLYPH_WIDTH_BITS);
+ uint32_t data_offset = sizeof(qff_font_descriptor_v1_t) // Skip the font descriptor
+ + sizeof(qff_ascii_glyph_table_v1_t) // Skip the ascii table
+ + (qff_font->num_unicode_glyphs > 0 ? (sizeof(qff_unicode_glyph_table_v1_t) + (qff_font->num_unicode_glyphs * sizeof(qff_unicode_glyph_v1_t))) : 0) // Skip the unicode table
+ + (qff_font->has_palette ? (sizeof(qgf_palette_v1_t) + ((1 << qff_font->bpp) * sizeof(qgf_palette_entry_v1_t))) : 0) // Skip the palette
+ + sizeof(qgf_block_header_v1_t) // Skip the data block header
+ + glyph_offset; // Jump to the specified glyph offset
+
+ if (qp_stream_setpos(&qff_font->stream, data_offset) < 0) {
+ qp_dprintf("Failed to set stream position while preparing ascii glyph data\n");
+ return false;
+ }
+
+ *width = glyph_width;
+ return true;
+ } else {
+ // Do unicode table, which may include singular ascii glyphs if full ascii table isn't specified
+ uint32_t glyph_info_offset = sizeof(qff_font_descriptor_v1_t) // Skip the font descriptor
+ + (qff_font->has_ascii_table ? sizeof(qff_ascii_glyph_table_v1_t) : 0) // Skip the ascii table
+ + sizeof(qgf_block_header_v1_t); // Skip the unicode block header
+
+ if (qp_stream_setpos(&qff_font->stream, glyph_info_offset) < 0) {
+ qp_dprintf("Failed to set stream position while preparing glyph data\n");
+ return false;
+ }
+
+ qff_unicode_glyph_v1_t glyph_info;
+ for (uint16_t i = 0; i < qff_font->num_unicode_glyphs; ++i) {
+ if (qp_stream_read(&glyph_info, sizeof(qff_unicode_glyph_v1_t), 1, &qff_font->stream) != 1) {
+ qp_dprintf("Failed to set stream position while reading unicode glyph info\n");
+ return false;
+ }
+
+ if (glyph_info.code_point == code_point) {
+ uint8_t glyph_width = (uint8_t)(glyph_info.value & QFF_GLYPH_WIDTH_MASK);
+ uint32_t glyph_offset = ((glyph_info.value & QFF_GLYPH_OFFSET_MASK) >> QFF_GLYPH_WIDTH_BITS);
+ uint32_t data_offset = sizeof(qff_font_descriptor_v1_t) // Skip the font descriptor
+ + sizeof(qff_ascii_glyph_table_v1_t) // Skip the ascii table
+ + (qff_font->num_unicode_glyphs > 0 ? (sizeof(qff_unicode_glyph_table_v1_t) + (qff_font->num_unicode_glyphs * sizeof(qff_unicode_glyph_v1_t))) : 0) // Skip the unicode table
+ + (qff_font->has_palette ? (sizeof(qgf_palette_v1_t) + ((1 << qff_font->bpp) * sizeof(qgf_palette_entry_v1_t))) : 0) // Skip the palette
+ + sizeof(qgf_block_header_v1_t) // Skip the data block header
+ + glyph_offset; // Jump to the specified glyph offset
+
+ if (qp_stream_setpos(&qff_font->stream, data_offset) < 0) {
+ qp_dprintf("Failed to set stream position while preparing unicode glyph data\n");
+ return false;
+ }
+
+ *width = glyph_width;
+ return true;
+ }
+ }
+
+ // Not found
+ qp_dprintf("Failed to find unicode glyph info\n");
+ return false;
+ }
+ return false;
+}
+
+// Function to iterate over each UTF8 codepoint, invoking the callback for each decoded glyph
+static inline bool qp_iterate_code_points(qff_font_handle_t *qff_font, const char *str, code_point_handler handler, void *cb_arg) {
+ while (*str) {
+ int32_t code_point = 0;
+ str = decode_utf8(str, &code_point);
+ if (code_point < 0) {
+ qp_dprintf("Invalid unicode code point decoded. Cannot render.\n");
+ return false;
+ }
+
+ uint8_t width;
+ if (!qp_drawtext_prepare_glyph_for_render(qff_font, code_point, &width)) {
+ qp_dprintf("Failed to prepare glyph for rendering.\n");
+ return false;
+ }
+
+ if (!handler(qff_font, code_point, width, qff_font->base.line_height, cb_arg)) {
+ qp_dprintf("Failed to execute glyph handler.\n");
+ return false;
+ }
+ }
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// String width calculation
+
+// Callback state
+struct code_point_iter_calcwidth_state {
+ int16_t width;
+};
+
+// Codepoint handler callback: width calc
+static inline bool qp_font_code_point_handler_calcwidth(qff_font_handle_t *qff_font, uint32_t code_point, uint8_t width, uint8_t height, void *cb_arg) {
+ struct code_point_iter_calcwidth_state *state = (struct code_point_iter_calcwidth_state *)cb_arg;
+
+ // Increment the overall width by this glyph's width
+ state->width += width;
+
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// String drawing implementation
+
+// Callback state
+struct code_point_iter_drawglyph_state {
+ painter_device_t device;
+ int16_t xpos;
+ int16_t ypos;
+ qp_internal_byte_input_callback input_callback;
+ struct qp_internal_byte_input_state * input_state;
+ struct qp_internal_pixel_output_state *output_state;
+};
+
+// Codepoint handler callback: drawing
+static inline bool qp_font_code_point_handler_drawglyph(qff_font_handle_t *qff_font, uint32_t code_point, uint8_t width, uint8_t height, void *cb_arg) {
+ struct code_point_iter_drawglyph_state *state = (struct code_point_iter_drawglyph_state *)cb_arg;
+ struct painter_driver_t * driver = (struct painter_driver_t *)state->device;
+
+ // Reset the input state's RLE mode -- the stream should already be correctly positioned by qp_iterate_code_points()
+ state->input_state->rle.mode = MARKER_BYTE; // ignored if not using RLE
+
+ // Reset the output state
+ state->output_state->pixel_write_pos = 0;
+
+ // Configure where we're going to be rendering to
+ driver->driver_vtable->viewport(state->device, state->xpos, state->ypos, state->xpos + width - 1, state->ypos + height - 1);
+
+ // Move the x-position for the next glyph
+ state->xpos += width;
+
+ // Decode the pixel data for the glyph
+ uint32_t pixel_count = ((uint32_t)width) * height;
+ bool ret = qp_internal_decode_palette(state->device, pixel_count, qff_font->bpp, state->input_callback, state->input_state, qp_internal_global_pixel_lookup_table, qp_internal_pixel_appender, state->output_state);
+
+ // Any leftovers need transmission as well.
+ if (ret && state->output_state->pixel_write_pos > 0) {
+ ret &= driver->driver_vtable->pixdata(state->device, qp_internal_global_pixdata_buffer, state->output_state->pixel_write_pos);
+ }
+
+ return ret;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_textwidth
+
+int16_t qp_textwidth(painter_font_handle_t font, const char *str) {
+ qff_font_handle_t *qff_font = (qff_font_handle_t *)font;
+ if (!qff_font->validate_ok) {
+ qp_dprintf("qp_textwidth: fail (invalid font)\n");
+ return false;
+ }
+
+ // Create the codepoint iterator state
+ struct code_point_iter_calcwidth_state state = {.width = 0};
+ // Iterate each codepoint, return the calculated width if successful.
+ return qp_iterate_code_points(qff_font, str, qp_font_code_point_handler_calcwidth, &state) ? state.width : 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_drawtext
+
+int16_t qp_drawtext(painter_device_t device, uint16_t x, uint16_t y, painter_font_handle_t font, const char *str) {
+ // Offload to the recolor variant, substituting fg=white bg=black.
+ // Traditional LCDs with those colors will need to manually invoke qp_drawtext_recolor with the colors reversed.
+ return qp_drawtext_recolor(device, x, y, font, str, 0, 0, 255, 0, 0, 0);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter External API: qp_drawtext_recolor
+
+int16_t qp_drawtext_recolor(painter_device_t device, uint16_t x, uint16_t y, painter_font_handle_t font, const char *str, uint8_t hue_fg, uint8_t sat_fg, uint8_t val_fg, uint8_t hue_bg, uint8_t sat_bg, uint8_t val_bg) {
+ qp_dprintf("qp_drawtext_recolor: entry\n");
+ struct painter_driver_t *driver = (struct painter_driver_t *)device;
+ if (!driver->validate_ok) {
+ qp_dprintf("qp_drawtext_recolor: fail (validation_ok == false)\n");
+ return 0;
+ }
+
+ qff_font_handle_t *qff_font = (qff_font_handle_t *)font;
+ if (!qff_font->validate_ok) {
+ qp_dprintf("qp_drawtext_recolor: fail (invalid font)\n");
+ return false;
+ }
+
+ if (!qp_comms_start(device)) {
+ qp_dprintf("qp_drawtext_recolor: fail (could not start comms)\n");
+ return 0;
+ }
+
+ // Set up the byte input state and input callback
+ struct qp_internal_byte_input_state input_state = {.device = device, .src_stream = &qff_font->stream};
+ qp_internal_byte_input_callback input_callback = qp_internal_prepare_input_state(&input_state, qff_font->compression_scheme);
+ if (input_callback == NULL) {
+ qp_dprintf("qp_drawtext_recolor: fail (invalid font compression scheme)\n");
+ qp_comms_stop(device);
+ return false;
+ }
+
+ // Set up the pixel output state
+ struct qp_internal_pixel_output_state output_state = {.device = device, .pixel_write_pos = 0, .max_pixels = qp_internal_num_pixels_in_buffer(device)};
+
+ // Set up the codepoint iteration state
+ struct code_point_iter_drawglyph_state state = {// Common
+ .device = device,
+ .xpos = x,
+ .ypos = y,
+ // Input
+ .input_callback = input_callback,
+ .input_state = &input_state,
+ // Output
+ .output_state = &output_state};
+
+ qp_pixel_t fg_hsv888 = {.hsv888 = {.h = hue_fg, .s = sat_fg, .v = val_fg}};
+ qp_pixel_t bg_hsv888 = {.hsv888 = {.h = hue_bg, .s = sat_bg, .v = val_bg}};
+ uint32_t data_offset;
+ if (!qp_drawtext_prepare_font_for_render(driver, qff_font, fg_hsv888, bg_hsv888, &data_offset)) {
+ qp_dprintf("qp_drawtext_recolor: fail (failed to prepare font for rendering)\n");
+ qp_comms_stop(device);
+ return false;
+ }
+
+ // Iterate the codepoints with the drawglyph callback
+ bool ret = qp_iterate_code_points(qff_font, str, qp_font_code_point_handler_drawglyph, &state);
+
+ qp_dprintf("qp_drawtext_recolor: %s\n", ret ? "ok" : "fail");
+ qp_comms_stop(device);
+ return ret ? (state.xpos - x) : 0;
+}
diff --git a/quantum/painter/qp_internal.h b/quantum/painter/qp_internal.h
new file mode 100644
index 0000000000..e7a6d113c5
--- /dev/null
+++ b/quantum/painter/qp_internal.h
@@ -0,0 +1,33 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "quantum.h"
+#include "qp.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Helpers
+
+// Mark certain types that there should be no padding bytes between members.
+#define QP_PACKED __attribute__((packed))
+
+// Min/max defines
+#define QP_MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
+#define QP_MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
+
+#ifdef QUANTUM_PAINTER_DEBUG
+# include <debug.h>
+# include <print.h>
+# define qp_dprintf(...) dprintf(__VA_ARGS__)
+#else
+# define qp_dprintf(...) \
+ do { \
+ } while (0)
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Specific internal definitions
+
+#include <qp_internal_formats.h>
+#include <qp_internal_driver.h>
diff --git a/quantum/painter/qp_internal_driver.h b/quantum/painter/qp_internal_driver.h
new file mode 100644
index 0000000000..9e9d6bc848
--- /dev/null
+++ b/quantum/painter/qp_internal_driver.h
@@ -0,0 +1,82 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "qp_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Driver callbacks
+
+typedef bool (*painter_driver_init_func)(painter_device_t device, painter_rotation_t rotation);
+typedef bool (*painter_driver_power_func)(painter_device_t device, bool power_on);
+typedef bool (*painter_driver_clear_func)(painter_device_t device);
+typedef bool (*painter_driver_flush_func)(painter_device_t device);
+typedef bool (*painter_driver_viewport_func)(painter_device_t device, uint16_t left, uint16_t top, uint16_t right, uint16_t bottom);
+typedef bool (*painter_driver_pixdata_func)(painter_device_t device, const void *pixel_data, uint32_t native_pixel_count);
+typedef bool (*painter_driver_convert_palette_func)(painter_device_t device, int16_t palette_size, qp_pixel_t *palette);
+typedef bool (*painter_driver_append_pixels)(painter_device_t device, uint8_t *target_buffer, qp_pixel_t *palette, uint32_t pixel_offset, uint32_t pixel_count, uint8_t *palette_indices);
+
+// Driver vtable definition
+struct painter_driver_vtable_t {
+ painter_driver_init_func init;
+ painter_driver_power_func power;
+ painter_driver_clear_func clear;
+ painter_driver_flush_func flush;
+ painter_driver_viewport_func viewport;
+ painter_driver_pixdata_func pixdata;
+ painter_driver_convert_palette_func palette_convert;
+ painter_driver_append_pixels append_pixels;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Comms callbacks
+
+typedef bool (*painter_driver_comms_init_func)(painter_device_t device);
+typedef bool (*painter_driver_comms_start_func)(painter_device_t device);
+typedef void (*painter_driver_comms_stop_func)(painter_device_t device);
+typedef uint32_t (*painter_driver_comms_send_func)(painter_device_t device, const void *data, uint32_t byte_count);
+
+struct painter_comms_vtable_t {
+ painter_driver_comms_init_func comms_init;
+ painter_driver_comms_start_func comms_start;
+ painter_driver_comms_stop_func comms_stop;
+ painter_driver_comms_send_func comms_send;
+};
+
+typedef void (*painter_driver_comms_send_command_func)(painter_device_t device, uint8_t cmd);
+typedef void (*painter_driver_comms_bulk_command_sequence)(painter_device_t device, const uint8_t *sequence, size_t sequence_len);
+
+struct painter_comms_with_command_vtable_t {
+ struct painter_comms_vtable_t base; // must be first, so this object can be cast from the painter_comms_vtable_t* type
+ painter_driver_comms_send_command_func send_command;
+ painter_driver_comms_bulk_command_sequence bulk_command_sequence;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Driver base definition
+
+struct painter_driver_t {
+ const struct painter_driver_vtable_t *driver_vtable;
+ const struct painter_comms_vtable_t * comms_vtable;
+
+ // Flag signifying if validation was successful
+ bool validate_ok;
+
+ // Panel geometry
+ uint16_t panel_width;
+ uint16_t panel_height;
+
+ // Target drawing rotation
+ painter_rotation_t rotation;
+
+ // Automated offsets for setting viewport
+ uint16_t offset_x;
+ uint16_t offset_y;
+
+ // Number of bits per pixel, used for determining how many pixels can be sent during a transmission of the pixdata buffer
+ uint8_t native_bits_per_pixel;
+
+ // Comms config pointer -- needs to point to an appropriate comms config if the comms driver requires it.
+ void *comms_config;
+};
diff --git a/quantum/painter/qp_internal_formats.h b/quantum/painter/qp_internal_formats.h
new file mode 100644
index 0000000000..a4a86f0345
--- /dev/null
+++ b/quantum/painter/qp_internal_formats.h
@@ -0,0 +1,49 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "qp_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter pixel formats
+
+// Datatype containing a pixel's color. The internal member used is dependent on the external context.
+typedef union QP_PACKED qp_pixel_t {
+ uint8_t mono;
+ uint8_t palette_idx;
+
+ struct QP_PACKED {
+ uint8_t h;
+ uint8_t s;
+ uint8_t v;
+ } hsv888;
+
+ struct QP_PACKED {
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ } rgb888;
+
+ uint16_t rgb565;
+
+ uint32_t dummy;
+} qp_pixel_t;
+_Static_assert(sizeof(qp_pixel_t) == 4, "Invalid size for qp_pixel_t");
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Quantum Painter image format
+
+typedef enum qp_image_format_t {
+ // Pixel formats available in the QGF frame format
+ GRAYSCALE_1BPP = 0x00,
+ GRAYSCALE_2BPP = 0x01,
+ GRAYSCALE_4BPP = 0x02,
+ GRAYSCALE_8BPP = 0x03,
+ PALETTE_1BPP = 0x04,
+ PALETTE_2BPP = 0x05,
+ PALETTE_4BPP = 0x06,
+ PALETTE_8BPP = 0x07,
+} qp_image_format_t;
+
+typedef enum painter_compression_t { IMAGE_UNCOMPRESSED, IMAGE_COMPRESSED_RLE } painter_compression_t;
diff --git a/quantum/painter/qp_stream.c b/quantum/painter/qp_stream.c
new file mode 100644
index 0000000000..f00ae5ed38
--- /dev/null
+++ b/quantum/painter/qp_stream.c
@@ -0,0 +1,171 @@
+// Copyright 2021 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "qp_stream.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Stream API
+
+uint32_t qp_stream_read_impl(void *output_buf, uint32_t member_size, uint32_t num_members, qp_stream_t *stream) {
+ uint8_t *output_ptr = (uint8_t *)output_buf;
+
+ uint32_t i;
+ for (i = 0; i < (num_members * member_size); ++i) {
+ int16_t c = qp_stream_get(stream);
+ if (c < 0) {
+ break;
+ }
+
+ output_ptr[i] = (uint8_t)(c & 0xFF);
+ }
+
+ return i / member_size;
+}
+
+uint32_t qp_stream_write_impl(const void *input_buf, uint32_t member_size, uint32_t num_members, qp_stream_t *stream) {
+ uint8_t *input_ptr = (uint8_t *)input_buf;
+
+ uint32_t i;
+ for (i = 0; i < (num_members * member_size); ++i) {
+ if (!qp_stream_put(stream, input_ptr[i])) {
+ break;
+ }
+ }
+
+ return i / member_size;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Memory streams
+
+int16_t mem_get(qp_stream_t *stream) {
+ qp_memory_stream_t *s = (qp_memory_stream_t *)stream;
+ if (s->position >= s->length) {
+ s->is_eof = true;
+ return STREAM_EOF;
+ }
+ return s->buffer[s->position++];
+}
+
+bool mem_put(qp_stream_t *stream, uint8_t c) {
+ qp_memory_stream_t *s = (qp_memory_stream_t *)stream;
+ if (s->position >= s->length) {
+ s->is_eof = true;
+ return false;
+ }
+ s->buffer[s->position++] = c;
+ return true;
+}
+
+int mem_seek(qp_stream_t *stream, int32_t offset, int origin) {
+ qp_memory_stream_t *s = (qp_memory_stream_t *)stream;
+
+ // Handle as per fseek
+ int32_t position = s->position;
+ switch (origin) {
+ case SEEK_SET:
+ position = offset;
+ break;
+ case SEEK_CUR:
+ position += offset;
+ break;
+ case SEEK_END:
+ position = s->length + offset;
+ break;
+ default:
+ return -1;
+ }
+
+ // If we're before the start, ignore it.
+ if (position < 0) {
+ return -1;
+ }
+
+ // If we're at the end it's okay, we only care if we're after the end for failure purposes -- as per lseek()
+ if (position > s->length) {
+ return -1;
+ }
+
+ // Update the offset
+ s->position = position;
+
+ // Successful invocation of fseek() results in clearing of the EOF flag by default, mirror the same functionality
+ s->is_eof = false;
+
+ return 0;
+}
+
+int32_t mem_tell(qp_stream_t *stream) {
+ qp_memory_stream_t *s = (qp_memory_stream_t *)stream;
+ return s->position;
+}
+
+bool mem_is_eof(qp_stream_t *stream) {
+ qp_memory_stream_t *s = (qp_memory_stream_t *)stream;
+ return s->is_eof;
+}
+
+qp_memory_stream_t qp_make_memory_stream(void *buffer, int32_t length) {
+ qp_memory_stream_t stream = {
+ .base =
+ {
+ .get = mem_get,
+ .put = mem_put,
+ .seek = mem_seek,
+ .tell = mem_tell,
+ .is_eof = mem_is_eof,
+ },
+ .buffer = (uint8_t *)buffer,
+ .length = length,
+ .position = 0,
+ };
+ return stream;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// FILE streams
+
+#ifdef QP_STREAM_HAS_FILE_IO
+
+int16_t file_get(qp_stream_t *stream) {
+ qp_file_stream_t *s = (qp_file_stream_t *)stream;
+ int c = fgetc(s->file);
+ if (c < 0 || feof(s->file)) return STREAM_EOF;
+ return (uint16_t)c;
+}
+
+bool file_put(qp_stream_t *stream, uint8_t c) {
+ qp_file_stream_t *s = (qp_file_stream_t *)stream;
+ return fputc(c, s->file) == c;
+}
+
+int file_seek(qp_stream_t *stream, int32_t offset, int origin) {
+ qp_file_stream_t *s = (qp_file_stream_t *)stream;
+ return fseek(s->file, offset, origin);
+}
+
+int32_t file_tell(qp_stream_t *stream) {
+ qp_file_stream_t *s = (qp_file_stream_t *)stream;
+ return (int32_t)ftell(s->file);
+}
+
+bool file_is_eof(qp_stream_t *stream) {
+ qp_file_stream_t *s = (qp_file_stream_t *)stream;
+ return (bool)feof(s->file);
+}
+
+qp_file_stream_t qp_make_file_stream(FILE *f) {
+ qp_file_stream_t stream = {
+ .base =
+ {
+ .get = file_get,
+ .put = file_put,
+ .seek = file_seek,
+ .tell = file_tell,
+ .is_eof = file_is_eof,
+ },
+ .file = f,
+ };
+ return stream;
+}
+#endif // QP_STREAM_HAS_FILE_IO
diff --git a/quantum/painter/qp_stream.h b/quantum/painter/qp_stream.h
new file mode 100644
index 0000000000..878b9bf530
--- /dev/null
+++ b/quantum/painter/qp_stream.h
@@ -0,0 +1,82 @@
+/* Copyright 2021 Nick Brassel (@tzarc)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "qp_internal.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Stream API
+
+typedef struct qp_stream_t qp_stream_t;
+
+#define qp_stream_get(stream_ptr) (((qp_stream_t *)(stream_ptr))->get((qp_stream_t *)(stream_ptr)))
+#define qp_stream_put(stream_ptr, c) (((qp_stream_t *)(stream_ptr))->put((qp_stream_t *)(stream_ptr), (c)))
+#define qp_stream_seek(stream_ptr, offset, origin) (((qp_stream_t *)(stream_ptr))->seek((qp_stream_t *)(stream_ptr), (offset), (origin)))
+#define qp_stream_tell(stream_ptr) (((qp_stream_t *)(stream_ptr))->tell((qp_stream_t *)(stream_ptr)))
+#define qp_stream_eof(stream_ptr) (((qp_stream_t *)(stream_ptr))->is_eof((qp_stream_t *)(stream_ptr)))
+#define qp_stream_setpos(stream_ptr, offset) qp_stream_seek((stream_ptr), (offset), SEEK_SET)
+#define qp_stream_getpos(stream_ptr) qp_stream_tell((stream_ptr))
+#define qp_stream_read(output_buf, member_size, num_members, stream_ptr) qp_stream_read_impl((output_buf), (member_size), (num_members), (qp_stream_t *)(stream_ptr))
+#define qp_stream_write(input_buf, member_size, num_members, stream_ptr) qp_stream_write_impl((input_buf), (member_size), (num_members), (qp_stream_t *)(stream_ptr))
+
+uint32_t qp_stream_read_impl(void *output_buf, uint32_t member_size, uint32_t num_members, qp_stream_t *stream);
+uint32_t qp_stream_write_impl(const void *input_buf, uint32_t member_size, uint32_t num_members, qp_stream_t *stream);
+
+#define STREAM_EOF ((int16_t)(-1))
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Stream definition
+
+struct qp_stream_t {
+ int16_t (*get)(qp_stream_t *stream);
+ bool (*put)(qp_stream_t *stream, uint8_t c);
+ int (*seek)(qp_stream_t *stream, int32_t offset, int origin);
+ int32_t (*tell)(qp_stream_t *stream);
+ bool (*is_eof)(qp_stream_t *stream);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Memory streams
+
+typedef struct qp_memory_stream_t {
+ qp_stream_t base;
+ uint8_t * buffer;
+ int32_t length;
+ int32_t position;
+ bool is_eof;
+} qp_memory_stream_t;
+
+qp_memory_stream_t qp_make_memory_stream(void *buffer, int32_t length);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// FILE streams
+
+#ifdef QP_STREAM_HAS_FILE_IO
+
+typedef struct qp_file_stream_t {
+ qp_stream_t base;
+ FILE * file;
+} qp_file_stream_t;
+
+qp_file_stream_t qo_make_file_stream(FILE *f);
+
+#endif // QP_STREAM_HAS_FILE_IO
diff --git a/quantum/painter/rules.mk b/quantum/painter/rules.mk
new file mode 100644
index 0000000000..9115d3d406
--- /dev/null
+++ b/quantum/painter/rules.mk
@@ -0,0 +1,116 @@
+# Quantum Painter Configurables
+QUANTUM_PAINTER_DRIVERS ?=
+QUANTUM_PAINTER_ANIMATIONS_ENABLE ?= yes
+
+# The list of permissible drivers that can be listed in QUANTUM_PAINTER_DRIVERS
+VALID_QUANTUM_PAINTER_DRIVERS := ili9163_spi ili9341_spi st7789_spi gc9a01_spi ssd1351_spi
+
+#-------------------------------------------------------------------------------
+
+OPT_DEFS += -DQUANTUM_PAINTER_ENABLE
+COMMON_VPATH += $(QUANTUM_DIR)/painter
+SRC += \
+ $(QUANTUM_DIR)/utf8.c \
+ $(QUANTUM_DIR)/color.c \
+ $(QUANTUM_DIR)/painter/qp.c \
+ $(QUANTUM_DIR)/painter/qp_stream.c \
+ $(QUANTUM_DIR)/painter/qgf.c \
+ $(QUANTUM_DIR)/painter/qff.c \
+ $(QUANTUM_DIR)/painter/qp_draw_core.c \
+ $(QUANTUM_DIR)/painter/qp_draw_codec.c \
+ $(QUANTUM_DIR)/painter/qp_draw_circle.c \
+ $(QUANTUM_DIR)/painter/qp_draw_ellipse.c \
+ $(QUANTUM_DIR)/painter/qp_draw_image.c \
+ $(QUANTUM_DIR)/painter/qp_draw_text.c
+
+# Check if people want animations... enable the defered exec if so.
+ifeq ($(strip $(QUANTUM_PAINTER_ANIMATIONS_ENABLE)), yes)
+ DEFERRED_EXEC_ENABLE := yes
+ OPT_DEFS += -DQUANTUM_PAINTER_ANIMATIONS_ENABLE
+endif
+
+# Comms flags
+QUANTUM_PAINTER_NEEDS_COMMS_SPI ?= no
+
+# Handler for each driver
+define handle_quantum_painter_driver
+ CURRENT_PAINTER_DRIVER := $1
+
+ ifeq ($$(filter $$(strip $$(CURRENT_PAINTER_DRIVER)),$$(VALID_QUANTUM_PAINTER_DRIVERS)),)
+ $$(error "$$(CURRENT_PAINTER_DRIVER)" is not a valid Quantum Painter driver)
+
+ else ifeq ($$(strip $$(CURRENT_PAINTER_DRIVER)),ili9163_spi)
+ QUANTUM_PAINTER_NEEDS_COMMS_SPI := yes
+ QUANTUM_PAINTER_NEEDS_COMMS_SPI_DC_RESET := yes
+ OPT_DEFS += -DQUANTUM_PAINTER_ILI9163_ENABLE -DQUANTUM_PAINTER_ILI9163_SPI_ENABLE
+ COMMON_VPATH += \
+ $(DRIVER_PATH)/painter/tft_panel \
+ $(DRIVER_PATH)/painter/ili9xxx
+ SRC += \
+ $(DRIVER_PATH)/painter/tft_panel/qp_tft_panel.c \
+ $(DRIVER_PATH)/painter/ili9xxx/qp_ili9163.c \
+
+ else ifeq ($$(strip $$(CURRENT_PAINTER_DRIVER)),ili9341_spi)
+ QUANTUM_PAINTER_NEEDS_COMMS_SPI := yes
+ QUANTUM_PAINTER_NEEDS_COMMS_SPI_DC_RESET := yes
+ OPT_DEFS += -DQUANTUM_PAINTER_ILI9341_ENABLE -DQUANTUM_PAINTER_ILI9341_SPI_ENABLE
+ COMMON_VPATH += \
+ $(DRIVER_PATH)/painter/tft_panel \
+ $(DRIVER_PATH)/painter/ili9xxx
+ SRC += \
+ $(DRIVER_PATH)/painter/tft_panel/qp_tft_panel.c \
+ $(DRIVER_PATH)/painter/ili9xxx/qp_ili9341.c \
+
+ else ifeq ($$(strip $$(CURRENT_PAINTER_DRIVER)),st7789_spi)
+ QUANTUM_PAINTER_NEEDS_COMMS_SPI := yes
+ QUANTUM_PAINTER_NEEDS_COMMS_SPI_DC_RESET := yes
+ OPT_DEFS += -DQUANTUM_PAINTER_ST7789_ENABLE -DQUANTUM_PAINTER_ST7789_SPI_ENABLE
+ COMMON_VPATH += \
+ $(DRIVER_PATH)/painter/tft_panel \
+ $(DRIVER_PATH)/painter/st77xx
+ SRC += \
+ $(DRIVER_PATH)/painter/tft_panel/qp_tft_panel.c \
+ $(DRIVER_PATH)/painter/st77xx/qp_st7789.c
+
+ else ifeq ($$(strip $$(CURRENT_PAINTER_DRIVER)),gc9a01_spi)
+ QUANTUM_PAINTER_NEEDS_COMMS_SPI := yes
+ QUANTUM_PAINTER_NEEDS_COMMS_SPI_DC_RESET := yes
+ OPT_DEFS += -DQUANTUM_PAINTER_GC9A01_ENABLE -DQUANTUM_PAINTER_GC9A01_SPI_ENABLE
+ COMMON_VPATH += \
+ $(DRIVER_PATH)/painter/tft_panel \
+ $(DRIVER_PATH)/painter/gc9a01
+ SRC += \
+ $(DRIVER_PATH)/painter/tft_panel/qp_tft_panel.c \
+ $(DRIVER_PATH)/painter/gc9a01/qp_gc9a01.c
+
+ else ifeq ($$(strip $$(CURRENT_PAINTER_DRIVER)),ssd1351_spi)
+ QUANTUM_PAINTER_NEEDS_COMMS_SPI := yes
+ QUANTUM_PAINTER_NEEDS_COMMS_SPI_DC_RESET := yes
+ OPT_DEFS += -DQUANTUM_PAINTER_SSD1351_ENABLE -DQUANTUM_PAINTER_SSD1351_SPI_ENABLE
+ COMMON_VPATH += \
+ $(DRIVER_PATH)/painter/tft_panel \
+ $(DRIVER_PATH)/painter/ssd1351
+ SRC += \
+ $(DRIVER_PATH)/painter/tft_panel/qp_tft_panel.c \
+ $(DRIVER_PATH)/painter/ssd1351/qp_ssd1351.c
+
+ endif
+endef
+
+# Iterate through the listed drivers for the build, including what's necessary
+$(foreach qp_driver,$(QUANTUM_PAINTER_DRIVERS),$(eval $(call handle_quantum_painter_driver,$(qp_driver))))
+
+# If SPI comms is needed, set up the required files
+ifeq ($(strip $(QUANTUM_PAINTER_NEEDS_COMMS_SPI)), yes)
+ OPT_DEFS += -DQUANTUM_PAINTER_SPI_ENABLE
+ QUANTUM_LIB_SRC += spi_master.c
+ VPATH += $(DRIVER_PATH)/painter/comms
+ SRC += \
+ $(QUANTUM_DIR)/painter/qp_comms.c \
+ $(DRIVER_PATH)/painter/comms/qp_comms_spi.c
+
+ ifeq ($(strip $(QUANTUM_PAINTER_NEEDS_COMMS_SPI_DC_RESET)), yes)
+ OPT_DEFS += -DQUANTUM_PAINTER_SPI_DC_RESET_ENABLE
+ endif
+endif
+
diff --git a/quantum/pointing_device.c b/quantum/pointing_device.c
index 47a0af45d2..a160647890 100644
--- a/quantum/pointing_device.c
+++ b/quantum/pointing_device.c
@@ -71,17 +71,6 @@ static report_mouse_t local_mouse_report = {};
extern const pointing_device_driver_t pointing_device_driver;
/**
- * @brief Compares 2 mouse reports for difference and returns result
- *
- * @param[in] new_report report_mouse_t
- * @param[in] old_report report_mouse_t
- * @return bool result
- */
-__attribute__((weak)) bool has_mouse_report_changed(report_mouse_t new_report, report_mouse_t old_report) {
- return memcmp(&new_report, &old_report, sizeof(new_report));
-}
-
-/**
* @brief Keyboard level code pointing device initialisation
*
*/
@@ -165,7 +154,7 @@ __attribute__((weak)) void pointing_device_send(void) {
static report_mouse_t old_report = {};
// If you need to do other things, like debugging, this is the place to do it.
- if (has_mouse_report_changed(local_mouse_report, old_report)) {
+ if (has_mouse_report_changed(&local_mouse_report, &old_report)) {
host_mouse_send(&local_mouse_report);
}
// send it and 0 it out except for buttons, so those stay until they are explicity over-ridden using update_pointing_device
diff --git a/quantum/pointing_device.h b/quantum/pointing_device.h
index a6bdbf120c..5c0eaeaf34 100644
--- a/quantum/pointing_device.h
+++ b/quantum/pointing_device.h
@@ -80,7 +80,6 @@ void pointing_device_task(void);
void pointing_device_send(void);
report_mouse_t pointing_device_get_report(void);
void pointing_device_set_report(report_mouse_t mouse_report);
-bool has_mouse_report_changed(report_mouse_t new_report, report_mouse_t old_report);
uint16_t pointing_device_get_cpi(void);
void pointing_device_set_cpi(uint16_t cpi);
diff --git a/quantum/pointing_device_drivers.c b/quantum/pointing_device_drivers.c
index b8ef6e67e5..56363c7ac6 100644
--- a/quantum/pointing_device_drivers.c
+++ b/quantum/pointing_device_drivers.c
@@ -98,17 +98,9 @@ const pointing_device_driver_t pointing_device_driver = {
// clang-format on
#elif defined(POINTING_DEVICE_DRIVER_cirque_pinnacle_i2c) || defined(POINTING_DEVICE_DRIVER_cirque_pinnacle_spi)
# ifndef CIRQUE_PINNACLE_TAPPING_TERM
-# ifdef TAPPING_TERM_PER_KEY
-# include "action.h"
-# include "action_tapping.h"
-# define CIRQUE_PINNACLE_TAPPING_TERM get_tapping_term(KC_BTN1, &(keyrecord_t){})
-# else
-# ifdef TAPPING_TERM
-# define CIRQUE_PINNACLE_TAPPING_TERM TAPPING_TERM
-# else
-# define CIRQUE_PINNACLE_TAPPING_TERM 200
-# endif
-# endif
+# include "action.h"
+# include "action_tapping.h"
+# define CIRQUE_PINNACLE_TAPPING_TERM GET_TAPPING_TERM(KC_BTN1, &(keyrecord_t){})
# endif
# ifndef CIRQUE_PINNACLE_TOUCH_DEBOUNCE
# define CIRQUE_PINNACLE_TOUCH_DEBOUNCE (CIRQUE_PINNACLE_TAPPING_TERM * 8)
@@ -208,11 +200,11 @@ const pointing_device_driver_t pointing_device_driver = {
// clang-format on
#elif defined(POINTING_DEVICE_DRIVER_pmw3360)
static void pmw3360_device_init(void) {
- pmw3360_init();
+ pmw3360_init(0);
}
report_mouse_t pmw3360_get_report(report_mouse_t mouse_report) {
- report_pmw3360_t data = pmw3360_read_burst();
+ report_pmw3360_t data = pmw3360_read_burst(0);
static uint16_t MotionStart = 0; // Timer for accel, 0 is resting state
if (data.isOnSurface && data.isMotion) {
diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c
index 2150edd7b2..e6a7c01f2a 100644
--- a/quantum/process_keycode/process_auto_shift.c
+++ b/quantum/process_keycode/process_auto_shift.c
@@ -182,12 +182,7 @@ static bool autoshift_press(uint16_t keycode, uint16_t now, keyrecord_t *record)
# endif
) &&
# endif
- TIMER_DIFF_16(now, autoshift_time) <
-# ifdef TAPPING_TERM_PER_KEY
- get_tapping_term(autoshift_lastkey, record)
-# else
- TAPPING_TERM
-# endif
+ TIMER_DIFF_16(now, autoshift_time) < GET_TAPPING_TERM(autoshift_lastkey, record)
) {
// clang-format on
// Allow a tap-then-hold for keyrepeat.
diff --git a/quantum/process_keycode/process_caps_word.c b/quantum/process_keycode/process_caps_word.c
new file mode 100644
index 0000000000..15238f04a1
--- /dev/null
+++ b/quantum/process_keycode/process_caps_word.c
@@ -0,0 +1,160 @@
+// Copyright 2021-2022 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "process_caps_word.h"
+
+bool process_caps_word(uint16_t keycode, keyrecord_t* record) {
+ if (keycode == CAPSWRD) { // Pressing CAPSWRD toggles Caps Word.
+ if (record->event.pressed) {
+ caps_word_toggle();
+ }
+ return false;
+ }
+
+#ifndef NO_ACTION_ONESHOT
+ const uint8_t mods = get_mods() | get_oneshot_mods();
+#else
+ const uint8_t mods = get_mods();
+#endif // NO_ACTION_ONESHOT
+
+ if (!is_caps_word_on()) {
+ // The following optionally turns on Caps Word by holding left and
+ // right shifts or by double tapping left shift. This way Caps Word
+ // may be used without needing a dedicated key and also without
+ // needing combos or tap dance.
+
+#ifdef BOTH_SHIFTS_TURNS_ON_CAPS_WORD
+ // Many keyboards enable the Command feature by default, which also
+ // uses left+right shift. It can be configured to use a different
+ // key combination by defining IS_COMMAND(). We make a non-fatal
+ // warning if Command is enabled but IS_COMMAND() is *not* defined.
+# if defined(COMMAND_ENABLE) && !defined(IS_COMMAND)
+# pragma message "BOTH_SHIFTS_TURNS_ON_CAPS_WORD and Command should not be enabled at the same time, since both use the Left Shift + Right Shift key combination. Please disable Command, or ensure that `IS_COMMAND` is not set to (get_mods() == MOD_MASK_SHIFT)."
+# else
+ if (mods == MOD_MASK_SHIFT
+# ifdef COMMAND_ENABLE
+ // Don't activate Caps Word at the same time as Command.
+ && !(IS_COMMAND())
+# endif // COMMAND_ENABLE
+ ) {
+ caps_word_on();
+ }
+# endif // defined(COMMAND_ENABLE) && !defined(IS_COMMAND)
+#endif // BOTH_SHIFTS_TURNS_ON_CAPS_WORD
+
+#ifdef DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD
+ // Double tapping left shift turns on Caps Word.
+ //
+ // NOTE: This works with KC_LSFT and one-shot left shift. It
+ // wouldn't make sense with mod-tap or Space Cadet shift since
+ // double tapping would of course trigger the tapping action.
+ if (record->event.pressed) {
+ static bool tapped = false;
+ static uint16_t timer = 0;
+ if (keycode == KC_LSFT || keycode == OSM(MOD_LSFT)) {
+ if (tapped && !timer_expired(record->event.time, timer)) {
+ // Left shift was double tapped, activate Caps Word.
+ caps_word_on();
+ }
+ tapped = true;
+ timer = record->event.time + GET_TAPPING_TERM(keycode, record);
+ } else {
+ tapped = false; // Reset when any other key is pressed.
+ }
+ }
+#endif // DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD
+
+ return true;
+ }
+
+#if CAPS_WORD_IDLE_TIMEOUT > 0
+ caps_word_reset_idle_timer();
+#endif // CAPS_WORD_IDLE_TIMEOUT > 0
+
+ // From here on, we only take action on press events.
+ if (!record->event.pressed) {
+ return true;
+ }
+
+ if (!(mods & ~MOD_MASK_SHIFT)) {
+ switch (keycode) {
+ // Ignore MO, TO, TG, TT, and OSL layer switch keys.
+ case QK_MOMENTARY ... QK_MOMENTARY_MAX:
+ case QK_TO ... QK_TO_MAX:
+ case QK_TOGGLE_LAYER ... QK_TOGGLE_LAYER_MAX:
+ case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
+ case QK_ONE_SHOT_LAYER ... QK_ONE_SHOT_LAYER_MAX:
+ return true;
+
+#ifndef NO_ACTION_TAPPING
+ case QK_MOD_TAP ... QK_MOD_TAP_MAX:
+ if (record->tap.count == 0) {
+ // Deactivate if a mod becomes active through holding
+ // a mod-tap key.
+ caps_word_off();
+ return true;
+ }
+ keycode &= 0xff;
+ break;
+
+# ifndef NO_ACTION_LAYER
+ case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
+# endif // NO_ACTION_LAYER
+ if (record->tap.count == 0) {
+ return true;
+ }
+ keycode &= 0xff;
+ break;
+#endif // NO_ACTION_TAPPING
+
+#ifdef SWAP_HANDS_ENABLE
+ case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX:
+ if (keycode > 0x56F0 || record->tap.count == 0) {
+ return true;
+ }
+ keycode &= 0xff;
+ break;
+#endif // SWAP_HANDS_ENABLE
+ }
+
+ clear_weak_mods();
+ if (caps_word_press_user(keycode)) {
+ send_keyboard_report();
+ return true;
+ }
+ }
+
+ caps_word_off();
+ return true;
+}
+
+__attribute__((weak)) bool caps_word_press_user(uint16_t keycode) {
+ switch (keycode) {
+ // Keycodes that continue Caps Word, with shift applied.
+ case KC_A ... KC_Z:
+ case KC_MINS:
+ add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to next key.
+ return true;
+
+ // Keycodes that continue Caps Word, without shifting.
+ case KC_1 ... KC_0:
+ case KC_BSPC:
+ case KC_DEL:
+ case KC_UNDS:
+ return true;
+
+ default:
+ return false; // Deactivate Caps Word.
+ }
+}
diff --git a/quantum/process_keycode/process_caps_word.h b/quantum/process_keycode/process_caps_word.h
new file mode 100644
index 0000000000..f215bbc3a3
--- /dev/null
+++ b/quantum/process_keycode/process_caps_word.h
@@ -0,0 +1,37 @@
+// Copyright 2021-2022 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#pragma once
+
+#include "quantum.h"
+#include "caps_word.h"
+
+/**
+ * @brief Process handler for Caps Word feature.
+ *
+ * @param keycode Keycode registered by matrix press, per keymap
+ * @param record keyrecord_t structure
+ * @return true Continue processing keycodes, and send to host
+ * @return false Stop processing keycodes, and don't send to host
+ */
+bool process_caps_word(uint16_t keycode, keyrecord_t* record);
+
+/**
+ * @brief Weak function for user-level Caps Word press modification.
+ *
+ * @param keycode Keycode registered by matrix press, per keymap
+ * @return true Continue Caps Word
+ * @return false Stop Caps Word
+ */
+bool caps_word_press_user(uint16_t keycode);
diff --git a/quantum/process_keycode/process_combo.c b/quantum/process_keycode/process_combo.c
index efaf8fe0e9..d5a649adb3 100644
--- a/quantum/process_keycode/process_combo.c
+++ b/quantum/process_keycode/process_combo.c
@@ -88,8 +88,6 @@ static queued_combo_t combo_buffer[COMBO_BUFFER_LENGTH];
#define INCREMENT_MOD(i) i = (i + 1) % COMBO_BUFFER_LENGTH
-#define COMBO_KEY_POS ((keypos_t){.col = 254, .row = 254})
-
#ifndef EXTRA_SHORT_COMBOS
/* flags are their own elements in combo_t struct. */
# define COMBO_ACTIVE(combo) (combo->active)
@@ -140,12 +138,7 @@ static queued_combo_t combo_buffer[COMBO_BUFFER_LENGTH];
static inline void release_combo(uint16_t combo_index, combo_t *combo) {
if (combo->keycode) {
keyrecord_t record = {
- .event =
- {
- .key = COMBO_KEY_POS,
- .time = timer_read() | 1,
- .pressed = false,
- },
+ .event = MAKE_KEYEVENT(KEYLOC_COMBO, KEYLOC_COMBO, false),
.keycode = combo->keycode,
};
#ifndef NO_ACTION_TAPPING
@@ -325,7 +318,7 @@ void apply_combo(uint16_t combo_index, combo_t *combo) {
if (ALL_COMBO_KEYS_ARE_DOWN(state, key_count)) {
// this in the end executes the combo when the key_buffer is dumped.
record->keycode = combo->keycode;
- record->event.key = COMBO_KEY_POS;
+ record->event.key = MAKE_KEYPOS(KEYLOC_COMBO, KEYLOC_COMBO);
qrecord->combo_index = combo_index;
ACTIVATE_COMBO(combo);
diff --git a/quantum/process_keycode/process_joystick.c b/quantum/process_keycode/process_joystick.c
index 2fb092c573..8c3e71616f 100644
--- a/quantum/process_keycode/process_joystick.c
+++ b/quantum/process_keycode/process_joystick.c
@@ -6,41 +6,25 @@
#include <string.h>
#include <math.h>
-bool process_joystick_buttons(uint16_t keycode, keyrecord_t *record);
-
bool process_joystick(uint16_t keycode, keyrecord_t *record) {
- if (process_joystick_buttons(keycode, record) && (joystick_status.status & JS_UPDATED) > 0) {
- send_joystick_packet(&joystick_status);
- joystick_status.status &= ~JS_UPDATED;
+ switch (keycode) {
+ case JS_BUTTON0 ... JS_BUTTON_MAX:
+ if (record->event.pressed) {
+ register_joystick_button(keycode - JS_BUTTON0);
+ } else {
+ unregister_joystick_button(keycode - JS_BUTTON0);
+ }
+ return false;
}
-
return true;
}
__attribute__((weak)) void joystick_task(void) {
- if (process_joystick_analogread() && (joystick_status.status & JS_UPDATED)) {
- send_joystick_packet(&joystick_status);
- joystick_status.status &= ~JS_UPDATED;
+ if (process_joystick_analogread()) {
+ joystick_flush();
}
}
-bool process_joystick_buttons(uint16_t keycode, keyrecord_t *record) {
- if (keycode < JS_BUTTON0 || keycode > JS_BUTTON_MAX) {
- return true;
- } else {
- uint8_t button_idx = (keycode - JS_BUTTON0);
- if (record->event.pressed) {
- joystick_status.buttons[button_idx / 8] |= 1 << (button_idx % 8);
- } else {
- joystick_status.buttons[button_idx / 8] &= ~(1 << (button_idx % 8));
- }
-
- joystick_status.status |= JS_UPDATED;
- }
-
- return true;
-}
-
uint16_t savePinState(pin_t pin) {
#ifdef __AVR__
uint8_t pinNumber = pin & 0xF;
diff --git a/quantum/process_keycode/process_secure.c b/quantum/process_keycode/process_secure.c
new file mode 100644
index 0000000000..827ace597a
--- /dev/null
+++ b/quantum/process_keycode/process_secure.c
@@ -0,0 +1,39 @@
+// Copyright 2022 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "secure.h"
+#include "process_secure.h"
+#include "quantum_keycodes.h"
+
+bool preprocess_secure(uint16_t keycode, keyrecord_t *record) {
+ if (secure_is_unlocking()) {
+ if (!record->event.pressed) {
+ secure_keypress_event(record->event.key.row, record->event.key.col);
+ }
+
+ // Normal keypresses should be disabled until the sequence is completed
+ return false;
+ }
+
+ return true;
+}
+
+bool process_secure(uint16_t keycode, keyrecord_t *record) {
+#ifndef SECURE_DISABLE_KEYCODES
+ if (!record->event.pressed) {
+ if (keycode == SECURE_LOCK) {
+ secure_lock();
+ return false;
+ }
+ if (keycode == SECURE_UNLOCK) {
+ secure_unlock();
+ return false;
+ }
+ if (keycode == SECURE_TOGGLE) {
+ secure_is_locked() ? secure_unlock() : secure_lock();
+ return false;
+ }
+ }
+#endif
+ return true;
+} \ No newline at end of file
diff --git a/quantum/process_keycode/process_secure.h b/quantum/process_keycode/process_secure.h
new file mode 100644
index 0000000000..2814264b92
--- /dev/null
+++ b/quantum/process_keycode/process_secure.h
@@ -0,0 +1,15 @@
+// Copyright 2022 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <stdbool.h>
+#include "action.h"
+
+/** \brief Intercept keycodes and detect unlock sequences
+ */
+bool preprocess_secure(uint16_t keycode, keyrecord_t *record);
+
+/** \brief Handle any secure specific keycodes
+ */
+bool process_secure(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c
index 46b2648c35..0997e7b7f3 100644
--- a/quantum/process_keycode/process_space_cadet.c
+++ b/quantum/process_keycode/process_space_cadet.c
@@ -93,12 +93,7 @@ void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdM
register_mods(MOD_BIT(holdMod));
}
} else {
-#ifdef TAPPING_TERM_PER_KEY
- if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode, record))
-#else
- if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM)
-#endif
- {
+ if (sc_last == holdMod && timer_elapsed(sc_timer) < GET_TAPPING_TERM(sc_keycode, record)) {
if (holdMod != tapMod) {
if (IS_MOD(holdMod)) {
unregister_mods(MOD_BIT(holdMod));
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c
index e99119b2ae..db8df5f870 100644
--- a/quantum/process_keycode/process_tap_dance.c
+++ b/quantum/process_keycode/process_tap_dance.c
@@ -174,11 +174,7 @@ void tap_dance_task() {
if (action->custom_tapping_term > 0) {
tap_user_defined = action->custom_tapping_term;
} else {
-#ifdef TAPPING_TERM_PER_KEY
- tap_user_defined = get_tapping_term(action->state.keycode, &(keyrecord_t){});
-#else
- tap_user_defined = TAPPING_TERM;
-#endif
+ tap_user_defined = GET_TAPPING_TERM(action->state.keycode, &(keyrecord_t){});
}
if (action->state.count && timer_elapsed(action->state.timer) > tap_user_defined) {
process_tap_dance_action_on_dance_finished(action);
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c
index 46b77e14ba..652becbc9a 100644
--- a/quantum/process_keycode/process_unicode_common.c
+++ b/quantum/process_keycode/process_unicode_common.c
@@ -16,8 +16,7 @@
#include "process_unicode_common.h"
#include "eeprom.h"
-#include <ctype.h>
-#include <string.h>
+#include "utf8.h"
unicode_config_t unicode_config;
uint8_t unicode_saved_mods;
@@ -231,66 +230,6 @@ void register_unicode(uint32_t code_point) {
unicode_input_finish();
}
-// clang-format off
-
-void send_unicode_hex_string(const char *str) {
- if (!str) {
- return;
- }
-
- while (*str) {
- // Find the next code point (token) in the string
- for (; *str == ' '; str++); // Skip leading spaces
- size_t n = strcspn(str, " "); // Length of the current token
- char code_point[n+1];
- strncpy(code_point, str, n); // Copy token into buffer
- code_point[n] = '\0'; // Make sure it's null-terminated
-
- // Normalize the code point: make all hex digits lowercase
- for (char *p = code_point; *p; p++) {
- *p = tolower((unsigned char)*p);
- }
-
- // Send the code point as a Unicode input string
- unicode_input_start();
- send_string(code_point);
- unicode_input_finish();
-
- str += n; // Move to the first ' ' (or '\0') after the current token
- }
-}
-
-// clang-format on
-
-// Borrowed from https://nullprogram.com/blog/2017/10/06/
-static const char *decode_utf8(const char *str, int32_t *code_point) {
- const char *next;
-
- if (str[0] < 0x80) { // U+0000-007F
- *code_point = str[0];
- next = str + 1;
- } else if ((str[0] & 0xE0) == 0xC0) { // U+0080-07FF
- *code_point = ((int32_t)(str[0] & 0x1F) << 6) | ((int32_t)(str[1] & 0x3F) << 0);
- next = str + 2;
- } else if ((str[0] & 0xF0) == 0xE0) { // U+0800-FFFF
- *code_point = ((int32_t)(str[0] & 0x0F) << 12) | ((int32_t)(str[1] & 0x3F) << 6) | ((int32_t)(str[2] & 0x3F) << 0);
- next = str + 3;
- } else if ((str[0] & 0xF8) == 0xF0 && (str[0] <= 0xF4)) { // U+10000-10FFFF
- *code_point = ((int32_t)(str[0] & 0x07) << 18) | ((int32_t)(str[1] & 0x3F) << 12) | ((int32_t)(str[2] & 0x3F) << 6) | ((int32_t)(str[3] & 0x3F) << 0);
- next = str + 4;
- } else {
- *code_point = -1;
- next = str + 1;
- }
-
- // part of a UTF-16 surrogate pair - invalid
- if (*code_point >= 0xD800 && *code_point <= 0xDFFF) {
- *code_point = -1;
- }
-
- return next;
-}
-
void send_unicode_string(const char *str) {
if (!str) {
return;
diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h
index 1a6607c757..8a4494c939 100644
--- a/quantum/process_keycode/process_unicode_common.h
+++ b/quantum/process_keycode/process_unicode_common.h
@@ -90,7 +90,6 @@ void register_hex(uint16_t hex);
void register_hex32(uint32_t hex);
void register_unicode(uint32_t code_point);
-void send_unicode_hex_string(const char *str);
void send_unicode_string(const char *str);
bool process_unicode_common(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/quantum.c b/quantum/quantum.c
index ef6e5ac1df..b54b46760c 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -121,7 +121,7 @@ __attribute__((weak)) void post_process_record_kb(uint16_t keycode, keyrecord_t
__attribute__((weak)) void post_process_record_user(uint16_t keycode, keyrecord_t *record) {}
-void reset_keyboard(void) {
+void shutdown_quantum(void) {
clear_keyboard();
#if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
process_midi_all_notes_off();
@@ -143,9 +143,18 @@ void reset_keyboard(void) {
#ifdef HAPTIC_ENABLE
haptic_shutdown();
#endif
+}
+
+void reset_keyboard(void) {
+ shutdown_quantum();
bootloader_jump();
}
+void soft_reset_keyboard(void) {
+ shutdown_quantum();
+ mcu_reset();
+}
+
/* Convert record into usable keycode via the contained event. */
uint16_t get_record_keycode(keyrecord_t *record, bool update_layer_cache) {
#ifdef COMBO_ENABLE
@@ -212,6 +221,12 @@ bool process_record_quantum(keyrecord_t *record) {
// return false;
// }
+#if defined(SECURE_ENABLE)
+ if (!preprocess_secure(keycode, record)) {
+ return false;
+ }
+#endif
+
#ifdef VELOCIKEY_ENABLE
if (velocikey_enabled() && record->event.pressed) {
velocikey_accelerate();
@@ -247,6 +262,9 @@ bool process_record_quantum(keyrecord_t *record) {
process_record_via(keycode, record) &&
#endif
process_record_kb(keycode, record) &&
+#if defined(SECURE_ENABLE)
+ process_secure(keycode, record) &&
+#endif
#if defined(SEQUENCER_ENABLE)
process_sequencer(keycode, record) &&
#endif
@@ -289,6 +307,9 @@ bool process_record_quantum(keyrecord_t *record) {
#ifdef TERMINAL_ENABLE
process_terminal(keycode, record) &&
#endif
+#ifdef CAPS_WORD_ENABLE
+ process_caps_word(keycode, record) &&
+#endif
#ifdef SPACE_CADET_ENABLE
process_space_cadet(keycode, record) &&
#endif
@@ -317,6 +338,9 @@ bool process_record_quantum(keyrecord_t *record) {
case QK_BOOTLOADER:
reset_keyboard();
return false;
+ case QK_REBOOT:
+ soft_reset_keyboard();
+ return false;
#endif
#ifndef NO_DEBUG
case QK_DEBUG_TOGGLE:
@@ -330,6 +354,9 @@ bool process_record_quantum(keyrecord_t *record) {
return false;
case QK_CLEAR_EEPROM:
eeconfig_init();
+#ifndef NO_RESET
+ soft_reset_keyboard();
+#endif
return false;
#ifdef VELOCIKEY_ENABLE
case VLK_TOG:
@@ -358,6 +385,26 @@ bool process_record_quantum(keyrecord_t *record) {
oneshot_disable();
break;
#endif
+#ifdef ENABLE_COMPILE_KEYCODE
+ case QK_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
+ {
+# ifdef NO_ACTION_ONESHOT
+ const uint8_t temp_mod = mod_config(get_mods());
+# else
+ const uint8_t temp_mod = mod_config(get_mods() | get_oneshot_mods());
+ clear_oneshot_mods();
+# endif
+ clear_mods();
+
+ SEND_STRING_DELAY("qmk", TAP_CODE_DELAY);
+ if (temp_mod & MOD_MASK_SHIFT) { // if shift is held, flash rather than compile
+ SEND_STRING_DELAY(" flash ", TAP_CODE_DELAY);
+ } else {
+ SEND_STRING_DELAY(" compile ", TAP_CODE_DELAY);
+ }
+ SEND_STRING_DELAY("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP SS_TAP(X_ENTER), TAP_CODE_DELAY);
+ }
+#endif
}
}
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 020e455941..92e1af1c40 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -188,6 +188,10 @@ extern layer_state_t layer_state;
# include "st7565.h"
#endif
+#ifdef QUANTUM_PAINTER_ENABLE
+# include "qp.h"
+#endif
+
#ifdef DIP_SWITCH_ENABLE
# include "dip_switch.h"
#endif
@@ -196,10 +200,19 @@ extern layer_state_t layer_state;
# include "process_dynamic_macro.h"
#endif
+#ifdef SECURE_ENABLE
+# include "secure.h"
+# include "process_secure.h"
+#endif
+
#ifdef DYNAMIC_KEYMAP_ENABLE
# include "dynamic_keymap.h"
#endif
+#ifdef JOYSTICK_ENABLE
+# include "joystick.h"
+#endif
+
#ifdef VIA_ENABLE
# include "via.h"
#endif
@@ -220,6 +233,11 @@ extern layer_state_t layer_state;
# include "pointing_device.h"
#endif
+#ifdef CAPS_WORD_ENABLE
+# include "caps_word.h"
+# include "process_caps_word.h"
+#endif
+
// For tri-layer
void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3);
@@ -241,6 +259,7 @@ void post_process_record_kb(uint16_t keycode, keyrecord_t *record);
void post_process_record_user(uint16_t keycode, keyrecord_t *record);
void reset_keyboard(void);
+void soft_reset_keyboard(void);
void startup_user(void);
void shutdown_user(void);
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 2552c48165..2f8ee2322e 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -595,6 +595,15 @@ enum quantum_keycodes {
MAGIC_TOGGLE_CONTROL_CAPSLOCK,
+ QK_MAKE,
+ QK_REBOOT,
+
+ SECURE_LOCK,
+ SECURE_UNLOCK,
+ SECURE_TOGGLE,
+
+ CAPS_WORD,
+
// Start of custom keycode range for keyboards and keymaps - always leave at the end
SAFE_RANGE
};
@@ -711,6 +720,7 @@ enum quantum_keycodes {
#define QK_BOOT QK_BOOTLOADER
#define DB_TOGG QK_DEBUG_TOGGLE
#define EE_CLR QK_CLEAR_EEPROM
+#define QK_RBT QK_REBOOT
// Audio Clicky aliases
#define CK_TOGG CLICKY_TOGGLE
@@ -956,5 +966,6 @@ enum quantum_keycodes {
#define PB_32 PROGRAMMABLE_BUTTON_32
#define PROGRAMMABLE_BUTTON_MIN PROGRAMMABLE_BUTTON_1
#define PROGRAMMABLE_BUTTON_MAX PROGRAMMABLE_BUTTON_32
+#define CAPSWRD CAPS_WORD
#include "quantum_keycodes_legacy.h"
diff --git a/quantum/rgb_matrix/animations/digital_rain_anim.h b/quantum/rgb_matrix/animations/digital_rain_anim.h
index 4633145ff6..7d3b22f697 100644
--- a/quantum/rgb_matrix/animations/digital_rain_anim.h
+++ b/quantum/rgb_matrix/animations/digital_rain_anim.h
@@ -10,11 +10,13 @@ RGB_MATRIX_EFFECT(DIGITAL_RAIN)
bool DIGITAL_RAIN(effect_params_t* params) {
// algorithm ported from https://github.com/tremby/Kaleidoscope-LEDEffect-DigitalRain
const uint8_t drop_ticks = 28;
- const uint8_t pure_green_intensity = 0xd0;
- const uint8_t max_brightness_boost = 0xc0;
- const uint8_t max_intensity = 0xff;
+ const uint8_t pure_green_intensity = (((uint16_t)rgb_matrix_config.hsv.v) * 3) >> 2;
+ const uint8_t max_brightness_boost = (((uint16_t)rgb_matrix_config.hsv.v) * 3) >> 2;
+ const uint8_t max_intensity = rgb_matrix_config.hsv.v;
+ const uint8_t decay_ticks = 0xff / max_intensity;
- static uint8_t drop = 0;
+ static uint8_t drop = 0;
+ static uint8_t decay = 0;
if (params->init) {
rgb_matrix_set_color_all(0, 0, 0);
@@ -22,6 +24,7 @@ bool DIGITAL_RAIN(effect_params_t* params) {
drop = 0;
}
+ decay++;
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) {
@@ -30,7 +33,9 @@ bool DIGITAL_RAIN(effect_params_t* params) {
g_rgb_frame_buffer[row][col] = max_intensity;
} else if (g_rgb_frame_buffer[row][col] > 0 && g_rgb_frame_buffer[row][col] < max_intensity) {
// neither fully bright nor dark, decay it
- g_rgb_frame_buffer[row][col]--;
+ if (decay == decay_ticks) {
+ g_rgb_frame_buffer[row][col]--;
+ }
}
// set the pixel colour
uint8_t led[LED_HITS_TO_REMEMBER];
@@ -48,6 +53,9 @@ bool DIGITAL_RAIN(effect_params_t* params) {
}
}
}
+ if (decay == decay_ticks) {
+ decay = 0;
+ }
if (++drop > drop_ticks) {
// reset drop timer
@@ -59,9 +67,9 @@ bool DIGITAL_RAIN(effect_params_t* params) {
g_rgb_frame_buffer[row][col]--;
}
// check if the pixel above is bright
- if (g_rgb_frame_buffer[row - 1][col] == max_intensity) {
+ if (g_rgb_frame_buffer[row - 1][col] >= max_intensity) { // Note: can be larger than max_intensity if val was recently decreased
// allow old bright pixel to decay
- g_rgb_frame_buffer[row - 1][col]--;
+ g_rgb_frame_buffer[row - 1][col] = max_intensity - 1;
// make this pixel bright
g_rgb_frame_buffer[row][col] = max_intensity;
}
diff --git a/quantum/rgb_matrix/animations/typing_heatmap_anim.h b/quantum/rgb_matrix/animations/typing_heatmap_anim.h
index f3a94280c0..4b17c4c3ed 100644
--- a/quantum/rgb_matrix/animations/typing_heatmap_anim.h
+++ b/quantum/rgb_matrix/animations/typing_heatmap_anim.h
@@ -7,6 +7,10 @@ RGB_MATRIX_EFFECT(TYPING_HEATMAP)
# endif
void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) {
+# ifdef RGB_MATRIX_TYPING_HEATMAP_SLIM
+ // Limit effect to pressed keys
+ g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], 32);
+# else
uint8_t m_row = row - 1;
uint8_t p_row = row + 1;
uint8_t m_col = col - 1;
@@ -27,6 +31,7 @@ void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) {
g_rgb_frame_buffer[m_row][col] = qadd8(g_rgb_frame_buffer[m_row][col], 16);
if (p_col < MATRIX_COLS) g_rgb_frame_buffer[m_row][p_col] = qadd8(g_rgb_frame_buffer[m_row][p_col], 13);
}
+# endif
}
// A timer to track the last time we decremented all heatmap values.
diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c
index 3bacbda876..e5d3a98bea 100644
--- a/quantum/rgblight/rgblight.c
+++ b/quantum/rgblight/rgblight.c
@@ -559,12 +559,8 @@ void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool w
// static gradient
uint8_t delta = rgblight_config.mode - rgblight_status.base_mode;
bool direction = (delta % 2) == 0;
-# ifdef __AVR__
- // probably due to how pgm_read_word is defined for ARM, but the ARM compiler really hates this line
- uint8_t range = pgm_read_word(&RGBLED_GRADIENT_RANGES[delta / 2]);
-# else
- uint8_t range = RGBLED_GRADIENT_RANGES[delta / 2];
-# endif
+
+ uint8_t range = pgm_read_byte(&RGBLED_GRADIENT_RANGES[delta / 2]);
for (uint8_t i = 0; i < rgblight_ranges.effect_num_leds; i++) {
uint8_t _hue = ((uint16_t)i * (uint16_t)range) / rgblight_ranges.effect_num_leds;
if (direction) {
@@ -826,6 +822,21 @@ void rgblight_blink_layer_repeat(uint8_t layer, uint16_t duration_ms, uint8_t ti
_repeat_timer = sync_timer_read() + duration_ms;
}
+void rgblight_unblink_layer(uint8_t layer) {
+ rgblight_set_layer_state(layer, false);
+ _blinking_layer_mask &= ~((rgblight_layer_mask_t)1 << layer);
+}
+
+void rgblight_unblink_all_but_layer(uint8_t layer) {
+ for (uint8_t i = 0; i < RGBLIGHT_MAX_LAYERS; i++) {
+ if (i != layer) {
+ if ((_blinking_layer_mask & (rgblight_layer_mask_t)1 << i) != 0) {
+ rgblight_unblink_layer(i);
+ }
+ }
+ }
+}
+
void rgblight_blink_layer_repeat_helper(void) {
if (_blinking_layer_mask != 0 && timer_expired(sync_timer_read(), _repeat_timer)) {
for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) {
@@ -1259,19 +1270,19 @@ void rgblight_effect_snake(animation_status_t *anim) {
}
rgblight_set();
if (increment == 1) {
- if (pos - 1 < 0) {
+ if (pos - RGBLIGHT_EFFECT_SNAKE_INCREMENT < 0) {
pos = rgblight_ranges.effect_num_leds - 1;
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
anim->pos = 0;
# endif
} else {
- pos -= 1;
+ pos -= RGBLIGHT_EFFECT_SNAKE_INCREMENT;
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
anim->pos = 1;
# endif
}
} else {
- pos = (pos + 1) % rgblight_ranges.effect_num_leds;
+ pos = (pos + RGBLIGHT_EFFECT_SNAKE_INCREMENT) % rgblight_ranges.effect_num_leds;
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
anim->pos = pos;
# endif
@@ -1285,7 +1296,7 @@ __attribute__((weak)) const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63
void rgblight_effect_knight(animation_status_t *anim) {
static int8_t low_bound = 0;
static int8_t high_bound = RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1;
- static int8_t increment = 1;
+ static int8_t increment = RGBLIGHT_EFFECT_KNIGHT_INCREMENT;
uint8_t i, cur;
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
diff --git a/quantum/rgblight/rgblight.h b/quantum/rgblight/rgblight.h
index 7076dc41ac..a08b9a7b6b 100644
--- a/quantum/rgblight/rgblight.h
+++ b/quantum/rgblight/rgblight.h
@@ -126,10 +126,18 @@ enum RGBLIGHT_EFFECT_MODE {
# define RGBLIGHT_EFFECT_SNAKE_LENGTH 4
#endif
+#ifndef RGBLIGHT_EFFECT_SNAKE_INCREMENT
+# define RGBLIGHT_EFFECT_SNAKE_INCREMENT 1
+#endif
+
#ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH
# define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3
#endif
+#ifndef RGBLIGHT_EFFECT_KNIGHT_INCREMENT
+# define RGBLIGHT_EFFECT_KNIGHT_INCREMENT 1
+#endif
+
#ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET
# define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0
#endif
@@ -217,6 +225,24 @@ extern const rgblight_segment_t *const *rgblight_layers;
# define RGBLIGHT_USE_TIMER
void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms);
void rgblight_blink_layer_repeat(uint8_t layer, uint16_t duration_ms, uint8_t times);
+/**
+ * \brief Stop blinking on one layer.
+ *
+ * Stop a layer that is blinking. If the layer is not blinking it will
+ * be unaffected.
+ *
+ * \param layer Layer number to stop blinking.
+ */
+void rgblight_unblink_layer(uint8_t layer);
+/**
+ * \brief Stop blinking all layers except one.
+ *
+ * Stop all layers that are blinking except for one specific layer.
+ * Layers that are not blinking are unaffected.
+ *
+ * \param layer Layer number to keep blinking.
+ */
+void rgblight_unblink_all_but_layer(uint8_t layer);
# endif
#endif
diff --git a/quantum/secure.c b/quantum/secure.c
new file mode 100644
index 0000000000..00048bd6dd
--- /dev/null
+++ b/quantum/secure.c
@@ -0,0 +1,87 @@
+// Copyright 2022 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "secure.h"
+#include "timer.h"
+
+#ifndef SECURE_UNLOCK_TIMEOUT
+# define SECURE_UNLOCK_TIMEOUT 5000
+#endif
+
+#ifndef SECURE_IDLE_TIMEOUT
+# define SECURE_IDLE_TIMEOUT 60000
+#endif
+
+#ifndef SECURE_UNLOCK_SEQUENCE
+# define SECURE_UNLOCK_SEQUENCE \
+ { \
+ { 0, 0 } \
+ }
+#endif
+
+static secure_status_t secure_status = SECURE_LOCKED;
+static uint32_t unlock_time = 0;
+static uint32_t idle_time = 0;
+
+secure_status_t secure_get_status(void) {
+ return secure_status;
+}
+
+void secure_lock(void) {
+ secure_status = SECURE_LOCKED;
+}
+
+void secure_unlock(void) {
+ secure_status = SECURE_UNLOCKED;
+ idle_time = timer_read32();
+}
+
+void secure_request_unlock(void) {
+ if (secure_status == SECURE_LOCKED) {
+ secure_status = SECURE_PENDING;
+ unlock_time = timer_read32();
+ }
+}
+
+void secure_activity_event(void) {
+ if (secure_status == SECURE_UNLOCKED) {
+ idle_time = timer_read32();
+ }
+}
+
+void secure_keypress_event(uint8_t row, uint8_t col) {
+ static const uint8_t sequence[][2] = SECURE_UNLOCK_SEQUENCE;
+ static const uint8_t sequence_len = sizeof(sequence) / sizeof(sequence[0]);
+
+ static uint8_t offset = 0;
+ if ((sequence[offset][0] == row) && (sequence[offset][1] == col)) {
+ offset++;
+ if (offset == sequence_len) {
+ offset = 0;
+ secure_unlock();
+ }
+ } else {
+ offset = 0;
+ secure_lock();
+ }
+}
+
+void secure_task(void) {
+#if SECURE_UNLOCK_TIMEOUT != 0
+ // handle unlock timeout
+ if (secure_status == SECURE_PENDING) {
+ if (timer_elapsed32(unlock_time) >= SECURE_UNLOCK_TIMEOUT) {
+ secure_lock();
+ }
+ }
+#endif
+
+#if SECURE_IDLE_TIMEOUT != 0
+ // handle idle timeout
+ if (secure_status == SECURE_UNLOCKED) {
+ if (timer_elapsed32(idle_time) >= SECURE_IDLE_TIMEOUT) {
+ secure_lock();
+ }
+ }
+#endif
+}
diff --git a/quantum/secure.h b/quantum/secure.h
new file mode 100644
index 0000000000..04507fd5b1
--- /dev/null
+++ b/quantum/secure.h
@@ -0,0 +1,67 @@
+// Copyright 2022 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+/** \file
+ *
+ * Exposes a set of functionality to act as a virtual padlock for your device
+ * ... As long as that padlock is made of paper and its currently raining.
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+
+/** \brief Available secure states
+ */
+typedef enum {
+ SECURE_LOCKED,
+ SECURE_PENDING,
+ SECURE_UNLOCKED,
+} secure_status_t;
+
+/** \brief Query current secure state
+ */
+secure_status_t secure_get_status(void);
+
+/** \brief Helper to check if unlocking is currently locked
+ */
+#define secure_is_locked() (secure_get_status() == SECURE_LOCKED)
+
+/** \brief Helper to check if unlocking is currently in progress
+ */
+#define secure_is_unlocking() (secure_get_status() == SECURE_PENDING)
+
+/** \brief Helper to check if unlocking is currently unlocked
+ */
+#define secure_is_unlocked() (secure_get_status() == SECURE_UNLOCKED)
+
+/** \brief Lock down the device
+ */
+void secure_lock(void);
+
+/** \brief Force unlock the device
+ *
+ * \warning bypasses user unlock sequence
+ */
+void secure_unlock(void);
+
+/** \brief Begin listening for an unlock sequence
+ */
+void secure_request_unlock(void);
+
+/** \brief Flag to the secure subsystem that user activity has happened
+ *
+ * Call when some user activity has happened and the device should remain unlocked
+ */
+void secure_activity_event(void);
+
+/** \brief Flag to the secure subsystem that user has triggered a keypress
+ *
+ * Call to trigger processing of the unlock sequence
+ */
+void secure_keypress_event(uint8_t row, uint8_t col);
+
+/** \brief Handle various secure subsystem background tasks
+ */
+void secure_task(void);
diff --git a/quantum/send_string_keycodes.h b/quantum/send_string_keycodes.h
index 7017e03d5a..b35bf66b7b 100644
--- a/quantum/send_string_keycodes.h
+++ b/quantum/send_string_keycodes.h
@@ -21,45 +21,53 @@
/* Punctuation */
#define X_ENT X_ENTER
#define X_ESC X_ESCAPE
-#define X_BSPC X_BSPACE
+#define X_BSPC X_BACKSPACE
#define X_SPC X_SPACE
#define X_MINS X_MINUS
#define X_EQL X_EQUAL
-#define X_LBRC X_LBRACKET
-#define X_RBRC X_RBRACKET
-#define X_BSLS X_BSLASH
+#define X_LBRC X_LEFT_BRACKET
+#define X_RBRC X_RIGHT_BRACKET
+#define X_BSLS X_BACKSLASH
#define X_NUHS X_NONUS_HASH
-#define X_SCLN X_SCOLON
+#define X_SCLN X_SEMICOLON
#define X_QUOT X_QUOTE
#define X_GRV X_GRAVE
#define X_COMM X_COMMA
#define X_SLSH X_SLASH
-#define X_NUBS X_NONUS_BSLASH
+#define X_NUBS X_NONUS_BACKSLASH
/* Lock Keys */
-#define X_CLCK X_CAPSLOCK
-#define X_CAPS X_CAPSLOCK
-#define X_SLCK X_SCROLLLOCK
-#define X_NLCK X_NUMLOCK
-#define X_LCAP X_LOCKING_CAPS
-#define X_LNUM X_LOCKING_NUM
-#define X_LSCR X_LOCKING_SCROLL
+#define X_CAPS X_CAPS_LOCK
+#define X_SCRL X_SCROLL_LOCK
+#define X_NUM X_NUM_LOCK
+#define X_LCAP X_LOCKING_CAPS_LOCK
+#define X_LNUM X_LOCKING_NUM_LOCK
+#define X_LSCR X_LOCKING_SCROLL_LOCK
/* Commands */
-#define X_PSCR X_PSCREEN
+#define X_PSCR X_PRINT_SCREEN
#define X_PAUS X_PAUSE
#define X_BRK X_PAUSE
#define X_INS X_INSERT
+#define X_PGUP X_PAGE_UP
#define X_DEL X_DELETE
-#define X_PGDN X_PGDOWN
+#define X_PGDN X_PAGE_DOWN
#define X_RGHT X_RIGHT
#define X_APP X_APPLICATION
#define X_EXEC X_EXECUTE
#define X_SLCT X_SELECT
#define X_AGIN X_AGAIN
#define X_PSTE X_PASTE
-#define X_ERAS X_ALT_ERASE
+#define X_ERAS X_ALTERNATE_ERASE
+#define X_SYRQ X_SYSTEM_REQUEST
+#define X_CNCL X_CANCEL
#define X_CLR X_CLEAR
+#define X_PRIR X_PRIOR
+#define X_RETN X_RETURN
+#define X_SEPR X_SEPARATOR
+#define X_CLAG X_CLEAR_AGAIN
+#define X_CRSL X_CRSEL
+#define X_EXSL X_EXSEL
/* Keypad */
#define X_PSLS X_KP_SLASH
@@ -81,30 +89,42 @@
#define X_PEQL X_KP_EQUAL
#define X_PCMM X_KP_COMMA
-/* Japanese specific */
-#define X_ZKHK X_GRAVE
-#define X_RO X_INT1
-#define X_KANA X_INT2
-#define X_JYEN X_INT3
-#define X_HENK X_INT4
-#define X_MHEN X_INT5
-
-/* Korean specific */
-#define X_HAEN X_LANG1
-#define X_HANJ X_LANG2
+/* Language Specific */
+#define X_INT1 X_INTERNATIONAL_1
+#define X_INT2 X_INTERNATIONAL_2
+#define X_INT3 X_INTERNATIONAL_3
+#define X_INT4 X_INTERNATIONAL_4
+#define X_INT5 X_INTERNATIONAL_5
+#define X_INT6 X_INTERNATIONAL_6
+#define X_INT7 X_INTERNATIONAL_7
+#define X_INT8 X_INTERNATIONAL_8
+#define X_INT9 X_INTERNATIONAL_9
+#define X_LNG1 X_LANGUAGE_1
+#define X_LNG2 X_LANGUAGE_2
+#define X_LNG3 X_LANGUAGE_3
+#define X_LNG4 X_LANGUAGE_4
+#define X_LNG5 X_LANGUAGE_5
+#define X_LNG6 X_LANGUAGE_6
+#define X_LNG7 X_LANGUAGE_7
+#define X_LNG8 X_LANGUAGE_8
+#define X_LNG9 X_LANGUAGE_9
/* Modifiers */
-#define X_LCTL X_LCTRL
-#define X_LSFT X_LSHIFT
-#define X_LOPT X_LALT
-#define X_LCMD X_LGUI
-#define X_LWIN X_LGUI
-#define X_RCTL X_RCTRL
-#define X_RSFT X_RSHIFT
-#define X_ALGR X_RALT
-#define X_ROPT X_RALT
-#define X_RCMD X_RGUI
-#define X_RWIN X_RGUI
+#define X_LCTL X_LEFT_CTRL
+#define X_LSFT X_LEFT_SHIFT
+#define X_LALT X_LEFT_ALT
+#define X_LOPT X_LEFT_ALT
+#define X_LGUI X_LEFT_GUI
+#define X_LCMD X_LEFT_GUI
+#define X_LWIN X_LEFT_GUI
+#define X_RCTL X_RIGHT_CTRL
+#define X_RSFT X_RIGHT_SHIFT
+#define X_RALT X_RIGHT_ALT
+#define X_ALGR X_RIGHT_ALT
+#define X_ROPT X_RIGHT_ALT
+#define X_RGUI X_RIGHT_GUI
+#define X_RCMD X_RIGHT_GUI
+#define X_RWIN X_RIGHT_GUI
/* Generic Desktop Page (0x01) */
#define X_PWR X_SYSTEM_POWER
@@ -137,7 +157,7 @@
/* System Specific */
#define X_BRMU X_PAUSE
-#define X_BRMD X_SCROLLLOCK
+#define X_BRMD X_SCROLL_LOCK
/* Mouse Keys */
#define X_MS_U X_MS_UP
@@ -149,6 +169,9 @@
#define X_BTN3 X_MS_BTN3
#define X_BTN4 X_MS_BTN4
#define X_BTN5 X_MS_BTN5
+#define X_BTN6 X_MS_BTN6
+#define X_BTN7 X_MS_BTN7
+#define X_BTN8 X_MS_BTN8
#define X_WH_U X_MS_WH_UP
#define X_WH_D X_MS_WH_DOWN
#define X_WH_L X_MS_WH_LEFT
@@ -158,157 +181,157 @@
#define X_ACL2 X_MS_ACCEL2
/* Keyboard/Keypad Page (0x07) */
-#define X_A 04
-#define X_B 05
-#define X_C 06
-#define X_D 07
-#define X_E 08
-#define X_F 09
-#define X_G 0a
-#define X_H 0b
-#define X_I 0c
-#define X_J 0d
-#define X_K 0e
-#define X_L 0f
-#define X_M 10
-#define X_N 11
-#define X_O 12
-#define X_P 13
-#define X_Q 14
-#define X_R 15
-#define X_S 16
-#define X_T 17
-#define X_U 18
-#define X_V 19
-#define X_W 1a
-#define X_X 1b
-#define X_Y 1c
-#define X_Z 1d
-#define X_1 1e
-#define X_2 1f
-#define X_3 20
-#define X_4 21
-#define X_5 22
-#define X_6 23
-#define X_7 24
-#define X_8 25
-#define X_9 26
-#define X_0 27
-#define X_ENTER 28
-#define X_ESCAPE 29
-#define X_BSPACE 2a
-#define X_TAB 2b
-#define X_SPACE 2c
-#define X_MINUS 2d
-#define X_EQUAL 2e
-#define X_LBRACKET 2f
-#define X_RBRACKET 30
-#define X_BSLASH 31
-#define X_NONUS_HASH 32
-#define X_SCOLON 33
-#define X_QUOTE 34
-#define X_GRAVE 35
-#define X_COMMA 36
-#define X_DOT 37
-#define X_SLASH 38
-#define X_CAPSLOCK 39
-#define X_F1 3a
-#define X_F2 3b
-#define X_F3 3c
-#define X_F4 3d
-#define X_F5 3e
-#define X_F6 3f
-#define X_F7 40
-#define X_F8 41
-#define X_F9 42
-#define X_F10 43
-#define X_F11 44
-#define X_F12 45
-#define X_PSCREEN 46
-#define X_SCROLLLOCK 47
-#define X_PAUSE 48
-#define X_INSERT 49
-#define X_HOME 4a
-#define X_PGUP 4b
-#define X_DELETE 4c
-#define X_END 4d
-#define X_PGDOWN 4e
-#define X_RIGHT 4f
-#define X_LEFT 50
-#define X_DOWN 51
-#define X_UP 52
-#define X_NUMLOCK 53
-#define X_KP_SLASH 54
-#define X_KP_ASTERISK 55
-#define X_KP_MINUS 56
-#define X_KP_PLUS 57
-#define X_KP_ENTER 58
-#define X_KP_1 59
-#define X_KP_2 5a
-#define X_KP_3 5b
-#define X_KP_4 5c
-#define X_KP_5 5d
-#define X_KP_6 5e
-#define X_KP_7 5f
-#define X_KP_8 60
-#define X_KP_9 61
-#define X_KP_0 62
-#define X_KP_DOT 63
-#define X_NONUS_BSLASH 64
-#define X_APPLICATION 65
-#define X_POWER 66
-#define X_KP_EQUAL 67
-#define X_F13 68
-#define X_F14 69
-#define X_F15 6a
-#define X_F16 6b
-#define X_F17 6c
-#define X_F18 6d
-#define X_F19 6e
-#define X_F20 6f
-#define X_F21 70
-#define X_F22 71
-#define X_F23 72
-#define X_F24 73
-#define X_EXECUTE 74
-#define X_HELP 75
-#define X_MENU 76
-#define X_SELECT 77
-#define X_STOP 78
-#define X_AGAIN 79
-#define X_UNDO 7a
-#define X_CUT 7b
-#define X_COPY 7c
-#define X_PASTE 7d
-#define X_FIND 7e
-#define X__MUTE 7f
-#define X__VOLUP 80
-#define X__VOLDOWN 81
-#define X_LOCKING_CAPS 82
-#define X_LOCKING_NUM 83
-#define X_LOCKING_SCROLL 84
+#define X_A 04
+#define X_B 05
+#define X_C 06
+#define X_D 07
+#define X_E 08
+#define X_F 09
+#define X_G 0a
+#define X_H 0b
+#define X_I 0c
+#define X_J 0d
+#define X_K 0e
+#define X_L 0f
+#define X_M 10
+#define X_N 11
+#define X_O 12
+#define X_P 13
+#define X_Q 14
+#define X_R 15
+#define X_S 16
+#define X_T 17
+#define X_U 18
+#define X_V 19
+#define X_W 1a
+#define X_X 1b
+#define X_Y 1c
+#define X_Z 1d
+#define X_1 1e
+#define X_2 1f
+#define X_3 20
+#define X_4 21
+#define X_5 22
+#define X_6 23
+#define X_7 24
+#define X_8 25
+#define X_9 26
+#define X_0 27
+#define X_ENTER 28
+#define X_ESCAPE 29
+#define X_BACKSPACE 2a
+#define X_TAB 2b
+#define X_SPACE 2c
+#define X_MINUS 2d
+#define X_EQUAL 2e
+#define X_LEFT_BRACKET 2f
+#define X_RIGHT_BRACKET 30
+#define X_BACKSLASH 31
+#define X_NONUS_HASH 32
+#define X_SEMICOLON 33
+#define X_QUOTE 34
+#define X_GRAVE 35
+#define X_COMMA 36
+#define X_DOT 37
+#define X_SLASH 38
+#define X_CAPS_LOCK 39
+#define X_F1 3a
+#define X_F2 3b
+#define X_F3 3c
+#define X_F4 3d
+#define X_F5 3e
+#define X_F6 3f
+#define X_F7 40
+#define X_F8 41
+#define X_F9 42
+#define X_F10 43
+#define X_F11 44
+#define X_F12 45
+#define X_PRINT_SCREEN 46
+#define X_SCROLL_LOCK 47
+#define X_PAUSE 48
+#define X_INSERT 49
+#define X_HOME 4a
+#define X_PAGE_UP 4b
+#define X_DELETE 4c
+#define X_END 4d
+#define X_PAGE_DOWN 4e
+#define X_RIGHT 4f
+#define X_LEFT 50
+#define X_DOWN 51
+#define X_UP 52
+#define X_NUM_LOCK 53
+#define X_KP_SLASH 54
+#define X_KP_ASTERISK 55
+#define X_KP_MINUS 56
+#define X_KP_PLUS 57
+#define X_KP_ENTER 58
+#define X_KP_1 59
+#define X_KP_2 5a
+#define X_KP_3 5b
+#define X_KP_4 5c
+#define X_KP_5 5d
+#define X_KP_6 5e
+#define X_KP_7 5f
+#define X_KP_8 60
+#define X_KP_9 61
+#define X_KP_0 62
+#define X_KP_DOT 63
+#define X_NONUS_BACKSLASH 64
+#define X_APPLICATION 65
+#define X_KB_POWER 66
+#define X_KP_EQUAL 67
+#define X_F13 68
+#define X_F14 69
+#define X_F15 6a
+#define X_F16 6b
+#define X_F17 6c
+#define X_F18 6d
+#define X_F19 6e
+#define X_F20 6f
+#define X_F21 70
+#define X_F22 71
+#define X_F23 72
+#define X_F24 73
+#define X_EXECUTE 74
+#define X_HELP 75
+#define X_MENU 76
+#define X_SELECT 77
+#define X_STOP 78
+#define X_AGAIN 79
+#define X_UNDO 7a
+#define X_CUT 7b
+#define X_COPY 7c
+#define X_PASTE 7d
+#define X_FIND 7e
+#define X_KB_MUTE 7f
+#define X_KB_VOLUME_UP 80
+#define X_KB_VOLUME_DOWN 81
+#define X_LOCKING_CAPS_LOCK 82
+#define X_LOCKING_NUM_LOCK 83
+#define X_LOCKING_SCROLL_LOCK 84
#define X_KP_COMMA 85
#define X_KP_EQUAL_AS400 86
-#define X_INT1 87
-#define X_INT2 88
-#define X_INT3 89
-#define X_INT4 8a
-#define X_INT5 8b
-#define X_INT6 8c
-#define X_INT7 8d
-#define X_INT8 8e
-#define X_INT9 8f
-#define X_LANG1 90
-#define X_LANG2 91
-#define X_LANG3 92
-#define X_LANG4 93
-#define X_LANG5 94
-#define X_LANG6 95
-#define X_LANG7 96
-#define X_LANG8 97
-#define X_LANG9 98
-#define X_ALT_ERASE 99
-#define X_SYSREQ 9a
+#define X_INTERNATIONAL_1 87
+#define X_INTERNATIONAL_2 88
+#define X_INTERNATIONAL_3 89
+#define X_INTERNATIONAL_4 8a
+#define X_INTERNATIONAL_5 8b
+#define X_INTERNATIONAL_6 8c
+#define X_INTERNATIONAL_7 8d
+#define X_INTERNATIONAL_8 8e
+#define X_INTERNATIONAL_9 8f
+#define X_LANGUAGE_1 90
+#define X_LANGUAGE_2 91
+#define X_LANGUAGE_3 92
+#define X_LANGUAGE_4 93
+#define X_LANGUAGE_5 94
+#define X_LANGUAGE_6 95
+#define X_LANGUAGE_7 96
+#define X_LANGUAGE_8 97
+#define X_LANGUAGE_9 98
+#define X_ALTERNATE_ERASE 99
+#define X_SYSTEM_REQUEST 9a
#define X_CANCEL 9b
#define X_CLEAR 9c
#define X_PRIOR 9d
@@ -321,14 +344,14 @@
#define X_EXSEL a4
/* Modifiers */
-#define X_LCTRL e0
-#define X_LSHIFT e1
-#define X_LALT e2
-#define X_LGUI e3
-#define X_RCTRL e4
-#define X_RSHIFT e5
-#define X_RALT e6
-#define X_RGUI e7
+#define X_LEFT_CTRL e0
+#define X_LEFT_SHIFT e1
+#define X_LEFT_ALT e2
+#define X_LEFT_GUI e3
+#define X_RIGHT_CTRL e4
+#define X_RIGHT_SHIFT e5
+#define X_RIGHT_ALT e6
+#define X_RIGHT_GUI e7
/* Media and Function keys */
/* Generic Desktop Page (0x01) */
@@ -431,4 +454,52 @@
#define SS_RWIN(string) SS_RGUI(string)
// DEPRECATED
+#define X_BSPACE X_BACKSPACE
+#define X_LBRACKET X_LEFT_BRACKET
+#define X_RBRACKET X_RIGHT_BRACKET
+#define X_BSLASH X_BACKSLASH
+#define X_SCOLON X_SEMICOLON
+#define X_CAPSLOCK X_CAPS_LOCK
+#define X_PSCREEN X_PRINT_SCREEN
+#define X_SCROLLLOCK X_SCROLL_LOCK
+#define X_PGDOWN X_PAGE_DOWN
+#define X_NUMLOCK X_NUM_LOCK
+#define X_NONUS_BSLASH X_NONUS_BACKSLASH
+#define X_POWER X_KB_POWER
+#define X__MUTE X_KB_MUTE
+#define X__VOLUP X_KB_VOLUME_UP
+#define X__VOLDOWN X_KB_VOLUME_DOWN
+#define X_LOCKING_CAPS X_LOCKING_CAPS_LOCK
+#define X_LOCKING_NUM X_LOCKING_NUM_LOCK
+#define X_LOCKING_SCROLL X_LOCKING_SCROLL_LOCK
+#define X_LANG1 X_LANGUAGE_1
+#define X_LANG2 X_LANGUAGE_2
+#define X_LANG3 X_LANGUAGE_3
+#define X_LANG4 X_LANGUAGE_4
+#define X_LANG5 X_LANGUAGE_5
+#define X_LANG6 X_LANGUAGE_6
+#define X_LANG7 X_LANGUAGE_7
+#define X_LANG8 X_LANGUAGE_8
+#define X_LANG9 X_LANGUAGE_9
+#define X_ALT_ERASE X_ALTERNATE_ERASE
+#define X_SYSREQ X_SYSTEM_REQUEST
+
+#define X_LCTRL X_LEFT_CTRL
+#define X_LSHIFT X_LEFT_SHIFT
+#define X_RCTRL X_RIGHT_CTRL
+#define X_RSHIFT X_RIGHT_SHIFT
+
+#define X_ZKHK X_GRAVE
+#define X_RO X_INTERNATIONAL_1
+#define X_KANA X_INTERNATIONAL_2
+#define X_JYEN X_INTERNATIONAL_3
+#define X_HENK X_INTERNATIONAL_4
+#define X_MHEN X_INTERNATIONAL_5
+#define X_HAEN X_LANGUAGE_1
+#define X_HANJ X_LANGUAGE_2
+
+#define X_CLCK X_CAPS_LOCK
+#define X_SLCK X_SCROLL_LOCK
+#define X_NLCK X_NUM_LOCK
+
#define SS_LCTRL(string) SS_LCTL(string)
diff --git a/quantum/split_common/transactions.c b/quantum/split_common/transactions.c
index cffbccaeee..9e3df534e3 100644
--- a/quantum/split_common/transactions.c
+++ b/quantum/split_common/transactions.c
@@ -23,8 +23,9 @@
#include "quantum.h"
#include "transactions.h"
#include "transport.h"
-#include "split_util.h"
#include "transaction_id_define.h"
+#include "split_util.h"
+#include "synchronization_util.h"
#define SYNC_TIMER_OFFSET 2
@@ -63,9 +64,7 @@ static bool transaction_handler_master(matrix_row_t master_matrix[], matrix_row_
}
}
bool this_okay = true;
- ATOMIC_BLOCK_FORCEON {
- this_okay = handler(master_matrix, slave_matrix);
- };
+ this_okay = handler(master_matrix, slave_matrix);
if (this_okay) return true;
}
dprintf("Failed to execute %s\n", prefix);
@@ -77,11 +76,11 @@ static bool transaction_handler_master(matrix_row_t master_matrix[], matrix_row_
if (!transaction_handler_master(master_matrix, slave_matrix, #prefix, &prefix##_handlers_master)) return false; \
} while (0)
-#define TRANSACTION_HANDLER_SLAVE(prefix) \
- do { \
- ATOMIC_BLOCK_FORCEON { \
- prefix##_handlers_slave(master_matrix, slave_matrix); \
- }; \
+#define TRANSACTION_HANDLER_SLAVE(prefix) \
+ do { \
+ split_shared_memory_lock(); \
+ prefix##_handlers_slave(master_matrix, slave_matrix); \
+ split_shared_memory_unlock(); \
} while (0)
inline static bool read_if_checksum_mismatch(int8_t trans_id_checksum, int8_t trans_id_retrieve, uint32_t *last_update, void *destination, const void *equiv_shmem, size_t length) {
@@ -180,7 +179,7 @@ static void master_matrix_handlers_slave(matrix_row_t master_matrix[], matrix_ro
static bool encoder_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
static uint32_t last_update = 0;
- uint8_t temp_state[NUMBER_OF_ENCODERS];
+ uint8_t temp_state[NUM_ENCODERS_MAX_PER_SIDE];
bool okay = read_if_checksum_mismatch(GET_ENCODERS_CHECKSUM, GET_ENCODERS_DATA, &last_update, temp_state, split_shmem->encoders.state, sizeof(temp_state));
if (okay) encoder_update_raw(temp_state);
@@ -188,7 +187,7 @@ static bool encoder_handlers_master(matrix_row_t master_matrix[], matrix_row_t s
}
static void encoder_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
- uint8_t encoder_state[NUMBER_OF_ENCODERS];
+ uint8_t encoder_state[NUM_ENCODERS_MAX_PER_SIDE];
encoder_state_raw(encoder_state);
// Always prepare the encoder state for read.
memcpy(split_shmem->encoders.state, encoder_state, sizeof(encoder_state));
diff --git a/quantum/split_common/transport.h b/quantum/split_common/transport.h
index 26bd136728..e62679990a 100644
--- a/quantum/split_common/transport.h
+++ b/quantum/split_common/transport.h
@@ -42,7 +42,6 @@ bool transport_execute_transaction(int8_t id, const void *initiator2target_buf,
#ifdef ENCODER_ENABLE
# include "encoder.h"
-# define NUMBER_OF_ENCODERS (sizeof((pin_t[])ENCODERS_PAD_A) / sizeof(pin_t))
#endif // ENCODER_ENABLE
#ifdef BACKLIGHT_ENABLE
@@ -67,7 +66,7 @@ typedef struct _split_master_matrix_sync_t {
#ifdef ENCODER_ENABLE
typedef struct _split_slave_encoder_sync_t {
uint8_t checksum;
- uint8_t state[NUMBER_OF_ENCODERS];
+ uint8_t state[NUM_ENCODERS_MAX_PER_SIDE];
} split_slave_encoder_sync_t;
#endif // ENCODER_ENABLE
diff --git a/quantum/utf8.c b/quantum/utf8.c
new file mode 100644
index 0000000000..4b2cd4d8d4
--- /dev/null
+++ b/quantum/utf8.c
@@ -0,0 +1,46 @@
+/* Copyright 2021 QMK
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "utf8.h"
+
+// Borrowed from https://nullprogram.com/blog/2017/10/06/
+const char *decode_utf8(const char *str, int32_t *code_point) {
+ const char *next;
+
+ if (str[0] < 0x80) { // U+0000-007F
+ *code_point = str[0];
+ next = str + 1;
+ } else if ((str[0] & 0xE0) == 0xC0) { // U+0080-07FF
+ *code_point = ((int32_t)(str[0] & 0x1F) << 6) | ((int32_t)(str[1] & 0x3F) << 0);
+ next = str + 2;
+ } else if ((str[0] & 0xF0) == 0xE0) { // U+0800-FFFF
+ *code_point = ((int32_t)(str[0] & 0x0F) << 12) | ((int32_t)(str[1] & 0x3F) << 6) | ((int32_t)(str[2] & 0x3F) << 0);
+ next = str + 3;
+ } else if ((str[0] & 0xF8) == 0xF0 && (str[0] <= 0xF4)) { // U+10000-10FFFF
+ *code_point = ((int32_t)(str[0] & 0x07) << 18) | ((int32_t)(str[1] & 0x3F) << 12) | ((int32_t)(str[2] & 0x3F) << 6) | ((int32_t)(str[3] & 0x3F) << 0);
+ next = str + 4;
+ } else {
+ *code_point = -1;
+ next = str + 1;
+ }
+
+ // part of a UTF-16 surrogate pair - invalid
+ if (*code_point >= 0xD800 && *code_point <= 0xDFFF) {
+ *code_point = -1;
+ }
+
+ return next;
+}
diff --git a/quantum/utf8.h b/quantum/utf8.h
new file mode 100644
index 0000000000..fb10910944
--- /dev/null
+++ b/quantum/utf8.h
@@ -0,0 +1,21 @@
+/* Copyright 2021 QMK
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <stdint.h>
+
+const char *decode_utf8(const char *str, int32_t *code_point); \ No newline at end of file
diff --git a/quantum/util.h b/quantum/util.h
index bef3b9abe3..ab96ce4bde 100644
--- a/quantum/util.h
+++ b/quantum/util.h
@@ -24,3 +24,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// convert to string
#define STR(s) XSTR(s)
#define XSTR(s) #s
+
+#if !defined(MIN)
+# define MIN(x, y) (((x) < (y)) ? (x) : (y))
+#endif
+
+#if !defined(MAX)
+# define MAX(x, y) (((x) > (y)) ? (x) : (y))
+#endif
diff --git a/quantum/via.c b/quantum/via.c
index 05ab799cbb..320bd5546d 100644
--- a/quantum/via.c
+++ b/quantum/via.c
@@ -38,6 +38,10 @@
# define VIA_QMK_RGBLIGHT_ENABLE
#endif
+#if defined(RGB_MATRIX_ENABLE) && !defined(VIA_QMK_RGBLIGHT_ENABLE) && !defined(VIA_CUSTOM_LIGHTING_ENABLE)
+# define VIA_QMK_RGB_MATRIX_ENABLE
+#endif
+
#include "quantum.h"
#include "via.h"
@@ -59,6 +63,12 @@ void via_qmk_rgblight_set_value(uint8_t *data);
void via_qmk_rgblight_get_value(uint8_t *data);
#endif
+#if defined(VIA_QMK_RGB_MATRIX_ENABLE)
+void via_qmk_rgb_matrix_set_value(uint8_t *data);
+void via_qmk_rgb_matrix_get_value(uint8_t *data);
+void eeconfig_update_rgb_matrix(void);
+#endif
+
// Can be called in an overriding via_init_kb() to test if keyboard level code usage of
// EEPROM is invalid and use/save defaults.
bool via_eeprom_is_valid(void) {
@@ -287,10 +297,13 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
#if defined(VIA_QMK_RGBLIGHT_ENABLE)
via_qmk_rgblight_set_value(command_data);
#endif
+#if defined(VIA_QMK_RGB_MATRIX_ENABLE)
+ via_qmk_rgb_matrix_set_value(command_data);
+#endif
#if defined(VIA_CUSTOM_LIGHTING_ENABLE)
raw_hid_receive_kb(data, length);
#endif
-#if !defined(VIA_QMK_BACKLIGHT_ENABLE) && !defined(VIA_QMK_RGBLIGHT_ENABLE) && !defined(VIA_CUSTOM_LIGHTING_ENABLE)
+#if !defined(VIA_QMK_BACKLIGHT_ENABLE) && !defined(VIA_QMK_RGBLIGHT_ENABLE) && !defined(VIA_CUSTOM_LIGHTING_ENABLE) && !defined(VIA_QMK_RGB_MATRIX_ENABLE)
// Return the unhandled state
*command_id = id_unhandled;
#endif
@@ -303,10 +316,13 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
#if defined(VIA_QMK_RGBLIGHT_ENABLE)
via_qmk_rgblight_get_value(command_data);
#endif
+#if defined(VIA_QMK_RGB_MATRIX_ENABLE)
+ via_qmk_rgb_matrix_get_value(command_data);
+#endif
#if defined(VIA_CUSTOM_LIGHTING_ENABLE)
raw_hid_receive_kb(data, length);
#endif
-#if !defined(VIA_QMK_BACKLIGHT_ENABLE) && !defined(VIA_QMK_RGBLIGHT_ENABLE) && !defined(VIA_CUSTOM_LIGHTING_ENABLE)
+#if !defined(VIA_QMK_BACKLIGHT_ENABLE) && !defined(VIA_QMK_RGBLIGHT_ENABLE) && !defined(VIA_CUSTOM_LIGHTING_ENABLE) && !defined(VIA_QMK_RGB_MATRIX_ENABLE)
// Return the unhandled state
*command_id = id_unhandled;
#endif
@@ -319,10 +335,13 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
#if defined(VIA_QMK_RGBLIGHT_ENABLE)
eeconfig_update_rgblight_current();
#endif
+#if defined(VIA_QMK_RGB_MATRIX_ENABLE)
+ eeconfig_update_rgb_matrix();
+#endif
#if defined(VIA_CUSTOM_LIGHTING_ENABLE)
raw_hid_receive_kb(data, length);
#endif
-#if !defined(VIA_QMK_BACKLIGHT_ENABLE) && !defined(VIA_QMK_RGBLIGHT_ENABLE) && !defined(VIA_CUSTOM_LIGHTING_ENABLE)
+#if !defined(VIA_QMK_BACKLIGHT_ENABLE) && !defined(VIA_QMK_RGBLIGHT_ENABLE) && !defined(VIA_CUSTOM_LIGHTING_ENABLE) && !defined(VIA_QMK_RGB_MATRIX_ENABLE)
// Return the unhandled state
*command_id = id_unhandled;
#endif
@@ -495,3 +514,86 @@ void via_qmk_rgblight_set_value(uint8_t *data) {
}
#endif // #if defined(VIA_QMK_RGBLIGHT_ENABLE)
+
+#if defined(VIA_QMK_RGB_MATRIX_ENABLE)
+
+// VIA supports only 4 discrete values for effect speed; map these to some
+// useful speed values for RGB Matrix.
+enum speed_values {
+ RGBLIGHT_SPEED_0 = UINT8_MAX / 16, // not 0 to avoid really slow effects
+ RGBLIGHT_SPEED_1 = UINT8_MAX / 4,
+ RGBLIGHT_SPEED_2 = UINT8_MAX / 2, // matches the default value
+ RGBLIGHT_SPEED_3 = UINT8_MAX / 4 * 3, // UINT8_MAX is really fast
+};
+
+static uint8_t speed_from_rgblight(uint8_t rgblight_speed) {
+ switch (rgblight_speed) {
+ case 0:
+ return RGBLIGHT_SPEED_0;
+ case 1:
+ return RGBLIGHT_SPEED_1;
+ case 2:
+ default:
+ return RGBLIGHT_SPEED_2;
+ case 3:
+ return RGBLIGHT_SPEED_3;
+ }
+}
+
+static uint8_t speed_to_rgblight(uint8_t rgb_matrix_speed) {
+ if (rgb_matrix_speed < ((RGBLIGHT_SPEED_0 + RGBLIGHT_SPEED_1) / 2)) {
+ return 0;
+ } else if (rgb_matrix_speed < ((RGBLIGHT_SPEED_1 + RGBLIGHT_SPEED_2) / 2)) {
+ return 1;
+ } else if (rgb_matrix_speed < ((RGBLIGHT_SPEED_2 + RGBLIGHT_SPEED_3) / 2)) {
+ return 2;
+ } else {
+ return 3;
+ }
+}
+
+void via_qmk_rgb_matrix_get_value(uint8_t *data) {
+ uint8_t *value_id = &(data[0]);
+ uint8_t *value_data = &(data[1]);
+ switch (*value_id) {
+ case id_qmk_rgblight_brightness:
+ value_data[0] = rgb_matrix_get_val();
+ break;
+ case id_qmk_rgblight_effect:
+ value_data[0] = rgb_matrix_get_mode();
+ break;
+ case id_qmk_rgblight_effect_speed:
+ value_data[0] = speed_to_rgblight(rgb_matrix_get_speed());
+ break;
+ case id_qmk_rgblight_color:
+ value_data[0] = rgb_matrix_get_hue();
+ value_data[1] = rgb_matrix_get_sat();
+ break;
+ }
+}
+
+void via_qmk_rgb_matrix_set_value(uint8_t *data) {
+ uint8_t *value_id = &(data[0]);
+ uint8_t *value_data = &(data[1]);
+ switch (*value_id) {
+ case id_qmk_rgblight_brightness:
+ rgb_matrix_sethsv_noeeprom(rgb_matrix_get_hue(), rgb_matrix_get_sat(), value_data[0]);
+ break;
+ case id_qmk_rgblight_effect:
+ rgb_matrix_mode_noeeprom(value_data[0]);
+ if (value_data[0] == 0) {
+ rgb_matrix_disable_noeeprom();
+ } else {
+ rgb_matrix_enable_noeeprom();
+ }
+ break;
+ case id_qmk_rgblight_effect_speed:
+ rgb_matrix_set_speed_noeeprom(speed_from_rgblight(value_data[0]));
+ break;
+ case id_qmk_rgblight_color:
+ rgb_matrix_sethsv_noeeprom(value_data[0], value_data[1], rgb_matrix_get_val());
+ break;
+ }
+}
+
+#endif // #if defined(VIA_QMK_RGB_MATRIX_ENABLE)
diff --git a/readme.md b/readme.md
index 5649ddfa09..63b483c744 100644
--- a/readme.md
+++ b/readme.md
@@ -1,3 +1,7 @@
+# This is the `develop` branch!
+
+See the [Breaking Changes](https://docs.qmk.fm/#/breaking_changes) document for more information.
+
# Quantum Mechanical Keyboard Firmware
[![Current Version](https://img.shields.io/github/tag/qmk/qmk_firmware.svg)](https://github.com/qmk/qmk_firmware/tags)
diff --git a/requirements.txt b/requirements.txt
index 92381d7d51..e09d58d829 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,8 +4,9 @@ argcomplete
colorama
hid
hjson
-jsonschema>=3
+jsonschema>=4
milc>=1.4.2
pygments
pyusb
qmk-dotty-dict
+pillow
diff --git a/setup.cfg b/setup.cfg
index c7d7952098..6cbe1a616d 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -6,7 +6,11 @@ ignore =
# Conflicts with our yapf config
E231
per_file_ignores =
+ # Module imported but unused
**/__init__.py:F401
+ # Quantum Painter also outputs append data using bytes object arithmetic on multiple lines
+ **/painter_qgf.py:W503
+ **/painter_qff.py:W503
# Let's slowly crank this down
max_complexity=16
diff --git a/tests/caps_word/config.h b/tests/caps_word/config.h
new file mode 100644
index 0000000000..0d5cebd778
--- /dev/null
+++ b/tests/caps_word/config.h
@@ -0,0 +1,21 @@
+// Copyright 2022 Google LLC
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#pragma once
+
+#include "test_common.h"
+
+#define BOTH_SHIFTS_TURNS_ON_CAPS_WORD
+#define DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD
diff --git a/tests/caps_word/test.mk b/tests/caps_word/test.mk
new file mode 100644
index 0000000000..2509b01858
--- /dev/null
+++ b/tests/caps_word/test.mk
@@ -0,0 +1,19 @@
+# Copyright 2022 Google LLC
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CAPS_WORD_ENABLE = yes
+COMMAND_ENABLE = no
+SPACE_CADET_ENABLE = yes
+
diff --git a/tests/caps_word/test_caps_word.cpp b/tests/caps_word/test_caps_word.cpp
new file mode 100644
index 0000000000..bcc8c53326
--- /dev/null
+++ b/tests/caps_word/test_caps_word.cpp
@@ -0,0 +1,423 @@
+// Copyright 2022 Google LLC
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#include "keyboard_report_util.hpp"
+#include "keycode.h"
+#include "test_common.hpp"
+#include "test_fixture.hpp"
+#include "test_keymap_key.hpp"
+
+using ::testing::_;
+using ::testing::AnyNumber;
+using ::testing::AnyOf;
+using ::testing::InSequence;
+using ::testing::TestParamInfo;
+
+class CapsWord : public TestFixture {
+ public:
+ void SetUp() override {
+ caps_word_off();
+ }
+
+ // Convenience function to tap `key`.
+ void TapKey(KeymapKey key) {
+ key.press();
+ run_one_scan_loop();
+ key.release();
+ run_one_scan_loop();
+ }
+
+ // Taps in order each key in `keys`.
+ template <typename... Ts>
+ void TapKeys(Ts... keys) {
+ for (KeymapKey key : {keys...}) {
+ TapKey(key);
+ }
+ }
+};
+
+// Tests caps_word_on(), _off(), and _toggle() functions.
+TEST_F(CapsWord, OnOffToggleFuns) {
+ TestDriver driver;
+
+ EXPECT_EQ(is_caps_word_on(), false);
+
+ caps_word_on();
+ EXPECT_EQ(is_caps_word_on(), true);
+ caps_word_on();
+ EXPECT_EQ(is_caps_word_on(), true);
+
+ caps_word_off();
+ EXPECT_EQ(is_caps_word_on(), false);
+ caps_word_off();
+ EXPECT_EQ(is_caps_word_on(), false);
+
+ caps_word_toggle();
+ EXPECT_EQ(is_caps_word_on(), true);
+ caps_word_toggle();
+ EXPECT_EQ(is_caps_word_on(), false);
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+// Tests the default `caps_word_press_user()` function.
+TEST_F(CapsWord, DefaultCapsWordPressUserFun) {
+ // Spot check some keycodes that continue Caps Word, with shift applied.
+ for (uint16_t keycode : {KC_A, KC_B, KC_Z, KC_MINS}) {
+ SCOPED_TRACE("keycode: " + testing::PrintToString(keycode));
+ clear_weak_mods();
+ EXPECT_TRUE(caps_word_press_user(keycode));
+ EXPECT_EQ(get_weak_mods(), MOD_BIT(KC_LSFT));
+ }
+
+ // Some keycodes that continue Caps Word, without shifting.
+ for (uint16_t keycode : {KC_1, KC_9, KC_0, KC_BSPC, KC_DEL}) {
+ SCOPED_TRACE("keycode: " + testing::PrintToString(keycode));
+ clear_weak_mods();
+ EXPECT_TRUE(caps_word_press_user(keycode));
+ EXPECT_EQ(get_weak_mods(), 0);
+ }
+
+ // Some keycodes that turn off Caps Word.
+ for (uint16_t keycode : {KC_SPC, KC_DOT, KC_COMM, KC_TAB, KC_ESC, KC_ENT}) {
+ SCOPED_TRACE("keycode: " + testing::PrintToString(keycode));
+ EXPECT_FALSE(caps_word_press_user(keycode));
+ }
+}
+
+// Tests that `CAPSWRD` key toggles Caps Word.
+TEST_F(CapsWord, CapswrdKey) {
+ TestDriver driver;
+ KeymapKey key_capswrd(0, 0, 0, CAPSWRD);
+ set_keymap({key_capswrd});
+
+ // No keyboard reports should be sent.
+ EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
+
+ TapKey(key_capswrd); // Tap the CAPSWRD key.
+ EXPECT_EQ(is_caps_word_on(), true);
+
+ TapKey(key_capswrd); // Tap the CAPSWRD key again.
+ EXPECT_EQ(is_caps_word_on(), false);
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+// Tests that being idle for CAPS_WORD_IDLE_TIMEOUT turns off Caps Word.
+TEST_F(CapsWord, IdleTimeout) {
+ TestDriver driver;
+ KeymapKey key_a(0, 0, 0, KC_A);
+ set_keymap({key_a});
+
+ // Allow any number of reports with no keys or only KC_LSFT.
+ // clang-format off
+ EXPECT_CALL(driver, send_keyboard_mock(AnyOf(
+ KeyboardReport(),
+ KeyboardReport(KC_LSFT))))
+ .Times(AnyNumber());
+ // clang-format on
+
+ // Expect "Shift+A".
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_A)));
+
+ // Turn on Caps Word and tap "A".
+ caps_word_on();
+ TapKey(key_a);
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+
+ idle_for(CAPS_WORD_IDLE_TIMEOUT);
+ run_one_scan_loop();
+
+ // Caps Word should be off and mods should be clear.
+ EXPECT_EQ(is_caps_word_on(), false);
+ EXPECT_EQ(get_mods() | get_weak_mods(), 0);
+
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(AnyNumber());
+ // Expect unshifted "A".
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_A)));
+ TapKey(key_a);
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+// Tests that typing "A, 4, A, 4" produces "Shift+A, 4, Shift+A, 4".
+TEST_F(CapsWord, ShiftsLettersButNotDigits) {
+ TestDriver driver;
+ KeymapKey key_a(0, 0, 0, KC_A);
+ KeymapKey key_4(0, 1, 0, KC_4);
+ set_keymap({key_a, key_4});
+
+ // Allow any number of reports with no keys or only KC_LSFT.
+ // clang-format off
+ EXPECT_CALL(driver, send_keyboard_mock(AnyOf(
+ KeyboardReport(),
+ KeyboardReport(KC_LSFT))))
+ .Times(AnyNumber());
+ // clang-format on
+
+ { // Expect: "Shift+A, 4, Shift+A, 4".
+ InSequence s;
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_A)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_4)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_A)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_4)));
+ }
+
+ // Turn on Caps Word and tap "A, 4, A, 4".
+ caps_word_on();
+ TapKeys(key_a, key_4, key_a, key_4);
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+// Tests that typing "A, Space, A" produces "Shift+A, Space, A".
+TEST_F(CapsWord, SpaceTurnsOffCapsWord) {
+ TestDriver driver;
+ KeymapKey key_a(0, 0, 0, KC_A);
+ KeymapKey key_spc(0, 1, 0, KC_SPC);
+ set_keymap({key_a, key_spc});
+
+ // Allow any number of reports with no keys or only KC_LSFT.
+ // clang-format off
+ EXPECT_CALL(driver, send_keyboard_mock(AnyOf(
+ KeyboardReport(),
+ KeyboardReport(KC_LSFT))))
+ .Times(AnyNumber());
+ // clang-format on
+
+ { // Expect: "Shift+A, Space, A".
+ InSequence seq;
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_A)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_SPC)));
+ EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_A)));
+ }
+
+ // Turn on Caps Word and tap "A, Space, A".
+ caps_word_on();
+ TapKeys(key_a, key_spc, key_a);
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+struct CapsWordBothShiftsParams {
+ std::string name;
+ uint16_t left_shift_keycode;
+ uint16_t right_shift_keycode;
+
+ static const std::string& GetName(const TestParamInfo<CapsWordBothShiftsParams>& info) {
+ return info.param.name;
+ }
+};
+
+// Tests the BOTH_SHIFTS_TURNS_ON_CAPS_WORD method to turn on Caps Word.
+class CapsWordBothShifts : public ::testing::WithParamInterface<CapsWordBothShiftsParams>, public CapsWord {};
+
+// Pressing shifts as "Left down, Right down, Left up, Right up".
+TEST_P(CapsWordBothShifts, PressLRLR) {
+ TestDriver driver;
+ KeymapKey left_shift(0, 0, 0, GetParam().left_shift_keycode);
+ KeymapKey right_shift(0, 1, 0, GetParam().right_shift_keycode);
+ set_keymap({left_shift, right_shift});
+
+ // clang-format off
+ EXPECT_CALL(driver, send_keyboard_mock(AnyOf(
+ KeyboardReport(),
+ KeyboardReport(KC_LSFT),
+ KeyboardReport(KC_RSFT),
+ KeyboardReport(KC_LSFT, KC_RSFT))))
+ .Times(AnyNumber());
+ // clang-format on
+
+ EXPECT_EQ(is_caps_word_on(), false);
+
+ left_shift.press(); // Press both shifts.
+ run_one_scan_loop();
+ right_shift.press();
+
+ // For mod-tap and Space Cadet keys, wait for the tapping term.
+ if (left_shift.code == LSFT_T(KC_A) || left_shift.code == KC_LSPO) {
+ idle_for(TAPPING_TERM);
+ }
+
+ run_one_scan_loop();
+ left_shift.release(); // Release both.
+ run_one_scan_loop();
+ right_shift.release();
+ run_one_scan_loop();
+
+ EXPECT_EQ(is_caps_word_on(), true);
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+// Pressing shifts as "Left down, Right down, Right up, Left up".
+TEST_P(CapsWordBothShifts, PressLRRL) {
+ TestDriver driver;
+ KeymapKey left_shift(0, 0, 0, GetParam().left_shift_keycode);
+ KeymapKey right_shift(0, 1, 0, GetParam().right_shift_keycode);
+ set_keymap({left_shift, right_shift});
+
+ // clang-format off
+ EXPECT_CALL(driver, send_keyboard_mock(AnyOf(
+ KeyboardReport(),
+ KeyboardReport(KC_LSFT),
+ KeyboardReport(KC_RSFT),
+ KeyboardReport(KC_LSFT, KC_RSFT))))
+ .Times(AnyNumber());
+ // clang-format on
+
+ EXPECT_EQ(is_caps_word_on(), false);
+
+ left_shift.press(); // Press both shifts.
+ run_one_scan_loop();
+ right_shift.press();
+
+ if (left_shift.code == LSFT_T(KC_A) || left_shift.code == KC_LSPO) {
+ idle_for(TAPPING_TERM);
+ }
+ run_one_scan_loop();
+
+ right_shift.release(); // Release both.
+ run_one_scan_loop();
+ left_shift.release();
+ run_one_scan_loop();
+
+ EXPECT_EQ(is_caps_word_on(), true);
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+// clang-format off
+INSTANTIATE_TEST_CASE_P(
+ ShiftPairs,
+ CapsWordBothShifts,
+ ::testing::Values(
+ CapsWordBothShiftsParams{
+ "PlainShifts", KC_LSFT, KC_RSFT},
+ CapsWordBothShiftsParams{
+ "OneshotShifts", OSM(MOD_LSFT), OSM(MOD_RSFT)},
+ CapsWordBothShiftsParams{
+ "SpaceCadetShifts", KC_LSPO, KC_RSPC},
+ CapsWordBothShiftsParams{
+ "ModTapShifts", LSFT_T(KC_A), RSFT_T(KC_B)}
+ ),
+ CapsWordBothShiftsParams::GetName
+ );
+// clang-format on
+
+struct CapsWordDoubleTapShiftParams {
+ std::string name;
+ uint16_t left_shift_keycode;
+
+ static const std::string& GetName(const TestParamInfo<CapsWordDoubleTapShiftParams>& info) {
+ return info.param.name;
+ }
+};
+
+// Tests the DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD method to turn on Caps Word.
+class CapsWordDoubleTapShift : public ::testing::WithParamInterface<CapsWordDoubleTapShiftParams>, public CapsWord {};
+
+// Tests that double tapping activates Caps Word.
+TEST_P(CapsWordDoubleTapShift, Activation) {
+ TestDriver driver;
+ KeymapKey left_shift(0, 0, 0, GetParam().left_shift_keycode);
+ set_keymap({left_shift});
+
+ // clang-format off
+ EXPECT_CALL(driver, send_keyboard_mock(AnyOf(
+ KeyboardReport(),
+ KeyboardReport(KC_LSFT))))
+ .Times(AnyNumber());
+ // clang-format on
+
+ EXPECT_EQ(is_caps_word_on(), false);
+
+ // Tapping shift twice within the tapping term turns on Caps Word.
+ TapKey(left_shift);
+ idle_for(TAPPING_TERM - 10);
+ TapKey(left_shift);
+
+ EXPECT_EQ(is_caps_word_on(), true);
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+// Double tap doesn't count if another key is pressed between the taps.
+TEST_P(CapsWordDoubleTapShift, Interrupted) {
+ TestDriver driver;
+ KeymapKey left_shift(0, 0, 0, GetParam().left_shift_keycode);
+ KeymapKey key_a(0, 1, 0, KC_A);
+ set_keymap({left_shift, key_a});
+
+ // clang-format off
+ EXPECT_CALL(driver, send_keyboard_mock(AnyOf(
+ KeyboardReport(),
+ KeyboardReport(KC_LSFT),
+ KeyboardReport(KC_LSFT, KC_A))))
+ .Times(AnyNumber());
+ // clang-format on
+
+ left_shift.press();
+ run_one_scan_loop();
+
+ TapKey(key_a); // 'A' key interrupts the double tap.
+
+ left_shift.release();
+ run_one_scan_loop();
+
+ idle_for(TAPPING_TERM - 10);
+ TapKey(left_shift);
+
+ EXPECT_EQ(is_caps_word_on(), false); // Caps Word is still off.
+ clear_oneshot_mods();
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+// Double tap doesn't count if taps are more than tapping term apart.
+TEST_P(CapsWordDoubleTapShift, SlowTaps) {
+ TestDriver driver;
+ KeymapKey left_shift(0, 0, 0, GetParam().left_shift_keycode);
+ set_keymap({left_shift});
+
+ // clang-format off
+ EXPECT_CALL(driver, send_keyboard_mock(AnyOf(
+ KeyboardReport(),
+ KeyboardReport(KC_LSFT))))
+ .Times(AnyNumber());
+ // clang-format on
+
+ TapKey(left_shift);
+ idle_for(TAPPING_TERM + 1);
+ TapKey(left_shift);
+
+ EXPECT_EQ(is_caps_word_on(), false); // Caps Word is still off.
+ clear_oneshot_mods();
+
+ testing::Mock::VerifyAndClearExpectations(&driver);
+}
+
+// clang-format off
+INSTANTIATE_TEST_CASE_P(
+ Shifts,
+ CapsWordDoubleTapShift,
+ ::testing::Values(
+ CapsWordDoubleTapShiftParams{"PlainShift", KC_LSFT},
+ CapsWordDoubleTapShiftParams{"OneshotShift", OSM(MOD_LSFT)}
+ ),
+ CapsWordDoubleTapShiftParams::GetName
+ );
+// clang-format on
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index d9aa351ecb..19e2e858fc 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -339,8 +339,12 @@ static usb_driver_configs_t drivers = {
.console_driver = QMK_USB_DRIVER_CONFIG(CONSOLE, 0, true),
#endif
#ifdef RAW_ENABLE
-# define RAW_IN_CAPACITY 4
-# define RAW_OUT_CAPACITY 4
+# ifndef RAW_IN_CAPACITY
+# define RAW_IN_CAPACITY 4
+# endif
+# ifndef RAW_OUT_CAPACITY
+# define RAW_OUT_CAPACITY 4
+# endif
# define RAW_IN_MODE USB_EP_MODE_TYPE_INTR
# define RAW_OUT_MODE USB_EP_MODE_TYPE_INTR
.raw_driver = QMK_USB_DRIVER_CONFIG(RAW, 0, false),
@@ -1074,7 +1078,7 @@ void console_task(void) {
uint8_t buffer[CONSOLE_EPSIZE];
size_t size = 0;
do {
- size_t size = chnReadTimeout(&drivers.console_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
+ size = chnReadTimeout(&drivers.console_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
if (size > 0) {
console_receive(buffer, size);
}
@@ -1102,7 +1106,7 @@ void raw_hid_task(void) {
uint8_t buffer[RAW_EPSIZE];
size_t size = 0;
do {
- size_t size = chnReadTimeout(&drivers.raw_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
+ size = chnReadTimeout(&drivers.raw_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
if (size > 0) {
raw_hid_receive(buffer, size);
}
@@ -1125,7 +1129,7 @@ void midi_ep_task(void) {
uint8_t buffer[MIDI_STREAM_EPSIZE];
size_t size = 0;
do {
- size_t size = chnReadTimeout(&drivers.midi_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
+ size = chnReadTimeout(&drivers.midi_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
if (size > 0) {
MIDI_EventPacket_t event;
recv_midi_packet(&event);
diff --git a/tmk_core/protocol/report.c b/tmk_core/protocol/report.c
index 854b59ae48..5755098c60 100644
--- a/tmk_core/protocol/report.c
+++ b/tmk_core/protocol/report.c
@@ -278,3 +278,16 @@ void clear_keys_from_report(report_keyboard_t* keyboard_report) {
#endif
memset(keyboard_report->keys, 0, sizeof(keyboard_report->keys));
}
+
+#ifdef MOUSE_ENABLE
+/**
+ * @brief Compares 2 mouse reports for difference and returns result
+ *
+ * @param[in] new_report report_mouse_t
+ * @param[in] old_report report_mouse_t
+ * @return bool result
+ */
+__attribute__((weak)) bool has_mouse_report_changed(report_mouse_t* new_report, report_mouse_t* old_report) {
+ return memcmp(new_report, old_report, sizeof(report_mouse_t));
+}
+#endif
diff --git a/tmk_core/protocol/report.h b/tmk_core/protocol/report.h
index 1adc892f3b..7bbeb78af7 100644
--- a/tmk_core/protocol/report.h
+++ b/tmk_core/protocol/report.h
@@ -320,6 +320,10 @@ void add_key_to_report(report_keyboard_t* keyboard_report, uint8_t key);
void del_key_from_report(report_keyboard_t* keyboard_report, uint8_t key);
void clear_keys_from_report(report_keyboard_t* keyboard_report);
+#ifdef MOUSE_ENABLE
+bool has_mouse_report_changed(report_mouse_t* new_report, report_mouse_t* old_report);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c
index 0b992ba6c5..063bd2c3f1 100644
--- a/tmk_core/protocol/usb_descriptor.c
+++ b/tmk_core/protocol/usb_descriptor.c
@@ -347,49 +347,44 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM ConsoleReport[] = {
#endif
#ifdef JOYSTICK_ENABLE
-# if JOYSTICK_AXES_COUNT == 0 && JOYSTICK_BUTTON_COUNT == 0
-# error Need at least one axis or button for joystick
-# endif
const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] = {
- HID_RI_USAGE_PAGE(8, 0x01), // Generic Desktop
- HID_RI_USAGE(8, 0x04), // Joystick
- HID_RI_COLLECTION(8, 0x01), // Application
- HID_RI_COLLECTION(8, 0x00), // Physical
+ HID_RI_USAGE_PAGE(8, 0x01), // Generic Desktop
+ HID_RI_USAGE(8, 0x04), // Joystick
+ HID_RI_COLLECTION(8, 0x01), // Application
+ HID_RI_COLLECTION(8, 0x00), // Physical
+# if JOYSTICK_AXES_COUNT > 0
HID_RI_USAGE_PAGE(8, 0x01), // Generic Desktop
-# if JOYSTICK_AXES_COUNT >= 1
HID_RI_USAGE(8, 0x30), // X
-# endif
-# if JOYSTICK_AXES_COUNT >= 2
+# if JOYSTICK_AXES_COUNT > 1
HID_RI_USAGE(8, 0x31), // Y
-# endif
-# if JOYSTICK_AXES_COUNT >= 3
+# endif
+# if JOYSTICK_AXES_COUNT > 2
HID_RI_USAGE(8, 0x32), // Z
-# endif
-# if JOYSTICK_AXES_COUNT >= 4
+# endif
+# if JOYSTICK_AXES_COUNT > 3
HID_RI_USAGE(8, 0x33), // Rx
-# endif
-# if JOYSTICK_AXES_COUNT >= 5
+# endif
+# if JOYSTICK_AXES_COUNT > 4
HID_RI_USAGE(8, 0x34), // Ry
-# endif
-# if JOYSTICK_AXES_COUNT >= 6
+# endif
+# if JOYSTICK_AXES_COUNT > 5
HID_RI_USAGE(8, 0x35), // Rz
-# endif
-# if JOYSTICK_AXES_COUNT >= 1
- # if JOYSTICK_AXES_RESOLUTION == 8
+# endif
+# if JOYSTICK_AXES_RESOLUTION == 8
HID_RI_LOGICAL_MINIMUM(8, -JOYSTICK_RESOLUTION),
HID_RI_LOGICAL_MAXIMUM(8, JOYSTICK_RESOLUTION),
HID_RI_REPORT_COUNT(8, JOYSTICK_AXES_COUNT),
HID_RI_REPORT_SIZE(8, 0x08),
- # else
+# else
HID_RI_LOGICAL_MINIMUM(16, -JOYSTICK_RESOLUTION),
HID_RI_LOGICAL_MAXIMUM(16, JOYSTICK_RESOLUTION),
HID_RI_REPORT_COUNT(8, JOYSTICK_AXES_COUNT),
HID_RI_REPORT_SIZE(8, 0x10),
- # endif
+# endif
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
# endif
-# if JOYSTICK_BUTTON_COUNT >= 1
+# if JOYSTICK_BUTTON_COUNT > 0
HID_RI_USAGE_PAGE(8, 0x09), // Button
HID_RI_USAGE_MINIMUM(8, 0x01),
HID_RI_USAGE_MAXIMUM(8, JOYSTICK_BUTTON_COUNT),
diff --git a/util/generate_internal_docs.sh b/util/generate_internal_docs.sh
deleted file mode 100755
index b107a37ad6..0000000000
--- a/util/generate_internal_docs.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env bash
-
-set -x
-
-if ! doxygen -v 2>&1 > /dev/null; then
- echo "doxygen not found! Please install it!"
- exit 1
-elif ! moxygen -V 2>&1 > /dev/null; then
- echo -n "moxygen not found! Would you like to install it? [y/n] "
- read ANSWER
- case $ANSWER in
- y|Y|yes|YES|Yes)
- npm install -g moxygen
- ;;
- *)
- exit 1
- ;;
- esac
-fi
-
-if [ ! -e Doxyfile ]; then
- echo "Error: You must run this from the top-level qmk_firmware directory!"
- exit 1
-fi
-
-# Generate the doxygen XML files
-rm -rf doxygen
-doxygen Doxyfile
-
-# Generate the moxygen Markdown files
-moxygen -a -g -o docs/internals_%s.md doxygen/xml
diff --git a/util/install/msys2.sh b/util/install/msys2.sh
index 203f8eff0c..c57c455eb4 100755
--- a/util/install/msys2.sh
+++ b/util/install/msys2.sh
@@ -12,7 +12,8 @@ _qmk_install() {
base-devel: toolchain:x clang:x git: unzip: python3-pip:x \
avr-binutils:x avr-gcc:x avr-libc:x arm-none-eabi-binutils:x \
arm-none-eabi-gcc:x arm-none-eabi-newlib:x avrdude:x bootloadhid:x \
- dfu-programmer:x dfu-util:x teensy-loader-cli:x hidapi:x
+ dfu-programmer:x dfu-util:x teensy-loader-cli:x hidapi:x \
+ python-appdirs:x python-colorama:x python-jsonschema:x python-pillow:x python-pygments:x
_qmk_install_drivers
diff --git a/util/uf2conv.py b/util/uf2conv.py
index 8677a828c9..fb82fd03ca 100755
--- a/util/uf2conv.py
+++ b/util/uf2conv.py
@@ -6,40 +6,13 @@ import re
import os
import os.path
import argparse
+import json
UF2_MAGIC_START0 = 0x0A324655 # "UF2\n"
UF2_MAGIC_START1 = 0x9E5D5157 # Randomly selected
UF2_MAGIC_END = 0x0AB16F30 # Ditto
-families = {
- 'SAMD21': 0x68ed2b88,
- 'SAML21': 0x1851780a,
- 'SAMD51': 0x55114460,
- 'NRF52': 0x1b57745f,
- 'STM32F0': 0x647824b6,
- 'STM32F1': 0x5ee21072,
- 'STM32F2': 0x5d1a0a2e,
- 'STM32F3': 0x6b846188,
- 'STM32F4': 0x57755a57,
- 'STM32F7': 0x53b80f00,
- 'STM32G0': 0x300f5633,
- 'STM32G4': 0x4c71240a,
- 'STM32H7': 0x6db66082,
- 'STM32L0': 0x202e3a91,
- 'STM32L1': 0x1e1f432d,
- 'STM32L4': 0x00ff6919,
- 'STM32L5': 0x04240bdf,
- 'STM32WB': 0x70d16653,
- 'STM32WL': 0x21460ff0,
- 'ATMEGA32': 0x16573617,
- 'MIMXRT10XX': 0x4FB2D5BD,
- 'LPC55': 0x2abc77ec,
- 'GD32F350': 0x31D228C6,
- 'ESP32S2': 0xbfdd4eee,
- 'RP2040': 0xe48bff56
-}
-
INFO_FILE = "/INFO_UF2.TXT"
appstartaddr = 0x2000
@@ -61,8 +34,13 @@ def is_hex(buf):
def convert_from_uf2(buf):
global appstartaddr
+ global familyid
numblocks = len(buf) // 512
curraddr = None
+ currfamilyid = None
+ families_found = {}
+ prev_flag = None
+ all_flags_same = True
outp = []
for blockno in range(numblocks):
ptr = blockno * 512
@@ -78,9 +56,13 @@ def convert_from_uf2(buf):
if datalen > 476:
assert False, "Invalid UF2 data size at " + ptr
newaddr = hd[3]
- if curraddr is None:
- appstartaddr = newaddr
+ if (hd[2] & 0x2000) and (currfamilyid == None):
+ currfamilyid = hd[7]
+ if curraddr == None or ((hd[2] & 0x2000) and hd[7] != currfamilyid):
+ currfamilyid = hd[7]
curraddr = newaddr
+ if familyid == 0x0 or familyid == hd[7]:
+ appstartaddr = newaddr
padding = newaddr - curraddr
if padding < 0:
assert False, "Block out of order at " + ptr
@@ -91,8 +73,37 @@ def convert_from_uf2(buf):
while padding > 0:
padding -= 4
outp += b"\x00\x00\x00\x00"
- outp.append(block[32 : 32 + datalen])
+ if familyid == 0x0 or ((hd[2] & 0x2000) and familyid == hd[7]):
+ outp.append(block[32 : 32 + datalen])
curraddr = newaddr + datalen
+ if hd[2] & 0x2000:
+ if hd[7] in families_found.keys():
+ if families_found[hd[7]] > newaddr:
+ families_found[hd[7]] = newaddr
+ else:
+ families_found[hd[7]] = newaddr
+ if prev_flag == None:
+ prev_flag = hd[2]
+ if prev_flag != hd[2]:
+ all_flags_same = False
+ if blockno == (numblocks - 1):
+ print("--- UF2 File Header Info ---")
+ families = load_families()
+ for family_hex in families_found.keys():
+ family_short_name = ""
+ for name, value in families.items():
+ if value == family_hex:
+ family_short_name = name
+ print("Family ID is {:s}, hex value is 0x{:08x}".format(family_short_name,family_hex))
+ print("Target Address is 0x{:08x}".format(families_found[family_hex]))
+ if all_flags_same:
+ print("All block flag values consistent, 0x{:04x}".format(hd[2]))
+ else:
+ print("Flags were not all the same")
+ print("----------------------------")
+ if len(families_found) > 1 and familyid == 0x0:
+ outp = []
+ appstartaddr = 0x0
return b"".join(outp)
def convert_to_carray(file_content):
@@ -166,12 +177,11 @@ def convert_from_hex_to_uf2(buf):
upper = ((rec[4] << 8) | rec[5]) << 16
elif tp == 2:
upper = ((rec[4] << 8) | rec[5]) << 4
- assert (upper & 0xffff) == 0
elif tp == 1:
break
elif tp == 0:
- addr = upper | (rec[1] << 8) | rec[2]
- if appstartaddr is None:
+ addr = upper + ((rec[1] << 8) | rec[2])
+ if appstartaddr == None:
appstartaddr = addr
i = 4
while i < len(rec) - 1:
@@ -215,7 +225,7 @@ def get_drives():
def has_info(d):
try:
return os.path.isfile(d + INFO_FILE)
- except Exception:
+ except:
return False
return list(filter(has_info, drives))
@@ -238,10 +248,26 @@ def write_file(name, buf):
print("Wrote %d bytes to %s" % (len(buf), name))
+def load_families():
+ # The expectation is that the `uf2families.json` file is in the same
+ # directory as this script. Make a path that works using `__file__`
+ # which contains the full path to this script.
+ filename = "uf2families.json"
+ pathname = os.path.join(os.path.dirname(os.path.abspath(__file__)), filename)
+ with open(pathname) as f:
+ raw_families = json.load(f)
+
+ families = {}
+ for family in raw_families:
+ families[family["short_name"]] = int(family["id"], 0)
+
+ return families
+
+
def main():
global appstartaddr, familyid
def error(msg):
- print(msg)
+ print(msg, file=sys.stderr)
sys.exit(1)
parser = argparse.ArgumentParser(description='Convert to UF2 or flash directly.')
parser.add_argument('input', metavar='INPUT', type=str, nargs='?',
@@ -264,9 +290,13 @@ def main():
help='specify familyID - number or name (default: 0x0)')
parser.add_argument('-C' , '--carray', action='store_true',
help='convert binary file to a C array, not UF2')
+ parser.add_argument('-i', '--info', action='store_true',
+ help='display header information from UF2, do not convert')
args = parser.parse_args()
appstartaddr = int(args.base, 0)
+ families = load_families()
+
if args.family.upper() in families:
familyid = families[args.family.upper()]
else:
@@ -286,9 +316,12 @@ def main():
ext = "uf2"
if args.deploy:
outbuf = inpbuf
- elif from_uf2:
+ elif from_uf2 and not args.info:
outbuf = convert_from_uf2(inpbuf)
ext = "bin"
+ elif from_uf2 and args.info:
+ outbuf = ""
+ convert_from_uf2(inpbuf)
elif is_hex(inpbuf):
outbuf = convert_from_hex_to_uf2(inpbuf.decode("utf-8"))
elif args.carray:
@@ -296,11 +329,12 @@ def main():
ext = "h"
else:
outbuf = convert_to_uf2(inpbuf)
- print("Converting to %s, output size: %d, start address: 0x%x" %
- (ext, len(outbuf), appstartaddr))
+ if not args.deploy and not args.info:
+ print("Converted to %s, output size: %d, start address: 0x%x" %
+ (ext, len(outbuf), appstartaddr))
if args.convert or ext != "uf2":
drives = []
- if args.output is None:
+ if args.output == None:
args.output = "flash." + ext
else:
drives = get_drives()
diff --git a/util/uf2families.json b/util/uf2families.json
new file mode 100644
index 0000000000..fafae82a60
--- /dev/null
+++ b/util/uf2families.json
@@ -0,0 +1,192 @@
+[
+ {
+ "id": "0x16573617",
+ "short_name": "ATMEGA32",
+ "description": "Microchip (Atmel) ATmega32"
+ },
+ {
+ "id": "0x1851780a",
+ "short_name": "SAML21",
+ "description": "Microchip (Atmel) SAML21"
+ },
+ {
+ "id": "0x1b57745f",
+ "short_name": "NRF52",
+ "description": "Nordic NRF52"
+ },
+ {
+ "id": "0x1c5f21b0",
+ "short_name": "ESP32",
+ "description": "ESP32"
+ },
+ {
+ "id": "0x1e1f432d",
+ "short_name": "STM32L1",
+ "description": "ST STM32L1xx"
+ },
+ {
+ "id": "0x202e3a91",
+ "short_name": "STM32L0",
+ "description": "ST STM32L0xx"
+ },
+ {
+ "id": "0x21460ff0",
+ "short_name": "STM32WL",
+ "description": "ST STM32WLxx"
+ },
+ {
+ "id": "0x2abc77ec",
+ "short_name": "LPC55",
+ "description": "NXP LPC55xx"
+ },
+ {
+ "id": "0x300f5633",
+ "short_name": "STM32G0",
+ "description": "ST STM32G0xx"
+ },
+ {
+ "id": "0x31d228c6",
+ "short_name": "GD32F350",
+ "description": "GD32F350"
+ },
+ {
+ "id": "0x04240bdf",
+ "short_name": "STM32L5",
+ "description": "ST STM32L5xx"
+ },
+ {
+ "id": "0x4c71240a",
+ "short_name": "STM32G4",
+ "description": "ST STM32G4xx"
+ },
+ {
+ "id": "0x4fb2d5bd",
+ "short_name": "MIMXRT10XX",
+ "description": "NXP i.MX RT10XX"
+ },
+ {
+ "id": "0x53b80f00",
+ "short_name": "STM32F7",
+ "description": "ST STM32F7xx"
+ },
+ {
+ "id": "0x55114460",
+ "short_name": "SAMD51",
+ "description": "Microchip (Atmel) SAMD51"
+ },
+ {
+ "id": "0x57755a57",
+ "short_name": "STM32F4",
+ "description": "ST STM32F401"
+ },
+ {
+ "id": "0x5a18069b",
+ "short_name": "FX2",
+ "description": "Cypress FX2"
+ },
+ {
+ "id": "0x5d1a0a2e",
+ "short_name": "STM32F2",
+ "description": "ST STM32F2xx"
+ },
+ {
+ "id": "0x5ee21072",
+ "short_name": "STM32F1",
+ "description": "ST STM32F103"
+ },
+ {
+ "id": "0x621e937a",
+ "short_name": "NRF52833",
+ "description": "Nordic NRF52833"
+ },
+ {
+ "id": "0x647824b6",
+ "short_name": "STM32F0",
+ "description": "ST STM32F0xx"
+ },
+ {
+ "id": "0x68ed2b88",
+ "short_name": "SAMD21",
+ "description": "Microchip (Atmel) SAMD21"
+ },
+ {
+ "id": "0x6b846188",
+ "short_name": "STM32F3",
+ "description": "ST STM32F3xx"
+ },
+ {
+ "id": "0x6d0922fa",
+ "short_name": "STM32F407",
+ "description": "ST STM32F407"
+ },
+ {
+ "id": "0x6db66082",
+ "short_name": "STM32H7",
+ "description": "ST STM32H7xx"
+ },
+ {
+ "id": "0x70d16653",
+ "short_name": "STM32WB",
+ "description": "ST STM32WBxx"
+ },
+ {
+ "id": "0x7eab61ed",
+ "short_name": "ESP8266",
+ "description": "ESP8266"
+ },
+ {
+ "id": "0x7f83e793",
+ "short_name": "KL32L2",
+ "description": "NXP KL32L2x"
+ },
+ {
+ "id": "0x8fb060fe",
+ "short_name": "STM32F407VG",
+ "description": "ST STM32F407VG"
+ },
+ {
+ "id": "0xada52840",
+ "short_name": "NRF52840",
+ "description": "Nordic NRF52840"
+ },
+ {
+ "id": "0xbfdd4eee",
+ "short_name": "ESP32S2",
+ "description": "ESP32-S2"
+ },
+ {
+ "id": "0xc47e5767",
+ "short_name": "ESP32S3",
+ "description": "ESP32-S3"
+ },
+ {
+ "id": "0xd42ba06c",
+ "short_name": "ESP32C3",
+ "description": "ESP32-C3"
+ },
+ {
+ "id": "0x2b88d29c",
+ "short_name": "ESP32C2",
+ "description": "ESP32-C2"
+ },
+ {
+ "id": "0x332726f6",
+ "short_name": "ESP32H2",
+ "description": "ESP32-H2"
+ },
+ {
+ "id": "0xe48bff56",
+ "short_name": "RP2040",
+ "description": "Raspberry Pi RP2040"
+ },
+ {
+ "id": "0x00ff6919",
+ "short_name": "STM32L4",
+ "description": "ST STM32L4xx"
+ },
+ {
+ "id": "0x9af03e33",
+ "short_name": "GD32VF103",
+ "description": "GigaDevice GD32VF103"
+ }
+]