diff options
author | Drashna Jael're <drashna@live.com> | 2021-10-11 20:36:47 -0700 |
---|---|---|
committer | Drashna Jael're <drashna@live.com> | 2021-10-11 20:36:47 -0700 |
commit | b34675555cbd9a71a797a7ebc2148cbf2e8f0efc (patch) | |
tree | 2d701310ccd3fc2c603d63536ab4a3c1d9b9381b | |
parent | bcddde8738dbba48c548f1e3f12a10bbf60a65d8 (diff) | |
parent | d9e077468ab3446cbd7306a453a73dad2c1403e8 (diff) |
Merge commit 'd9e077468ab3446cbd7306a453a73dad2c1403e8' into firmware_21
-rw-r--r-- | .github/workflows/api.yml | 3 | ||||
-rw-r--r-- | .github/workflows/cli.yml | 4 | ||||
-rw-r--r-- | .github/workflows/develop_api.yml | 3 | ||||
-rw-r--r-- | .github/workflows/docs.yml | 2 | ||||
-rw-r--r-- | .github/workflows/format.yaml | 14 | ||||
-rw-r--r-- | .github/workflows/lint.yml | 2 | ||||
-rw-r--r-- | .gitignore | 93 | ||||
-rw-r--r-- | CODE_OF_CONDUCT.md | 24 | ||||
-rw-r--r-- | Dockerfile | 5 | ||||
-rw-r--r-- | Makefile | 77 | ||||
-rw-r--r-- | Vagrantfile | 6 | ||||
-rw-r--r-- | bootloader.mk | 32 | ||||
-rw-r--r-- | build_json.mk | 14 | ||||
-rw-r--r-- | build_keyboard.mk | 56 | ||||
-rw-r--r-- | build_layout.mk | 4 | ||||
-rw-r--r-- | build_test.mk | 15 | ||||
-rw-r--r-- | common.mk | 3 | ||||
-rw-r--r-- | common_features.mk | 171 | ||||
-rw-r--r-- | data/mappings/info_config.json | 58 | ||||
-rw-r--r-- | data/mappings/info_rules.json | 14 | ||||
-rw-r--r-- | data/mappings/keyboard_aliases.json | 118 | ||||
-rw-r--r-- | data/schemas/api_keyboard.jsonschema | 44 | ||||
-rw-r--r-- | data/schemas/definitions.jsonschema | 107 | ||||
-rw-r--r-- | data/schemas/keyboard.jsonschema | 451 | ||||
-rw-r--r-- | data/schemas/keymap.jsonschema | 24 | ||||
-rw-r--r-- | data/templates/avr/config.h (renamed from quantum/template/avr/config.h) | 0 | ||||
-rw-r--r-- | data/templates/avr/readme.md (renamed from quantum/template/avr/readme.md) | 8 | ||||
-rw-r--r-- | data/templates/avr/rules.mk (renamed from quantum/template/avr/rules.mk) | 3 | ||||
-rw-r--r-- | data/templates/base/info.json (renamed from quantum/template/base/info.json) | 2 | ||||
-rw-r--r-- | data/templates/base/keyboard.c (renamed from quantum/template/base/keyboard.c) | 0 | ||||
-rw-r--r-- | data/templates/base/keyboard.h (renamed from quantum/template/base/keyboard.h) | 0 | ||||
-rw-r--r-- | data/templates/base/keymaps/default/keymap.c (renamed from quantum/template/base/keymaps/default/keymap.c) | 0 | ||||
-rw-r--r-- | data/templates/base/keymaps/default/readme.md (renamed from quantum/template/base/keymaps/default/readme.md) | 0 | ||||
-rw-r--r-- | data/templates/ps2avrgb/config.h (renamed from quantum/template/ps2avrgb/config.h) | 0 | ||||
-rw-r--r-- | data/templates/ps2avrgb/readme.md (renamed from quantum/template/ps2avrgb/readme.md) | 11 | ||||
-rw-r--r-- | data/templates/ps2avrgb/rules.mk (renamed from quantum/template/ps2avrgb/rules.mk) | 4 | ||||
-rw-r--r-- | doxygen-todo | 1 | ||||
-rw-r--r-- | drivers/avr/serial.h | 62 | ||||
-rw-r--r-- | drivers/chibios/serial.h | 62 | ||||
-rw-r--r-- | drivers/chibios/serial_usart.c | 219 | ||||
-rw-r--r-- | drivers/chibios/serial_usart_duplex.c | 261 | ||||
-rw-r--r-- | drivers/eeprom/eeprom_i2c.c | 23 | ||||
-rw-r--r-- | drivers/eeprom/eeprom_spi.c | 7 | ||||
-rw-r--r-- | drivers/haptic/solenoid.c | 1 | ||||
-rw-r--r-- | drivers/lcd/st7565.c | 496 | ||||
-rw-r--r-- | drivers/lcd/st7565.h | 219 | ||||
-rw-r--r-- | drivers/led/apa102.c (renamed from drivers/apa102/apa102.c) | 0 | ||||
-rw-r--r-- | drivers/led/apa102.h (renamed from drivers/apa102/apa102.h) | 0 | ||||
-rw-r--r-- | drivers/led/aw20216.c | 141 | ||||
-rw-r--r-- | drivers/led/aw20216.h | 253 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3218.c (renamed from drivers/issi/is31fl3218.c) | 0 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3218.h (renamed from drivers/issi/is31fl3218.h) | 0 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3731-simple.c (renamed from drivers/issi/is31fl3731-simple.c) | 0 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3731-simple.h (renamed from drivers/issi/is31fl3731-simple.h) | 3 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3731.c (renamed from drivers/issi/is31fl3731.c) | 0 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3731.h (renamed from drivers/issi/is31fl3731.h) | 3 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3733.c (renamed from drivers/issi/is31fl3733.c) | 0 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3733.h (renamed from drivers/issi/is31fl3733.h) | 3 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3736.c (renamed from drivers/issi/is31fl3736.c) | 0 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3736.h (renamed from drivers/issi/is31fl3736.h) | 3 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3737.c (renamed from drivers/issi/is31fl3737.c) | 43 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3737.h (renamed from drivers/issi/is31fl3737.h) | 3 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3741.c (renamed from drivers/issi/is31fl3741.c) | 20 | ||||
-rw-r--r-- | drivers/led/issi/is31fl3741.h (renamed from drivers/issi/is31fl3741.h) | 7 | ||||
-rw-r--r-- | drivers/oled/oled_driver.h | 8 | ||||
-rw-r--r-- | drivers/oled/ssd1306_sh1106.c (renamed from drivers/oled/oled_driver.c) | 28 | ||||
-rw-r--r-- | drivers/qwiic/micro_oled.c | 27 | ||||
-rw-r--r-- | drivers/sensors/adns5050.c | 193 | ||||
-rw-r--r-- | drivers/sensors/adns5050.h | 79 | ||||
-rw-r--r-- | drivers/sensors/adns9800.c | 219 | ||||
-rw-r--r-- | drivers/sensors/adns9800.h | 35 | ||||
-rw-r--r-- | drivers/sensors/adns9800_srom_A6.h | 3078 | ||||
-rw-r--r-- | drivers/sensors/pimoroni_trackball.c | 201 | ||||
-rw-r--r-- | drivers/sensors/pimoroni_trackball.h | 37 | ||||
-rw-r--r-- | drivers/sensors/pmw3360.c | 271 | ||||
-rw-r--r-- | drivers/sensors/pmw3360.h | 85 | ||||
-rw-r--r-- | drivers/sensors/pmw3360_firmware.h | 300 | ||||
-rw-r--r-- | drivers/serial.h | 46 | ||||
-rw-r--r-- | keyboards/ergodox_ez/config.h | 3 | ||||
-rw-r--r-- | keyboards/ergodox_ez/ergodox_ez.c | 180 | ||||
-rw-r--r-- | keyboards/ergodox_ez/info.json | 3 | ||||
-rw-r--r-- | keyboards/ergodox_ez/keymaps/default/keymap.c | 156 | ||||
-rw-r--r-- | keyboards/ergodox_ez/rules.mk | 14 | ||||
-rwxr-xr-x | keyboards/ergodox_ez/util/compile_keymap.py | 5 | ||||
-rw-r--r-- | keyboards/moonlander/config.h | 7 | ||||
-rw-r--r-- | keyboards/moonlander/halconf.h | 22 | ||||
-rw-r--r-- | keyboards/moonlander/info.json | 3 | ||||
-rw-r--r-- | keyboards/moonlander/keymaps/default/config.h | 2 | ||||
-rw-r--r-- | keyboards/moonlander/keymaps/default/keymap.c | 2 | ||||
-rw-r--r-- | keyboards/moonlander/matrix.c | 264 | ||||
-rw-r--r-- | keyboards/moonlander/mcuconf.h | 39 | ||||
-rw-r--r-- | keyboards/moonlander/moonlander.c | 13 | ||||
-rw-r--r-- | keyboards/moonlander/moonlander.h | 2 | ||||
-rw-r--r-- | keyboards/moonlander/readme.md | 18 | ||||
-rw-r--r-- | keyboards/moonlander/rules.mk | 7 | ||||
-rw-r--r-- | keyboards/planck/ez/config.h | 27 | ||||
-rw-r--r-- | keyboards/planck/ez/ez.c | 4 | ||||
-rw-r--r-- | keyboards/planck/ez/ez.h | 2 | ||||
-rw-r--r-- | keyboards/planck/ez/glow/config.h | 5 | ||||
-rw-r--r-- | keyboards/planck/ez/glow/glow.c | 18 | ||||
-rw-r--r-- | keyboards/planck/ez/glow/glow.h | 18 | ||||
-rw-r--r-- | keyboards/planck/ez/glow/keymaps/glow/keymap.c | 7 | ||||
-rw-r--r-- | keyboards/planck/ez/halconf.h | 23 | ||||
-rw-r--r-- | keyboards/planck/ez/info.json | 219 | ||||
-rw-r--r-- | keyboards/planck/ez/mcuconf.h | 53 | ||||
-rw-r--r-- | keyboards/planck/ez/readme.md | 18 | ||||
-rwxr-xr-x | keyboards/planck/ez/rules.mk | 12 | ||||
-rw-r--r-- | keyboards/planck/info.json | 108 | ||||
-rw-r--r-- | keyboards/planck/keymaps/default/config.h | 27 | ||||
-rw-r--r-- | keyboards/planck/keymaps/default/keymap.c | 7 | ||||
-rw-r--r-- | keyboards/planck/keymaps/oryx/config.h | 29 | ||||
-rw-r--r-- | keyboards/planck/keymaps/oryx/keymap.c | 463 | ||||
-rw-r--r-- | keyboards/planck/keymaps/oryx/rules.mk | 3 | ||||
-rw-r--r-- | keyboards/planck/planck.h | 18 | ||||
m--------- | lib/chibios | 0 | ||||
m--------- | lib/chibios-contrib | 0 | ||||
m--------- | lib/googletest | 0 | ||||
-rw-r--r-- | lib/python/qmk/c_parse.py | 1 | ||||
-rw-r--r-- | lib/python/qmk/cli/__init__.py | 41 | ||||
-rwxr-xr-x[-rw-r--r--] | lib/python/qmk/cli/cformat.py | 139 | ||||
-rwxr-xr-x | lib/python/qmk/cli/compile.py | 2 | ||||
-rw-r--r-- | lib/python/qmk/cli/console.py | 9 | ||||
-rw-r--r-- | lib/python/qmk/cli/docs.py | 7 | ||||
-rwxr-xr-x | lib/python/qmk/cli/doctor/__init__.py | 5 | ||||
-rw-r--r-- | lib/python/qmk/cli/doctor/check.py (renamed from lib/python/qmk/os_helpers/__init__.py) | 22 | ||||
-rw-r--r-- | lib/python/qmk/cli/doctor/linux.py (renamed from lib/python/qmk/os_helpers/linux/__init__.py) | 50 | ||||
-rw-r--r-- | lib/python/qmk/cli/doctor/macos.py | 13 | ||||
-rwxr-xr-x | lib/python/qmk/cli/doctor/main.py (renamed from lib/python/qmk/cli/doctor.py) | 80 | ||||
-rw-r--r-- | lib/python/qmk/cli/doctor/windows.py | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | lib/python/qmk/cli/fileformat.py | 24 | ||||
-rw-r--r-- | lib/python/qmk/cli/flash.py | 2 | ||||
-rw-r--r-- | lib/python/qmk/cli/format/c.py | 137 | ||||
-rwxr-xr-x | lib/python/qmk/cli/format/json.py | 5 | ||||
-rwxr-xr-x | lib/python/qmk/cli/format/python.py | 26 | ||||
-rw-r--r-- | lib/python/qmk/cli/format/text.py | 27 | ||||
-rwxr-xr-x | lib/python/qmk/cli/generate/config_h.py | 143 | ||||
-rw-r--r-- | lib/python/qmk/cli/generate/dfu_header.py | 2 | ||||
-rwxr-xr-x | lib/python/qmk/cli/generate/info_json.py | 40 | ||||
-rwxr-xr-x | lib/python/qmk/cli/generate/keyboard_h.py | 9 | ||||
-rwxr-xr-x | lib/python/qmk/cli/generate/layouts.py | 2 | ||||
-rwxr-xr-x | lib/python/qmk/cli/generate/rules_mk.py | 43 | ||||
-rw-r--r-- | lib/python/qmk/cli/generate/version_h.py | 28 | ||||
-rwxr-xr-x | lib/python/qmk/cli/info.py | 55 | ||||
-rwxr-xr-x | lib/python/qmk/cli/kle2json.py | 2 | ||||
-rw-r--r-- | lib/python/qmk/cli/lint.py | 9 | ||||
-rw-r--r-- | lib/python/qmk/cli/list/layouts.py | 18 | ||||
-rwxr-xr-x | lib/python/qmk/cli/multibuild.py | 6 | ||||
-rw-r--r-- | lib/python/qmk/cli/new/keyboard.py | 141 | ||||
-rwxr-xr-x | lib/python/qmk/cli/pyformat.py | 32 | ||||
-rw-r--r-- | lib/python/qmk/commands.py | 165 | ||||
-rw-r--r-- | lib/python/qmk/constants.py | 5 | ||||
-rw-r--r-- | lib/python/qmk/info.py | 323 | ||||
-rwxr-xr-x | lib/python/qmk/json_encoders.py | 3 | ||||
-rw-r--r-- | lib/python/qmk/json_schema.py | 50 | ||||
-rw-r--r-- | lib/python/qmk/keyboard.py | 2 | ||||
-rw-r--r-- | lib/python/qmk/keymap.py | 4 | ||||
-rw-r--r-- | lib/python/qmk/tests/minimal_info.json | 2 | ||||
-rw-r--r-- | lib/python/qmk/tests/test_cli_commands.py | 22 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/.gitattributes (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/.gitattributes) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/.gitignore (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/.gitignore) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/.gitmodules (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/.gitmodules) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/usbhost/USB_Host_Shield_2.0/BTD.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/BTD.cpp) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/usbhost/USB_Host_Shield_2.0/BTD.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/BTD.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/BTHID.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/BTHID.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/BTHID.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/BTHID.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/PS3BT.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3BT.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/PS3BT.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3BT.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/PS3Enums.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3Enums.h) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/usbhost/USB_Host_Shield_2.0/PS3USB.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3USB.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/PS3USB.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3USB.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/PS4BT.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS4BT.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/PS4Parser.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS4Parser.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/PS4Parser.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS4Parser.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/PS4USB.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS4USB.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/PSBuzz.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PSBuzz.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/PSBuzz.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PSBuzz.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/README.md (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/SPP.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/SPP.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/SPP.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/SPP.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/Usb.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/Usb.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/Usb.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/Usb.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/UsbCore.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/UsbCore.h) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/usbhost/USB_Host_Shield_2.0/Wii.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/Wii.cpp) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/usbhost/USB_Host_Shield_2.0/Wii.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/Wii.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/WiiCameraReadme.md (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/WiiCameraReadme.md) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/XBOXOLD.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXOLD.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/XBOXOLD.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXOLD.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/XBOXONE.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXONE.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/XBOXONE.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXONE.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/XBOXRECV.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXRECV.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/XBOXRECV.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXRECV.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/XBOXUSB.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXUSB.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/XBOXUSB.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXUSB.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/address.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/address.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/adk.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/adk.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/adk.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/adk.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/avrpins.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/avrpins.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/cdc_XR21B1411.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdc_XR21B1411.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/cdc_XR21B1411.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdc_XR21B1411.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/cdcacm.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcacm.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/cdcacm.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcacm.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/cdcftdi.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcftdi.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/cdcftdi.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcftdi.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/cdcprolific.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcprolific.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/cdcprolific.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcprolific.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/confdescparser.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/confdescparser.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/controllerEnums.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/controllerEnums.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/BTHID.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/BTHID.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/KeyboardParser.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/KeyboardParser.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/MouseParser.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/MouseParser.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3BT/PS3BT.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/PS3BT/PS3BT.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3SPP/PS3SPP.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/PS3SPP/PS3SPP.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS4BT/PS4BT.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/PS4BT/PS4BT.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/SPP/SPP.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/SPP/SPP.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/SPPMulti/SPPMulti.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/SPPMulti/SPPMulti.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/Wii/Wii.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/Wii/Wii.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiBalanceBoard/WiiBalanceBoard.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/WiiBalanceBoard/WiiBalanceBoard.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiUProController/WiiUProController.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/WiiUProController/WiiUProController.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDBootKbdAndMouse/USBHIDBootKbdAndMouse.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDBootKbdAndMouse/USBHIDBootKbdAndMouse.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/USBHIDJoystick.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/USBHIDJoystick.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/hidjoystickrptparser.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/hidjoystickrptparser.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/hidjoystickrptparser.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/hidjoystickrptparser.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHID_desc/USBHID_desc.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHID_desc/USBHID_desc.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHID_desc/pgmstrings.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHID_desc/pgmstrings.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/scale/scale.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/PS3USB/PS3USB.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/PS3USB/PS3USB.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/PS4USB/PS4USB.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/PS4USB/PS4USB.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/PSBuzz/PSBuzz.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/PSBuzz/PSBuzz.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/USB_desc/USB_desc.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/USB_desc/USB_desc.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/USB_desc/pgmstrings.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/USB_desc/pgmstrings.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Xbox/XBOXOLD/XBOXOLD.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Xbox/XBOXOLD/XBOXOLD.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Xbox/XBOXONE/XBOXONE.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Xbox/XBOXONE/XBOXONE.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Xbox/XBOXRECV/XBOXRECV.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Xbox/XBOXRECV/XBOXRECV.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/Xbox/XBOXUSB/XBOXUSB.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Xbox/XBOXUSB/XBOXUSB.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/acm/acm_terminal/acm_terminal.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/acm/acm_terminal/acm_terminal.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/acm/acm_terminal/pgmstrings.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/acm/acm_terminal/pgmstrings.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/adk/ArduinoBlinkLED/ArduinoBlinkLED.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/ArduinoBlinkLED/ArduinoBlinkLED.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/adk/adk_barcode/adk_barcode.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/adk_barcode/adk_barcode.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/adk/demokit_20/demokit_20.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/demokit_20/demokit_20.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/adk/term_test/term_test.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/term_test/term_test.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/adk/term_time/term_time.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/term_time/term_time.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/board_qc/board_qc.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/board_qc/board_qc.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/cdc_XR21B1411/XR_terminal/XR_terminal.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/cdc_XR21B1411/XR_terminal/XR_terminal.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/ftdi/USBFTDILoopback/pgmstrings.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/ftdi/USBFTDILoopback/pgmstrings.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/hub_demo/hub_demo.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/hub_demo/hub_demo.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/hub_demo/pgmstrings.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/hub_demo/pgmstrings.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/max_LCD/max_LCD.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/max_LCD/max_LCD.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/pl2303/pl2303_gps/pl2303_gps.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/pl2303/pl2303_gps/pl2303_gps.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/pl2303/pl2303_tinygps/pl2303_tinygps.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/pl2303/pl2303_tinygps/pl2303_tinygps.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/testusbhostFAT/Makefile (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/Makefile) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/testusbhostFAT/testusbhostFAT.ino (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/testusbhostFAT.ino) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/gpl2.txt (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/gpl2.txt) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/hexdump.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hexdump.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/hid.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hid.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/hid.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hid.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/hidboot.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidboot.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/hidboot.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidboot.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/hidescriptorparser.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidescriptorparser.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/hidescriptorparser.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidescriptorparser.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/hiduniversal.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hiduniversal.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/hiduniversal.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hiduniversal.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/hidusagestr.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidusagestr.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/hidusagetitlearrays.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidusagetitlearrays.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/keywords.txt (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/keywords.txt) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/library.json (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/library.json) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/library.properties (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/library.properties) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/macros.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/macros.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/masstorage.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/masstorage.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/masstorage.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/masstorage.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/max3421e.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/max3421e.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/max_LCD.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/max_LCD.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/max_LCD.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/max_LCD.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/message.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/message.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/message.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/message.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/parsetools.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/parsetools.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/parsetools.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/parsetools.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/printhex.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/printhex.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/settings.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/settings.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/sink_parser.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/sink_parser.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/usb_ch9.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/usb_ch9.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/usbhost.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/usbhost.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/usbhub.cpp (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/usbhub.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/usbhub.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/usbhub.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/version_helper.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/version_helper.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/xboxEnums.h (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/xboxEnums.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/Arduino.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Arduino.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/CDC.cpp (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/Client.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Client.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/HID.cpp (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HID.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/HardwareSerial.cpp (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/HardwareSerial.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/IPAddress.cpp (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/IPAddress.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/Platform.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Platform.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/Print.cpp (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/Print.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/Printable.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Printable.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/Server.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Server.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/Stream.cpp (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/Stream.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/Tone.cpp (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/USBAPI.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/USBCore.cpp (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/USBCore.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/USBDesc.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/Udp.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/WCharacter.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WCharacter.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/WInterrupts.c (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WInterrupts.c) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/WMath.cpp (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WMath.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/WString.cpp (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/WString.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/binary.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/binary.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/main.cpp (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/main.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/new.cpp (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.cpp) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/new.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/wiring.c (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring.c) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/wiring_analog.c (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_analog.c) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/wiring_digital.c (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_digital.c) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/wiring_private.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_private.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/wiring_pulse.c (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_pulse.c) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/cores/arduino/wiring_shift.c (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_shift.c) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/variants/leonardo/pins_arduino.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/variants/leonardo/pins_arduino.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/variants/mega/pins_arduino.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/variants/mega/pins_arduino.h) | 0 | ||||
-rw-r--r-- | lib/usbhost/arduino-1.0.1/variants/standard/pins_arduino.h (renamed from tmk_core/protocol/usb_hid/arduino-1.0.1/variants/standard/pins_arduino.h) | 0 | ||||
-rw-r--r-- | message.mk | 13 | ||||
-rw-r--r-- | platforms/arm_atsam/flash.mk | 11 | ||||
-rw-r--r-- | platforms/avr/drivers/analog.c (renamed from drivers/avr/analog.c) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/analog.h (renamed from drivers/avr/analog.h) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/apa102.c (renamed from drivers/avr/apa102.c) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/glcdfont.c (renamed from drivers/avr/glcdfont.c) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/hd44780.c (renamed from drivers/avr/hd44780.c) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/hd44780.h (renamed from drivers/avr/hd44780.h) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/i2c_master.c (renamed from drivers/avr/i2c_master.c) | 19 | ||||
-rw-r--r-- | platforms/avr/drivers/i2c_master.h (renamed from drivers/avr/i2c_master.h) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/i2c_slave.c (renamed from drivers/avr/i2c_slave.c) | 29 | ||||
-rw-r--r-- | platforms/avr/drivers/i2c_slave.h (renamed from drivers/avr/i2c_slave.h) | 13 | ||||
-rw-r--r-- | platforms/avr/drivers/serial.c (renamed from drivers/avr/serial.c) | 82 | ||||
-rw-r--r-- | platforms/avr/drivers/spi_master.c (renamed from drivers/avr/spi_master.c) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/spi_master.h (renamed from drivers/avr/spi_master.h) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/ssd1306.c (renamed from drivers/avr/ssd1306.c) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/ssd1306.h (renamed from drivers/avr/ssd1306.h) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/uart.c (renamed from drivers/avr/uart.c) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/uart.h (renamed from drivers/avr/uart.h) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/ws2812.c (renamed from drivers/avr/ws2812.c) | 0 | ||||
-rw-r--r-- | platforms/avr/drivers/ws2812_i2c.c (renamed from drivers/avr/ws2812_i2c.c) | 0 | ||||
-rw-r--r-- | platforms/avr/flash.mk | 179 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F401/board/board.mk (renamed from platforms/chibios/BLACKPILL_STM32_F401/board/board.mk) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F401/configs/board.h (renamed from platforms/chibios/BLACKPILL_STM32_F401/configs/board.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F401/configs/bootloader_defs.h (renamed from platforms/chibios/BLACKPILL_STM32_F401/configs/bootloader_defs.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F401/configs/config.h (renamed from platforms/chibios/BLACKPILL_STM32_F401/configs/config.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F401/configs/mcuconf.h (renamed from platforms/chibios/BLACKPILL_STM32_F401/configs/mcuconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xC_tinyuf2.ld | 88 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xE_tinyuf2.ld | 88 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F411/board/board.mk (renamed from platforms/chibios/BLACKPILL_STM32_F411/board/board.mk) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F411/configs/board.h (renamed from platforms/chibios/BLACKPILL_STM32_F411/configs/board.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F411/configs/bootloader_defs.h (renamed from platforms/chibios/BLACKPILL_STM32_F411/configs/bootloader_defs.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F411/configs/config.h (renamed from platforms/chibios/BLACKPILL_STM32_F411/configs/config.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F411/configs/mcuconf.h (renamed from platforms/chibios/BLACKPILL_STM32_F411/configs/mcuconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F411/ld/STM32F411xC_tinyuf2.ld (renamed from platforms/chibios/BLACKPILL_STM32_F411/ld/STM32F411xC_tinyuf2.ld) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/BLACKPILL_STM32_F411/ld/STM32F411xE_tinyuf2.ld (renamed from platforms/chibios/BLACKPILL_STM32_F411/ld/STM32F411xE_tinyuf2.ld) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F042X6/board/board.c (renamed from platforms/chibios/GENERIC_STM32_F042X6/board/board.c) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F042X6/board/board.h (renamed from platforms/chibios/GENERIC_STM32_F042X6/board/board.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F042X6/board/board.mk (renamed from platforms/chibios/GENERIC_STM32_F042X6/board/board.mk) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F042X6/configs/bootloader_defs.h (renamed from platforms/chibios/GENERIC_STM32_F042X6/configs/bootloader_defs.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F042X6/configs/config.h (renamed from platforms/chibios/GENERIC_STM32_F042X6/configs/config.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F042X6/configs/mcuconf.h (renamed from platforms/chibios/GENERIC_STM32_F042X6/configs/mcuconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F072XB/board/board.mk (renamed from platforms/chibios/GENERIC_STM32_F072XB/board/board.mk) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F072XB/configs/board.h (renamed from platforms/chibios/GENERIC_STM32_F072XB/configs/board.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F072XB/configs/bootloader_defs.h (renamed from platforms/chibios/GENERIC_STM32_F072XB/configs/bootloader_defs.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F072XB/configs/config.h (renamed from platforms/chibios/GENERIC_STM32_F072XB/configs/config.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F072XB/configs/mcuconf.h (renamed from platforms/chibios/GENERIC_STM32_F072XB/configs/mcuconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F303XC/board/board.mk (renamed from platforms/chibios/GENERIC_STM32_F303XC/board/board.mk) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F303XC/configs/board.h (renamed from platforms/chibios/GENERIC_STM32_F303XC/configs/board.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F303XC/configs/bootloader_defs.h (renamed from platforms/chibios/GENERIC_STM32_F303XC/configs/bootloader_defs.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F303XC/configs/config.h (renamed from platforms/chibios/GENERIC_STM32_F303XC/configs/config.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F303XC/configs/mcuconf.h (renamed from platforms/chibios/GENERIC_STM32_F303XC/configs/mcuconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F407XE/board/board.mk | 9 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F407XE/configs/board.h | 24 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F407XE/configs/config.h (renamed from platforms/chibios/GENERIC_STM32_F446XE/configs/config.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h | 355 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F446XE/board/board.mk (renamed from platforms/chibios/GENERIC_STM32_F446XE/board/board.mk) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F446XE/configs/board.h (renamed from platforms/chibios/GENERIC_STM32_F446XE/configs/board.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F446XE/configs/config.h | 23 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_F446XE/configs/mcuconf.h (renamed from platforms/chibios/GENERIC_STM32_F446XE/configs/mcuconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_G431XB/board/board.mk (renamed from platforms/chibios/GENERIC_STM32_G431XB/board/board.mk) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_G431XB/configs/config.h (renamed from platforms/chibios/GENERIC_STM32_G431XB/configs/config.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_G431XB/configs/mcuconf.h (renamed from platforms/chibios/GENERIC_STM32_G431XB/configs/mcuconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_G474XE/board/board.mk (renamed from platforms/chibios/GENERIC_STM32_G474XE/board/board.mk) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_G474XE/configs/config.h (renamed from platforms/chibios/GENERIC_STM32_G474XE/configs/config.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_G474XE/configs/mcuconf.h (renamed from platforms/chibios/GENERIC_STM32_G474XE/configs/mcuconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_L412XB/board/board.mk (renamed from platforms/chibios/GENERIC_STM32_L433XC/board/board.mk) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_L412XB/configs/board.h (renamed from platforms/chibios/GENERIC_STM32_L433XC/configs/board.h) | 2 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_L412XB/configs/config.h (renamed from platforms/chibios/GENERIC_STM32_L433XC/configs/config.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_L412XB/configs/mcuconf.h | 282 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_L433XC/board/board.mk | 9 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_L433XC/configs/board.h | 24 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h | 26 | ||||
-rw-r--r-- | platforms/chibios/boards/GENERIC_STM32_L433XC/configs/mcuconf.h (renamed from platforms/chibios/GENERIC_STM32_L433XC/configs/mcuconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/IC_TEENSY_3_1/board/board.c (renamed from platforms/chibios/IC_TEENSY_3_1/board/board.c) | 5 | ||||
-rw-r--r-- | platforms/chibios/boards/IC_TEENSY_3_1/board/board.h (renamed from platforms/chibios/IC_TEENSY_3_1/board/board.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/IC_TEENSY_3_1/board/board.mk (renamed from platforms/chibios/IC_TEENSY_3_1/board/board.mk) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/IC_TEENSY_4_1/board/board.mk | 1 | ||||
-rw-r--r-- | platforms/chibios/boards/IC_TEENSY_4_1/rules.mk | 1 | ||||
-rw-r--r-- | platforms/chibios/boards/QMK_PROTON_C/board/board.mk (renamed from platforms/chibios/QMK_PROTON_C/board/board.mk) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/QMK_PROTON_C/configs/board.h (renamed from platforms/chibios/QMK_PROTON_C/configs/board.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/QMK_PROTON_C/configs/bootloader_defs.h (renamed from platforms/chibios/QMK_PROTON_C/configs/bootloader_defs.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/QMK_PROTON_C/configs/chconf.h (renamed from platforms/chibios/QMK_PROTON_C/configs/chconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/QMK_PROTON_C/configs/config.h (renamed from platforms/chibios/QMK_PROTON_C/configs/config.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/QMK_PROTON_C/configs/halconf.h (renamed from platforms/chibios/QMK_PROTON_C/configs/halconf.h) | 2 | ||||
-rw-r--r-- | platforms/chibios/boards/QMK_PROTON_C/configs/mcuconf.h (renamed from platforms/chibios/QMK_PROTON_C/configs/mcuconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/QMK_PROTON_C/convert_to_proton_c.mk (renamed from platforms/chibios/QMK_PROTON_C/convert_to_proton_c.mk) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.c (renamed from platforms/chibios/STM32_F103_STM32DUINO/board/board.c) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.h (renamed from platforms/chibios/STM32_F103_STM32DUINO/board/board.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.mk (renamed from platforms/chibios/STM32_F103_STM32DUINO/board/board.mk) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/STM32_F103_STM32DUINO/configs/mcuconf.h (renamed from platforms/chibios/STM32_F103_STM32DUINO/configs/mcuconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/STM32_F103_STM32DUINO/ld/STM32F103x8_stm32duino_bootloader.ld | 22 | ||||
-rw-r--r-- | platforms/chibios/boards/STM32_F103_STM32DUINO/ld/STM32F103xB_stm32duino_bootloader.ld | 22 | ||||
-rw-r--r-- | platforms/chibios/boards/STM32_F103_STM32DUINO/ld/stm32duino_bootloader_common.ld (renamed from platforms/chibios/common/ld/STM32F103x8_stm32duino_bootloader.ld) | 4 | ||||
-rw-r--r-- | platforms/chibios/boards/common/configs/chconf.h (renamed from platforms/chibios/common/configs/chconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/common/configs/halconf.h (renamed from platforms/chibios/common/configs/halconf.h) | 2 | ||||
-rw-r--r-- | platforms/chibios/boards/common/ld/MKL26Z64.ld (renamed from platforms/chibios/common/ld/MKL26Z64.ld) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/common/ld/STM32L412xB.ld | 85 | ||||
-rw-r--r-- | platforms/chibios/boards/keyboard-config-templates/board.h (renamed from platforms/chibios/keyboard-config-templates/board.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/keyboard-config-templates/chconf.h (renamed from platforms/chibios/keyboard-config-templates/chconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/keyboard-config-templates/halconf.h (renamed from platforms/chibios/keyboard-config-templates/halconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/boards/keyboard-config-templates/mcuconf.h (renamed from platforms/chibios/keyboard-config-templates/mcuconf.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/analog.c (renamed from drivers/chibios/analog.c) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/analog.h (renamed from drivers/chibios/analog.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/eeprom/eeprom_stm32_L0_L1.c (renamed from drivers/eeprom/eeprom_stm32_L0_L1.c) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/eeprom/eeprom_stm32_L0_L1.h (renamed from drivers/eeprom/eeprom_stm32_L0_L1.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/i2c_master.c (renamed from drivers/chibios/i2c_master.c) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/i2c_master.h (renamed from drivers/chibios/i2c_master.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/serial.c (renamed from drivers/chibios/serial.c) | 52 | ||||
-rw-r--r-- | platforms/chibios/drivers/serial_usart.c | 318 | ||||
-rw-r--r-- | platforms/chibios/drivers/serial_usart.h (renamed from drivers/chibios/serial_usart.h) | 42 | ||||
-rw-r--r-- | platforms/chibios/drivers/spi_master.c (renamed from drivers/chibios/spi_master.c) | 70 | ||||
-rw-r--r-- | platforms/chibios/drivers/spi_master.h (renamed from drivers/chibios/spi_master.h) | 19 | ||||
-rw-r--r-- | platforms/chibios/drivers/uart.c (renamed from drivers/chibios/uart.c) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/uart.h (renamed from drivers/chibios/uart.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/usbpd_stm32g4.c (renamed from drivers/chibios/usbpd_stm32g4.c) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/ws2812.c (renamed from drivers/chibios/ws2812.c) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/ws2812_pwm.c (renamed from drivers/chibios/ws2812_pwm.c) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/ws2812_spi.c (renamed from drivers/chibios/ws2812_spi.c) | 20 | ||||
-rw-r--r-- | platforms/chibios/drivers/wt_rgb_backlight.c (renamed from drivers/chibios/wt_rgb_backlight.c) | 157 | ||||
-rw-r--r-- | platforms/chibios/drivers/wt_rgb_backlight.h (renamed from drivers/chibios/wt_rgb_backlight.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/wt_rgb_backlight_api.h (renamed from drivers/chibios/wt_rgb_backlight_api.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/drivers/wt_rgb_backlight_keycodes.h (renamed from drivers/chibios/wt_rgb_backlight_keycodes.h) | 0 | ||||
-rw-r--r-- | platforms/chibios/flash.mk | 87 | ||||
-rw-r--r-- | quantum/action.c (renamed from tmk_core/common/action.c) | 43 | ||||
-rw-r--r-- | quantum/action.h (renamed from tmk_core/common/action.h) | 12 | ||||
-rw-r--r-- | quantum/action_code.h (renamed from tmk_core/common/action_code.h) | 0 | ||||
-rw-r--r-- | quantum/action_layer.c (renamed from tmk_core/common/action_layer.c) | 12 | ||||
-rw-r--r-- | quantum/action_layer.h (renamed from tmk_core/common/action_layer.h) | 29 | ||||
-rw-r--r-- | quantum/action_macro.c (renamed from tmk_core/common/action_macro.c) | 0 | ||||
-rw-r--r-- | quantum/action_macro.h (renamed from tmk_core/common/action_macro.h) | 0 | ||||
-rw-r--r-- | quantum/action_tapping.c (renamed from tmk_core/common/action_tapping.c) | 58 | ||||
-rw-r--r-- | quantum/action_tapping.h (renamed from tmk_core/common/action_tapping.h) | 1 | ||||
-rw-r--r-- | quantum/action_util.c (renamed from tmk_core/common/action_util.c) | 36 | ||||
-rw-r--r-- | quantum/action_util.h (renamed from tmk_core/common/action_util.h) | 0 | ||||
-rw-r--r-- | quantum/audio/audio.c | 542 | ||||
-rw-r--r-- | quantum/audio/luts.h | 10 | ||||
-rw-r--r-- | quantum/audio/voices.h | 3 | ||||
-rw-r--r-- | quantum/bootmagic/bootmagic.h | 4 | ||||
-rw-r--r-- | quantum/bootmagic/bootmagic_full.c | 147 | ||||
-rw-r--r-- | quantum/bootmagic/bootmagic_full.h | 115 | ||||
-rw-r--r-- | quantum/bootmagic/bootmagic_lite.c | 8 | ||||
-rw-r--r-- | quantum/color.h | 54 | ||||
-rw-r--r-- | quantum/command.c | 599 | ||||
-rw-r--r-- | quantum/command.h | 3 | ||||
-rw-r--r-- | quantum/crc.c | 59 | ||||
-rw-r--r-- | quantum/crc.h | 44 | ||||
-rw-r--r-- | quantum/debounce.h | 2 | ||||
-rw-r--r-- | quantum/debounce/asym_eager_defer_pk.c | 171 | ||||
-rw-r--r-- | quantum/debounce/none.c | 31 | ||||
-rw-r--r-- | quantum/debounce/sym_defer_g.c | 26 | ||||
-rw-r--r-- | quantum/debounce/sym_defer_pk.c | 67 | ||||
-rw-r--r-- | quantum/debounce/sym_eager_pk.c | 72 | ||||
-rw-r--r-- | quantum/debounce/sym_eager_pr.c | 76 | ||||
-rw-r--r-- | quantum/debounce/tests/asym_eager_defer_pk_tests.cpp | 374 | ||||
-rw-r--r-- | quantum/debounce/tests/debounce_test_common.cpp | 229 | ||||
-rw-r--r-- | quantum/debounce/tests/debounce_test_common.h | 83 | ||||
-rw-r--r-- | quantum/debounce/tests/rules.mk | 44 | ||||
-rw-r--r-- | quantum/debounce/tests/sym_defer_g_tests.cpp | 223 | ||||
-rw-r--r-- | quantum/debounce/tests/sym_defer_pk_tests.cpp | 225 | ||||
-rw-r--r-- | quantum/debounce/tests/sym_eager_pk_tests.cpp | 237 | ||||
-rw-r--r-- | quantum/debounce/tests/sym_eager_pr_tests.cpp | 280 | ||||
-rw-r--r-- | quantum/debounce/tests/testlist.mk | 6 | ||||
-rw-r--r-- | quantum/digitizer.c | 34 | ||||
-rw-r--r-- | quantum/digitizer.h | 41 | ||||
-rw-r--r-- | quantum/dip_switch.c | 19 | ||||
-rw-r--r-- | quantum/dip_switch.h | 8 | ||||
-rw-r--r-- | quantum/eeconfig.c (renamed from tmk_core/common/eeconfig.c) | 33 | ||||
-rw-r--r-- | quantum/eeconfig.h (renamed from tmk_core/common/eeconfig.h) | 2 | ||||
-rw-r--r-- | quantum/encoder.c | 5 | ||||
-rw-r--r-- | quantum/haptic.c (renamed from drivers/haptic/haptic.c) | 106 | ||||
-rw-r--r-- | quantum/haptic.h (renamed from drivers/haptic/haptic.h) | 6 | ||||
-rw-r--r-- | quantum/keyboard.c (renamed from tmk_core/common/keyboard.c) | 45 | ||||
-rw-r--r-- | quantum/keyboard.h (renamed from tmk_core/common/keyboard.h) | 0 | ||||
-rw-r--r-- | quantum/keycode.h (renamed from tmk_core/common/keycode.h) | 0 | ||||
-rw-r--r-- | quantum/keymap_common.c | 7 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_belgian.h | 49 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_bepo.h | 219 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_br_abnt2.h | 56 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_canadian_multilingual.h | 241 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_colemak.h | 52 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_croatian.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_czech.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_danish.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_dvorak.h | 20 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_dvorak_fr.h | 24 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_dvp.h | 20 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_estonian.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_finnish.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_fr_ch.h | 115 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_french.h | 47 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_french_afnor.h | 60 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_french_osx.h | 60 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_german.h | 49 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_german_ch.h | 54 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_german_osx.h | 128 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_greek.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_hebrew.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_hungarian.h | 55 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_icelandic.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_irish.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_italian.h | 67 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_italian_osx_ansi.h | 58 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_italian_osx_iso.h | 66 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_jp.h | 33 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_korean.h | 20 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_latvian.h | 50 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_lithuanian_azerty.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_lithuanian_qwerty.h | 48 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_neo2.h | 64 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_norman.h | 20 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_norwegian.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_plover.h | 10 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_polish.h | 30 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_portuguese.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_portuguese_osx_iso.h | 48 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_romanian.h | 48 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_russian.h | 30 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_serbian.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_serbian_latin.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_slovak.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_slovenian.h | 44 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_spanish.h | 45 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_spanish_dvorak.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_steno.h | 18 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_swedish.h | 59 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_swedish_osx_ansi.h | 240 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_swedish_osx_iso.h | 239 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_swedish_pro_osx_ansi.h | 240 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_swedish_pro_osx_iso.h | 239 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_turkish_f.h | 50 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_turkish_q.h | 36 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_uk.h | 111 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_us_extended.h | 42 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_us_international.h | 40 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_us_international_linux.h | 48 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_workman.h | 49 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_workman_zxcvm.h | 20 | ||||
-rw-r--r-- | quantum/led_matrix/animations/alpha_mods_anim.h (renamed from quantum/led_matrix_animations/alpha_mods_anim.h) | 4 | ||||
-rw-r--r-- | quantum/led_matrix/animations/band_anim.h (renamed from quantum/led_matrix_animations/band_anim.h) | 4 | ||||
-rw-r--r-- | quantum/led_matrix/animations/band_pinwheel_anim.h (renamed from quantum/led_matrix_animations/band_pinwheel_anim.h) | 4 | ||||
-rw-r--r-- | quantum/led_matrix/animations/band_spiral_anim.h (renamed from quantum/led_matrix_animations/band_spiral_anim.h) | 4 | ||||
-rw-r--r-- | quantum/led_matrix/animations/breathing_anim.h (renamed from quantum/led_matrix_animations/breathing_anim.h) | 4 | ||||
-rw-r--r-- | quantum/led_matrix/animations/cycle_left_right_anim.h (renamed from quantum/led_matrix_animations/cycle_left_right_anim.h) | 4 | ||||
-rw-r--r-- | quantum/led_matrix/animations/cycle_out_in_anim.h (renamed from quantum/led_matrix_animations/cycle_out_in_anim.h) | 4 | ||||
-rw-r--r-- | quantum/led_matrix/animations/cycle_up_down_anim.h (renamed from quantum/led_matrix_animations/cycle_up_down_anim.h) | 4 | ||||
-rw-r--r-- | quantum/led_matrix/animations/dual_beacon_anim.h (renamed from quantum/led_matrix_animations/dual_beacon_anim.h) | 4 | ||||
-rw-r--r-- | quantum/led_matrix/animations/led_matrix_effects.inc | 18 | ||||
-rw-r--r-- | quantum/led_matrix/animations/runners/effect_runner_dx_dy.h (renamed from quantum/led_matrix_runners/effect_runner_dx_dy.h) | 0 | ||||
-rw-r--r-- | quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h (renamed from quantum/led_matrix_runners/effect_runner_dx_dy_dist.h) | 0 | ||||
-rw-r--r-- | quantum/led_matrix/animations/runners/effect_runner_i.h (renamed from quantum/led_matrix_runners/effect_runner_i.h) | 0 | ||||
-rw-r--r-- | quantum/led_matrix/animations/runners/effect_runner_reactive.h (renamed from quantum/led_matrix_runners/effect_runner_reactive.h) | 0 | ||||
-rw-r--r-- | quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h (renamed from quantum/led_matrix_runners/effect_runner_reactive_splash.h) | 0 | ||||
-rw-r--r-- | quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h (renamed from quantum/led_matrix_runners/effect_runner_sin_cos_i.h) | 0 | ||||
-rw-r--r-- | quantum/led_matrix/animations/runners/led_matrix_runners.inc | 6 | ||||
-rw-r--r-- | quantum/led_matrix/animations/solid_anim.h (renamed from quantum/led_matrix_animations/solid_anim.h) | 0 | ||||
-rw-r--r-- | quantum/led_matrix/animations/solid_reactive_cross.h (renamed from quantum/led_matrix_animations/solid_reactive_cross.h) | 12 | ||||
-rw-r--r-- | quantum/led_matrix/animations/solid_reactive_nexus.h (renamed from quantum/led_matrix_animations/solid_reactive_nexus.h) | 14 | ||||
-rw-r--r-- | quantum/led_matrix/animations/solid_reactive_simple_anim.h (renamed from quantum/led_matrix_animations/solid_reactive_simple_anim.h) | 6 | ||||
-rw-r--r-- | quantum/led_matrix/animations/solid_reactive_wide.h (renamed from quantum/led_matrix_animations/solid_reactive_wide.h) | 12 | ||||
-rw-r--r-- | quantum/led_matrix/animations/solid_splash_anim.h (renamed from quantum/led_matrix_animations/solid_splash_anim.h) | 12 | ||||
-rw-r--r-- | quantum/led_matrix/animations/wave_left_right_anim.h (renamed from quantum/led_matrix_animations/wave_left_right_anim.h) | 4 | ||||
-rw-r--r-- | quantum/led_matrix/animations/wave_up_down_anim.h (renamed from quantum/led_matrix_animations/wave_up_down_anim.h) | 4 | ||||
-rw-r--r-- | quantum/led_matrix/led_matrix.c (renamed from quantum/led_matrix.c) | 53 | ||||
-rw-r--r-- | quantum/led_matrix/led_matrix.h (renamed from quantum/led_matrix.h) | 3 | ||||
-rw-r--r-- | quantum/led_matrix/led_matrix_drivers.c (renamed from quantum/led_matrix_drivers.c) | 0 | ||||
-rw-r--r-- | quantum/led_matrix/led_matrix_legacy_enables.h | 82 | ||||
-rw-r--r-- | quantum/led_matrix/led_matrix_types.h (renamed from quantum/led_matrix_types.h) | 0 | ||||
-rw-r--r-- | quantum/led_matrix_animations/led_matrix_effects.inc | 18 | ||||
-rw-r--r-- | quantum/logging/debug.c (renamed from tmk_core/common/debug.c) | 0 | ||||
-rw-r--r-- | quantum/logging/debug.h (renamed from tmk_core/common/debug.h) | 2 | ||||
-rw-r--r-- | quantum/logging/nodebug.h (renamed from tmk_core/common/nodebug.h) | 0 | ||||
-rw-r--r-- | quantum/logging/print.c (renamed from tmk_core/common/printf.c) | 0 | ||||
-rw-r--r-- | quantum/logging/print.h (renamed from tmk_core/common/print.h) | 2 | ||||
-rw-r--r-- | quantum/logging/print.mk | 9 | ||||
-rw-r--r-- | quantum/logging/sendchar.c (renamed from tmk_core/common/sendchar_null.c) | 1 | ||||
-rw-r--r-- | quantum/logging/sendchar.h (renamed from tmk_core/common/sendchar.h) | 0 | ||||
-rw-r--r-- | quantum/main.c | 41 | ||||
-rw-r--r-- | quantum/matrix.c | 277 | ||||
-rw-r--r-- | quantum/matrix.h | 2 | ||||
-rw-r--r-- | quantum/matrix_common.c | 2 | ||||
-rw-r--r-- | quantum/mcu_selection.mk | 109 | ||||
-rw-r--r-- | quantum/mousekey.c | 2 | ||||
-rw-r--r-- | quantum/mousekey.h | 11 | ||||
-rw-r--r-- | quantum/process_keycode/process_combo.c | 558 | ||||
-rw-r--r-- | quantum/process_keycode/process_combo.h | 38 | ||||
-rw-r--r-- | quantum/process_keycode/process_haptic.c | 148 | ||||
-rw-r--r-- | quantum/process_keycode/process_haptic.h | 21 | ||||
-rw-r--r-- | quantum/process_keycode/process_key_override.c | 518 | ||||
-rw-r--r-- | quantum/process_keycode/process_key_override.h | 153 | ||||
-rw-r--r-- | quantum/process_keycode/process_magic.c | 3 | ||||
-rw-r--r-- | quantum/process_keycode/process_music.c | 2 | ||||
-rw-r--r-- | quantum/process_keycode/process_music.h | 2 | ||||
-rw-r--r-- | quantum/process_keycode/process_rgb.c | 7 | ||||
-rw-r--r-- | quantum/process_keycode/process_steno.c | 15 | ||||
-rw-r--r-- | quantum/process_keycode/process_tap_dance.c | 4 | ||||
-rw-r--r-- | quantum/process_keycode/process_tap_dance.h | 2 | ||||
-rw-r--r-- | quantum/quantum.c | 62 | ||||
-rw-r--r-- | quantum/quantum.h | 30 | ||||
-rw-r--r-- | quantum/quantum_keycodes.h | 11 | ||||
-rw-r--r-- | quantum/rgb.h | 39 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/alpha_mods_anim.h (renamed from quantum/rgb_matrix_animations/alpha_mods_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/breathing_anim.h (renamed from quantum/rgb_matrix_animations/breathing_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h (renamed from quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h (renamed from quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/colorband_sat_anim.h (renamed from quantum/rgb_matrix_animations/colorband_sat_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h (renamed from quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/colorband_spiral_val_anim.h (renamed from quantum/rgb_matrix_animations/colorband_spiral_val_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/colorband_val_anim.h (renamed from quantum/rgb_matrix_animations/colorband_val_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/cycle_all_anim.h (renamed from quantum/rgb_matrix_animations/cycle_all_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/cycle_left_right_anim.h (renamed from quantum/rgb_matrix_animations/cycle_left_right_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/cycle_out_in_anim.h (renamed from quantum/rgb_matrix_animations/cycle_out_in_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h (renamed from quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/cycle_pinwheel_anim.h (renamed from quantum/rgb_matrix_animations/cycle_pinwheel_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/cycle_spiral_anim.h (renamed from quantum/rgb_matrix_animations/cycle_spiral_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/cycle_up_down_anim.h (renamed from quantum/rgb_matrix_animations/cycle_up_down_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/digital_rain_anim.h (renamed from quantum/rgb_matrix_animations/digital_rain_anim.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/dual_beacon_anim.h (renamed from quantum/rgb_matrix_animations/dual_beacon_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/gradient_left_right_anim.h (renamed from quantum/rgb_matrix_animations/gradient_left_right_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/gradient_up_down_anim.h (renamed from quantum/rgb_matrix_animations/gradient_up_down_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/hue_breathing_anim.h (renamed from quantum/rgb_matrix_animations/hue_breathing_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/hue_pendulum_anim.h (renamed from quantum/rgb_matrix_animations/hue_pendulum_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/hue_wave_anim.h (renamed from quantum/rgb_matrix_animations/hue_wave_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/jellybean_raindrops_anim.h (renamed from quantum/rgb_matrix_animations/jellybean_raindrops_anim.h) | 4 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/rainbow_beacon_anim.h (renamed from quantum/rgb_matrix_animations/rainbow_beacon_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h (renamed from quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h (renamed from quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/raindrops_anim.h (renamed from quantum/rgb_matrix_animations/raindrops_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/rgb_matrix_effects.inc | 37 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/runners/effect_runner_dx_dy.h (renamed from quantum/rgb_matrix_runners/effect_runner_dx_dy.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/runners/effect_runner_dx_dy_dist.h (renamed from quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/runners/effect_runner_i.h (renamed from quantum/rgb_matrix_runners/effect_runner_i.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/runners/effect_runner_reactive.h (renamed from quantum/rgb_matrix_runners/effect_runner_reactive.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h (renamed from quantum/rgb_matrix_runners/effect_runner_reactive_splash.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/runners/effect_runner_sin_cos_i.h (renamed from quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/runners/rgb_matrix_runners.inc | 6 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/solid_color_anim.h (renamed from quantum/rgb_matrix_animations/solid_color_anim.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/solid_reactive_anim.h (renamed from quantum/rgb_matrix_animations/solid_reactive_anim.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/solid_reactive_cross.h (renamed from quantum/rgb_matrix_animations/solid_reactive_cross.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/solid_reactive_nexus.h (renamed from quantum/rgb_matrix_animations/solid_reactive_nexus.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/solid_reactive_simple_anim.h (renamed from quantum/rgb_matrix_animations/solid_reactive_simple_anim.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/solid_reactive_wide.h (renamed from quantum/rgb_matrix_animations/solid_reactive_wide.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/solid_splash_anim.h (renamed from quantum/rgb_matrix_animations/solid_splash_anim.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/splash_anim.h (renamed from quantum/rgb_matrix_animations/splash_anim.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix/animations/typing_heatmap_anim.h (renamed from quantum/rgb_matrix_animations/typing_heatmap_anim.h) | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/rgb_matrix.c (renamed from quantum/rgb_matrix.c) | 59 | ||||
-rw-r--r-- | quantum/rgb_matrix/rgb_matrix.h (renamed from quantum/rgb_matrix.h) | 6 | ||||
-rw-r--r-- | quantum/rgb_matrix/rgb_matrix_drivers.c (renamed from quantum/rgb_matrix_drivers.c) | 46 | ||||
-rw-r--r-- | quantum/rgb_matrix/rgb_matrix_legacy_enables.h | 153 | ||||
-rw-r--r-- | quantum/rgb_matrix/rgb_matrix_types.h (renamed from quantum/rgb_matrix_types.h) | 0 | ||||
-rw-r--r-- | quantum/rgb_matrix_animations/rgb_matrix_effects.inc | 37 | ||||
-rw-r--r-- | quantum/rgblight/rgblight.c (renamed from quantum/rgblight.c) | 23 | ||||
-rw-r--r-- | quantum/rgblight/rgblight.h (renamed from quantum/rgblight.h) | 196 | ||||
-rw-r--r-- | quantum/rgblight/rgblight_breathe_table.h (renamed from quantum/rgblight_breathe_table.h) | 0 | ||||
-rw-r--r-- | quantum/rgblight/rgblight_list.h (renamed from quantum/rgblight_list.h) | 46 | ||||
-rw-r--r-- | quantum/rgblight/rgblight_modes.h (renamed from quantum/rgblight_modes.h) | 0 | ||||
-rw-r--r-- | quantum/rgblight/rgblight_post_config.h (renamed from quantum/rgblight_post_config.h) | 0 | ||||
-rw-r--r-- | quantum/send_string.c | 8 | ||||
-rw-r--r-- | quantum/sequencer/sequencer.c | 2 | ||||
-rw-r--r-- | quantum/sequencer/sequencer.h | 2 | ||||
-rw-r--r-- | quantum/sequencer/tests/sequencer_tests.cpp | 26 | ||||
-rw-r--r-- | quantum/serial_link/system/serial_link.c | 22 | ||||
-rw-r--r-- | quantum/split_common/matrix.c | 309 | ||||
-rw-r--r-- | quantum/split_common/post_config.h | 9 | ||||
-rw-r--r-- | quantum/split_common/split_util.c | 57 | ||||
-rw-r--r-- | quantum/split_common/split_util.h | 5 | ||||
-rw-r--r-- | quantum/split_common/transaction_id_define.h | 102 | ||||
-rw-r--r-- | quantum/split_common/transactions.c | 723 | ||||
-rw-r--r-- | quantum/split_common/transactions.h | 54 | ||||
-rw-r--r-- | quantum/split_common/transport.c | 484 | ||||
-rw-r--r-- | quantum/split_common/transport.h | 173 | ||||
-rw-r--r-- | quantum/tools/readme.md | 6 | ||||
-rw-r--r-- | quantum/via.c | 42 | ||||
-rw-r--r-- | quantum/via.h | 8 | ||||
-rw-r--r-- | quantum/wpm.c | 14 | ||||
-rw-r--r-- | readme.md | 12 | ||||
-rw-r--r-- | requirements.txt | 2 | ||||
-rw-r--r-- | secrets.tar.enc | bin | 10256 -> 0 bytes | |||
-rw-r--r-- | shell.nix | 11 | ||||
-rw-r--r-- | show_options.mk | 41 | ||||
-rw-r--r-- | testlist.mk | 2 | ||||
-rw-r--r-- | tests/test_common/keyboard_report_util.cpp | 2 | ||||
-rw-r--r-- | tests/test_common/main.cpp | 32 | ||||
-rw-r--r-- | tests/test_common/test_fixture.cpp | 8 | ||||
-rw-r--r-- | tmk_core/arm_atsam.mk | 18 | ||||
-rw-r--r-- | tmk_core/avr.mk | 196 | ||||
-rw-r--r-- | tmk_core/chibios.mk | 125 | ||||
-rw-r--r-- | tmk_core/common.mk | 48 | ||||
-rw-r--r-- | tmk_core/common/arm_atsam/_print.h | 34 | ||||
-rw-r--r-- | tmk_core/common/arm_atsam/_timer.h | 19 | ||||
-rw-r--r-- | tmk_core/common/arm_atsam/atomic_util.h | 37 | ||||
-rw-r--r-- | tmk_core/common/arm_atsam/gpio.h | 71 | ||||
-rw-r--r-- | tmk_core/common/arm_atsam/pin_defs.h | 84 | ||||
-rw-r--r-- | tmk_core/common/arm_atsam/platform.c | 21 | ||||
-rw-r--r-- | tmk_core/common/arm_atsam/platform_deps.h | 18 | ||||
-rw-r--r-- | tmk_core/common/arm_atsam/printf.c | 75 | ||||
-rw-r--r-- | tmk_core/common/arm_atsam/printf.h | 7 | ||||
-rw-r--r-- | tmk_core/common/arm_atsam/printf.mk | 1 | ||||
-rw-r--r-- | tmk_core/common/avr/_timer.h | 19 | ||||
-rw-r--r-- | tmk_core/common/avr/_wait.h | 26 | ||||
-rw-r--r-- | tmk_core/common/avr/gpio.h | 15 | ||||
-rw-r--r-- | tmk_core/common/avr/platform.c | 21 | ||||
-rw-r--r-- | tmk_core/common/avr/platform_deps.h | 20 | ||||
-rw-r--r-- | tmk_core/common/chibios/_timer.h | 19 | ||||
-rw-r--r-- | tmk_core/common/chibios/_wait.c | 89 | ||||
-rw-r--r-- | tmk_core/common/chibios/_wait.h | 31 | ||||
-rw-r--r-- | tmk_core/common/chibios/bootloader.c | 5 | ||||
-rw-r--r-- | tmk_core/common/chibios/chibios_config.h | 4 | ||||
-rw-r--r-- | tmk_core/common/chibios/eeprom_stm32.c | 764 | ||||
-rw-r--r-- | tmk_core/common/chibios/eeprom_stm32.h | 61 | ||||
-rw-r--r-- | tmk_core/common/chibios/eeprom_stm32_defs.h | 61 | ||||
-rw-r--r-- | tmk_core/common/chibios/flash_stm32.c | 39 | ||||
-rw-r--r-- | tmk_core/common/chibios/flash_stm32.h | 8 | ||||
-rw-r--r-- | tmk_core/common/chibios/gpio.h | 16 | ||||
-rw-r--r-- | tmk_core/common/chibios/platform.c | 22 | ||||
-rw-r--r-- | tmk_core/common/chibios/platform_deps.h | 19 | ||||
-rw-r--r-- | tmk_core/common/chibios/wait.c | 90 | ||||
-rw-r--r-- | tmk_core/common/host.c | 33 | ||||
-rw-r--r-- | tmk_core/common/host_driver.h | 2 | ||||
-rw-r--r-- | tmk_core/common/lib_printf.mk | 9 | ||||
-rw-r--r-- | tmk_core/common/progmem.h | 2 | ||||
-rw-r--r-- | tmk_core/common/report.c | 16 | ||||
-rw-r--r-- | tmk_core/common/report.h | 14 | ||||
-rw-r--r-- | tmk_core/common/sendchar_uart.c | 23 | ||||
-rw-r--r-- | tmk_core/common/sync_timer.c | 2 | ||||
-rw-r--r-- | tmk_core/common/sync_timer.h | 2 | ||||
-rw-r--r-- | tmk_core/common/test/eeprom_stm32_tests.cpp | 438 | ||||
-rw-r--r-- | tmk_core/common/test/flash_stm32_mock.c | 49 | ||||
-rw-r--r-- | tmk_core/common/test/hal.h | 18 | ||||
-rw-r--r-- | tmk_core/common/test/platform.c | 21 | ||||
-rw-r--r-- | tmk_core/common/test/platform.h | 18 | ||||
-rw-r--r-- | tmk_core/common/test/platform_deps.h | 18 | ||||
-rw-r--r-- | tmk_core/common/test/rules.mk | 23 | ||||
-rw-r--r-- | tmk_core/common/test/testlist.mk | 1 | ||||
-rw-r--r-- | tmk_core/common/timer.h | 25 | ||||
-rw-r--r-- | tmk_core/common/usb_util.c | 4 | ||||
-rw-r--r-- | tmk_core/common/usb_util.h | 2 | ||||
-rw-r--r-- | tmk_core/native.mk | 5 | ||||
-rw-r--r-- | tmk_core/protocol.mk | 4 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/main_arm_atsam.c | 56 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/md_rgb_matrix.c | 4 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/md_rgb_matrix.h | 2 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/usb/udi_device_conf.h | 10 | ||||
-rw-r--r-- | tmk_core/protocol/chibios.mk | 2 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/chibios.c (renamed from tmk_core/protocol/chibios/main.c) | 68 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/usb_main.c | 73 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/usb_util.c | 2 | ||||
-rw-r--r-- | tmk_core/protocol/lufa.mk | 1 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 131 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/usb_util.c | 2 | ||||
-rw-r--r-- | tmk_core/protocol/ps2_interrupt.c | 91 | ||||
-rw-r--r-- | tmk_core/protocol/ps2_io_chibios.c | 55 | ||||
-rw-r--r-- | tmk_core/protocol/ps2_mouse.c | 21 | ||||
-rw-r--r-- | tmk_core/protocol/usb_descriptor.c | 105 | ||||
-rw-r--r-- | tmk_core/protocol/usb_descriptor.h | 27 | ||||
-rw-r--r-- | tmk_core/protocol/usb_descriptor_common.h | 4 | ||||
-rw-r--r-- | tmk_core/protocol/usb_hid.mk | 12 | ||||
-rw-r--r-- | tmk_core/protocol/vusb.mk | 2 | ||||
-rw-r--r-- | tmk_core/protocol/vusb/protocol.c (renamed from tmk_core/protocol/vusb/main.c) | 89 | ||||
-rw-r--r-- | tmk_core/protocol/vusb/usb_util.c | 2 | ||||
-rw-r--r-- | tmk_core/protocol/vusb/vusb.c | 55 | ||||
-rw-r--r-- | tmk_core/rules.mk | 15 | ||||
-rw-r--r-- | util/bootloader_at90usb128_1.0.1.hex | 2 | ||||
-rw-r--r-- | util/bootloader_at90usb64_1.0.0.hex | 2 | ||||
-rwxr-xr-x | util/chibios_conf_updater.sh | 2 | ||||
-rwxr-xr-x | util/docker_build.sh | 2 | ||||
-rwxr-xr-x | util/generate_internal_docs.sh | 2 | ||||
-rwxr-xr-x | util/install/arch.sh | 2 | ||||
-rwxr-xr-x | util/install/debian.sh | 2 | ||||
-rwxr-xr-x | util/install/fedora.sh | 2 | ||||
-rwxr-xr-x | util/install/freebsd.sh | 2 | ||||
-rwxr-xr-x | util/install/gentoo.sh | 2 | ||||
-rwxr-xr-x | util/install/linux_shared.sh | 2 | ||||
-rwxr-xr-x | util/install/macos.sh | 4 | ||||
-rwxr-xr-x | util/install/msys2.sh | 2 | ||||
-rwxr-xr-x | util/install/slackware.sh | 2 | ||||
-rwxr-xr-x | util/install/solus.sh | 2 | ||||
-rwxr-xr-x | util/install/void.sh | 2 | ||||
-rwxr-xr-x | util/new_keyboard.sh | 14 | ||||
-rw-r--r-- | util/nix/poetry.lock (renamed from nix/poetry.lock) | 121 | ||||
-rw-r--r-- | util/nix/pyproject.toml (renamed from nix/pyproject.toml) | 32 | ||||
-rw-r--r-- | util/nix/sources.json (renamed from nix/sources.json) | 0 | ||||
-rw-r--r-- | util/nix/sources.nix (renamed from nix/sources.nix) | 0 | ||||
-rwxr-xr-x | util/qmk_install.sh | 4 | ||||
-rw-r--r-- | util/reset.eep (renamed from quantum/tools/eeprom_reset.hex) | 0 | ||||
-rwxr-xr-x | util/rules_cleaner.sh | 2 | ||||
-rwxr-xr-x | util/stm32eeprom_parser.py | 316 | ||||
-rwxr-xr-x | util/travis_utils.sh | 25 | ||||
-rw-r--r-- | util/udev/50-qmk.rules | 6 | ||||
-rwxr-xr-x | util/uf2conv.py | 8 | ||||
-rwxr-xr-x | util/update_chibios_mirror.sh | 92 | ||||
-rw-r--r-- | util/vagrant/Dockerfile | 2 | ||||
-rw-r--r-- | util/vagrant/readme.md | 2 |
832 files changed, 23066 insertions, 8078 deletions
diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index c8d988d0f0..a19667f97e 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -7,11 +7,12 @@ on: paths: - 'keyboards/**' - 'layouts/community/**' + workflow_dispatch: jobs: api_data: runs-on: ubuntu-latest - container: qmkfm/base_container + container: qmkfm/qmk_cli # protect against those who develop with their fork on master if: github.repository == 'qmk/qmk_firmware' diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index df727518e5..7a8dc8540f 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -16,7 +16,7 @@ jobs: test: runs-on: ubuntu-latest - container: qmkfm/base_container + container: qmkfm/qmk_cli steps: - uses: actions/checkout@v2 @@ -25,4 +25,4 @@ jobs: - name: Install dependencies run: pip3 install -r requirements-dev.txt - name: Run tests - run: bin/qmk pytest + run: qmk pytest diff --git a/.github/workflows/develop_api.yml b/.github/workflows/develop_api.yml index 4e64cbcf8c..f0098142c7 100644 --- a/.github/workflows/develop_api.yml +++ b/.github/workflows/develop_api.yml @@ -7,11 +7,12 @@ on: paths: - 'keyboards/**' - 'layouts/community/**' + workflow_dispatch: jobs: api_data: runs-on: ubuntu-latest - container: qmkfm/base_container + container: qmkfm/qmk_cli # protect against those who work in their fork on develop if: github.repository == 'qmk/qmk_firmware' diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8855d1107f..1ee3ae3964 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -14,7 +14,7 @@ on: jobs: generate: runs-on: ubuntu-latest - container: qmkfm/base_container + container: qmkfm/qmk_cli # protect against those who develop with their fork on master if: github.repository == 'qmk/qmk_firmware' diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index c17a04a542..0bb8701068 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -16,7 +16,7 @@ jobs: lint: runs-on: ubuntu-latest - container: qmkfm/base_container + container: qmkfm/qmk_cli steps: - uses: rlespinasse/github-slug-action@v3.x @@ -31,12 +31,12 @@ jobs: output: ' ' fileOutput: ' ' - - name: Run qmk cformat and qmk pyformat + - name: Run qmk format-c and qmk format-python shell: 'bash {0}' run: | - qmk cformat --core-only -n $(< ~/files.txt) - cformat_exit=$? - qmk pyformat -n - pyformat_exit=$? + qmk format-c --core-only -n $(< ~/files.txt) + format_c_exit=$? + qmk format-python -n + format_python_exit=$? - exit $((cformat_exit + pyformat_exit)) + exit $((format_c_exit + format_python_exit)) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index cd67de9d8b..c7a8624ee1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,7 +9,7 @@ jobs: lint: runs-on: ubuntu-latest - container: qmkfm/base_container + container: qmkfm/qmk_cli steps: - uses: actions/checkout@v2 diff --git a/.gitignore b/.gitignore index 06632a144a..e69e41ed96 100644 --- a/.gitignore +++ b/.gitignore @@ -1,77 +1,86 @@ -.history/ -.dep -*.o -*.bin -*.eep +# Junk files +*.bak +*.swp +*~ +.DS_Store + +# Build artifacts +.clang_complete +.build/ *.elf -*.hex -*.uf2 -*.qmk -!util/bootloader.hex -!quantum/tools/eeprom_reset.hex *.log *.lss *.lst *.map +*.o +*.stackdump *.sym -*.swp -tags -*~ + +# QMK-specific api_data/v1 -build/ -.build/ -*.bak -.vagrant/ -quantum/version.h -.idea/ -CMakeLists.txt -cmake-build-debug -.clang_complete doxygen/ -.DS_Store -/util/wsl_downloaded -/util/win_downloaded -/users/ -/layouts/ +quantum/version.h +*.bin +*.eep +*.hex +*.qmk +*.uf2 + +# Old-style QMK Makefiles /keyboards/*/Makefile !/keyboards/ergodox_ez/ !/keyboards/planck/ # Eclipse/PyCharm/Other IDE Settings +*.iml +.browse.VC.db* .cproject +.idea +.idea/ .project .settings/ -.idea -*.iml -.browse.VC.db* -*.stackdump +.vagrant/ + +# ? +.dep +.history/ +build/ +cmake-build-debug +CMakeLists.txt + # Let these ones be user specific, since we have so many different configurations *.code-workspace +.stfolder +.tags .vscode/c_cpp_properties.json +.vscode/ipch/ +.vscode/last.sql .vscode/launch.json .vscode/tasks.json -.vscode/last.sql .vscode/temp.sql -.vscode/ipch/ -.stfolder -.tags +tags -# ignore image files -*.png +# Ignore image files *.gif *.jpg +*.png -# things travis sees -secrets.tar -id_rsa_* +# Things Travis sees /.vs +id_rsa_* +secrets.tar -# python things +# Python things __pycache__ .python-version -# prerequisites for updating ChibiOS +# Prerequisites for updating ChibiOS /util/fmpp* # Allow to exist but don't include it in the repo user_song_list.h + +/util/wsl_downloaded +/util/win_downloaded +/users/ +/layouts/ diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index c9e3e0586a..0000000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,24 +0,0 @@ -# Code Of Conduct - -QMK strives to be an inclusive, tolerant, and welcoming community. We encourage participation from anyone regardless of age, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, political belief, race, religion, or sexual identity and orientation. - -> “A gentle word turns away wrath, but a harsh word stirs up anger." - -Our users, contributors, and collaborators are expected to treat each other with kindness and respect, to assume good intentions, and to gently correct, where possible, rather than react with escalation. While our goal is to be as accurate as possible, kindness and understanding are more valuable than correctness. Some examples of behavior we will not tolerate include, but is not limited to: - -* The use of sexualized language or imagery -* Unwelcome advances, sexual or otherwise -* Deliberate intimidation, stalking, or following -* Insults or derogatory comments, or personal or political attacks -* Publishing others’ private information without explicit permission -* Sustained disruption of talks or other events -* Other conduct which could reasonably be considered inappropriate in a professional setting -* Advocating for, or encouraging, any of the above behaviour - -# Reporting - -If someone is violating this Code of Conduct, please email hello@qmk.fm or reach out to one of the Collaborators to bring it to our attention. All complaints will be reviewed and investigated. - -QMK will seek to use the least punitive means available to resolve an issue. If the circumstances require asking an offender to leave, we will do that. - -Reports will be taken and kept in strict confidence. You will not be required to confront an offender directly. diff --git a/Dockerfile b/Dockerfile index 316b2196d3..e283c8f98a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ -FROM qmkfm/base_container +FROM qmkfm/qmk_cli VOLUME /qmk_firmware WORKDIR /qmk_firmware -COPY . . -CMD make all:all +CMD qmk compile -kb all -km default @@ -264,11 +264,20 @@ define PARSE_RULE else $$(info make: *** No rule to make target '$1'. Stop.) $$(info |) - $$(info | QMK's make format recently changed to use folder locations and colons:) - $$(info | make project_folder:keymap[:target]) - $$(info | Examples:) - $$(info | make planck/ez:default:flash) - $$(info | make planck/ez:default) + $$(info | QMK's make format is:) + $$(info | make keyboard_folder:keymap_folder[:target]) + $$(info |) + $$(info | Where `keyboard_folder` is the path to the keyboard relative to) + $$(info | `qmk_firmware/keyboards/`, and `keymap_folder` is the name of the) + $$(info | keymap folder under that board's `keymaps/` directory.) + $$(info |) + $$(info | Examples:) + $$(info | keyboards/dz60, keyboards/dz60/keymaps/default) + $$(info | -> make dz60:default) + $$(info | -> qmk compile -kb dz60 -km default) + $$(info | keyboards/planck/rev6, keyboards/planck/keymaps/default) + $$(info | -> make planck/rev6:default:flash) + $$(info | -> qmk flash -kb planck/rev6 -km default) $$(info |) endif endef @@ -306,37 +315,8 @@ define PARSE_KEYBOARD KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_3)/keymaps/*/.))) KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_4)/keymaps/*/.))) KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_5)/keymaps/*/.))) - # this might be needed, but in a different form - #KEYMAPS := $$(sort $$(filter-out $$(KEYBOARD_FOLDER_1) $$(KEYBOARD_FOLDER_2) \ - $$(KEYBOARD_FOLDER_3) $$(KEYBOARD_FOLDER_4) $$(KEYBOARD_FOLDER_5), $$(KEYMAPS))) - - KEYBOARD_LAYOUTS := - ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_5)/rules.mk)","") - LAYOUTS := - $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_5)/rules.mk) - KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS)) - endif - ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_4)/rules.mk)","") - LAYOUTS := - $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_4)/rules.mk) - KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS)) - endif - ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_3)/rules.mk)","") - LAYOUTS := - $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_3)/rules.mk) - KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS)) - endif - ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_2)/rules.mk)","") - LAYOUTS := - $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_2)/rules.mk) - KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS)) - endif - ifneq ("$$(wildcard $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_1)/rules.mk)","") - LAYOUTS := - $$(eval include $(ROOT_DIR)/keyboards/$$(KEYBOARD_FOLDER_PATH_1)/rules.mk) - KEYBOARD_LAYOUTS := $$(sort $$(LAYOUTS) $$(KEYBOARD_LAYOUTS)) - endif + KEYBOARD_LAYOUTS := $(shell $(QMK_BIN) list-layouts --keyboard $1) LAYOUT_KEYMAPS := $$(foreach LAYOUT,$$(KEYBOARD_LAYOUTS),$$(eval LAYOUT_KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/layouts/*/$$(LAYOUT)/*/.))))) @@ -560,29 +540,14 @@ git-submodule: git submodule sync --recursive git submodule update --init --recursive --progress -ifdef SKIP_VERSION -SKIP_GIT := yes -endif - # Generate the version.h file -ifndef SKIP_GIT - GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S") - CHIBIOS_VERSION := $(shell cd lib/chibios && git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S") - CHIBIOS_CONTRIB_VERSION := $(shell cd lib/chibios-contrib && git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S") -else - GIT_VERSION := NA - CHIBIOS_VERSION := NA - CHIBIOS_CONTRIB_VERSION := NA +ifdef SKIP_GIT +VERSION_H_FLAGS := --skip-git endif -ifndef SKIP_VERSION -BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S") -else -BUILD_DATE := 2020-01-01-00:00:00 +ifdef SKIP_VERSION +VERSION_H_FLAGS := --skip-all +SKIP_GIT := yes endif - -$(shell echo '#define QMK_VERSION "$(GIT_VERSION)"' > $(ROOT_DIR)/quantum/version.h) -$(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(ROOT_DIR)/quantum/version.h) -$(shell echo '#define CHIBIOS_VERSION "$(CHIBIOS_VERSION)"' >> $(ROOT_DIR)/quantum/version.h) -$(shell echo '#define CHIBIOS_CONTRIB_VERSION "$(CHIBIOS_CONTRIB_VERSION)"' >> $(ROOT_DIR)/quantum/version.h) +$(shell $(QMK_BIN) generate-version-h $(VERSION_H_FLAGS) -q -o quantum/version.h) include $(ROOT_DIR)/testlist.mk diff --git a/Vagrantfile b/Vagrantfile index a0137a599c..49ee4e8355 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -6,7 +6,7 @@ Vagrant.configure(2) do |config| config.vm.define "qmk_firmware" # VMware/Virtualbox ( and also Hyperv/Parallels) 64 bit - config.vm.box = "generic/debian9" + config.vm.box = "generic/debian10" config.vm.synced_folder '.', '/vagrant' @@ -68,13 +68,13 @@ Vagrant.configure(2) do |config| ["virtualbox", "vmware_workstation", "vmware_fusion"].each do |type| config.vm.provider type do |virt, override| override.vm.provision "docker" do |d| - d.run "qmkfm/base_container", + d.run "qmkfm/qmk_cli", cmd: "tail -f /dev/null", args: "--privileged -v /dev:/dev -v '/vagrant:/vagrant'" end override.vm.provision "shell", inline: <<-SHELL - echo 'docker restart qmkfm-base_container && exec docker exec -it qmkfm-base_container /bin/bash -l' >> ~vagrant/.bashrc + echo 'docker restart qmkfm-qmk_cli && exec docker exec -it qmkfm-qmk_cli /bin/bash -l' >> ~vagrant/.bashrc SHELL end end diff --git a/bootloader.mk b/bootloader.mk index 4f2d69d998..2bcca6bb81 100644 --- a/bootloader.mk +++ b/bootloader.mk @@ -21,18 +21,19 @@ # Current options: # # AVR: -# halfkay PJRC Teensy -# caterina Pro Micro (Sparkfun/generic) -# atmel-dfu Atmel factory DFU -# lufa-dfu LUFA DFU -# qmk-dfu QMK DFU (LUFA + blinkenlight) -# bootloadHID HIDBootFlash compatible (ATmega32A) -# USBasp USBaspLoader (ATmega328P) +# halfkay PJRC Teensy +# caterina Pro Micro (Sparkfun/generic) +# atmel-dfu Atmel factory DFU +# lufa-dfu LUFA DFU +# qmk-dfu QMK DFU (LUFA + blinkenlight) +# qmk-hid QMK HID (LUFA + blinkenlight) +# bootloadhid HIDBootFlash compatible (ATmega32A) +# usbasploader USBaspLoader (ATmega328P) # ARM: -# kiibohd Input:Club Kiibohd bootloader (only used on their boards) -# stm32duino STM32Duino (STM32F103x8) -# stm32-dfu STM32 USB DFU in ROM -# apm32-dfu APM32 USB DFU in ROM +# kiibohd Input:Club Kiibohd bootloader (only used on their boards) +# stm32duino STM32Duino (STM32F103x8) +# stm32-dfu STM32 USB DFU in ROM +# apm32-dfu APM32 USB DFU in ROM # # BOOTLOADER_SIZE can still be defined manually, but it's recommended # you add any possible configuration to this list @@ -67,6 +68,11 @@ ifeq ($(strip $(BOOTLOADER)), qmk-dfu) BOOTLOADER_SIZE = 8192 endif endif +ifeq ($(strip $(BOOTLOADER)), qmk-hid) + OPT_DEFS += -DBOOTLOADER_QMK_HID + OPT_DEFS += -DBOOTLOADER_HID + BOOTLOADER_SIZE = 4096 +endif ifeq ($(strip $(BOOTLOADER)), halfkay) OPT_DEFS += -DBOOTLOADER_HALFKAY ifeq ($(strip $(MCU)), atmega32u4) @@ -80,11 +86,11 @@ ifeq ($(strip $(BOOTLOADER)), caterina) OPT_DEFS += -DBOOTLOADER_CATERINA BOOTLOADER_SIZE = 4096 endif -ifeq ($(strip $(BOOTLOADER)), bootloadHID) +ifneq (,$(filter $(BOOTLOADER), bootloadhid bootloadHID)) OPT_DEFS += -DBOOTLOADER_BOOTLOADHID BOOTLOADER_SIZE = 4096 endif -ifeq ($(strip $(BOOTLOADER)), USBasp) +ifneq (,$(filter $(BOOTLOADER), usbasploader USBasp)) OPT_DEFS += -DBOOTLOADER_USBASP BOOTLOADER_SIZE = 4096 endif diff --git a/build_json.mk b/build_json.mk index 8822be6a12..0c034eb2ae 100644 --- a/build_json.mk +++ b/build_json.mk @@ -1,31 +1,17 @@ # Look for a json keymap file ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.json)","") - KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c KEYMAP_JSON := $(MAIN_KEYMAP_PATH_5)/keymap.json KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5) else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.json)","") - KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c KEYMAP_JSON := $(MAIN_KEYMAP_PATH_4)/keymap.json KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4) else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.json)","") - KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c KEYMAP_JSON := $(MAIN_KEYMAP_PATH_3)/keymap.json KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3) else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.json)","") - KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c KEYMAP_JSON := $(MAIN_KEYMAP_PATH_2)/keymap.json KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2) else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.json)","") - KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c KEYMAP_JSON := $(MAIN_KEYMAP_PATH_1)/keymap.json KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1) endif - -# Load the keymap-level rules.mk if exists -ifneq ("$(wildcard $(KEYMAP_PATH))", "") - -include $(KEYMAP_PATH)/rules.mk -endif - -# Generate the keymap.c -$(KEYBOARD_OUTPUT)/src/keymap.c: $(KEYMAP_JSON) - $(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON) diff --git a/build_keyboard.mk b/build_keyboard.mk index 91a6c23b71..37fa6852f8 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -23,6 +23,15 @@ KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD_FILESAFE) # Force expansion TARGET := $(TARGET) +ifneq ($(FORCE_LAYOUT),) + TARGET := $(TARGET)_$(FORCE_LAYOUT) +endif + +# Object files and generated keymap directory +# To put object files in current directory, use a dot (.), do NOT make +# this an empty or blank macro! +KEYMAP_OUTPUT := $(BUILD_DIR)/obj_$(TARGET) + # For split boards we need to set a master half. MASTER ?= left ifdef master @@ -100,7 +109,7 @@ MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP) MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP) # Pull in rules from info.json -INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/rules.mk) +INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_rules.mk) include $(INFO_RULES_MK) # Check for keymap.json first, so we can regenerate keymap.c @@ -137,16 +146,35 @@ ifeq ("$(wildcard $(KEYMAP_PATH))", "") endif endif +# Have we found a keymap.json? +ifneq ("$(wildcard $(KEYMAP_JSON))", "") + KEYMAP_C := $(KEYMAP_OUTPUT)/src/keymap.c + KEYMAP_H := $(KEYMAP_OUTPUT)/src/config.h + + # Load the keymap-level rules.mk if exists + -include $(KEYMAP_PATH)/rules.mk + + # Load any rules.mk content from keymap.json + INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --keymap $(KEYMAP) --output $(KEYMAP_OUTPUT)/src/rules.mk) + include $(INFO_RULES_MK) + +# Add rules to generate the keymap files - indentation here is important +$(KEYMAP_OUTPUT)/src/keymap.c: $(KEYMAP_JSON) + $(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON) + +$(KEYMAP_OUTPUT)/src/config.h: $(KEYMAP_JSON) + $(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --keymap $(KEYMAP) --output $(KEYMAP_H) + +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/QMK_PROTON_C/convert_to_proton_c.mk -endif - -ifneq ($(FORCE_LAYOUT),) - TARGET := $(TARGET)_$(FORCE_LAYOUT) + include platforms/chibios/boards/QMK_PROTON_C/convert_to_proton_c.mk endif include quantum/mcu_selection.mk @@ -232,6 +260,7 @@ ifdef MCU_FAMILY PLATFORM=CHIBIOS PLATFORM_KEY=chibios FIRMWARE_FORMAT?=bin + OPT_DEFS += -DMCU_$(MCU_FAMILY) else ifdef ARM_ATSAM PLATFORM=ARM_ATSAM PLATFORM_KEY=arm_atsam @@ -327,19 +356,19 @@ endif # Disable features that a keyboard doesn't support -include disable_features.mk -# Object files directory -# To put object files in current directory, use a dot (.), do NOT make -# this an empty or blank macro! -KEYMAP_OUTPUT := $(BUILD_DIR)/obj_$(TARGET) - ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","") CONFIG_H += $(KEYMAP_PATH)/config.h endif +ifneq ("$(KEYMAP_H)","") + CONFIG_H += $(KEYMAP_H) +endif # project specific files -SRC += $(KEYBOARD_SRC) \ +SRC += \ + $(KEYBOARD_SRC) \ $(KEYMAP_C) \ - $(QUANTUM_SRC) + $(QUANTUM_SRC) \ + $(QUANTUM_DIR)/main.c \ # Optimize size but this may cause error "relocation truncated to fit" #EXTRALDFLAGS = -Wl,--relax @@ -374,6 +403,7 @@ ifneq ($(strip $(PROTOCOL)),) else include $(TMK_PATH)/protocol/$(PLATFORM_KEY).mk endif +-include $(TOP_DIR)/platforms/$(PLATFORM_KEY)/flash.mk # TODO: remove this bodge? PROJECT_DEFS := $(OPT_DEFS) diff --git a/build_layout.mk b/build_layout.mk index 4748ad483d..b4b00793ea 100644 --- a/build_layout.mk +++ b/build_layout.mk @@ -7,7 +7,6 @@ define SEARCH_LAYOUTS_REPO LAYOUT_KEYMAP_C := $$(LAYOUT_KEYMAP_PATH)/keymap.c ifneq ("$$(wildcard $$(LAYOUT_KEYMAP_JSON))","") -include $$(LAYOUT_KEYMAP_PATH)/rules.mk - KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c KEYMAP_JSON := $$(LAYOUT_KEYMAP_JSON) KEYMAP_PATH := $$(LAYOUT_KEYMAP_PATH) else ifneq ("$$(wildcard $$(LAYOUT_KEYMAP_C))","") @@ -31,6 +30,3 @@ ifneq ($(FORCE_LAYOUT),) endif $(foreach LAYOUT,$(LAYOUTS),$(eval $(call SEARCH_LAYOUTS))) - -# Use rule from build_json.mk, but update prerequisite in case KEYMAP_JSON was updated -$(KEYBOARD_OUTPUT)/src/keymap.c: $(KEYMAP_JSON) diff --git a/build_test.mk b/build_test.mk index 77c4265f93..037577bf90 100644 --- a/build_test.mk +++ b/build_test.mk @@ -24,7 +24,6 @@ GTEST_INTERNAL_INC :=\ $(GTEST_OUTPUT)_SRC :=\ googletest/src/gtest-all.cc\ - googletest/src/gtest_main.cc\ googlemock/src/gmock-all.cc $(GTEST_OUTPUT)_DEFS := @@ -35,7 +34,8 @@ CREATE_MAP := no VPATH +=\ $(LIB_PATH)/googletest\ - $(LIB_PATH)/googlemock + $(LIB_PATH)/googlemock\ + $(LIB_PATH)/printf all: elf @@ -43,18 +43,29 @@ VPATH += $(COMMON_VPATH) PLATFORM:=TEST PLATFORM_KEY:=test +ifeq ($(strip $(DEBUG)), 1) +CONSOLE_ENABLE = yes +endif + ifneq ($(filter $(FULL_TESTS),$(TEST)),) include tests/$(TEST)/rules.mk endif include common_features.mk include $(TMK_PATH)/common.mk +include $(QUANTUM_PATH)/debounce/tests/rules.mk include $(QUANTUM_PATH)/sequencer/tests/rules.mk include $(QUANTUM_PATH)/serial_link/tests/rules.mk +include $(TMK_PATH)/common/test/rules.mk ifneq ($(filter $(FULL_TESTS),$(TEST)),) include build_full_test.mk endif +$(TEST)_SRC += \ + tests/test_common/main.c \ + $(LIB_PATH)/printf/printf.c \ + $(QUANTUM_PATH)/logging/print.c + $(TEST_OBJ)/$(TEST)_SRC := $($(TEST)_SRC) $(TEST_OBJ)/$(TEST)_INC := $($(TEST)_INC) $(VPATH) $(GTEST_INC) $(TEST_OBJ)/$(TEST)_DEFS := $($(TEST)_DEFS) @@ -12,6 +12,9 @@ QUANTUM_PATH = $(QUANTUM_DIR) DRIVER_DIR = drivers DRIVER_PATH = $(DRIVER_DIR) +PLATFORM_DIR = platforms +PLATFORM_PATH = $(PLATFORM_DIR) + BUILD_DIR := .build COMMON_VPATH := $(TOP_DIR) diff --git a/common_features.mk b/common_features.mk index 2789a3620c..926eef4c99 100644 --- a/common_features.mk +++ b/common_features.mk @@ -20,8 +20,23 @@ QUANTUM_SRC += \ $(QUANTUM_DIR)/send_string.c \ $(QUANTUM_DIR)/bitwise.c \ $(QUANTUM_DIR)/led.c \ + $(QUANTUM_DIR)/action.c \ + $(QUANTUM_DIR)/action_layer.c \ + $(QUANTUM_DIR)/action_macro.c \ + $(QUANTUM_DIR)/action_tapping.c \ + $(QUANTUM_DIR)/action_util.c \ + $(QUANTUM_DIR)/eeconfig.c \ + $(QUANTUM_DIR)/keyboard.c \ $(QUANTUM_DIR)/keymap_common.c \ - $(QUANTUM_DIR)/keycode_config.c + $(QUANTUM_DIR)/keycode_config.c \ + $(QUANTUM_DIR)/logging/debug.c \ + $(QUANTUM_DIR)/logging/sendchar.c \ + +VPATH += $(QUANTUM_DIR)/logging +# Fall back to lib/printf if there is no platform provided print +ifeq ("$(wildcard $(TMK_PATH)/common/$(PLATFORM_KEY)/printf.mk)","") + include $(QUANTUM_PATH)/logging/print.mk +endif ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), yes) OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE @@ -83,13 +98,13 @@ endif ifeq ($(strip $(MOUSEKEY_ENABLE)), yes) OPT_DEFS += -DMOUSEKEY_ENABLE - OPT_DEFS += -DMOUSE_ENABLE + MOUSE_ENABLE := yes SRC += $(QUANTUM_DIR)/mousekey.c endif ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes) OPT_DEFS += -DPOINTING_DEVICE_ENABLE - OPT_DEFS += -DMOUSE_ENABLE + MOUSE_ENABLE := yes SRC += $(QUANTUM_DIR)/pointing_device.c endif @@ -150,6 +165,7 @@ else else ifneq ($(filter $(MCU_SERIES),STM32L0xx STM32L1xx),) OPT_DEFS += -DEEPROM_DRIVER COMMON_VPATH += $(DRIVER_PATH)/eeprom + COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/eeprom SRC += eeprom_driver.c eeprom_stm32_L0_L1.c else # This will effectively work the same as "transient" if not supported by the chip @@ -176,10 +192,11 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) ifeq ($(filter $(RGBLIGHT_DRIVER),$(VALID_RGBLIGHT_TYPES)),) $(error RGBLIGHT_DRIVER="$(RGBLIGHT_DRIVER)" is not a valid RGB type) else - POST_CONFIG_H += $(QUANTUM_DIR)/rgblight_post_config.h + COMMON_VPATH += $(QUANTUM_DIR)/rgblight + POST_CONFIG_H += $(QUANTUM_DIR)/rgblight/rgblight_post_config.h OPT_DEFS += -DRGBLIGHT_ENABLE SRC += $(QUANTUM_DIR)/color.c - SRC += $(QUANTUM_DIR)/rgblight.c + SRC += $(QUANTUM_DIR)/rgblight/rgblight.c CIE1931_CURVE := yes RGB_KEYCODES_ENABLE := yes endif @@ -210,21 +227,25 @@ ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 at90usb162)) # ATmegaxxU2 does not have hardware MUL instruction - lib8tion must be told to use software multiplication routines OPT_DEFS += -DLIB8_ATTINY endif + COMMON_VPATH += $(QUANTUM_DIR)/led_matrix + COMMON_VPATH += $(QUANTUM_DIR)/led_matrix/animations + COMMON_VPATH += $(QUANTUM_DIR)/led_matrix/animations/runners SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c - SRC += $(QUANTUM_DIR)/led_matrix.c - SRC += $(QUANTUM_DIR)/led_matrix_drivers.c + SRC += $(QUANTUM_DIR)/led_matrix/led_matrix.c + SRC += $(QUANTUM_DIR)/led_matrix/led_matrix_drivers.c + SRC += $(LIB_PATH)/lib8tion/lib8tion.c CIE1931_CURVE := yes ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3731) OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE - COMMON_VPATH += $(DRIVER_PATH)/issi + COMMON_VPATH += $(DRIVER_PATH)/led/issi SRC += is31fl3731-simple.c QUANTUM_LIB_SRC += i2c_master.c endif endif RGB_MATRIX_ENABLE ?= no -VALID_RGB_MATRIX_TYPES := IS31FL3731 IS31FL3733 IS31FL3737 IS31FL3741 WS2812 custom +VALID_RGB_MATRIX_TYPES := AW20216 IS31FL3731 IS31FL3733 IS31FL3737 IS31FL3741 WS2812 custom ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) ifeq ($(filter $(RGB_MATRIX_DRIVER),$(VALID_RGB_MATRIX_TYPES)),) @@ -235,36 +256,47 @@ ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 at90usb162)) # ATmegaxxU2 does not have hardware MUL instruction - lib8tion must be told to use software multiplication routines OPT_DEFS += -DLIB8_ATTINY endif + COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix + COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations + COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations/runners SRC += $(QUANTUM_DIR)/color.c - SRC += $(QUANTUM_DIR)/rgb_matrix.c - SRC += $(QUANTUM_DIR)/rgb_matrix_drivers.c + SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix.c + SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix_drivers.c + SRC += $(LIB_PATH)/lib8tion/lib8tion.c CIE1931_CURVE := yes RGB_KEYCODES_ENABLE := yes + ifeq ($(strip $(RGB_MATRIX_DRIVER)), AW20216) + OPT_DEFS += -DAW20216 -DSTM32_SPI -DHAL_USE_SPI=TRUE + COMMON_VPATH += $(DRIVER_PATH)/led + SRC += aw20216.c + QUANTUM_LIB_SRC += spi_master.c + endif + ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3731) OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE - COMMON_VPATH += $(DRIVER_PATH)/issi + COMMON_VPATH += $(DRIVER_PATH)/led/issi SRC += is31fl3731.c QUANTUM_LIB_SRC += i2c_master.c endif ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3733) OPT_DEFS += -DIS31FL3733 -DSTM32_I2C -DHAL_USE_I2C=TRUE - COMMON_VPATH += $(DRIVER_PATH)/issi + COMMON_VPATH += $(DRIVER_PATH)/led/issi SRC += is31fl3733.c QUANTUM_LIB_SRC += i2c_master.c endif ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3737) OPT_DEFS += -DIS31FL3737 -DSTM32_I2C -DHAL_USE_I2C=TRUE - COMMON_VPATH += $(DRIVER_PATH)/issi + COMMON_VPATH += $(DRIVER_PATH)/led/issi SRC += is31fl3737.c QUANTUM_LIB_SRC += i2c_master.c endif ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3741) OPT_DEFS += -DIS31FL3741 -DSTM32_I2C -DHAL_USE_I2C=TRUE - COMMON_VPATH += $(DRIVER_PATH)/issi + COMMON_VPATH += $(DRIVER_PATH)/led/issi SRC += is31fl3741.c QUANTUM_LIB_SRC += i2c_master.c endif @@ -322,11 +354,6 @@ ifeq ($(strip $(LCD_ENABLE)), yes) CIE1931_CURVE := yes endif -# backward compat -ifeq ($(strip $(BACKLIGHT_CUSTOM_DRIVER)), yes) - BACKLIGHT_DRIVER := custom -endif - VALID_BACKLIGHT_TYPES := pwm timer software custom BACKLIGHT_ENABLE ?= no @@ -386,7 +413,7 @@ ifeq ($(strip $(WS2812_DRIVER_REQUIRED)), yes) endif ifeq ($(strip $(APA102_DRIVER_REQUIRED)), yes) - COMMON_VPATH += $(DRIVER_PATH)/apa102 + COMMON_VPATH += $(DRIVER_PATH)/led SRC += apa102.c endif @@ -448,18 +475,15 @@ ifeq ($(strip $(DIP_SWITCH_ENABLE)), yes) SRC += $(QUANTUM_DIR)/dip_switch.c endif -VALID_MAGIC_TYPES := yes full lite +VALID_MAGIC_TYPES := yes lite BOOTMAGIC_ENABLE ?= no ifneq ($(strip $(BOOTMAGIC_ENABLE)), no) ifeq ($(filter $(BOOTMAGIC_ENABLE),$(VALID_MAGIC_TYPES)),) $(error BOOTMAGIC_ENABLE="$(BOOTMAGIC_ENABLE)" is not a valid type of magic) endif - ifneq ($(strip $(BOOTMAGIC_ENABLE)), full) + ifneq ($(strip $(BOOTMAGIC_ENABLE)), no) OPT_DEFS += -DBOOTMAGIC_LITE QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/bootmagic_lite.c - else - OPT_DEFS += -DBOOTMAGIC_ENABLE - QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/bootmagic_full.c endif endif COMMON_VPATH += $(QUANTUM_DIR)/bootmagic @@ -480,42 +504,31 @@ ifneq ($(strip $(CUSTOM_MATRIX)), yes) # if 'lite' then skip the actual matrix implementation ifneq ($(strip $(CUSTOM_MATRIX)), lite) # Include the standard or split matrix code if needed - ifeq ($(strip $(SPLIT_KEYBOARD)), yes) - QUANTUM_SRC += $(QUANTUM_DIR)/split_common/matrix.c - else - QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c - endif + QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c endif endif -# Support for translating old names to new names: -ifeq ($(strip $(DEBOUNCE_TYPE)),sym_g) - DEBOUNCE_TYPE:=sym_defer_g -else ifeq ($(strip $(DEBOUNCE_TYPE)),eager_pk) - DEBOUNCE_TYPE:=sym_eager_pk -else ifeq ($(strip $(DEBOUNCE_TYPE)),sym_pk) - DEBOUNCE_TYPE:=sym_defer_pk -else ifeq ($(strip $(DEBOUNCE_TYPE)),eager_pr) - DEBOUNCE_TYPE:=sym_eager_pr -endif - -DEBOUNCE_DIR:= $(QUANTUM_DIR)/debounce # Debounce Modules. Set DEBOUNCE_TYPE=custom if including one manually. -DEBOUNCE_TYPE?= sym_defer_g +DEBOUNCE_TYPE ?= sym_defer_g ifneq ($(strip $(DEBOUNCE_TYPE)), custom) - QUANTUM_SRC += $(DEBOUNCE_DIR)/$(strip $(DEBOUNCE_TYPE)).c + QUANTUM_SRC += $(QUANTUM_DIR)/debounce/$(strip $(DEBOUNCE_TYPE)).c endif ifeq ($(strip $(SPLIT_KEYBOARD)), yes) POST_CONFIG_H += $(QUANTUM_DIR)/split_common/post_config.h OPT_DEFS += -DSPLIT_KEYBOARD + CRC_ENABLE := yes # Include files used by all split keyboards QUANTUM_SRC += $(QUANTUM_DIR)/split_common/split_util.c # Determine which (if any) transport files are required ifneq ($(strip $(SPLIT_TRANSPORT)), custom) - QUANTUM_LIB_SRC += $(QUANTUM_DIR)/split_common/transport.c + QUANTUM_SRC += $(QUANTUM_DIR)/split_common/transport.c \ + $(QUANTUM_DIR)/split_common/transactions.c + + OPT_DEFS += -DSPLIT_COMMON_TRANSACTIONS + # Functions added via QUANTUM_LIB_SRC are only included in the final binary if they're called. # Unused functions are pruned away, which is why we can add multiple drivers here without bloat. ifeq ($(PLATFORM),AVR) @@ -536,11 +549,17 @@ ifeq ($(strip $(SPLIT_KEYBOARD)), yes) COMMON_VPATH += $(QUANTUM_PATH)/split_common endif +ifeq ($(strip $(CRC_ENABLE)), yes) + OPT_DEFS += -DCRC_ENABLE + SRC += crc.c +endif + HAPTIC_ENABLE ?= no ifneq ($(strip $(HAPTIC_ENABLE)),no) COMMON_VPATH += $(DRIVER_PATH)/haptic - SRC += haptic.c OPT_DEFS += -DHAPTIC_ENABLE + SRC += $(QUANTUM_DIR)/haptic.c + SRC += $(QUANTUM_DIR)/process_keycode/process_haptic.c endif ifneq ($(filter DRV2605L, $(HAPTIC_ENABLE)), ) @@ -555,15 +574,33 @@ ifneq ($(filter SOLENOID, $(HAPTIC_ENABLE)), ) endif ifeq ($(strip $(HD44780_ENABLE)), yes) - SRC += drivers/avr/hd44780.c + SRC += platforms/avr/drivers/hd44780.c OPT_DEFS += -DHD44780_ENABLE endif -ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) - OPT_DEFS += -DOLED_DRIVER_ENABLE - COMMON_VPATH += $(DRIVER_PATH)/oled - QUANTUM_LIB_SRC += i2c_master.c - SRC += oled_driver.c +VALID_OLED_DRIVER_TYPES := SSD1306 custom +OLED_DRIVER ?= SSD1306 +ifeq ($(strip $(OLED_ENABLE)), yes) + ifeq ($(filter $(OLED_DRIVER),$(VALID_OLED_DRIVER_TYPES)),) + $(error OLED_DRIVER="$(OLED_DRIVER)" is not a valid OLED driver) + else + OPT_DEFS += -DOLED_ENABLE + COMMON_VPATH += $(DRIVER_PATH)/oled + + OPT_DEFS += -DOLED_DRIVER_$(strip $(shell echo $(OLED_DRIVER) | tr '[:lower:]' '[:upper:]')) + ifeq ($(strip $(OLED_DRIVER)), SSD1306) + SRC += ssd1306_sh1106.c + QUANTUM_LIB_SRC += i2c_master.c + endif + endif +endif + +ifeq ($(strip $(ST7565_ENABLE)), yes) + OPT_DEFS += -DST7565_ENABLE + COMMON_VPATH += $(DRIVER_PATH)/oled # For glcdfont.h + COMMON_VPATH += $(DRIVER_PATH)/lcd + QUANTUM_LIB_SRC += spi_master.c + SRC += st7565.c endif include $(DRIVER_PATH)/qwiic/qwiic.mk @@ -618,6 +655,11 @@ ifeq ($(strip $(COMBO_ENABLE)), yes) OPT_DEFS += -DCOMBO_ENABLE endif +ifeq ($(strip $(KEY_OVERRIDE_ENABLE)), yes) + SRC += $(QUANTUM_DIR)/process_keycode/process_key_override.c + OPT_DEFS += -DKEY_OVERRIDE_ENABLE +endif + ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c OPT_DEFS += -DTAP_DANCE_ENABLE @@ -642,19 +684,28 @@ ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes) endif JOYSTICK_ENABLE ?= no -ifneq ($(strip $(JOYSTICK_ENABLE)), no) +VALID_JOYSTICK_TYPES := analog digital +JOYSTICK_DRIVER ?= analog +ifeq ($(strip $(JOYSTICK_ENABLE)), yes) + ifeq ($(filter $(JOYSTICK_DRIVER),$(VALID_JOYSTICK_TYPES)),) + $(error "$(JOYSTICK_DRIVER)" is not a valid joystick driver) + endif OPT_DEFS += -DJOYSTICK_ENABLE SRC += $(QUANTUM_DIR)/process_keycode/process_joystick.c SRC += $(QUANTUM_DIR)/joystick.c -endif -ifeq ($(strip $(JOYSTICK_ENABLE)), analog) - OPT_DEFS += -DANALOG_JOYSTICK_ENABLE - SRC += analog.c + ifeq ($(strip $(JOYSTICK_DRIVER)), analog) + OPT_DEFS += -DANALOG_JOYSTICK_ENABLE + SRC += analog.c + endif + ifeq ($(strip $(JOYSTICK_DRIVER)), digital) + OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE + endif endif -ifeq ($(strip $(JOYSTICK_ENABLE)), digital) - OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE +DIGITIZER_ENABLE ?= no +ifneq ($(strip $(DIGITIZER_ENABLE)), no) + SRC += $(QUANTUM_DIR)/digitizer.c endif USBPD_ENABLE ?= no diff --git a/data/mappings/info_config.json b/data/mappings/info_config.json index b949b13320..72bb0f4a1c 100644 --- a/data/mappings/info_config.json +++ b/data/mappings/info_config.json @@ -1,21 +1,48 @@ -# This file maps keys between `config.h` and `info.json`. It is used by QMK +# This file maps keys between `config.h` and `info.json`. It is used by QMK # to correctly and consistently map back and forth between the two systems. { # 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", "int", "hex", "list", "mapping" + # value_type: one of "array", "array.int", "bool", "int", "hex", "list", "mapping" # 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 - "DEBOUNCE": {"info_key": "debounce", "value_type": "int"} + "AUDIO_VOICES": {"info_key": "audio.voices", "value_type": "bool"}, + "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"}, + "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"}, "DESCRIPTION": {"info_key": "keyboard_folder", "to_json": false}, "DIODE_DIRECTION": {"info_key": "diode_direction"}, + "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"}, + "IGNORE_MOD_TAP_INTERRUPT": {"info_key": "tapping.ignore_mod_tap_interrupt", "value_type": "bool"}, + "IGNORE_MOD_TAP_INTERRUPT_PER_KEY": {"info_key": "tapping.ignore_mod_tap_interrupt_per_key", "value_type": "bool"}, "LAYOUTS": {"info_key": "layout_aliases", "value_type": "mapping"}, + "LEADER_PER_KEY_TIMING": {"info_key": "leader_key.timing", "value_type": "bool"}, + "LEADER_KEY_STRICT_KEY_PROCESSING": {"info_key": "leader_key.strict_processing", "value_type": "bool"}, + "LEADER_TIMEOUT": {"info_key": "leader_key.timeout", "value_type": "int"}, "LED_CAPS_LOCK_PIN": {"info_key": "indicators.caps_lock"}, "LED_NUM_LOCK_PIN": {"info_key": "indicators.num_lock"}, "LED_SCROLL_LOCK_PIN": {"info_key": "indicators.scroll_lock"}, "MANUFACTURER": {"info_key": "manufacturer"}, + "MATRIX_HAS_GHOST": {"info_key": "matrix_pins.ghost", "value_type": "bool"}, + "MATRIX_IO_DELAY": {"info_key": "matrix_pins.io_delay", "value_type": "int"}, + "MOUSEKEY_DELAY": {"info_key": "mousekey.delay", "value_type": "int"}, + "MOUSEKEY_INTERVAL": {"info_key": "mousekey.interval", "value_type": "int"}, + "MOUSEKEY_MAX_SPEED": {"info_key": "mousekey.max_speed", "value_type": "int"}, + "MOUSEKEY_TIME_TO_MAX": {"info_key": "mousekey.time_to_max", "value_type": "int"}, + "MOUSEKEY_WHEEL_DELAY": {"info_key": "mousekey.wheel_delay", "value_type": "int"}, + "ONESHOT_TIMEOUT": {"info_key": "oneshot.timeout", "value_type": "int"}, + "ONESHOT_TAP_TOGGLE": {"info_key": "oneshot.tap_toggle", "value_type": "int"}, + "PERMISSIVE_HOLD": {"info_key": "tapping.permissive_hold", "value_type": "bool"}, + "PERMISSIVE_HOLD_PER_KEY": {"info_key": "tapping.permissive_hold_per_key", "value_type": "bool"}, + "RETRO_TAPPING": {"info_key": "tapping.retro", "value_type": "bool"}, + "RETRO_TAPPING_PER_KEY": {"info_key": "tapping.retro_per_key", "value_type": "bool"}, "RGB_DI_PIN": {"info_key": "rgblight.pin"}, "RGBLED_NUM": {"info_key": "rgblight.led_count", "value_type": "int"}, "RGBLED_SPLIT": {"info_key": "rgblight.split_count", "value_type": "array.int"}, @@ -30,17 +57,40 @@ "RGBLIGHT_EFFECT_SNAKE": {"info_key": "rgblight.animations.snake", "value_type": "bool"}, "RGBLIGHT_EFFECT_STATIC_GRADIENT": {"info_key": "rgblight.animations.static_gradient", "value_type": "bool"}, "RGBLIGHT_EFFECT_TWINKLE": {"info_key": "rgblight.animations.twinkle"}, + "RGBLIGHT_LAYER_BLINK": {"info_key": "rgblight.layers.blink", "value_type": "bool"}, + "RGBLIGHT_LAYERS": {"info_key": "rgblight.layers.enabled", "value_type": "bool"}, + "RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF": {"info_key": "rgblight.layers.override_rgb", "value_type": "bool"}, "RGBLIGHT_LIMIT_VAL": {"info_key": "rgblight.max_brightness", "value_type": "int"}, + "RGBLIGHT_MAX_LAYERS": {"info_key": "rgblight.layers.max", "value_type": "int"}, "RGBLIGHT_HUE_STEP": {"info_key": "rgblight.hue_steps", "value_type": "int"}, "RGBLIGHT_SAT_STEP": {"info_key": "rgblight.saturation_steps", "value_type": "int"}, "RGBLIGHT_VAL_STEP": {"info_key": "rgblight.brightness_steps", "value_type": "int"}, "RGBLIGHT_SLEEP": {"info_key": "rgblight.sleep", "value_type": "bool"}, "RGBLIGHT_SPLIT": {"info_key": "rgblight.split", "value_type": "bool"}, + "RGBW": {"info_key": "rgblight.rgbw", "value_type": "bool"}, "PRODUCT": {"info_key": "keyboard_folder", "to_json": false}, "PRODUCT_ID": {"info_key": "usb.pid", "value_type": "hex"}, "VENDOR_ID": {"info_key": "usb.vid", "value_type": "hex"}, "QMK_ESC_OUTPUT": {"info_key": "qmk_lufa_bootloader.esc_output"}, "QMK_ESC_INPUT": {"info_key": "qmk_lufa_bootloader.esc_input"}, + "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"} + "QMK_SPEAKER": {"info_key": "qmk_lufa_bootloader.speaker"}, + "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"}, + "SPLIT_USB_DETECT": {"info_key": "split.usb_detect.enabled", "value_type": "bool"}, + "SPLIT_USB_TIMEOUT": {"info_key": "split.usb_detect.timeout", "value_type": "int"}, + "SPLIT_USB_TIMEOUT_POLL": {"info_key": "split.usb_detect.polling_interval", "value_type": "int"}, + "SOFT_SERIAL_PIN": {"info_key": "split.soft_serial_pin"}, + "SOFT_SERIAL_SPEED": {"info_key": "split.soft_serial_speed"}, + "TAP_CODE_DELAY": {"info_key": "qmk.tap_keycode_delay", "value_type": "int"}, + "TAP_HOLD_CAPS_DELAY": {"info_key": "qmk.tap_capslock_delay", "value_type": "int"}, + "TAPPING_FORCE_HOLD": {"info_key": "tapping.force_hold", "value_type": "bool"}, + "TAPPING_FORCE_HOLD_PER_KEY": {"info_key": "tapping.force_hold_per_key", "value_type": "bool"}, + "TAPPING_TERM": {"info_key": "tapping.term", "value_type": "int"}, + "TAPPING_TERM_PER_KEY": {"info_key": "tapping.term_per_key", "value_type": "bool"}, + "TAPPING_TOGGLE": {"info_key": "tapping.toggle", "value_type": "int"}, + "USB_MAX_POWER_CONSUMPTION": {"info_key": "usb.max_power", "value_type": "int"}, + "USB_POLLING_INTERVAL_MS": {"info_key": "usb.polling_interval", "value_type": "int"}, + "USB_SUSPEND_WAKEUP_DELAY": {"info_key": "usb.suspend_wakeup_delay", "value_type": "int"}, } diff --git a/data/mappings/info_rules.json b/data/mappings/info_rules.json index 97f772c4d5..aea67e04c8 100644 --- a/data/mappings/info_rules.json +++ b/data/mappings/info_rules.json @@ -1,15 +1,25 @@ -# This file maps keys between `rules.mk` and `info.json`. It is used by QMK +# This file maps keys between `rules.mk` and `info.json`. It is used by QMK # to correctly and consistently map back and forth between the two systems. { # 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", "int", "list", "hex", "mapping" + # value_type: one of "array", "array.int", "bool", "int", "list", "hex", "mapping" # 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"}, + "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"}, "LAYOUTS": {"info_key": "community_layouts", "value_type": "list"}, "LED_MATRIX_DRIVER": {"info_key": "led_matrix.driver"}, + "LTO_ENABLE": {"info_key": "build.lto", "value_type": "bool"}, "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"}, + "SPLIT_KEYBOARD": {"info_key": "split.enabled", "value_type": "bool"}, + "SPLIT_TRANSPORT": {"info_key": "split.transport.protocol", "value_type": "str", "to_c": false}, + "WAIT_FOR_USB": {"info_key": "usb.wait_for", "value_type": "bool"} } diff --git a/data/mappings/keyboard_aliases.json b/data/mappings/keyboard_aliases.json index c205b5e13e..60c91b1bfc 100644 --- a/data/mappings/keyboard_aliases.json +++ b/data/mappings/keyboard_aliases.json @@ -11,6 +11,9 @@ '2_milk': { target: 'spaceman/2_milk' }, + 'aeboards/constellation': { + target: 'aeboards/constellation/rev1' + }, 'aeboards/ext65': { target: 'aeboards/ext65/rev1' }, @@ -38,9 +41,36 @@ 'atom47/rev3': { target: 'maartenwut/atom47/rev3' }, + bakeneko65: { + target: 'bakeneko65/rev2' + }, bear_face: { target: 'bear_face/v1' }, + bm16a: { + target: 'kprepublic/bm16a' + }, + bm16s: { + target: 'kprepublic/bm16s' + }, + bm40hsrgb: { + target: 'kprepublic/bm40hsrgb' + }, + bm43a: { + target: 'kprepublic/bm43a' + }, + bm60poker: { + target: 'kprepublic/bm60poker' + }, + bm60rgb: { + target: 'kprepublic/bm60rgb' + }, + bm60rgb_iso: { + target: 'kprepublic/bm60rgb_iso' + }, + bm68rgb: { + target: 'kprepublic/bm68rgb' + }, 'bpiphany/pegasushoof': { target: 'bpiphany/pegasushoof/2013' }, @@ -56,15 +86,27 @@ canoe: { target: 'percent/canoe' }, + 'clawsome/gamebuddy': { + target: 'clawsome/gamebuddy/v1_0' + }, 'cmm_studio/saka68': { target: 'cmm_studio/saka68/solder' }, + 'cospad': { + target: 'kprepublic/cospad' + }, 'crkbd/rev1/legacy': { target: 'crkbd/rev1' }, 'crkbd/rev1/common': { target: 'crkbd/rev1' }, + 'custommk/genesis': { + target: 'custommk/genesis/rev1' + }, + 'daisy': { + target: 'ktec/daisy' + }, 'doro67/multi': { layouts: { LAYOUT_ansi: 'LAYOUT_65_ansi_blocker' @@ -83,6 +125,9 @@ drakon: { target: 'jagdpietr/drakon' }, + 'durgod/k320': { + target: 'durgod/k3x0/k320' + }, 'dztech/dz60rgb': { target: 'dztech/dz60rgb/v1' }, @@ -95,9 +140,15 @@ 'dztech/dz65rgb': { target: 'dztech/dz65rgb/v1' }, + 'dztech/volcano660': { + target: 'ilumkb/volcano660' + }, eek: { target: 'eek/silk_down' }, + 'ergodone': { + target: 'ktec/ergodone' + }, ergoinu: { target: 'dm9records/ergoinu' }, @@ -107,9 +158,15 @@ gh60: { target: 'gh60/revc' }, + 'gmmk/pro': { + target: 'gmmk/pro/ansi' + }, 'handwired/ferris': { target: 'ferris/0_1' }, + 'handwired/p1800fl': { + target: 'team0110/p1800fl' + }, 'helix/pico/sc/back': { target: 'helix/pico/sc' }, @@ -158,6 +215,15 @@ LAYOUT: 'LAYOUT_all' } }, + 'jj40': { + target: 'kprepublic/jj40' + }, + 'jj4x4': { + target: 'kprepublic/jj4x4' + }, + 'jj50': { + target: 'kprepublic/jj50' + }, jones: { target: 'jones/v03_1' }, @@ -182,6 +248,12 @@ kudox: { target: 'kudox/rev1' }, + 'kyria': { + target: 'splitkb/kyria' + }, + 'lazydesigners/the60': { + target: 'lazydesigners/the60/rev1' + }, 'lfkeyboards/lfk78': { target: 'lfkeyboards/lfk78/revj' }, @@ -251,6 +323,9 @@ 'maartenwut/wonderland': { target: 'evyd13/wonderland' }, + 'matrix/m12og': { + target: 'matrix/m12og/rev1' + }, 'mechlovin/hannah910': { target: 'mechlovin/hannah910/rev1' }, @@ -266,6 +341,9 @@ 'mechlovin/hannah60rgb': { target: 'mechlovin/hannah60rgb/rev1' }, + 'mechlovin/hannah65/mechlovin9': { + target: 'mechlovin/mechlovin9/rev1' + }, 'melgeek/z70ultra': { target: 'melgeek/z70ultra/rev1' }, @@ -304,6 +382,9 @@ 'pancake/promicro': { target: 'spaceman/pancake/promicro' }, + 'peiorisboards/ixora': { + target: 'coarse/ixora' + }, 'percent/canoe': { layouts: { LAYOUT_iso: 'LAYOUT_65_iso_blocker' @@ -366,6 +447,9 @@ 'ramonimbao/herringbone': { target: 'ramonimbao/herringbone/v1' }, + 'ramonimbao/mona': { + target: 'ramonimbao/mona/v1' + }, 'rgbkb/pan': { target: 'rgbkb/pan/rev1/32a' }, @@ -387,6 +471,9 @@ speedo: { target: 'cozykeys/speedo/v2' }, + 'staryu': { + target: 'ktec/staryu' + }, stoutgat: { target: 'tkw/stoutgat/v1' }, @@ -405,10 +492,14 @@ 'tkw/stoutgat/v2': { target: 'tkw/stoutgat/v2/f411' }, + 'tokyo60': { + target: 'tokyokeyboard/tokyo60' + }, underscore33: { target: 'underscore33/rev1' }, vinta: { + target: 'coarse/vinta', layouts: { LAYOUT_67_ansi: 'LAYOUT_65_ansi_blocker' } @@ -422,6 +513,33 @@ 'whale/sk': { target: 'whale/sk/v3' }, + 'xd002': { + target: 'xiudi/xd002' + }, + 'xd004': { + target: 'xiudi/xd004' + }, + 'xd60': { + target: 'xiudi/xd60' + }, + 'xd68': { + target: 'xiudi/xd68' + }, + 'xd75': { + target: 'xiudi/xd75' + }, + 'xd84': { + target: 'xiudi/xd84' + }, + 'xd84pro': { + target: 'xiudi/xd84pro' + }, + 'xd87': { + target: 'xiudi/xd87' + }, + 'xd96': { + target: 'xiudi/xd96' + }, 'xelus/dawn60': { target: 'xelus/dawn60/rev1' }, diff --git a/data/schemas/api_keyboard.jsonschema b/data/schemas/api_keyboard.jsonschema index d570ee9990..d638658a1d 100644 --- a/data/schemas/api_keyboard.jsonschema +++ b/data/schemas/api_keyboard.jsonschema @@ -1,34 +1,22 @@ { + "$id": "qmk.api.keyboard.v1", "allOf": [ - { "$ref": "qmk.keyboard.v1" }, + {"$ref": "qmk.keyboard.v1"}, { - "$id": "qmk.api.keyboard.v1", - "keymaps": { - "type": "string" - }, - "parse_errors": { - "type": "array", - "items": { - "type": "string" - } - }, - "parse_warnings": { - "type": "array", - "items": { - "type": "string" - } - }, - "processor_type": { - "type": "string" - }, - "protocol": { - "type": "string" - }, - "keyboard_folder": { - "type": "string" - }, - "platform": { - "type": "string" + "properties": { + "keymaps": { + "type": "object", + "properties": { + "url": {"type": "string"} + } + + }, + "parse_errors": {"$ref": "qmk.definitions.v1#/string_array"}, + "parse_warnings": {"$ref": "qmk.definitions.v1#/string_array"}, + "processor_type": {"type": "string"}, + "protocol": {"type": "string"}, + "keyboard_folder": {"type": "string"}, + "platform": {"type": "string"} } } ] diff --git a/data/schemas/definitions.jsonschema b/data/schemas/definitions.jsonschema new file mode 100644 index 0000000000..822f237073 --- /dev/null +++ b/data/schemas/definitions.jsonschema @@ -0,0 +1,107 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "qmk.definitions.v1", + "title": "Common definitions used across QMK's jsonschemas.", + "type": "object", + "boolean_array": { + "type": "object", + "additionalProperties": {"type": "boolean"} + }, + "filename": { + "type": "string", + "minLength": 1, + "pattern": "^[0-9a-z_]*$" + }, + "hex_number_2d": { + "type": "string", + "pattern": "^0x[0-9A-F]{2}$" + }, + "hex_number_4d": { + "type": "string", + "pattern": "^0x[0-9A-F]{4}$" + }, + "text_identifier": { + "type": "string", + "minLength": 1, + "maxLength": 250 + }, + "layout_macro": { + "oneOf": [ + { + "type": "string", + "enum": ["LAYOUT", "LAYOUT_planck_1x2uC"] + }, + { + "type": "string", + "pattern": "^LAYOUT_[0-9a-z_]*$" + } + ] + }, + "key_unit": { + "type": "number", + "min": 0.25 + }, + "mcu_pin_array": { + "type": "array", + "items": {"$ref": "#/mcu_pin"} + }, + "mcu_pin": { + "oneOf": [ + { + "type": "string", + "pattern": "^[A-K]\\d{1,2}$" + }, + { + "type": "string", + "pattern": "^LINE_PIN\\d{1,2}$" + }, + { + "type": "number", + "multipleOf": 1 + }, + { + "type": "null" + } + ] + }, + "signed_decimal": { + "type": "number" + }, + "signed_int": { + "type": "number", + "multipleOf": 1 + } + "signed_int_8": { + "type": "number", + "min": -127, + "max": 127, + "multipleOf": 1 + } + "string_array": { + "type": "array", + "items": { + "type": "string" + } + }, + "string_object": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "unsigned_decimal": { + "type": "number", + "min": 0 + }, + "unsigned_int": { + "type": "number", + "min": 0, + "multipleOf": 1 + } + "unsigned_int_8": { + "type": "number", + "min": 0, + "max": 255, + "multipleOf": 1 + } +} diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index c335f49d52..15f407fce4 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -1,31 +1,53 @@ { - "$schema": "http://json-schema.org/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "$id": "qmk.keyboard.v1", "title": "Keyboard Information", "type": "object", "properties": { - "keyboard_name": { - "type": "string", - "minLength": 2, - "maxLength": 250 - }, - "maintainer": { - "type": "string", - "minLength": 2, - "maxLength": 250 - }, - "manufacturer": { - "type": "string", - "minLength": 2, - "maxLength": 250 - }, + "keyboard_name": {"$ref": "qmk.definitions.v1#/text_identifier"}, + "maintainer": {"$ref": "qmk.definitions.v1#/text_identifier"}, + "manufacturer": {"$ref": "qmk.definitions.v1#/text_identifier"}, "url": { "type": "string", "format": "uri" }, "processor": { "type": "string", - "enum": ["cortex-m0", "cortex-m0plus", "cortex-m3", "cortex-m4", "MKL26Z64", "MK20DX128", "MK20DX256", "MK66F18", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F411", "STM32F446", "STM32G431", "STM32G474", "STM32L433", "STM32L443", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"] + "enum": ["cortex-m0", "cortex-m0plus", "cortex-m3", "cortex-m4", "MKL26Z64", "MK20DX128", "MK20DX256", "MK66F18", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F407", "STM32F411", "STM32F446", "STM32G431", "STM32G474", "STM32L412", "STM32L422", "STM32L433", "STM32L443", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"] + }, + "audio": { + "type": "object", + "additionalProperties": false, + "properties": { + "pins": {"$ref": "qmk.definitions.v1#/mcu_pin_array"}, + "voices": {"type": "boolean"} + } + }, + "backlight": { + "type": "object", + "additionalProperties": false, + "properties": { + "breathing": {"type": "boolean"}, + "breathing_period": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}, + "levels": { + "type": "number", + "min": 1, + "max": 31, + "multipleOf": 1 + }, + "pin": {"$ref": "qmk.definitions.v1#/mcu_pin"} + } + }, + "bluetooth": { + "type": "object", + "additionalProperties": false, + "properties": { + "driver": { + "type": "string", + "enum": ["AdafruitBLE", "RN42"] + }, + "lto": {"type": "boolean"}, + } }, "board": { "type": "string", @@ -34,68 +56,55 @@ }, "bootloader": { "type": "string", - "enum": ["atmel-dfu", "bootloadHID", "caterina", "halfkay", "kiibohd", "lufa-dfu", "lufa-ms", "micronucleus", "qmk-dfu", "stm32-dfu", "stm32duino", "unknown", "USBasp", "tinyuf2"] + "enum": ["atmel-dfu", "bootloadhid", "bootloadHID", "caterina", "halfkay", "kiibohd", "lufa-dfu", "lufa-ms", "micronucleus", "qmk-dfu", "qmk-hid", "stm32-dfu", "stm32duino", "unknown", "usbasploader", "USBasp", "tinyuf2"], }, - "diode_direction": { + "bootloader_instructions": { "type": "string", - "enum": ["COL2ROW", "ROW2COL"] + "description": "Instructions for putting the keyboard into a mode that allows for firmware flashing." }, - "debounce": { - "type": "number", - "min": 0, - "multipleOf": 1 + "build": { + "type": "object", + "additionalProperties": false, + "properties": { + "debounce_type": { + "type": "string", + "enum": ["custom", "eager_pk", "eager_pr", "sym_defer_pk", "sym_eager_pk"] + }, + "firmware_format": { + "type": "string", + "enum": ["bin", "hex", "uf2"] + }, + "lto": {"type": "boolean"}, + } }, - "height": { - "type": "number", - "min": 0.25 + "diode_direction": { + "type": "string", + "enum": ["COL2ROW", "ROW2COL"] }, - "width": { - "type": "number", - "min": 0.25 + "debounce": {"$ref": "qmk.definitions.v1#/unsigned_int"}, + "combo": { + "type": "object", + "properties": { + "count": {"$ref": "qmk.definitions.v1#/unsigned_int"}, + "term": {"$ref": "qmk.definitions.v1#/unsigned_int"} + } }, "community_layouts": { "type": "array", - "items": { - "type": "string", - "minLength": 2, - "pattern": "^[0-9a-z_]*$" - } - }, - "features": { - "type": "object", - "additionalProperties": {"type": "boolean"} + "items": {"$ref": "qmk.definitions.v1#/filename"} }, + "features": {"$ref": "qmk.definitions.v1#/boolean_array"}, "indicators": { "type": "object", "properties": { - "caps_lock": { - "type": "string", - "pattern": "^[A-K]\\d{1,2}$" - }, - "num_lock": { - "type": "string", - "pattern": "^[A-K]\\d{1,2}$" - }, - "scroll_lock": { - "type": "string", - "pattern": "^[A-K]\\d{1,2}$" - } + "caps_lock": {"$ref": "qmk.definitions.v1#/mcu_pin"}, + "num_lock": {"$ref": "qmk.definitions.v1#/mcu_pin"}, + "scroll_lock": {"$ref": "qmk.definitions.v1#/mcu_pin"} } }, "layout_aliases": { "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "string", - "enum": ["LAYOUT", "LAYOUT_planck_1x2uC"] - }, - { - "type": "string", - "pattern": "^LAYOUT_[0-9a-z_]*$" - } - ] - } + "additionalProperties": {"$ref": "qmk.definitions.v1#/layout_macro"} }, "layouts": { "type": "object", @@ -109,11 +118,6 @@ "c_macro": { "type": "boolean" }, - "key_count": { - "type": "number", - "min": 0, - "multipleOf": 1 - }, "layout": { "type": "array", "items": { @@ -131,101 +135,60 @@ "multipleOf": 1 } }, - "h": { - "type": "number", - "min": 0.25 - }, - "r": { - "type": "number", - "min": 0 - }, - "rx": { - "type": "number", - "min": 0 - }, - "ry": { - "type": "number", - "min": 0 - }, - "w": { - "type": "number", - "min": 0.25 - }, - "x": { - "type": "number", - "min": 0 - }, - "y": { - "type": "number", - "min": 0 - } + "r": {"$ref": "qmk.definitions.v1#/unsigned_decimal"}, + "rx": {"$ref": "qmk.definitions.v1#/unsigned_decimal"}, + "ry": {"$ref": "qmk.definitions.v1#/unsigned_decimal"}, + "h": {"$ref": "qmk.definitions.v1#/key_unit"}, + "w": {"$ref": "qmk.definitions.v1#/key_unit"}, + "x": {"$ref": "qmk.definitions.v1#/key_unit"}, + "y": {"$ref": "qmk.definitions.v1#/key_unit"} } } } } } }, + "leader_key": { + "type": "object", + "properties": { + "timing": {"type": "boolean"}, + "strict_processing": {"type": "boolean"}, + "timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"} + } + }, "matrix_pins": { "type": "object", "additionalProperties": false, "properties": { + "custom": {"type": "boolean"}, + "custom_lite": {"type": "boolean"}, + "ghost": {"type": "boolean"}, + "io_delay": {"$ref": "qmk.definitions.v1#/unsigned_int"}, "direct": { "type": "array", - "items": { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string", - "pattern": "^[A-K]\\d{1,2}$" - }, - { - "type": "number", - "multipleOf": 1 - }, - { - "type": "null" - } - ] - } - } - }, - "cols": { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string", - "pattern": "^[A-K]\\d{1,2}$" - }, - { - "type": "number", - "multipleOf": 1 - }, - { - "type": "null" - } - ] - } + "items": {"$ref": "qmk.definitions.v1#/mcu_pin_array"} }, - "rows": { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string", - "pattern": "^[A-K]\\d{1,2}$" - }, - { - "type": "number", - "multipleOf": 1 - }, - { - "type": "null" - } - ] - } - } + "cols": {"$ref": "qmk.definitions.v1#/mcu_pin_array"}, + "rows": {"$ref": "qmk.definitions.v1#/mcu_pin_array"}, + "unused": {"$ref": "qmk.definitions.v1#/mcu_pin_array"} + } + }, + "mouse_key": { + "type": "object", + "properties": { + "enabled": {"type": "boolean"}, + "delay": {"$ref": "qmk.definitions.v1#/unsigned_int_8"} + "interval": {"$ref": "qmk.definitions.v1#/unsigned_int_8"} + "max_speed": {"$ref": "qmk.definitions.v1#/unsigned_int_8"} + "time_to_max": {"$ref": "qmk.definitions.v1#/unsigned_int_8"} + "wheel_delay": {"$ref": "qmk.definitions.v1#/unsigned_int_8"} + } + }, + "oneshot": { + "type": "object", + "properties": { + "tap_toggle": {"$ref": "qmk.definitions.v1#/unsigned_int"}, + "timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"} } }, "rgblight": { @@ -238,88 +201,160 @@ "type": "boolean" } }, - "brightness_steps": { - "type": "number", - "min": 0, - "multipleOf": 1 - }, - "hue_steps": { - "type": "number", - "min": 0, - "multipleOf": 1 + "brightness_steps": {"$ref": "qmk.definitions.v1#/unsigned_int"}, + "hue_steps": {"$ref": "qmk.definitions.v1#/unsigned_int"}, + "layers": { + "type": "object", + "additionalProperties": false, + "properties": { + "blink": {"type": "boolean"}, + "enabled": {"type": "boolean"}, + "max": { + "type": "number", + "min": 1, + "max": 32, + "multipleOf": 1 + }, + "override_rgb": {"type": "boolean"} + } }, - "led_count": { - "type": "number", - "min": 0, - "multipleOf": 1 + "led_count": {"$ref": "qmk.definitions.v1#/unsigned_int"}, + "max_brightness": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}, + "pin": {"$ref": "qmk.definitions.v1#/mcu_pin"}, + "rgbw": {"type": "boolean"}, + "saturation_steps": {"$ref": "qmk.definitions.v1#/unsigned_int"}, + "sleep": {"type": "boolean"}, + "split": {"type": "boolean"}, + "split_count": { + "type": "array", + "minLength": 2, + "maxLength": 2, + "items": {"$ref": "qmk.definitions.v1#/unsigned_int"} + } + } + }, + "split": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": {"type": "boolean"}, + "matrix_grid": { + "type": "array", + "items": {"$ref": "qmk.definitions.v1#/mcu_pin"} }, - "max_brightness": { - "type": "number", - "min": 0, - "max": 255, - "multipleOf": 1 + "matrix_pins": { + "type": "object", + "additionalProperties": false, + "properties": { + "right": { + "type": "object", + "additionalProperties": false, + "properties": { + "direct": { + "type": "array", + "items": {"$ref": "qmk.definitions.v1#/mcu_pin_array"} + }, + "cols": {"$ref": "qmk.definitions.v1#/mcu_pin_array"}, + "rows": {"$ref": "qmk.definitions.v1#/mcu_pin_array"}, + "unused": {"$ref": "qmk.definitions.v1#/mcu_pin_array"} + } + } + } }, - "pin": { + "main": { "type": "string", - "pattern": "^[A-K]\\d{1,2}$" + "enum": ["eeprom", "left", "matrix_grid", "pin", "right"] }, - "saturation_steps": { + "soft_serial_pin": {"$ref": "qmk.definitions.v1#/mcu_pin"}, + "soft_serial_speed": { "type": "number", "min": 0, + "max": 5, "multipleOf": 1 }, - "sleep": {"type": "boolean"}, - "split": {"type": "boolean"}, - "split_count": { - "type": "array", - "minLength": 2, - "maxLength": 2, - "items": { - "type": "number", - "min": 0, - "multipleOf": 1 + "transport": { + "type": "object", + "additionalProperties": false, + "properties": { + "protocol": { + "type": "string", + "enum": ["custom", "i2c", "serial", "serial_usart"] + }, + "sync_matrix_state": {"type": "boolean"}, + "sync_modifiers": {"type": "boolean"} + } + }, + "usb_detect": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": {"type": "boolean"}, + "polling_interval": {"$ref": "qmk.definitions.v1#/unsigned_int"}, + "timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"} } } } }, + "tags": { + "type": "array", + "items": {"type": "string"} + }, + "tapping": { + "type": "object", + "properties": { + "force_hold": {"type": "boolean"}, + "force_hold_per_key": {"type": "boolean"}, + "ignore_mod_tap_interrupt": {"type": "boolean"}, + "ignore_mod_tap_interrupt_per_key": {"type": "boolean"}, + "permissive_hold": {"type": "boolean"}, + "permissive_hold_per_key": {"type": "boolean"}, + "retro": {"type": "boolean"}, + "retro_per_key": {"type": "boolean"}, + "term": {"$ref": "qmk.definitions.v1#/unsigned_int"}, + "term_per_key": {"type": "boolean"}, + "toggle": {"$ref": "qmk.definitions.v1#/unsigned_int"}, + } + }, "usb": { "type": "object", "additionalProperties": false, "properties": { - "device_ver": { - "type": "string", - "pattern": "^[0-9A-F]x[0-9A-F][0-9A-F][0-9A-F][0-9A-F]" - }, - "pid": { - "type": "string", - "pattern": "^[0-9A-F]x[0-9A-F][0-9A-F][0-9A-F][0-9A-F]" + "device_ver": {"$ref": "qmk.definitions.v1#/hex_number_4d"}, + "force_nkro": {"type": "boolean"}, + "pid": {"$ref": "qmk.definitions.v1#/hex_number_4d"}, + "vid": {"$ref": "qmk.definitions.v1#/hex_number_4d"}, + "max_power": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}, + "no_startup_check": {"type": "boolean"}, + "polling_interval": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}, + "shared_endpoint": { + "type": "object", + "additionalProperties": false, + "properties": { + "keyboard": {"type": "boolean"}, + "mouse": {"type": "boolean"} + } }, - "vid": { - "type": "string", - "pattern": "^[0-9A-F]x[0-9A-F][0-9A-F][0-9A-F][0-9A-F]" - } + "suspend_wakeup_delay": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}, + "wait_for": {"type": "boolean"}, + } + }, + "qmk": { + "type": "object", + "additionalProperties": false, + "properties": { + "keys_per_scan": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}, + "tap_keycode_delay": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}, + "tap_capslock_delay": {"$ref": "qmk.definitions.v1#/unsigned_int_8"}, } }, "qmk_lufa_bootloader": { "type": "object", "additionalProperties": false, "properties": { - "esc_output": { - "type": "string", - "pattern": "^[A-K]\\d{1,2}$" - }, - "esc_input": { - "type": "string", - "pattern": "^[A-K]\\d{1,2}$" - }, - "led": { - "type": "string", - "pattern": "^[A-K]\\d{1,2}$" - }, - "speaker": { - "type": "string", - "pattern": "^[A-K]\\d{1,2}$" - } + "esc_output": {"$ref": "qmk.definitions.v1#/mcu_pin"}, + "esc_input": {"$ref": "qmk.definitions.v1#/mcu_pin"}, + "led": {"$ref": "qmk.definitions.v1#/mcu_pin"}, + "speaker": {"$ref": "qmk.definitions.v1#/mcu_pin"} } } } diff --git a/data/schemas/keymap.jsonschema b/data/schemas/keymap.jsonschema new file mode 100644 index 0000000000..a4bdab966b --- /dev/null +++ b/data/schemas/keymap.jsonschema @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "qmk.keymap.v1", + "title": "Keymap Information", + "type": "object", + "properties": { + "author": {"type": "string"}, + "keyboard": {"$ref": "qmk.definitions.v1#/text_identifier"}, + "keymap": {"$ref": "qmk.definitions.v1#/text_identifier"}, + "layout": {"$ref": "qmk.definitions.v1#/layout_macro"}, + "layers": { + "type": "array", + "items": { + "type": "array", + "items": {"type": "string"} + } + }, + "config": {"$ref": "qmk.keyboard.v1"}, + "notes": { + "type": "string", + "description": "asdf" + } + } +}
\ No newline at end of file diff --git a/quantum/template/avr/config.h b/data/templates/avr/config.h index 4192bbcfa2..4192bbcfa2 100644 --- a/quantum/template/avr/config.h +++ b/data/templates/avr/config.h diff --git a/quantum/template/avr/readme.md b/data/templates/avr/readme.md index fd14558420..b099ed726d 100644 --- a/quantum/template/avr/readme.md +++ b/data/templates/avr/readme.md @@ -17,3 +17,11 @@ Flashing example for this keyboard: make %KEYBOARD%: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). + +## Bootloader + +Enter the bootloader in 3 ways: + +* **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/quantum/template/avr/rules.mk b/data/templates/avr/rules.mk index 5c0d8f307c..9906266f48 100644 --- a/quantum/template/avr/rules.mk +++ b/data/templates/avr/rules.mk @@ -7,7 +7,7 @@ BOOTLOADER = atmel-dfu # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug @@ -18,5 +18,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend NKRO_ENABLE = no # USB Nkey Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -BLUETOOTH_ENABLE = no # Enable Bluetooth AUDIO_ENABLE = no # Audio output diff --git a/quantum/template/base/info.json b/data/templates/base/info.json index af14d87996..3993d85467 100644 --- a/quantum/template/base/info.json +++ b/data/templates/base/info.json @@ -2,8 +2,6 @@ "keyboard_name": "%KEYBOARD%", "url": "", "maintainer": "%YOUR_NAME%", - "width": 3, - "height": 2, "layouts": { "LAYOUT": { "layout": [ diff --git a/quantum/template/base/keyboard.c b/data/templates/base/keyboard.c index f69ae16ede..f69ae16ede 100644 --- a/quantum/template/base/keyboard.c +++ b/data/templates/base/keyboard.c diff --git a/quantum/template/base/keyboard.h b/data/templates/base/keyboard.h index bd2e88d12b..bd2e88d12b 100644 --- a/quantum/template/base/keyboard.h +++ b/data/templates/base/keyboard.h diff --git a/quantum/template/base/keymaps/default/keymap.c b/data/templates/base/keymaps/default/keymap.c index b8ffb0156c..b8ffb0156c 100644 --- a/quantum/template/base/keymaps/default/keymap.c +++ b/data/templates/base/keymaps/default/keymap.c diff --git a/quantum/template/base/keymaps/default/readme.md b/data/templates/base/keymaps/default/readme.md index e052ed80f1..e052ed80f1 100644 --- a/quantum/template/base/keymaps/default/readme.md +++ b/data/templates/base/keymaps/default/readme.md diff --git a/quantum/template/ps2avrgb/config.h b/data/templates/ps2avrgb/config.h index 6150bcce6d..6150bcce6d 100644 --- a/quantum/template/ps2avrgb/config.h +++ b/data/templates/ps2avrgb/config.h diff --git a/quantum/template/ps2avrgb/readme.md b/data/templates/ps2avrgb/readme.md index f19743a163..94063f9ebc 100644 --- a/quantum/template/ps2avrgb/readme.md +++ b/data/templates/ps2avrgb/readme.md @@ -16,6 +16,13 @@ Flashing example for this keyboard ([after setting up the bootloadHID flashing e make %KEYBOARD%:default:flash -**Reset Key**: Hold down the key located at *LOCATION*, commonly programmed as *KEY* while plugging in the keyboard. - 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). + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard +* **BootloadHID reset**: Hold down the key connected to the `A0` and `B0` pins on the MCU if it is known (often top left or bottom left) 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/quantum/template/ps2avrgb/rules.mk b/data/templates/ps2avrgb/rules.mk index 1b61e9534d..b374eca336 100644 --- a/quantum/template/ps2avrgb/rules.mk +++ b/data/templates/ps2avrgb/rules.mk @@ -2,12 +2,12 @@ MCU = atmega32a # Bootloader selection -BOOTLOADER = bootloadHID +BOOTLOADER = bootloadhid # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug diff --git a/doxygen-todo b/doxygen-todo index d8892e48de..643a0df1da 100644 --- a/doxygen-todo +++ b/doxygen-todo @@ -21,7 +21,6 @@ quantum/tools quantum/visualizer quantum/visualizer/resources drivers -drivers/avr drivers/ugfx drivers/ugfx/gdisp drivers/ugfx/gdisp/is31fl3731c diff --git a/drivers/avr/serial.h b/drivers/avr/serial.h deleted file mode 100644 index 53e66cf905..0000000000 --- a/drivers/avr/serial.h +++ /dev/null @@ -1,62 +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 simple API (using signle-type transaction function) -// /* nothing */ -// //// USE flexible API (using multi-type transaction function) -// #define SERIAL_USE_MULTI_TRANSACTION -// -// ///////////////////////////////////////////////////////////////// - -// 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/drivers/chibios/serial.h b/drivers/chibios/serial.h deleted file mode 100644 index 0c1857d52e..0000000000 --- a/drivers/chibios/serial.h +++ /dev/null @@ -1,62 +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 simple API (using signle-type transaction function) -// /* nothing */ -// //// USE flexible API (using multi-type transaction function) -// #define SERIAL_USE_MULTI_TRANSACTION -// -// ///////////////////////////////////////////////////////////////// - -// 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 result -#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/drivers/chibios/serial_usart.c b/drivers/chibios/serial_usart.c deleted file mode 100644 index 63ba83a801..0000000000 --- a/drivers/chibios/serial_usart.c +++ /dev/null @@ -1,219 +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/>. - */ - -#include "serial_usart.h" - -#ifndef USE_GPIOV1 -// The default PAL alternate modes are used to signal that the pins are used for USART -# ifndef SERIAL_USART_TX_PAL_MODE -# define SERIAL_USART_TX_PAL_MODE 7 -# endif -#endif - -#ifndef SERIAL_USART_DRIVER -# define SERIAL_USART_DRIVER SD1 -#endif - -#ifdef SOFT_SERIAL_PIN -# define SERIAL_USART_TX_PIN SOFT_SERIAL_PIN -#endif - -static inline msg_t sdWriteHalfDuplex(SerialDriver* driver, uint8_t* data, uint8_t size) { - msg_t ret = sdWrite(driver, data, size); - - // Half duplex requires us to read back the data we just wrote - just throw it away - uint8_t dump[size]; - sdRead(driver, dump, size); - - return ret; -} -#undef sdWrite -#define sdWrite sdWriteHalfDuplex - -static inline msg_t sdWriteTimeoutHalfDuplex(SerialDriver* driver, uint8_t* data, uint8_t size, uint32_t timeout) { - msg_t ret = sdWriteTimeout(driver, data, size, timeout); - - // Half duplex requires us to read back the data we just wrote - just throw it away - uint8_t dump[size]; - sdReadTimeout(driver, dump, size, timeout); - - return ret; -} -#undef sdWriteTimeout -#define sdWriteTimeout sdWriteTimeoutHalfDuplex - -static inline void sdClear(SerialDriver* driver) { - while (sdGetTimeout(driver, TIME_IMMEDIATE) != MSG_TIMEOUT) { - // Do nothing with the data - } -} - -static SerialConfig sdcfg = { - (SERIAL_USART_SPEED), // speed - mandatory - (SERIAL_USART_CR1), // CR1 - (SERIAL_USART_CR2), // CR2 - (SERIAL_USART_CR3) // CR3 -}; - -void handle_soft_serial_slave(void); - -/* - * This thread runs on the slave and responds to transactions initiated - * by the master - */ -static THD_WORKING_AREA(waSlaveThread, 2048); -static THD_FUNCTION(SlaveThread, arg) { - (void)arg; - chRegSetThreadName("slave_transport"); - - while (true) { - handle_soft_serial_slave(); - } -} - -__attribute__((weak)) void usart_init(void) { -#if defined(USE_GPIOV1) - palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_STM32_ALTERNATE_OPENDRAIN); -#else - palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_ALTERNATE(SERIAL_USART_TX_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN); -#endif - -#if defined(USART_REMAP) - USART_REMAP; -#endif -} - -void usart_master_init(void) { - usart_init(); - - sdcfg.cr3 |= USART_CR3_HDSEL; - sdStart(&SERIAL_USART_DRIVER, &sdcfg); -} - -void usart_slave_init(void) { - usart_init(); - - sdcfg.cr3 |= USART_CR3_HDSEL; - sdStart(&SERIAL_USART_DRIVER, &sdcfg); - - // Start transport thread - chThdCreateStatic(waSlaveThread, sizeof(waSlaveThread), HIGHPRIO, SlaveThread, NULL); -} - -static SSTD_t* Transaction_table = NULL; -static uint8_t Transaction_table_size = 0; - -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; - - usart_master_init(); -} - -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; - - usart_slave_init(); -} - -void handle_soft_serial_slave(void) { - uint8_t sstd_index = sdGet(&SERIAL_USART_DRIVER); // first chunk is always transaction id - SSTD_t* trans = &Transaction_table[sstd_index]; - - // Always write back the sstd_index as part of a basic handshake - sstd_index ^= HANDSHAKE_MAGIC; - sdWrite(&SERIAL_USART_DRIVER, &sstd_index, sizeof(sstd_index)); - - if (trans->initiator2target_buffer_size) { - sdRead(&SERIAL_USART_DRIVER, trans->initiator2target_buffer, trans->initiator2target_buffer_size); - } - - if (trans->target2initiator_buffer_size) { - sdWrite(&SERIAL_USART_DRIVER, trans->target2initiator_buffer, trans->target2initiator_buffer_size); - } - - if (trans->status) { - *trans->status = TRANSACTION_ACCEPTED; - } -} - -///////// -// start transaction by initiator -// -// int soft_serial_transaction(int sstd_index) -// -// Returns: -// TRANSACTION_END -// TRANSACTION_NO_RESPONSE -// TRANSACTION_DATA_ERROR -#ifndef SERIAL_USE_MULTI_TRANSACTION -int soft_serial_transaction(void) { - uint8_t sstd_index = 0; -#else -int soft_serial_transaction(int index) { - uint8_t sstd_index = index; -#endif - - if (sstd_index > Transaction_table_size) return TRANSACTION_TYPE_ERROR; - SSTD_t* trans = &Transaction_table[sstd_index]; - msg_t res = 0; - - sdClear(&SERIAL_USART_DRIVER); - - // First chunk is always transaction id -<<<<<<< HEAD - sdWriteTimeout(&SERIAL_USART_DRIVER, &sstd_index, sizeof(sstd_index), TIME_MS2I(TIMEOUT)); -======= - sdWriteTimeout(&SERIAL_USART_DRIVER, &sstd_index, sizeof(sstd_index), TIME_MS2I(SERIAL_USART_TIMEOUT)); - // - due to the half duplex limitations on return codes, we always have to read *something* - // - without the read, write only transactions *always* succeed, even during the boot process where the slave is not ready -<<<<<<< HEAD - res = sdReadTimeout(&SERIAL_USART_DRIVER, &sstd_index_shake, sizeof(sstd_index_shake), TIME_MS2I(TIMEOUT)); -======= - res = sdReadTimeout(&SERIAL_USART_DRIVER, &sstd_index_shake, sizeof(sstd_index_shake), TIME_MS2I(SERIAL_USART_TIMEOUT)); ->>>>>>> 0.12.52~1 - if (res < 0 || (sstd_index_shake != (sstd_index ^ HANDSHAKE_MAGIC))) { - dprintf("serial::usart_shake NO_RESPONSE\n"); - return TRANSACTION_NO_RESPONSE; - } - - if (trans->initiator2target_buffer_size) { -<<<<<<< HEAD - res = sdWriteTimeout(&SERIAL_USART_DRIVER, trans->initiator2target_buffer, trans->initiator2target_buffer_size, TIME_MS2I(TIMEOUT)); -======= - res = sdWriteTimeout(&SERIAL_USART_DRIVER, trans->initiator2target_buffer, trans->initiator2target_buffer_size, TIME_MS2I(SERIAL_USART_TIMEOUT)); ->>>>>>> 0.12.52~1 - if (res < 0) { - dprintf("serial::usart_transmit NO_RESPONSE\n"); - return TRANSACTION_NO_RESPONSE; - } - } - - if (trans->target2initiator_buffer_size) { -<<<<<<< HEAD - res = sdReadTimeout(&SERIAL_USART_DRIVER, trans->target2initiator_buffer, trans->target2initiator_buffer_size, TIME_MS2I(TIMEOUT)); -======= - res = sdReadTimeout(&SERIAL_USART_DRIVER, trans->target2initiator_buffer, trans->target2initiator_buffer_size, TIME_MS2I(SERIAL_USART_TIMEOUT)); ->>>>>>> 0.12.52~1 - if (res < 0) { - dprintf("serial::usart_receive NO_RESPONSE\n"); - return TRANSACTION_NO_RESPONSE; - } - } - - return TRANSACTION_END; -} diff --git a/drivers/chibios/serial_usart_duplex.c b/drivers/chibios/serial_usart_duplex.c deleted file mode 100644 index cc9b889ac2..0000000000 --- a/drivers/chibios/serial_usart_duplex.c +++ /dev/null @@ -1,261 +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/>. - */ - -#include "serial_usart.h" - -#include <stdatomic.h> - -#if !defined(USE_GPIOV1) -// The default PAL alternate modes are used to signal that the pins are used for USART -# if !defined(SERIAL_USART_TX_PAL_MODE) -# define SERIAL_USART_TX_PAL_MODE 7 -# endif -# if !defined(SERIAL_USART_RX_PAL_MODE) -# define SERIAL_USART_RX_PAL_MODE 7 -# endif -#endif - -#if !defined(SERIAL_USART_DRIVER) -# define SERIAL_USART_DRIVER UARTD1 -#endif - -#if !defined(SERIAL_USART_TX_PIN) -# define SERIAL_USART_TX_PIN A9 -#endif - -#if !defined(SERIAL_USART_RX_PIN) -# define SERIAL_USART_RX_PIN A10 -#endif - -#define SIGNAL_HANDSHAKE_RECEIVED 0x1 - -void handle_transactions_slave(uint8_t sstd_index); -static void receive_transaction_handshake(UARTDriver* uartp, uint16_t received_handshake); - -/* - * UART driver configuration structure. We use the blocking DMA enabled API and - * the rxchar callback to receive handshake tokens but only on the slave halve. - */ -// clang-format off -static UARTConfig uart_config = { - .txend1_cb = NULL, - .txend2_cb = NULL, - .rxend_cb = NULL, - .rxchar_cb = NULL, - .rxerr_cb = NULL, - .timeout_cb = NULL, - .speed = (SERIAL_USART_SPEED), - .cr1 = (SERIAL_USART_CR1), - .cr2 = (SERIAL_USART_CR2), - .cr3 = (SERIAL_USART_CR3) -}; -// clang-format on - -static SSTD_t* Transaction_table = NULL; -static uint8_t Transaction_table_size = 0; -static atomic_uint_least8_t handshake = 0xFF; -static thread_reference_t tp_target = NULL; - -/* - * This callback is invoked when a character is received but the application - * was not ready to receive it, the character is passed as parameter. - * Receive transaction table index from initiator, which doubles as basic handshake token. */ -static void receive_transaction_handshake(UARTDriver* uartp, uint16_t received_handshake) { - /* Check if received handshake is not a valid transaction id. - * Please note that we can still catch a seemingly valid handshake - * i.e. a byte from a ongoing transfer which is in the allowed range. - * So this check mainly prevents any obviously wrong handshakes and - * subsequent wakeups of the receiving thread, which is a costly operation. */ - if (received_handshake > Transaction_table_size) { - return; - } - - handshake = (uint8_t)received_handshake; - chSysLockFromISR(); - /* Wakeup receiving thread to start a transaction. */ - chEvtSignalI(tp_target, (eventmask_t)SIGNAL_HANDSHAKE_RECEIVED); - chSysUnlockFromISR(); -} - -__attribute__((weak)) void usart_init(void) { -#if defined(USE_GPIOV1) - palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_STM32_ALTERNATE_PUSHPULL); - palSetLineMode(SERIAL_USART_RX_PIN, PAL_MODE_INPUT); -#else - palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_ALTERNATE(SERIAL_USART_TX_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); - palSetLineMode(SERIAL_USART_RX_PIN, PAL_MODE_ALTERNATE(SERIAL_USART_RX_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); -#endif -} - -/* - * This thread runs on the slave half and reacts to transactions initiated from the master. - */ -static THD_WORKING_AREA(waSlaveThread, 1024); -static THD_FUNCTION(SlaveThread, arg) { - (void)arg; - chRegSetThreadName("slave_usart_tx_rx"); - - while (true) { - /* We sleep as long as there is no handshake waiting for us. */ - chEvtWaitAny((eventmask_t)SIGNAL_HANDSHAKE_RECEIVED); - handle_transactions_slave(handshake); - } -} - -void soft_serial_target_init(SSTD_t* const sstd_table, int sstd_table_size) { - Transaction_table = sstd_table; - Transaction_table_size = (uint8_t)sstd_table_size; - usart_init(); - -#if defined(USART_REMAP) - USART_REMAP; -#endif - - tp_target = chThdCreateStatic(waSlaveThread, sizeof(waSlaveThread), HIGHPRIO, SlaveThread, NULL); - - // Start receiving handshake tokens on slave halve - uart_config.rxchar_cb = receive_transaction_handshake; - uartStart(&SERIAL_USART_DRIVER, &uart_config); -} - -/** - * @brief React to transactions started by the master. - * This version uses duplex send and receive usart pheriphals and DMA backed transfers. - */ -void inline handle_transactions_slave(uint8_t sstd_index) { - size_t buffer_size = 0; - msg_t msg = 0; - SSTD_t* trans = &Transaction_table[sstd_index]; - - /* Send back the handshake which is XORed as a simple checksum, - to signal that the slave is ready to receive possible transaction buffers */ - sstd_index ^= HANDSHAKE_MAGIC; - buffer_size = (size_t)sizeof(sstd_index); - msg = uartSendTimeout(&SERIAL_USART_DRIVER, &buffer_size, &sstd_index, TIME_MS2I(SERIAL_USART_TIMEOUT)); - - if (msg != MSG_OK) { - if (trans->status) { - *trans->status = TRANSACTION_NO_RESPONSE; - } - return; - } - - /* Receive transaction buffer from the master. If this transaction requires it.*/ - buffer_size = (size_t)trans->initiator2target_buffer_size; - if (buffer_size) { - msg = uartReceiveTimeout(&SERIAL_USART_DRIVER, &buffer_size, trans->initiator2target_buffer, TIME_MS2I(SERIAL_USART_TIMEOUT)); - if (msg != MSG_OK) { - if (trans->status) { - *trans->status = TRANSACTION_NO_RESPONSE; - } - return; - } - } - - /* Send transaction buffer to the master. If this transaction requires it. */ - buffer_size = (size_t)trans->target2initiator_buffer_size; - if (buffer_size) { - msg = uartSendFullTimeout(&SERIAL_USART_DRIVER, &buffer_size, trans->target2initiator_buffer, TIME_MS2I(SERIAL_USART_TIMEOUT)); - if (msg != MSG_OK) { - if (trans->status) { - *trans->status = TRANSACTION_NO_RESPONSE; - } - return; - } - } - - if (trans->status) { - *trans->status = TRANSACTION_ACCEPTED; - } -} - -void soft_serial_initiator_init(SSTD_t* const sstd_table, int sstd_table_size) { - Transaction_table = sstd_table; - Transaction_table_size = (uint8_t)sstd_table_size; - usart_init(); - -#if defined(SERIAL_USART_PIN_SWAP) - uart_config.cr2 |= USART_CR2_SWAP; // master has swapped TX/RX pins -#endif - -#if defined(USART_REMAP) - USART_REMAP; -#endif - - uartStart(&SERIAL_USART_DRIVER, &uart_config); -} - -/** - * @brief Start transaction from the master to the slave. - * This version uses duplex send and receive usart pheriphals and DMA backed transfers. - * - * @param index Transaction Table index of the transaction to start. - * @return int TRANSACTION_NO_RESPONSE in case of Timeout. - * TRANSACTION_TYPE_ERROR in case of invalid transaction index. - * TRANSACTION_END in case of success. - */ -#if !defined(SERIAL_USE_MULTI_TRANSACTION) -int soft_serial_transaction(void) { - uint8_t sstd_index = 0; -#else -int soft_serial_transaction(int index) { - uint8_t sstd_index = index; -#endif - - if (sstd_index > Transaction_table_size) { - return TRANSACTION_TYPE_ERROR; - } - - SSTD_t* const trans = &Transaction_table[sstd_index]; - msg_t msg = 0; - size_t buffer_size = (size_t)sizeof(sstd_index); - - /* Send transaction table index to the slave, which doubles as basic handshake token. */ - uartSendFullTimeout(&SERIAL_USART_DRIVER, &buffer_size, &sstd_index, TIME_MS2I(SERIAL_USART_TIMEOUT)); - - uint8_t sstd_index_shake = 0xFF; - buffer_size = (size_t)sizeof(sstd_index_shake); - - /* Receive the handshake token from the slave. The token was XORed by the slave as a simple checksum. - If the tokens match, the master will start to send and receive possible transaction buffers. */ - msg = uartReceiveTimeout(&SERIAL_USART_DRIVER, &buffer_size, &sstd_index_shake, TIME_MS2I(SERIAL_USART_TIMEOUT)); - if (msg != MSG_OK || (sstd_index_shake != (sstd_index ^ HANDSHAKE_MAGIC))) { - dprintln("USART: Handshake Failed"); - return TRANSACTION_NO_RESPONSE; - } - - /* Send transaction buffer to the slave. If this transaction requires it. */ - buffer_size = (size_t)trans->initiator2target_buffer_size; - if (buffer_size) { - msg = uartSendFullTimeout(&SERIAL_USART_DRIVER, &buffer_size, trans->initiator2target_buffer, TIME_MS2I(SERIAL_USART_TIMEOUT)); - if (msg != MSG_OK) { - dprintln("USART: Send Failed"); - return TRANSACTION_NO_RESPONSE; - } - } - - /* Receive transaction buffer from the slave. If this transaction requires it. */ - buffer_size = (size_t)trans->target2initiator_buffer_size; - if (buffer_size) { - msg = uartReceiveTimeout(&SERIAL_USART_DRIVER, &buffer_size, trans->target2initiator_buffer, TIME_MS2I(SERIAL_USART_TIMEOUT)); - if (msg != MSG_OK) { - dprintln("USART: Receive Failed"); - return TRANSACTION_NO_RESPONSE; - } - } - - return TRANSACTION_END; -} diff --git a/drivers/eeprom/eeprom_i2c.c b/drivers/eeprom/eeprom_i2c.c index 4210f06f9f..8e80ff544f 100644 --- a/drivers/eeprom/eeprom_i2c.c +++ b/drivers/eeprom/eeprom_i2c.c @@ -16,6 +16,9 @@ #include <stdint.h> #include <string.h> +#if defined(EXTERNAL_EEPROM_WP_PIN) +# include "gpio.h" +#endif /* Note that the implementations of eeprom_XXXX_YYYY on AVR are normally @@ -50,7 +53,14 @@ static inline void fill_target_address(uint8_t *buffer, const void *addr) { } } -void eeprom_driver_init(void) { i2c_init(); } +void eeprom_driver_init(void) { + i2c_init(); +#if defined(EXTERNAL_EEPROM_WP_PIN) + /* We are setting the WP pin to high in a way that requires at least two bit-flips to change back to 0 */ + writePin(EXTERNAL_EEPROM_WP_PIN, 1); + setPinInputHigh(EXTERNAL_EEPROM_WP_PIN); +#endif +} void eeprom_driver_erase(void) { #if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT) @@ -89,6 +99,11 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) { uint8_t * read_buf = (uint8_t *)buf; uintptr_t target_addr = (uintptr_t)addr; +#if defined(EXTERNAL_EEPROM_WP_PIN) + setPinOutput(EXTERNAL_EEPROM_WP_PIN); + writePin(EXTERNAL_EEPROM_WP_PIN, 0); +#endif + while (len > 0) { uintptr_t page_offset = target_addr % EXTERNAL_EEPROM_PAGE_SIZE; int write_length = EXTERNAL_EEPROM_PAGE_SIZE - page_offset; @@ -116,4 +131,10 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) { target_addr += write_length; len -= write_length; } + +#if defined(EXTERNAL_EEPROM_WP_PIN) + /* We are setting the WP pin to high in a way that requires at least two bit-flips to change back to 0 */ + writePin(EXTERNAL_EEPROM_WP_PIN, 1); + setPinInputHigh(EXTERNAL_EEPROM_WP_PIN); +#endif } diff --git a/drivers/eeprom/eeprom_spi.c b/drivers/eeprom/eeprom_spi.c index 182731d82f..e273090854 100644 --- a/drivers/eeprom/eeprom_spi.c +++ b/drivers/eeprom/eeprom_spi.c @@ -31,6 +31,8 @@ */ #include "wait.h" +#include "debug.h" +#include "timer.h" #include "spi_master.h" #include "eeprom.h" #include "eeprom_spi.h" @@ -50,11 +52,6 @@ # define EXTERNAL_EEPROM_SPI_TIMEOUT 100 #endif -#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT) -# include "timer.h" -# include "debug.h" -#endif // CONSOLE_ENABLE - static bool spi_eeprom_start(void) { return spi_start(EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN, EXTERNAL_EEPROM_SPI_LSBFIRST, EXTERNAL_EEPROM_SPI_MODE, EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR); } static spi_status_t spi_eeprom_wait_while_busy(int timeout) { diff --git a/drivers/haptic/solenoid.c b/drivers/haptic/solenoid.c index 3e61d5a171..25cf344655 100644 --- a/drivers/haptic/solenoid.c +++ b/drivers/haptic/solenoid.c @@ -18,6 +18,7 @@ #include "timer.h" #include "solenoid.h" #include "haptic.h" +#include "gpio.h" bool solenoid_on = false; bool solenoid_buzzing = false; diff --git a/drivers/lcd/st7565.c b/drivers/lcd/st7565.c new file mode 100644 index 0000000000..49b13c00f1 --- /dev/null +++ b/drivers/lcd/st7565.c @@ -0,0 +1,496 @@ +/* +Copyright 2021 + +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 "st7565.h" + +#include <string.h> + +#include "keyboard.h" +#include "progmem.h" +#include "timer.h" +#include "wait.h" + +#include ST7565_FONT_H + +// Fundamental Commands +#define CONTRAST 0x81 +#define DISPLAY_ALL_ON 0xA5 +#define DISPLAY_ALL_ON_RESUME 0xA4 +#define NORMAL_DISPLAY 0xA6 +#define INVERT_DISPLAY 0xA7 +#define DISPLAY_ON 0xAF +#define DISPLAY_OFF 0xAE +#define NOP 0xE3 + +// Addressing Setting Commands +#define PAM_SETCOLUMN_LSB 0x00 +#define PAM_SETCOLUMN_MSB 0x10 +#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7 + +// Hardware Configuration Commands +#define DISPLAY_START_LINE 0x40 +#define SEGMENT_REMAP 0xA0 +#define SEGMENT_REMAP_INV 0xA1 +#define COM_SCAN_INC 0xC0 +#define COM_SCAN_DEC 0xC8 +#define LCD_BIAS_7 0xA3 +#define LCD_BIAS_9 0xA2 +#define RESISTOR_RATIO 0x20 +#define POWER_CONTROL 0x28 + +// Misc defines +#ifndef ST7565_BLOCK_COUNT +# define ST7565_BLOCK_COUNT (sizeof(ST7565_BLOCK_TYPE) * 8) +#endif +#ifndef ST7565_BLOCK_SIZE +# define ST7565_BLOCK_SIZE (ST7565_MATRIX_SIZE / ST7565_BLOCK_COUNT) +#endif + +#define ST7565_ALL_BLOCKS_MASK (((((ST7565_BLOCK_TYPE)1 << (ST7565_BLOCK_COUNT - 1)) - 1) << 1) | 1) + +#define HAS_FLAGS(bits, flags) ((bits & flags) == flags) + +// Display buffer's is the same as the display memory layout +// this is so we don't end up with rounding errors with +// parts of the display unusable or don't get cleared correctly +// and also allows for drawing & inverting +uint8_t st7565_buffer[ST7565_MATRIX_SIZE]; +uint8_t * st7565_cursor; +ST7565_BLOCK_TYPE st7565_dirty = 0; +bool st7565_initialized = false; +bool st7565_active = false; +bool st7565_inverted = false; +display_rotation_t st7565_rotation = DISPLAY_ROTATION_0; +#if ST7565_TIMEOUT > 0 +uint32_t st7565_timeout; +#endif +#if ST7565_UPDATE_INTERVAL > 0 +uint16_t st7565_update_timeout; +#endif + +// Flips the rendering bits for a character at the current cursor position +static void InvertCharacter(uint8_t *cursor) { + const uint8_t *end = cursor + ST7565_FONT_WIDTH; + while (cursor < end) { + *cursor = ~(*cursor); + cursor++; + } +} + +bool st7565_init(display_rotation_t rotation) { + setPinOutput(ST7565_A0_PIN); + writePinHigh(ST7565_A0_PIN); + setPinOutput(ST7565_RST_PIN); + writePinHigh(ST7565_RST_PIN); + + st7565_rotation = st7565_init_user(rotation); + + spi_init(); + spi_start(ST7565_SS_PIN, false, 0, ST7565_SPI_CLK_DIVISOR); + + st7565_reset(); + + st7565_send_cmd(LCD_BIAS_7); + if (!HAS_FLAGS(st7565_rotation, DISPLAY_ROTATION_180)) { + st7565_send_cmd(SEGMENT_REMAP); + st7565_send_cmd(COM_SCAN_DEC); + } else { + st7565_send_cmd(SEGMENT_REMAP_INV); + st7565_send_cmd(COM_SCAN_INC); + } + st7565_send_cmd(DISPLAY_START_LINE | 0x00); + st7565_send_cmd(CONTRAST); + st7565_send_cmd(ST7565_CONTRAST); + st7565_send_cmd(RESISTOR_RATIO | 0x01); + st7565_send_cmd(POWER_CONTROL | 0x04); + wait_ms(50); + st7565_send_cmd(POWER_CONTROL | 0x06); + wait_ms(50); + st7565_send_cmd(POWER_CONTROL | 0x07); + wait_ms(10); + st7565_send_cmd(DISPLAY_ON); + st7565_send_cmd(DISPLAY_ALL_ON_RESUME); + st7565_send_cmd(NORMAL_DISPLAY); + + spi_stop(); + +#if ST7565_TIMEOUT > 0 + st7565_timeout = timer_read32() + ST7565_TIMEOUT; +#endif + + st7565_clear(); + st7565_initialized = true; + st7565_active = true; + return true; +} + +__attribute__((weak)) display_rotation_t st7565_init_user(display_rotation_t rotation) { return rotation; } + +void st7565_clear(void) { + memset(st7565_buffer, 0, sizeof(st7565_buffer)); + st7565_cursor = &st7565_buffer[0]; + st7565_dirty = ST7565_ALL_BLOCKS_MASK; +} + +uint8_t crot(uint8_t a, int8_t n) { + const uint8_t mask = 0x7; + n &= mask; + return a << n | a >> (-n & mask); +} + +void st7565_render(void) { + if (!st7565_initialized) { + return; + } + + // Do we have work to do? + st7565_dirty &= ST7565_ALL_BLOCKS_MASK; + if (!st7565_dirty) { + return; + } + + // Find first dirty block + uint8_t update_start = 0; + while (!(st7565_dirty & ((ST7565_BLOCK_TYPE)1 << update_start))) { + ++update_start; + } + + // Calculate commands to set memory addressing bounds. + uint8_t start_page = ST7565_BLOCK_SIZE * update_start / ST7565_DISPLAY_WIDTH; + uint8_t start_column = ST7565_BLOCK_SIZE * update_start % ST7565_DISPLAY_WIDTH; + // IC has 132 segment drivers, for panels with less width we need to offset the starting column + if (HAS_FLAGS(st7565_rotation, DISPLAY_ROTATION_180)) { + start_column += (132 - ST7565_DISPLAY_WIDTH); + } + + spi_start(ST7565_SS_PIN, false, 0, ST7565_SPI_CLK_DIVISOR); + + st7565_send_cmd(PAM_PAGE_ADDR | start_page); + st7565_send_cmd(PAM_SETCOLUMN_LSB | ((ST7565_COLUMN_OFFSET + start_column) & 0x0f)); + st7565_send_cmd(PAM_SETCOLUMN_MSB | ((ST7565_COLUMN_OFFSET + start_column) >> 4 & 0x0f)); + + st7565_send_data(&st7565_buffer[ST7565_BLOCK_SIZE * update_start], ST7565_BLOCK_SIZE); + + // Turn on display if it is off + st7565_on(); + + // Clear dirty flag + st7565_dirty &= ~((ST7565_BLOCK_TYPE)1 << update_start); +} + +void st7565_set_cursor(uint8_t col, uint8_t line) { + uint16_t index = line * ST7565_DISPLAY_WIDTH + col * ST7565_FONT_WIDTH; + + // Out of bounds? + if (index >= ST7565_MATRIX_SIZE) { + index = 0; + } + + st7565_cursor = &st7565_buffer[index]; +} + +void st7565_advance_page(bool clearPageRemainder) { + uint16_t index = st7565_cursor - &st7565_buffer[0]; + uint8_t remaining = ST7565_DISPLAY_WIDTH - (index % ST7565_DISPLAY_WIDTH); + + if (clearPageRemainder) { + // Remaining Char count + remaining = remaining / ST7565_FONT_WIDTH; + + // Write empty character until next line + while (remaining--) st7565_write_char(' ', false); + } else { + // Next page index out of bounds? + if (index + remaining >= ST7565_MATRIX_SIZE) { + index = 0; + remaining = 0; + } + + st7565_cursor = &st7565_buffer[index + remaining]; + } +} + +void st7565_advance_char(void) { + uint16_t nextIndex = st7565_cursor - &st7565_buffer[0] + ST7565_FONT_WIDTH; + uint8_t remainingSpace = ST7565_DISPLAY_WIDTH - (nextIndex % ST7565_DISPLAY_WIDTH); + + // Do we have enough space on the current line for the next character + if (remainingSpace < ST7565_FONT_WIDTH) { + nextIndex += remainingSpace; + } + + // Did we go out of bounds + if (nextIndex >= ST7565_MATRIX_SIZE) { + nextIndex = 0; + } + + // Update cursor position + st7565_cursor = &st7565_buffer[nextIndex]; +} + +// Main handler that writes character data to the display buffer +void st7565_write_char(const char data, bool invert) { + // Advance to the next line if newline + if (data == '\n') { + // Old source wrote ' ' until end of line... + st7565_advance_page(true); + return; + } + + if (data == '\r') { + st7565_advance_page(false); + return; + } + + // copy the current render buffer to check for dirty after + static uint8_t st7565_temp_buffer[ST7565_FONT_WIDTH]; + memcpy(&st7565_temp_buffer, st7565_cursor, ST7565_FONT_WIDTH); + + _Static_assert(sizeof(font) >= ((ST7565_FONT_END + 1 - ST7565_FONT_START) * ST7565_FONT_WIDTH), "ST7565_FONT_END references outside array"); + + // set the reder buffer data + uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index + if (cast_data < ST7565_FONT_START || cast_data > ST7565_FONT_END) { + memset(st7565_cursor, 0x00, ST7565_FONT_WIDTH); + } else { + const uint8_t *glyph = &font[(cast_data - ST7565_FONT_START) * ST7565_FONT_WIDTH]; + memcpy_P(st7565_cursor, glyph, ST7565_FONT_WIDTH); + } + + // Invert if needed + if (invert) { + InvertCharacter(st7565_cursor); + } + + // Dirty check + if (memcmp(&st7565_temp_buffer, st7565_cursor, ST7565_FONT_WIDTH)) { + uint16_t index = st7565_cursor - &st7565_buffer[0]; + st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << (index / ST7565_BLOCK_SIZE)); + // Edgecase check if the written data spans the 2 chunks + st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << ((index + ST7565_FONT_WIDTH - 1) / ST7565_BLOCK_SIZE)); + } + + // Finally move to the next char + st7565_advance_char(); +} + +void st7565_write(const char *data, bool invert) { + const char *end = data + strlen(data); + while (data < end) { + st7565_write_char(*data, invert); + data++; + } +} + +void st7565_write_ln(const char *data, bool invert) { + st7565_write(data, invert); + st7565_advance_page(true); +} + +void st7565_pan(bool left) { + uint16_t i = 0; + for (uint16_t y = 0; y < ST7565_DISPLAY_HEIGHT / 8; y++) { + if (left) { + for (uint16_t x = 0; x < ST7565_DISPLAY_WIDTH - 1; x++) { + i = y * ST7565_DISPLAY_WIDTH + x; + st7565_buffer[i] = st7565_buffer[i + 1]; + } + } else { + for (uint16_t x = ST7565_DISPLAY_WIDTH - 1; x > 0; x--) { + i = y * ST7565_DISPLAY_WIDTH + x; + st7565_buffer[i] = st7565_buffer[i - 1]; + } + } + } + st7565_dirty = ST7565_ALL_BLOCKS_MASK; +} + +display_buffer_reader_t st7565_read_raw(uint16_t start_index) { + if (start_index > ST7565_MATRIX_SIZE) start_index = ST7565_MATRIX_SIZE; + display_buffer_reader_t ret_reader; + ret_reader.current_element = &st7565_buffer[start_index]; + ret_reader.remaining_element_count = ST7565_MATRIX_SIZE - start_index; + return ret_reader; +} + +void st7565_write_raw_byte(const char data, uint16_t index) { + if (index > ST7565_MATRIX_SIZE) index = ST7565_MATRIX_SIZE; + if (st7565_buffer[index] == data) return; + st7565_buffer[index] = data; + st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << (index / ST7565_BLOCK_SIZE)); +} + +void st7565_write_raw(const char *data, uint16_t size) { + uint16_t cursor_start_index = st7565_cursor - &st7565_buffer[0]; + if ((size + cursor_start_index) > ST7565_MATRIX_SIZE) size = ST7565_MATRIX_SIZE - cursor_start_index; + for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) { + uint8_t c = *data++; + if (st7565_buffer[i] == c) continue; + st7565_buffer[i] = c; + st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << (i / ST7565_BLOCK_SIZE)); + } +} + +void st7565_write_pixel(uint8_t x, uint8_t y, bool on) { + if (x >= ST7565_DISPLAY_WIDTH) { + return; + } + uint16_t index = x + (y / 8) * ST7565_DISPLAY_WIDTH; + if (index >= ST7565_MATRIX_SIZE) { + return; + } + uint8_t data = st7565_buffer[index]; + if (on) { + data |= (1 << (y % 8)); + } else { + data &= ~(1 << (y % 8)); + } + if (st7565_buffer[index] != data) { + st7565_buffer[index] = data; + st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << (index / ST7565_BLOCK_SIZE)); + } +} + +#if defined(__AVR__) +void st7565_write_P(const char *data, bool invert) { + uint8_t c = pgm_read_byte(data); + while (c != 0) { + st7565_write_char(c, invert); + c = pgm_read_byte(++data); + } +} + +void st7565_write_ln_P(const char *data, bool invert) { + st7565_write_P(data, invert); + st7565_advance_page(true); +} + +void st7565_write_raw_P(const char *data, uint16_t size) { + uint16_t cursor_start_index = st7565_cursor - &st7565_buffer[0]; + if ((size + cursor_start_index) > ST7565_MATRIX_SIZE) size = ST7565_MATRIX_SIZE - cursor_start_index; + for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) { + uint8_t c = pgm_read_byte(data++); + if (st7565_buffer[i] == c) continue; + st7565_buffer[i] = c; + st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << (i / ST7565_BLOCK_SIZE)); + } +} +#endif // defined(__AVR__) + +bool st7565_on(void) { + if (!st7565_initialized) { + return st7565_active; + } + +#if ST7565_TIMEOUT > 0 + st7565_timeout = timer_read32() + ST7565_TIMEOUT; +#endif + + if (!st7565_active) { + spi_start(ST7565_SS_PIN, false, 0, ST7565_SPI_CLK_DIVISOR); + st7565_send_cmd(DISPLAY_ON); + spi_stop(); + st7565_active = true; + st7565_on_user(); + } + return st7565_active; +} + +__attribute__((weak)) void st7565_on_user(void) {} + +bool st7565_off(void) { + if (!st7565_initialized) { + return !st7565_active; + } + + if (st7565_active) { + spi_start(ST7565_SS_PIN, false, 0, ST7565_SPI_CLK_DIVISOR); + st7565_send_cmd(DISPLAY_OFF); + spi_stop(); + st7565_active = false; + st7565_off_user(); + } + return !st7565_active; +} + +__attribute__((weak)) void st7565_off_user(void) {} + +bool st7565_is_on(void) { return st7565_active; } + +bool st7565_invert(bool invert) { + if (!st7565_initialized) { + return st7565_inverted; + } + + if (invert != st7565_inverted) { + spi_start(ST7565_SS_PIN, false, 0, ST7565_SPI_CLK_DIVISOR); + st7565_send_cmd(invert ? INVERT_DISPLAY : NORMAL_DISPLAY); + spi_stop(); + st7565_inverted = invert; + } + return st7565_inverted; +} + +uint8_t st7565_max_chars(void) { return ST7565_DISPLAY_WIDTH / ST7565_FONT_WIDTH; } + +uint8_t st7565_max_lines(void) { return ST7565_DISPLAY_HEIGHT / ST7565_FONT_HEIGHT; } + +void st7565_task(void) { + if (!st7565_initialized) { + return; + } + +#if ST7565_UPDATE_INTERVAL > 0 + if (timer_elapsed(st7565_update_timeout) >= ST7565_UPDATE_INTERVAL) { + st7565_update_timeout = timer_read(); + st7565_set_cursor(0, 0); + st7565_task_user(); + } +#else + st7565_set_cursor(0, 0); + st7565_task_user(); +#endif + + // Smart render system, no need to check for dirty + st7565_render(); + + // Display timeout check +#if ST7565_TIMEOUT > 0 + if (st7565_active && timer_expired32(timer_read32(), st7565_timeout)) { + st7565_off(); + } +#endif +} + +__attribute__((weak)) void st7565_task_user(void) {} + +void st7565_reset(void) { + writePinLow(ST7565_RST_PIN); + wait_ms(20); + writePinHigh(ST7565_RST_PIN); + wait_ms(20); +} + +spi_status_t st7565_send_cmd(uint8_t cmd) { + writePinLow(ST7565_A0_PIN); + return spi_write(cmd); +} + +spi_status_t st7565_send_data(uint8_t *data, uint16_t length) { + writePinHigh(ST7565_A0_PIN); + return spi_transmit(data, length); +} diff --git a/drivers/lcd/st7565.h b/drivers/lcd/st7565.h new file mode 100644 index 0000000000..d453dbe6da --- /dev/null +++ b/drivers/lcd/st7565.h @@ -0,0 +1,219 @@ +/* +Copyright 2021 + +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> + +#include "spi_master.h" + +#ifndef ST7565_DISPLAY_WIDTH +# define ST7565_DISPLAY_WIDTH 128 +#endif +#ifndef ST7565_DISPLAY_HEIGHT +# define ST7565_DISPLAY_HEIGHT 32 +#endif +#ifndef ST7565_MATRIX_SIZE +# define ST7565_MATRIX_SIZE (ST7565_DISPLAY_HEIGHT / 8 * ST7565_DISPLAY_WIDTH) // 1024 (compile time mathed) +#endif +#ifndef ST7565_BLOCK_TYPE +# define ST7565_BLOCK_TYPE uint16_t +#endif +#ifndef ST7565_BLOCK_COUNT +# define ST7565_BLOCK_COUNT (sizeof(ST7565_BLOCK_TYPE) * 8) // 32 (compile time mathed) +#endif +#ifndef ST7565_BLOCK_SIZE +# define ST7565_BLOCK_SIZE (ST7565_MATRIX_SIZE / ST7565_BLOCK_COUNT) // 32 (compile time mathed) +#endif + +// the column address corresponding to the first column in the display hardware +#if !defined(ST7565_COLUMN_OFFSET) +# define ST7565_COLUMN_OFFSET 0 +#endif + +// spi clock divisor +#if !defined(ST7565_SPI_CLK_DIVISOR) +# define ST7565_SPI_CLK_DIVISOR 4 +#endif + +// Custom font file to use +#if !defined(ST7565_FONT_H) +# define ST7565_FONT_H "glcdfont.c" +#endif +// unsigned char value of the first character in the font file +#if !defined(ST7565_FONT_START) +# define ST7565_FONT_START 0 +#endif +// unsigned char value of the last character in the font file +#if !defined(ST7565_FONT_END) +# define ST7565_FONT_END 223 +#endif +// Font render width +#if !defined(ST7565_FONT_WIDTH) +# define ST7565_FONT_WIDTH 6 +#endif +// Font render height +#if !defined(ST7565_FONT_HEIGHT) +# define ST7565_FONT_HEIGHT 8 +#endif +// Default contrast level +#if !defined(ST7565_CONTRAST) +# define ST7565_CONTRAST 32 +#endif + +#if !defined(ST7565_TIMEOUT) +# if defined(ST7565_DISABLE_TIMEOUT) +# define ST7565_TIMEOUT 0 +# else +# define ST7565_TIMEOUT 60000 +# endif +#endif + +#if !defined(ST7565_UPDATE_INTERVAL) && defined(SPLIT_KEYBOARD) +# define ST7565_UPDATE_INTERVAL 50 +#endif + +typedef struct __attribute__((__packed__)) { + uint8_t *current_element; + uint16_t remaining_element_count; +} display_buffer_reader_t; + +// Rotation enum values are flags +typedef enum { DISPLAY_ROTATION_0, DISPLAY_ROTATION_180 } display_rotation_t; + +// Initialize the display, rotating the rendered output based on the define passed in. +// Returns true if the display was initialized successfully +bool st7565_init(display_rotation_t rotation); + +// Called at the start of st7565_init, weak function overridable by the user +// rotation - the value passed into st7565_init +// Return new display_rotation_t if you want to override default rotation +display_rotation_t st7565_init_user(display_rotation_t rotation); + +// Clears the display buffer, resets cursor position to 0, and sets the buffer to dirty for rendering +void st7565_clear(void); + +// Renders the dirty chunks of the buffer to display +void st7565_render(void); + +// Moves cursor to character position indicated by column and line, wraps if out of bounds +// Max column denoted by 'st7565_max_chars()' and max lines by 'st7565_max_lines()' functions +void st7565_set_cursor(uint8_t col, uint8_t line); + +// Advances the cursor to the next page, writing ' ' if true +// Wraps to the begining when out of bounds +void st7565_advance_page(bool clearPageRemainder); + +// Moves the cursor forward 1 character length +// Advance page if there is not enough room for the next character +// Wraps to the begining when out of bounds +void st7565_advance_char(void); + +// Writes a single character to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +// Main handler that writes character data to the display buffer +void st7565_write_char(const char data, bool invert); + +// Writes a string to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +void st7565_write(const char *data, bool invert); + +// Writes a string to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +// Advances the cursor to the next page, wiring ' ' to the remainder of the current page +void st7565_write_ln(const char *data, bool invert); + +// Pans the buffer to the right (or left by passing true) by moving contents of the buffer +// Useful for moving the screen in preparation for new drawing +void st7565_pan(bool left); + +// Returns a pointer to the requested start index in the buffer plus remaining +// buffer length as struct +display_buffer_reader_t st7565_read_raw(uint16_t start_index); + +// Writes a string to the buffer at current cursor position +void st7565_write_raw(const char *data, uint16_t size); + +// Writes a single byte into the buffer at the specified index +void st7565_write_raw_byte(const char data, uint16_t index); + +// Sets a specific pixel on or off +// Coordinates start at top-left and go right and down for positive x and y +void st7565_write_pixel(uint8_t x, uint8_t y, bool on); + +#if defined(__AVR__) +// Writes a PROGMEM string to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +// Remapped to call 'void st7565_write(const char *data, bool invert);' on ARM +void st7565_write_P(const char *data, bool invert); + +// Writes a PROGMEM string to the buffer at current cursor position +// Advances the cursor while writing, inverts the pixels if true +// Advances the cursor to the next page, wiring ' ' to the remainder of the current page +// Remapped to call 'void st7565_write_ln(const char *data, bool invert);' on ARM +void st7565_write_ln_P(const char *data, bool invert); + +// Writes a PROGMEM string to the buffer at current cursor position +void st7565_write_raw_P(const char *data, uint16_t size); +#else +# define st7565_write_P(data, invert) st7565_write(data, invert) +# define st7565_write_ln_P(data, invert) st7565_write_ln(data, invert) +# define st7565_write_raw_P(data, size) st7565_write_raw(data, size) +#endif // defined(__AVR__) + +// Can be used to manually turn on the screen if it is off +// Returns true if the screen was on or turns on +bool st7565_on(void); + +// Called when st7565_on() turns on the screen, weak function overridable by the user +// Not called if the screen is already on +void st7565_on_user(void); + +// Can be used to manually turn off the screen if it is on +// Returns true if the screen was off or turns off +bool st7565_off(void); + +// Called when st7565_off() turns off the screen, weak function overridable by the user +// Not called if the screen is already off +void st7565_off_user(void); + +// Returns true if the screen is currently on, false if it is +// not +bool st7565_is_on(void); + +// Basically it's st7565_render, but with timeout management and st7565_task_user calling! +void st7565_task(void); + +// Called at the start of st7565_task, weak function overridable by the user +void st7565_task_user(void); + +// Inverts the display +// Returns true if the screen was or is inverted +bool st7565_invert(bool invert); + +// Returns the maximum number of characters that will fit on a line +uint8_t st7565_max_chars(void); + +// Returns the maximum number of lines that will fit on the display +uint8_t st7565_max_lines(void); + +void st7565_reset(void); + +spi_status_t st7565_send_cmd(uint8_t cmd); + +spi_status_t st7565_send_data(uint8_t *data, uint16_t length); diff --git a/drivers/apa102/apa102.c b/drivers/led/apa102.c index 7396dc3c55..7396dc3c55 100644 --- a/drivers/apa102/apa102.c +++ b/drivers/led/apa102.c diff --git a/drivers/apa102/apa102.h b/drivers/led/apa102.h index 58cf020c1e..58cf020c1e 100644 --- a/drivers/apa102/apa102.h +++ b/drivers/led/apa102.h diff --git a/drivers/led/aw20216.c b/drivers/led/aw20216.c new file mode 100644 index 0000000000..c608c0ab44 --- /dev/null +++ b/drivers/led/aw20216.c @@ -0,0 +1,141 @@ +/* Copyright 2021 Jasper Chan + * + * 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 "aw20216.h" +#include "spi_master.h" + +/* The AW20216 appears to be somewhat similar to the IS31FL743, although quite + * a few things are different, such as the command byte format and page ordering. + * The LED addresses start from 0x00 instead of 0x01. + */ +#define AWINIC_ID 0b1010 << 4 + +#define AW_PAGE_FUNCTION 0x00 << 1 // PG0, Function registers +#define AW_PAGE_PWM 0x01 << 1 // PG1, LED PWM control +#define AW_PAGE_SCALING 0x02 << 1 // PG2, LED current scaling control +#define AW_PAGE_PATCHOICE 0x03 << 1 // PG3, Pattern choice? +#define AW_PAGE_PWMSCALING 0x04 << 1 // PG4, LED PWM + Scaling control? + +#define AW_WRITE 0 +#define AW_READ 1 + +#define AW_REG_CONFIGURATION 0x00 // PG0 +#define AW_REG_GLOBALCURRENT 0x01 // PG0 + +// Default value of AW_REG_CONFIGURATION +// D7:D4 = 1011, SWSEL (SW1~SW12 active) +// D3 = 0?, reserved (apparently this should be 1 but it doesn't seem to matter) +// D2:D1 = 00, OSDE (open/short detection enable) +// D0 = 0, CHIPEN (write 1 to enable LEDs when hardware enable pulled high) +#define AW_CONFIG_DEFAULT 0b10110000 +#define AW_CHIPEN 1 + +#define AW_PWM_REGISTER_COUNT 216 + +#ifndef AW_SCALING_MAX +# define AW_SCALING_MAX 150 +#endif + +#ifndef AW_GLOBAL_CURRENT_MAX +# define AW_GLOBAL_CURRENT_MAX 150 +#endif + +#ifndef AW_SPI_DIVISOR +# define AW_SPI_DIVISOR 4 +#endif + +uint8_t g_pwm_buffer[DRIVER_COUNT][AW_PWM_REGISTER_COUNT]; +bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false}; + +bool AW20216_write(pin_t cs_pin, uint8_t page, uint8_t reg, uint8_t* data, uint8_t len) { + static uint8_t s_spi_transfer_buffer[2] = {0}; + + if (!spi_start(cs_pin, false, 0, AW_SPI_DIVISOR)) { + spi_stop(); + return false; + } + + s_spi_transfer_buffer[0] = (AWINIC_ID | page | AW_WRITE); + s_spi_transfer_buffer[1] = reg; + + if (spi_transmit(s_spi_transfer_buffer, 2) != SPI_STATUS_SUCCESS) { + spi_stop(); + return false; + } + + if (spi_transmit(data, len) != SPI_STATUS_SUCCESS) { + spi_stop(); + return false; + } + + spi_stop(); + return true; +} + +static inline bool AW20216_write_register(pin_t cs_pin, uint8_t page, uint8_t reg, uint8_t value) { + // Little wrapper so callers need not care about sending a buffer + return AW20216_write(cs_pin, page, reg, &value, 1); +} + +static void AW20216_init_scaling(pin_t cs_pin) { + // Set constant current to the max, control brightness with PWM + for (uint8_t i = 0; i < AW_PWM_REGISTER_COUNT; i++) { + AW20216_write_register(cs_pin, AW_PAGE_SCALING, i, AW_SCALING_MAX); + } +} + +static inline void AW20216_init_current_limit(pin_t cs_pin) { + // Push config + AW20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_GLOBALCURRENT, AW_GLOBAL_CURRENT_MAX); +} + +static inline void AW20216_soft_enable(pin_t cs_pin) { + // Push config + AW20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_CONFIGURATION, AW_CONFIG_DEFAULT | AW_CHIPEN); +} + +void AW20216_init(pin_t cs_pin, pin_t en_pin) { + setPinOutput(en_pin); + writePinHigh(en_pin); + + // Drivers should start with all scaling and PWM registers as off + AW20216_init_current_limit(cs_pin); + AW20216_init_scaling(cs_pin); + + AW20216_soft_enable(cs_pin); +} + +void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { + aw_led led = g_aw_leds[index]; + + g_pwm_buffer[led.driver][led.r] = red; + g_pwm_buffer[led.driver][led.g] = green; + g_pwm_buffer[led.driver][led.b] = blue; + g_pwm_buffer_update_required[led.driver] = true; +} + +void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { + for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + AW20216_set_color(i, red, green, blue); + } +} + +void AW20216_update_pwm_buffers(pin_t cs_pin, uint8_t index) { + if (g_pwm_buffer_update_required[index]) { + AW20216_write(cs_pin, AW_PAGE_PWM, 0, g_pwm_buffer[index], AW_PWM_REGISTER_COUNT); + } + g_pwm_buffer_update_required[index] = false; +} diff --git a/drivers/led/aw20216.h b/drivers/led/aw20216.h new file mode 100644 index 0000000000..97ac6dc5bf --- /dev/null +++ b/drivers/led/aw20216.h @@ -0,0 +1,253 @@ +/* Copyright 2021 Jasper Chan (Gigahawk) + * + * 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> +#include "progmem.h" +#include "gpio.h" + +typedef struct aw_led { + uint8_t driver : 2; + uint8_t r; + uint8_t g; + uint8_t b; +} aw_led; + +extern const aw_led __flash g_aw_leds[DRIVER_LED_TOTAL]; + +void AW20216_init(pin_t cs_pin, pin_t en_pin); +void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); +void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue); +void AW20216_update_pwm_buffers(pin_t cs_pin, uint8_t index); + +#define CS1_SW1 0x00 +#define CS2_SW1 0x01 +#define CS3_SW1 0x02 +#define CS4_SW1 0x03 +#define CS5_SW1 0x04 +#define CS6_SW1 0x05 +#define CS7_SW1 0x06 +#define CS8_SW1 0x07 +#define CS9_SW1 0x08 +#define CS10_SW1 0x09 +#define CS11_SW1 0x0A +#define CS12_SW1 0x0B +#define CS13_SW1 0x0C +#define CS14_SW1 0x0D +#define CS15_SW1 0x0E +#define CS16_SW1 0x0F +#define CS17_SW1 0x10 +#define CS18_SW1 0x11 +#define CS1_SW2 0x12 +#define CS2_SW2 0x13 +#define CS3_SW2 0x14 +#define CS4_SW2 0x15 +#define CS5_SW2 0x16 +#define CS6_SW2 0x17 +#define CS7_SW2 0x18 +#define CS8_SW2 0x19 +#define CS9_SW2 0x1A +#define CS10_SW2 0x1B +#define CS11_SW2 0x1C +#define CS12_SW2 0x1D +#define CS13_SW2 0x1E +#define CS14_SW2 0x1F +#define CS15_SW2 0x20 +#define CS16_SW2 0x21 +#define CS17_SW2 0x22 +#define CS18_SW2 0x23 +#define CS1_SW3 0x24 +#define CS2_SW3 0x25 +#define CS3_SW3 0x26 +#define CS4_SW3 0x27 +#define CS5_SW3 0x28 +#define CS6_SW3 0x29 +#define CS7_SW3 0x2A +#define CS8_SW3 0x2B +#define CS9_SW3 0x2C +#define CS10_SW3 0x2D +#define CS11_SW3 0x2E +#define CS12_SW3 0x2F +#define CS13_SW3 0x30 +#define CS14_SW3 0x31 +#define CS15_SW3 0x32 +#define CS16_SW3 0x33 +#define CS17_SW3 0x34 +#define CS18_SW3 0x35 +#define CS1_SW4 0x36 +#define CS2_SW4 0x37 +#define CS3_SW4 0x38 +#define CS4_SW4 0x39 +#define CS5_SW4 0x3A +#define CS6_SW4 0x3B +#define CS7_SW4 0x3C +#define CS8_SW4 0x3D +#define CS9_SW4 0x3E +#define CS10_SW4 0x3F +#define CS11_SW4 0x40 +#define CS12_SW4 0x41 +#define CS13_SW4 0x42 +#define CS14_SW4 0x43 +#define CS15_SW4 0x44 +#define CS16_SW4 0x45 +#define CS17_SW4 0x46 +#define CS18_SW4 0x47 +#define CS1_SW5 0x48 +#define CS2_SW5 0x49 +#define CS3_SW5 0x4A +#define CS4_SW5 0x4B +#define CS5_SW5 0x4C +#define CS6_SW5 0x4D +#define CS7_SW5 0x4E +#define CS8_SW5 0x4F +#define CS9_SW5 0x50 +#define CS10_SW5 0x51 +#define CS11_SW5 0x52 +#define CS12_SW5 0x53 +#define CS13_SW5 0x54 +#define CS14_SW5 0x55 +#define CS15_SW5 0x56 +#define CS16_SW5 0x57 +#define CS17_SW5 0x58 +#define CS18_SW5 0x59 +#define CS1_SW6 0x5A +#define CS2_SW6 0x5B +#define CS3_SW6 0x5C +#define CS4_SW6 0x5D +#define CS5_SW6 0x5E +#define CS6_SW6 0x5F +#define CS7_SW6 0x60 +#define CS8_SW6 0x61 +#define CS9_SW6 0x62 +#define CS10_SW6 0x63 +#define CS11_SW6 0x64 +#define CS12_SW6 0x65 +#define CS13_SW6 0x66 +#define CS14_SW6 0x67 +#define CS15_SW6 0x68 +#define CS16_SW6 0x69 +#define CS17_SW6 0x6A +#define CS18_SW6 0x6B +#define CS1_SW7 0x6C +#define CS2_SW7 0x6D +#define CS3_SW7 0x6E +#define CS4_SW7 0x6F +#define CS5_SW7 0x70 +#define CS6_SW7 0x71 +#define CS7_SW7 0x72 +#define CS8_SW7 0x73 +#define CS9_SW7 0x74 +#define CS10_SW7 0x75 +#define CS11_SW7 0x76 +#define CS12_SW7 0x77 +#define CS13_SW7 0x78 +#define CS14_SW7 0x79 +#define CS15_SW7 0x7A +#define CS16_SW7 0x7B +#define CS17_SW7 0x7C +#define CS18_SW7 0x7D +#define CS1_SW8 0x7E +#define CS2_SW8 0x7F +#define CS3_SW8 0x80 +#define CS4_SW8 0x81 +#define CS5_SW8 0x82 +#define CS6_SW8 0x83 +#define CS7_SW8 0x84 +#define CS8_SW8 0x85 +#define CS9_SW8 0x86 +#define CS10_SW8 0x87 +#define CS11_SW8 0x88 +#define CS12_SW8 0x89 +#define CS13_SW8 0x8A +#define CS14_SW8 0x8B +#define CS15_SW8 0x8C +#define CS16_SW8 0x8D +#define CS17_SW8 0x8E +#define CS18_SW8 0x8F +#define CS1_SW9 0x90 +#define CS2_SW9 0x91 +#define CS3_SW9 0x92 +#define CS4_SW9 0x93 +#define CS5_SW9 0x94 +#define CS6_SW9 0x95 +#define CS7_SW9 0x96 +#define CS8_SW9 0x97 +#define CS9_SW9 0x98 +#define CS10_SW9 0x99 +#define CS11_SW9 0x9A +#define CS12_SW9 0x9B +#define CS13_SW9 0x9C +#define CS14_SW9 0x9D +#define CS15_SW9 0x9E +#define CS16_SW9 0x9F +#define CS17_SW9 0xA0 +#define CS18_SW9 0xA1 +#define CS1_SW10 0xA2 +#define CS2_SW10 0xA3 +#define CS3_SW10 0xA4 +#define CS4_SW10 0xA5 +#define CS5_SW10 0xA6 +#define CS6_SW10 0xA7 +#define CS7_SW10 0xA8 +#define CS8_SW10 0xA9 +#define CS9_SW10 0xAA +#define CS10_SW10 0xAB +#define CS11_SW10 0xAC +#define CS12_SW10 0xAD +#define CS13_SW10 0xAE +#define CS14_SW10 0xAF +#define CS15_SW10 0xB0 +#define CS16_SW10 0xB1 +#define CS17_SW10 0xB2 +#define CS18_SW10 0xB3 +#define CS1_SW11 0xB4 +#define CS2_SW11 0xB5 +#define CS3_SW11 0xB6 +#define CS4_SW11 0xB7 +#define CS5_SW11 0xB8 +#define CS6_SW11 0xB9 +#define CS7_SW11 0xBA +#define CS8_SW11 0xBB +#define CS9_SW11 0xBC +#define CS10_SW11 0xBD +#define CS11_SW11 0xBE +#define CS12_SW11 0xBF +#define CS13_SW11 0xC0 +#define CS14_SW11 0xC1 +#define CS15_SW11 0xC2 +#define CS16_SW11 0xC3 +#define CS17_SW11 0xC4 +#define CS18_SW11 0xC5 +#define CS1_SW12 0xC6 +#define CS2_SW12 0xC7 +#define CS3_SW12 0xC8 +#define CS4_SW12 0xC9 +#define CS5_SW12 0xCA +#define CS6_SW12 0xCB +#define CS7_SW12 0xCC +#define CS8_SW12 0xCD +#define CS9_SW12 0xCE +#define CS10_SW12 0xCF +#define CS11_SW12 0xD0 +#define CS12_SW12 0xD1 +#define CS13_SW12 0xD2 +#define CS14_SW12 0xD3 +#define CS15_SW12 0xD4 +#define CS16_SW12 0xD5 +#define CS17_SW12 0xD6 +#define CS18_SW12 0xD7 diff --git a/drivers/issi/is31fl3218.c b/drivers/led/issi/is31fl3218.c index d43863ac4b..d43863ac4b 100644 --- a/drivers/issi/is31fl3218.c +++ b/drivers/led/issi/is31fl3218.c diff --git a/drivers/issi/is31fl3218.h b/drivers/led/issi/is31fl3218.h index fa760da191..fa760da191 100644 --- a/drivers/issi/is31fl3218.h +++ b/drivers/led/issi/is31fl3218.h diff --git a/drivers/issi/is31fl3731-simple.c b/drivers/led/issi/is31fl3731-simple.c index d295772f5e..d295772f5e 100644 --- a/drivers/issi/is31fl3731-simple.c +++ b/drivers/led/issi/is31fl3731-simple.c diff --git a/drivers/issi/is31fl3731-simple.h b/drivers/led/issi/is31fl3731-simple.h index 9665d6ed35..ecde31eed5 100644 --- a/drivers/issi/is31fl3731-simple.h +++ b/drivers/led/issi/is31fl3731-simple.h @@ -20,13 +20,14 @@ #include <stdint.h> #include <stdbool.h> +#include "progmem.h" typedef struct is31_led { uint8_t driver : 2; uint8_t v; } __attribute__((packed)) is31_led; -extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; +extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; void IS31FL3731_init(uint8_t addr); void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/issi/is31fl3731.c b/drivers/led/issi/is31fl3731.c index 110bdc1be4..110bdc1be4 100644 --- a/drivers/issi/is31fl3731.c +++ b/drivers/led/issi/is31fl3731.c diff --git a/drivers/issi/is31fl3731.h b/drivers/led/issi/is31fl3731.h index 19e8e6251f..803ea3ea12 100644 --- a/drivers/issi/is31fl3731.h +++ b/drivers/led/issi/is31fl3731.h @@ -19,6 +19,7 @@ #include <stdint.h> #include <stdbool.h> +#include "progmem.h" typedef struct is31_led { uint8_t driver : 2; @@ -27,7 +28,7 @@ typedef struct is31_led { uint8_t b; } __attribute__((packed)) is31_led; -extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; +extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; void IS31FL3731_init(uint8_t addr); void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/issi/is31fl3733.c b/drivers/led/issi/is31fl3733.c index d99e5339c9..d99e5339c9 100644 --- a/drivers/issi/is31fl3733.c +++ b/drivers/led/issi/is31fl3733.c diff --git a/drivers/issi/is31fl3733.h b/drivers/led/issi/is31fl3733.h index 603d505a13..64fd38eb19 100644 --- a/drivers/issi/is31fl3733.h +++ b/drivers/led/issi/is31fl3733.h @@ -20,6 +20,7 @@ #include <stdint.h> #include <stdbool.h> +#include "progmem.h" typedef struct is31_led { uint8_t driver : 2; @@ -28,7 +29,7 @@ typedef struct is31_led { uint8_t b; } __attribute__((packed)) is31_led; -extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; +extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; void IS31FL3733_init(uint8_t addr, uint8_t sync); bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/issi/is31fl3736.c b/drivers/led/issi/is31fl3736.c index 7dece1b1eb..7dece1b1eb 100644 --- a/drivers/issi/is31fl3736.c +++ b/drivers/led/issi/is31fl3736.c diff --git a/drivers/issi/is31fl3736.h b/drivers/led/issi/is31fl3736.h index e48e31c279..c956c87f7c 100644 --- a/drivers/issi/is31fl3736.h +++ b/drivers/led/issi/is31fl3736.h @@ -18,6 +18,7 @@ #include <stdint.h> #include <stdbool.h> +#include "progmem.h" // Simple interface option. // If these aren't defined, just define them to make it compile @@ -37,7 +38,7 @@ typedef struct is31_led { uint8_t b; } __attribute__((packed)) is31_led; -extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; +extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; void IS31FL3736_init(uint8_t addr); void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/issi/is31fl3737.c b/drivers/led/issi/is31fl3737.c index 8647c93cc1..0bb4ddd425 100644 --- a/drivers/issi/is31fl3737.c +++ b/drivers/led/issi/is31fl3737.c @@ -65,11 +65,12 @@ uint8_t g_twi_transfer_buffer[20]; // We could optimize this and take out the unused registers from these // buffers and the transfers in IS31FL3737_write_pwm_buffer() but it's // probably not worth the extra complexity. + uint8_t g_pwm_buffer[DRIVER_COUNT][192]; -bool g_pwm_buffer_update_required = false; +bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false}; -uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}}; -bool g_led_control_registers_update_required = false; +uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0}; +bool g_led_control_registers_update_required[DRIVER_COUNT] = {false}; void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) { g_twi_transfer_buffer[0] = reg; @@ -155,10 +156,10 @@ void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { if (index >= 0 && index < DRIVER_LED_TOTAL) { is31_led led = g_is31_leds[index]; - g_pwm_buffer[led.driver][led.r] = red; - g_pwm_buffer[led.driver][led.g] = green; - g_pwm_buffer[led.driver][led.b] = blue; - g_pwm_buffer_update_required = true; + g_pwm_buffer[led.driver][led.r] = red; + g_pwm_buffer[led.driver][led.g] = green; + g_pwm_buffer[led.driver][led.b] = blue; + g_pwm_buffer_update_required[led.driver] = true; } } @@ -194,30 +195,28 @@ void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bo g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b); } - g_led_control_registers_update_required = true; + g_led_control_registers_update_required[led.driver] = true; } -void IS31FL3737_update_pwm_buffers(uint8_t addr1, uint8_t addr2) { - if (g_pwm_buffer_update_required) { +void IS31FL3737_update_pwm_buffers(uint8_t addr, uint8_t index) { + if (g_pwm_buffer_update_required[index]) { // Firstly we need to unlock the command register and select PG1 - IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); - IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); + IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); + IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); - IS31FL3737_write_pwm_buffer(addr1, g_pwm_buffer[0]); - // IS31FL3737_write_pwm_buffer(addr2, g_pwm_buffer[1]); + IS31FL3737_write_pwm_buffer(addr, g_pwm_buffer[index]); } - g_pwm_buffer_update_required = false; + g_pwm_buffer_update_required[index] = false; } -void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2) { - if (g_led_control_registers_update_required) { +void IS31FL3737_update_led_control_registers(uint8_t addr, uint8_t index) { + if (g_led_control_registers_update_required[index]) { // Firstly we need to unlock the command register and select PG0 - IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); - IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); + IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); + IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); for (int i = 0; i < 24; i++) { - IS31FL3737_write_register(addr1, i, g_led_control_registers[0][i]); - // IS31FL3737_write_register(addr2, i, g_led_control_registers[1][i]); + IS31FL3737_write_register(addr, i, g_led_control_registers[index][i]); } - g_led_control_registers_update_required = false; } + g_led_control_registers_update_required[index] = false; } diff --git a/drivers/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h index a1d2281778..06886e9c9b 100644 --- a/drivers/issi/is31fl3737.h +++ b/drivers/led/issi/is31fl3737.h @@ -20,6 +20,7 @@ #include <stdint.h> #include <stdbool.h> +#include "progmem.h" typedef struct is31_led { uint8_t driver : 2; @@ -28,7 +29,7 @@ typedef struct is31_led { uint8_t b; } __attribute__((packed)) is31_led; -extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; +extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; void IS31FL3737_init(uint8_t addr); void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); diff --git a/drivers/issi/is31fl3741.c b/drivers/led/issi/is31fl3741.c index 1b533c9b6a..24a273514e 100644 --- a/drivers/issi/is31fl3741.c +++ b/drivers/led/issi/is31fl3741.c @@ -73,7 +73,7 @@ uint8_t g_twi_transfer_buffer[20] = {0xFF}; // buffers and the transfers in IS31FL3741_write_pwm_buffer() but it's // probably not worth the extra complexity. uint8_t g_pwm_buffer[DRIVER_COUNT][ISSI_MAX_LEDS]; -bool g_pwm_buffer_update_required = false; +bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false}; bool g_scaling_registers_update_required[DRIVER_COUNT] = {false}; uint8_t g_scaling_registers[DRIVER_COUNT][ISSI_MAX_LEDS]; @@ -169,10 +169,10 @@ void IS31FL3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { if (index >= 0 && index < DRIVER_LED_TOTAL) { is31_led led = g_is31_leds[index]; - g_pwm_buffer[led.driver][led.r] = red; - g_pwm_buffer[led.driver][led.g] = green; - g_pwm_buffer[led.driver][led.b] = blue; - g_pwm_buffer_update_required = true; + g_pwm_buffer[led.driver][led.r] = red; + g_pwm_buffer[led.driver][led.g] = green; + g_pwm_buffer[led.driver][led.b] = blue; + g_pwm_buffer_update_required[led.driver] = true; } } @@ -206,12 +206,12 @@ void IS31FL3741_set_led_control_register(uint8_t index, bool red, bool green, bo g_scaling_registers_update_required[led.driver] = true; } -void IS31FL3741_update_pwm_buffers(uint8_t addr1, uint8_t addr2) { - if (g_pwm_buffer_update_required) { - IS31FL3741_write_pwm_buffer(addr1, g_pwm_buffer[0]); +void IS31FL3741_update_pwm_buffers(uint8_t addr, uint8_t index) { + if (g_pwm_buffer_update_required[index]) { + IS31FL3741_write_pwm_buffer(addr, g_pwm_buffer[index]); } - g_pwm_buffer_update_required = false; + g_pwm_buffer_update_required[index] = false; } void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue) { @@ -219,7 +219,7 @@ void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, g_pwm_buffer[pled->driver][pled->g] = green; g_pwm_buffer[pled->driver][pled->b] = blue; - g_pwm_buffer_update_required = true; + g_pwm_buffer_update_required[pled->driver] = true; } void IS31FL3741_update_led_control_registers(uint8_t addr, uint8_t index) { diff --git a/drivers/issi/is31fl3741.h b/drivers/led/issi/is31fl3741.h index 2df0c5b1a7..163a035233 100644 --- a/drivers/issi/is31fl3741.h +++ b/drivers/led/issi/is31fl3741.h @@ -21,6 +21,7 @@ #include <stdint.h> #include <stdbool.h> +#include "progmem.h" typedef struct is31_led { uint32_t driver : 2; @@ -29,7 +30,7 @@ typedef struct is31_led { uint32_t b : 10; } __attribute__((packed)) is31_led; -extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; +extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; void IS31FL3741_init(uint8_t addr); void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); @@ -44,8 +45,8 @@ void IS31FL3741_set_led_control_register(uint8_t index, bool red, bool green, bo // (eg. from a timer interrupt). // Call this while idle (in between matrix scans). // If the buffer is dirty, it will update the driver with the buffer. -void IS31FL3741_update_pwm_buffers(uint8_t addr1, uint8_t addr2); -void IS31FL3741_update_led_control_registers(uint8_t addr1, uint8_t addr2); +void IS31FL3741_update_pwm_buffers(uint8_t addr, uint8_t index); +void IS31FL3741_update_led_control_registers(uint8_t addr, uint8_t index); void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue); void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue); diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h index a6b85f37e6..13b73ede9d 100644 --- a/drivers/oled/oled_driver.h +++ b/drivers/oled/oled_driver.h @@ -313,6 +313,14 @@ bool oled_scroll_left(void); // Returns true if the screen was not scrolling or stops scrolling bool oled_scroll_off(void); +// Returns true if the oled is currently scrolling, false if it is +// not +bool is_oled_scrolling(void); + +// Inverts the display +// Returns true if the screen was or is inverted +bool oled_invert(bool invert); + // Returns the maximum number of characters that will fit on a line uint8_t oled_max_chars(void); diff --git a/drivers/oled/oled_driver.c b/drivers/oled/ssd1306_sh1106.c index 8e5ed5f070..e9049438f5 100644 --- a/drivers/oled/oled_driver.c +++ b/drivers/oled/ssd1306_sh1106.c @@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define DISPLAY_ALL_ON 0xA5 #define DISPLAY_ALL_ON_RESUME 0xA4 #define NORMAL_DISPLAY 0xA6 +#define INVERT_DISPLAY 0xA7 #define DISPLAY_ON 0xAF #define DISPLAY_OFF 0xAE #define NOP 0xE3 @@ -114,6 +115,7 @@ OLED_BLOCK_TYPE oled_dirty = 0; bool oled_initialized = false; bool oled_active = false; bool oled_scrolling = false; +bool oled_inverted = false; uint8_t oled_brightness = OLED_BRIGHTNESS; oled_rotation_t oled_rotation = 0; uint8_t oled_rotation_width = 0; @@ -690,6 +692,32 @@ bool oled_scroll_off(void) { return !oled_scrolling; } +bool is_oled_scrolling(void) { return oled_scrolling; } + +bool oled_invert(bool invert) { + if (!oled_initialized) { + return oled_inverted; + } + + if (invert && !oled_inverted) { + static const uint8_t PROGMEM display_inverted[] = {I2C_CMD, INVERT_DISPLAY}; + if (I2C_TRANSMIT_P(display_inverted) != I2C_STATUS_SUCCESS) { + print("oled_invert cmd failed\n"); + return oled_inverted; + } + oled_inverted = true; + } else if (!invert && oled_inverted) { + static const uint8_t PROGMEM display_normal[] = {I2C_CMD, NORMAL_DISPLAY}; + if (I2C_TRANSMIT_P(display_normal) != I2C_STATUS_SUCCESS) { + print("oled_invert cmd failed\n"); + return oled_inverted; + } + oled_inverted = false; + } + + return oled_inverted; +} + uint8_t oled_max_chars(void) { if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) { return OLED_DISPLAY_WIDTH / OLED_FONT_WIDTH; diff --git a/drivers/qwiic/micro_oled.c b/drivers/qwiic/micro_oled.c index bbeb140cbe..8dfff6968f 100644 --- a/drivers/qwiic/micro_oled.c +++ b/drivers/qwiic/micro_oled.c @@ -70,25 +70,28 @@ static uint8_t micro_oled_screen_current[LCDWIDTH * LCDHEIGHT / 8] = {0}; D6 D6.............D6 / D7 D7.............D7 ---- */ - -#if LCDWIDTH == 64 -# if LCDHEIGHT == 48 +#ifdef NO_LCD_SPLASH +// do not initialize with a splash screen +static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = {0}; +#else +# if LCDWIDTH == 64 +# if LCDHEIGHT == 48 static uint8_t micro_oled_screen_buffer[] = { // QMK Logo - generated at http://www.majer.ch/lcd/adf_bitmap.php // 64x48 image 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0xF8, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x8C, 0x8C, 0x8C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0x8C, 0x8C, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x31, 0x31, 0x31, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF8, 0xF1, 0xE3, 0xE7, 0xCF, 0xCF, 0xCF, 0xCF, 0x00, 0x00, 0xCF, 0xCF, 0xCF, 0xC7, 0xE7, 0xE3, 0xF1, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x1F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x1F, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -# endif -#elif LCDWIDTH == 128 -# if LCDHEIGHT == 32 +# endif +# elif LCDWIDTH == 128 +# if LCDHEIGHT == 32 static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = { // 128x32 qmk image 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, 0xFC, 0xFC, 0xE0, 0xFC, 0xFC, 0xE0, 0xF0, 0xFC, 0xE0, 0xE0, 0xFC, 0xE0, 0xE0, 0xFC, 0xFC, 0xE0, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x10, 0x10, 0x30, 0xE0, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0xB2, 0xB2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x03, 0xFF, 0xFF, 0xFF, 0x03, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xB7, 0xB2, 0xB2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x02, 0x02, 0x03, 0x01, 0x00, 0x06, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x06, 0x00, 0x03, 0x1E, 0x18, 0x0F, 0x01, 0x0F, 0x18, 0x1E, 0x01, 0x00, 0x0F, 0x1F, 0x12, 0x02, 0x12, 0x13, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x0E, 0x1F, 0x12, 0x02, 0x12, 0x13, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x4D, 0x4D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xF9, 0xF3, 0xF3, 0xC0, 0x80, 0xF3, 0xF3, 0xF3, 0xF9, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0x4D, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0xC0, 0x00, 0x70, 0xC0, 0x00, 0x80, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x1C, 0xF0, 0x00, 0x00, 0xFC, 0x0C, 0x38, 0xE0, 0x00, 0x00, 0xC0, 0x38, 0x0C, 0xFC, 0x00, 0x00, 0xFC, 0xFC, 0x60, 0x90, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x3F, 0x3F, 0x07, 0x3F, 0x3F, 0x07, 0x0F, 0x3F, 0x07, 0x07, 0x3F, 0x07, 0x07, 0x3F, 0x3F, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x06, 0x04, 0x04, 0x07, 0x01, 0x00, 0x00, 0x13, 0x1E, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x07, 0x0D, 0x08, 0x00, 0x07, 0x00, 0x00, 0x01, 0x07, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x07, 0x00, 0x01, 0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -# elif LCDHEIGHT == 64 +# elif LCDHEIGHT == 64 static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0xFF, 0x7F, 0x7E, 0xFE, 0xFF, 0xFF, 0xFE, 0xFE, 0x7F, 0x7F, 0xFE, 0xFE, 0xFF, 0xFF, 0xFE, 0x7E, 0x7F, 0xFF, 0xFE, 0xFE, 0xFC, 0xFC, 0xF8, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -99,10 +102,11 @@ static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; // TODO: generate bitmap of QMK logo here -# endif -#else +# endif +# else // catchall for custom screen sizes static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = {0}; +# endif #endif void micro_oled_init(void) { @@ -145,7 +149,7 @@ void micro_oled_init(void) { #endif send_command(MEMORYMODE); - send_command(0x10); + send_command(0x02); // 0x02 = 10b, Page addressing mode send_command(SETCOMPINS); // 0xDA if (LCDHEIGHT > 32) { @@ -250,13 +254,14 @@ void send_buffer(void) { if (micro_oled_screen_buffer[i * LCDWIDTH + j] != micro_oled_screen_current[i * LCDWIDTH + j]) { if (page_addr != i) { set_page_address(i); + page_addr = i; } if (col_addr != j) { set_column_address(j); + col_addr = j + 1; } send_data(micro_oled_screen_buffer[i * LCDWIDTH + j]); micro_oled_screen_current[i * LCDWIDTH + j] = micro_oled_screen_buffer[i * LCDWIDTH + j]; - col_addr = j + 1; } } } diff --git a/drivers/sensors/adns5050.c b/drivers/sensors/adns5050.c new file mode 100644 index 0000000000..e7273977d5 --- /dev/null +++ b/drivers/sensors/adns5050.c @@ -0,0 +1,193 @@ +/* Copyright 2021 Colin Lam (Ploopy Corporation) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * Copyright 2019 Sunjun Kim + * Copyright 2019 Hiroyuki Okada + * + * 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 "adns5050.h" +#include "wait.h" +#include "debug.h" +#include "print.h" +#include "gpio.h" + +#ifndef OPTIC_ROTATED +# define OPTIC_ROTATED false +#endif + +// Definitions for the ADNS serial line. +#ifndef ADNS_SCLK_PIN +# define ADNS_SCLK_PIN B7 +#endif + +#ifndef ADNS_SDIO_PIN +# define ADNS_SDIO_PIN C6 +#endif + +#ifndef ADNS_CS_PIN +# define ADNS_CS_PIN B4 +#endif + +#ifdef CONSOLE_ENABLE +void print_byte(uint8_t byte) { dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); } +#endif + +// Initialize the ADNS serial pins. +void adns_init(void) { + setPinOutput(ADNS_SCLK_PIN); + setPinOutput(ADNS_SDIO_PIN); + setPinOutput(ADNS_CS_PIN); +} + +// Perform a synchronization with the ADNS. +// Just as with the serial protocol, this is used by the slave to send a +// synchronization signal to the master. +void adns_sync(void) { + writePinLow(ADNS_CS_PIN); + wait_us(1); + writePinHigh(ADNS_CS_PIN); +} + +void adns_cs_select(void) { + writePinLow(ADNS_CS_PIN); +} + +void adns_cs_deselect(void) { + writePinHigh(ADNS_CS_PIN); +} + +uint8_t adns_serial_read(void) { + setPinInput(ADNS_SDIO_PIN); + uint8_t byte = 0; + + for (uint8_t i = 0; i < 8; ++i) { + writePinLow(ADNS_SCLK_PIN); + wait_us(1); + + byte = (byte << 1) | readPin(ADNS_SDIO_PIN); + + writePinHigh(ADNS_SCLK_PIN); + wait_us(1); + } + + return byte; +} + +void adns_serial_write(uint8_t data) { + setPinOutput(ADNS_SDIO_PIN); + + for (int8_t b = 7; b >= 0; b--) { + writePinLow(ADNS_SCLK_PIN); + + if (data & (1 << b)) + writePinHigh(ADNS_SDIO_PIN); + else + writePinLow(ADNS_SDIO_PIN); + + wait_us(2); + + writePinHigh(ADNS_SCLK_PIN); + } + + // tSWR. See page 15 of the ADNS spec sheet. + // Technically, this is only necessary if the next operation is an SDIO + // read. This is not guaranteed to be the case, but we're being lazy. + wait_us(4); + + // Note that tSWW is never necessary. All write operations require at + // least 32us, which exceeds tSWW, so there's never a need to wait for it. +} + +// Read a byte of data from a register on the ADNS. +// Don't forget to use the register map (as defined in the header file). +uint8_t adns_read_reg(uint8_t reg_addr) { + adns_cs_select(); + + adns_serial_write(reg_addr); + + // We don't need a minimum tSRAD here. That's because a 4ms wait time is + // already included in adns_serial_write(), so we're good. + // See page 10 and 15 of the ADNS spec sheet. + //wait_us(4); + + uint8_t byte = adns_serial_read(); + + // tSRW & tSRR. See page 15 of the ADNS spec sheet. + // Technically, this is only necessary if the next operation is an SDIO + // read or write. This is not guaranteed to be the case. + // Honestly, this wait could probably be removed. + wait_us(1); + + adns_cs_deselect(); + + return byte; +} + +void adns_write_reg(uint8_t reg_addr, uint8_t data) { + adns_cs_select(); + adns_serial_write( 0b10000000 | reg_addr ); + adns_serial_write(data); + adns_cs_deselect(); +} + +report_adns_t adns_read_burst(void) { + adns_cs_select(); + + report_adns_t data; + data.dx = 0; + data.dy = 0; + + adns_serial_write(REG_MOTION_BURST); + + // We don't need a minimum tSRAD here. That's because a 4ms wait time is + // already included in adns_serial_write(), so we're good. + // See page 10 and 15 of the ADNS spec sheet. + //wait_us(4); + + uint8_t x = adns_serial_read(); + uint8_t y = adns_serial_read(); + + // Burst mode returns a bunch of other shit that we don't really need. + // Setting CS to high ends burst mode early. + adns_cs_deselect(); + + data.dx = convert_twoscomp(x); + data.dy = convert_twoscomp(y); + + return data; +} + +// Convert a two's complement byte from an unsigned data type into a signed +// data type. +int8_t convert_twoscomp(uint8_t data) { + if ((data & 0x80) == 0x80) + return -128 + (data & 0x7F); + else + return data; +} + +// Don't forget to use the definitions for CPI in the header file. +void adns_set_cpi(uint8_t cpi) { + adns_write_reg(REG_MOUSE_CONTROL2, cpi); +} + +bool adns_check_signature(void) { + uint8_t pid = adns_read_reg(REG_PRODUCT_ID); + uint8_t rid = adns_read_reg(REG_REVISION_ID); + uint8_t pid2 = adns_read_reg(REG_PRODUCT_ID2); + + return (pid == 0x12 && rid == 0x01 && pid2 == 0x26); +} diff --git a/drivers/sensors/adns5050.h b/drivers/sensors/adns5050.h new file mode 100644 index 0000000000..ff8e8f78e9 --- /dev/null +++ b/drivers/sensors/adns5050.h @@ -0,0 +1,79 @@ +/* Copyright 2021 Colin Lam (Ploopy Corporation) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * Copyright 2019 Sunjun Kim + * Copyright 2019 Hiroyuki Okada + * + * 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> + +// Registers +#define REG_PRODUCT_ID 0x00 +#define REG_REVISION_ID 0x01 +#define REG_MOTION 0x02 +#define REG_DELTA_X 0x03 +#define REG_DELTA_Y 0x04 +#define REG_SQUAL 0x05 +#define REG_SHUTTER_UPPER 0x06 +#define REG_SHUTTER_LOWER 0x07 +#define REG_MAXIMUM_PIXEL 0x08 +#define REG_PIXEL_SUM 0x09 +#define REG_MINIMUM_PIXEL 0x0a +#define REG_PIXEL_GRAB 0x0b +#define REG_MOUSE_CONTROL 0x0d +#define REG_MOUSE_CONTROL2 0x19 +#define REG_LED_DC_MODE 0x22 +#define REG_CHIP_RESET 0x3a +#define REG_PRODUCT_ID2 0x3e +#define REG_INV_REV_ID 0x3f +#define REG_MOTION_BURST 0x63 + +// CPI values +#define CPI125 0x11 +#define CPI250 0x12 +#define CPI375 0x13 +#define CPI500 0x14 +#define CPI625 0x15 +#define CPI750 0x16 +#define CPI875 0x17 +#define CPI1000 0x18 +#define CPI1125 0x19 +#define CPI1250 0x1a +#define CPI1375 0x1b + +#ifdef CONSOLE_ENABLE +void print_byte(uint8_t byte); +#endif + +typedef struct { + int8_t dx; + int8_t dy; +} report_adns_t; + +// A bunch of functions to implement the ADNS5050-specific serial protocol. +// Note that the "serial.h" driver is insufficient, because it does not +// manually manipulate a serial clock signal. +void adns_init(void); +void adns_sync(void); +uint8_t adns_serial_read(void); +void adns_serial_write(uint8_t data); +uint8_t adns_read_reg(uint8_t reg_addr); +void adns_write_reg(uint8_t reg_addr, uint8_t data); +report_adns_t adns_read_burst(void); +int8_t convert_twoscomp(uint8_t data); +void adns_set_cpi(uint8_t cpi); +bool adns_check_signature(void); diff --git a/drivers/sensors/adns9800.c b/drivers/sensors/adns9800.c new file mode 100644 index 0000000000..36213179f7 --- /dev/null +++ b/drivers/sensors/adns9800.c @@ -0,0 +1,219 @@ +/* Copyright 2020 Alexander Tulloh + * + * 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 "spi_master.h" +#include "quantum.h" +#include "adns9800_srom_A6.h" +#include "adns9800.h" + +// registers +#define REG_Product_ID 0x00 +#define REG_Revision_ID 0x01 +#define REG_Motion 0x02 +#define REG_Delta_X_L 0x03 +#define REG_Delta_X_H 0x04 +#define REG_Delta_Y_L 0x05 +#define REG_Delta_Y_H 0x06 +#define REG_SQUAL 0x07 +#define REG_Pixel_Sum 0x08 +#define REG_Maximum_Pixel 0x09 +#define REG_Minimum_Pixel 0x0a +#define REG_Shutter_Lower 0x0b +#define REG_Shutter_Upper 0x0c +#define REG_Frame_Period_Lower 0x0d +#define REG_Frame_Period_Upper 0x0e +#define REG_Configuration_I 0x0f +#define REG_Configuration_II 0x10 +#define REG_Frame_Capture 0x12 +#define REG_SROM_Enable 0x13 +#define REG_Run_Downshift 0x14 +#define REG_Rest1_Rate 0x15 +#define REG_Rest1_Downshift 0x16 +#define REG_Rest2_Rate 0x17 +#define REG_Rest2_Downshift 0x18 +#define REG_Rest3_Rate 0x19 +#define REG_Frame_Period_Max_Bound_Lower 0x1a +#define REG_Frame_Period_Max_Bound_Upper 0x1b +#define REG_Frame_Period_Min_Bound_Lower 0x1c +#define REG_Frame_Period_Min_Bound_Upper 0x1d +#define REG_Shutter_Max_Bound_Lower 0x1e +#define REG_Shutter_Max_Bound_Upper 0x1f +#define REG_LASER_CTRL0 0x20 +#define REG_Observation 0x24 +#define REG_Data_Out_Lower 0x25 +#define REG_Data_Out_Upper 0x26 +#define REG_SROM_ID 0x2a +#define REG_Lift_Detection_Thr 0x2e +#define REG_Configuration_V 0x2f +#define REG_Configuration_IV 0x39 +#define REG_Power_Up_Reset 0x3a +#define REG_Shutdown 0x3b +#define REG_Inverse_Product_ID 0x3f +#define REG_Motion_Burst 0x50 +#define REG_SROM_Load_Burst 0x62 +#define REG_Pixel_Burst 0x64 + +#define ADNS_CLOCK_SPEED 2000000 +#define MIN_CPI 200 +#define MAX_CPI 8200 +#define CPI_STEP 200 +#define CLAMP_CPI(value) value < MIN_CPI ? MIN_CPI : value > MAX_CPI ? MAX_CPI : value +#define SPI_MODE 3 +#define SPI_DIVISOR (F_CPU / ADNS_CLOCK_SPEED) +#define US_BETWEEN_WRITES 120 +#define US_BETWEEN_READS 20 +#define US_BEFORE_MOTION 100 +#define MSB1 0x80 + +extern const uint16_t adns_firmware_length; +extern const uint8_t adns_firmware_data[]; + +void adns_spi_start(void){ + spi_start(SPI_SS_PIN, false, SPI_MODE, SPI_DIVISOR); +} + +void adns_write(uint8_t reg_addr, uint8_t data){ + + adns_spi_start(); + spi_write(reg_addr | MSB1); + spi_write(data); + spi_stop(); + wait_us(US_BETWEEN_WRITES); +} + +uint8_t adns_read(uint8_t reg_addr){ + + adns_spi_start(); + spi_write(reg_addr & 0x7f ); + uint8_t data = spi_read(); + spi_stop(); + wait_us(US_BETWEEN_READS); + + return data; +} + +void adns_init() { + + setPinOutput(SPI_SS_PIN); + + spi_init(); + + // reboot + adns_write(REG_Power_Up_Reset, 0x5a); + wait_ms(50); + + // read registers and discard + adns_read(REG_Motion); + adns_read(REG_Delta_X_L); + adns_read(REG_Delta_X_H); + adns_read(REG_Delta_Y_L); + adns_read(REG_Delta_Y_H); + + // upload firmware + + // 3k firmware mode + adns_write(REG_Configuration_IV, 0x02); + + // enable initialisation + adns_write(REG_SROM_Enable, 0x1d); + + // wait a frame + wait_ms(10); + + // start SROM download + adns_write(REG_SROM_Enable, 0x18); + + // write the SROM file + + adns_spi_start(); + + spi_write(REG_SROM_Load_Burst | 0x80); + wait_us(15); + + // send all bytes of the firmware + unsigned char c; + for(int i = 0; i < adns_firmware_length; i++){ + c = (unsigned char)pgm_read_byte(adns_firmware_data + i); + spi_write(c); + wait_us(15); + } + + spi_stop(); + + wait_ms(10); + + // enable laser + uint8_t laser_ctrl0 = adns_read(REG_LASER_CTRL0); + adns_write(REG_LASER_CTRL0, laser_ctrl0 & 0xf0); +} + +config_adns_t adns_get_config(void) { + uint8_t config_1 = adns_read(REG_Configuration_I); + return (config_adns_t){ (config_1 & 0xFF) * CPI_STEP }; +} + +void adns_set_config(config_adns_t config) { + uint8_t config_1 = (CLAMP_CPI(config.cpi) / CPI_STEP) & 0xFF; + adns_write(REG_Configuration_I, config_1); +} + +static int16_t convertDeltaToInt(uint8_t high, uint8_t low){ + + // join bytes into twos compliment + uint16_t twos_comp = (high << 8) | low; + + // convert twos comp to int + if (twos_comp & 0x8000) + return -1 * (~twos_comp + 1); + + return twos_comp; +} + +report_adns_t adns_get_report(void) { + + report_adns_t report = {0, 0}; + + adns_spi_start(); + + // start burst mode + spi_write(REG_Motion_Burst & 0x7f); + + wait_us(US_BEFORE_MOTION); + + uint8_t motion = spi_read(); + + if(motion & 0x80) { + + // clear observation register + spi_read(); + + // delta registers + uint8_t delta_x_l = spi_read(); + uint8_t delta_x_h = spi_read(); + uint8_t delta_y_l = spi_read(); + uint8_t delta_y_h = spi_read(); + + report.x = convertDeltaToInt(delta_x_h, delta_x_l); + report.y = convertDeltaToInt(delta_y_h, delta_y_l); + } + + // clear residual motion + spi_write(REG_Motion & 0x7f); + + spi_stop(); + + return report; +} diff --git a/drivers/sensors/adns9800.h b/drivers/sensors/adns9800.h new file mode 100644 index 0000000000..2f50b8f1be --- /dev/null +++ b/drivers/sensors/adns9800.h @@ -0,0 +1,35 @@ +/* Copyright 2020 Alexander Tulloh + * + * 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> + +typedef struct { + /* 200 - 8200 CPI supported */ + uint16_t cpi; +} config_adns_t; + +typedef struct { + int16_t x; + int16_t y; +} report_adns_t; + +void adns_init(void); +config_adns_t adns_get_config(void); +void adns_set_config(config_adns_t); +/* Reads and clears the current delta values on the ADNS sensor */ +report_adns_t adns_get_report(void); diff --git a/drivers/sensors/adns9800_srom_A6.h b/drivers/sensors/adns9800_srom_A6.h new file mode 100644 index 0000000000..f5b3abeb62 --- /dev/null +++ b/drivers/sensors/adns9800_srom_A6.h @@ -0,0 +1,3078 @@ +#pragma once + +#include "progmem.h" + +const uint16_t adns_firmware_length = 3070; + +const uint8_t adns_firmware_data[] PROGMEM = { +0x03, +0xa6, +0x68, +0x1e, +0x7d, +0x10, +0x7e, +0x7e, +0x5f, +0x1c, +0xb8, +0xf2, +0x47, +0x0c, +0x7b, +0x74, +0x4b, +0x14, +0x8b, +0x75, +0x66, +0x51, +0x0b, +0x8c, +0x76, +0x74, +0x4b, +0x14, +0xaa, +0xd6, +0x0f, +0x9c, +0xba, +0xf6, +0x6e, +0x3f, +0xdd, +0x38, +0xd5, +0x02, +0x80, +0x9b, +0x82, +0x6d, +0x58, +0x13, +0xa4, +0xab, +0xb5, +0xc9, +0x10, +0xa2, +0xc6, +0x0a, +0x7f, +0x5d, +0x19, +0x91, +0xa0, +0xa3, +0xce, +0xeb, +0x3e, +0xc9, +0xf1, +0x60, +0x42, +0xe7, +0x4c, +0xfb, +0x74, +0x6a, +0x56, +0x2e, +0xbf, +0xdd, +0x38, +0xd3, +0x05, +0x88, +0x92, +0xa6, +0xce, +0xff, +0x5d, +0x38, +0xd1, +0xcf, +0xef, +0x58, +0xcb, +0x65, +0x48, +0xf0, +0x35, +0x85, +0xa9, +0xb2, +0x8f, +0x5e, +0xf3, +0x80, +0x94, +0x97, +0x7e, +0x75, +0x97, +0x87, +0x73, +0x13, +0xb0, +0x8a, +0x69, +0xd4, +0x0a, +0xde, +0xc1, +0x79, +0x59, +0x36, +0xdb, +0x9d, +0xd6, +0xb8, +0x15, +0x6f, +0xce, +0x3c, +0x72, +0x32, +0x45, +0x88, +0xdf, +0x6c, +0xa5, +0x6d, +0xe8, +0x76, +0x96, +0x14, +0x74, +0x20, +0xdc, +0xf4, +0xfa, +0x37, +0x6a, +0x27, +0x32, +0xe3, +0x29, +0xbf, +0xc4, +0xc7, +0x06, +0x9d, +0x58, +0xe7, +0x87, +0x7c, +0x2e, +0x9f, +0x6e, +0x49, +0x07, +0x5d, +0x23, +0x64, +0x54, +0x83, +0x6e, +0xcb, +0xb7, +0x77, +0xf7, +0x2b, +0x6e, +0x0f, +0x2e, +0x66, +0x12, +0x60, +0x55, +0x65, +0xfc, +0x43, +0xb3, +0x58, +0x73, +0x5b, +0xe8, +0x67, +0x04, +0x43, +0x02, +0xde, +0xb3, +0x89, +0xa0, +0x6d, +0x3a, +0x27, +0x79, +0x64, +0x5b, +0x0c, +0x16, +0x9e, +0x66, +0xb1, +0x8b, +0x87, +0x0c, +0x5d, +0xf2, +0xb6, +0x3d, +0x71, +0xdf, +0x42, +0x03, +0x8a, +0x06, +0x8d, +0xef, +0x1d, +0xa8, +0x96, +0x5c, +0xed, +0x31, +0x61, +0x5c, +0xa1, +0x34, +0xf6, +0x8c, +0x08, +0x60, +0x33, +0x07, +0x00, +0x3e, +0x79, +0x95, +0x1b, +0x43, +0x7f, +0xfe, +0xb6, +0xa6, +0xd4, +0x9d, +0x76, +0x72, +0xbf, +0xad, +0xc0, +0x15, +0xe8, +0x37, +0x31, +0xa3, +0x72, +0x63, +0x52, +0x1d, +0x1c, +0x5d, +0x51, +0x1b, +0xe1, +0xa9, +0xed, +0x60, +0x32, +0x3e, +0xa9, +0x50, +0x28, +0x53, +0x06, +0x59, +0xe2, +0xfc, +0xe7, +0x02, +0x64, +0x39, +0x21, +0x56, +0x4a, +0xa5, +0x40, +0x80, +0x81, +0xd5, +0x5a, +0x60, +0x7b, +0x68, +0x84, +0xf1, +0xe0, +0xb1, +0xb6, +0x5b, +0xdf, +0xa8, +0x1d, +0x6d, +0x65, +0x20, +0xc0, +0xa2, +0xb9, +0xd9, +0xbb, +0x00, +0xa6, +0xdb, +0x8b, +0x01, +0x53, +0x91, +0xfe, +0xc4, +0x51, +0x85, +0xb0, +0x96, +0x7f, +0xfd, +0x51, +0xdd, +0x14, +0x03, +0x67, +0x2e, +0x75, +0x1c, +0x76, +0xd3, +0x6e, +0xdd, +0x99, +0x55, +0x76, +0xe5, +0xab, +0x23, +0xfc, +0x4a, +0xd5, +0xc6, +0xe8, +0x2e, +0xca, +0x8a, +0xb3, +0xf6, +0x8c, +0x6c, +0xb0, +0xe9, +0xf2, +0xe7, +0x9e, +0x69, +0x41, +0xed, +0xf1, +0x6d, +0xd2, +0x86, +0xd8, +0x7e, +0xcb, +0x5d, +0x47, +0x6c, +0x85, +0x6a, +0x23, +0xed, +0x20, +0x40, +0x93, +0xb4, +0x20, +0xc7, +0xa5, +0xc9, +0xaf, +0x03, +0x15, +0xac, +0x19, +0xe5, +0x2a, +0x36, +0xdf, +0x6d, +0xc5, +0x8c, +0x80, +0x07, +0xce, +0x92, +0x0c, +0xd8, +0x06, +0x62, +0x0f, +0xdd, +0x48, +0x46, +0x1a, +0x53, +0xc7, +0x8a, +0x8c, +0x5d, +0x5d, +0xb4, +0xa1, +0x02, +0xd3, +0xa9, +0xb8, +0xf3, +0x94, +0x8f, +0x3f, +0xe5, +0x54, +0xd4, +0x11, +0x65, +0xb2, +0x5e, +0x09, +0x0b, +0x81, +0xe3, +0x75, +0xa7, +0x89, +0x81, +0x39, +0x6c, +0x46, +0xf6, +0x06, +0x9f, +0x27, +0x3b, +0xb6, +0x2d, +0x5f, +0x1d, +0x4b, +0xd4, +0x7b, +0x1d, +0x61, +0x74, +0x89, +0xe4, +0xe3, +0xbd, +0x98, +0x1b, +0xc4, +0x51, +0x3b, +0xa4, +0xfa, +0xe0, +0x92, +0xf7, +0xbe, +0xf2, +0x4d, +0xbb, +0xff, +0xad, +0x4f, +0x6d, +0x68, +0xc2, +0x79, +0x40, +0xaa, +0x9b, +0x8f, +0x0c, +0x32, +0x4b, +0x5f, +0x3e, +0xab, +0x59, +0x98, +0xb3, +0xf5, +0x1d, +0xac, +0x5e, +0xbc, +0x78, +0xd3, +0x01, +0x6c, +0x64, +0x15, +0x2f, +0xd8, +0x71, +0xa6, +0x2d, +0x45, +0xe1, +0x22, +0x42, +0xe4, +0x4e, +0x04, +0x3c, +0x7d, +0xf4, +0x40, +0x21, +0xb4, +0x67, +0x05, +0xa8, +0xe2, +0xf3, +0x72, +0x87, +0x4c, +0x7d, +0xd9, +0x1b, +0x65, +0x97, +0xf3, +0xc2, +0xe3, +0xe4, +0xc8, +0xd2, +0xde, +0xf6, +0xef, +0xdc, +0xbb, +0x44, +0x08, +0x5e, +0xe2, +0x45, +0x27, +0x01, +0xb0, +0xf6, +0x43, +0xe7, +0x3a, +0xf6, +0xdc, +0x9d, +0xed, +0xf3, +0xc5, +0x0c, +0xb8, +0x9c, +0x98, +0x3a, +0xd8, +0x36, +0xee, +0x96, +0x72, +0x67, +0xe7, +0x81, +0x91, +0xd5, +0x05, +0x0a, +0xe0, +0x82, +0xd5, +0x8f, +0xe8, +0xf9, +0xb0, +0xc9, +0xcf, +0x93, +0xe7, +0x04, +0xc5, +0xbc, +0x2b, +0x43, +0x56, +0x7e, +0xe8, +0x67, +0x7c, +0xe5, +0xfb, +0x49, +0xad, +0x5e, +0x9f, +0x25, +0x13, +0xde, +0x6e, +0x6e, +0xe9, +0xf1, +0xec, +0x87, +0x0b, +0x59, +0x81, +0x76, +0x84, +0x76, +0xb3, +0x24, +0xaf, +0x30, +0xfd, +0x27, +0x8b, +0xab, +0xd8, +0x00, +0x8b, +0x9b, +0x0c, +0xd2, +0xb2, +0x4e, +0x5e, +0x9d, +0x1d, +0x96, +0x01, +0x00, +0x67, +0xc1, +0x5f, +0x02, +0x20, +0xfd, +0x45, +0x6a, +0x01, +0x60, +0x58, +0x45, +0xca, +0x47, +0x21, +0x90, +0x5a, +0xc4, +0x43, +0x26, +0x1a, +0xd7, +0xa5, +0x4a, +0xb2, +0x5d, +0x2b, +0x35, +0x49, +0xfb, +0xa5, +0x17, +0x92, +0x21, +0x1e, +0x93, +0x96, +0x67, +0xa2, +0x7e, +0x36, +0x7a, +0xde, +0x5f, +0xbe, +0x7a, +0x58, +0x9d, +0xf8, +0x78, +0xa3, +0xfa, +0xc8, +0xd5, +0x17, +0xf0, +0x21, +0x97, +0x8c, +0x80, +0xb5, +0x4b, +0x3b, +0xbd, +0xbb, +0x41, +0x21, +0xa8, +0x50, +0x67, +0xf7, +0xe7, +0x19, +0x80, +0x10, +0x8e, +0xce, +0x04, +0x18, +0x3f, +0x51, +0x6b, +0x77, +0xd8, +0x9e, +0x16, +0xaf, +0xec, +0xef, +0x48, +0x16, +0x4d, +0x9e, +0x85, +0x38, +0x18, +0x3e, +0xd4, +0x28, +0x87, +0x60, +0x2a, +0xf6, +0x7f, +0x09, +0x86, +0x6f, +0x9c, +0x3c, +0x3a, +0xff, +0xab, +0xd0, +0x61, +0xa2, +0x97, +0x0d, +0x71, +0x94, +0x7e, +0xfd, +0xb9, +0x80, +0x02, +0x89, +0x6a, +0xb3, +0x84, +0x6c, +0x2a, +0x77, +0x62, +0xbe, +0x0b, +0xf4, +0xaf, +0xac, +0x7b, +0x7c, +0x8e, +0xca, +0x01, +0xba, +0x71, +0x78, +0x94, +0xfd, +0xb5, +0x39, +0xa4, +0x4d, +0x2f, +0x78, +0xcf, +0xca, +0x92, +0x0c, +0x1a, +0x99, +0x48, +0x4c, +0x11, +0x96, +0xb5, +0x4e, +0x41, +0x28, +0xe4, +0xa6, +0xfe, +0x4b, +0x72, +0x91, +0xe7, +0xd4, +0xdd, +0x9f, +0x12, +0xe6, +0x29, +0x38, +0xce, +0x45, +0xae, +0x02, +0xb8, +0x24, +0xae, +0xbd, +0xe9, +0x66, +0x08, +0x62, +0xa2, +0x2c, +0x2b, +0x00, +0xe2, +0x23, +0xd9, +0xc4, +0x48, +0xe4, +0xd3, +0xac, +0xbb, +0x34, +0xc7, +0xf0, +0xe3, +0x4f, +0xb9, +0x30, +0xea, +0xa2, +0x12, +0xf1, +0x30, +0x2c, +0x36, +0xde, +0x48, +0xf2, +0xb0, +0x4c, +0x43, +0x3f, +0x2e, +0x58, +0xe4, +0x20, +0xe3, +0x58, +0xcd, +0x31, +0x22, +0xf0, +0xa2, +0x2a, +0xe6, +0x19, +0x90, +0x55, +0x86, +0xf6, +0x55, +0x79, +0xd1, +0xd7, +0x46, +0x2f, +0xc0, +0xdc, +0x99, +0xe8, +0xf3, +0x6a, +0xdf, +0x7f, +0xeb, +0x24, +0x4a, +0x1e, +0x5a, +0x75, +0xde, +0x2f, +0x5c, +0x19, +0x61, +0x03, +0x53, +0x54, +0x6a, +0x3b, +0x18, +0x70, +0xb6, +0x4f, +0xf1, +0x9c, +0x0a, +0x59, +0x9d, +0x19, +0x92, +0x65, +0x8c, +0x83, +0x14, +0x2d, +0x44, +0x8a, +0x75, +0xa9, +0xf5, +0x90, +0xd2, +0x66, +0x4e, +0xfa, +0x69, +0x0f, +0x5b, +0x0b, +0x98, +0x65, +0xc8, +0x11, +0x42, +0x59, +0x7f, +0xdd, +0x1b, +0x75, +0x17, +0x31, +0x4c, +0x75, +0x58, +0xeb, +0x58, +0x63, +0x7d, +0xf2, +0xa6, +0xc2, +0x6e, +0xb7, +0x3f, +0x3e, +0x5e, +0x47, +0xad, +0xb7, +0x04, +0xe8, +0x05, +0xf8, +0xb2, +0xcf, +0x19, +0xf3, +0xd2, +0x85, +0xfe, +0x3e, +0x3e, +0xb1, +0x62, +0x08, +0x2c, +0x10, +0x07, +0x0d, +0x73, +0x90, +0x17, +0xfa, +0x9b, +0x56, +0x02, +0x75, +0xf9, +0x51, +0xe0, +0xe9, +0x1a, +0x7b, +0x9f, +0xb3, +0xf3, +0x98, +0xb8, +0x1c, +0x9c, +0xe1, +0xd5, +0x35, +0xae, +0xc8, +0x60, +0x48, +0x11, +0x09, +0x94, +0x6b, +0xd0, +0x8b, +0x15, +0xbc, +0x05, +0x68, +0xd3, +0x54, +0x8a, +0x51, +0x39, +0x5c, +0x42, +0x76, +0xce, +0xd8, +0xad, +0x89, +0x30, +0xc9, +0x05, +0x1c, +0xcc, +0x94, +0x3f, +0x0f, +0x90, +0x6f, +0x72, +0x2d, +0x85, +0x64, +0x9a, +0xb9, +0x23, +0xf9, +0x0b, +0xc3, +0x7c, +0x39, +0x0f, +0x97, +0x07, +0x97, +0xda, +0x58, +0x48, +0x33, +0x05, +0x23, +0xb8, +0x82, +0xe8, +0xd3, +0x53, +0x89, +0xaf, +0x33, +0x80, +0x22, +0x84, +0x0c, +0x95, +0x5c, +0x67, +0xb8, +0x77, +0x0c, +0x5c, +0xa2, +0x5f, +0x3d, +0x58, +0x0f, +0x27, +0xf3, +0x2f, +0xae, +0x48, +0xbd, +0x0b, +0x6f, +0x54, +0xfb, +0x67, +0x4c, +0xea, +0x32, +0x27, +0xf1, +0xfa, +0xe2, +0xb0, +0xec, +0x0b, +0x15, +0xb4, +0x70, +0xf6, +0x5c, +0xdd, +0x71, +0x60, +0xc3, +0xc1, +0xa8, +0x32, +0x65, +0xac, +0x7a, +0x77, +0x41, +0xe5, +0xa9, +0x6b, +0x11, +0x81, +0xfa, +0x34, +0x8d, +0xfb, +0xc1, +0x80, +0x6e, +0xc4, +0x60, +0x30, +0x07, +0xd4, +0x8b, +0x67, +0xbd, +0xaa, +0x8c, +0x9c, +0x64, +0xac, +0xdb, +0x0b, +0x24, +0x8b, +0x63, +0x6f, +0xe6, +0xbc, +0xe7, +0x33, +0xa4, +0x4a, +0x4c, +0xa7, +0x9f, +0x43, +0x53, +0xd2, +0xbb, +0x8f, +0x43, +0xc7, +0x3d, +0x78, +0x68, +0x3f, +0xa5, +0x3d, +0xca, +0x69, +0x84, +0xa6, +0x97, +0x2d, +0xc0, +0x7d, +0x31, +0x34, +0x55, +0x1d, +0x07, +0xb1, +0x5f, +0x40, +0x5c, +0x93, +0xb0, +0xbc, +0x7c, +0xb0, +0xbc, +0xe7, +0x12, +0xee, +0x6b, +0x2b, +0xd3, +0x4d, +0x67, +0x70, +0x3a, +0x9a, +0xf2, +0x3c, +0x7c, +0x81, +0xfa, +0xd7, +0xd9, +0x90, +0x91, +0x81, +0xb8, +0xb1, +0xf3, +0x48, +0x6a, +0x26, +0x4f, +0x0c, +0xce, +0xb0, +0x9e, +0xfd, +0x4a, +0x3a, +0xaf, +0xac, +0x5b, +0x3f, +0xbf, +0x44, +0x5a, +0xa3, +0x19, +0x1e, +0x4b, +0xe7, +0x36, +0x6a, +0xd7, +0x20, +0xae, +0xd7, +0x7d, +0x3b, +0xe7, +0xff, +0x3a, +0x86, +0x2e, +0xd0, +0x4a, +0x3e, +0xaf, +0x9f, +0x8e, +0x01, +0xbf, +0xf8, +0x4f, +0xc1, +0xe8, +0x6f, +0x74, +0xe1, +0x45, +0xd3, +0xf7, +0x04, +0x6a, +0x4b, +0x9d, +0xec, +0x33, +0x27, +0x76, +0xd7, +0xc5, +0xe1, +0xb0, +0x3b, +0x0e, +0x23, +0xec, +0xf0, +0x86, +0xd2, +0x1a, +0xbf, +0x3d, +0x04, +0x62, +0xb3, +0x6c, +0xb2, +0xeb, +0x17, +0x05, +0xa6, +0x0a, +0x8a, +0x7e, +0x83, +0x1c, +0xb6, +0x37, +0x09, +0xc6, +0x0b, +0x70, +0x3c, +0xb5, +0x93, +0x81, +0xd8, +0x93, +0xa0, +0x5f, +0x1e, +0x08, +0xe2, +0xc6, +0xe5, +0xc9, +0x72, +0xf1, +0xf1, +0xc1, +0xed, +0xd5, +0x58, +0x93, +0x83, +0xf8, +0x65, +0x67, +0x2e, +0x0d, +0xa9, +0xf1, +0x64, +0x12, +0xe6, +0x4c, +0xea, +0x15, +0x3f, +0x8c, +0x1a, +0xb6, +0xbf, +0xf6, +0xb9, +0x52, +0x35, +0x09, +0xb0, +0xe6, +0xf7, +0xcd, +0xf1, +0xa5, +0xaa, +0x81, +0xd1, +0x81, +0x6f, +0xb4, +0xa9, +0x66, +0x1f, +0xfc, +0x48, +0xc0, +0xb6, +0xd1, +0x8b, +0x06, +0x2f, +0xf6, +0xef, +0x1f, +0x0a, +0xe6, +0xce, +0x3a, +0x4a, +0x55, +0xbf, +0x6d, +0xf9, +0x4d, +0xd4, +0x08, +0x45, +0x4b, +0xc3, +0x66, +0x19, +0x92, +0x10, +0xe1, +0x17, +0x8e, +0x28, +0x91, +0x16, +0xbf, +0x3c, +0xee, +0xa3, +0xa6, +0x99, +0x92, +0x10, +0xe1, +0xf6, +0xcc, +0xac, +0xb8, +0x65, +0x0b, +0x43, +0x66, +0xf8, +0xe3, +0xe5, +0x3f, +0x24, +0x89, +0x47, +0x5d, +0x78, +0x43, +0xd0, +0x61, +0x17, +0xbd, +0x5b, +0x64, +0x54, +0x08, +0x45, +0x59, +0x93, +0xf6, +0x95, +0x8a, +0x41, +0x51, +0x62, +0x4b, +0x51, +0x02, +0x30, +0x73, +0xc7, +0x87, +0xc5, +0x4b, +0xa2, +0x97, +0x0f, +0xe8, +0x46, +0x5f, +0x7e, +0x2a, +0xe1, +0x30, +0x20, +0xb0, +0xfa, +0xe7, +0xce, +0x61, +0x42, +0x57, +0x6e, +0x21, +0xf3, +0x7a, +0xec, +0xe3, +0x25, +0xc7, +0x25, +0xf3, +0x67, +0xa7, +0x57, +0x40, +0x00, +0x02, +0xcf, +0x1c, +0x80, +0x77, +0x67, +0xbd, +0x70, +0xa1, +0x19, +0x92, +0x31, +0x75, +0x93, +0x27, +0x27, +0xb6, +0x82, +0xe4, +0xeb, +0x1d, +0x78, +0x48, +0xe7, +0xa5, +0x5e, +0x57, +0xef, +0x64, +0x28, +0x64, +0x1b, +0xf6, +0x11, +0xb2, +0x03, +0x9d, +0xb9, +0x18, +0x02, +0x27, +0xf7, +0xbe, +0x9d, +0x55, +0xfc, +0x00, +0xd2, +0xc7, +0xae, +0xad, +0x0b, +0xc5, +0xe9, +0x42, +0x41, +0x48, +0xd8, +0x32, +0xcf, +0xf6, +0x0f, +0xf5, +0xbc, +0x97, +0xc6, +0x99, +0x47, +0x76, +0xbd, +0x89, +0x06, +0x0f, +0x63, +0x0c, +0x51, +0xd4, +0x5e, +0xea, +0x48, +0xa8, +0xa2, +0x56, +0x1c, +0x79, +0x84, +0x86, +0x40, +0x88, +0x41, +0x76, +0x55, +0xfc, +0xc2, +0xd7, +0xfd, +0xc9, +0xc7, +0x80, +0x61, +0x35, +0xa7, +0x43, +0x20, +0xf7, +0xeb, +0x6c, +0x66, +0x13, +0xb0, +0xec, +0x02, +0x75, +0x3e, +0x4b, +0xaf, +0xb9, +0x5d, +0x40, +0xda, +0xd6, +0x6e, +0x2d, +0x39, +0x54, +0xc2, +0x95, +0x35, +0x54, +0x25, +0x72, +0xe1, +0x78, +0xb8, +0xeb, +0xc1, +0x16, +0x58, +0x0f, +0x9c, +0x9b, +0xb4, +0xea, +0x37, +0xec, +0x3b, +0x11, +0xba, +0xd5, +0x8a, +0xa9, +0xe3, +0x98, +0x00, +0x51, +0x1c, +0x14, +0xe0, +0x40, +0x96, +0xe5, +0xe9, +0xf2, +0x21, +0x22, +0xb1, +0x23, +0x60, +0x78, +0xd3, +0x17, +0xf8, +0x7a, +0xa5, +0xa8, +0xba, +0x20, +0xd3, +0x15, +0x1e, +0x32, +0xe4, +0x5e, +0x15, +0x48, +0xae, +0xa9, +0xe5, +0xb8, +0x33, +0xec, +0xe8, +0xa2, +0x42, +0xac, +0xbf, +0x10, +0x84, +0x53, +0x87, +0x19, +0xb4, +0x5f, +0x76, +0x4d, +0x01, +0x9d, +0x56, +0x74, +0xd9, +0x5c, +0x97, +0xe7, +0x88, +0xea, +0x3a, +0xbf, +0xdc, +0x4c, +0x33, +0x8a, +0x16, +0xb9, +0x5b, +0xfa, +0xd8, +0x42, +0xa7, +0xbb, +0x3c, +0x04, +0x27, +0x78, +0x49, +0x81, +0x2a, +0x5a, +0x7d, +0x7c, +0x23, +0xa8, +0xba, +0xf7, +0x9a, +0x9f, +0xd2, +0x66, +0x3e, +0x38, +0x3c, +0x75, +0xf9, +0xd1, +0x30, +0x26, +0x30, +0x6e, +0x5a, +0x6e, +0xdc, +0x6a, +0x69, +0x32, +0x50, +0x33, +0x47, +0x9e, +0xa4, +0xa8, +0x64, +0x66, +0xf0, +0x8a, +0xe4, +0xfd, +0x27, +0x6f, +0x51, +0x25, +0x8b, +0x43, +0x74, +0xc9, +0x8e, +0xbd, +0x88, +0x31, +0xbe, +0xec, +0x65, +0xd2, +0xcb, +0x8d, +0x5a, +0x13, +0x48, +0x16, +0x8c, +0x61, +0x0b, +0x11, +0xf6, +0xc6, +0x66, +0xae, +0xc3, +0xcc, +0x0c, +0xd2, +0xe1, +0x9f, +0x82, +0x41, +0x3f, +0x56, +0xf9, +0x73, +0xef, +0xdc, +0x30, +0x50, +0xcf, +0xb6, +0x7f, +0xbc, +0xd0, +0xb3, +0x10, +0xab, +0x24, +0xe4, +0xec, +0xad, +0x18, +0x8c, +0x39, +0x2d, +0x30, +0x4c, +0xc5, +0x40, +0x0d, +0xf6, +0xac, +0xd6, +0x18, +0x5d, +0x96, +0xbf, +0x5f, +0x71, +0x75, +0x96, +0x22, +0x97, +0x0f, +0x02, +0x94, +0x6e, +0xa6, +0xae, +0x6d, +0x8f, +0x1e, +0xca, +0x12, +0x9b, +0x2a, +0x1c, +0xce, +0xa9, +0xee, +0xfd, +0x12, +0x8e, +0xfc, +0xed, +0x09, +0x33, +0xba, +0xf4, +0x1a, +0x15, +0xf6, +0x9d, +0x87, +0x16, +0x43, +0x7c, +0x78, +0x57, +0xe1, +0x44, +0xc9, +0xeb, +0x1f, +0x58, +0x4d, +0xc1, +0x49, +0x11, +0x5c, +0xb2, +0x11, +0xa8, +0x55, +0x16, +0xf1, +0xc6, +0x50, +0xe9, +0x87, +0x89, +0xf6, +0xcf, +0xd8, +0x9c, +0x51, +0xa7, +0xbc, +0x5b, +0x31, +0x6d, +0x4d, +0x51, +0xd0, +0x4c, +0xbc, +0x0d, +0x58, +0x2d, +0x7b, +0x88, +0x7a, +0xf9, +0x8e, +0xd6, +0x40, +0x4d, +0xbb, +0xbe, +0xc4, +0xe5, +0x07, +0xfc, +0xd9, +0x7b, +0x6d, +0xa6, +0x42, +0x57, +0x8f, +0x02, +0x94, +0x4f, +0xe4, +0x2a, +0x65, +0xe2, +0x19, +0x5a, +0x50, +0xe1, +0x25, +0x65, +0x4a, +0x60, +0xc2, +0xcd, +0xa8, +0xec, +0x05, +0x2e, +0x87, +0x7b, +0x95, +0xb7, +0x4f, +0xa0, +0x0b, +0x1b, +0x4a, +0x7f, +0x92, +0xc8, +0x90, +0xee, +0x89, +0x1e, +0x10, +0xd2, +0x85, +0xe4, +0x9f, +0x63, +0xc8, +0x12, +0xbb, +0x4e, +0xb8, +0xcf, +0x0a, +0xec, +0x18, +0x4e, +0xe6, +0x7c, +0xb3, +0x33, +0x26, +0xc7, +0x1f, +0xd2, +0x04, +0x23, +0xea, +0x07, +0x0c, +0x5f, +0x90, +0xbd, +0xa7, +0x6a, +0x0f, +0x4a, +0xd6, +0x10, +0x01, +0x3c, +0x12, +0x29, +0x2e, +0x96, +0xc0, +0x4d, +0xbb, +0xbe, +0xe5, +0xa7, +0x83, +0xd5, +0x6a, +0x3c, +0xe3, +0x5b, +0xb8, +0xf2, +0x5c, +0x6d, +0x1f, +0xa6, +0xf3, +0x12, +0x24, +0xf6, +0xd6, +0x3b, +0x10, +0x14, +0x09, +0x07, +0x82, +0xe8, +0x30, +0x6a, +0x99, +0xdc, +0x95, +0x01, +0x9c, +0xd4, +0x68, +0x3b, +0xca, +0x98, +0x12, +0xab, +0x77, +0x25, +0x15, +0x7d, +0x10, +0x32, +0x45, +0x98, +0xcd, +0x7a, +0xdf, +0x71, +0x8a, +0x75, +0xc1, +0x1c, +0xd4, +0x68, +0x25, +0xeb, +0xbb, +0x54, +0x27, +0x6f, +0x2a, +0xf7, +0xb9, +0x98, +0x03, +0x27, +0xde, +0x24, +0xa8, +0xbb, +0x98, +0xc2, +0x84, +0xff, +0x9b, +0x51, +0xd8, +0x53, +0x50, +0xda, +0xf5, +0x88, +0xaa, +0x87, +0x2f, +0xae, +0xd6, +0xea, +0x6b, +0xde, +0xc8, +0xd7, +0xa7, +0x28, +0x65, +0x81, +0xe8, +0xb2, +0x3b, +0x1d, +0x4f, +0x75, +0x8f, +0x9f, +0x7a, +0x74, +0x8e, +0xc1, +0x5f, +0x9a, +0xa8, +0x9d, +0xfa, +0x03, +0xa3, +0x71, +0x9b, +0x37, +0x6d, +0xd5, +0x0b, +0xf5, +0xe1, +0xa1, +0x1b, +0x01, +0x6a, +0xc6, +0x67, +0xaa, +0xea, +0x2c, +0x9d, +0xa4, +0xd2, +0x6e, +0xfc, +0xde, +0x2e, +0x7f, +0x94, +0x69, +0xe5, +0x4a, +0xe0, +0x01, +0x48, +0x3c, +0x6b, +0xf7, +0x1e, +0xb6, +0x0b, +0x5f, +0xf9, +0x2e, +0x07, +0xc5, +0xe8, +0xae, +0x37, +0x1b, +0xbc, +0x3c, +0xd8, +0xd5, +0x0b, +0x91, +0x9e, +0x80, +0x24, +0xf5, +0x06, +0x0c, +0x0e, +0x98, +0x07, +0x96, +0x2d, +0x19, +0xdc, +0x58, +0x93, +0xcc, +0xfb, +0x4e, +0xeb, +0xbd, +0x0f, +0xf5, +0xaf, +0x01, +0xfa, +0xf1, +0x7c, +0x43, +0x8c, +0xb8, +0x56, +0x3e, +0xbe, +0x77, +0x4e, +0x2b, +0xf7, +0xbb, +0xb7, +0x45, +0x47, +0xcd, +0xcc, +0xa6, +0x4c, +0x72, +0x7b, +0x6a, +0x2a, +0x70, +0x13, +0x07, +0xfd, +0xb8, +0x9c, +0x98, +0x3a, +0xd8, +0x23, +0x67, +0x5b, +0x34, +0xd5, +0x14, +0x0c, +0xab, +0x77, +0x1f, +0xf8, +0x3d, +0x5a, +0x9f, +0x92, +0xb7, +0x2c, +0xad, +0x31, +0xde, +0x61, +0x07, +0xb3, +0x6b, +0xf7, +0x38, +0x15, +0x95, +0x46, +0x14, +0x48, +0x53, +0x69, +0x52, +0x66, +0x07, +0x6d, +0x83, +0x71, +0x8a, +0x67, +0x25, +0x20, +0x0f, +0xfe, +0xd7, +0x02, +0xd7, +0x6e, +0x2c, +0xd2, +0x1a, +0x0a, +0x5d, +0xfd, +0x0f, +0x74, +0xe3, +0xa4, +0x36, +0x07, +0x9a, +0xdf, +0xd4, +0x79, +0xbf, +0xef, +0x59, +0xc0, +0x44, +0x52, +0x87, +0x9a, +0x6e, +0x1d, +0x0e, +0xee, +0xde, +0x2e, +0x1a, +0xa9, +0x8f, +0x3a, +0xc9, +0xba, +0xec, +0x99, +0x78, +0x2d, +0x55, +0x6b, +0x14, +0xc2, +0x06, +0xd5, +0xfc, +0x93, +0x53, +0x4d, +0x11, +0x8c, +0xf8, +0xfa, +0x79, +0x7c, +0xa6, +0x64, +0xae, +0x61, +0xb8, +0x7b, +0x94, +0x56, +0xa6, +0x39, +0x78, +0x9a, +0xe5, +0xc7, +0xdf, +0x18, +0x63, +0x23, +0x9c, +0xfa, +0x66, +0xbb, +0xb7, +0x5a, +0x27, +0x4c, +0xd1, +0xa1, +0x83, +0x22, +0xb3, +0x52, +0x49, +0x35, +0xb0, +0x22, +0x83, +0x59, +0x12, +0x00, +0x16, +0x98, +0xdd, +0xad, +0xc2, +0x94, +0xf9, +0xd3, +0x7b, +0x64, +0x7f, +0x44, +0x3e, +0x3c, +0x8b, +0x9a, +0x83, +0x9c, +0x69, +0x6b, +0xe4, +0xdf, +0x9f, +0xed, +0x54, +0x1f, +0xe5, +0x5d, +0x7a, +0x05, +0x82, +0xb3, +0xdd, +0xef, +0xfc, +0x53, +0x96, +0xb0, +0x2c, +0x5a, +0xf8, +0xdf, +0x9c, +0x8b, +0x16, +0x4e, +0xdf, +0xda, +0x4d, +0x09, +0x09, +0x69, +0x50, +0x03, +0x65, +0xd8, +0x73, +0x70, +0xe8, +0x86, +0xbf, +0xbb, +0x35, +0xce, +0xb2, +0x46, +0xcb, +0x02, +0x00, +0x5b, +0xb4, +0xe2, +0xc6, +0x8f, +0x2f, +0x98, +0xaf, +0x87, +0x4b, +0x48, +0x45, +0xed, +0xcc, +0x1d, +0xe6, +0x58, +0xd6, +0xf2, +0x50, +0x25, +0x9f, +0x52, +0xc7, +0xcb, +0x8a, +0x17, +0x9d, +0x5b, +0xe5, +0xc8, +0xd7, +0x72, +0xb7, +0x52, +0xb2, +0xc4, +0x98, +0xe3, +0x7a, +0x17, +0x3e, +0xc6, +0x60, +0xa7, +0x97, +0xb0, +0xcf, +0x18, +0x81, +0x53, +0x84, +0x4c, +0xd5, +0x17, +0x32, +0x03, +0x13, +0x39, +0x51, +0x09, +0x10, +0xe3, +0x77, +0x49, +0x4f, +0x62, +0x01, +0xbf, +0x8c, +0x9a, +0xe0, +0x41, +0x9e, +0x89, +0x74, +0x36, +0xf9, +0x96, +0x86, +0x2e, +0x96, +0x1c, +0x4a, +0xb7, +0x2b, +0x4a, +0x97, +0xbc, +0x99, +0x40, +0xa3, +0xe0, +0x3d, +0xc8, +0xad, +0x2f, +0xdf, +0x4f, +0x2c, +0xc4, +0x69, +0x82, +0x9f, +0x9b, +0x81, +0x0c, +0x61, +0x5c, +0xa5, +0x9d, +0x8c, +0x89, +0xc0, +0x2c, +0xb4, +0x4a, +0x33, +0x4e, +0xeb, +0xa2, +0x56, +0x40, +0xc0, +0xc2, +0x46, +0xaf, +0x6a, +0xfc, +0x67, +0xd1, +0x80, +0x5e, +0xc5, +0x6d, +0x84, +0x43, +0x27, +0x3f, +0x55, +0x15, +0x96, +0x6a, +0xa0, +0xa5, +0xda, +0xb7, +0xff, +0xb7, +0x75, +0x6e, +0x4c, +0x49, +0x91, +0x9d, +0x22, +0xa3, +0x46, +0xea, +0xed, +0x9a, +0x00, +0xe2, +0x32, +0xc3, +0xd6, +0xa9, +0x71, +0x20, +0x55, +0xa3, +0x19, +0xed, +0xf8, +0x4f, +0xa7, +0x12, +0x9c, +0x66, +0x87, +0xaf, +0x4e, +0xb7, +0xf0, +0xdb, +0xbf, +0xef, +0xf0, +0xf6, +0xaf, +0xea, +0xda, +0x09, +0xfe, +0xde, +0x38, +0x5c, +0xa5, +0xa2, +0xdf, +0x99, +0x45, +0xa8, +0xe4, +0xe7, +0x92, +0xac, +0x67, +0xaa, +0x4f, +0xbf, +0x77, +0x3e, +0xa2, +0x40, +0x49, +0x22, +0x4a, +0x1e, +0x3b, +0xaa, +0x70, +0x7f, +0x95, +0xaf, +0x37, +0x4b, +0xfc, +0x99, +0xe2, +0xe0, +0xba, +0xd7, +0x34, +0xce, +0x55, +0x88, +0x5b, +0x84, +0x1b, +0x57, +0xc4, +0x80, +0x03, +0x53, +0xc9, +0x2f, +0x93, +0x04, +0x4d, +0xd5, +0x96, +0xe5, +0x70, +0xa6, +0x6e, +0x63, +0x5d, +0x9d, +0x6c, +0xdb, +0x02, +0x0a, +0xa9, +0xda, +0x8b, +0x53, +0xdc, +0xd9, +0x9a, +0xc5, +0x94, +0x2c, +0x91, +0x92, +0x2a, +0xde, +0xbb, +0x8b, +0x13, +0xb9, +0x19, +0x96, +0x64, +0xcc, +0xf2, +0x64, +0x39, +0xb7, +0x75, +0x49, +0xe9, +0x86, +0xc2, +0x86, +0x62, +0xd9, +0x24, +0xd3, +0x81, +0x35, +0x49, +0xfc, +0xa0, +0xa5, +0xa0, +0x93, +0x05, +0x64, +0xb4, +0x1a, +0x57, +0xce, +0x0c, +0x90, +0x02, +0x27, +0xc5, +0x7a, +0x2b, +0x5d, +0xae, +0x3e, +0xd5, +0xdd, +0x10, +0x7c, +0x14, +0xea, +0x3a, +0x08, +0xac, +0x72, +0x4e, +0x90, +0x3d, +0x3b, +0x7c, +0x86, +0x2e, +0xeb, +0xd4, +0x06, +0x70, +0xe6, +0xc7, +0xfb, +0x5f, +0xbd, +0x18, +0xf4, +0x11, +0xa4, +0x1a, +0x93, +0xc3, +0xbe, +0xd9, +0xfb, +0x26, +0x48, +0x2f, +0x37, +0x3c, +0xd0, +0x03, +0x47, +0x1a, +0xf7, +0x62, +0x19, +0x24, +0x5c, +0xf4, +0xa8, +0x92, +0x20, +0x7a, +0xf2, +0x9e, +0x2a, +0xc5, +0x95, +0xa2, +0xfb, +0xa4, +0xea, +0x85, +0xd8, +0x56, +0xb7, +0x70, +0xd1, +0x60, +0x30, +0xa5, +0x30, +0x82, +0x70, +0xdc, +0x7a, +0x65, +0x8a, +0x36, +0x3f, +0x5b, +0x0c, +0xae, +0x54, +0x7c, +0xd3, +0x57, +0x84, +0x7b, +0x3a, +0x65, +0x18, +0x81, +0xee, +0x05, +0x9b, +0x44, +0x4d, +0xb8, +0xda, +0xa2, +0xa1, +0xc9, +0x15, +0xd3, +0x73, +0x03, +0x0e, +0x43, +0xe9, +0x8e, +0x15, +0xf9, +0xbe, +0xc6, +0xc5, +0x8a, +0xe5, +0xc0, +0x1e, +0xc2, +0x37, +0x9e, +0x2a, +0x26, +0xa5, +0xa0, +0xbd, +0x24, +0x5f, +0xb9, +0xc1, +0xab, +0x34, +0x48, +0xb9, +0x5d, +0x98, +0xb4, +0x65, +0x18, +0xf3, +0x63, +0x19, +0x44, +0x1b, +0x11, +0x16, +0xff, +0xdc, +0xf1, +0x79, +0x08, +0x86, +0x0f, +0x52, +0x98, +0x73, +0xc4, +0x92, +0x90, +0x2b, +0x47, +0x09, +0xd0, +0x43, +0x6c, +0x2f, +0x20, +0xeb, +0xdc, +0xda, +0xc5, +0x08, +0x7b, +0x94, +0x42, +0x30, +0x6a, +0xc7, +0xda, +0x8c, +0xc3, +0x76, +0xa7, +0xa5, +0xcc, +0x62, +0x13, +0x00, +0x60, +0x31, +0x58, +0x44, +0x9b, +0xf5, +0x64, +0x14, +0xf5, +0x11, +0xc5, +0x54, +0x52, +0x83, +0xd4, +0x73, +0x01, +0x16, +0x0e, +0xb3, +0x7a, +0x29, +0x69, +0x35, +0x56, +0xd4, +0xee, +0x8a, +0x17, +0xa2, +0x99, +0x24, +0x9c, +0xd7, +0x8f, +0xdb, +0x55, +0xb5, +0x3e +}; diff --git a/drivers/sensors/pimoroni_trackball.c b/drivers/sensors/pimoroni_trackball.c new file mode 100644 index 0000000000..48098ff0cc --- /dev/null +++ b/drivers/sensors/pimoroni_trackball.c @@ -0,0 +1,201 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * Copyright 2021 Dasky (@daskygit) + * + * 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 "pimoroni_trackball.h" +#include "i2c_master.h" +#include "print.h" + +#ifndef PIMORONI_TRACKBALL_ADDRESS +# define PIMORONI_TRACKBALL_ADDRESS 0x0A +#endif +#ifndef PIMORONI_TRACKBALL_INTERVAL_MS +# define PIMORONI_TRACKBALL_INTERVAL_MS 8 +#endif +#ifndef PIMORONI_TRACKBALL_MOUSE_SCALE +# define PIMORONI_TRACKBALL_MOUSE_SCALE 5 +#endif +#ifndef PIMORONI_TRACKBALL_SCROLL_SCALE +# define PIMORONI_TRACKBALL_SCROLL_SCALE 1 +#endif +#ifndef PIMORONI_TRACKBALL_DEBOUNCE_CYCLES +# define PIMORONI_TRACKBALL_DEBOUNCE_CYCLES 20 +#endif +#ifndef PIMORONI_TRACKBALL_ERROR_COUNT +# define PIMORONI_TRACKBALL_ERROR_COUNT 10 +#endif + +#define TRACKBALL_TIMEOUT 100 +#define TRACKBALL_REG_LED_RED 0x00 +#define TRACKBALL_REG_LED_GRN 0x01 +#define TRACKBALL_REG_LED_BLU 0x02 +#define TRACKBALL_REG_LED_WHT 0x03 +#define TRACKBALL_REG_LEFT 0x04 +#define TRACKBALL_REG_RIGHT 0x05 +#define TRACKBALL_REG_UP 0x06 +#define TRACKBALL_REG_DOWN 0x07 + +static pimoroni_data current_pimoroni_data; +static report_mouse_t mouse_report; +static bool scrolling = false; +static int16_t x_offset = 0; +static int16_t y_offset = 0; +static int16_t h_offset = 0; +static int16_t v_offset = 0; +static uint16_t precision = 128; +static uint8_t error_count = 0; + +float trackball_get_precision(void) { return ((float)precision / 128); } +void trackball_set_precision(float floatprecision) { precision = (floatprecision * 128); } +bool trackball_is_scrolling(void) { return scrolling; } +void trackball_set_scrolling(bool scroll) { scrolling = scroll; } + +void trackball_set_rgbw(uint8_t r, uint8_t g, uint8_t b, uint8_t w) { + uint8_t data[4] = {r, g, b, w}; + __attribute__((unused)) i2c_status_t status = i2c_writeReg(PIMORONI_TRACKBALL_ADDRESS << 1, TRACKBALL_REG_LED_RED, data, sizeof(data), TRACKBALL_TIMEOUT); +#ifdef TRACKBALL_DEBUG + dprintf("Trackball RGBW i2c_status_t: %d\n", status); +#endif +} + +i2c_status_t read_pimoroni_trackball(pimoroni_data* data) { + i2c_status_t status = i2c_readReg(PIMORONI_TRACKBALL_ADDRESS << 1, TRACKBALL_REG_LEFT, (uint8_t*)data, sizeof(*data), TRACKBALL_TIMEOUT); +#ifdef TRACKBALL_DEBUG + dprintf("Trackball READ i2c_status_t: %d\nLeft: %d\nRight: %d\nUp: %d\nDown: %d\nSwtich: %d\n", status, data->left, data->right, data->up, data->down, data->click); +#endif + return status; +} + +__attribute__((weak)) void pointing_device_init(void) { + i2c_init(); + trackball_set_rgbw(0x00, 0x00, 0x00, 0x00); +} + +int16_t trackball_get_offsets(uint8_t negative_dir, uint8_t positive_dir, uint8_t scale) { + uint8_t offset = 0; + bool isnegative = false; + if (negative_dir > positive_dir) { + offset = negative_dir - positive_dir; + isnegative = true; + } else { + offset = positive_dir - negative_dir; + } + uint16_t magnitude = (scale * offset * offset * precision) >> 7; + return isnegative ? -(int16_t)(magnitude) : (int16_t)(magnitude); +} + +void trackball_adapt_values(int8_t* mouse, int16_t* offset) { + if (*offset > 127) { + *mouse = 127; + *offset -= 127; + } else if (*offset < -127) { + *mouse = -127; + *offset += 127; + } else { + *mouse = *offset; + *offset = 0; + } +} + +__attribute__((weak)) void trackball_click(bool pressed, report_mouse_t* mouse) { +#ifdef PIMORONI_TRACKBALL_CLICK + if (pressed) { + mouse->buttons |= MOUSE_BTN1; + } else { + mouse->buttons &= ~MOUSE_BTN1; + } +#endif +} + +__attribute__((weak)) bool pointing_device_task_user(pimoroni_data* trackball_data) { return true; }; + +__attribute__((weak)) void pointing_device_task() { + static fast_timer_t throttle = 0; + static uint16_t debounce = 0; + + if (error_count < PIMORONI_TRACKBALL_ERROR_COUNT && timer_elapsed_fast(throttle) >= PIMORONI_TRACKBALL_INTERVAL_MS) { + i2c_status_t status = read_pimoroni_trackball(¤t_pimoroni_data); + + if (status == I2C_STATUS_SUCCESS) { + error_count = 0; + + if (pointing_device_task_user(¤t_pimoroni_data)) { + mouse_report = pointing_device_get_report(); + + if (!(current_pimoroni_data.click & 128)) { + trackball_click(false, &mouse_report); + if (!debounce) { + if (scrolling) { +#ifdef PIMORONI_TRACKBALL_INVERT_X + h_offset += trackball_get_offsets(current_pimoroni_data.right, current_pimoroni_data.left, PIMORONI_TRACKBALL_SCROLL_SCALE); +#else + h_offset -= trackball_get_offsets(current_pimoroni_data.right, current_pimoroni_data.left, PIMORONI_TRACKBALL_SCROLL_SCALE); +#endif +#ifdef PIMORONI_TRACKBALL_INVERT_Y + v_offset += trackball_get_offsets(current_pimoroni_data.down, current_pimoroni_data.up, PIMORONI_TRACKBALL_SCROLL_SCALE); +#else + v_offset -= trackball_get_offsets(current_pimoroni_data.down, current_pimoroni_data.up, PIMORONI_TRACKBALL_SCROLL_SCALE); +#endif + } else { +#ifdef PIMORONI_TRACKBALL_INVERT_X + x_offset -= trackball_get_offsets(current_pimoroni_data.right, current_pimoroni_data.left, PIMORONI_TRACKBALL_MOUSE_SCALE); +#else + x_offset += trackball_get_offsets(current_pimoroni_data.right, current_pimoroni_data.left, PIMORONI_TRACKBALL_MOUSE_SCALE); +#endif +#ifdef PIMORONI_TRACKBALL_INVERT_Y + y_offset -= trackball_get_offsets(current_pimoroni_data.down, current_pimoroni_data.up, PIMORONI_TRACKBALL_MOUSE_SCALE); +#else + y_offset += trackball_get_offsets(current_pimoroni_data.down, current_pimoroni_data.up, PIMORONI_TRACKBALL_MOUSE_SCALE); +#endif + } + if (scrolling) { +#ifndef PIMORONI_TRACKBALL_ROTATE + trackball_adapt_values(&mouse_report.h, &h_offset); + trackball_adapt_values(&mouse_report.v, &v_offset); +#else + trackball_adapt_values(&mouse_report.h, &v_offset); + trackball_adapt_values(&mouse_report.v, &h_offset); +#endif + mouse_report.x = 0; + mouse_report.y = 0; + } else { +#ifndef PIMORONI_TRACKBALL_ROTATE + trackball_adapt_values(&mouse_report.x, &x_offset); + trackball_adapt_values(&mouse_report.y, &y_offset); +#else + trackball_adapt_values(&mouse_report.x, &y_offset); + trackball_adapt_values(&mouse_report.y, &x_offset); +#endif + mouse_report.h = 0; + mouse_report.v = 0; + } + } else { + debounce--; + } + } else { + trackball_click(true, &mouse_report); + debounce = PIMORONI_TRACKBALL_DEBOUNCE_CYCLES; + } + } + } else { + error_count++; + } + + pointing_device_set_report(mouse_report); + pointing_device_send(); + + throttle = timer_read_fast(); + } +} diff --git a/drivers/sensors/pimoroni_trackball.h b/drivers/sensors/pimoroni_trackball.h new file mode 100644 index 0000000000..6b2a41425d --- /dev/null +++ b/drivers/sensors/pimoroni_trackball.h @@ -0,0 +1,37 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * Copyright 2021 Dasky (@daskygit) + * + * 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 "quantum.h" +#include "pointing_device.h" + +typedef struct pimoroni_data { + uint8_t left; + uint8_t right; + uint8_t up; + uint8_t down; + uint8_t click; +} pimoroni_data; + +void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white); +void trackball_click(bool pressed, report_mouse_t* mouse); +int16_t trackball_get_offsets(uint8_t negative_dir, uint8_t positive_dir, uint8_t scale); +void trackball_adapt_values(int8_t* mouse, int16_t* offset); +float trackball_get_precision(void); +void trackball_set_precision(float precision); +bool trackball_is_scrolling(void); +void trackball_set_scrolling(bool scroll); diff --git a/drivers/sensors/pmw3360.c b/drivers/sensors/pmw3360.c new file mode 100644 index 0000000000..17c4675ffa --- /dev/null +++ b/drivers/sensors/pmw3360.c @@ -0,0 +1,271 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * Copyright 2019 Sunjun Kim + * Copyright 2020 Ploopy Corporation + * + * 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 "pmw3360.h" +#include "wait.h" +#include "debug.h" +#include "print.h" +#include "pmw3360_firmware.h" + +// Registers +#define REG_Product_ID 0x00 +#define REG_Revision_ID 0x01 +#define REG_Motion 0x02 +#define REG_Delta_X_L 0x03 +#define REG_Delta_X_H 0x04 +#define REG_Delta_Y_L 0x05 +#define REG_Delta_Y_H 0x06 +#define REG_SQUAL 0x07 +#define REG_Raw_Data_Sum 0x08 +#define REG_Maximum_Raw_data 0x09 +#define REG_Minimum_Raw_data 0x0A +#define REG_Shutter_Lower 0x0B +#define REG_Shutter_Upper 0x0C +#define REG_Control 0x0D +#define REG_Config1 0x0F +#define REG_Config2 0x10 +#define REG_Angle_Tune 0x11 +#define REG_Frame_Capture 0x12 +#define REG_SROM_Enable 0x13 +#define REG_Run_Downshift 0x14 +#define REG_Rest1_Rate_Lower 0x15 +#define REG_Rest1_Rate_Upper 0x16 +#define REG_Rest1_Downshift 0x17 +#define REG_Rest2_Rate_Lower 0x18 +#define REG_Rest2_Rate_Upper 0x19 +#define REG_Rest2_Downshift 0x1A +#define REG_Rest3_Rate_Lower 0x1B +#define REG_Rest3_Rate_Upper 0x1C +#define REG_Observation 0x24 +#define REG_Data_Out_Lower 0x25 +#define REG_Data_Out_Upper 0x26 +#define REG_Raw_Data_Dump 0x29 +#define REG_SROM_ID 0x2A +#define REG_Min_SQ_Run 0x2B +#define REG_Raw_Data_Threshold 0x2C +#define REG_Config5 0x2F +#define REG_Power_Up_Reset 0x3A +#define REG_Shutdown 0x3B +#define REG_Inverse_Product_ID 0x3F +#define REG_LiftCutoff_Tune3 0x41 +#define REG_Angle_Snap 0x42 +#define REG_LiftCutoff_Tune1 0x4A +#define REG_Motion_Burst 0x50 +#define REG_LiftCutoff_Tune_Timeout 0x58 +#define REG_LiftCutoff_Tune_Min_Length 0x5A +#define REG_SROM_Load_Burst 0x62 +#define REG_Lift_Config 0x63 +#define REG_Raw_Data_Burst 0x64 +#define REG_LiftCutoff_Tune2 0x65 + +bool _inBurst = false; + +void print_byte(uint8_t byte) { dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); } + +bool spi_start_adv(void) { + bool status = spi_start(PMW3360_CS_PIN, PMW3360_SPI_LSBFIRST, PMW3360_SPI_MODE, PMW3360_SPI_DIVISOR); + wait_us(1); + return status; +} + +void spi_stop_adv(void) { + wait_us(1); + spi_stop(); +} + +spi_status_t spi_write_adv(uint8_t reg_addr, uint8_t data) { + if (reg_addr != REG_Motion_Burst) { + _inBurst = false; + } + + spi_start_adv(); + // send address of the register, with MSBit = 1 to indicate it's a write + spi_status_t status = spi_write(reg_addr | 0x80); + status = spi_write(data); + + // tSCLK-NCS for write operation + wait_us(20); + + // tSWW/tSWR (=120us) minus tSCLK-NCS. Could be shortened, but is looks like a safe lower bound + wait_us(100); + spi_stop(); + return status; +} + +uint8_t spi_read_adv(uint8_t reg_addr) { + spi_start_adv(); + // send adress of the register, with MSBit = 0 to indicate it's a read + spi_write(reg_addr & 0x7f); + + uint8_t data = spi_read(); + + // tSCLK-NCS for read operation is 120ns + wait_us(1); + + // tSRW/tSRR (=20us) minus tSCLK-NCS + wait_us(19); + + spi_stop(); + return data; +} + +void pmw_set_cpi(uint16_t cpi) { + uint8_t cpival = constrain((cpi / 100) - 1, 0, 0x77); // limits to 0--119 + + spi_start_adv(); + spi_write_adv(REG_Config1, cpival); + spi_stop(); +} + +uint16_t pmw_get_cpi(void) { + uint8_t cpival = spi_read_adv(REG_Config1); + return (uint16_t)(cpival & 0xFF) * 100; +} + +bool pmw_spi_init(void) { + setPinOutput(PMW3360_CS_PIN); + + spi_init(); + _inBurst = false; + + spi_stop(); + spi_start_adv(); + spi_stop(); + + spi_write_adv(REG_Shutdown, 0xb6); // Shutdown first + wait_ms(300); + + spi_start_adv(); + wait_us(40); + spi_stop_adv(); + wait_us(40); + + spi_write_adv(REG_Power_Up_Reset, 0x5a); + wait_ms(50); + + spi_read_adv(REG_Motion); + spi_read_adv(REG_Delta_X_L); + spi_read_adv(REG_Delta_X_H); + spi_read_adv(REG_Delta_Y_L); + spi_read_adv(REG_Delta_Y_H); + + pmw_upload_firmware(); + + spi_stop_adv(); + + wait_ms(10); + pmw_set_cpi(PMW3360_CPI); + + wait_ms(1); + + spi_write_adv(REG_Config2, 0x00); + + spi_write_adv(REG_Angle_Tune, constrain(ROTATIONAL_TRANSFORM_ANGLE, -30, 30)); + + bool init_success = pmw_check_signature(); + + writePinLow(PMW3360_CS_PIN); + + return init_success; +} + +void pmw_upload_firmware(void) { + spi_write_adv(REG_SROM_Enable, 0x1d); + + wait_ms(10); + + spi_write_adv(REG_SROM_Enable, 0x18); + + spi_start_adv(); + spi_write(REG_SROM_Load_Burst | 0x80); + wait_us(15); + + unsigned char c; + for (int i = 0; i < firmware_length; i++) { + c = (unsigned char)pgm_read_byte(firmware_data + i); + spi_write(c); + wait_us(15); + } + wait_us(200); + + spi_read_adv(REG_SROM_ID); + + spi_write_adv(REG_Config2, 0x00); + + spi_stop(); + wait_ms(10); +} + +bool pmw_check_signature(void) { + uint8_t pid = spi_read_adv(REG_Product_ID); + uint8_t iv_pid = spi_read_adv(REG_Inverse_Product_ID); + uint8_t SROM_ver = spi_read_adv(REG_SROM_ID); + return (pid == 0x42 && iv_pid == 0xBD && SROM_ver == 0x04); // signature for SROM 0x04 +} + +report_pmw_t pmw_read_burst(void) { + if (!_inBurst) { + dprintf("burst on"); + spi_write_adv(REG_Motion_Burst, 0x00); + _inBurst = true; + } + + spi_start_adv(); + spi_write(REG_Motion_Burst); + wait_us(35); // waits for tSRAD + + report_pmw_t data; + data.motion = 0; + data.dx = 0; + data.mdx = 0; + data.dy = 0; + data.mdx = 0; + + data.motion = spi_read(); + spi_write(0x00); // skip Observation + data.dx = spi_read(); + data.mdx = spi_read(); + data.dy = spi_read(); + data.mdy = spi_read(); + + spi_stop(); + + if (debug_mouse) { + print_byte(data.motion); + print_byte(data.dx); + print_byte(data.mdx); + print_byte(data.dy); + print_byte(data.mdy); + dprintf("\n"); + } + + data.isMotion = (data.motion & 0x80) != 0; + data.isOnSurface = (data.motion & 0x08) == 0; + data.dx |= (data.mdx << 8); + data.dx = data.dx * -1; + data.dy |= (data.mdy << 8); + data.dy = data.dy * -1; + + spi_stop(); + + if (data.motion & 0b111) { // panic recovery, sometimes burst mode works weird. + _inBurst = false; + } + + return data; +} diff --git a/drivers/sensors/pmw3360.h b/drivers/sensors/pmw3360.h new file mode 100644 index 0000000000..124c62cf00 --- /dev/null +++ b/drivers/sensors/pmw3360.h @@ -0,0 +1,85 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * Copyright 2019 Sunjun Kim + * Copyright 2020 Ploopy Corporation + * + * 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 "spi_master.h" + +#ifndef PMW3360_CPI +# define PMW3360_CPI 1600 +#endif + +#ifndef PMW3360_CLOCK_SPEED +# define PMW3360_CLOCK_SPEED 70000000 +#endif + +#ifndef PMW3360_SPI_LSBFIRST +# define PMW3360_SPI_LSBFIRST false +#endif + +#ifndef PMW3360_SPI_MODE +# define PMW3360_SPI_MODE 3 +#endif + +#ifndef PMW3360_SPI_DIVISOR +# ifdef __AVR__ +# define PMW3360_SPI_DIVISOR (F_CPU / PMW3360_CLOCK_SPEED) +# else +# define PMW3360_SPI_DIVISOR 64 +# endif +#endif + +#ifndef ROTATIONAL_TRANSFORM_ANGLE +# define ROTATIONAL_TRANSFORM_ANGLE 0x00 +#endif + +#ifndef PMW3360_CS_PIN +# error "No chip select pin defined -- missing PMW3360_CS_PIN" +#endif + +#ifdef CONSOLE_ENABLE +void print_byte(uint8_t byte); +#endif + +typedef struct { + int8_t motion; + bool isMotion; // True if a motion is detected. + bool isOnSurface; // True when a chip is on a surface + int16_t dx; // displacement on x directions. Unit: Count. (CPI * Count = Inch value) + int8_t mdx; + int16_t dy; // displacement on y directions. + int8_t mdy; +} report_pmw_t; + + + +bool spi_start_adv(void); +void spi_stop_adv(void); +spi_status_t spi_write_adv(uint8_t reg_addr, uint8_t data); +uint8_t spi_read_adv(uint8_t reg_addr); +bool pmw_spi_init(void); +void pmw_set_cpi(uint16_t cpi); +uint16_t pmw_get_cpi(void); +void pmw_upload_firmware(void); +bool pmw_check_signature(void); +report_pmw_t pmw_read_burst(void); + + +#define degToRad(angleInDegrees) ((angleInDegrees)*M_PI / 180.0) +#define radToDeg(angleInRadians) ((angleInRadians)*180.0 / M_PI) +#define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt))) diff --git a/drivers/sensors/pmw3360_firmware.h b/drivers/sensors/pmw3360_firmware.h new file mode 100644 index 0000000000..cca5a6a4d8 --- /dev/null +++ b/drivers/sensors/pmw3360_firmware.h @@ -0,0 +1,300 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> + * Copyright 2019 Sunjun Kim + * Copyright 2020 Ploopy Corporation + * + * 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 + +// clang-format off +// Firmware Blob foor PMW3360 +const uint16_t firmware_length = 4094; +// clang-format off +const uint8_t firmware_data[] PROGMEM = { // SROM 0x04 +0x01, 0x04, 0x8e, 0x96, 0x6e, 0x77, 0x3e, 0xfe, 0x7e, 0x5f, 0x1d, 0xb8, 0xf2, 0x66, 0x4e, +0xff, 0x5d, 0x19, 0xb0, 0xc2, 0x04, 0x69, 0x54, 0x2a, 0xd6, 0x2e, 0xbf, 0xdd, 0x19, 0xb0, +0xc3, 0xe5, 0x29, 0xb1, 0xe0, 0x23, 0xa5, 0xa9, 0xb1, 0xc1, 0x00, 0x82, 0x67, 0x4c, 0x1a, +0x97, 0x8d, 0x79, 0x51, 0x20, 0xc7, 0x06, 0x8e, 0x7c, 0x7c, 0x7a, 0x76, 0x4f, 0xfd, 0x59, +0x30, 0xe2, 0x46, 0x0e, 0x9e, 0xbe, 0xdf, 0x1d, 0x99, 0x91, 0xa0, 0xa5, 0xa1, 0xa9, 0xd0, +0x22, 0xc6, 0xef, 0x5c, 0x1b, 0x95, 0x89, 0x90, 0xa2, 0xa7, 0xcc, 0xfb, 0x55, 0x28, 0xb3, +0xe4, 0x4a, 0xf7, 0x6c, 0x3b, 0xf4, 0x6a, 0x56, 0x2e, 0xde, 0x1f, 0x9d, 0xb8, 0xd3, 0x05, +0x88, 0x92, 0xa6, 0xce, 0x1e, 0xbe, 0xdf, 0x1d, 0x99, 0xb0, 0xe2, 0x46, 0xef, 0x5c, 0x07, +0x11, 0x5d, 0x98, 0x0b, 0x9d, 0x94, 0x97, 0xee, 0x4e, 0x45, 0x33, 0x6b, 0x44, 0xc7, 0x29, +0x56, 0x27, 0x30, 0xc6, 0xa7, 0xd5, 0xf2, 0x56, 0xdf, 0xb4, 0x38, 0x62, 0xcb, 0xa0, 0xb6, +0xe3, 0x0f, 0x84, 0x06, 0x24, 0x05, 0x65, 0x6f, 0x76, 0x89, 0xb5, 0x77, 0x41, 0x27, 0x82, +0x66, 0x65, 0x82, 0xcc, 0xd5, 0xe6, 0x20, 0xd5, 0x27, 0x17, 0xc5, 0xf8, 0x03, 0x23, 0x7c, +0x5f, 0x64, 0xa5, 0x1d, 0xc1, 0xd6, 0x36, 0xcb, 0x4c, 0xd4, 0xdb, 0x66, 0xd7, 0x8b, 0xb1, +0x99, 0x7e, 0x6f, 0x4c, 0x36, 0x40, 0x06, 0xd6, 0xeb, 0xd7, 0xa2, 0xe4, 0xf4, 0x95, 0x51, +0x5a, 0x54, 0x96, 0xd5, 0x53, 0x44, 0xd7, 0x8c, 0xe0, 0xb9, 0x40, 0x68, 0xd2, 0x18, 0xe9, +0xdd, 0x9a, 0x23, 0x92, 0x48, 0xee, 0x7f, 0x43, 0xaf, 0xea, 0x77, 0x38, 0x84, 0x8c, 0x0a, +0x72, 0xaf, 0x69, 0xf8, 0xdd, 0xf1, 0x24, 0x83, 0xa3, 0xf8, 0x4a, 0xbf, 0xf5, 0x94, 0x13, +0xdb, 0xbb, 0xd8, 0xb4, 0xb3, 0xa0, 0xfb, 0x45, 0x50, 0x60, 0x30, 0x59, 0x12, 0x31, 0x71, +0xa2, 0xd3, 0x13, 0xe7, 0xfa, 0xe7, 0xce, 0x0f, 0x63, 0x15, 0x0b, 0x6b, 0x94, 0xbb, 0x37, +0x83, 0x26, 0x05, 0x9d, 0xfb, 0x46, 0x92, 0xfc, 0x0a, 0x15, 0xd1, 0x0d, 0x73, 0x92, 0xd6, +0x8c, 0x1b, 0x8c, 0xb8, 0x55, 0x8a, 0xce, 0xbd, 0xfe, 0x8e, 0xfc, 0xed, 0x09, 0x12, 0x83, +0x91, 0x82, 0x51, 0x31, 0x23, 0xfb, 0xb4, 0x0c, 0x76, 0xad, 0x7c, 0xd9, 0xb4, 0x4b, 0xb2, +0x67, 0x14, 0x09, 0x9c, 0x7f, 0x0c, 0x18, 0xba, 0x3b, 0xd6, 0x8e, 0x14, 0x2a, 0xe4, 0x1b, +0x52, 0x9f, 0x2b, 0x7d, 0xe1, 0xfb, 0x6a, 0x33, 0x02, 0xfa, 0xac, 0x5a, 0xf2, 0x3e, 0x88, +0x7e, 0xae, 0xd1, 0xf3, 0x78, 0xe8, 0x05, 0xd1, 0xe3, 0xdc, 0x21, 0xf6, 0xe1, 0x9a, 0xbd, +0x17, 0x0e, 0xd9, 0x46, 0x9b, 0x88, 0x03, 0xea, 0xf6, 0x66, 0xbe, 0x0e, 0x1b, 0x50, 0x49, +0x96, 0x40, 0x97, 0xf1, 0xf1, 0xe4, 0x80, 0xa6, 0x6e, 0xe8, 0x77, 0x34, 0xbf, 0x29, 0x40, +0x44, 0xc2, 0xff, 0x4e, 0x98, 0xd3, 0x9c, 0xa3, 0x32, 0x2b, 0x76, 0x51, 0x04, 0x09, 0xe7, +0xa9, 0xd1, 0xa6, 0x32, 0xb1, 0x23, 0x53, 0xe2, 0x47, 0xab, 0xd6, 0xf5, 0x69, 0x5c, 0x3e, +0x5f, 0xfa, 0xae, 0x45, 0x20, 0xe5, 0xd2, 0x44, 0xff, 0x39, 0x32, 0x6d, 0xfd, 0x27, 0x57, +0x5c, 0xfd, 0xf0, 0xde, 0xc1, 0xb5, 0x99, 0xe5, 0xf5, 0x1c, 0x77, 0x01, 0x75, 0xc5, 0x6d, +0x58, 0x92, 0xf2, 0xb2, 0x47, 0x00, 0x01, 0x26, 0x96, 0x7a, 0x30, 0xff, 0xb7, 0xf0, 0xef, +0x77, 0xc1, 0x8a, 0x5d, 0xdc, 0xc0, 0xd1, 0x29, 0x30, 0x1e, 0x77, 0x38, 0x7a, 0x94, 0xf1, +0xb8, 0x7a, 0x7e, 0xef, 0xa4, 0xd1, 0xac, 0x31, 0x4a, 0xf2, 0x5d, 0x64, 0x3d, 0xb2, 0xe2, +0xf0, 0x08, 0x99, 0xfc, 0x70, 0xee, 0x24, 0xa7, 0x7e, 0xee, 0x1e, 0x20, 0x69, 0x7d, 0x44, +0xbf, 0x87, 0x42, 0xdf, 0x88, 0x3b, 0x0c, 0xda, 0x42, 0xc9, 0x04, 0xf9, 0x45, 0x50, 0xfc, +0x83, 0x8f, 0x11, 0x6a, 0x72, 0xbc, 0x99, 0x95, 0xf0, 0xac, 0x3d, 0xa7, 0x3b, 0xcd, 0x1c, +0xe2, 0x88, 0x79, 0x37, 0x11, 0x5f, 0x39, 0x89, 0x95, 0x0a, 0x16, 0x84, 0x7a, 0xf6, 0x8a, +0xa4, 0x28, 0xe4, 0xed, 0x83, 0x80, 0x3b, 0xb1, 0x23, 0xa5, 0x03, 0x10, 0xf4, 0x66, 0xea, +0xbb, 0x0c, 0x0f, 0xc5, 0xec, 0x6c, 0x69, 0xc5, 0xd3, 0x24, 0xab, 0xd4, 0x2a, 0xb7, 0x99, +0x88, 0x76, 0x08, 0xa0, 0xa8, 0x95, 0x7c, 0xd8, 0x38, 0x6d, 0xcd, 0x59, 0x02, 0x51, 0x4b, +0xf1, 0xb5, 0x2b, 0x50, 0xe3, 0xb6, 0xbd, 0xd0, 0x72, 0xcf, 0x9e, 0xfd, 0x6e, 0xbb, 0x44, +0xc8, 0x24, 0x8a, 0x77, 0x18, 0x8a, 0x13, 0x06, 0xef, 0x97, 0x7d, 0xfa, 0x81, 0xf0, 0x31, +0xe6, 0xfa, 0x77, 0xed, 0x31, 0x06, 0x31, 0x5b, 0x54, 0x8a, 0x9f, 0x30, 0x68, 0xdb, 0xe2, +0x40, 0xf8, 0x4e, 0x73, 0xfa, 0xab, 0x74, 0x8b, 0x10, 0x58, 0x13, 0xdc, 0xd2, 0xe6, 0x78, +0xd1, 0x32, 0x2e, 0x8a, 0x9f, 0x2c, 0x58, 0x06, 0x48, 0x27, 0xc5, 0xa9, 0x5e, 0x81, 0x47, +0x89, 0x46, 0x21, 0x91, 0x03, 0x70, 0xa4, 0x3e, 0x88, 0x9c, 0xda, 0x33, 0x0a, 0xce, 0xbc, +0x8b, 0x8e, 0xcf, 0x9f, 0xd3, 0x71, 0x80, 0x43, 0xcf, 0x6b, 0xa9, 0x51, 0x83, 0x76, 0x30, +0x82, 0xc5, 0x6a, 0x85, 0x39, 0x11, 0x50, 0x1a, 0x82, 0xdc, 0x1e, 0x1c, 0xd5, 0x7d, 0xa9, +0x71, 0x99, 0x33, 0x47, 0x19, 0x97, 0xb3, 0x5a, 0xb1, 0xdf, 0xed, 0xa4, 0xf2, 0xe6, 0x26, +0x84, 0xa2, 0x28, 0x9a, 0x9e, 0xdf, 0xa6, 0x6a, 0xf4, 0xd6, 0xfc, 0x2e, 0x5b, 0x9d, 0x1a, +0x2a, 0x27, 0x68, 0xfb, 0xc1, 0x83, 0x21, 0x4b, 0x90, 0xe0, 0x36, 0xdd, 0x5b, 0x31, 0x42, +0x55, 0xa0, 0x13, 0xf7, 0xd0, 0x89, 0x53, 0x71, 0x99, 0x57, 0x09, 0x29, 0xc5, 0xf3, 0x21, +0xf8, 0x37, 0x2f, 0x40, 0xf3, 0xd4, 0xaf, 0x16, 0x08, 0x36, 0x02, 0xfc, 0x77, 0xc5, 0x8b, +0x04, 0x90, 0x56, 0xb9, 0xc9, 0x67, 0x9a, 0x99, 0xe8, 0x00, 0xd3, 0x86, 0xff, 0x97, 0x2d, +0x08, 0xe9, 0xb7, 0xb3, 0x91, 0xbc, 0xdf, 0x45, 0xc6, 0xed, 0x0f, 0x8c, 0x4c, 0x1e, 0xe6, +0x5b, 0x6e, 0x38, 0x30, 0xe4, 0xaa, 0xe3, 0x95, 0xde, 0xb9, 0xe4, 0x9a, 0xf5, 0xb2, 0x55, +0x9a, 0x87, 0x9b, 0xf6, 0x6a, 0xb2, 0xf2, 0x77, 0x9a, 0x31, 0xf4, 0x7a, 0x31, 0xd1, 0x1d, +0x04, 0xc0, 0x7c, 0x32, 0xa2, 0x9e, 0x9a, 0xf5, 0x62, 0xf8, 0x27, 0x8d, 0xbf, 0x51, 0xff, +0xd3, 0xdf, 0x64, 0x37, 0x3f, 0x2a, 0x6f, 0x76, 0x3a, 0x7d, 0x77, 0x06, 0x9e, 0x77, 0x7f, +0x5e, 0xeb, 0x32, 0x51, 0xf9, 0x16, 0x66, 0x9a, 0x09, 0xf3, 0xb0, 0x08, 0xa4, 0x70, 0x96, +0x46, 0x30, 0xff, 0xda, 0x4f, 0xe9, 0x1b, 0xed, 0x8d, 0xf8, 0x74, 0x1f, 0x31, 0x92, 0xb3, +0x73, 0x17, 0x36, 0xdb, 0x91, 0x30, 0xd6, 0x88, 0x55, 0x6b, 0x34, 0x77, 0x87, 0x7a, 0xe7, +0xee, 0x06, 0xc6, 0x1c, 0x8c, 0x19, 0x0c, 0x48, 0x46, 0x23, 0x5e, 0x9c, 0x07, 0x5c, 0xbf, +0xb4, 0x7e, 0xd6, 0x4f, 0x74, 0x9c, 0xe2, 0xc5, 0x50, 0x8b, 0xc5, 0x8b, 0x15, 0x90, 0x60, +0x62, 0x57, 0x29, 0xd0, 0x13, 0x43, 0xa1, 0x80, 0x88, 0x91, 0x00, 0x44, 0xc7, 0x4d, 0x19, +0x86, 0xcc, 0x2f, 0x2a, 0x75, 0x5a, 0xfc, 0xeb, 0x97, 0x2a, 0x70, 0xe3, 0x78, 0xd8, 0x91, +0xb0, 0x4f, 0x99, 0x07, 0xa3, 0x95, 0xea, 0x24, 0x21, 0xd5, 0xde, 0x51, 0x20, 0x93, 0x27, +0x0a, 0x30, 0x73, 0xa8, 0xff, 0x8a, 0x97, 0xe9, 0xa7, 0x6a, 0x8e, 0x0d, 0xe8, 0xf0, 0xdf, +0xec, 0xea, 0xb4, 0x6c, 0x1d, 0x39, 0x2a, 0x62, 0x2d, 0x3d, 0x5a, 0x8b, 0x65, 0xf8, 0x90, +0x05, 0x2e, 0x7e, 0x91, 0x2c, 0x78, 0xef, 0x8e, 0x7a, 0xc1, 0x2f, 0xac, 0x78, 0xee, 0xaf, +0x28, 0x45, 0x06, 0x4c, 0x26, 0xaf, 0x3b, 0xa2, 0xdb, 0xa3, 0x93, 0x06, 0xb5, 0x3c, 0xa5, +0xd8, 0xee, 0x8f, 0xaf, 0x25, 0xcc, 0x3f, 0x85, 0x68, 0x48, 0xa9, 0x62, 0xcc, 0x97, 0x8f, +0x7f, 0x2a, 0xea, 0xe0, 0x15, 0x0a, 0xad, 0x62, 0x07, 0xbd, 0x45, 0xf8, 0x41, 0xd8, 0x36, +0xcb, 0x4c, 0xdb, 0x6e, 0xe6, 0x3a, 0xe7, 0xda, 0x15, 0xe9, 0x29, 0x1e, 0x12, 0x10, 0xa0, +0x14, 0x2c, 0x0e, 0x3d, 0xf4, 0xbf, 0x39, 0x41, 0x92, 0x75, 0x0b, 0x25, 0x7b, 0xa3, 0xce, +0x39, 0x9c, 0x15, 0x64, 0xc8, 0xfa, 0x3d, 0xef, 0x73, 0x27, 0xfe, 0x26, 0x2e, 0xce, 0xda, +0x6e, 0xfd, 0x71, 0x8e, 0xdd, 0xfe, 0x76, 0xee, 0xdc, 0x12, 0x5c, 0x02, 0xc5, 0x3a, 0x4e, +0x4e, 0x4f, 0xbf, 0xca, 0x40, 0x15, 0xc7, 0x6e, 0x8d, 0x41, 0xf1, 0x10, 0xe0, 0x4f, 0x7e, +0x97, 0x7f, 0x1c, 0xae, 0x47, 0x8e, 0x6b, 0xb1, 0x25, 0x31, 0xb0, 0x73, 0xc7, 0x1b, 0x97, +0x79, 0xf9, 0x80, 0xd3, 0x66, 0x22, 0x30, 0x07, 0x74, 0x1e, 0xe4, 0xd0, 0x80, 0x21, 0xd6, +0xee, 0x6b, 0x6c, 0x4f, 0xbf, 0xf5, 0xb7, 0xd9, 0x09, 0x87, 0x2f, 0xa9, 0x14, 0xbe, 0x27, +0xd9, 0x72, 0x50, 0x01, 0xd4, 0x13, 0x73, 0xa6, 0xa7, 0x51, 0x02, 0x75, 0x25, 0xe1, 0xb3, +0x45, 0x34, 0x7d, 0xa8, 0x8e, 0xeb, 0xf3, 0x16, 0x49, 0xcb, 0x4f, 0x8c, 0xa1, 0xb9, 0x36, +0x85, 0x39, 0x75, 0x5d, 0x08, 0x00, 0xae, 0xeb, 0xf6, 0xea, 0xd7, 0x13, 0x3a, 0x21, 0x5a, +0x5f, 0x30, 0x84, 0x52, 0x26, 0x95, 0xc9, 0x14, 0xf2, 0x57, 0x55, 0x6b, 0xb1, 0x10, 0xc2, +0xe1, 0xbd, 0x3b, 0x51, 0xc0, 0xb7, 0x55, 0x4c, 0x71, 0x12, 0x26, 0xc7, 0x0d, 0xf9, 0x51, +0xa4, 0x38, 0x02, 0x05, 0x7f, 0xb8, 0xf1, 0x72, 0x4b, 0xbf, 0x71, 0x89, 0x14, 0xf3, 0x77, +0x38, 0xd9, 0x71, 0x24, 0xf3, 0x00, 0x11, 0xa1, 0xd8, 0xd4, 0x69, 0x27, 0x08, 0x37, 0x35, +0xc9, 0x11, 0x9d, 0x90, 0x1c, 0x0e, 0xe7, 0x1c, 0xff, 0x2d, 0x1e, 0xe8, 0x92, 0xe1, 0x18, +0x10, 0x95, 0x7c, 0xe0, 0x80, 0xf4, 0x96, 0x43, 0x21, 0xf9, 0x75, 0x21, 0x64, 0x38, 0xdd, +0x9f, 0x1e, 0x95, 0x16, 0xda, 0x56, 0x1d, 0x4f, 0x9a, 0x53, 0xb2, 0xe2, 0xe4, 0x18, 0xcb, +0x6b, 0x1a, 0x65, 0xeb, 0x56, 0xc6, 0x3b, 0xe5, 0xfe, 0xd8, 0x26, 0x3f, 0x3a, 0x84, 0x59, +0x72, 0x66, 0xa2, 0xf3, 0x75, 0xff, 0xfb, 0x60, 0xb3, 0x22, 0xad, 0x3f, 0x2d, 0x6b, 0xf9, +0xeb, 0xea, 0x05, 0x7c, 0xd8, 0x8f, 0x6d, 0x2c, 0x98, 0x9e, 0x2b, 0x93, 0xf1, 0x5e, 0x46, +0xf0, 0x87, 0x49, 0x29, 0x73, 0x68, 0xd7, 0x7f, 0xf9, 0xf0, 0xe5, 0x7d, 0xdb, 0x1d, 0x75, +0x19, 0xf3, 0xc4, 0x58, 0x9b, 0x17, 0x88, 0xa8, 0x92, 0xe0, 0xbe, 0xbd, 0x8b, 0x1d, 0x8d, +0x9f, 0x56, 0x76, 0xad, 0xaf, 0x29, 0xe2, 0xd9, 0xd5, 0x52, 0xf6, 0xb5, 0x56, 0x35, 0x57, +0x3a, 0xc8, 0xe1, 0x56, 0x43, 0x19, 0x94, 0xd3, 0x04, 0x9b, 0x6d, 0x35, 0xd8, 0x0b, 0x5f, +0x4d, 0x19, 0x8e, 0xec, 0xfa, 0x64, 0x91, 0x0a, 0x72, 0x20, 0x2b, 0xbc, 0x1a, 0x4a, 0xfe, +0x8b, 0xfd, 0xbb, 0xed, 0x1b, 0x23, 0xea, 0xad, 0x72, 0x82, 0xa1, 0x29, 0x99, 0x71, 0xbd, +0xf0, 0x95, 0xc1, 0x03, 0xdd, 0x7b, 0xc2, 0xb2, 0x3c, 0x28, 0x54, 0xd3, 0x68, 0xa4, 0x72, +0xc8, 0x66, 0x96, 0xe0, 0xd1, 0xd8, 0x7f, 0xf8, 0xd1, 0x26, 0x2b, 0xf7, 0xad, 0xba, 0x55, +0xca, 0x15, 0xb9, 0x32, 0xc3, 0xe5, 0x88, 0x97, 0x8e, 0x5c, 0xfb, 0x92, 0x25, 0x8b, 0xbf, +0xa2, 0x45, 0x55, 0x7a, 0xa7, 0x6f, 0x8b, 0x57, 0x5b, 0xcf, 0x0e, 0xcb, 0x1d, 0xfb, 0x20, +0x82, 0x77, 0xa8, 0x8c, 0xcc, 0x16, 0xce, 0x1d, 0xfa, 0xde, 0xcc, 0x0b, 0x62, 0xfe, 0xcc, +0xe1, 0xb7, 0xf0, 0xc3, 0x81, 0x64, 0x73, 0x40, 0xa0, 0xc2, 0x4d, 0x89, 0x11, 0x75, 0x33, +0x55, 0x33, 0x8d, 0xe8, 0x4a, 0xfd, 0xea, 0x6e, 0x30, 0x0b, 0xd7, 0x31, 0x2c, 0xde, 0x47, +0xe3, 0xbf, 0xf8, 0x55, 0x42, 0xe2, 0x7f, 0x59, 0xe5, 0x17, 0xef, 0x99, 0x34, 0x69, 0x91, +0xb1, 0x23, 0x8e, 0x20, 0x87, 0x2d, 0xa8, 0xfe, 0xd5, 0x8a, 0xf3, 0x84, 0x3a, 0xf0, 0x37, +0xe4, 0x09, 0x00, 0x54, 0xee, 0x67, 0x49, 0x93, 0xe4, 0x81, 0x70, 0xe3, 0x90, 0x4d, 0xef, +0xfe, 0x41, 0xb7, 0x99, 0x7b, 0xc1, 0x83, 0xba, 0x62, 0x12, 0x6f, 0x7d, 0xde, 0x6b, 0xaf, +0xda, 0x16, 0xf9, 0x55, 0x51, 0xee, 0xa6, 0x0c, 0x2b, 0x02, 0xa3, 0xfd, 0x8d, 0xfb, 0x30, +0x17, 0xe4, 0x6f, 0xdf, 0x36, 0x71, 0xc4, 0xca, 0x87, 0x25, 0x48, 0xb0, 0x47, 0xec, 0xea, +0xb4, 0xbf, 0xa5, 0x4d, 0x9b, 0x9f, 0x02, 0x93, 0xc4, 0xe3, 0xe4, 0xe8, 0x42, 0x2d, 0x68, +0x81, 0x15, 0x0a, 0xeb, 0x84, 0x5b, 0xd6, 0xa8, 0x74, 0xfb, 0x7d, 0x1d, 0xcb, 0x2c, 0xda, +0x46, 0x2a, 0x76, 0x62, 0xce, 0xbc, 0x5c, 0x9e, 0x8b, 0xe7, 0xcf, 0xbe, 0x78, 0xf5, 0x7c, +0xeb, 0xb3, 0x3a, 0x9c, 0xaa, 0x6f, 0xcc, 0x72, 0xd1, 0x59, 0xf2, 0x11, 0x23, 0xd6, 0x3f, +0x48, 0xd1, 0xb7, 0xce, 0xb0, 0xbf, 0xcb, 0xea, 0x80, 0xde, 0x57, 0xd4, 0x5e, 0x97, 0x2f, +0x75, 0xd1, 0x50, 0x8e, 0x80, 0x2c, 0x66, 0x79, 0xbf, 0x72, 0x4b, 0xbd, 0x8a, 0x81, 0x6c, +0xd3, 0xe1, 0x01, 0xdc, 0xd2, 0x15, 0x26, 0xc5, 0x36, 0xda, 0x2c, 0x1a, 0xc0, 0x27, 0x94, +0xed, 0xb7, 0x9b, 0x85, 0x0b, 0x5e, 0x80, 0x97, 0xc5, 0xec, 0x4f, 0xec, 0x88, 0x5d, 0x50, +0x07, 0x35, 0x47, 0xdc, 0x0b, 0x3b, 0x3d, 0xdd, 0x60, 0xaf, 0xa8, 0x5d, 0x81, 0x38, 0x24, +0x25, 0x5d, 0x5c, 0x15, 0xd1, 0xde, 0xb3, 0xab, 0xec, 0x05, 0x69, 0xef, 0x83, 0xed, 0x57, +0x54, 0xb8, 0x64, 0x64, 0x11, 0x16, 0x32, 0x69, 0xda, 0x9f, 0x2d, 0x7f, 0x36, 0xbb, 0x44, +0x5a, 0x34, 0xe8, 0x7f, 0xbf, 0x03, 0xeb, 0x00, 0x7f, 0x59, 0x68, 0x22, 0x79, 0xcf, 0x73, +0x6c, 0x2c, 0x29, 0xa7, 0xa1, 0x5f, 0x38, 0xa1, 0x1d, 0xf0, 0x20, 0x53, 0xe0, 0x1a, 0x63, +0x14, 0x58, 0x71, 0x10, 0xaa, 0x08, 0x0c, 0x3e, 0x16, 0x1a, 0x60, 0x22, 0x82, 0x7f, 0xba, +0xa4, 0x43, 0xa0, 0xd0, 0xac, 0x1b, 0xd5, 0x6b, 0x64, 0xb5, 0x14, 0x93, 0x31, 0x9e, 0x53, +0x50, 0xd0, 0x57, 0x66, 0xee, 0x5a, 0x4f, 0xfb, 0x03, 0x2a, 0x69, 0x58, 0x76, 0xf1, 0x83, +0xf7, 0x4e, 0xba, 0x8c, 0x42, 0x06, 0x60, 0x5d, 0x6d, 0xce, 0x60, 0x88, 0xae, 0xa4, 0xc3, +0xf1, 0x03, 0xa5, 0x4b, 0x98, 0xa1, 0xff, 0x67, 0xe1, 0xac, 0xa2, 0xb8, 0x62, 0xd7, 0x6f, +0xa0, 0x31, 0xb4, 0xd2, 0x77, 0xaf, 0x21, 0x10, 0x06, 0xc6, 0x9a, 0xff, 0x1d, 0x09, 0x17, +0x0e, 0x5f, 0xf1, 0xaa, 0x54, 0x34, 0x4b, 0x45, 0x8a, 0x87, 0x63, 0xa6, 0xdc, 0xf9, 0x24, +0x30, 0x67, 0xc6, 0xb2, 0xd6, 0x61, 0x33, 0x69, 0xee, 0x50, 0x61, 0x57, 0x28, 0xe7, 0x7e, +0xee, 0xec, 0x3a, 0x5a, 0x73, 0x4e, 0xa8, 0x8d, 0xe4, 0x18, 0xea, 0xec, 0x41, 0x64, 0xc8, +0xe2, 0xe8, 0x66, 0xb6, 0x2d, 0xb6, 0xfb, 0x6a, 0x6c, 0x16, 0xb3, 0xdd, 0x46, 0x43, 0xb9, +0x73, 0x00, 0x6a, 0x71, 0xed, 0x4e, 0x9d, 0x25, 0x1a, 0xc3, 0x3c, 0x4a, 0x95, 0x15, 0x99, +0x35, 0x81, 0x14, 0x02, 0xd6, 0x98, 0x9b, 0xec, 0xd8, 0x23, 0x3b, 0x84, 0x29, 0xaf, 0x0c, +0x99, 0x83, 0xa6, 0x9a, 0x34, 0x4f, 0xfa, 0xe8, 0xd0, 0x3c, 0x4b, 0xd0, 0xfb, 0xb6, 0x68, +0xb8, 0x9e, 0x8f, 0xcd, 0xf7, 0x60, 0x2d, 0x7a, 0x22, 0xe5, 0x7d, 0xab, 0x65, 0x1b, 0x95, +0xa7, 0xa8, 0x7f, 0xb6, 0x77, 0x47, 0x7b, 0x5f, 0x8b, 0x12, 0x72, 0xd0, 0xd4, 0x91, 0xef, +0xde, 0x19, 0x50, 0x3c, 0xa7, 0x8b, 0xc4, 0xa9, 0xb3, 0x23, 0xcb, 0x76, 0xe6, 0x81, 0xf0, +0xc1, 0x04, 0x8f, 0xa3, 0xb8, 0x54, 0x5b, 0x97, 0xac, 0x19, 0xff, 0x3f, 0x55, 0x27, 0x2f, +0xe0, 0x1d, 0x42, 0x9b, 0x57, 0xfc, 0x4b, 0x4e, 0x0f, 0xce, 0x98, 0xa9, 0x43, 0x57, 0x03, +0xbd, 0xe7, 0xc8, 0x94, 0xdf, 0x6e, 0x36, 0x73, 0x32, 0xb4, 0xef, 0x2e, 0x85, 0x7a, 0x6e, +0xfc, 0x6c, 0x18, 0x82, 0x75, 0x35, 0x90, 0x07, 0xf3, 0xe4, 0x9f, 0x3e, 0xdc, 0x68, 0xf3, +0xb5, 0xf3, 0x19, 0x80, 0x92, 0x06, 0x99, 0xa2, 0xe8, 0x6f, 0xff, 0x2e, 0x7f, 0xae, 0x42, +0xa4, 0x5f, 0xfb, 0xd4, 0x0e, 0x81, 0x2b, 0xc3, 0x04, 0xff, 0x2b, 0xb3, 0x74, 0x4e, 0x36, +0x5b, 0x9c, 0x15, 0x00, 0xc6, 0x47, 0x2b, 0xe8, 0x8b, 0x3d, 0xf1, 0x9c, 0x03, 0x9a, 0x58, +0x7f, 0x9b, 0x9c, 0xbf, 0x85, 0x49, 0x79, 0x35, 0x2e, 0x56, 0x7b, 0x41, 0x14, 0x39, 0x47, +0x83, 0x26, 0xaa, 0x07, 0x89, 0x98, 0x11, 0x1b, 0x86, 0xe7, 0x73, 0x7a, 0xd8, 0x7d, 0x78, +0x61, 0x53, 0xe9, 0x79, 0xf5, 0x36, 0x8d, 0x44, 0x92, 0x84, 0xf9, 0x13, 0x50, 0x58, 0x3b, +0xa4, 0x6a, 0x36, 0x65, 0x49, 0x8e, 0x3c, 0x0e, 0xf1, 0x6f, 0xd2, 0x84, 0xc4, 0x7e, 0x8e, +0x3f, 0x39, 0xae, 0x7c, 0x84, 0xf1, 0x63, 0x37, 0x8e, 0x3c, 0xcc, 0x3e, 0x44, 0x81, 0x45, +0xf1, 0x4b, 0xb9, 0xed, 0x6b, 0x36, 0x5d, 0xbb, 0x20, 0x60, 0x1a, 0x0f, 0xa3, 0xaa, 0x55, +0x77, 0x3a, 0xa9, 0xae, 0x37, 0x4d, 0xba, 0xb8, 0x86, 0x6b, 0xbc, 0x08, 0x50, 0xf6, 0xcc, +0xa4, 0xbd, 0x1d, 0x40, 0x72, 0xa5, 0x86, 0xfa, 0xe2, 0x10, 0xae, 0x3d, 0x58, 0x4b, 0x97, +0xf3, 0x43, 0x74, 0xa9, 0x9e, 0xeb, 0x21, 0xb7, 0x01, 0xa4, 0x86, 0x93, 0x97, 0xee, 0x2f, +0x4f, 0x3b, 0x86, 0xa1, 0x41, 0x6f, 0x41, 0x26, 0x90, 0x78, 0x5c, 0x7f, 0x30, 0x38, 0x4b, +0x3f, 0xaa, 0xec, 0xed, 0x5c, 0x6f, 0x0e, 0xad, 0x43, 0x87, 0xfd, 0x93, 0x35, 0xe6, 0x01, +0xef, 0x41, 0x26, 0x90, 0x99, 0x9e, 0xfb, 0x19, 0x5b, 0xad, 0xd2, 0x91, 0x8a, 0xe0, 0x46, +0xaf, 0x65, 0xfa, 0x4f, 0x84, 0xc1, 0xa1, 0x2d, 0xcf, 0x45, 0x8b, 0xd3, 0x85, 0x50, 0x55, +0x7c, 0xf9, 0x67, 0x88, 0xd4, 0x4e, 0xe9, 0xd7, 0x6b, 0x61, 0x54, 0xa1, 0xa4, 0xa6, 0xa2, +0xc2, 0xbf, 0x30, 0x9c, 0x40, 0x9f, 0x5f, 0xd7, 0x69, 0x2b, 0x24, 0x82, 0x5e, 0xd9, 0xd6, +0xa7, 0x12, 0x54, 0x1a, 0xf7, 0x55, 0x9f, 0x76, 0x50, 0xa9, 0x95, 0x84, 0xe6, 0x6b, 0x6d, +0xb5, 0x96, 0x54, 0xd6, 0xcd, 0xb3, 0xa1, 0x9b, 0x46, 0xa7, 0x94, 0x4d, 0xc4, 0x94, 0xb4, +0x98, 0xe3, 0xe1, 0xe2, 0x34, 0xd5, 0x33, 0x16, 0x07, 0x54, 0xcd, 0xb7, 0x77, 0x53, 0xdb, +0x4f, 0x4d, 0x46, 0x9d, 0xe9, 0xd4, 0x9c, 0x8a, 0x36, 0xb6, 0xb8, 0x38, 0x26, 0x6c, 0x0e, +0xff, 0x9c, 0x1b, 0x43, 0x8b, 0x80, 0xcc, 0xb9, 0x3d, 0xda, 0xc7, 0xf1, 0x8a, 0xf2, 0x6d, +0xb8, 0xd7, 0x74, 0x2f, 0x7e, 0x1e, 0xb7, 0xd3, 0x4a, 0xb4, 0xac, 0xfc, 0x79, 0x48, 0x6c, +0xbc, 0x96, 0xb6, 0x94, 0x46, 0x57, 0x2d, 0xb0, 0xa3, 0xfc, 0x1e, 0xb9, 0x52, 0x60, 0x85, +0x2d, 0x41, 0xd0, 0x43, 0x01, 0x1e, 0x1c, 0xd5, 0x7d, 0xfc, 0xf3, 0x96, 0x0d, 0xc7, 0xcb, +0x2a, 0x29, 0x9a, 0x93, 0xdd, 0x88, 0x2d, 0x37, 0x5d, 0xaa, 0xfb, 0x49, 0x68, 0xa0, 0x9c, +0x50, 0x86, 0x7f, 0x68, 0x56, 0x57, 0xf9, 0x79, 0x18, 0x39, 0xd4, 0xe0, 0x01, 0x84, 0x33, +0x61, 0xca, 0xa5, 0xd2, 0xd6, 0xe4, 0xc9, 0x8a, 0x4a, 0x23, 0x44, 0x4e, 0xbc, 0xf0, 0xdc, +0x24, 0xa1, 0xa0, 0xc4, 0xe2, 0x07, 0x3c, 0x10, 0xc4, 0xb5, 0x25, 0x4b, 0x65, 0x63, 0xf4, +0x80, 0xe7, 0xcf, 0x61, 0xb1, 0x71, 0x82, 0x21, 0x87, 0x2c, 0xf5, 0x91, 0x00, 0x32, 0x0c, +0xec, 0xa9, 0xb5, 0x9a, 0x74, 0x85, 0xe3, 0x36, 0x8f, 0x76, 0x4f, 0x9c, 0x6d, 0xce, 0xbc, +0xad, 0x0a, 0x4b, 0xed, 0x76, 0x04, 0xcb, 0xc3, 0xb9, 0x33, 0x9e, 0x01, 0x93, 0x96, 0x69, +0x7d, 0xc5, 0xa2, 0x45, 0x79, 0x9b, 0x04, 0x5c, 0x84, 0x09, 0xed, 0x88, 0x43, 0xc7, 0xab, +0x93, 0x14, 0x26, 0xa1, 0x40, 0xb5, 0xce, 0x4e, 0xbf, 0x2a, 0x42, 0x85, 0x3e, 0x2c, 0x3b, +0x54, 0xe8, 0x12, 0x1f, 0x0e, 0x97, 0x59, 0xb2, 0x27, 0x89, 0xfa, 0xf2, 0xdf, 0x8e, 0x68, +0x59, 0xdc, 0x06, 0xbc, 0xb6, 0x85, 0x0d, 0x06, 0x22, 0xec, 0xb1, 0xcb, 0xe5, 0x04, 0xe6, +0x3d, 0xb3, 0xb0, 0x41, 0x73, 0x08, 0x3f, 0x3c, 0x58, 0x86, 0x63, 0xeb, 0x50, 0xee, 0x1d, +0x2c, 0x37, 0x74, 0xa9, 0xd3, 0x18, 0xa3, 0x47, 0x6e, 0x93, 0x54, 0xad, 0x0a, 0x5d, 0xb8, +0x2a, 0x55, 0x5d, 0x78, 0xf6, 0xee, 0xbe, 0x8e, 0x3c, 0x76, 0x69, 0xb9, 0x40, 0xc2, 0x34, +0xec, 0x2a, 0xb9, 0xed, 0x7e, 0x20, 0xe4, 0x8d, 0x00, 0x38, 0xc7, 0xe6, 0x8f, 0x44, 0xa8, +0x86, 0xce, 0xeb, 0x2a, 0xe9, 0x90, 0xf1, 0x4c, 0xdf, 0x32, 0xfb, 0x73, 0x1b, 0x6d, 0x92, +0x1e, 0x95, 0xfe, 0xb4, 0xdb, 0x65, 0xdf, 0x4d, 0x23, 0x54, 0x89, 0x48, 0xbf, 0x4a, 0x2e, +0x70, 0xd6, 0xd7, 0x62, 0xb4, 0x33, 0x29, 0xb1, 0x3a, 0x33, 0x4c, 0x23, 0x6d, 0xa6, 0x76, +0xa5, 0x21, 0x63, 0x48, 0xe6, 0x90, 0x5d, 0xed, 0x90, 0x95, 0x0b, 0x7a, 0x84, 0xbe, 0xb8, +0x0d, 0x5e, 0x63, 0x0c, 0x62, 0x26, 0x4c, 0x14, 0x5a, 0xb3, 0xac, 0x23, 0xa4, 0x74, 0xa7, +0x6f, 0x33, 0x30, 0x05, 0x60, 0x01, 0x42, 0xa0, 0x28, 0xb7, 0xee, 0x19, 0x38, 0xf1, 0x64, +0x80, 0x82, 0x43, 0xe1, 0x41, 0x27, 0x1f, 0x1f, 0x90, 0x54, 0x7a, 0xd5, 0x23, 0x2e, 0xd1, +0x3d, 0xcb, 0x28, 0xba, 0x58, 0x7f, 0xdc, 0x7c, 0x91, 0x24, 0xe9, 0x28, 0x51, 0x83, 0x6e, +0xc5, 0x56, 0x21, 0x42, 0xed, 0xa0, 0x56, 0x22, 0xa1, 0x40, 0x80, 0x6b, 0xa8, 0xf7, 0x94, +0xca, 0x13, 0x6b, 0x0c, 0x39, 0xd9, 0xfd, 0xe9, 0xf3, 0x6f, 0xa6, 0x9e, 0xfc, 0x70, 0x8a, +0xb3, 0xbc, 0x59, 0x3c, 0x1e, 0x1d, 0x6c, 0xf9, 0x7c, 0xaf, 0xf9, 0x88, 0x71, 0x95, 0xeb, +0x57, 0x00, 0xbd, 0x9f, 0x8c, 0x4f, 0xe1, 0x24, 0x83, 0xc5, 0x22, 0xea, 0xfd, 0xd3, 0x0c, +0xe2, 0x17, 0x18, 0x7c, 0x6a, 0x4c, 0xde, 0x77, 0xb4, 0x53, 0x9b, 0x4c, 0x81, 0xcd, 0x23, +0x60, 0xaa, 0x0e, 0x25, 0x73, 0x9c, 0x02, 0x79, 0x32, 0x30, 0xdf, 0x74, 0xdf, 0x75, 0x19, +0xf4, 0xa5, 0x14, 0x5c, 0xf7, 0x7a, 0xa8, 0xa5, 0x91, 0x84, 0x7c, 0x60, 0x03, 0x06, 0x3b, +0xcd, 0x50, 0xb6, 0x27, 0x9c, 0xfe, 0xb1, 0xdd, 0xcc, 0xd3, 0xb0, 0x59, 0x24, 0xb2, 0xca, +0xe2, 0x1c, 0x81, 0x22, 0x9d, 0x07, 0x8f, 0x8e, 0xb9, 0xbe, 0x4e, 0xfa, 0xfc, 0x39, 0x65, +0xba, 0xbf, 0x9d, 0x12, 0x37, 0x5e, 0x97, 0x7e, 0xf3, 0x89, 0xf5, 0x5d, 0xf5, 0xe3, 0x09, +0x8c, 0x62, 0xb5, 0x20, 0x9d, 0x0c, 0x53, 0x8a, 0x68, 0x1b, 0xd2, 0x8f, 0x75, 0x17, 0x5d, +0xd4, 0xe5, 0xda, 0x75, 0x62, 0x19, 0x14, 0x6a, 0x26, 0x2d, 0xeb, 0xf8, 0xaf, 0x37, 0xf0, +0x6c, 0xa4, 0x55, 0xb1, 0xbc, 0xe2, 0x33, 0xc0, 0x9a, 0xca, 0xb0, 0x11, 0x49, 0x4f, 0x68, +0x9b, 0x3b, 0x6b, 0x3c, 0xcc, 0x13, 0xf6, 0xc7, 0x85, 0x61, 0x68, 0x42, 0xae, 0xbb, 0xdd, +0xcd, 0x45, 0x16, 0x29, 0x1d, 0xea, 0xdb, 0xc8, 0x03, 0x94, 0x3c, 0xee, 0x4f, 0x82, 0x11, +0xc3, 0xec, 0x28, 0xbd, 0x97, 0x05, 0x99, 0xde, 0xd7, 0xbb, 0x5e, 0x22, 0x1f, 0xd4, 0xeb, +0x64, 0xd9, 0x92, 0xd9, 0x85, 0xb7, 0x6a, 0x05, 0x6a, 0xe4, 0x24, 0x41, 0xf1, 0xcd, 0xf0, +0xd8, 0x3f, 0xf8, 0x9e, 0x0e, 0xcd, 0x0b, 0x7a, 0x70, 0x6b, 0x5a, 0x75, 0x0a, 0x6a, 0x33, +0x88, 0xec, 0x17, 0x75, 0x08, 0x70, 0x10, 0x2f, 0x24, 0xcf, 0xc4, 0xe9, 0x42, 0x00, 0x61, +0x94, 0xca, 0x1f, 0x3a, 0x76, 0x06, 0xfa, 0xd2, 0x48, 0x81, 0xf0, 0x77, 0x60, 0x03, 0x45, +0xd9, 0x61, 0xf4, 0xa4, 0x6f, 0x3d, 0xd9, 0x30, 0xc3, 0x04, 0x6b, 0x54, 0x2a, 0xb7, 0xec, +0x3b, 0xf4, 0x4b, 0xf5, 0x68, 0x52, 0x26, 0xce, 0xff, 0x5d, 0x19, 0x91, 0xa0, 0xa3, 0xa5, +0xa9, 0xb1, 0xe0, 0x23, 0xc4, 0x0a, 0x77, 0x4d, 0xf9, 0x51, 0x20, 0xa3, 0xa5, 0xa9, 0xb1, +0xc1, 0x00, 0x82, 0x86, 0x8e, 0x7f, 0x5d, 0x19, 0x91, 0xa0, 0xa3, 0xc4, 0xeb, 0x54, 0x0b, +0x75, 0x68, 0x52, 0x07, 0x8c, 0x9a, 0x97, 0x8d, 0x79, 0x70, 0x62, 0x46, 0xef, 0x5c, 0x1b, +0x95, 0x89, 0x71, 0x41, 0xe1, 0x21, 0xa1, 0xa1, 0xa1, 0xc0, 0x02, 0x67, 0x4c, 0x1a, 0xb6, +0xcf, 0xfd, 0x78, 0x53, 0x24, 0xab, 0xb5, 0xc9, 0xf1, 0x60, 0x23, 0xa5, 0xc8, 0x12, 0x87, +0x6d, 0x58, 0x13, 0x85, 0x88, 0x92, 0x87, 0x6d, 0x58, 0x32, 0xc7, 0x0c, 0x9a, 0x97, 0xac, +0xda, 0x36, 0xee, 0x5e, 0x3e, 0xdf, 0x1d, 0xb8, 0xf2, 0x66, 0x2f, 0xbd, 0xf8, 0x72, 0x47, +0xed, 0x58, 0x13, 0x85, 0x88, 0x92, 0x87, 0x8c, 0x7b, 0x55, 0x09, 0x90, 0xa2, 0xc6, 0xef, +0x3d, 0xf8, 0x53, 0x24, 0xab, 0xd4, 0x2a, 0xb7, 0xec, 0x5a, 0x36, 0xee, 0x5e, 0x3e, 0xdf, +0x3c, 0xfa, 0x76, 0x4f, 0xfd, 0x59, 0x30, 0xe2, 0x46, 0xef, 0x3d, 0xf8, 0x53, 0x05, 0x69, +0x31, 0xc1, 0x00, 0x82, 0x86, 0x8e, 0x7f, 0x5d, 0x19, 0xb0, 0xe2, 0x27, 0xcc, 0xfb, 0x74, +0x4b, 0x14, 0x8b, 0x94, 0x8b, 0x75, 0x68, 0x33, 0xc5, 0x08, 0x92, 0x87, 0x8c, 0x9a, 0xb6, +0xcf, 0x1c, 0xba, 0xd7, 0x0d, 0x98, 0xb2, 0xe6, 0x2f, 0xdc, 0x1b, 0x95, 0x89, 0x71, 0x60, +0x23, 0xc4, 0x0a, 0x96, 0x8f, 0x9c, 0xba, 0xf6, 0x6e, 0x3f, 0xfc, 0x5b, 0x15, 0xa8, 0xd2, +0x26, 0xaf, 0xbd, 0xf8, 0x72, 0x66, 0x2f, 0xdc, 0x1b, 0xb4, 0xcb, 0x14, 0x8b, 0x94, 0xaa, +0xb7, 0xcd, 0xf9, 0x51, 0x01, 0x80, 0x82, 0x86, 0x6f, 0x3d, 0xd9, 0x30, 0xe2, 0x27, 0xcc, +0xfb, 0x74, 0x4b, 0x14, 0xaa, 0xb7, 0xcd, 0xf9, 0x70, 0x43, 0x04, 0x6b, 0x35, 0xc9, 0xf1, +0x60, 0x23, 0xa5, 0xc8, 0xf3, 0x45, 0x08, 0x92, 0x87, 0x6d, 0x58, 0x32, 0xe6, 0x2f, 0xbd, +0xf8, 0x72, 0x66, 0x4e, 0x1e, 0xbe, 0xfe, 0x7e, 0x7e, 0x7e, 0x5f, 0x1d, 0x99, 0x91, 0xa0, +0xa3, 0xc4, 0x0a, 0x77, 0x4d, 0x18, 0x93, 0xa4, 0xab, 0xd4, 0x0b, 0x75, 0x49, 0x10, 0xa2, +0xc6, 0xef, 0x3d, 0xf8, 0x53, 0x24, 0xab, 0xb5, 0xe8, 0x33, 0xe4, 0x4a, 0x16, 0xae, 0xde, +0x1f, 0xbc, 0xdb, 0x15, 0xa8, 0xb3, 0xc5, 0x08, 0x73, 0x45, 0xe9, 0x31, 0xc1, 0xe1, 0x21, +0xa1, 0xa1, 0xa1, 0xc0, 0x02, 0x86, 0x6f, 0x5c, 0x3a, 0xd7, 0x0d, 0x98, 0x93, 0xa4, 0xca, +0x16, 0xae, 0xde, 0x1f, 0x9d, 0x99, 0xb0, 0xe2, 0x46, 0xef, 0x3d, 0xf8, 0x72, 0x47, 0x0c, +0x9a, 0xb6, 0xcf, 0xfd, 0x59, 0x11, 0xa0, 0xa3, 0xa5, 0xc8, 0xf3, 0x45, 0x08, 0x92, 0x87, +0x6d, 0x39, 0xf0, 0x43, 0x04, 0x8a, 0x96, 0xae, 0xde, 0x3e, 0xdf, 0x1d, 0x99, 0x91, 0xa0, +0xc2, 0x06, 0x6f, 0x3d, 0xf8, 0x72, 0x47, 0x0c, 0x9a, 0x97, 0x8d, 0x98, 0x93, 0x85, 0x88, +0x73, 0x45, 0xe9, 0x31, 0xe0, 0x23, 0xa5, 0xa9, 0xd0, 0x03, 0x84, 0x8a, 0x96, 0xae, 0xde, +0x1f, 0xbc, 0xdb, 0x15, 0xa8, 0xd2, 0x26, 0xce, 0xff, 0x5d, 0x19, 0x91, 0x81, 0x80, 0x82, +0x67, 0x2d, 0xd8, 0x13, 0xa4, 0xab, 0xd4, 0x0b, 0x94, 0xaa, 0xb7, 0xcd, 0xf9, 0x51, 0x20, +0xa3, 0xa5, 0xc8, 0xf3, 0x45, 0xe9, 0x50, 0x22, 0xc6, 0xef, 0x5c, 0x3a, 0xd7, 0x0d, 0x98, +0x93, 0x85, 0x88, 0x73, 0x64, 0x4a, 0xf7, 0x4d, 0xf9, 0x51, 0x20, 0xa3, 0xc4, 0x0a, 0x96, +0xae, 0xde, 0x3e, 0xfe, 0x7e, 0x7e, 0x7e, 0x5f, 0x3c, 0xfa, 0x76, 0x4f, 0xfd, 0x78, 0x72, +0x66, 0x2f, 0xbd, 0xd9, 0x30, 0xc3, 0xe5, 0x48, 0x12, 0x87, 0x8c, 0x7b, 0x55, 0x28, 0xd2, +0x07, 0x8c, 0x9a, 0x97, 0xac, 0xda, 0x17, 0x8d, 0x79, 0x51, 0x20, 0xa3, 0xc4, 0xeb, 0x54, +0x0b, 0x94, 0x8b, 0x94, 0xaa, 0xd6, 0x2e, 0xbf, 0xfc, 0x5b, 0x15, 0xa8, 0xd2, 0x26, 0xaf, +0xdc, 0x1b, 0xb4, 0xea, 0x37, 0xec, 0x3b, 0xf4, 0x6a, 0x37, 0xcd, 0x18, 0x93, 0x85, 0x69, +0x31, 0xc1, 0xe1, 0x40, 0xe3, 0x25, 0xc8, 0x12, 0x87, 0x8c, 0x9a, 0xb6, 0xcf, 0xfd, 0x59, +0x11, 0xa0, 0xc2, 0x06, 0x8e, 0x7f, 0x5d, 0x38, 0xf2, 0x47, 0x0c, 0x7b, 0x74, 0x6a, 0x37, +0xec, 0x5a, 0x36, 0xee, 0x3f, 0xfc, 0x7a, 0x76, 0x4f, 0x1c, 0x9b, 0x95, 0x89, 0x71, 0x41, +0x00, 0x63, 0x44, 0xeb, 0x54, 0x2a, 0xd6, 0x0f, 0x9c, 0xba, 0xd7, 0x0d, 0x98, 0x93, 0x85, +0x69, 0x31, 0xc1, 0x00, 0x82, 0x86, 0x8e, 0x9e, 0xbe, 0xdf, 0x3c, 0xfa, 0x57, 0x2c, 0xda, +0x36, 0xee, 0x3f, 0xfc, 0x5b, 0x15, 0x89, 0x71, 0x41, 0x00, 0x82, 0x86, 0x8e, 0x7f, 0x5d, +0x38, 0xf2, 0x47, 0xed, 0x58, 0x13, 0xa4, 0xca, 0xf7, 0x4d, 0xf9, 0x51, 0x01, 0x80, 0x63, +0x44, 0xeb, 0x54, 0x2a, 0xd6, 0x2e, 0xbf, 0xdd, 0x19, 0x91, 0xa0, 0xa3, 0xa5, 0xa9, 0xb1, +0xe0, 0x42, 0x06, 0x8e, 0x7f, 0x5d, 0x19, 0x91, 0xa0, 0xa3, 0xc4, 0x0a, 0x96, 0x8f, 0x7d, +0x78, 0x72, 0x47, 0x0c, 0x7b, 0x74, 0x6a, 0x56, 0x2e, 0xde, 0x1f, 0xbc, 0xfa, 0x57, 0x0d, +0x79, 0x51, 0x01, 0x61, 0x21, 0xa1, 0xc0, 0xe3, 0x25, 0xa9, 0xb1, 0xc1, 0xe1, 0x40, 0x02, +0x67, 0x4c, 0x1a, 0x97, 0x8d, 0x98, 0x93, 0xa4, 0xab, 0xd4, 0x2a, 0xd6, 0x0f, 0x9c, 0x9b, +0xb4, 0xcb, 0x14, 0xaa, 0xb7, 0xcd, 0xf9, 0x51, 0x20, 0xa3, 0xc4, 0xeb, 0x35, 0xc9, 0xf1, +0x60, 0x42, 0x06, 0x8e, 0x7f, 0x7c, 0x7a, 0x76, 0x6e, 0x3f, 0xfc, 0x7a, 0x76, 0x6e, 0x5e, +0x3e, 0xfe, 0x7e, 0x5f, 0x3c, 0xdb, 0x15, 0x89, 0x71, 0x41, 0xe1, 0x21, 0xc0, 0xe3, 0x44, +0xeb, 0x54, 0x2a, 0xb7, 0xcd, 0xf9, 0x70, 0x62, 0x27, 0xad, 0xd8, 0x32, 0xc7, 0x0c, 0x7b, +0x74, 0x4b, 0x14, 0xaa, 0xb7, 0xec, 0x3b, 0xd5, 0x28, 0xd2, 0x07, 0x6d, 0x39, 0xd1, 0x20, +0xc2, 0xe7, 0x4c, 0x1a, 0x97, 0x8d, 0x98, 0xb2, 0xc7, 0x0c, 0x59, 0x28, 0xf3, 0x9b }; + +// clang-format off diff --git a/drivers/serial.h b/drivers/serial.h new file mode 100644 index 0000000000..d9c2a69e96 --- /dev/null +++ b/drivers/serial.h @@ -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/>. + */ + +#pragma once + +#include <stdint.h> +#include <stdbool.h> + +#include <transactions.h> + +// initiator is transaction start side +void soft_serial_initiator_init(void); +// target is interrupt accept side +void soft_serial_target_init(void); + +// initiator result +#define TRANSACTION_END 0 +#define TRANSACTION_NO_RESPONSE 0x1 +#define TRANSACTION_DATA_ERROR 0x2 +#define TRANSACTION_TYPE_ERROR 0x4 +int soft_serial_transaction(int sstd_index); + +// 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 +int soft_serial_get_and_clean_status(int sstd_index); diff --git a/keyboards/ergodox_ez/config.h b/keyboards/ergodox_ez/config.h index 874ec795bd..5fdc4e5f19 100644 --- a/keyboards/ergodox_ez/config.h +++ b/keyboards/ergodox_ez/config.h @@ -125,7 +125,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define RGB_MATRIX_LED_PROCESS_LIMIT 5 #define RGB_MATRIX_LED_FLUSH_LIMIT 26 -#define RGB_DISABLE_WHEN_USB_SUSPENDED true + +#define RGB_DISABLE_WHEN_USB_SUSPENDED // #define RGBLIGHT_COLOR_LAYER_0 0x00, 0x00, 0xFF /* #define RGBLIGHT_COLOR_LAYER_1 0x00, 0x00, 0xFF */ diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c index 28a6fc9670..47537a71d7 100644 --- a/keyboards/ergodox_ez/ergodox_ez.c +++ b/keyboards/ergodox_ez/ergodox_ez.c @@ -44,29 +44,29 @@ extern inline void ergodox_led_all_set(uint8_t n); keyboard_config_t keyboard_config; -bool i2c_initialized = 0; +bool i2c_initialized = 0; i2c_status_t mcp23018_status = 0x20; void matrix_init_kb(void) { - // keyboard LEDs (see "PWM on ports OC1(A|B|C)" in "teensy-2-0.md") + // keyboard LEDs (see "PWM on ports OC1(A|B|C)" in "teensy-2-0.md") TCCR1A = 0b10101001; // set and configure fast PWM TCCR1B = 0b00001001; // set and configure fast PWM // (tied to Vcc for hardware convenience) - DDRB &= ~(1<<4); // set B(4) as input - PORTB &= ~(1<<4); // set B(4) internal pull-up disabled + DDRB &= ~(1 << 4); // set B(4) as input + PORTB &= ~(1 << 4); // set B(4) internal pull-up disabled // unused pins - C7, D4, D5, D7, E6 // set as input with internal pull-up enabled - DDRC &= ~(1<<7); - DDRD &= ~(1<<5 | 1<<4); - DDRE &= ~(1<<6); - PORTC |= (1<<7); - PORTD |= (1<<5 | 1<<4); - PORTE |= (1<<6); + DDRC &= ~(1 << 7); + DDRD &= ~(1 << 5 | 1 << 4); + DDRE &= ~(1 << 6); + PORTC |= (1 << 7); + PORTD |= (1 << 5 | 1 << 4); + PORTE |= (1 << 6); keyboard_config.raw = eeconfig_read_kb(); - ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 ); + ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4); #ifdef RGB_MATRIX_ENABLE if (keyboard_config.rgb_matrix_enable) { rgb_matrix_set_flags(LED_FLAG_ALL); @@ -80,8 +80,7 @@ void matrix_init_kb(void) { matrix_init_user(); } -void ergodox_blink_all_leds(void) -{ +void ergodox_blink_all_leds(void) { ergodox_led_all_off(); ergodox_led_all_set(LED_BRIGHTNESS_DEFAULT); ergodox_right_led_1_on(); @@ -94,17 +93,17 @@ void ergodox_blink_all_leds(void) ergodox_left_led_1_on(); _delay_ms(50); if (!mcp23018_status) { - mcp23018_status = ergodox_left_leds_update(); + mcp23018_status = ergodox_left_leds_update(); } ergodox_left_led_2_on(); _delay_ms(50); if (!mcp23018_status) { - mcp23018_status = ergodox_left_leds_update(); + mcp23018_status = ergodox_left_leds_update(); } ergodox_left_led_3_on(); _delay_ms(50); if (!mcp23018_status) { - mcp23018_status = ergodox_left_leds_update(); + mcp23018_status = ergodox_left_leds_update(); } #endif ergodox_right_led_1_off(); @@ -116,21 +115,21 @@ void ergodox_blink_all_leds(void) _delay_ms(50); ergodox_left_led_1_off(); if (!mcp23018_status) { - mcp23018_status = ergodox_left_leds_update(); + mcp23018_status = ergodox_left_leds_update(); } _delay_ms(50); ergodox_left_led_2_off(); if (!mcp23018_status) { - mcp23018_status = ergodox_left_leds_update(); + mcp23018_status = ergodox_left_leds_update(); } _delay_ms(50); ergodox_left_led_3_off(); if (!mcp23018_status) { - mcp23018_status = ergodox_left_leds_update(); + mcp23018_status = ergodox_left_leds_update(); } #endif - //ergodox_led_all_on(); + // ergodox_led_all_on(); //_delay_ms(333); ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 ); @@ -158,27 +157,35 @@ uint8_t init_mcp23018(void) { // - unused : input : 1 // - input : input : 1 // - driving : output : 0 - mcp23018_status = i2c_start(I2C_ADDR_WRITE, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(IODIRA, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00000000, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00111111, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_start(I2C_ADDR_WRITE, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(IODIRA, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00000000, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00111111, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; i2c_stop(); // set pull-up // - unused : on : 1 // - input : on : 1 // - driving : off : 0 - mcp23018_status = i2c_start(I2C_ADDR_WRITE, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(GPPUA, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00000000, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b00111111, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; + mcp23018_status = i2c_start(I2C_ADDR_WRITE, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(GPPUA, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00000000, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; + mcp23018_status = i2c_write(0b00111111, ERGODOX_EZ_I2C_TIMEOUT); + if (mcp23018_status) goto out; out: i2c_stop(); #ifdef LEFT_LEDS if (!mcp23018_status) mcp23018_status = ergodox_left_leds_update(); -#endif // LEFT_LEDS +#endif // LEFT_LEDS // SREG=sreg_prev; @@ -187,12 +194,12 @@ out: #ifdef LEFT_LEDS uint8_t ergodox_left_leds_update(void) { - if (mcp23018_status) { // if there was an error + if (mcp23018_status) { // if there was an error return mcp23018_status; } -#define LEFT_LED_1_SHIFT 7 // in MCP23018 port B -#define LEFT_LED_2_SHIFT 6 // in MCP23018 port B -#define LEFT_LED_3_SHIFT 7 // in MCP23018 port A +# define LEFT_LED_1_SHIFT 7 // in MCP23018 port B +# define LEFT_LED_2_SHIFT 6 // in MCP23018 port B +# define LEFT_LED_3_SHIFT 7 // in MCP23018 port A // set logical value (doesn't matter on inputs) // - unused : hi-Z : 1 @@ -202,49 +209,43 @@ uint8_t ergodox_left_leds_update(void) { if (mcp23018_status) goto out; mcp23018_status = i2c_write(OLATA, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b11111111 - & ~(ergodox_left_led_3<<LEFT_LED_3_SHIFT), - ERGODOX_EZ_I2C_TIMEOUT); + mcp23018_status = i2c_write(0b11111111 & ~(ergodox_left_led_3 << LEFT_LED_3_SHIFT), ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b11111111 - & ~(ergodox_left_led_2<<LEFT_LED_2_SHIFT) - & ~(ergodox_left_led_1<<LEFT_LED_1_SHIFT), - ERGODOX_EZ_I2C_TIMEOUT); + mcp23018_status = i2c_write(0b11111111 & ~(ergodox_left_led_2 << LEFT_LED_2_SHIFT) & ~(ergodox_left_led_1 << LEFT_LED_1_SHIFT), ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out; - out: +out: i2c_stop(); return mcp23018_status; } #endif - #ifdef SWAP_HANDS_ENABLE -__attribute__ ((weak)) +__attribute__((weak)) // swap-hands action needs a matrix to define the swap const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { /* Left hand, matrix positions */ - {{0,13}, {1,13}, {2,13}, {3,13}, {4,13}, {5,13}}, - {{0,12}, {1,12}, {2,12}, {3,12}, {4,12}, {5,12}}, - {{0,11}, {1,11}, {2,11}, {3,11}, {4,11}, {5,11}}, - {{0,10}, {1,10}, {2,10}, {3,10}, {4,10}, {5,10}}, - {{0,9}, {1,9}, {2,9}, {3,9}, {4,9}, {5,9}}, - {{0,8}, {1,8}, {2,8}, {3,8}, {4,8}, {5,8}}, - {{0,7}, {1,7}, {2,7}, {3,7}, {4,7}, {5,7}}, + {{0, 13}, {1, 13}, {2, 13}, {3, 13}, {4, 13}, {5, 13}}, + {{0, 12}, {1, 12}, {2, 12}, {3, 12}, {4, 12}, {5, 12}}, + {{0, 11}, {1, 11}, {2, 11}, {3, 11}, {4, 11}, {5, 11}}, + {{0, 10}, {1, 10}, {2, 10}, {3, 10}, {4, 10}, {5, 10}}, + {{0, 9}, {1, 9}, {2, 9}, {3, 9}, {4, 9}, {5, 9}}, + {{0, 8}, {1, 8}, {2, 8}, {3, 8}, {4, 8}, {5, 8}}, + {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}}, /* Right hand, matrix positions */ - {{0,6}, {1,6}, {2,6}, {3,6}, {4,6}, {5,6}}, - {{0,5}, {1,5}, {2,5}, {3,5}, {4,5}, {5,5}}, - {{0,4}, {1,4}, {2,4}, {3,4}, {4,4}, {5,4}}, - {{0,3}, {1,3}, {2,3}, {3,3}, {4,3}, {5,3}}, - {{0,2}, {1,2}, {2,2}, {3,2}, {4,2}, {5,2}}, - {{0,1}, {1,1}, {2,1}, {3,1}, {4,1}, {5,1}}, - {{0,0}, {1,0}, {2,0}, {3,0}, {4,0}, {5,0}}, + {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}, + {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}}, + {{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}}, + {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}}, + {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}}, + {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}}, + {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}}, }; #endif #ifdef RGB_MATRIX_ENABLE - -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +// clang-format off +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { /* driver * | R location * | | G location @@ -338,17 +339,7 @@ led_config_t g_led_config = { { 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1 } }; - -void suspend_power_down_kb(void) { - rgb_matrix_set_color_all(0, 0, 0); - rgb_matrix_set_suspend_state(true); - suspend_power_down_user(); -} - - void suspend_wakeup_init_kb(void) { - rgb_matrix_set_suspend_state(false); - suspend_wakeup_init_user(); -} +// clang-format on # ifdef ORYX_CONFIGURATOR void keyboard_post_init_kb(void) { @@ -363,51 +354,48 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case LED_LEVEL: if (record->event.pressed) { - keyboard_config.led_level++; - if (keyboard_config.led_level > 4) { + keyboard_config.led_level++; + if (keyboard_config.led_level > 4) { keyboard_config.led_level = 0; - } - ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 ); - eeconfig_update_kb(keyboard_config.raw); - layer_state_set_kb(layer_state); + } + ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4); + eeconfig_update_kb(keyboard_config.raw); + layer_state_set_kb(layer_state); } break; -#ifdef RGB_MATRIX_ENABLE +# ifdef RGB_MATRIX_ENABLE case TOGGLE_LAYER_COLOR: if (record->event.pressed) { keyboard_config.disable_layer_led ^= 1; - if (keyboard_config.disable_layer_led) - rgb_matrix_set_color_all(0, 0, 0); + if (keyboard_config.disable_layer_led) rgb_matrix_set_color_all(0, 0, 0); eeconfig_update_kb(keyboard_config.raw); } break; case RGB_TOG: if (record->event.pressed) { - switch (rgb_matrix_get_flags()) { - case LED_FLAG_ALL: { - rgb_matrix_set_flags(LED_FLAG_NONE); - keyboard_config.rgb_matrix_enable = false; - rgb_matrix_set_color_all(0, 0, 0); - } - break; - default: { - rgb_matrix_set_flags(LED_FLAG_ALL); - keyboard_config.rgb_matrix_enable = true; - } - break; - } - eeconfig_update_kb(keyboard_config.raw); + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + keyboard_config.rgb_matrix_enable = false; + rgb_matrix_set_color_all(0, 0, 0); + } break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + keyboard_config.rgb_matrix_enable = true; + } break; + } + eeconfig_update_kb(keyboard_config.raw); } return false; -#endif +# endif } return process_record_user(keycode, record); } #endif void eeconfig_init_kb(void) { // EEPROM is getting reset! - keyboard_config.raw = 0; - keyboard_config.led_level = 4; + keyboard_config.raw = 0; + keyboard_config.led_level = 4; keyboard_config.rgb_matrix_enable = true; eeconfig_update_kb(keyboard_config.raw); eeconfig_init_user(); diff --git a/keyboards/ergodox_ez/info.json b/keyboards/ergodox_ez/info.json index 6c5598b083..1682f4bb45 100644 --- a/keyboards/ergodox_ez/info.json +++ b/keyboards/ergodox_ez/info.json @@ -2,9 +2,6 @@ "keyboard_name": "ErgoDox EZ", "url": "ergodox-ez.com", "maintainer": "ZSA via Drashna", - "width": 17, - "height": 8, - "layouts": { "LAYOUT_ergodox": { "layout": [ diff --git a/keyboards/ergodox_ez/keymaps/default/keymap.c b/keyboards/ergodox_ez/keymaps/default/keymap.c index 83aed78d26..3c0ef320a4 100644 --- a/keyboards/ergodox_ez/keymaps/default/keymap.c +++ b/keyboards/ergodox_ez/keymaps/default/keymap.c @@ -2,20 +2,20 @@ #include "version.h" enum layers { - BASE, // default layer - SYMB, // symbols + BASE, // default layer + SYMB, // symbols MDIA, // media keys }; enum custom_keycodes { #ifdef ORYX_CONFIGURATOR - VRSN = EZ_SAFE_RANGE, + VRSN = EZ_SAFE_RANGE, #else - VRSN = SAFE_RANGE, + VRSN = SAFE_RANGE, #endif - RGB_SLD }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap 0: Basic layer * @@ -77,7 +77,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRV, KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, KC_TRNS, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, KC_TRNS, KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, EEP_RST, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DOT, KC_0, KC_EQL, KC_TRNS, - RGB_MOD, KC_TRNS, RGB_TOG, RGB_SLD, + RGB_MOD, KC_TRNS, RGB_TOG, RGB_M_P, KC_TRNS, KC_TRNS, RGB_VAD, RGB_VAI, KC_TRNS, KC_TRNS, RGB_HUD, RGB_HUI ), @@ -115,94 +115,90 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_WBAK ), }; +// clang-format on bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if (record->event.pressed) { - switch (keycode) { - case VRSN: - SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); - return false; -#ifdef RGBLIGHT_ENABLE - case RGB_SLD: - rgblight_mode(1); - return false; -#endif + if (record->event.pressed) { + switch (keycode) { + case VRSN: + SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + return false; + } } - } - return true; + return true; } // Runs just one time when the keyboard initializes. void keyboard_post_init_user(void) { #ifdef RGBLIGHT_COLOR_LAYER_0 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); #endif }; // Runs whenever there is a layer state change. layer_state_t layer_state_set_user(layer_state_t state) { - ergodox_board_led_off(); - ergodox_right_led_1_off(); - ergodox_right_led_2_off(); - ergodox_right_led_3_off(); + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); - uint8_t layer = get_highest_layer(state); - switch (layer) { - case 0: - #ifdef RGBLIGHT_COLOR_LAYER_0 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); - #endif - break; - case 1: - ergodox_right_led_1_on(); - #ifdef RGBLIGHT_COLOR_LAYER_1 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_1); - #endif - break; - case 2: - ergodox_right_led_2_on(); - #ifdef RGBLIGHT_COLOR_LAYER_2 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_2); - #endif - break; - case 3: - ergodox_right_led_3_on(); - #ifdef RGBLIGHT_COLOR_LAYER_3 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_3); - #endif - break; - case 4: - ergodox_right_led_1_on(); - ergodox_right_led_2_on(); - #ifdef RGBLIGHT_COLOR_LAYER_4 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_4); - #endif - break; - case 5: - ergodox_right_led_1_on(); - ergodox_right_led_3_on(); - #ifdef RGBLIGHT_COLOR_LAYER_5 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_5); - #endif - break; - case 6: - ergodox_right_led_2_on(); - ergodox_right_led_3_on(); - #ifdef RGBLIGHT_COLOR_LAYER_6 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6); - #endif - break; - case 7: - ergodox_right_led_1_on(); - ergodox_right_led_2_on(); - ergodox_right_led_3_on(); - #ifdef RGBLIGHT_COLOR_LAYER_7 - rgblight_setrgb(RGBLIGHT_COLOR_LAYER_7); - #endif - break; - default: - break; + uint8_t layer = get_highest_layer(state); + switch (layer) { + case 0: +#ifdef RGBLIGHT_COLOR_LAYER_0 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); +#endif + break; + case 1: + ergodox_right_led_1_on(); +#ifdef RGBLIGHT_COLOR_LAYER_1 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_1); +#endif + break; + case 2: + ergodox_right_led_2_on(); +#ifdef RGBLIGHT_COLOR_LAYER_2 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_2); +#endif + break; + case 3: + ergodox_right_led_3_on(); +#ifdef RGBLIGHT_COLOR_LAYER_3 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_3); +#endif + break; + case 4: + ergodox_right_led_1_on(); + ergodox_right_led_2_on(); +#ifdef RGBLIGHT_COLOR_LAYER_4 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_4); +#endif + break; + case 5: + ergodox_right_led_1_on(); + ergodox_right_led_3_on(); +#ifdef RGBLIGHT_COLOR_LAYER_5 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_5); +#endif + break; + case 6: + ergodox_right_led_2_on(); + ergodox_right_led_3_on(); +#ifdef RGBLIGHT_COLOR_LAYER_6 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6); +#endif + break; + case 7: + ergodox_right_led_1_on(); + ergodox_right_led_2_on(); + ergodox_right_led_3_on(); +#ifdef RGBLIGHT_COLOR_LAYER_7 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_7); +#endif + break; + default: + break; } - return state; + return state; }; diff --git a/keyboards/ergodox_ez/rules.mk b/keyboards/ergodox_ez/rules.mk index 72781ff901..88821a1deb 100644 --- a/keyboards/ergodox_ez/rules.mk +++ b/keyboards/ergodox_ez/rules.mk @@ -2,13 +2,6 @@ MCU = atmega32u4 # Bootloader selection -# Teensy halfkay -# Pro Micro caterina -# Atmel DFU atmel-dfu -# LUFA DFU lufa-dfu -# QMK DFU qmk-dfu -# ATmega32A bootloadHID -# ATmega328P USBasp BOOTLOADER = halfkay # If you have Left LEDs (see @@ -19,7 +12,7 @@ BOOTLOADER = halfkay # Build Options # comment out to disable the options. # -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug @@ -30,19 +23,16 @@ NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: ht UNICODE_ENABLE = no # Unicode SWAP_HANDS_ENABLE= no # Allow swapping hands of keyboard SLEEP_LED_ENABLE = no -API_SYSEX_ENABLE = no RGB_MATRIX_ENABLE = no # enable later RGB_MATRIX_DRIVER = IS31FL3731 -DEBOUNCE_TYPE = eager_pr +DEBOUNCE_TYPE = sym_eager_pr # project specific files SRC += matrix.c \ led_i2c.c QUANTUM_LIB_SRC += i2c_master.c -LAYOUTS = ergodox - MOUSE_SHARED_EP = no # Disable unsupported hardware diff --git a/keyboards/ergodox_ez/util/compile_keymap.py b/keyboards/ergodox_ez/util/compile_keymap.py index f427d6fd80..b447ecaf5c 100755 --- a/keyboards/ergodox_ez/util/compile_keymap.py +++ b/keyboards/ergodox_ez/util/compile_keymap.py @@ -584,11 +584,6 @@ def unicode_macro_cases(config): for macro_id, uc_hex in config['unicode_macros'].items(): hi = int(uc_hex, 16) >> 8 lo = int(uc_hex, 16) & 0xFF - unimacro_keys = ", ".join( - "T({})".format( - "KP_" + digit if digit.isdigit() else digit - ) for digit in uc_hex - ) yield UNICODE_MACRO_TEMPLATE.format( macro_id=macro_id, hi=hi, lo=lo ) diff --git a/keyboards/moonlander/config.h b/keyboards/moonlander/config.h index 18a7dacdb6..a3e2975735 100644 --- a/keyboards/moonlander/config.h +++ b/keyboards/moonlander/config.h @@ -1,6 +1,6 @@ /* Copyright 2020 ZSA Technology Labs, Inc <@zsa> * Copyright 2020 Jack Humbert <jack.humb@gmail.com> - * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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 @@ -89,7 +89,7 @@ #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 175 #define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_MATRIX_KEYPRESSES -#define RGB_DISABLE_WHEN_USB_SUSPENDED true +#define RGB_DISABLE_WHEN_USB_SUSPENDED // #define RGB_MATRIX_LED_PROCESS_LIMIT 5 // #define RGB_MATRIX_LED_FLUSH_LIMIT 26 @@ -111,8 +111,9 @@ #define FIRMWARE_VERSION_SIZE 17 #define DYNAMIC_KEYMAP_EEPROM_ADDR (EECONFIG_SIZE + FIRMWARE_VERSION_SIZE) + #define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 16383 -#define DYNAMIC_KEYMAP_LAYER_COUNT 32 +#define DYNAMIC_KEYMAP_LAYER_COUNT 8 #define EEPROM_I2C_24LC128 #define AUDIO_PIN A5 diff --git a/keyboards/moonlander/halconf.h b/keyboards/moonlander/halconf.h new file mode 100644 index 0000000000..46b53b1a7f --- /dev/null +++ b/keyboards/moonlander/halconf.h @@ -0,0 +1,22 @@ +/* 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 <https://www.gnu.org/licenses/>. + */ +#pragma once + +#define HAL_USE_I2C TRUE +#define HAL_USE_GPT TRUE +#define HAL_USE_DAC TRUE + +#include_next <halconf.h> diff --git a/keyboards/moonlander/info.json b/keyboards/moonlander/info.json index 34f4e8a9ae..60b560eeee 100644 --- a/keyboards/moonlander/info.json +++ b/keyboards/moonlander/info.json @@ -2,9 +2,6 @@ "keyboard_name": "Moonlander Mark I", "url": "zsa.io/moonlander", "maintainer": "ZSA via Drashna", - "width": 17, - "height": 8, - "layouts": { "LAYOUT_moonlander": { "layout": [ diff --git a/keyboards/moonlander/keymaps/default/config.h b/keyboards/moonlander/keymaps/default/config.h index 576aae9f52..83ea2a1b58 100644 --- a/keyboards/moonlander/keymaps/default/config.h +++ b/keyboards/moonlander/keymaps/default/config.h @@ -1,6 +1,6 @@ /* Copyright 2020 ZSA Technology Labs, Inc <@zsa> * Copyright 2020 Jack Humbert <jack.humb@gmail.com> - * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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 diff --git a/keyboards/moonlander/keymaps/default/keymap.c b/keyboards/moonlander/keymaps/default/keymap.c index 6d98a8607e..0cb7fa5d27 100644 --- a/keyboards/moonlander/keymaps/default/keymap.c +++ b/keyboards/moonlander/keymaps/default/keymap.c @@ -1,6 +1,6 @@ /* Copyright 2020 ZSA Technology Labs, Inc <@zsa> * Copyright 2020 Jack Humbert <jack.humb@gmail.com> - * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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 diff --git a/keyboards/moonlander/matrix.c b/keyboards/moonlander/matrix.c index 6a24346180..7492109d22 100644 --- a/keyboards/moonlander/matrix.c +++ b/keyboards/moonlander/matrix.c @@ -1,6 +1,6 @@ /* Copyright 2020 ZSA Technology Labs, Inc <@zsa> * Copyright 2020 Jack Humbert <jack.humb@gmail.com> - * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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 @@ -16,53 +16,26 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <stdint.h> -#include <stdbool.h> -#include <string.h> -#include <hal.h> -#include "timer.h" -#include "wait.h" -#include "print.h" -#include "matrix.h" -#include "action.h" -#include "keycode.h" -#include <string.h> #include "moonlander.h" #include "i2c_master.h" -#include "debounce.h" /* #define MATRIX_ROW_PINS { B10, B11, B12, B13, B14, B15 } outputs #define MATRIX_COL_PINS { A0, A1, A2, A3, A6, A7, B0 } inputs */ /* 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 matrix_debouncing_right[MATRIX_COLS]; -static bool debouncing = false; -static uint16_t debouncing_time = 0; -static bool debouncing_right = false; -static uint16_t debouncing_time_right = 0; +extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values +extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values +static matrix_row_t raw_matrix_right[MATRIX_COLS]; #define ROWS_PER_HAND (MATRIX_ROWS / 2) - -#ifndef MATRIX_IO_DELAY -# define MATRIX_IO_DELAY 20 +#ifndef MOONLANDER_I2C_TIMEOUT +# define MOONLANDER_I2C_TIMEOUT 100 #endif extern bool mcp23018_leds[3]; extern bool is_launching; -__attribute__((weak)) void matrix_init_user(void) {} - -__attribute__((weak)) void matrix_scan_user(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_io_delay(void) { wait_us(MATRIX_IO_DELAY); } - bool mcp23018_initd = false; static uint8_t mcp23018_reset_loop; @@ -79,14 +52,14 @@ void mcp23018_init(void) { mcp23018_tx[1] = 0b00000000; // A is output mcp23018_tx[2] = 0b00111111; // B is inputs - if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, I2C_TIMEOUT)) { + if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, MOONLANDER_I2C_TIMEOUT)) { dprintf("error hori\n"); } else { mcp23018_tx[0] = 0x0C; // GPPUA mcp23018_tx[1] = 0b10000000; // A is not pulled-up mcp23018_tx[2] = 0b11111111; // B is pulled-up - if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, I2C_TIMEOUT)) { + if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, MOONLANDER_I2C_TIMEOUT)) { dprintf("error hori\n"); } else { mcp23018_initd = is_launching = true; @@ -94,10 +67,9 @@ void mcp23018_init(void) { } } -void matrix_init(void) { +void matrix_init_custom(void) { dprintf("matrix init\n"); // debug_matrix = true; - // outputs setPinOutput(B10); setPinOutput(B11); @@ -115,21 +87,34 @@ void matrix_init(void) { setPinInputLow(A7); setPinInputLow(B0); - memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t)); - memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t)); - memset(matrix_debouncing_right, 0, MATRIX_COLS * sizeof(matrix_row_t)); - mcp23018_init(); - - matrix_init_quantum(); } -uint8_t matrix_scan(void) { +bool matrix_scan_custom(matrix_row_t current_matrix[]) { bool changed = false; + // Try to re-init right side + if (!mcp23018_initd) { + if (++mcp23018_reset_loop == 0) { + // if (++mcp23018_reset_loop >= 1300) { + // since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans + // this will be approx bit more frequent than once per second + print("trying to reset mcp23018\n"); + mcp23018_init(); + if (!mcp23018_initd) { + print("left side not responding\n"); + } else { + print("left side attached\n"); +#ifdef RGB_MATRIX_ENABLE + rgb_matrix_init(); +#endif + } + } + } + matrix_row_t data = 0; // actual matrix - for (uint8_t row = 0; row < ROWS_PER_HAND; row++) { + for (uint8_t row = 0; row <= ROWS_PER_HAND; row++) { // strobe row switch (row) { case 0: writePinHigh(B10); break; @@ -138,159 +123,94 @@ uint8_t matrix_scan(void) { case 3: writePinHigh(B13); break; case 4: writePinHigh(B14); break; case 5: writePinHigh(B15); break; + case 6: break; // Left hand has 6 rows } - // need wait to settle pin state - matrix_io_delay(); - - // read col data - data = ( - (readPin(A0) << 0 ) | - (readPin(A1) << 1 ) | - (readPin(A2) << 2 ) | - (readPin(A3) << 3 ) | - (readPin(A6) << 4 ) | - (readPin(A7) << 5 ) | - (readPin(B0) << 6 ) - ); - - // unstrobe row - switch (row) { - case 0: writePinLow(B10); break; - case 1: writePinLow(B11); break; - case 2: writePinLow(B12); break; - case 3: writePinLow(B13); break; - case 4: writePinLow(B14); break; - case 5: writePinLow(B15); break; - } - - if (matrix_debouncing[row] != data) { - matrix_debouncing[row] = data; - debouncing = true; - debouncing_time = timer_read(); - changed = true; - } - } - - for (uint8_t row = 0; row <= ROWS_PER_HAND; row++) { // right side - - if (!mcp23018_initd) { - if (++mcp23018_reset_loop == 0) { - // if (++mcp23018_reset_loop >= 1300) { - // since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans - // this will be approx bit more frequent than once per second - print("trying to reset mcp23018\n"); - mcp23018_init(); - if (!mcp23018_initd) { - print("left side not responding\n"); - } else { - print("left side attached\n"); -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_init(); -#endif - } + if (mcp23018_initd) { + // #define MCP23_ROW_PINS { GPB5, GBP4, GBP3, GBP2, GBP1, GBP0 } outputs + // #define MCP23_COL_PINS { GPA0, GBA1, GBA2, GBA3, GBA4, GBA5, GBA6 } inputs + + // select row + mcp23018_tx[0] = 0x12; // GPIOA + mcp23018_tx[1] = (0b01111111 & ~(1 << (row))) | ((uint8_t)!mcp23018_leds[2] << 7); // activate row + mcp23018_tx[2] = ((uint8_t)!mcp23018_leds[1] << 6) | ((uint8_t)!mcp23018_leds[0] << 7); // activate row + + if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, MOONLANDER_I2C_TIMEOUT)) { + dprintf("error hori\n"); + mcp23018_initd = false; } - } - // #define MCP23_ROW_PINS { GPB5, GBP4, GBP3, GBP2, GBP1, GBP0 } outputs - // #define MCP23_COL_PINS { GPA0, GBA1, GBA2, GBA3, GBA4, GBA5, GBA6 } inputs + // read col - // select row - - mcp23018_tx[0] = 0x12; // GPIOA - mcp23018_tx[1] = (0b01111111 & ~(1 << (row))) | ((uint8_t)!mcp23018_leds[2] << 7); // activate row - mcp23018_tx[2] = ((uint8_t)!mcp23018_leds[1] << 6) | ((uint8_t)!mcp23018_leds[0] << 7); // activate row + mcp23018_tx[0] = 0x13; // GPIOB + if (MSG_OK != i2c_readReg(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx[0], &mcp23018_rx[0], 1, MOONLANDER_I2C_TIMEOUT)) { + dprintf("error vert\n"); + mcp23018_initd = false; + } - if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, I2C_TIMEOUT)) { - dprintf("error hori\n"); - mcp23018_initd = false; + data = ~(mcp23018_rx[0] & 0b00111111); + // data = 0x01; + } else { + data = 0; } - // read col - - mcp23018_tx[0] = 0x13; // GPIOB - if (MSG_OK != i2c_readReg(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx[0], &mcp23018_rx[0], 1, I2C_TIMEOUT)) { - dprintf("error vert\n"); - mcp23018_initd = false; + if (raw_matrix_right[row] != data) { + raw_matrix_right[row] = data; + changed = true; } - data = ~(mcp23018_rx[0] & 0b00111111); - // data = 0x01; - - if (matrix_debouncing_right[row] != data) { - matrix_debouncing_right[row] = data; - debouncing_right = true; - debouncing_time_right = timer_read(); - changed = true; - } - } - if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) { - for (int row = 0; row < ROWS_PER_HAND; row++) { - matrix[row] = matrix_debouncing[row]; - } - debouncing = false; - } + // left side + if (row < ROWS_PER_HAND) { + // i2c comm incur enough wait time + if (!mcp23018_initd) { + // need wait to settle pin state + matrix_io_delay(); + } + // read col data + data = ( + (readPin(A0) << 0 ) | + (readPin(A1) << 1 ) | + (readPin(A2) << 2 ) | + (readPin(A3) << 3 ) | + (readPin(A6) << 4 ) | + (readPin(A7) << 5 ) | + (readPin(B0) << 6 ) + ); + // unstrobe row + switch (row) { + case 0: writePinLow(B10); break; + case 1: writePinLow(B11); break; + case 2: writePinLow(B12); break; + case 3: writePinLow(B13); break; + case 4: writePinLow(B14); break; + case 5: writePinLow(B15); break; + case 6: break; + } - if (debouncing_right && timer_elapsed(debouncing_time_right) > DEBOUNCE && mcp23018_initd) { - for (int row = 0; row < ROWS_PER_HAND; row++) { - matrix[11 - row] = 0; - for (int col = 0; col < MATRIX_COLS; col++) { - matrix[11 - row] |= ((matrix_debouncing_right[6 - col] & (1 << row) ? 1 : 0) << col); + if (current_matrix[row] != data) { + current_matrix[row] = data; + changed = true; } } - debouncing_right = false; } - - matrix_scan_quantum(); - - return (uint8_t)changed; -} - -bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & (1 << col)); } - -matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } - -void matrix_print(void) { - dprintf("\nr/c 01234567\n"); - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - dprintf("%X0: ", row); - matrix_row_t data = matrix_get_row(row); - for (int col = 0; col < MATRIX_COLS; col++) { - if (data & (1 << col)) - dprintf("1"); - else - dprintf("0"); + for (uint8_t row = 0; row < ROWS_PER_HAND; row++) { + current_matrix[11 - row] = 0; + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + current_matrix[11 - row] |= ((raw_matrix_right[6 - col] & (1 << row) ? 1 : 0) << col); } - dprintf("\n"); } + return changed; } // DO NOT REMOVE // Needed for proper wake/sleep void matrix_power_up(void) { bool temp_launching = is_launching; - // outputs - setPinOutput(B10); - setPinOutput(B11); - setPinOutput(B12); - setPinOutput(B13); - setPinOutput(B14); - setPinOutput(B15); - wait_us(30); - - // inputs - setPinInputLow(A0); - setPinInputLow(A1); - setPinInputLow(A2); - setPinInputLow(A3); - setPinInputLow(A6); - setPinInputLow(A7); - setPinInputLow(B0); + matrix_init_custom(); - mcp23018_init(); is_launching = temp_launching; if (!temp_launching) { ML_LED_1(false); diff --git a/keyboards/moonlander/mcuconf.h b/keyboards/moonlander/mcuconf.h new file mode 100644 index 0000000000..69f458a937 --- /dev/null +++ b/keyboards/moonlander/mcuconf.h @@ -0,0 +1,39 @@ +/* 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 <https://www.gnu.org/licenses/>. + */ + +#pragma once + +#include_next "mcuconf.h" + +// for i2c expander, and ISSI +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE + +// for future hardwar +#undef STM32_I2C_USE_I2C2 +#define STM32_I2C_USE_I2C2 TRUE + +// for audio +#undef STM32_DAC_USE_DAC1_CH1 +#define STM32_DAC_USE_DAC1_CH1 TRUE +#undef STM32_DAC_USE_DAC1_CH2 +#define STM32_DAC_USE_DAC1_CH2 TRUE +#undef STM32_GPT_USE_TIM6 +#define STM32_GPT_USE_TIM6 TRUE +#undef STM32_GPT_USE_TIM7 +#define STM32_GPT_USE_TIM7 TRUE +#undef STM32_GPT_USE_TIM8 +#define STM32_GPT_USE_TIM8 TRUE diff --git a/keyboards/moonlander/moonlander.c b/keyboards/moonlander/moonlander.c index 0746d279c9..4452a3a5e2 100644 --- a/keyboards/moonlander/moonlander.c +++ b/keyboards/moonlander/moonlander.c @@ -1,6 +1,6 @@ /* Copyright 2020 ZSA Technology Labs, Inc <@zsa> * Copyright 2020 Jack Humbert <jack.humb@gmail.com> - * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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 @@ -219,7 +219,7 @@ layer_state_t layer_state_set_kb(layer_state_t state) { #ifdef RGB_MATRIX_ENABLE // clang-format off -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | R location @@ -356,15 +356,6 @@ led_config_t g_led_config = { { } }; // clang-format on -void suspend_power_down_kb(void) { - rgb_matrix_set_suspend_state(true); - suspend_power_down_user(); -} - -void suspend_wakeup_init_kb(void) { - rgb_matrix_set_suspend_state(false); - suspend_wakeup_init_user(); -} #endif #ifdef AUDIO_ENABLE diff --git a/keyboards/moonlander/moonlander.h b/keyboards/moonlander/moonlander.h index e81e168b96..16c6859613 100644 --- a/keyboards/moonlander/moonlander.h +++ b/keyboards/moonlander/moonlander.h @@ -1,6 +1,6 @@ /* Copyright 2020 ZSA Technology Labs, Inc <@zsa> * Copyright 2020 Jack Humbert <jack.humb@gmail.com> - * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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 diff --git a/keyboards/moonlander/readme.md b/keyboards/moonlander/readme.md index 7ddfdb84a7..0ad2e4775c 100644 --- a/keyboards/moonlander/readme.md +++ b/keyboards/moonlander/readme.md @@ -19,7 +19,23 @@ Flashing example for this keyboard: 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). -## Oryx Configuation + +## Moonlander Customization + +### Indicator LEDs + +There are 6 functions for enabling and disabling the LEDs on the top of the boards. The functions are `ML_LED_1(bool)` through `ML_LED_6(bool)`, with the first LED being the left most LED on the left hand, and the sixth LED being the right most LED on the right side. + +By default, the Indicator LEDs are used to indicate the layer state for the keyboard. If you wish to change this (and indicate caps/num/scroll lock status instead), then define `MOONLANDER_USER_LEDS` in your `config.h` file. + + +### Oryx Configuration + +To enable the features from Oryx (ZSA's Configurator), either compile the the `default` keymap, or add `#define ORYX_CONFIGURATOR` to your `config.h` file. + +This enables the front Indicator LEDs, and the `TOGGLE_LAYER_COLOR` keycode. The `TOGGLE_LAYER_COLOR` keycode toggles the customized LED map configured on Oryx. + +### RGB Matrix Features If you're using the Smart LED (layer indication) feature from the Oryx Configurator, you want to make sure that you enable these options by adding `#define ORYX_CONFIGURATOR` to your keymap's `config.h`. diff --git a/keyboards/moonlander/rules.mk b/keyboards/moonlander/rules.mk index 16822cb504..2295b7db95 100644 --- a/keyboards/moonlander/rules.mk +++ b/keyboards/moonlander/rules.mk @@ -1,6 +1,5 @@ # MCU name MCU = STM32F303 -BOARD = QMK_PROTON_C # Bootloader selection BOOTLOADER = stm32-dfu @@ -8,7 +7,7 @@ BOOTLOADER = stm32-dfu # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = yes # Console for debug @@ -19,10 +18,8 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -BLUETOOTH_ENABLE = no # Enable Bluetooth AUDIO_ENABLE = yes # Audio output -CUSTOM_MATRIX = yes -DEBOUNCE_TYPE = custom +CUSTOM_MATRIX = lite SWAP_HANDS_ENABLE = yes RGB_MATRIX_ENABLE = yes RGB_MATRIX_DRIVER = IS31FL3731 diff --git a/keyboards/planck/ez/config.h b/keyboards/planck/ez/config.h index b37b2570ca..e924d077d2 100644 --- a/keyboards/planck/ez/config.h +++ b/keyboards/planck/ez/config.h @@ -1,5 +1,6 @@ -/* - * Copyright 2018 Jack Humbert <jack.humb@gmail.com> +/* Copyright 2018 Jack Humbert <jack.humb@gmail.com> + * Copyright 2015 ZSA Technology Labs Inc (@zsa) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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 @@ -106,26 +107,6 @@ //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION -/* - * MIDI options - */ - -/* enable basic MIDI features: - - MIDI notes can be sent when in Music mode is on -*/ -//#define MIDI_BASIC - -/* enable advanced MIDI features: - - MIDI notes can be added to the keymap - - Octave shift and transpose - - Virtual sustain, portamento, and modulation wheel - - etc. -*/ -//#define MIDI_ADVANCED - -/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ -//#define MIDI_TONE_KEYCODE_OCTAVES 1 - #define DRIVER_ADDR_1 0b1010000 #define DRIVER_ADDR_2 0b1010000 // this is here for compliancy reasons. @@ -135,7 +116,7 @@ #define RGB_MATRIX_KEYPRESSES #define RGB_MATRIX_FRAMEBUFFER_EFFECTS -#define RGB_DISABLE_WHEN_USB_SUSPENDED true +#define RGB_DISABLE_WHEN_USB_SUSPENDED #define RGB_MATRIX_LED_PROCESS_LIMIT 5 #define RGB_MATRIX_LED_FLUSH_LIMIT 26 diff --git a/keyboards/planck/ez/ez.c b/keyboards/planck/ez/ez.c index 87ee3f7238..dc95607604 100644 --- a/keyboards/planck/ez/ez.c +++ b/keyboards/planck/ez/ez.c @@ -1,4 +1,6 @@ /* Copyright 2018 Jack Humbert <jack.humb@gmail.com> + * Copyright 2015 ZSA Technology Labs Inc (@zsa) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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 @@ -19,7 +21,7 @@ keyboard_config_t keyboard_config; #ifdef RGB_MATRIX_ENABLE -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | R location diff --git a/keyboards/planck/ez/ez.h b/keyboards/planck/ez/ez.h index e3b5077bbb..9e572d258d 100644 --- a/keyboards/planck/ez/ez.h +++ b/keyboards/planck/ez/ez.h @@ -1,4 +1,6 @@ /* Copyright 2018 Jack Humbert <jack.humb@gmail.com> + * Copyright 2015 ZSA Technology Labs Inc (@zsa) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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 diff --git a/keyboards/planck/ez/glow/config.h b/keyboards/planck/ez/glow/config.h index 21a339da28..55ce289010 100644 --- a/keyboards/planck/ez/glow/config.h +++ b/keyboards/planck/ez/glow/config.h @@ -1,5 +1,6 @@ -/* - * Copyright 2018 Jack Humbert <jack.humb@gmail.com> +/* Copyright 2018 Jack Humbert <jack.humb@gmail.com> + * Copyright 2015 ZSA Technology Labs Inc (@zsa) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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 diff --git a/keyboards/planck/ez/glow/glow.c b/keyboards/planck/ez/glow/glow.c index 1813ccae09..c6733bbe50 100644 --- a/keyboards/planck/ez/glow/glow.c +++ b/keyboards/planck/ez/glow/glow.c @@ -1 +1,19 @@ +/* Copyright 2018 Jack Humbert <jack.humb@gmail.com> + * Copyright 2015 ZSA Technology Labs Inc (@zsa) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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/>. + */ + #include "glow.h" diff --git a/keyboards/planck/ez/glow/glow.h b/keyboards/planck/ez/glow/glow.h index d8a01f4359..cfc26b5e03 100644 --- a/keyboards/planck/ez/glow/glow.h +++ b/keyboards/planck/ez/glow/glow.h @@ -1,3 +1,21 @@ +/* Copyright 2018 Jack Humbert <jack.humb@gmail.com> + * Copyright 2015 ZSA Technology Labs Inc (@zsa) + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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/>. + */ + #pragma once #include "ez.h" diff --git a/keyboards/planck/ez/glow/keymaps/glow/keymap.c b/keyboards/planck/ez/glow/keymaps/glow/keymap.c index 2cb68dfe95..37659fbc32 100644 --- a/keyboards/planck/ez/glow/keymaps/glow/keymap.c +++ b/keyboards/planck/ez/glow/keymaps/glow/keymap.c @@ -176,7 +176,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); #endif -uint32_t layer_state_set_user(uint32_t state) { +layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); } @@ -256,7 +256,7 @@ uint16_t muse_counter = 0; uint8_t muse_offset = 70; uint16_t muse_tempo = 50; -bool encoder_update(bool clockwise) { +bool encoder_update_user(uint8_t index, bool clockwise) { if (muse_mode) { if (IS_LAYER_ON(_RAISE)) { if (clockwise) { @@ -293,7 +293,7 @@ bool encoder_update(bool clockwise) { return true; } -void dip_update(uint8_t index, bool active) { +bool dip_switch_update_user(uint8_t index, bool active) { switch (index) { case 0: if (active) { @@ -318,6 +318,7 @@ void dip_update(uint8_t index, bool active) { #endif } } + return true; } void matrix_scan_user(void) { diff --git a/keyboards/planck/ez/halconf.h b/keyboards/planck/ez/halconf.h new file mode 100644 index 0000000000..f1044867f7 --- /dev/null +++ b/keyboards/planck/ez/halconf.h @@ -0,0 +1,23 @@ +/* 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 <https://www.gnu.org/licenses/>. + */ +#pragma once + +#define HAL_USE_I2C TRUE +#define HAL_USE_GPT TRUE +#define HAL_USE_DAC TRUE +#define HAL_USE_PWM TRUE + +#include_next <halconf.h> diff --git a/keyboards/planck/ez/info.json b/keyboards/planck/ez/info.json index e1573871b6..6c9332b052 100644 --- a/keyboards/planck/ez/info.json +++ b/keyboards/planck/ez/info.json @@ -1,115 +1,110 @@ { - "keyboard_name": "Planck EZ", - "keyboard_folder": "planck/ez", - "url": "https://ergodox-ez.com/pages/planck", - "maintainer": "jackhumbert", - "width": 12, - "height": 4, - "layouts": { - "LAYOUT_planck_1x2uC": { - "key_count": 47, - "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": 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": 0, "y": 2 }, - { "x": 1, "y": 2 }, - { "x": 2, "y": 2 }, - { "x": 3, "y": 2 }, - { "x": 4, "y": 2 }, - { "x": 5, "y": 2 }, - { "x": 6, "y": 2 }, - { "x": 7, "y": 2 }, - { "x": 8, "y": 2 }, - { "x": 9, "y": 2 }, - { "x": 10, "y": 2 }, - { "x": 11, "y": 2 }, - { "x": 0, "y": 3 }, - { "x": 1, "y": 3 }, - { "x": 2, "y": 3 }, - { "x": 3, "y": 3 }, - { "x": 4, "y": 3 }, - { "x": 5, "y": 3, "w": 2 }, - { "x": 7, "y": 3 }, - { "x": 8, "y": 3 }, - { "x": 9, "y": 3 }, - { "x": 10, "y": 3 }, - { "x": 11, "y": 3 } - ] - }, - "LAYOUT_ortho_4x12": { - "key_count": 48, - "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": 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": 0, "y": 2 }, - { "x": 1, "y": 2 }, - { "x": 2, "y": 2 }, - { "x": 3, "y": 2 }, - { "x": 4, "y": 2 }, - { "x": 5, "y": 2 }, - { "x": 6, "y": 2 }, - { "x": 7, "y": 2 }, - { "x": 8, "y": 2 }, - { "x": 9, "y": 2 }, - { "x": 10, "y": 2 }, - { "x": 11, "y": 2 }, - { "x": 0, "y": 3 }, - { "x": 1, "y": 3 }, - { "x": 2, "y": 3 }, - { "x": 3, "y": 3 }, - { "x": 4, "y": 3 }, - { "x": 5, "y": 3 }, - { "x": 6, "y": 3 }, - { "x": 7, "y": 3 }, - { "x": 8, "y": 3 }, - { "x": 9, "y": 3 }, - { "x": 10, "y": 3 }, - { "x": 11, "y": 3 } - ] - } + "keyboard_name": "Planck EZ", + "url": "https://ergodox-ez.com/pages/planck", + "maintainer": "jackhumbert", + "layouts": { + "LAYOUT_planck_1x2uC": { + "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": 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": 0, "y": 2 }, + { "x": 1, "y": 2 }, + { "x": 2, "y": 2 }, + { "x": 3, "y": 2 }, + { "x": 4, "y": 2 }, + { "x": 5, "y": 2 }, + { "x": 6, "y": 2 }, + { "x": 7, "y": 2 }, + { "x": 8, "y": 2 }, + { "x": 9, "y": 2 }, + { "x": 10, "y": 2 }, + { "x": 11, "y": 2 }, + { "x": 0, "y": 3 }, + { "x": 1, "y": 3 }, + { "x": 2, "y": 3 }, + { "x": 3, "y": 3 }, + { "x": 4, "y": 3 }, + { "x": 5, "y": 3, "w": 2 }, + { "x": 7, "y": 3 }, + { "x": 8, "y": 3 }, + { "x": 9, "y": 3 }, + { "x": 10, "y": 3 }, + { "x": 11, "y": 3 } + ] + }, + "LAYOUT_ortho_4x12": { + "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": 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": 0, "y": 2 }, + { "x": 1, "y": 2 }, + { "x": 2, "y": 2 }, + { "x": 3, "y": 2 }, + { "x": 4, "y": 2 }, + { "x": 5, "y": 2 }, + { "x": 6, "y": 2 }, + { "x": 7, "y": 2 }, + { "x": 8, "y": 2 }, + { "x": 9, "y": 2 }, + { "x": 10, "y": 2 }, + { "x": 11, "y": 2 }, + { "x": 0, "y": 3 }, + { "x": 1, "y": 3 }, + { "x": 2, "y": 3 }, + { "x": 3, "y": 3 }, + { "x": 4, "y": 3 }, + { "x": 5, "y": 3 }, + { "x": 6, "y": 3 }, + { "x": 7, "y": 3 }, + { "x": 8, "y": 3 }, + { "x": 9, "y": 3 }, + { "x": 10, "y": 3 }, + { "x": 11, "y": 3 } + ] } } +} diff --git a/keyboards/planck/ez/mcuconf.h b/keyboards/planck/ez/mcuconf.h index dde67871cd..44035e7827 100644 --- a/keyboards/planck/ez/mcuconf.h +++ b/keyboards/planck/ez/mcuconf.h @@ -1,30 +1,41 @@ -/* Copyright 2020 QMK Contributors +/* 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 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. + * 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/>. + * 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 "mcuconf.h" -// The SysTick timer from the normal quantum/stm32 uses TIM2 -- the WS2812 pin used -// on the Planck requires the use of TIM2 to run PWM -- rework which timers are -// allocated for PWM usage. -#undef STM32_PWM_USE_TIM2 +// for i2c expander, and ISSI +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE + +// for indicator LEDs #undef STM32_PWM_USE_TIM3 -#define STM32_PWM_USE_TIM2 TRUE -#define STM32_PWM_USE_TIM3 FALSE +#define STM32_PWM_USE_TIM3 TRUE +#undef STM32_PWM_USE_TIM4 +#define STM32_PWM_USE_TIM4 TRUE -// As mentioned above, we need to reallocate the SysTick timer used from -// TIM2 to TIM3. -#undef STM32_ST_USE_TIMER -#define STM32_ST_USE_TIMER 3 +// for audio +#undef STM32_DAC_USE_DAC1_CH1 +#define STM32_DAC_USE_DAC1_CH1 TRUE +#undef STM32_DAC_USE_DAC1_CH2 +#define STM32_DAC_USE_DAC1_CH2 TRUE +#undef STM32_GPT_USE_TIM6 +#define STM32_GPT_USE_TIM6 TRUE +#undef STM32_GPT_USE_TIM7 +#define STM32_GPT_USE_TIM7 TRUE +#undef STM32_GPT_USE_TIM8 +#define STM32_GPT_USE_TIM8 TRUE diff --git a/keyboards/planck/ez/readme.md b/keyboards/planck/ez/readme.md index 247bf7448a..f85ab59693 100644 --- a/keyboards/planck/ez/readme.md +++ b/keyboards/planck/ez/readme.md @@ -4,24 +4,26 @@ A variant of the Planck featuring a 2u spacebar and per-key RGB backlighting. -Keyboard Maintainer: [Jack Humbert](https://github.com/jackhumbert) +Keyboard Maintainer: [Jack Humbert](https://github.com/jackhumbert), [Drashna Jael're](https://github.com/drashna) Hardware Supported: Planck EZ -Hardware Availability: [ergodox-ez.com](https://ergodox-ez.com/pages/planck) +Hardware Availability: [ZSA](https://www.zsa.io/planck/) Make example for this keyboard (after setting up your build environment): - make planck/ez: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). - -# Planck EZ Glow + make planck/ez:oryx For the per key RGB version of this keyboard, you want to use the "glow" subdirectory. For example: - make planck/ez/glow:default + make planck/ez/glow:oryx + +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). ## Planck EZ Configuration (from Oryx) +To enable the features from Oryx (ZSA's Configurator), either compile the the `oryx` keymap, or add `#define ORYX_CONFIGURATOR` to your `config.h` file. + +This enables the front Indicator LEDs, and the `TOGGLE_LAYER_COLOR`, and `LED_LEVEL` keycodes. The `TOGGLE_LAYER_COLOR` keycode toggles the customized LED map configured on Oryx. The `LED_LEVEL` cycles through the brightness levels for the front "teeth" LEDs. + ### Indicator LEDs The two front "teeth" LED indicators are PWM controlled. If you have `ORYX_CONFIGURATOR` defined in your keymap's `config.h`, you can use the `LED_LEVEL` to cycle through preset vales (0, 25%, 50%, 75%, 100%), and will be saved to EEPROM (persistent storage) diff --git a/keyboards/planck/ez/rules.mk b/keyboards/planck/ez/rules.mk index 23f2aaa313..bc18497a74 100755 --- a/keyboards/planck/ez/rules.mk +++ b/keyboards/planck/ez/rules.mk @@ -1,6 +1,5 @@ # MCU name MCU = STM32F303 -BOARD = QMK_PROTON_C # Bootloader selection BOOTLOADER = stm32-dfu @@ -10,8 +9,8 @@ BOOTLOADER = stm32-dfu # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE = full # Virtual DIP switch configuration -MOUSEKEY_ENABLE = yes # Mouse keys +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration @@ -19,16 +18,17 @@ NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: h BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality AUDIO_ENABLE = yes # Audio output on port C6 RGBLIGHT_ENABLE = no -ENCODER_ENABLE = yes # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend ENCODER_ENABLE = yes RGB_MATRIX_DRIVER = IS31FL3737 MOUSE_SHARED_EP = no -LAYOUTS = ortho_4x12 LAYOUTS_HAS_RGB = no + +RGB_MATRIX_SUPPORTED = yes +RGBLIGHT_SUPPORTED = no +BAKCLIGHT_SUPPORTED = no diff --git a/keyboards/planck/info.json b/keyboards/planck/info.json new file mode 100644 index 0000000000..a4710d781f --- /dev/null +++ b/keyboards/planck/info.json @@ -0,0 +1,108 @@ +{ + "keyboard_name": "Planck", + "url": "https://olkb.com/planck", + "maintainer": "jackhumbert", + "layouts": { + "LAYOUT_planck_1x2uC": { + "layout": [ + { "w": 1, "x": 0, "y": 0 }, + { "w": 1, "x": 1, "y": 0 }, + { "w": 1, "x": 2, "y": 0 }, + { "w": 1, "x": 3, "y": 0 }, + { "w": 1, "x": 4, "y": 0 }, + { "w": 1, "x": 5, "y": 0 }, + { "w": 1, "x": 6, "y": 0 }, + { "w": 1, "x": 7, "y": 0 }, + { "w": 1, "x": 8, "y": 0 }, + { "w": 1, "x": 9, "y": 0 }, + { "w": 1, "x": 10, "y": 0 }, + { "w": 1, "x": 11, "y": 0 }, + { "w": 1, "x": 0, "y": 1 }, + { "w": 1, "x": 1, "y": 1 }, + { "w": 1, "x": 2, "y": 1 }, + { "w": 1, "x": 3, "y": 1 }, + { "w": 1, "x": 4, "y": 1 }, + { "w": 1, "x": 5, "y": 1 }, + { "w": 1, "x": 6, "y": 1 }, + { "w": 1, "x": 7, "y": 1 }, + { "w": 1, "x": 8, "y": 1 }, + { "w": 1, "x": 9, "y": 1 }, + { "w": 1, "x": 10, "y": 1 }, + { "w": 1, "x": 11, "y": 1 }, + { "w": 1, "x": 0, "y": 2 }, + { "w": 1, "x": 1, "y": 2 }, + { "w": 1, "x": 2, "y": 2 }, + { "w": 1, "x": 3, "y": 2 }, + { "w": 1, "x": 4, "y": 2 }, + { "w": 1, "x": 5, "y": 2 }, + { "w": 1, "x": 6, "y": 2 }, + { "w": 1, "x": 7, "y": 2 }, + { "w": 1, "x": 8, "y": 2 }, + { "w": 1, "x": 9, "y": 2 }, + { "w": 1, "x": 10, "y": 2 }, + { "w": 1, "x": 11, "y": 2 }, + { "w": 1, "x": 0, "y": 3 }, + { "w": 1, "x": 1, "y": 3 }, + { "w": 1, "x": 2, "y": 3 }, + { "w": 1, "x": 3, "y": 3 }, + { "w": 1, "x": 4, "y": 3 }, + { "w": 2, "x": 5, "y": 3 }, + { "w": 1, "x": 7, "y": 3 }, + { "w": 1, "x": 8, "y": 3 }, + { "w": 1, "x": 9, "y": 3 }, + { "w": 1, "x": 10, "y": 3 }, + { "w": 1, "x": 11, "y": 3 } ] + }, + "LAYOUT_ortho_4x12": { + "layout": [ + { "w": 1, "x": 0, "y": 0 }, + { "w": 1, "x": 1, "y": 0 }, + { "w": 1, "x": 2, "y": 0 }, + { "w": 1, "x": 3, "y": 0 }, + { "w": 1, "x": 4, "y": 0 }, + { "w": 1, "x": 5, "y": 0 }, + { "w": 1, "x": 6, "y": 0 }, + { "w": 1, "x": 7, "y": 0 }, + { "w": 1, "x": 8, "y": 0 }, + { "w": 1, "x": 9, "y": 0 }, + { "w": 1, "x": 10, "y": 0 }, + { "w": 1, "x": 11, "y": 0 }, + { "w": 1, "x": 0, "y": 1 }, + { "w": 1, "x": 1, "y": 1 }, + { "w": 1, "x": 2, "y": 1 }, + { "w": 1, "x": 3, "y": 1 }, + { "w": 1, "x": 4, "y": 1 }, + { "w": 1, "x": 5, "y": 1 }, + { "w": 1, "x": 6, "y": 1 }, + { "w": 1, "x": 7, "y": 1 }, + { "w": 1, "x": 8, "y": 1 }, + { "w": 1, "x": 9, "y": 1 }, + { "w": 1, "x": 10, "y": 1 }, + { "w": 1, "x": 11, "y": 1 }, + { "w": 1, "x": 0, "y": 2 }, + { "w": 1, "x": 1, "y": 2 }, + { "w": 1, "x": 2, "y": 2 }, + { "w": 1, "x": 3, "y": 2 }, + { "w": 1, "x": 4, "y": 2 }, + { "w": 1, "x": 5, "y": 2 }, + { "w": 1, "x": 6, "y": 2 }, + { "w": 1, "x": 7, "y": 2 }, + { "w": 1, "x": 8, "y": 2 }, + { "w": 1, "x": 9, "y": 2 }, + { "w": 1, "x": 10, "y": 2 }, + { "w": 1, "x": 11, "y": 2 }, + { "w": 1, "x": 0, "y": 3 }, + { "w": 1, "x": 1, "y": 3 }, + { "w": 1, "x": 2, "y": 3 }, + { "w": 1, "x": 3, "y": 3 }, + { "w": 1, "x": 4, "y": 3 }, + { "w": 1, "x": 5, "y": 3 }, + { "w": 1, "x": 6, "y": 3 }, + { "w": 1, "x": 7, "y": 3 }, + { "w": 1, "x": 8, "y": 3 }, + { "w": 1, "x": 9, "y": 3 }, + { "w": 1, "x": 10, "y": 3 }, + { "w": 1, "x": 11, "y": 3 } ] + } + } +} diff --git a/keyboards/planck/keymaps/default/config.h b/keyboards/planck/keymaps/default/config.h index 9020d2b9f8..464b7b29f8 100644 --- a/keyboards/planck/keymaps/default/config.h +++ b/keyboards/planck/keymaps/default/config.h @@ -1,13 +1,27 @@ +/* Copyright 2015-2021 Jack Humbert + * + * 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 #ifdef AUDIO_ENABLE - #define STARTUP_SONG SONG(PLANCK_SOUND) - // #define STARTUP_SONG SONG(NO_SOUND) +# define STARTUP_SONG SONG(PLANCK_SOUND) +// #define STARTUP_SONG SONG(NO_SOUND) - #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ - SONG(COLEMAK_SOUND), \ - SONG(DVORAK_SOUND) \ - } +# define DEFAULT_LAYER_SONGS \ + { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND) } #endif /* @@ -33,4 +47,3 @@ // Most tactile encoders have detents every 4 stages #define ENCODER_RESOLUTION 4 - diff --git a/keyboards/planck/keymaps/default/keymap.c b/keyboards/planck/keymaps/default/keymap.c index 304d320b69..7c787e0366 100644 --- a/keyboards/planck/keymaps/default/keymap.c +++ b/keyboards/planck/keymaps/default/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2015-2017 Jack Humbert +/* Copyright 2015-2021 Jack Humbert * * 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 @@ -256,7 +256,7 @@ uint16_t muse_counter = 0; uint8_t muse_offset = 70; uint16_t muse_tempo = 50; -bool encoder_update(bool clockwise) { +bool encoder_update_user(uint8_t index, bool clockwise) { if (muse_mode) { if (IS_LAYER_ON(_RAISE)) { if (clockwise) { @@ -289,7 +289,7 @@ bool encoder_update(bool clockwise) { return true; } -void dip_switch_update_user(uint8_t index, bool active) { +bool dip_switch_update_user(uint8_t index, bool active) { switch (index) { case 0: { #ifdef AUDIO_ENABLE @@ -318,6 +318,7 @@ void dip_switch_update_user(uint8_t index, bool active) { muse_mode = false; } } + return true; } void matrix_scan_user(void) { diff --git a/keyboards/planck/keymaps/oryx/config.h b/keyboards/planck/keymaps/oryx/config.h index 54a7918d36..d0313de699 100644 --- a/keyboards/planck/keymaps/oryx/config.h +++ b/keyboards/planck/keymaps/oryx/config.h @@ -1,18 +1,41 @@ +/* Copyright 2020 ZSA Technology Inc + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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/>. + */ + #pragma once #ifdef AUDIO_ENABLE -#define STARTUP_SONG SONG(PLANCK_SOUND) +# define STARTUP_SONG SONG(PLANCK_SOUND) #endif #define MIDI_BASIC #define ENCODER_RESOLUTION 4 -#define ORYX_CONFIGURATOR - /* Set any config.h overrides for your specific keymap here. See config.h options at https://docs.qmk.fm/#/config_options?id=the-configh-file */ #define LAYER_STATE_8BIT +#define ORYX_CONFIGURATOR +#define USB_SUSPEND_WAKEUP_DELAY 0 +#define FIRMWARE_VERSION u8"vAxxa/ZlQEV" +#define RGB_MATRIX_STARTUP_SPD 60 + +#define PLANCK_EZ_LED_LOWER 1 +#define PLANCK_EZ_LED_RAISE 2 +#define PLANCK_EZ_LED_ADJUST 3 diff --git a/keyboards/planck/keymaps/oryx/keymap.c b/keyboards/planck/keymaps/oryx/keymap.c index 64a77eb3d9..2ce5dc3c5e 100644 --- a/keyboards/planck/keymaps/oryx/keymap.c +++ b/keyboards/planck/keymaps/oryx/keymap.c @@ -1,386 +1,153 @@ -#include QMK_KEYBOARD_H -#include "muse.h" -#include "eeprom.h" -#include "keymap_german.h" -#include "keymap_nordic.h" -#include "keymap_french.h" -#include "keymap_spanish.h" -#include "keymap_hungarian.h" -#include "keymap_swedish.h" -//#include "keymap_br_abnt2.h" -#include "keymap_canadian_multilingual.h" -#include "keymap_german_ch.h" - -#define KC_MAC_UNDO LGUI(KC_Z) -#define KC_MAC_CUT LGUI(KC_X) -#define KC_MAC_COPY LGUI(KC_C) -#define KC_MAC_PASTE LGUI(KC_V) -#define KC_PC_UNDO LCTL(KC_Z) -#define KC_PC_CUT LCTL(KC_X) -#define KC_PC_COPY LCTL(KC_C) -#define KC_PC_PASTE LCTL(KC_V) -#define NO_TH ALGR(KC_T) -#define NO_ETH ALGR(KC_D) +/* Copyright 2020 ZSA Technology Inc + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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/>. + */ -enum planck_layers { - _QWERTY, - _COLEMAK, - _DVORAK, - _LOWER, - _RAISE, - _PLOVER, - _ADJUST -}; +#include QMK_KEYBOARD_H enum planck_keycodes { - QWERTY = EZ_SAFE_RANGE, - COLEMAK, - DVORAK, - PLOVER, - BACKLIT, - EXT_PLV, - RGB_SLD + RGB_SLD = EZ_SAFE_RANGE, }; -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) +enum planck_layers { + _BASE, + _LOWER, + _RAISE, + _ADJUST, +}; +# define LOWER MO(_LOWER) +# define RAISE MO(_RAISE) +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -/* Qwerty - * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Esc | A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_QWERTY] = LAYOUT_planck_grid( - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, - KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , - BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT -), - -/* Colemak - * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Esc | A | R | S | T | D | H | N | E | I | O | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_COLEMAK] = LAYOUT_planck_grid( - KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, - KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , - BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT -), - -/* Dvorak - * ,-----------------------------------------------------------------------------------. - * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Esc | A | O | E | U | I | D | H | T | N | S | / | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_DVORAK] = LAYOUT_planck_grid( - KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, - KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, - KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , - BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT -), - -/* Lower - * ,-----------------------------------------------------------------------------------. - * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | Next | Vol- | Vol+ | Play | - * `-----------------------------------------------------------------------------------' - */ -[_LOWER] = LAYOUT_planck_grid( - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, - KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______, - _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -/* Raise - * ,-----------------------------------------------------------------------------------. - * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | Next | Vol- | Vol+ | Play | - * `-----------------------------------------------------------------------------------' - */ -[_RAISE] = LAYOUT_planck_grid( - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, - KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______, - _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -/* Plover layer (http://opensteno.org) - * ,-----------------------------------------------------------------------------------. - * | # | # | # | # | # | # | # | # | # | # | # | # | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | S | T | P | H | * | * | F | P | L | T | D | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | S | K | W | R | * | * | R | B | G | S | Z | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Exit | | | A | O | | E | U | | | | - * `-----------------------------------------------------------------------------------' - */ -[_PLOVER] = LAYOUT_planck_grid( - KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 , - XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, - XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, - EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX -), - -/* Adjust (Lower + Raise) - * v------------------------RGB CONTROL--------------------v - * ,----------------------------------------------------------------------------------- - * | | Reset|Debug | RGB |RGBMOD| HUE+ | HUE- | SAT+ | SAT- |BRGTH+|BRGTH-| Del | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | - * `-----------------------------------------------------------------------------------' - */ -[_ADJUST] = LAYOUT_planck_grid( - _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , - _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______, - _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, TOGGLE_LAYER_COLOR, LED_LEVEL, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ -) + [_BASE] = LAYOUT_planck_grid( + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPACE, + KC_ESCAPE, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCOLON, KC_QUOTE, + KC_LSHIFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMMA, KC_DOT, KC_SLASH, KC_ENTER, + WEBUSB_PAIR, KC_LCTRL, KC_LALT, KC_LGUI, LOWER, KC_SPACE, KC_NO, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT + ), + + [_LOWER] = LAYOUT_planck_grid( + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, + KC_DELETE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NONUS_HASH, KC_NONUS_BSLASH,KC_HOME, KC_END, _______, + KC_COMMA, _______, _______, _______, _______, _______, KC_NO, _______, KC_MEDIA_NEXT_TRACK,KC_AUDIO_VOL_DOWN,KC_AUDIO_VOL_UP,KC_MEDIA_PLAY_PAUSE + ), + + [_RAISE] = LAYOUT_planck_grid( + KC_GRAVE,KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINUS, KC_EQUAL, KC_LBRACKET, KC_RBRACKET, KC_BSLASH, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NONUS_HASH, KC_NONUS_BSLASH,KC_PGUP, KC_PGDOWN, _______, + _______, _______, _______, _______, _______, _______, KC_NO, _______, KC_MEDIA_NEXT_TRACK,KC_AUDIO_VOL_DOWN,KC_AUDIO_VOL_UP,KC_MEDIA_PLAY_PAUSE + ), + + [_ADJUST] = LAYOUT_planck_grid( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_DEL, _______, AU_ON, AU_OFF, AU_TOG, _______, _______, RGB_TOG, RGB_VAI, RGB_VAD, LED_LEVEL, RESET, + _______, _______, MU_ON, MU_OFF, MU_TOG, _______, _______, RGB_MOD, RGB_HUI, RGB_HUD, TOGGLE_LAYER_COLOR, _______, + _______, _______, _______, _______, _______, _______, KC_NO, _______, _______, _______, _______, _______ + ), }; - - -#ifdef AUDIO_ENABLE - float plover_song[][2] = SONG(PLOVER_SOUND); - float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); -#endif - -layer_state_t layer_state_set_user(layer_state_t state) { - return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); -} +// clang-format on #ifdef RGB_MATRIX_EANBLE const uint8_t PROGMEM ledmap[][DRIVER_LED_TOTAL][3] = { - [0] = { {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255}, {130,255,255} }, + [0] = {{42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {146, 224, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {42, 255, 255}, {32, 255, 234}, {32, 255, 234}, {32, 255, 234}, {32, 255, 234}}, - [1] = { {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {146,224,255}, {146,224,255}, {146,224,255}, {146,224,255}, {146,224,255}, {146,224,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {146,224,255}, {146,224,255}, {146,224,255}, {146,224,255}, {146,224,255}, {146,224,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {42,255,255}, {32,255,234}, {32,255,234}, {32,255,234}, {32,255,234} }, + [1] = {{89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {169, 120, 255}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}, {89, 255, 246}}, - [2] = { {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {169,120,255}, {169,120,255}, {169,120,255}, {169,120,255}, {169,120,255}, {169,120,255}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {169,120,255}, {169,120,255}, {169,120,255}, {169,120,255}, {169,120,255}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246}, {89,255,246} }, - - [3] = { {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {249,228,255}, {249,228,255}, {249,228,255}, {216,255,255}, {216,255,255}, {105,255,255}, {105,255,255}, {105,255,255}, {216,255,255}, {14,255,255}, {216,255,255}, {216,255,255}, {249,228,255}, {249,228,255}, {249,228,255}, {216,255,255}, {216,255,255}, {105,255,255}, {105,255,255}, {105,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255}, {216,255,255} }, + [2] = {{216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {249, 228, 255}, {249, 228, 255}, {249, 228, 255}, {216, 255, 255}, {216, 255, 255}, {105, 255, 255}, {105, 255, 255}, {105, 255, 255}, {216, 255, 255}, {14, 255, 255}, {216, 255, 255}, {216, 255, 255}, {249, 228, 255}, {249, 228, 255}, {249, 228, 255}, {216, 255, 255}, {216, 255, 255}, {105, 255, 255}, {105, 255, 255}, {105, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}, {216, 255, 255}}, }; void set_layer_color(int layer) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - HSV hsv = { - .h = pgm_read_byte(&ledmap[layer][i][0]), - .s = pgm_read_byte(&ledmap[layer][i][1]), - .v = pgm_read_byte(&ledmap[layer][i][2]), - }; - if (!hsv.h && !hsv.s && !hsv.v) { - rgb_matrix_set_color( i, 0, 0, 0 ); - } else { - RGB rgb = hsv_to_rgb( hsv ); - float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX; - rgb_matrix_set_color( i, f * rgb.r, f * rgb.g, f * rgb.b ); + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + HSV hsv = { + .h = pgm_read_byte(&ledmap[layer][i][0]), + .s = pgm_read_byte(&ledmap[layer][i][1]), + .v = pgm_read_byte(&ledmap[layer][i][2]), + }; + if (!hsv.h && !hsv.s && !hsv.v) { + rgb_matrix_set_color(i, 0, 0, 0); + } else { + RGB rgb = hsv_to_rgb(hsv); + float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX; + rgb_matrix_set_color(i, f * rgb.r, f * rgb.g, f * rgb.b); + } } - } } void rgb_matrix_indicators_user(void) { - if (g_suspend_state || keyboard_config.disable_layer_led) { return; } - switch (biton32(layer_state)) { - case 0: - set_layer_color(0); - break; - case 3: - set_layer_color(1); - break; - case 4: - set_layer_color(2); - break; - case 6: - set_layer_color(3); - break; - default: - if (rgb_matrix_get_flags() == LED_FLAG_NONE) - rgb_matrix_set_color_all(0, 0, 0); - break; - } + if (g_suspend_state || keyboard_config.disable_layer_led) { + return; + } + switch (biton32(layer_state)) { + case 1: + set_layer_color(0); + break; + case 2: + set_layer_color(1); + break; + case 3: + set_layer_color(2); + break; + default: + if (rgb_matrix_get_flags() == LED_FLAG_NONE) rgb_matrix_set_color_all(0, 0, 0); + break; + } } -#endif bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case RGB_SLD: - if (record->event.pressed) { -#ifdef RGBLIGHT_ENABLE - rgblight_mode(1); -#endif - } - return false; - case QWERTY: - if (record->event.pressed) { - print("mode just switched to qwerty and this is a huge string\n"); - set_single_persistent_default_layer(_QWERTY); - } - return false; - break; - case COLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_COLEMAK); - } - return false; - break; - case DVORAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_DVORAK); - } - return false; - break; - case BACKLIT: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - #ifdef KEYBOARD_planck_rev5 - PORTE &= ~(1<<6); - #endif - } else { - unregister_code(KC_RSFT); - #ifdef KEYBOARD_planck_rev5 - PORTE |= (1<<6); - #endif - } - return false; - break; - case PLOVER: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - stop_all_notes(); - PLAY_SONG(plover_song); - #endif - layer_off(_RAISE); - layer_off(_LOWER); - layer_off(_ADJUST); - layer_on(_PLOVER); - if (!eeconfig_is_enabled()) { - eeconfig_init(); - } - keymap_config.raw = eeconfig_read_keymap(); - keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); - } - return false; - break; - case EXT_PLV: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(plover_gb_song); - #endif - layer_off(_PLOVER); - } - return false; - break; - } - return true; -} - -bool muse_mode = false; -uint8_t last_muse_note = 0; -uint16_t muse_counter = 0; -uint8_t muse_offset = 70; -uint16_t muse_tempo = 50; - -bool encoder_update(bool clockwise) { - if (muse_mode) { - if (IS_LAYER_ON(_RAISE)) { - if (clockwise) { - muse_offset++; - } else { - muse_offset--; - } - } else { - if (clockwise) { - muse_tempo+=1; - } else { - muse_tempo-=1; + switch (keycode) { + case RGB_SLD: + if (record->event.pressed) { + rgblight_mode(1); } - } - } else { - if (clockwise) { - #ifdef MOUSEKEY_ENABLE - register_code(KC_MS_WH_DOWN); - unregister_code(KC_MS_WH_DOWN); - #else - register_code(KC_PGDN); - unregister_code(KC_PGDN); - #endif - } else { - #ifdef MOUSEKEY_ENABLE - register_code(KC_MS_WH_UP); - unregister_code(KC_MS_WH_UP); - #else - register_code(KC_PGUP); - unregister_code(KC_PGUP); - #endif - } + return false; } return true; } +#endif -void matrix_scan_user(void) { -#ifdef AUDIO_ENABLE - if (muse_mode) { - if (muse_counter == 0) { - uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; - if (muse_note != last_muse_note) { - stop_note(compute_freq_for_midi_note(last_muse_note)); - play_note(compute_freq_for_midi_note(muse_note), 0xF); - last_muse_note = muse_note; - } - } - muse_counter = (muse_counter + 1) % muse_tempo; +bool encoder_update_user(uint8_t index, bool clockwise) { + if (clockwise) { +# ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); +# else + tap_code(KC_PGDN); +# endif + } else { +# ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); +# else + tap_code(KC_PGUP); +# endif } -#endif + return true; } bool music_mask_user(uint16_t keycode) { switch (keycode) { - case RAISE: - case LOWER: - return false; - default: - return true; + case RAISE: + case LOWER: + return false; + default: + return true; } } + +layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); } diff --git a/keyboards/planck/keymaps/oryx/rules.mk b/keyboards/planck/keymaps/oryx/rules.mk index 27ab9be851..1e29b5f218 100644 --- a/keyboards/planck/keymaps/oryx/rules.mk +++ b/keyboards/planck/keymaps/oryx/rules.mk @@ -1,6 +1,7 @@ -SRC += muse.c # Set any rules.mk overrides for your specific keymap here. # See rules at https://docs.qmk.fm/#/config_options?id=the-rulesmk-file +CONSOLE_ENABLE = no COMMAND_ENABLE = no MOUSEKEY_ENABLE = no +WEBUSB_ENABLE = yes ORYX_ENABLE = yes diff --git a/keyboards/planck/planck.h b/keyboards/planck/planck.h index d575112d36..0d5c14fdac 100644 --- a/keyboards/planck/planck.h +++ b/keyboards/planck/planck.h @@ -1,9 +1,23 @@ +/* Copyright 2018 Jack Humbert <jack.humb@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/>. + */ + #pragma once #include "quantum.h" -#define encoder_update(clockwise) encoder_update_user(uint8_t index, clockwise) - #if defined(KEYBOARD_planck_ez) # include "ez.h" #endif // Planck revisions diff --git a/lib/chibios b/lib/chibios -Subproject ffe54d63cb10a355add318f8e922e39f1c3d4bf +Subproject 413e39c5681d181720440f2a8b7391f581788d7 diff --git a/lib/chibios-contrib b/lib/chibios-contrib -Subproject 61baa6b036138c155f7cfc5646d833d9423f324 +Subproject 4568901a91e9bef78ea96a7a83e8150fe1f7353 diff --git a/lib/googletest b/lib/googletest -Subproject ec44c6c1675c25b9827aacd08c02433cccde778 +Subproject e2239ee6043f73722e7aa812a459f54a2855292 diff --git a/lib/python/qmk/c_parse.py b/lib/python/qmk/c_parse.py index 991373d569..e7d44a514f 100644 --- a/lib/python/qmk/c_parse.py +++ b/lib/python/qmk/c_parse.py @@ -74,7 +74,6 @@ def find_layouts(file): key['matrix'] = matrix_locations[key['label']] parsed_layouts[macro_name] = { - 'key_count': len(parsed_layout), 'layout': parsed_layout, 'filename': str(file), } diff --git a/lib/python/qmk/cli/__init__.py b/lib/python/qmk/cli/__init__.py index 32da1a9b52..539d03e2fc 100644 --- a/lib/python/qmk/cli/__init__.py +++ b/lib/python/qmk/cli/__init__.py @@ -16,12 +16,14 @@ import_names = { # A mapping of package name to importable name 'pep8-naming': 'pep8ext_naming', 'pyusb': 'usb.core', + 'qmk-dotty-dict': 'dotty_dict' } safe_commands = [ # A list of subcommands we always run, even when the module imports fail 'clone', 'config', + 'doctor', 'env', 'setup', ] @@ -38,7 +40,10 @@ subcommands = [ 'qmk.cli.doctor', 'qmk.cli.fileformat', 'qmk.cli.flash', + 'qmk.cli.format.c', 'qmk.cli.format.json', + 'qmk.cli.format.python', + 'qmk.cli.format.text', 'qmk.cli.generate.api', 'qmk.cli.generate.config_h', 'qmk.cli.generate.dfu_header', @@ -48,12 +53,14 @@ subcommands = [ 'qmk.cli.generate.layouts', 'qmk.cli.generate.rgb_breathe_table', 'qmk.cli.generate.rules_mk', + 'qmk.cli.generate.version_h', 'qmk.cli.hello', 'qmk.cli.info', 'qmk.cli.json2c', 'qmk.cli.lint', 'qmk.cli.list.keyboards', 'qmk.cli.list.keymaps', + 'qmk.cli.list.layouts', 'qmk.cli.kle2json', 'qmk.cli.multibuild', 'qmk.cli.new.keyboard', @@ -63,6 +70,26 @@ subcommands = [ ] +def _install_deps(requirements): + """Perform the installation of missing requirements. + + If we detect that we are running in a virtualenv we can't write into we'll use sudo to perform the pip install. + """ + command = [sys.executable, '-m', 'pip', 'install'] + + if sys.prefix != sys.base_prefix: + # We are in a virtualenv, check to see if we need to use sudo to write to it + if not os.access(sys.prefix, os.W_OK): + print('Notice: Using sudo to install modules to location owned by root:', sys.prefix) + command.insert(0, 'sudo') + + elif not os.access(sys.prefix, os.W_OK): + # We can't write to sys.prefix, attempt to install locally + command.append('--local') + + return _run_cmd(*command, '-r', requirements) + + def _run_cmd(*command): """Run a command in a subshell. """ @@ -155,8 +182,14 @@ if int(milc_version[0]) < 2 and int(milc_version[1]) < 4: print(f'Your MILC library is too old! Please upgrade: python3 -m pip install -U -r {str(requirements)}') exit(127) +# Make sure we can run binaries in the same directory as our Python interpreter +python_dir = os.path.dirname(sys.executable) + +if python_dir not in os.environ['PATH'].split(':'): + os.environ['PATH'] = ":".join((python_dir, os.environ['PATH'])) + # Check to make sure we have all our dependencies -msg_install = 'Please run `python3 -m pip install -r %s` to install required python dependencies.' +msg_install = f'Please run `{sys.executable} -m pip install -r %s` to install required python dependencies.' args = sys.argv[1:] while args and args[0][0] == '-': del args[0] @@ -166,7 +199,7 @@ safe_command = args and args[0] in safe_commands if not safe_command: if _broken_module_imports('requirements.txt'): if yesno('Would you like to install the required Python modules?'): - _run_cmd(sys.executable, '-m', 'pip', 'install', '-r', 'requirements.txt') + _install_deps('requirements.txt') else: print() print(msg_install % (str(Path('requirements.txt').resolve()),)) @@ -175,7 +208,7 @@ if not safe_command: if cli.config.user.developer and _broken_module_imports('requirements-dev.txt'): if yesno('Would you like to install the required developer Python modules?'): - _run_cmd(sys.executable, '-m', 'pip', 'install', '-r', 'requirements-dev.txt') + _install_deps('requirements-dev.txt') elif yesno('Would you like to disable developer mode?'): _run_cmd(sys.argv[0], 'config', 'user.developer=None') else: @@ -190,7 +223,7 @@ for subcommand in subcommands: try: __import__(subcommand) - except ModuleNotFoundError as e: + except (ImportError, ModuleNotFoundError) as e: if safe_command: print(f'Warning: Could not import {subcommand}: {e.__class__.__name__}, {e}') else: diff --git a/lib/python/qmk/cli/cformat.py b/lib/python/qmk/cli/cformat.py index efeb459676..9d0ecaeba3 100644..100755 --- a/lib/python/qmk/cli/cformat.py +++ b/lib/python/qmk/cli/cformat.py @@ -1,137 +1,28 @@ -"""Format C code according to QMK's style. +"""Point people to the new command name. """ -from os import path -from shutil import which -from subprocess import CalledProcessError, DEVNULL, Popen, PIPE +import sys +from pathlib import Path -from argcomplete.completers import FilesCompleter from milc import cli -from qmk.path import normpath -from qmk.c_parse import c_source_files - -c_file_suffixes = ('c', 'h', 'cpp') -core_dirs = ('drivers', 'quantum', 'tests', 'tmk_core', 'platforms') -ignored = ('tmk_core/protocol/usb_hid', 'quantum/template', 'platforms/chibios') - - -def find_clang_format(): - """Returns the path to clang-format. - """ - for clang_version in range(20, 6, -1): - binary = f'clang-format-{clang_version}' - - if which(binary): - return binary - - return 'clang-format' - - -def find_diffs(files): - """Run clang-format and diff it against a file. - """ - found_diffs = False - - for file in files: - cli.log.debug('Checking for changes in %s', file) - clang_format = Popen([find_clang_format(), file], stdout=PIPE, stderr=PIPE, universal_newlines=True) - diff = cli.run(['diff', '-u', f'--label=a/{file}', f'--label=b/{file}', str(file), '-'], stdin=clang_format.stdout, capture_output=True) - - if diff.returncode != 0: - print(diff.stdout) - found_diffs = True - - return found_diffs - - -def cformat_run(files): - """Spawn clang-format subprocess with proper arguments - """ - # Determine which version of clang-format to use - clang_format = [find_clang_format(), '-i'] - - try: - cli.run([*clang_format, *map(str, files)], check=True, capture_output=False, stdin=DEVNULL) - cli.log.info('Successfully formatted the C code.') - return True - - except CalledProcessError as e: - cli.log.error('Error formatting C code!') - cli.log.debug('%s exited with returncode %s', e.cmd, e.returncode) - cli.log.debug('STDOUT:') - cli.log.debug(e.stdout) - cli.log.debug('STDERR:') - cli.log.debug(e.stderr) - return False - - -def filter_files(files, core_only=False): - """Yield only files to be formatted and skip the rest - """ - if core_only: - # Filter non-core files - for index, file in enumerate(files): - # The following statement checks each file to see if the file path is - # - in the core directories - # - not in the ignored directories - if not any(i in str(file) for i in core_dirs) or any(i in str(file) for i in ignored): - files[index] = None - cli.log.debug("Skipping non-core file %s, as '--core-only' is used.", file) - - for file in files: - if file and file.name.split('.')[-1] in c_file_suffixes: - yield file - else: - cli.log.debug('Skipping file %s', file) - @cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Flag only, don't automatically format.") @cli.argument('-b', '--base-branch', default='origin/master', help='Branch to compare to diffs to.') @cli.argument('-a', '--all-files', arg_only=True, action='store_true', help='Format all core files.') @cli.argument('--core-only', arg_only=True, action='store_true', help='Format core files only.') -@cli.argument('files', nargs='*', arg_only=True, type=normpath, completer=FilesCompleter('.c'), help='Filename(s) to format.') -@cli.subcommand("Format C code according to QMK's style.", hidden=False if cli.config.user.developer else True) +@cli.argument('files', nargs='*', arg_only=True, help='Filename(s) to format.') +@cli.subcommand('Pointer to the new command name: qmk format-c.', hidden=True) def cformat(cli): - """Format C code according to QMK's style. + """Pointer to the new command name: qmk format-c. """ - # Find the list of files to format - if cli.args.files: - files = list(filter_files(cli.args.files, cli.args.core_only)) - - if not files: - cli.log.error('No C files in filelist: %s', ', '.join(map(str, cli.args.files))) - exit(0) - - if cli.args.all_files: - cli.log.warning('Filenames passed with -a, only formatting: %s', ','.join(map(str, files))) - - elif cli.args.all_files: - all_files = c_source_files(core_dirs) - files = list(filter_files(all_files, True)) - - else: - git_diff_cmd = ['git', 'diff', '--name-only', cli.args.base_branch, *core_dirs] - git_diff = cli.run(git_diff_cmd, stdin=DEVNULL) - - if git_diff.returncode != 0: - cli.log.error("Error running %s", git_diff_cmd) - print(git_diff.stderr) - return git_diff.returncode - - files = [] - - for file in git_diff.stdout.strip().split('\n'): - if not any([file.startswith(ignore) for ignore in ignored]): - if path.exists(file) and file.split('.')[-1] in c_file_suffixes: - files.append(file) + cli.log.warning('"qmk cformat" has been renamed to "qmk format-c". Please use the new command in the future.') + argv = [sys.executable, *sys.argv] + argv[argv.index('cformat')] = 'format-c' + script_path = Path(argv[1]) + script_path_exe = Path(f'{argv[1]}.exe') - # Sanity check - if not files: - cli.log.error('No changed files detected. Use "qmk cformat -a" to format all core files') - return False + if not script_path.exists() and script_path_exe.exists(): + # For reasons I don't understand ".exe" is stripped from the script name on windows. + argv[1] = str(script_path_exe) - # Run clang-format on the files we've found - if cli.args.dry_run: - return not find_diffs(files) - else: - return cformat_run(files) + return cli.run(argv, capture_output=False).returncode diff --git a/lib/python/qmk/cli/compile.py b/lib/python/qmk/cli/compile.py index 7a45e77214..acbd778649 100755 --- a/lib/python/qmk/cli/compile.py +++ b/lib/python/qmk/cli/compile.py @@ -18,7 +18,7 @@ from qmk.keymap import keymap_completer @cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='The keyboard to build a firmware for. Ignored when a configurator export is supplied.') @cli.argument('-km', '--keymap', completer=keymap_completer, help='The keymap to build a firmware for. Ignored when a configurator export is supplied.') @cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Don't actually build, just show the make command to be run.") -@cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs to run.") +@cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs; 0 means unlimited.") @cli.argument('-e', '--env', arg_only=True, action='append', default=[], help="Set a variable to be passed to make. May be passed multiple times.") @cli.argument('-c', '--clean', arg_only=True, action='store_true', help="Remove object files before compiling.") @cli.subcommand('Compile a QMK Firmware.') diff --git a/lib/python/qmk/cli/console.py b/lib/python/qmk/cli/console.py index 45ff0c8bee..98c6bc0dc0 100644 --- a/lib/python/qmk/cli/console.py +++ b/lib/python/qmk/cli/console.py @@ -34,8 +34,8 @@ KNOWN_BOOTLOADERS = { ('03EB', '2FFB'): 'atmel-dfu: AT90USB128', ('03EB', '6124'): 'Microchip SAM-BA', ('0483', 'DF11'): 'stm32-dfu: STM32 BOOTLOADER', - ('16C0', '05DC'): 'USBasp: USBaspLoader', - ('16C0', '05DF'): 'bootloadHID: HIDBoot', + ('16C0', '05DC'): 'usbasploader: USBaspLoader', + ('16C0', '05DF'): 'bootloadhid: HIDBoot', ('16C0', '0478'): 'halfkay: Teensy Halfkay', ('1B4F', '9203'): 'caterina: Pro Micro 3.3V', ('1B4F', '9205'): 'caterina: Pro Micro 5V', @@ -48,10 +48,11 @@ KNOWN_BOOTLOADERS = { ('239A', '000C'): 'caterina: Adafruit Feather 32U4', ('239A', '000D'): 'caterina: Adafruit ItsyBitsy 32U4 3v', ('239A', '000E'): 'caterina: Adafruit ItsyBitsy 32U4 5v', - ('239A', '000E'): 'caterina: Adafruit ItsyBitsy 32U4 5v', ('2A03', '0036'): 'caterina: Arduino Leonardo', ('2A03', '0037'): 'caterina: Arduino Micro', - ('314B', '0106'): 'apm32-dfu: APM32 DFU ISP Mode' + ('314B', '0106'): 'apm32-dfu: APM32 DFU ISP Mode', + ('03EB', '2067'): 'qmk-hid: HID Bootloader', + ('03EB', '2045'): 'lufa-ms: LUFA Mass Storage Bootloader' } diff --git a/lib/python/qmk/cli/docs.py b/lib/python/qmk/cli/docs.py index 5816106504..d8f9b045a1 100644 --- a/lib/python/qmk/cli/docs.py +++ b/lib/python/qmk/cli/docs.py @@ -2,11 +2,13 @@ """ import http.server import os +import webbrowser from milc import cli @cli.argument('-p', '--port', default=8936, type=int, help='Port number to use.') +@cli.argument('-b', '--browser', action='store_true', help='Open the docs in the default browser.') @cli.subcommand('Run a local webserver for QMK documentation.', hidden=False if cli.config.user.developer else True) def docs(cli): """Spin up a local HTTPServer instance for the QMK docs. @@ -14,9 +16,12 @@ def docs(cli): os.chdir('docs') with http.server.HTTPServer(('', cli.config.docs.port), http.server.SimpleHTTPRequestHandler) as httpd: - cli.log.info("Serving QMK docs at http://localhost:%d/", cli.config.docs.port) + cli.log.info(f"Serving QMK docs at http://localhost:{cli.config.docs.port}/") cli.log.info("Press Control+C to exit.") + if cli.config.docs.browser: + webbrowser.open(f'http://localhost:{cli.config.docs.port}') + try: httpd.serve_forever() except KeyboardInterrupt: diff --git a/lib/python/qmk/cli/doctor/__init__.py b/lib/python/qmk/cli/doctor/__init__.py new file mode 100755 index 0000000000..272e042023 --- /dev/null +++ b/lib/python/qmk/cli/doctor/__init__.py @@ -0,0 +1,5 @@ +"""QMK Doctor + +Check out the user's QMK environment and make sure it's ready to compile. +""" +from .main import doctor diff --git a/lib/python/qmk/os_helpers/__init__.py b/lib/python/qmk/cli/doctor/check.py index 3e98db3c32..0807f41518 100644 --- a/lib/python/qmk/os_helpers/__init__.py +++ b/lib/python/qmk/cli/doctor/check.py @@ -1,4 +1,4 @@ -"""OS-agnostic helper functions +"""Check for specific programs. """ from enum import Enum import re @@ -30,7 +30,7 @@ ESSENTIAL_BINARIES = { } -def parse_gcc_version(version): +def _parse_gcc_version(version): m = re.match(r"(\d+)(?:\.(\d+))?(?:\.(\d+))?", version) return { @@ -40,7 +40,7 @@ def parse_gcc_version(version): } -def check_arm_gcc_version(): +def _check_arm_gcc_version(): """Returns True if the arm-none-eabi-gcc version is not known to cause problems. """ if 'output' in ESSENTIAL_BINARIES['arm-none-eabi-gcc']: @@ -50,7 +50,7 @@ def check_arm_gcc_version(): return CheckStatus.OK # Right now all known arm versions are ok -def check_avr_gcc_version(): +def _check_avr_gcc_version(): """Returns True if the avr-gcc version is not known to cause problems. """ rc = CheckStatus.ERROR @@ -60,7 +60,7 @@ def check_avr_gcc_version(): cli.log.info('Found avr-gcc version %s', version_number) rc = CheckStatus.OK - parsed_version = parse_gcc_version(version_number) + parsed_version = _parse_gcc_version(version_number) if parsed_version['major'] > 8: cli.log.warning('{fg_yellow}We do not recommend avr-gcc newer than 8. Downgrading to 8.x is recommended.') rc = CheckStatus.WARNING @@ -68,7 +68,7 @@ def check_avr_gcc_version(): return rc -def check_avrdude_version(): +def _check_avrdude_version(): if 'output' in ESSENTIAL_BINARIES['avrdude']: last_line = ESSENTIAL_BINARIES['avrdude']['output'].split('\n')[-2] version_number = last_line.split()[2][:-1] @@ -77,7 +77,7 @@ def check_avrdude_version(): return CheckStatus.OK -def check_dfu_util_version(): +def _check_dfu_util_version(): if 'output' in ESSENTIAL_BINARIES['dfu-util']: first_line = ESSENTIAL_BINARIES['dfu-util']['output'].split('\n')[0] version_number = first_line.split()[1] @@ -86,7 +86,7 @@ def check_dfu_util_version(): return CheckStatus.OK -def check_dfu_programmer_version(): +def _check_dfu_programmer_version(): if 'output' in ESSENTIAL_BINARIES['dfu-programmer']: first_line = ESSENTIAL_BINARIES['dfu-programmer']['output'].split('\n')[0] version_number = first_line.split()[1] @@ -111,7 +111,7 @@ def check_binary_versions(): """Check the versions of ESSENTIAL_BINARIES """ versions = [] - for check in (check_arm_gcc_version, check_avr_gcc_version, check_avrdude_version, check_dfu_util_version, check_dfu_programmer_version): + for check in (_check_arm_gcc_version, _check_avr_gcc_version, _check_avrdude_version, _check_dfu_util_version, _check_dfu_programmer_version): versions.append(check()) return versions @@ -159,6 +159,6 @@ def check_git_repo(): This is a decent enough indicator that the qmk_firmware directory is a proper Git repository, rather than a .zip download from GitHub. """ - dot_git_dir = QMK_FIRMWARE / '.git' + dot_git = QMK_FIRMWARE / '.git' - return CheckStatus.OK if dot_git_dir.is_dir() else CheckStatus.WARNING + return CheckStatus.OK if dot_git.exists() else CheckStatus.WARNING diff --git a/lib/python/qmk/os_helpers/linux/__init__.py b/lib/python/qmk/cli/doctor/linux.py index de38f1d609..777b19f762 100644 --- a/lib/python/qmk/os_helpers/linux/__init__.py +++ b/lib/python/qmk/cli/doctor/linux.py @@ -1,11 +1,13 @@ """OS-specific functions for: Linux """ -from pathlib import Path +import platform import shutil +from pathlib import Path from milc import cli + from qmk.constants import QMK_FIRMWARE -from qmk.os_helpers import CheckStatus +from .check import CheckStatus def _udev_rule(vid, pid=None, *args): @@ -39,7 +41,12 @@ def check_udev_rules(): """Make sure the udev rules look good. """ rc = CheckStatus.OK - udev_dir = Path("/etc/udev/rules.d/") + udev_dirs = [ + Path("/usr/lib/udev/rules.d/"), + Path("/usr/local/lib/udev/rules.d/"), + Path("/run/udev/rules.d/"), + Path("/etc/udev/rules.d/"), + ] desired_rules = { 'atmel-dfu': { _udev_rule("03eb", "2fef"), # ATmega16U2 @@ -78,6 +85,10 @@ def check_udev_rules(): # dog hunter AG _udev_rule("2a03", "0036", 'ENV{ID_MM_DEVICE_IGNORE}="1"'), # Leonardo _udev_rule("2a03", "0037", 'ENV{ID_MM_DEVICE_IGNORE}="1"') # Micro + }, + 'hid-bootloader': { + _udev_rule("03eb", "2067"), # QMK HID + _udev_rule("16c0", "0478") # PJRC halfkay } } @@ -91,8 +102,8 @@ def check_udev_rules(): 'tmk': {_deprecated_udev_rule("feed")} } - if udev_dir.exists(): - udev_rules = [rule_file for rule_file in udev_dir.glob('*.rules')] + if any(udev_dir.exists() for udev_dir in udev_dirs): + udev_rules = [rule_file for udev_dir in udev_dirs for rule_file in udev_dir.glob('*.rules')] current_rules = set() # Collect all rules from the config files @@ -114,15 +125,15 @@ def check_udev_rules(): cli.log.warning("{fg_yellow}Found old, deprecated udev rules for '%s' boards. The new rules on https://docs.qmk.fm/#/faq_build?id=linux-udev-rules offer better security with the same functionality.", bootloader) else: # For caterina, check if ModemManager is running - if bootloader == "caterina": - if check_modem_manager(): - rc = CheckStatus.WARNING - cli.log.warning("{fg_yellow}Detected ModemManager without the necessary udev rules. Please either disable it or set the appropriate udev rules if you are using a Pro Micro.") + if bootloader == "caterina" and check_modem_manager(): + cli.log.warning("{fg_yellow}Detected ModemManager without the necessary udev rules. Please either disable it or set the appropriate udev rules if you are using a Pro Micro.") + rc = CheckStatus.WARNING cli.log.warning("{fg_yellow}Missing or outdated udev rules for '%s' boards. Run 'sudo cp %s/util/udev/50-qmk.rules /etc/udev/rules.d/'.", bootloader, QMK_FIRMWARE) else: - cli.log.warning("{fg_yellow}'%s' does not exist. Skipping udev rule checking...", udev_dir) + cli.log.warning("{fg_yellow}Can't find udev rules, skipping udev rule checking...") + cli.log.debug("Checked directories: %s", ', '.join(str(udev_dir) for udev_dir in udev_dirs)) return rc @@ -149,3 +160,22 @@ def check_modem_manager(): """(TODO): Add check for non-systemd systems """ return False + + +def os_test_linux(): + """Run the Linux specific tests. + """ + # Don't bother with udev on WSL, for now + if 'microsoft' in platform.uname().release.lower(): + cli.log.info("Detected {fg_cyan}Linux (WSL){fg_reset}.") + + # https://github.com/microsoft/WSL/issues/4197 + if QMK_FIRMWARE.as_posix().startswith("/mnt"): + cli.log.warning("I/O performance on /mnt may be extremely slow.") + return CheckStatus.WARNING + + return CheckStatus.OK + else: + cli.log.info("Detected {fg_cyan}Linux{fg_reset}.") + + return check_udev_rules() diff --git a/lib/python/qmk/cli/doctor/macos.py b/lib/python/qmk/cli/doctor/macos.py new file mode 100644 index 0000000000..00fb272858 --- /dev/null +++ b/lib/python/qmk/cli/doctor/macos.py @@ -0,0 +1,13 @@ +import platform + +from milc import cli + +from .check import CheckStatus + + +def os_test_macos(): + """Run the Mac specific tests. + """ + cli.log.info("Detected {fg_cyan}macOS %s{fg_reset}.", platform.mac_ver()[0]) + + return CheckStatus.OK diff --git a/lib/python/qmk/cli/doctor.py b/lib/python/qmk/cli/doctor/main.py index 9e10570620..ed20f46d3f 100755 --- a/lib/python/qmk/cli/doctor.py +++ b/lib/python/qmk/cli/doctor/main.py @@ -7,9 +7,11 @@ from subprocess import DEVNULL from milc import cli from milc.questions import yesno + from qmk import submodules -from qmk.constants import QMK_FIRMWARE -from qmk.os_helpers import CheckStatus, check_binaries, check_binary_versions, check_submodules, check_git_repo +from qmk.constants import QMK_FIRMWARE, QMK_FIRMWARE_UPSTREAM +from .check import CheckStatus, check_binaries, check_binary_versions, check_submodules +from qmk.commands import git_check_repo, git_get_branch, git_is_dirty, git_get_remotes, git_check_deviation, in_virtualenv def os_tests(): @@ -18,51 +20,48 @@ def os_tests(): platform_id = platform.platform().lower() if 'darwin' in platform_id or 'macos' in platform_id: + from .macos import os_test_macos return os_test_macos() elif 'linux' in platform_id: + from .linux import os_test_linux return os_test_linux() elif 'windows' in platform_id: + from .windows import os_test_windows return os_test_windows() else: cli.log.warning('Unsupported OS detected: %s', platform_id) return CheckStatus.WARNING -def os_test_linux(): - """Run the Linux specific tests. +def git_tests(): + """Run Git-related checks """ - # Don't bother with udev on WSL, for now - if 'microsoft' in platform.uname().release.lower(): - cli.log.info("Detected {fg_cyan}Linux (WSL){fg_reset}.") - - # https://github.com/microsoft/WSL/issues/4197 - if QMK_FIRMWARE.as_posix().startswith("/mnt"): - cli.log.warning("I/O performance on /mnt may be extremely slow.") - return CheckStatus.WARNING + status = CheckStatus.OK - return CheckStatus.OK + # Make sure our QMK home is a Git repo + git_ok = git_check_repo() + if not git_ok: + cli.log.warning("{fg_yellow}QMK home does not appear to be a Git repository! (no .git folder)") + status = CheckStatus.WARNING else: - cli.log.info("Detected {fg_cyan}Linux{fg_reset}.") - from qmk.os_helpers.linux import check_udev_rules - - return check_udev_rules() - - -def os_test_macos(): - """Run the Mac specific tests. - """ - cli.log.info("Detected {fg_cyan}macOS %s{fg_reset}.", platform.mac_ver()[0]) - - return CheckStatus.OK - - -def os_test_windows(): - """Run the Windows specific tests. - """ - win32_ver = platform.win32_ver() - cli.log.info("Detected {fg_cyan}Windows %s (%s){fg_reset}.", win32_ver[0], win32_ver[1]) - - return CheckStatus.OK + git_branch = git_get_branch() + if git_branch: + cli.log.info('Git branch: %s', git_branch) + git_dirty = git_is_dirty() + if git_dirty: + cli.log.warning('{fg_yellow}Git has unstashed/uncommitted changes.') + status = CheckStatus.WARNING + git_remotes = git_get_remotes() + if 'upstream' not in git_remotes.keys() or QMK_FIRMWARE_UPSTREAM not in git_remotes['upstream'].get('url', ''): + cli.log.warning('{fg_yellow}The official repository does not seem to be configured as git remote "upstream".') + status = CheckStatus.WARNING + else: + git_deviation = git_check_deviation(git_branch) + if git_branch in ['master', 'develop'] and git_deviation: + cli.log.warning('{fg_yellow}The local "%s" branch contains commits not found in the upstream branch.', git_branch) + status = CheckStatus.WARNING + + return status @cli.argument('-y', '--yes', action='store_true', arg_only=True, help='Answer yes to all questions.') @@ -77,16 +76,17 @@ def doctor(cli): * [ ] Compile a trivial program with each compiler """ cli.log.info('QMK Doctor is checking your environment.') + cli.log.info('CLI version: %s', cli.version) cli.log.info('QMK home: {fg_cyan}%s', QMK_FIRMWARE) - status = os_tests() + status = os_status = os_tests() + git_status = git_tests() - # Make sure our QMK home is a Git repo - git_ok = check_git_repo() + if git_status == CheckStatus.ERROR or (os_status == CheckStatus.OK and git_status == CheckStatus.WARNING): + status = git_status - if git_ok == CheckStatus.WARNING: - cli.log.warning("QMK home does not appear to be a Git repository! (no .git folder)") - status = CheckStatus.WARNING + if in_virtualenv(): + cli.log.info('CLI installed in virtualenv.') # Make sure the basic CLI tools we need are available and can be executed. bin_ok = check_binaries() diff --git a/lib/python/qmk/cli/doctor/windows.py b/lib/python/qmk/cli/doctor/windows.py new file mode 100644 index 0000000000..381ab36fde --- /dev/null +++ b/lib/python/qmk/cli/doctor/windows.py @@ -0,0 +1,14 @@ +import platform + +from milc import cli + +from .check import CheckStatus + + +def os_test_windows(): + """Run the Windows specific tests. + """ + win32_ver = platform.win32_ver() + cli.log.info("Detected {fg_cyan}Windows %s (%s){fg_reset}.", win32_ver[0], win32_ver[1]) + + return CheckStatus.OK diff --git a/lib/python/qmk/cli/fileformat.py b/lib/python/qmk/cli/fileformat.py index 112d8d59da..cee4ba1acd 100644..100755 --- a/lib/python/qmk/cli/fileformat.py +++ b/lib/python/qmk/cli/fileformat.py @@ -1,13 +1,23 @@ -"""Format files according to QMK's style. +"""Point people to the new command name. """ -from milc import cli +import sys +from pathlib import Path -import subprocess +from milc import cli -@cli.subcommand("Format files according to QMK's style.", hidden=True) +@cli.subcommand('Pointer to the new command name: qmk format-text.', hidden=True) def fileformat(cli): - """Run several general formatting commands. + """Pointer to the new command name: qmk format-text. """ - dos2unix = subprocess.run(['bash', '-c', 'git ls-files -z | xargs -0 dos2unix'], stdout=subprocess.DEVNULL) - return dos2unix.returncode + cli.log.warning('"qmk fileformat" has been renamed to "qmk format-text". Please use the new command in the future.') + argv = [sys.executable, *sys.argv] + argv[argv.index('fileformat')] = 'format-text' + script_path = Path(argv[1]) + script_path_exe = Path(f'{argv[1]}.exe') + + if not script_path.exists() and script_path_exe.exists(): + # For reasons I don't understand ".exe" is stripped from the script name on windows. + argv[1] = str(script_path_exe) + + return cli.run(argv, capture_output=False).returncode diff --git a/lib/python/qmk/cli/flash.py b/lib/python/qmk/cli/flash.py index 1b2932a5b2..c2d9e09c69 100644 --- a/lib/python/qmk/cli/flash.py +++ b/lib/python/qmk/cli/flash.py @@ -38,7 +38,7 @@ def print_bootloader_help(): @cli.argument('-km', '--keymap', help='The keymap to build a firmware for. Use this if you dont have a configurator file. Ignored when a configurator file is supplied.') @cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='The keyboard to build a firmware for. Use this if you dont have a configurator file. Ignored when a configurator file is supplied.') @cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Don't actually build, just show the make command to be run.") -@cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs to run.") +@cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs; 0 means unlimited.") @cli.argument('-e', '--env', arg_only=True, action='append', default=[], help="Set a variable to be passed to make. May be passed multiple times.") @cli.argument('-c', '--clean', arg_only=True, action='store_true', help="Remove object files before compiling.") @cli.subcommand('QMK Flash.') diff --git a/lib/python/qmk/cli/format/c.py b/lib/python/qmk/cli/format/c.py new file mode 100644 index 0000000000..0160e6036f --- /dev/null +++ b/lib/python/qmk/cli/format/c.py @@ -0,0 +1,137 @@ +"""Format C code according to QMK's style. +""" +from os import path +from shutil import which +from subprocess import CalledProcessError, DEVNULL, Popen, PIPE + +from argcomplete.completers import FilesCompleter +from milc import cli + +from qmk.path import normpath +from qmk.c_parse import c_source_files + +c_file_suffixes = ('c', 'h', 'cpp') +core_dirs = ('drivers', 'quantum', 'tests', 'tmk_core', 'platforms') +ignored = ('tmk_core/protocol/usb_hid', 'platforms/chibios/boards') + + +def find_clang_format(): + """Returns the path to clang-format. + """ + for clang_version in range(20, 6, -1): + binary = f'clang-format-{clang_version}' + + if which(binary): + return binary + + return 'clang-format' + + +def find_diffs(files): + """Run clang-format and diff it against a file. + """ + found_diffs = False + + for file in files: + cli.log.debug('Checking for changes in %s', file) + clang_format = Popen([find_clang_format(), file], stdout=PIPE, stderr=PIPE, universal_newlines=True) + diff = cli.run(['diff', '-u', f'--label=a/{file}', f'--label=b/{file}', str(file), '-'], stdin=clang_format.stdout, capture_output=True) + + if diff.returncode != 0: + print(diff.stdout) + found_diffs = True + + return found_diffs + + +def cformat_run(files): + """Spawn clang-format subprocess with proper arguments + """ + # Determine which version of clang-format to use + clang_format = [find_clang_format(), '-i'] + + try: + cli.run([*clang_format, *map(str, files)], check=True, capture_output=False, stdin=DEVNULL) + cli.log.info('Successfully formatted the C code.') + return True + + except CalledProcessError as e: + cli.log.error('Error formatting C code!') + cli.log.debug('%s exited with returncode %s', e.cmd, e.returncode) + cli.log.debug('STDOUT:') + cli.log.debug(e.stdout) + cli.log.debug('STDERR:') + cli.log.debug(e.stderr) + return False + + +def filter_files(files, core_only=False): + """Yield only files to be formatted and skip the rest + """ + if core_only: + # Filter non-core files + for index, file in enumerate(files): + # The following statement checks each file to see if the file path is + # - in the core directories + # - not in the ignored directories + if not any(i in str(file) for i in core_dirs) or any(i in str(file) for i in ignored): + files[index] = None + cli.log.debug("Skipping non-core file %s, as '--core-only' is used.", file) + + for file in files: + if file and file.name.split('.')[-1] in c_file_suffixes: + yield file + else: + cli.log.debug('Skipping file %s', file) + + +@cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Flag only, don't automatically format.") +@cli.argument('-b', '--base-branch', default='origin/master', help='Branch to compare to diffs to.') +@cli.argument('-a', '--all-files', arg_only=True, action='store_true', help='Format all core files.') +@cli.argument('--core-only', arg_only=True, action='store_true', help='Format core files only.') +@cli.argument('files', nargs='*', arg_only=True, type=normpath, completer=FilesCompleter('.c'), help='Filename(s) to format.') +@cli.subcommand("Format C code according to QMK's style.", hidden=False if cli.config.user.developer else True) +def format_c(cli): + """Format C code according to QMK's style. + """ + # Find the list of files to format + if cli.args.files: + files = list(filter_files(cli.args.files, cli.args.core_only)) + + if not files: + cli.log.error('No C files in filelist: %s', ', '.join(map(str, cli.args.files))) + exit(0) + + if cli.args.all_files: + cli.log.warning('Filenames passed with -a, only formatting: %s', ','.join(map(str, files))) + + elif cli.args.all_files: + all_files = c_source_files(core_dirs) + files = list(filter_files(all_files, True)) + + else: + git_diff_cmd = ['git', 'diff', '--name-only', cli.args.base_branch, *core_dirs] + git_diff = cli.run(git_diff_cmd, stdin=DEVNULL) + + if git_diff.returncode != 0: + cli.log.error("Error running %s", git_diff_cmd) + print(git_diff.stderr) + return git_diff.returncode + + files = [] + + for file in git_diff.stdout.strip().split('\n'): + if not any([file.startswith(ignore) for ignore in ignored]): + if path.exists(file) and file.split('.')[-1] in c_file_suffixes: + files.append(file) + + # Sanity check + if not files: + cli.log.error('No changed files detected. Use "qmk format-c -a" to format all core files') + return False + + # Run clang-format on the files we've found + if cli.args.dry_run: + return not find_diffs(files) + else: + return cformat_run(files) diff --git a/lib/python/qmk/cli/format/json.py b/lib/python/qmk/cli/format/json.py index 1358c70e7a..19d504491f 100755 --- a/lib/python/qmk/cli/format/json.py +++ b/lib/python/qmk/cli/format/json.py @@ -8,7 +8,7 @@ from jsonschema import ValidationError from milc import cli from qmk.info import info_json -from qmk.json_schema import json_load, keyboard_validate +from qmk.json_schema import json_load, validate from qmk.json_encoders import InfoJSONEncoder, KeymapJSONEncoder from qmk.path import normpath @@ -23,14 +23,13 @@ def format_json(cli): if cli.args.format == 'auto': try: - keyboard_validate(json_file) + validate(json_file, 'qmk.keyboard.v1') json_encoder = InfoJSONEncoder except ValidationError as e: cli.log.warning('File %s did not validate as a keyboard:\n\t%s', cli.args.json_file, e) cli.log.info('Treating %s as a keymap file.', cli.args.json_file) json_encoder = KeymapJSONEncoder - elif cli.args.format == 'keyboard': json_encoder = InfoJSONEncoder elif cli.args.format == 'keymap': diff --git a/lib/python/qmk/cli/format/python.py b/lib/python/qmk/cli/format/python.py new file mode 100755 index 0000000000..00612f97ec --- /dev/null +++ b/lib/python/qmk/cli/format/python.py @@ -0,0 +1,26 @@ +"""Format python code according to QMK's style. +""" +from subprocess import CalledProcessError, DEVNULL + +from milc import cli + + +@cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Don't actually format.") +@cli.subcommand("Format python code according to QMK's style.", hidden=False if cli.config.user.developer else True) +def format_python(cli): + """Format python code according to QMK's style. + """ + edit = '--diff' if cli.args.dry_run else '--in-place' + yapf_cmd = ['yapf', '-vv', '--recursive', edit, 'bin/qmk', 'lib/python'] + try: + cli.run(yapf_cmd, check=True, capture_output=False, stdin=DEVNULL) + cli.log.info('Python code in `bin/qmk` and `lib/python` is correctly formatted.') + return True + + except CalledProcessError: + if cli.args.dry_run: + cli.log.error('Python code in `bin/qmk` and `lib/python` incorrectly formatted!') + else: + cli.log.error('Error formatting python code!') + + return False diff --git a/lib/python/qmk/cli/format/text.py b/lib/python/qmk/cli/format/text.py new file mode 100644 index 0000000000..e7e07b7297 --- /dev/null +++ b/lib/python/qmk/cli/format/text.py @@ -0,0 +1,27 @@ +"""Ensure text files have the proper line endings. +""" +from subprocess import CalledProcessError + +from milc import cli + + +@cli.subcommand("Ensure text files have the proper line endings.", hidden=True) +def format_text(cli): + """Ensure text files have the proper line endings. + """ + try: + file_list_cmd = cli.run(['git', 'ls-files', '-z'], check=True) + except CalledProcessError as e: + cli.log.error('Could not get file list: %s', e) + exit(1) + except Exception as e: + cli.log.error('Unhandled exception: %s: %s', e.__class__.__name__, e) + cli.log.exception(e) + exit(1) + + dos2unix = cli.run(['xargs', '-0', 'dos2unix'], stdin=None, input=file_list_cmd.stdout) + + if dos2unix.returncode != 0: + print(dos2unix.stderr) + + return dos2unix.returncode diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py index 54cd5b96a8..f16dca1de8 100755 --- a/lib/python/qmk/cli/generate/config_h.py +++ b/lib/python/qmk/cli/generate/config_h.py @@ -5,14 +5,14 @@ from pathlib import Path from dotty_dict import dotty from milc import cli -from qmk.decorators import automagic_keyboard, automagic_keymap from qmk.info import info_json -from qmk.json_schema import json_load +from qmk.json_schema import json_load, validate from qmk.keyboard import keyboard_completer, keyboard_folder -from qmk.path import is_keyboard, normpath +from qmk.keymap import locate_keymap +from qmk.path import normpath -def direct_pins(direct_pins): +def direct_pins(direct_pins, postfix): """Return the config.h lines that set the direct pins. """ rows = [] @@ -24,81 +24,60 @@ def direct_pins(direct_pins): col_count = len(direct_pins[0]) row_count = len(direct_pins) - return """ -#ifndef MATRIX_COLS -# define MATRIX_COLS %s -#endif // MATRIX_COLS + return f""" +#ifndef MATRIX_COLS{postfix} +# define MATRIX_COLS{postfix} {col_count} +#endif // MATRIX_COLS{postfix} -#ifndef MATRIX_ROWS -# define MATRIX_ROWS %s -#endif // MATRIX_ROWS +#ifndef MATRIX_ROWS{postfix} +# define MATRIX_ROWS{postfix} {row_count} +#endif // MATRIX_ROWS{postfix} -#ifndef DIRECT_PINS -# define DIRECT_PINS {%s} -#endif // DIRECT_PINS -""" % (col_count, row_count, ','.join(rows)) +#ifndef DIRECT_PINS{postfix} +# define DIRECT_PINS{postfix} {{ {", ".join(rows)} }} +#endif // DIRECT_PINS{postfix} +""" -def pin_array(define, pins): +def pin_array(define, pins, postfix): """Return the config.h lines that set a pin array. """ pin_num = len(pins) pin_array = ', '.join(map(str, [pin or 'NO_PIN' for pin in pins])) return f""" -#ifndef {define}S -# define {define}S {pin_num} -#endif // {define}S +#ifndef {define}S{postfix} +# define {define}S{postfix} {pin_num} +#endif // {define}S{postfix} -#ifndef {define}_PINS -# define {define}_PINS {{ {pin_array} }} -#endif // {define}_PINS +#ifndef {define}_PINS{postfix} +# define {define}_PINS{postfix} {{ {pin_array} }} +#endif // {define}_PINS{postfix} """ -def matrix_pins(matrix_pins): +def matrix_pins(matrix_pins, postfix=''): """Add the matrix config to the config.h. """ pins = [] if 'direct' in matrix_pins: - pins.append(direct_pins(matrix_pins['direct'])) + pins.append(direct_pins(matrix_pins['direct'], postfix)) if 'cols' in matrix_pins: - pins.append(pin_array('MATRIX_COL', matrix_pins['cols'])) + pins.append(pin_array('MATRIX_COL', matrix_pins['cols'], postfix)) if 'rows' in matrix_pins: - pins.append(pin_array('MATRIX_ROW', matrix_pins['rows'])) + pins.append(pin_array('MATRIX_ROW', matrix_pins['rows'], postfix)) return '\n'.join(pins) -@cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') -@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") -@cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Keyboard to generate config.h for.') -@cli.subcommand('Used by the make system to generate info_config.h from info.json', hidden=True) -@automagic_keyboard -@automagic_keymap -def generate_config_h(cli): - """Generates the info_config.h file. +def generate_config_items(kb_info_json, config_h_lines): + """Iterate through the info_config map to generate basic config values. """ - # Determine our keyboard(s) - if not cli.config.generate_config_h.keyboard: - cli.log.error('Missing parameter: --keyboard') - cli.subcommands['info'].print_help() - return False - - if not is_keyboard(cli.config.generate_config_h.keyboard): - cli.log.error('Invalid keyboard: "%s"', cli.config.generate_config_h.keyboard) - return False - - # Build the info_config.h file. - kb_info_json = dotty(info_json(cli.config.generate_config_h.keyboard)) info_config_map = json_load(Path('data/mappings/info_config.json')) - config_h_lines = ['/* This file was generated by `qmk generate-config-h`. Do not edit or copy.' ' */', '', '#pragma once'] - - # Iterate through the info_config map to generate basic things for config_key, info_dict in info_config_map.items(): info_key = info_dict['info_key'] key_type = info_dict.get('value_type', 'str') @@ -135,9 +114,75 @@ def generate_config_h(cli): config_h_lines.append(f'# define {config_key} {config_value}') config_h_lines.append(f'#endif // {config_key}') + +def generate_split_config(kb_info_json, config_h_lines): + """Generate the config.h lines for split boards.""" + if 'primary' in kb_info_json['split']: + if kb_info_json['split']['primary'] in ('left', 'right'): + config_h_lines.append('') + config_h_lines.append('#ifndef MASTER_LEFT') + config_h_lines.append('# ifndef MASTER_RIGHT') + if kb_info_json['split']['primary'] == 'left': + config_h_lines.append('# define MASTER_LEFT') + elif kb_info_json['split']['primary'] == 'right': + config_h_lines.append('# define MASTER_RIGHT') + config_h_lines.append('# endif // MASTER_RIGHT') + config_h_lines.append('#endif // MASTER_LEFT') + elif kb_info_json['split']['primary'] == 'pin': + config_h_lines.append('') + config_h_lines.append('#ifndef SPLIT_HAND_PIN') + config_h_lines.append('# define SPLIT_HAND_PIN') + config_h_lines.append('#endif // SPLIT_HAND_PIN') + elif kb_info_json['split']['primary'] == 'matrix_grid': + config_h_lines.append('') + config_h_lines.append('#ifndef SPLIT_HAND_MATRIX_GRID') + config_h_lines.append('# define SPLIT_HAND_MATRIX_GRID {%s}' % (','.join(kb_info_json["split"]["matrix_grid"],))) + config_h_lines.append('#endif // SPLIT_HAND_MATRIX_GRID') + elif kb_info_json['split']['primary'] == 'eeprom': + config_h_lines.append('') + config_h_lines.append('#ifndef EE_HANDS') + config_h_lines.append('# define EE_HANDS') + config_h_lines.append('#endif // EE_HANDS') + + if 'protocol' in kb_info_json['split'].get('transport', {}): + if kb_info_json['split']['transport']['protocol'] == 'i2c': + config_h_lines.append('') + config_h_lines.append('#ifndef USE_I2C') + config_h_lines.append('# define USE_I2C') + config_h_lines.append('#endif // USE_I2C') + + if 'right' in kb_info_json['split'].get('matrix_pins', {}): + config_h_lines.append(matrix_pins(kb_info_json['split']['matrix_pins']['right'], '_RIGHT')) + + +@cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') +@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") +@cli.argument('-kb', '--keyboard', arg_only=True, type=keyboard_folder, completer=keyboard_completer, required=True, help='Keyboard to generate config.h for.') +@cli.argument('-km', '--keymap', arg_only=True, help='Keymap to generate config.h for.') +@cli.subcommand('Used by the make system to generate info_config.h from info.json', hidden=True) +def generate_config_h(cli): + """Generates the info_config.h file. + """ + # 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', {})) + else: + kb_info_json = dotty(info_json(cli.args.keyboard)) + + # Build the info_config.h file. + config_h_lines = ['/* This file was generated by `qmk generate-config-h`. Do not edit or copy.', ' */', '', '#pragma once'] + + generate_config_items(kb_info_json, config_h_lines) + if 'matrix_pins' in kb_info_json: config_h_lines.append(matrix_pins(kb_info_json['matrix_pins'])) + if 'split' in kb_info_json: + generate_split_config(kb_info_json, config_h_lines) + # Show the results config_h = '\n'.join(config_h_lines) diff --git a/lib/python/qmk/cli/generate/dfu_header.py b/lib/python/qmk/cli/generate/dfu_header.py index 211ed9991a..5a1b109f1e 100644 --- a/lib/python/qmk/cli/generate/dfu_header.py +++ b/lib/python/qmk/cli/generate/dfu_header.py @@ -30,7 +30,7 @@ def generate_dfu_header(cli): # Build the Keyboard.h file. kb_info_json = dotty(info_json(cli.config.generate_dfu_header.keyboard)) - keyboard_h_lines = ['/* This file was generated by `qmk generate-dfu-header`. Do not edit or copy.' ' */', '', '#pragma once'] + keyboard_h_lines = ['/* This file was generated by `qmk generate-dfu-header`. Do not edit or copy.', ' */', '', '#pragma once'] keyboard_h_lines.append(f'#define MANUFACTURER {kb_info_json["manufacturer"]}') keyboard_h_lines.append(f'#define PRODUCT {cli.config.generate_dfu_header.keyboard} Bootloader') diff --git a/lib/python/qmk/cli/generate/info_json.py b/lib/python/qmk/cli/generate/info_json.py index 8931b68b6f..284d1a8510 100755 --- a/lib/python/qmk/cli/generate/info_json.py +++ b/lib/python/qmk/cli/generate/info_json.py @@ -4,15 +4,17 @@ Compile an info.json for a particular keyboard and pretty-print it. """ import json -from jsonschema import Draft7Validator, validators +from argcomplete.completers import FilesCompleter +from jsonschema import Draft7Validator, RefResolver, validators from milc import cli +from pathlib import Path from qmk.decorators import automagic_keyboard, automagic_keymap from qmk.info import info_json from qmk.json_encoders import InfoJSONEncoder -from qmk.json_schema import load_jsonschema +from qmk.json_schema import compile_schema_store from qmk.keyboard import keyboard_completer, keyboard_folder -from qmk.path import is_keyboard +from qmk.path import is_keyboard, normpath def pruning_validator(validator_class): @@ -34,15 +36,19 @@ def pruning_validator(validator_class): def strip_info_json(kb_info_json): """Remove the API-only properties from the info.json. """ + schema_store = compile_schema_store() pruning_draft_7_validator = pruning_validator(Draft7Validator) - schema = load_jsonschema('keyboard') - validator = pruning_draft_7_validator(schema).validate + schema = schema_store['qmk.keyboard.v1'] + resolver = RefResolver.from_schema(schema_store['qmk.keyboard.v1'], store=schema_store) + validator = pruning_draft_7_validator(schema, resolver=resolver).validate return validator(kb_info_json) @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('-o', '--output', arg_only=True, completer=FilesCompleter, help='Write the output the specified file, overwriting if necessary.') +@cli.argument('-ow', '--overwrite', arg_only=True, action='store_true', help='Overwrite the existing info.json. (Overrides the location of --output)') @cli.subcommand('Generate an info.json file for a keyboard.', hidden=False if cli.config.user.developer else True) @automagic_keyboard @automagic_keymap @@ -59,9 +65,29 @@ def generate_info_json(cli): cli.log.error('Invalid keyboard: "%s"', cli.config.generate_info_json.keyboard) return False + if cli.args.overwrite: + output_path = (Path('keyboards') / cli.config.generate_info_json.keyboard / 'info.json').resolve() + + if cli.args.output: + cli.log.warning('Overwriting user supplied --output with %s', output_path) + + cli.args.output = output_path + # Build the info.json file kb_info_json = info_json(cli.config.generate_info_json.keyboard) strip_info_json(kb_info_json) + info_json_text = json.dumps(kb_info_json, indent=4, cls=InfoJSONEncoder) + + if cli.args.output: + # Write to a file + output_path = normpath(cli.args.output) + + if output_path.exists(): + cli.log.warning('Overwriting output file %s', output_path) + + output_path.write_text(info_json_text + '\n') + cli.log.info('Wrote info.json to %s.', output_path) - # Display the results - print(json.dumps(kb_info_json, indent=2, cls=InfoJSONEncoder)) + else: + # Display the results + print(info_json_text) diff --git a/lib/python/qmk/cli/generate/keyboard_h.py b/lib/python/qmk/cli/generate/keyboard_h.py index 22500dbc91..f05178cede 100755 --- a/lib/python/qmk/cli/generate/keyboard_h.py +++ b/lib/python/qmk/cli/generate/keyboard_h.py @@ -2,7 +2,6 @@ """ from milc import cli -from qmk.decorators import automagic_keyboard, automagic_keymap from qmk.info import info_json from qmk.keyboard import keyboard_completer, keyboard_folder from qmk.path import normpath @@ -29,17 +28,15 @@ def would_populate_layout_h(keyboard): @cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') @cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") -@cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, required=True, help='Keyboard to generate keyboard.h for.') +@cli.argument('-kb', '--keyboard', arg_only=True, type=keyboard_folder, completer=keyboard_completer, required=True, help='Keyboard to generate keyboard.h for.') @cli.subcommand('Used by the make system to generate keyboard.h from info.json', hidden=True) -@automagic_keyboard -@automagic_keymap def generate_keyboard_h(cli): """Generates the keyboard.h file. """ - has_layout_h = would_populate_layout_h(cli.config.generate_keyboard_h.keyboard) + has_layout_h = would_populate_layout_h(cli.args.keyboard) # Build the layouts.h file. - keyboard_h_lines = ['/* This file was generated by `qmk generate-keyboard-h`. Do not edit or copy.' ' */', '', '#pragma once', '#include "quantum.h"'] + keyboard_h_lines = ['/* This file was generated by `qmk generate-keyboard-h`. Do not edit or copy.', ' */', '', '#pragma once', '#include "quantum.h"'] if not has_layout_h: keyboard_h_lines.append('#pragma error("<keyboard>.h is only optional for data driven keyboards - kb.h == bad times")') diff --git a/lib/python/qmk/cli/generate/layouts.py b/lib/python/qmk/cli/generate/layouts.py index 4de982f822..e44266e1c8 100755 --- a/lib/python/qmk/cli/generate/layouts.py +++ b/lib/python/qmk/cli/generate/layouts.py @@ -38,7 +38,7 @@ def generate_layouts(cli): kb_info_json = info_json(cli.config.generate_layouts.keyboard) # Build the layouts.h file. - layouts_h_lines = ['/* This file was generated by `qmk generate-layouts`. Do not edit or copy.' ' */', '', '#pragma once'] + layouts_h_lines = ['/* This file was generated by `qmk generate-layouts`. Do not edit or copy.', ' */', '', '#pragma once'] if 'matrix_pins' in kb_info_json: if 'direct' in kb_info_json['matrix_pins']: diff --git a/lib/python/qmk/cli/generate/rules_mk.py b/lib/python/qmk/cli/generate/rules_mk.py index 41c94e16b5..dcaff29fae 100755 --- a/lib/python/qmk/cli/generate/rules_mk.py +++ b/lib/python/qmk/cli/generate/rules_mk.py @@ -5,11 +5,11 @@ from pathlib import Path from dotty_dict import dotty from milc import cli -from qmk.decorators import automagic_keyboard, automagic_keymap from qmk.info import info_json -from qmk.json_schema import json_load +from qmk.json_schema import json_load, validate from qmk.keyboard import keyboard_completer, keyboard_folder -from qmk.path import is_keyboard, normpath +from qmk.keymap import locate_keymap +from qmk.path import normpath def process_mapping_rule(kb_info_json, rules_key, info_dict): @@ -26,7 +26,7 @@ def process_mapping_rule(kb_info_json, rules_key, info_dict): except KeyError: return None - if key_type == 'array': + if key_type in ['array', 'list']: return f'{rules_key} ?= {" ".join(rules_value)}' elif key_type == 'bool': return f'{rules_key} ?= {"on" if rules_value else "off"}' @@ -39,23 +39,21 @@ def process_mapping_rule(kb_info_json, rules_key, info_dict): @cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') @cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") @cli.argument('-e', '--escape', arg_only=True, action='store_true', help="Escape spaces in quiet mode") -@cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, help='Keyboard to generate config.h for.') -@cli.subcommand('Used by the make system to generate info_config.h from info.json', hidden=True) -@automagic_keyboard -@automagic_keymap +@cli.argument('-kb', '--keyboard', arg_only=True, type=keyboard_folder, completer=keyboard_completer, required=True, help='Keyboard to generate rules.mk for.') +@cli.argument('-km', '--keymap', arg_only=True, help='Keymap to generate rules.mk for.') +@cli.subcommand('Used by the make system to generate rules.mk from info.json', hidden=True) def generate_rules_mk(cli): """Generates a rules.mk file from info.json. """ - if not cli.config.generate_rules_mk.keyboard: - cli.log.error('Missing parameter: --keyboard') - cli.subcommands['info'].print_help() - return False - - if not is_keyboard(cli.config.generate_rules_mk.keyboard): - cli.log.error('Invalid keyboard: "%s"', cli.config.generate_rules_mk.keyboard) - return False + # 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', {})) + else: + kb_info_json = dotty(info_json(cli.args.keyboard)) - kb_info_json = dotty(info_json(cli.config.generate_rules_mk.keyboard)) info_rules_map = json_load(Path('data/mappings/info_rules.json')) rules_mk_lines = ['# This file was generated by `qmk generate-rules-mk`. Do not edit or copy.', ''] @@ -76,6 +74,17 @@ def generate_rules_mk(cli): enabled = 'yes' if enabled else 'no' rules_mk_lines.append(f'{feature}_ENABLE ?= {enabled}') + # Set SPLIT_TRANSPORT, if needed + if kb_info_json.get('split', {}).get('transport', {}).get('protocol') == 'custom': + rules_mk_lines.append('SPLIT_TRANSPORT ?= custom') + + # Set CUSTOM_MATRIX, if needed + if kb_info_json.get('matrix_pins', {}).get('custom'): + if kb_info_json.get('matrix_pins', {}).get('custom_lite'): + rules_mk_lines.append('CUSTOM_MATRIX ?= lite') + else: + rules_mk_lines.append('CUSTOM_MATRIX ?= yes') + # Show the results rules_mk = '\n'.join(rules_mk_lines) + '\n' diff --git a/lib/python/qmk/cli/generate/version_h.py b/lib/python/qmk/cli/generate/version_h.py new file mode 100644 index 0000000000..b8e52588c4 --- /dev/null +++ b/lib/python/qmk/cli/generate/version_h.py @@ -0,0 +1,28 @@ +"""Used by the make system to generate version.h for use in code. +""" +from milc import cli + +from qmk.commands import create_version_h +from qmk.path import normpath + + +@cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') +@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") +@cli.argument('--skip-git', arg_only=True, action='store_true', help='Skip Git operations') +@cli.argument('--skip-all', arg_only=True, action='store_true', help='Use placeholder values for all defines (implies --skip-git)') +@cli.subcommand('Used by the make system to generate version.h for use in code', hidden=True) +def generate_version_h(cli): + """Generates the version.h file. + """ + if cli.args.skip_all: + cli.args.skip_git = True + + version_h = create_version_h(cli.args.skip_git, cli.args.skip_all) + + if cli.args.output: + cli.args.output.write_text(version_h) + + if not cli.args.quiet: + cli.log.info('Wrote version.h to %s.', cli.args.output) + else: + print(version_h) diff --git a/lib/python/qmk/cli/info.py b/lib/python/qmk/cli/info.py index 0d08d242cd..3131d4b53f 100755 --- a/lib/python/qmk/cli/info.py +++ b/lib/python/qmk/cli/info.py @@ -24,19 +24,15 @@ def show_keymap(kb_info_json, title_caps=True): keymap_path = locate_keymap(cli.config.info.keyboard, cli.config.info.keymap) if keymap_path and keymap_path.suffix == '.json': - if title_caps: - cli.echo('{fg_blue}Keymap "%s"{fg_reset}:', cli.config.info.keymap) - else: - cli.echo('{fg_blue}keymap_%s{fg_reset}:', cli.config.info.keymap) - keymap_data = json.load(keymap_path.open(encoding='utf-8')) layout_name = keymap_data['layout'] + layout_name = kb_info_json.get('layout_aliases', {}).get(layout_name, layout_name) # Resolve alias names for layer_num, layer in enumerate(keymap_data['layers']): if title_caps: - cli.echo('{fg_cyan}Layer %s{fg_reset}:', layer_num) + cli.echo('{fg_cyan}Keymap %s Layer %s{fg_reset}:', cli.config.info.keymap, layer_num) else: - cli.echo('{fg_cyan}layer_%s{fg_reset}:', layer_num) + cli.echo('{fg_cyan}keymap.%s.layer.%s{fg_reset}:', cli.config.info.keymap, layer_num) print(render_layout(kb_info_json['layouts'][layout_name]['layout'], cli.config.info.ascii, layer)) @@ -45,7 +41,7 @@ def show_layouts(kb_info_json, title_caps=True): """Render the layouts with info.json labels. """ for layout_name, layout_art in render_layouts(kb_info_json, cli.config.info.ascii).items(): - title = layout_name.title() if title_caps else layout_name + title = f'Layout {layout_name.title()}' if title_caps else f'layouts.{layout_name}' cli.echo('{fg_cyan}%s{fg_reset}:', title) print(layout_art) # Avoid passing dirty data to cli.echo() @@ -87,23 +83,12 @@ def print_friendly_output(kb_info_json): cli.echo('{fg_blue}Maintainer{fg_reset}: %s', kb_info_json['maintainer']) cli.echo('{fg_blue}Keyboard Folder{fg_reset}: %s', kb_info_json.get('keyboard_folder', 'Unknown')) cli.echo('{fg_blue}Layouts{fg_reset}: %s', ', '.join(sorted(kb_info_json['layouts'].keys()))) - if 'width' in kb_info_json and 'height' in kb_info_json: - cli.echo('{fg_blue}Size{fg_reset}: %s x %s' % (kb_info_json['width'], kb_info_json['height'])) cli.echo('{fg_blue}Processor{fg_reset}: %s', kb_info_json.get('processor', 'Unknown')) cli.echo('{fg_blue}Bootloader{fg_reset}: %s', kb_info_json.get('bootloader', 'Unknown')) if 'layout_aliases' in kb_info_json: aliases = [f'{key}={value}' for key, value in kb_info_json['layout_aliases'].items()] cli.echo('{fg_blue}Layout aliases:{fg_reset} %s' % (', '.join(aliases),)) - if cli.config.info.layouts: - show_layouts(kb_info_json, True) - - if cli.config.info.matrix: - show_matrix(kb_info_json, True) - - if cli.config_source.info.keymap and cli.config_source.info.keymap != 'config_file': - show_keymap(kb_info_json, True) - def print_text_output(kb_info_json): """Print the info.json in a plain text format. @@ -124,6 +109,24 @@ def print_text_output(kb_info_json): show_keymap(kb_info_json, False) +def print_dotted_output(kb_info_json, prefix=''): + """Print the info.json in a plain text format with dot-joined keys. + """ + for key in sorted(kb_info_json): + new_prefix = f'{prefix}.{key}' if prefix else key + + if key in ['parse_errors', 'parse_warnings']: + continue + elif key == 'layouts' and prefix == '': + cli.echo('{fg_blue}layouts{fg_reset}: %s', ', '.join(sorted(kb_info_json['layouts'].keys()))) + elif isinstance(kb_info_json[key], dict): + print_dotted_output(kb_info_json[key], new_prefix) + elif isinstance(kb_info_json[key], list): + cli.echo('{fg_blue}%s{fg_reset}: %s', new_prefix, ', '.join(map(str, sorted(kb_info_json[key])))) + else: + cli.echo('{fg_blue}%s{fg_reset}: %s', new_prefix, kb_info_json[key]) + + def print_parsed_rules_mk(keyboard_name): rules = rules_mk(keyboard_name) for k in sorted(rules.keys()): @@ -164,10 +167,22 @@ def info(cli): # Output in the requested format if cli.args.format == 'json': print(json.dumps(kb_info_json, cls=InfoJSONEncoder)) + return True elif cli.args.format == 'text': - print_text_output(kb_info_json) + print_dotted_output(kb_info_json) + title_caps = False elif cli.args.format == 'friendly': print_friendly_output(kb_info_json) + title_caps = True else: cli.log.error('Unknown format: %s', cli.args.format) return False + + 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': + show_keymap(kb_info_json, title_caps) diff --git a/lib/python/qmk/cli/kle2json.py b/lib/python/qmk/cli/kle2json.py index acb75ef4fd..bbfddf4268 100755 --- a/lib/python/qmk/cli/kle2json.py +++ b/lib/python/qmk/cli/kle2json.py @@ -44,8 +44,6 @@ def kle2json(cli): 'keyboard_name': kle.name, 'url': '', 'maintainer': 'qmk', - 'width': kle.columns, - 'height': kle.rows, 'layouts': { 'LAYOUT': { 'layout': kle2qmk(kle) diff --git a/lib/python/qmk/cli/lint.py b/lib/python/qmk/cli/lint.py index a164dba632..02b31fbc41 100644 --- a/lib/python/qmk/cli/lint.py +++ b/lib/python/qmk/cli/lint.py @@ -4,7 +4,7 @@ from milc import cli from qmk.decorators import automagic_keyboard, automagic_keymap from qmk.info import info_json -from qmk.keyboard import keyboard_completer +from qmk.keyboard import find_readme, keyboard_completer from qmk.keymap import locate_keymap from qmk.path import is_keyboard, keyboard @@ -31,7 +31,8 @@ def lint(cli): ok = True keyboard_path = keyboard(cli.config.lint.keyboard) keyboard_info = info_json(cli.config.lint.keyboard) - readme_path = keyboard_path / 'readme.md' + readme_path = find_readme(cli.config.lint.keyboard) + missing_readme_path = keyboard_path / 'readme.md' # Check for errors in the info.json if keyboard_info['parse_errors']: @@ -43,9 +44,9 @@ def lint(cli): cli.log.error('Warnings found when generating info.json (Strict mode enabled.)') # Check for a readme.md and warn if it doesn't exist - if not readme_path.exists(): + if not readme_path: ok = False - cli.log.error('Missing %s', readme_path) + cli.log.error('Missing %s', missing_readme_path) # Keymap specific checks if cli.config.lint.keymap: diff --git a/lib/python/qmk/cli/list/layouts.py b/lib/python/qmk/cli/list/layouts.py new file mode 100644 index 0000000000..8e07afeeca --- /dev/null +++ b/lib/python/qmk/cli/list/layouts.py @@ -0,0 +1,18 @@ +"""List the keymaps for a specific keyboard +""" +from milc import cli + +from qmk.decorators import automagic_keyboard +from qmk.keyboard import keyboard_completer, keyboard_folder +from qmk.info import info_json + + +@cli.argument("-kb", "--keyboard", type=keyboard_folder, completer=keyboard_completer, help="Specify keyboard name. Example: monarch") +@cli.subcommand("List the layouts for a specific keyboard") +@automagic_keyboard +def list_layouts(cli): + """List the layouts for a specific keyboard + """ + info_data = info_json(cli.config.list_layouts.keyboard) + for name in sorted(info_data.get('community_layouts', [])): + print(name) diff --git a/lib/python/qmk/cli/multibuild.py b/lib/python/qmk/cli/multibuild.py index bdb0b493c8..85ed0fa1e9 100755 --- a/lib/python/qmk/cli/multibuild.py +++ b/lib/python/qmk/cli/multibuild.py @@ -10,7 +10,7 @@ from subprocess import DEVNULL from milc import cli from qmk.constants import QMK_FIRMWARE -from qmk.commands import _find_make +from qmk.commands import _find_make, get_make_parallel_args import qmk.keyboard import qmk.keymap @@ -28,7 +28,7 @@ def _is_split(keyboard_name): return True if 'SPLIT_KEYBOARD' in rules_mk and rules_mk['SPLIT_KEYBOARD'].lower() == 'yes' else False -@cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs to run.") +@cli.argument('-j', '--parallel', type=int, default=1, help="Set the number of parallel make jobs; 0 means unlimited.") @cli.argument('-c', '--clean', arg_only=True, action='store_true', help="Remove object files before compiling.") @cli.argument('-f', '--filter', arg_only=True, action='append', default=[], help="Filter the list of keyboards based on the supplied value in rules.mk. Supported format is 'SPLIT_KEYBOARD=yes'. May be passed multiple times.") @cli.argument('-km', '--keymap', type=str, default='default', help="The keymap name to build. Default is 'default'.") @@ -80,7 +80,7 @@ all: {keyboard_safe}_binary ) # yapf: enable - cli.run([make_cmd, '-j', str(cli.args.parallel), '-f', makefile.as_posix(), 'all'], capture_output=False, stdin=DEVNULL) + cli.run([make_cmd, *get_make_parallel_args(cli.args.parallel), '-f', makefile.as_posix(), 'all'], capture_output=False, stdin=DEVNULL) # Check for failures failures = [f for f in builddir.glob(f'failed.log.{os.getpid()}.*')] diff --git a/lib/python/qmk/cli/new/keyboard.py b/lib/python/qmk/cli/new/keyboard.py index ae4445ca48..369d2bd7da 100644 --- a/lib/python/qmk/cli/new/keyboard.py +++ b/lib/python/qmk/cli/new/keyboard.py @@ -1,11 +1,142 @@ -"""This script automates the creation of keyboards. +"""This script automates the creation of new keyboard directories using a starter template. """ +from datetime import date +import fileinput +from pathlib import Path +import re +import shutil + +from qmk.commands import git_get_username +import qmk.path from milc import cli +from milc.questions import choice, question + +KEYBOARD_TYPES = ['avr', 'ps2avrgb'] + + +def keyboard_name(name): + """Callable for argparse validation. + """ + if not validate_keyboard_name(name): + raise ValueError + return name -@cli.subcommand('Creates a new keyboard') +def validate_keyboard_name(name): + """Returns True if the given keyboard name contains only lowercase a-z, 0-9 and underscore characters. + """ + regex = re.compile(r'^[a-z0-9][a-z0-9/_]+$') + return bool(regex.match(name)) + + +@cli.argument('-kb', '--keyboard', help='Specify the name for the new keyboard directory', arg_only=True, type=keyboard_name) +@cli.argument('-t', '--type', help='Specify the keyboard type', arg_only=True, choices=KEYBOARD_TYPES) +@cli.argument('-u', '--username', help='Specify your username (default from Git config)', arg_only=True) +@cli.subcommand('Creates a new keyboard directory') def new_keyboard(cli): - """Creates a new keyboard + """Creates a new keyboard. """ - # TODO: replace this bodge to the existing script - cli.run(['util/new_keyboard.sh'], stdin=None, capture_output=False) + cli.log.info('{style_bright}Generating a new QMK keyboard directory{style_normal}') + cli.echo('') + + # Get keyboard name + new_keyboard_name = None + while not new_keyboard_name: + new_keyboard_name = cli.args.keyboard if cli.args.keyboard else question('Keyboard Name:') + if not validate_keyboard_name(new_keyboard_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.') + + # Exit if passed by arg + if cli.args.keyboard: + return False + + new_keyboard_name = None + continue + + keyboard_path = qmk.path.keyboard(new_keyboard_name) + if keyboard_path.exists(): + cli.log.error(f'Keyboard {{fg_cyan}}{new_keyboard_name}{{fg_reset}} already exists! Please choose a different name.') + + # Exit if passed by arg + if cli.args.keyboard: + return False + + new_keyboard_name = None + + # Get keyboard type + keyboard_type = cli.args.type if cli.args.type else choice('Keyboard Type:', KEYBOARD_TYPES, default=0) + + # Get username + user_name = None + while not user_name: + user_name = question('Your Name:', default=find_user_name()) + + if not user_name: + cli.log.error('You didn\'t provide a username, and we couldn\'t find one set in your QMK or Git configs. Please try again.') + + # Exit if passed by arg + if cli.args.username: + return False + + # Copy all the files + copy_templates(keyboard_type, keyboard_path) + + # Replace all the placeholders + keyboard_basename = keyboard_path.name + replacements = [ + ('%YEAR%', str(date.today().year)), + ('%KEYBOARD%', keyboard_basename), + ('%YOUR_NAME%', user_name), + ] + filenames = [ + keyboard_path / 'config.h', + keyboard_path / 'info.json', + keyboard_path / 'readme.md', + keyboard_path / f'{keyboard_basename}.c', + keyboard_path / f'{keyboard_basename}.h', + keyboard_path / 'keymaps/default/readme.md', + keyboard_path / 'keymaps/default/keymap.c', + ] + replace_placeholders(replacements, filenames) + + cli.echo('') + cli.log.info(f'{{fg_green}}Created a new keyboard called {{fg_cyan}}{new_keyboard_name}{{fg_green}}.{{fg_reset}}') + cli.log.info(f'To start working on things, `cd` into {{fg_cyan}}{keyboard_path}{{fg_reset}},') + cli.log.info('or open the directory in your preferred text editor.') + + +def find_user_name(): + if cli.args.username: + return cli.args.username + elif cli.config.user.name: + return cli.config.user.name + else: + return git_get_username() + + +def copy_templates(keyboard_type, keyboard_path): + """Copies the template files from data/templates to the new keyboard directory. + """ + template_base_path = Path('data/templates') + keyboard_basename = keyboard_path.name + + cli.log.info('Copying base template files...') + shutil.copytree(template_base_path / 'base', keyboard_path) + + cli.log.info(f'Copying {{fg_cyan}}{keyboard_type}{{fg_reset}} template files...') + shutil.copytree(template_base_path / keyboard_type, keyboard_path, dirs_exist_ok=True) + + cli.log.info(f'Renaming {{fg_cyan}}keyboard.[ch]{{fg_reset}} to {{fg_cyan}}{keyboard_basename}.[ch]{{fg_reset}}...') + shutil.move(keyboard_path / 'keyboard.c', keyboard_path / f'{keyboard_basename}.c') + shutil.move(keyboard_path / 'keyboard.h', keyboard_path / f'{keyboard_basename}.h') + + +def replace_placeholders(replacements, filenames): + """Replaces the given placeholders in each template file. + """ + for replacement in replacements: + cli.log.info(f'Replacing {{fg_cyan}}{replacement[0]}{{fg_reset}} with {{fg_cyan}}{replacement[1]}{{fg_reset}}...') + + with fileinput.input(files=filenames, inplace=True) as file: + for line in file: + print(line.replace(replacement[0], replacement[1]), end='') diff --git a/lib/python/qmk/cli/pyformat.py b/lib/python/qmk/cli/pyformat.py index abe5f6de19..c624f74aeb 100755 --- a/lib/python/qmk/cli/pyformat.py +++ b/lib/python/qmk/cli/pyformat.py @@ -1,26 +1,24 @@ -"""Format python code according to QMK's style. +"""Point people to the new command name. """ -from subprocess import CalledProcessError, DEVNULL +import sys +from pathlib import Path from milc import cli -@cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Flag only, don't automatically format.") -@cli.subcommand("Format python code according to QMK's style.", hidden=False if cli.config.user.developer else True) +@cli.argument('-n', '--dry-run', arg_only=True, action='store_true', help="Don't actually format.") +@cli.subcommand('Pointer to the new command name: qmk format-python.', hidden=False if cli.config.user.developer else True) def pyformat(cli): - """Format python code according to QMK's style. + """Pointer to the new command name: qmk format-python. """ - edit = '--diff' if cli.args.dry_run else '--in-place' - yapf_cmd = ['yapf', '-vv', '--recursive', edit, 'bin/qmk', 'lib/python'] - try: - cli.run(yapf_cmd, check=True, capture_output=False, stdin=DEVNULL) - cli.log.info('Python code in `bin/qmk` and `lib/python` is correctly formatted.') - return True + cli.log.warning('"qmk pyformat" has been renamed to "qmk format-python". Please use the new command in the future.') + argv = [sys.executable, *sys.argv] + argv[argv.index('pyformat')] = 'format-python' + script_path = Path(argv[1]) + script_path_exe = Path(f'{argv[1]}.exe') - except CalledProcessError: - if cli.args.dry_run: - cli.log.error('Python code in `bin/qmk` and `lib/python` incorrectly formatted!') - else: - cli.log.error('Error formatting python code!') + if not script_path.exists() and script_path_exe.exists(): + # For reasons I don't understand ".exe" is stripped from the script name on windows. + argv[1] = str(script_path_exe) - return False + return cli.run(argv, capture_output=False).returncode diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py index 3a35c11031..421453d837 100644 --- a/lib/python/qmk/commands.py +++ b/lib/python/qmk/commands.py @@ -2,6 +2,7 @@ """ import json import os +import sys import shutil from pathlib import Path from subprocess import DEVNULL @@ -10,7 +11,7 @@ from time import strftime from milc import cli import qmk.keymap -from qmk.constants import KEYBOARD_OUTPUT_PREFIX +from qmk.constants import QMK_FIRMWARE, KEYBOARD_OUTPUT_PREFIX from qmk.json_schema import json_load time_fmt = '%Y-%m-%d-%H:%M:%S' @@ -51,7 +52,7 @@ def create_make_target(target, parallel=1, **env_vars): for key, value in env_vars.items(): env.append(f'{key}={value}') - return [make_cmd, '-j', str(parallel), *env, target] + return [make_cmd, *get_make_parallel_args(parallel), *env, target] def create_make_command(keyboard, keymap, target=None, parallel=1, **env_vars): @@ -86,11 +87,17 @@ def create_make_command(keyboard, keymap, target=None, parallel=1, **env_vars): return create_make_target(':'.join(make_args), parallel, **env_vars) -def get_git_version(repo_dir='.', check_dir='.'): +def get_git_version(current_time, repo_dir='.', check_dir='.'): """Returns the current git version for a repo, or the current time. """ git_describe_cmd = ['git', 'describe', '--abbrev=6', '--dirty', '--always', '--tags'] + if repo_dir != '.': + repo_dir = Path('lib') / repo_dir + + if check_dir != '.': + check_dir = repo_dir / check_dir + if Path(check_dir).exists(): git_describe = cli.run(git_describe_cmd, stdin=DEVNULL, cwd=repo_dir) @@ -100,23 +107,58 @@ def get_git_version(repo_dir='.', check_dir='.'): else: cli.log.warn(f'"{" ".join(git_describe_cmd)}" returned error code {git_describe.returncode}') print(git_describe.stderr) - return strftime(time_fmt) + return current_time + + return current_time + + +def get_make_parallel_args(parallel=1): + """Returns the arguments for running the specified number of parallel jobs. + """ + parallel_args = [] + + if int(parallel) <= 0: + # 0 or -1 means -j without argument (unlimited jobs) + parallel_args.append('--jobs') + else: + parallel_args.append('--jobs=' + str(parallel)) + + if int(parallel) != 1: + # If more than 1 job is used, synchronize parallel output by target + parallel_args.append('--output-sync=target') - return strftime(time_fmt) + return parallel_args -def write_version_h(git_version, build_date, chibios_version, chibios_contrib_version): - """Generate and write quantum/version.h +def create_version_h(skip_git=False, skip_all=False): + """Generate version.h contents """ - version_h = [ - f'#define QMK_VERSION "{git_version}"', - f'#define QMK_BUILDDATE "{build_date}"', - f'#define CHIBIOS_VERSION "{chibios_version}"', - f'#define CHIBIOS_CONTRIB_VERSION "{chibios_contrib_version}"', - ] + if skip_all: + current_time = "1970-01-01-00:00:00" + else: + current_time = strftime(time_fmt) + + if skip_git: + git_version = "NA" + chibios_version = "NA" + chibios_contrib_version = "NA" + else: + git_version = get_git_version(current_time) + chibios_version = get_git_version(current_time, "chibios", "os") + chibios_contrib_version = get_git_version(current_time, "chibios-contrib", "os") + + version_h_lines = f"""/* This file was automatically generated. Do not edit or copy. + */ + +#pragma once + +#define QMK_VERSION "{git_version}" +#define QMK_BUILDDATE "{current_time}" +#define CHIBIOS_VERSION "{chibios_version}" +#define CHIBIOS_CONTRIB_VERSION "{chibios_contrib_version}" +""" - version_h_file = Path('quantum/version.h') - version_h_file.write_text('\n'.join(version_h)) + return version_h_lines def compile_configurator_json(user_keymap, bootloader=None, parallel=1, **env_vars): @@ -149,13 +191,8 @@ def compile_configurator_json(user_keymap, bootloader=None, parallel=1, **env_va keymap_dir.mkdir(exist_ok=True, parents=True) keymap_c.write_text(c_text) - # Write the version.h file - git_version = get_git_version() - build_date = strftime('%Y-%m-%d-%H:%M:%S') - chibios_version = get_git_version("lib/chibios", "lib/chibios/os") - chibios_contrib_version = get_git_version("lib/chibios-contrib", "lib/chibios-contrib/os") - - write_version_h(git_version, build_date, chibios_version, chibios_contrib_version) + version_h = Path('quantum/version.h') + version_h.write_text(create_version_h()) # Return a command that can be run to make the keymap and flash if given verbose = 'true' if cli.config.general.verbose else 'false' @@ -166,8 +203,7 @@ def compile_configurator_json(user_keymap, bootloader=None, parallel=1, **env_va make_command.append('-s') make_command.extend([ - '-j', - str(parallel), + *get_make_parallel_args(parallel), '-r', '-R', '-f', @@ -181,10 +217,6 @@ def compile_configurator_json(user_keymap, bootloader=None, parallel=1, **env_va make_command.append(f'{key}={value}') make_command.extend([ - f'GIT_VERSION={git_version}', - f'BUILD_DATE={build_date}', - f'CHIBIOS_VERSION={chibios_version}', - f'CHIBIOS_CONTRIB_VERSION={chibios_contrib_version}', f'KEYBOARD={user_keymap["keyboard"]}', f'KEYMAP={user_keymap["keymap"]}', f'KEYBOARD_FILESAFE={keyboard_filesafe}', @@ -223,3 +255,80 @@ def parse_configurator_json(configurator_file): user_keymap['layout'] = aliases[orig_keyboard]['layouts'][user_keymap['layout']] return user_keymap + + +def git_get_username(): + """Retrieves user's username from Git config, if set. + """ + git_username = cli.run(['git', 'config', '--get', 'user.name']) + + if git_username.returncode == 0 and git_username.stdout: + return git_username.stdout.strip() + + +def git_check_repo(): + """Checks that the .git directory exists inside QMK_HOME. + + This is a decent enough indicator that the qmk_firmware directory is a + proper Git repository, rather than a .zip download from GitHub. + """ + dot_git_dir = QMK_FIRMWARE / '.git' + + return dot_git_dir.is_dir() + + +def git_get_branch(): + """Returns the current branch for a repo, or None. + """ + git_branch = cli.run(['git', 'branch', '--show-current']) + if not git_branch.returncode != 0 or not git_branch.stdout: + # Workaround for Git pre-2.22 + git_branch = cli.run(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) + + if git_branch.returncode == 0: + return git_branch.stdout.strip() + + +def git_is_dirty(): + """Returns 1 if repo is dirty, or 0 if clean + """ + git_diff_staged_cmd = ['git', 'diff', '--quiet'] + git_diff_unstaged_cmd = [*git_diff_staged_cmd, '--cached'] + + unstaged = cli.run(git_diff_staged_cmd) + staged = cli.run(git_diff_unstaged_cmd) + + return unstaged.returncode != 0 or staged.returncode != 0 + + +def git_get_remotes(): + """Returns the current remotes for a repo. + """ + remotes = {} + + git_remote_show_cmd = ['git', 'remote', 'show'] + git_remote_get_cmd = ['git', 'remote', 'get-url'] + + git_remote_show = cli.run(git_remote_show_cmd) + if git_remote_show.returncode == 0: + for name in git_remote_show.stdout.splitlines(): + git_remote_name = cli.run([*git_remote_get_cmd, name]) + remotes[name.strip()] = {"url": git_remote_name.stdout.strip()} + + return remotes + + +def git_check_deviation(active_branch): + """Return True if branch has custom commits + """ + cli.run(['git', 'fetch', 'upstream', active_branch]) + deviations = cli.run(['git', '--no-pager', 'log', f'upstream/{active_branch}...{active_branch}']) + return bool(deviations.returncode) + + +def in_virtualenv(): + """Check if running inside a virtualenv. + Based on https://stackoverflow.com/a/1883251 + """ + active_prefix = getattr(sys, "base_prefix", None) or getattr(sys, "real_prefix", None) or sys.prefix + return active_prefix != sys.prefix diff --git a/lib/python/qmk/constants.py b/lib/python/qmk/constants.py index 49e5e0eb42..71a6c91c77 100644 --- a/lib/python/qmk/constants.py +++ b/lib/python/qmk/constants.py @@ -6,11 +6,14 @@ from pathlib import Path # The root of the qmk_firmware tree. QMK_FIRMWARE = Path.cwd() +# Upstream repo url +QMK_FIRMWARE_UPSTREAM = 'qmk/qmk_firmware' + # This is the number of directories under `qmk_firmware/keyboards` that will be traversed. This is currently a limitation of our make system. MAX_KEYBOARD_SUBFOLDERS = 5 # Supported processor types -CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK66F18', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32L433', 'STM32L443' +CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK66F18', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32L412', 'STM32L422', 'STM32L433', 'STM32L443' LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85' diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 47c8bff7a8..1b4c42ff41 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -9,7 +9,7 @@ from milc import cli from qmk.constants import CHIBIOS_PROCESSORS, LUFA_PROCESSORS, VUSB_PROCESSORS from qmk.c_parse import find_layouts -from qmk.json_schema import deep_update, json_load, keyboard_validate, keyboard_api_validate +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.makefile import parse_rules_mk_file @@ -29,10 +29,10 @@ def info_json(keyboard): """Generate the info.json data for a specific keyboard. """ cur_dir = Path('keyboards') - rules = parse_rules_mk_file(cur_dir / keyboard / 'rules.mk') - if 'DEFAULT_FOLDER' in rules: - keyboard = rules['DEFAULT_FOLDER'] - rules = parse_rules_mk_file(cur_dir / keyboard / 'rules.mk', rules) + root_rules_mk = parse_rules_mk_file(cur_dir / keyboard / 'rules.mk') + + if 'DEFAULT_FOLDER' in root_rules_mk: + keyboard = root_rules_mk['DEFAULT_FOLDER'] info_data = { 'keyboard_name': str(keyboard), @@ -49,7 +49,7 @@ def info_json(keyboard): info_data['keymaps'][keymap.name] = {'url': f'https://raw.githubusercontent.com/qmk/qmk_firmware/master/{keymap}/keymap.json'} # Populate layout data - layouts, aliases = _find_all_layouts(info_data, keyboard) + layouts, aliases = _search_keyboard_h(keyboard) if aliases: info_data['layout_aliases'] = aliases @@ -61,20 +61,26 @@ 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_config_h(info_data) info_data = _extract_rules_mk(info_data) + info_data = _extract_config_h(info_data) + + # Ensure that we have matrix row and column counts + info_data = _matrix_size(info_data) # Validate against the jsonschema try: - keyboard_api_validate(info_data) + validate(info_data, 'qmk.api.keyboard.v1') except jsonschema.ValidationError as e: json_path = '.'.join([str(p) for p in e.absolute_path]) cli.log.error('Invalid API data: %s: %s: %s', keyboard, json_path, e.message) - exit() + exit(1) # Make sure we have at least one layout if not info_data.get('layouts'): + _find_missing_layouts(info_data, keyboard) + + if not info_data.get('layouts'): _log_error(info_data, 'No LAYOUTs defined! Need at least one layout defined in the keyboard.h or info.json.') # Filter out any non-existing community layouts @@ -90,6 +96,9 @@ def info_json(keyboard): if layout_name not in info_data.get('layouts', {}) and layout_name not in info_data.get('layout_aliases', {}): _log_error(info_data, 'Claims to support community layout %s but no %s() macro found' % (layout, layout_name)) + # Check that the reported matrix size is consistent with the actual matrix size + _check_matrix(info_data) + return info_data @@ -143,10 +152,7 @@ def _pin_name(pin): elif pin == 'NO_PIN': return None - elif pin[0] in 'ABCDEFGHIJK' and pin[1].isdigit(): - return pin - - raise ValueError(f'Invalid pin: {pin}') + return pin def _extract_pins(pins): @@ -155,10 +161,9 @@ def _extract_pins(pins): return [_pin_name(pin) for pin in pins.split(',')] -def _extract_direct_matrix(info_data, direct_pins): +def _extract_direct_matrix(direct_pins): """ """ - info_data['matrix_pins'] = {} direct_pin_array = [] while direct_pins[-1] != '}': @@ -182,12 +187,157 @@ def _extract_direct_matrix(info_data, direct_pins): return direct_pin_array +def _extract_audio(info_data, config_c): + """Populate data about the audio configuration + """ + audio_pins = [] + + for pin in 'B5', 'B6', 'B7', 'C4', 'C5', 'C6': + if config_c.get(f'{pin}_AUDIO'): + audio_pins.append(pin) + + if audio_pins: + info_data['audio'] = {'pins': audio_pins} + + +def _extract_split_main(info_data, config_c): + """Populate data about the split configuration + """ + # Figure out how the main half is determined + if config_c.get('SPLIT_HAND_PIN') is True: + if 'split' not in info_data: + info_data['split'] = {} + + if 'main' in info_data['split']: + _log_warning(info_data, 'Split main hand is specified in both config.h (SPLIT_HAND_PIN) and info.json (split.main) (Value: %s), the config.h value wins.' % info_data['split']['main']) + + info_data['split']['main'] = 'pin' + + if config_c.get('SPLIT_HAND_MATRIX_GRID'): + if 'split' not in info_data: + info_data['split'] = {} + + if 'main' in info_data['split']: + _log_warning(info_data, 'Split main hand is specified in both config.h (SPLIT_HAND_MATRIX_GRID) and info.json (split.main) (Value: %s), the config.h value wins.' % info_data['split']['main']) + + info_data['split']['main'] = 'matrix_grid' + info_data['split']['matrix_grid'] = _extract_pins(config_c['SPLIT_HAND_MATRIX_GRID']) + + if config_c.get('EE_HANDS') is True: + if 'split' not in info_data: + info_data['split'] = {} + + if 'main' in info_data['split']: + _log_warning(info_data, 'Split main hand is specified in both config.h (EE_HANDS) and info.json (split.main) (Value: %s), the config.h value wins.' % info_data['split']['main']) + + info_data['split']['main'] = 'eeprom' + + if config_c.get('MASTER_RIGHT') is True: + if 'split' not in info_data: + info_data['split'] = {} + + if 'main' in info_data['split']: + _log_warning(info_data, 'Split main hand is specified in both config.h (MASTER_RIGHT) and info.json (split.main) (Value: %s), the config.h value wins.' % info_data['split']['main']) + + info_data['split']['main'] = 'right' + + if config_c.get('MASTER_LEFT') is True: + if 'split' not in info_data: + info_data['split'] = {} + + if 'main' in info_data['split']: + _log_warning(info_data, 'Split main hand is specified in both config.h (MASTER_LEFT) and info.json (split.main) (Value: %s), the config.h value wins.' % info_data['split']['main']) + + info_data['split']['main'] = 'left' + + +def _extract_split_transport(info_data, config_c): + # Figure out the transport method + if config_c.get('USE_I2C') is True: + if 'split' not in info_data: + info_data['split'] = {} + + if 'transport' not in info_data['split']: + info_data['split']['transport'] = {} + + if 'protocol' in info_data['split']['transport']: + _log_warning(info_data, 'Split transport is specified in both config.h (USE_I2C) and info.json (split.transport.protocol) (Value: %s), the config.h value wins.' % info_data['split']['transport']) + + info_data['split']['transport']['protocol'] = 'i2c' + + elif 'protocol' not in info_data.get('split', {}).get('transport', {}): + 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' + + +def _extract_split_right_pins(info_data, config_c): + # Figure out the right half matrix pins + row_pins = config_c.get('MATRIX_ROW_PINS_RIGHT', '').replace('{', '').replace('}', '').strip() + col_pins = config_c.get('MATRIX_COL_PINS_RIGHT', '').replace('{', '').replace('}', '').strip() + unused_pin_text = config_c.get('UNUSED_PINS_RIGHT') + unused_pins = unused_pin_text.replace('{', '').replace('}', '').strip() if isinstance(unused_pin_text, str) else None + direct_pins = config_c.get('DIRECT_PINS_RIGHT', '').replace(' ', '')[1:-1] + + if row_pins and col_pins: + if info_data.get('split', {}).get('matrix_pins', {}).get('right') in info_data: + _log_warning(info_data, 'Right hand matrix data is specified in both info.json and config.h, the config.h values win.') + + if 'split' not in info_data: + info_data['split'] = {} + + if 'matrix_pins' not in info_data['split']: + info_data['split']['matrix_pins'] = {} + + if 'right' not in info_data['split']['matrix_pins']: + info_data['split']['matrix_pins']['right'] = {} + + info_data['split']['matrix_pins']['right'] = { + 'cols': _extract_pins(col_pins), + 'rows': _extract_pins(row_pins), + } + + if direct_pins: + if info_data.get('split', {}).get('matrix_pins', {}).get('right', {}): + _log_warning(info_data, 'Right hand matrix data is specified in both info.json and config.h, the config.h values win.') + + if 'split' not in info_data: + info_data['split'] = {} + + if 'matrix_pins' not in info_data['split']: + info_data['split']['matrix_pins'] = {} + + if 'right' not in info_data['split']['matrix_pins']: + info_data['split']['matrix_pins']['right'] = {} + + info_data['split']['matrix_pins']['right']['direct'] = _extract_direct_matrix(direct_pins) + + if unused_pins: + if 'split' not in info_data: + info_data['split'] = {} + + if 'matrix_pins' not in info_data['split']: + info_data['split']['matrix_pins'] = {} + + if 'right' not in info_data['split']['matrix_pins']: + info_data['split']['matrix_pins']['right'] = {} + + info_data['split']['matrix_pins']['right']['unused'] = _extract_pins(unused_pins) + + def _extract_matrix_info(info_data, config_c): """Populate the matrix information. """ row_pins = config_c.get('MATRIX_ROW_PINS', '').replace('{', '').replace('}', '').strip() col_pins = config_c.get('MATRIX_COL_PINS', '').replace('{', '').replace('}', '').strip() + unused_pin_text = config_c.get('UNUSED_PINS') + unused_pins = unused_pin_text.replace('{', '').replace('}', '').strip() if isinstance(unused_pin_text, str) else None direct_pins = config_c.get('DIRECT_PINS', '').replace(' ', '')[1:-1] + info_snippet = {} if 'MATRIX_ROWS' in config_c and 'MATRIX_COLS' in config_c: if 'matrix_size' in info_data: @@ -199,19 +349,35 @@ def _extract_matrix_info(info_data, config_c): } if row_pins and col_pins: - if 'matrix_pins' in info_data: + if 'matrix_pins' in info_data and 'cols' in info_data['matrix_pins'] and 'rows' in info_data['matrix_pins']: _log_warning(info_data, 'Matrix pins are specified in both info.json and config.h, the config.h values win.') - info_data['matrix_pins'] = { - 'cols': _extract_pins(col_pins), - 'rows': _extract_pins(row_pins), - } + info_snippet['cols'] = _extract_pins(col_pins) + info_snippet['rows'] = _extract_pins(row_pins) if direct_pins: - if 'matrix_pins' in info_data: + if 'matrix_pins' in info_data and 'direct' in info_data['matrix_pins']: _log_warning(info_data, 'Direct pins are specified in both info.json and config.h, the config.h values win.') - info_data['matrix_pins']['direct'] = _extract_direct_matrix(info_data, direct_pins) + info_snippet['direct'] = _extract_direct_matrix(direct_pins) + + if unused_pins: + if 'matrix_pins' not in info_data: + info_data['matrix_pins'] = {} + + info_snippet['unused'] = _extract_pins(unused_pins) + + if config_c.get('CUSTOM_MATRIX', 'no') != 'no': + if 'matrix_pins' in info_data and 'custom' in info_data['matrix_pins']: + _log_warning(info_data, 'Custom Matrix is specified in both info.json and config.h, the config.h values win.') + + info_snippet['custom'] = True + + if config_c['CUSTOM_MATRIX'] == 'lite': + info_snippet['custom_lite'] = True + + if info_snippet: + info_data['matrix_pins'] = info_snippet return info_data @@ -269,6 +435,10 @@ 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_split_main(info_data, config_c) + _extract_split_transport(info_data, config_c) + _extract_split_right_pins(info_data, config_c) return info_data @@ -341,45 +511,53 @@ def _extract_rules_mk(info_data): return info_data -def _merge_layouts(info_data, new_info_data): - """Merge new_info_data into info_data in an intelligent way. +def _matrix_size(info_data): + """Add info_data['matrix_size'] if it doesn't exist. """ - for layout_name, layout_json in new_info_data['layouts'].items(): - if layout_name in info_data['layouts']: - # Pull in layouts we have a macro for - if len(info_data['layouts'][layout_name]['layout']) != len(layout_json['layout']): - msg = '%s: %s: Number of elements in info.json does not match! info.json:%s != %s:%s' - _log_error(info_data, msg % (info_data['keyboard_folder'], layout_name, len(layout_json['layout']), layout_name, len(info_data['layouts'][layout_name]['layout']))) - else: - for i, key in enumerate(info_data['layouts'][layout_name]['layout']): - key.update(layout_json['layout'][i]) - else: - # Pull in layouts that have matrix data - missing_matrix = False - for key in layout_json.get('layout', {}): - if 'matrix' not in key: - missing_matrix = True - - if not missing_matrix: - if layout_name in info_data['layouts']: - # Update an existing layout with new data - for i, key in enumerate(info_data['layouts'][layout_name]['layout']): - key.update(layout_json['layout'][i]) + if 'matrix_size' not in info_data and 'matrix_pins' in info_data: + info_data['matrix_size'] = {} - else: - # Copy in the new layout wholesale - layout_json['c_macro'] = False - info_data['layouts'][layout_name] = layout_json + if 'direct' in info_data['matrix_pins']: + info_data['matrix_size']['cols'] = len(info_data['matrix_pins']['direct'][0]) + info_data['matrix_size']['rows'] = len(info_data['matrix_pins']['direct']) + elif 'cols' in info_data['matrix_pins'] and 'rows' in info_data['matrix_pins']: + info_data['matrix_size']['cols'] = len(info_data['matrix_pins']['cols']) + info_data['matrix_size']['rows'] = len(info_data['matrix_pins']['rows']) return info_data -def _search_keyboard_h(path): +def _check_matrix(info_data): + """Check the matrix to ensure that row/column count is consistent. + """ + if 'matrix_pins' in info_data and 'matrix_size' in info_data: + actual_col_count = info_data['matrix_size'].get('cols', 0) + actual_row_count = info_data['matrix_size'].get('rows', 0) + col_count = row_count = 0 + + if 'direct' in info_data['matrix_pins']: + col_count = len(info_data['matrix_pins']['direct'][0]) + row_count = len(info_data['matrix_pins']['direct']) + elif 'cols' in info_data['matrix_pins'] and 'rows' in info_data['matrix_pins']: + col_count = len(info_data['matrix_pins']['cols']) + row_count = len(info_data['matrix_pins']['rows']) + + if col_count != actual_col_count and col_count != (actual_col_count / 2): + # FIXME: once we can we should detect if split is enabled to do the actual_col_count/2 check. + _log_error(info_data, f'MATRIX_COLS is inconsistent with the size of MATRIX_COL_PINS: {col_count} != {actual_col_count}') + + if row_count != actual_row_count and row_count != (actual_row_count / 2): + # FIXME: once we can we should detect if split is enabled to do the actual_row_count/2 check. + _log_error(info_data, f'MATRIX_ROWS is inconsistent with the size of MATRIX_ROW_PINS: {row_count} != {actual_row_count}') + + +def _search_keyboard_h(keyboard): + keyboard = Path(keyboard) current_path = Path('keyboards/') aliases = {} layouts = {} - for directory in path.parts: + for directory in keyboard.parts: current_path = current_path / directory keyboard_h = '%s.h' % (directory,) keyboard_h_path = current_path / keyboard_h @@ -394,27 +572,28 @@ def _search_keyboard_h(path): return layouts, aliases -def _find_all_layouts(info_data, keyboard): - """Looks for layout macros associated with this keyboard. +def _find_missing_layouts(info_data, keyboard): + """Looks for layout macros when they aren't found other places. + + If we don't find any layouts from info.json or keyboard.h we widen our search. This is error prone which is why we want to encourage people to follow the standard above. """ - layouts, aliases = _search_keyboard_h(Path(keyboard)) + _log_warning(info_data, '%s: Falling back to searching for KEYMAP/LAYOUT macros.' % (keyboard)) - if not layouts: - # If we don't find any layouts from info.json or keyboard.h we widen our search. This is error prone which is why we want to encourage people to follow the standard above. - info_data['parse_warnings'].append('%s: Falling back to searching for KEYMAP/LAYOUT macros.' % (keyboard)) + for file in glob('keyboards/%s/*.h' % keyboard): + these_layouts, these_aliases = find_layouts(file) - for file in glob('keyboards/%s/*.h' % keyboard): - if file.endswith('.h'): - these_layouts, these_aliases = find_layouts(file) + if these_layouts: + for layout_name, layout_json in these_layouts.items(): + if not layout_name.startswith('LAYOUT_kc'): + layout_json['c_macro'] = True + info_data['layouts'][layout_name] = layout_json - if these_layouts: - layouts.update(these_layouts) + for alias, alias_text in these_aliases.items(): + if alias_text in these_layouts: + if 'layout_aliases' not in info_data: + info_data['layout_aliases'] = {} - for alias, alias_text in these_aliases.items(): - if alias_text in layouts: - aliases[alias] = alias_text - - return layouts, aliases + info_data['layout_aliases'][alias] = alias_text def _log_error(info_data, message): @@ -493,7 +672,7 @@ def merge_info_jsons(keyboard, info_data): continue try: - keyboard_validate(new_info_data) + validate(new_info_data, 'qmk.keyboard.v1') except jsonschema.ValidationError as e: json_path = '.'.join([str(p) for p in e.absolute_path]) cli.log.error('Not including data from file: %s', info_file) @@ -511,8 +690,12 @@ def merge_info_jsons(keyboard, info_data): layout_name = info_data['layout_aliases'][layout_name] if layout_name in info_data['layouts']: - for new_key, existing_key in zip(layout['layout'], info_data['layouts'][layout_name]['layout']): - existing_key.update(new_key) + if len(info_data['layouts'][layout_name]['layout']) != len(layout['layout']): + msg = '%s: %s: Number of elements in info.json does not match! info.json:%s != %s:%s' + _log_error(info_data, msg % (info_data['keyboard_folder'], layout_name, len(layout['layout']), layout_name, len(info_data['layouts'][layout_name]['layout']))) + else: + for new_key, existing_key in zip(layout['layout'], info_data['layouts'][layout_name]['layout']): + existing_key.update(new_key) else: layout['c_macro'] = False info_data['layouts'][layout_name] = layout diff --git a/lib/python/qmk/json_encoders.py b/lib/python/qmk/json_encoders.py index 9f3da022b4..72e91973a3 100755 --- a/lib/python/qmk/json_encoders.py +++ b/lib/python/qmk/json_encoders.py @@ -102,9 +102,6 @@ class InfoJSONEncoder(QMKJSONEncoder): elif key == 'maintainer': return '12maintainer' - elif key in ('height', 'width'): - return '40' + str(key) - elif key == 'community_layouts': return '97community_layouts' diff --git a/lib/python/qmk/json_schema.py b/lib/python/qmk/json_schema.py index 077dfcaa93..ffc7c6bcd1 100644 --- a/lib/python/qmk/json_schema.py +++ b/lib/python/qmk/json_schema.py @@ -2,6 +2,7 @@ """ import json from collections.abc import Mapping +from functools import lru_cache from pathlib import Path import hjson @@ -17,16 +18,21 @@ def json_load(json_file): try: return hjson.load(json_file.open(encoding='utf-8')) - except json.decoder.JSONDecodeError as e: + except (json.decoder.JSONDecodeError, hjson.HjsonDecodeError) as e: cli.log.error('Invalid JSON encountered attempting to load {fg_cyan}%s{fg_reset}:\n\t{fg_red}%s', json_file, e) exit(1) + except Exception as e: + cli.log.error('Unknown error attempting to load {fg_cyan}%s{fg_reset}:\n\t{fg_red}%s', json_file, e) + exit(1) +@lru_cache(maxsize=0) def load_jsonschema(schema_name): """Read a jsonschema file from disk. - - FIXME(skullydazed/anyone): Refactor to make this a public function. """ + if Path(schema_name).exists(): + return json_load(schema_name) + schema_path = Path(f'data/schemas/{schema_name}.jsonschema') if not schema_path.exists(): @@ -35,28 +41,42 @@ def load_jsonschema(schema_name): return json_load(schema_path) -def keyboard_validate(data): - """Validates data against the keyboard jsonschema. +@lru_cache(maxsize=0) +def compile_schema_store(): + """Compile all our schemas into a schema store. """ - schema = load_jsonschema('keyboard') - validator = jsonschema.Draft7Validator(schema).validate + schema_store = {} - return validator(data) + for schema_file in Path('data/schemas').glob('*.jsonschema'): + schema_data = load_jsonschema(schema_file) + if not isinstance(schema_data, dict): + cli.log.debug('Skipping schema file %s', schema_file) + continue + schema_store[schema_data['$id']] = schema_data + + return schema_store + + +@lru_cache(maxsize=0) +def create_validator(schema): + """Creates a validator for the given schema id. + """ + schema_store = compile_schema_store() + resolver = jsonschema.RefResolver.from_schema(schema_store['qmk.keyboard.v1'], store=schema_store) + + return jsonschema.Draft7Validator(schema_store[schema], resolver=resolver).validate -def keyboard_api_validate(data): - """Validates data against the api_keyboard jsonschema. +def validate(data, schema): + """Validates data against a schema. """ - base = load_jsonschema('keyboard') - relative = load_jsonschema('api_keyboard') - resolver = jsonschema.RefResolver.from_schema(base) - validator = jsonschema.Draft7Validator(relative, resolver=resolver).validate + validator = create_validator(schema) return validator(data) def deep_update(origdict, newdict): - """Update a dictionary in place, recursing to do a deep copy. + """Update a dictionary in place, recursing to do a depth-first deep copy. """ for key, value in newdict.items(): if isinstance(value, Mapping): diff --git a/lib/python/qmk/keyboard.py b/lib/python/qmk/keyboard.py index 06c9df874f..c87ea9050b 100644 --- a/lib/python/qmk/keyboard.py +++ b/lib/python/qmk/keyboard.py @@ -160,7 +160,7 @@ def rules_mk(keyboard): def render_layout(layout_data, render_ascii, key_labels=None): """Renders a single layout. """ - textpad = [array('u', ' ' * 200) for x in range(50)] + textpad = [array('u', ' ' * 200) for x in range(100)] style = 'ascii' if render_ascii else 'unicode' box_chars = BOX_DRAWING_CHARACTERS[style] diff --git a/lib/python/qmk/keymap.py b/lib/python/qmk/keymap.py index 2d5921e7a8..6eec49cfd1 100644 --- a/lib/python/qmk/keymap.py +++ b/lib/python/qmk/keymap.py @@ -149,8 +149,8 @@ def is_keymap_dir(keymap, c=True, json=True, additional_files=None): for file in files: if (keymap / file).is_file(): if additional_files: - for file in additional_files: - if not (keymap / file).is_file(): + for additional_file in additional_files: + if not (keymap / additional_file).is_file(): return False return True diff --git a/lib/python/qmk/tests/minimal_info.json b/lib/python/qmk/tests/minimal_info.json index b91c23bd3d..11ef12fefe 100644 --- a/lib/python/qmk/tests/minimal_info.json +++ b/lib/python/qmk/tests/minimal_info.json @@ -1,8 +1,6 @@ { "keyboard_name": "tester", "maintainer": "qmk", - "height": 5, - "width": 15, "layouts": { "LAYOUT": { "layout": [ diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py index afdbc81429..b39fe5e46d 100644 --- a/lib/python/qmk/tests/test_cli_commands.py +++ b/lib/python/qmk/tests/test_cli_commands.py @@ -31,13 +31,13 @@ def check_returncode(result, expected=[0]): assert result.returncode in expected -def test_cformat(): - result = check_subcommand('cformat', '-n', 'quantum/matrix.c') +def test_format_c(): + result = check_subcommand('format-c', '-n', 'quantum/matrix.c') check_returncode(result) -def test_cformat_all(): - result = check_subcommand('cformat', '-n', '-a') +def test_format_c_all(): + result = check_subcommand('format-c', '-n', '-a') check_returncode(result, [0, 1]) @@ -80,8 +80,8 @@ def test_hello(): assert 'Hello,' in result.stdout -def test_pyformat(): - result = check_subcommand('pyformat', '--dry-run') +def test_format_python(): + result = check_subcommand('format-python', '--dry-run') check_returncode(result) assert 'Python code in `bin/qmk` and `lib/python` is correctly formatted.' in result.stdout @@ -258,6 +258,12 @@ def test_generate_rules_mk(): assert 'MCU ?= atmega32u4' in result.stdout +def test_generate_version_h(): + result = check_subcommand('generate-version-h') + check_returncode(result) + assert '#define QMK_VERSION' in result.stdout + + def test_generate_layouts(): result = check_subcommand('generate-layouts', '-kb', 'handwired/pytest/basic') check_returncode(result) @@ -267,7 +273,7 @@ def test_generate_layouts(): def test_format_json_keyboard(): result = check_subcommand('format-json', '--format', 'keyboard', 'lib/python/qmk/tests/minimal_info.json') check_returncode(result) - assert result.stdout == '{\n "keyboard_name": "tester",\n "maintainer": "qmk",\n "height": 5,\n "width": 15,\n "layouts": {\n "LAYOUT": {\n "layout": [\n { "label": "KC_A", "matrix": [0, 0], "x": 0, "y": 0 }\n ]\n }\n }\n}\n' + assert result.stdout == '{\n "keyboard_name": "tester",\n "maintainer": "qmk",\n "layouts": {\n "LAYOUT": {\n "layout": [\n { "label": "KC_A", "matrix": [0, 0], "x": 0, "y": 0 }\n ]\n }\n }\n}\n' def test_format_json_keymap(): @@ -279,7 +285,7 @@ def test_format_json_keymap(): def test_format_json_keyboard_auto(): result = check_subcommand('format-json', '--format', 'auto', 'lib/python/qmk/tests/minimal_info.json') check_returncode(result) - assert result.stdout == '{\n "keyboard_name": "tester",\n "maintainer": "qmk",\n "height": 5,\n "width": 15,\n "layouts": {\n "LAYOUT": {\n "layout": [\n { "label": "KC_A", "matrix": [0, 0], "x": 0, "y": 0 }\n ]\n }\n }\n}\n' + assert result.stdout == '{\n "keyboard_name": "tester",\n "maintainer": "qmk",\n "layouts": {\n "LAYOUT": {\n "layout": [\n { "label": "KC_A", "matrix": [0, 0], "x": 0, "y": 0 }\n ]\n }\n }\n}\n' def test_format_json_keymap_auto(): diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/.gitattributes b/lib/usbhost/USB_Host_Shield_2.0/.gitattributes index 6238b035a3..6238b035a3 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/.gitattributes +++ b/lib/usbhost/USB_Host_Shield_2.0/.gitattributes diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/.gitignore b/lib/usbhost/USB_Host_Shield_2.0/.gitignore index 7e69f457ba..7e69f457ba 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/.gitignore +++ b/lib/usbhost/USB_Host_Shield_2.0/.gitignore diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/.gitmodules b/lib/usbhost/USB_Host_Shield_2.0/.gitmodules index 32a0783a89..32a0783a89 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/.gitmodules +++ b/lib/usbhost/USB_Host_Shield_2.0/.gitmodules diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/BTD.cpp b/lib/usbhost/USB_Host_Shield_2.0/BTD.cpp index bcfba14b2b..bcfba14b2b 100755..100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/BTD.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/BTD.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/BTD.h b/lib/usbhost/USB_Host_Shield_2.0/BTD.h index 6549c30c98..6549c30c98 100755..100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/BTD.h +++ b/lib/usbhost/USB_Host_Shield_2.0/BTD.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/BTHID.cpp b/lib/usbhost/USB_Host_Shield_2.0/BTHID.cpp index bfa9202c39..bfa9202c39 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/BTHID.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/BTHID.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/BTHID.h b/lib/usbhost/USB_Host_Shield_2.0/BTHID.h index 1a7d8687c7..1a7d8687c7 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/BTHID.h +++ b/lib/usbhost/USB_Host_Shield_2.0/BTHID.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3BT.cpp b/lib/usbhost/USB_Host_Shield_2.0/PS3BT.cpp index 235092e0ac..235092e0ac 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3BT.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/PS3BT.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3BT.h b/lib/usbhost/USB_Host_Shield_2.0/PS3BT.h index c25ac5e59d..c25ac5e59d 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3BT.h +++ b/lib/usbhost/USB_Host_Shield_2.0/PS3BT.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3Enums.h b/lib/usbhost/USB_Host_Shield_2.0/PS3Enums.h index 77801945f2..77801945f2 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3Enums.h +++ b/lib/usbhost/USB_Host_Shield_2.0/PS3Enums.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3USB.cpp b/lib/usbhost/USB_Host_Shield_2.0/PS3USB.cpp index c32175389c..c32175389c 100755..100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3USB.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/PS3USB.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3USB.h b/lib/usbhost/USB_Host_Shield_2.0/PS3USB.h index 2eba9258cf..2eba9258cf 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS3USB.h +++ b/lib/usbhost/USB_Host_Shield_2.0/PS3USB.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS4BT.h b/lib/usbhost/USB_Host_Shield_2.0/PS4BT.h index b7eb4b5a91..b7eb4b5a91 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS4BT.h +++ b/lib/usbhost/USB_Host_Shield_2.0/PS4BT.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS4Parser.cpp b/lib/usbhost/USB_Host_Shield_2.0/PS4Parser.cpp index ca6adce403..ca6adce403 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS4Parser.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/PS4Parser.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS4Parser.h b/lib/usbhost/USB_Host_Shield_2.0/PS4Parser.h index 51f0806361..51f0806361 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS4Parser.h +++ b/lib/usbhost/USB_Host_Shield_2.0/PS4Parser.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS4USB.h b/lib/usbhost/USB_Host_Shield_2.0/PS4USB.h index b43079a6e9..b43079a6e9 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PS4USB.h +++ b/lib/usbhost/USB_Host_Shield_2.0/PS4USB.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PSBuzz.cpp b/lib/usbhost/USB_Host_Shield_2.0/PSBuzz.cpp index 498164d5a6..498164d5a6 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PSBuzz.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/PSBuzz.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PSBuzz.h b/lib/usbhost/USB_Host_Shield_2.0/PSBuzz.h index 8880d9e50a..8880d9e50a 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/PSBuzz.h +++ b/lib/usbhost/USB_Host_Shield_2.0/PSBuzz.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md b/lib/usbhost/USB_Host_Shield_2.0/README.md index 1eecb78ef2..1eecb78ef2 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md +++ b/lib/usbhost/USB_Host_Shield_2.0/README.md diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/SPP.cpp b/lib/usbhost/USB_Host_Shield_2.0/SPP.cpp index 0f4ee5e981..0f4ee5e981 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/SPP.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/SPP.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/SPP.h b/lib/usbhost/USB_Host_Shield_2.0/SPP.h index 233ac611fd..233ac611fd 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/SPP.h +++ b/lib/usbhost/USB_Host_Shield_2.0/SPP.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/Usb.cpp b/lib/usbhost/USB_Host_Shield_2.0/Usb.cpp index 14272588a1..14272588a1 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/Usb.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/Usb.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/Usb.h b/lib/usbhost/USB_Host_Shield_2.0/Usb.h index 47bd626cce..47bd626cce 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/Usb.h +++ b/lib/usbhost/USB_Host_Shield_2.0/Usb.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/UsbCore.h b/lib/usbhost/USB_Host_Shield_2.0/UsbCore.h index 5c6c771017..5c6c771017 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/UsbCore.h +++ b/lib/usbhost/USB_Host_Shield_2.0/UsbCore.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/Wii.cpp b/lib/usbhost/USB_Host_Shield_2.0/Wii.cpp index 4bbf4c91cb..4bbf4c91cb 100755..100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/Wii.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/Wii.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/Wii.h b/lib/usbhost/USB_Host_Shield_2.0/Wii.h index 960f2273de..960f2273de 100755..100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/Wii.h +++ b/lib/usbhost/USB_Host_Shield_2.0/Wii.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/WiiCameraReadme.md b/lib/usbhost/USB_Host_Shield_2.0/WiiCameraReadme.md index 8577d73fb3..8577d73fb3 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/WiiCameraReadme.md +++ b/lib/usbhost/USB_Host_Shield_2.0/WiiCameraReadme.md diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXOLD.cpp b/lib/usbhost/USB_Host_Shield_2.0/XBOXOLD.cpp index 78e6e9a5f5..78e6e9a5f5 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXOLD.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/XBOXOLD.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXOLD.h b/lib/usbhost/USB_Host_Shield_2.0/XBOXOLD.h index 9a36b5ccac..9a36b5ccac 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXOLD.h +++ b/lib/usbhost/USB_Host_Shield_2.0/XBOXOLD.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXONE.cpp b/lib/usbhost/USB_Host_Shield_2.0/XBOXONE.cpp index 2159c0528b..2159c0528b 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXONE.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/XBOXONE.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXONE.h b/lib/usbhost/USB_Host_Shield_2.0/XBOXONE.h index 11710fcf1a..11710fcf1a 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXONE.h +++ b/lib/usbhost/USB_Host_Shield_2.0/XBOXONE.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXRECV.cpp b/lib/usbhost/USB_Host_Shield_2.0/XBOXRECV.cpp index 41f1ff5816..41f1ff5816 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXRECV.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/XBOXRECV.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXRECV.h b/lib/usbhost/USB_Host_Shield_2.0/XBOXRECV.h index 4f9214653c..4f9214653c 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXRECV.h +++ b/lib/usbhost/USB_Host_Shield_2.0/XBOXRECV.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXUSB.cpp b/lib/usbhost/USB_Host_Shield_2.0/XBOXUSB.cpp index ddece21b45..ddece21b45 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXUSB.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/XBOXUSB.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXUSB.h b/lib/usbhost/USB_Host_Shield_2.0/XBOXUSB.h index 1ab37851a7..1ab37851a7 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/XBOXUSB.h +++ b/lib/usbhost/USB_Host_Shield_2.0/XBOXUSB.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/address.h b/lib/usbhost/USB_Host_Shield_2.0/address.h index c3e1b3141f..c3e1b3141f 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/address.h +++ b/lib/usbhost/USB_Host_Shield_2.0/address.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/adk.cpp b/lib/usbhost/USB_Host_Shield_2.0/adk.cpp index 9e4e0c8d86..9e4e0c8d86 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/adk.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/adk.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/adk.h b/lib/usbhost/USB_Host_Shield_2.0/adk.h index 4a2920b88a..4a2920b88a 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/adk.h +++ b/lib/usbhost/USB_Host_Shield_2.0/adk.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/avrpins.h b/lib/usbhost/USB_Host_Shield_2.0/avrpins.h index 4e60e3a229..4e60e3a229 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/avrpins.h +++ b/lib/usbhost/USB_Host_Shield_2.0/avrpins.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdc_XR21B1411.cpp b/lib/usbhost/USB_Host_Shield_2.0/cdc_XR21B1411.cpp index 74df8c3bdd..74df8c3bdd 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdc_XR21B1411.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/cdc_XR21B1411.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdc_XR21B1411.h b/lib/usbhost/USB_Host_Shield_2.0/cdc_XR21B1411.h index c32627544f..c32627544f 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdc_XR21B1411.h +++ b/lib/usbhost/USB_Host_Shield_2.0/cdc_XR21B1411.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcacm.cpp b/lib/usbhost/USB_Host_Shield_2.0/cdcacm.cpp index 2cd2c9a82d..2cd2c9a82d 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcacm.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/cdcacm.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcacm.h b/lib/usbhost/USB_Host_Shield_2.0/cdcacm.h index 2a38524d8c..2a38524d8c 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcacm.h +++ b/lib/usbhost/USB_Host_Shield_2.0/cdcacm.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcftdi.cpp b/lib/usbhost/USB_Host_Shield_2.0/cdcftdi.cpp index 80d21d16ec..80d21d16ec 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcftdi.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/cdcftdi.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcftdi.h b/lib/usbhost/USB_Host_Shield_2.0/cdcftdi.h index b731252629..b731252629 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcftdi.h +++ b/lib/usbhost/USB_Host_Shield_2.0/cdcftdi.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcprolific.cpp b/lib/usbhost/USB_Host_Shield_2.0/cdcprolific.cpp index eceb1df9f3..eceb1df9f3 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcprolific.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/cdcprolific.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcprolific.h b/lib/usbhost/USB_Host_Shield_2.0/cdcprolific.h index 4991466410..4991466410 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/cdcprolific.h +++ b/lib/usbhost/USB_Host_Shield_2.0/cdcprolific.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/confdescparser.h b/lib/usbhost/USB_Host_Shield_2.0/confdescparser.h index a6806f2ea7..a6806f2ea7 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/confdescparser.h +++ b/lib/usbhost/USB_Host_Shield_2.0/confdescparser.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/controllerEnums.h b/lib/usbhost/USB_Host_Shield_2.0/controllerEnums.h index 0169c763c1..0169c763c1 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/controllerEnums.h +++ b/lib/usbhost/USB_Host_Shield_2.0/controllerEnums.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/BTHID.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/BTHID.ino index 919a56468b..919a56468b 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/BTHID.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/BTHID.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/KeyboardParser.h b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/KeyboardParser.h index c5394331da..c5394331da 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/KeyboardParser.h +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/KeyboardParser.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/MouseParser.h b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/MouseParser.h index a9245ded99..a9245ded99 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/MouseParser.h +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/BTHID/MouseParser.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/PS3BT/PS3BT.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3BT/PS3BT.ino index b896734405..b896734405 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/PS3BT/PS3BT.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3BT/PS3BT.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino index 5ebfd7819c..5ebfd7819c 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3Multi/PS3Multi.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/PS3SPP/PS3SPP.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3SPP/PS3SPP.ino index 8f234cbd8d..8f234cbd8d 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/PS3SPP/PS3SPP.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS3SPP/PS3SPP.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/PS4BT/PS4BT.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS4BT/PS4BT.ino index c3ba696bd1..c3ba696bd1 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/PS4BT/PS4BT.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/PS4BT/PS4BT.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/SPP/SPP.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/SPP/SPP.ino index 8fb9c4eca2..8fb9c4eca2 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/SPP/SPP.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/SPP/SPP.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/SPPMulti/SPPMulti.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/SPPMulti/SPPMulti.ino index df521d8e17..df521d8e17 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/SPPMulti/SPPMulti.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/SPPMulti/SPPMulti.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/Wii/Wii.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/Wii/Wii.ino index b193568163..b193568163 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/Wii/Wii.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/Wii/Wii.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/WiiBalanceBoard/WiiBalanceBoard.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiBalanceBoard/WiiBalanceBoard.ino index 18c5b411ef..18c5b411ef 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/WiiBalanceBoard/WiiBalanceBoard.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiBalanceBoard/WiiBalanceBoard.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino index 573b8bd48c..573b8bd48c 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino index 07c6f13d2b..07c6f13d2b 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiMulti/WiiMulti.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/WiiUProController/WiiUProController.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiUProController/WiiUProController.ino index ab35a27479..ab35a27479 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Bluetooth/WiiUProController/WiiUProController.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Bluetooth/WiiUProController/WiiUProController.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino index 48b33abfd2..48b33abfd2 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDBootKbdAndMouse/USBHIDBootKbdAndMouse.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDBootKbdAndMouse/USBHIDBootKbdAndMouse.ino index 5fc8c96fc9..5fc8c96fc9 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDBootKbdAndMouse/USBHIDBootKbdAndMouse.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDBootKbdAndMouse/USBHIDBootKbdAndMouse.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino index 53102512bd..53102512bd 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/USBHIDJoystick.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/USBHIDJoystick.ino index 956441d67a..956441d67a 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/USBHIDJoystick.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/USBHIDJoystick.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/hidjoystickrptparser.cpp b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/hidjoystickrptparser.cpp index 083b95cac5..083b95cac5 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/hidjoystickrptparser.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/hidjoystickrptparser.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/hidjoystickrptparser.h b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/hidjoystickrptparser.h index 733b8f8da8..733b8f8da8 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/hidjoystickrptparser.h +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHIDJoystick/hidjoystickrptparser.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHID_desc/USBHID_desc.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHID_desc/USBHID_desc.ino index 85cfc19a2e..85cfc19a2e 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHID_desc/USBHID_desc.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHID_desc/USBHID_desc.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHID_desc/pgmstrings.h b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHID_desc/pgmstrings.h index bdb0077ecc..bdb0077ecc 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/USBHID_desc/pgmstrings.h +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/USBHID_desc/pgmstrings.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp.ino index 837d7f5a70..837d7f5a70 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.cpp b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.cpp index baece13b2c..baece13b2c 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h index 2400364e65..2400364e65 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/le3dp/le3dp_rptparser.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/scale/scale.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale.ino index f26ff964da..f26ff964da 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/scale/scale.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.cpp b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.cpp index 01ed980cfb..01ed980cfb 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h index 57fbb033bf..57fbb033bf 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/HID/scale/scale_rptparser.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/PS3USB/PS3USB.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/PS3USB/PS3USB.ino index a53dcfbe61..a53dcfbe61 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/PS3USB/PS3USB.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/PS3USB/PS3USB.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/PS4USB/PS4USB.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/PS4USB/PS4USB.ino index d0d76790ec..d0d76790ec 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/PS4USB/PS4USB.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/PS4USB/PS4USB.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/PSBuzz/PSBuzz.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/PSBuzz/PSBuzz.ino index 6ee462c1eb..6ee462c1eb 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/PSBuzz/PSBuzz.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/PSBuzz/PSBuzz.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/USB_desc/USB_desc.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/USB_desc/USB_desc.ino index acfe57d374..acfe57d374 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/USB_desc/USB_desc.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/USB_desc/USB_desc.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/USB_desc/pgmstrings.h b/lib/usbhost/USB_Host_Shield_2.0/examples/USB_desc/pgmstrings.h index bdb0077ecc..bdb0077ecc 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/USB_desc/pgmstrings.h +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/USB_desc/pgmstrings.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Xbox/XBOXOLD/XBOXOLD.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Xbox/XBOXOLD/XBOXOLD.ino index 64a3ed6120..64a3ed6120 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Xbox/XBOXOLD/XBOXOLD.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Xbox/XBOXOLD/XBOXOLD.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Xbox/XBOXONE/XBOXONE.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Xbox/XBOXONE/XBOXONE.ino index 9526f53d19..9526f53d19 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Xbox/XBOXONE/XBOXONE.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Xbox/XBOXONE/XBOXONE.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Xbox/XBOXRECV/XBOXRECV.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Xbox/XBOXRECV/XBOXRECV.ino index 491b287e44..491b287e44 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Xbox/XBOXRECV/XBOXRECV.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Xbox/XBOXRECV/XBOXRECV.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Xbox/XBOXUSB/XBOXUSB.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/Xbox/XBOXUSB/XBOXUSB.ino index 8a5691c6e1..8a5691c6e1 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/Xbox/XBOXUSB/XBOXUSB.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/Xbox/XBOXUSB/XBOXUSB.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/acm/acm_terminal/acm_terminal.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/acm/acm_terminal/acm_terminal.ino index f509cda890..f509cda890 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/acm/acm_terminal/acm_terminal.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/acm/acm_terminal/acm_terminal.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/acm/acm_terminal/pgmstrings.h b/lib/usbhost/USB_Host_Shield_2.0/examples/acm/acm_terminal/pgmstrings.h index bdb0077ecc..bdb0077ecc 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/acm/acm_terminal/pgmstrings.h +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/acm/acm_terminal/pgmstrings.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/ArduinoBlinkLED/ArduinoBlinkLED.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/adk/ArduinoBlinkLED/ArduinoBlinkLED.ino index d59b9bb3dc..d59b9bb3dc 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/ArduinoBlinkLED/ArduinoBlinkLED.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/adk/ArduinoBlinkLED/ArduinoBlinkLED.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/adk_barcode/adk_barcode.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/adk/adk_barcode/adk_barcode.ino index a308ff0f83..a308ff0f83 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/adk_barcode/adk_barcode.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/adk/adk_barcode/adk_barcode.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/demokit_20/demokit_20.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/adk/demokit_20/demokit_20.ino index f65adf57bb..f65adf57bb 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/demokit_20/demokit_20.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/adk/demokit_20/demokit_20.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/term_test/term_test.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/adk/term_test/term_test.ino index db681c3b50..db681c3b50 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/term_test/term_test.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/adk/term_test/term_test.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/term_time/term_time.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/adk/term_time/term_time.ino index a3f1dbc8cb..a3f1dbc8cb 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/adk/term_time/term_time.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/adk/term_time/term_time.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/board_qc/board_qc.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/board_qc/board_qc.ino index 573c3ce083..573c3ce083 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/board_qc/board_qc.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/board_qc/board_qc.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/cdc_XR21B1411/XR_terminal/XR_terminal.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/cdc_XR21B1411/XR_terminal/XR_terminal.ino index 0173a08b50..0173a08b50 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/cdc_XR21B1411/XR_terminal/XR_terminal.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/cdc_XR21B1411/XR_terminal/XR_terminal.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino index 5be7adc2f3..5be7adc2f3 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/ftdi/USBFTDILoopback/pgmstrings.h b/lib/usbhost/USB_Host_Shield_2.0/examples/ftdi/USBFTDILoopback/pgmstrings.h index bdb0077ecc..bdb0077ecc 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/ftdi/USBFTDILoopback/pgmstrings.h +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/ftdi/USBFTDILoopback/pgmstrings.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/hub_demo/hub_demo.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/hub_demo/hub_demo.ino index d8b2d4bb72..d8b2d4bb72 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/hub_demo/hub_demo.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/hub_demo/hub_demo.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/hub_demo/pgmstrings.h b/lib/usbhost/USB_Host_Shield_2.0/examples/hub_demo/pgmstrings.h index bdb0077ecc..bdb0077ecc 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/hub_demo/pgmstrings.h +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/hub_demo/pgmstrings.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/max_LCD/max_LCD.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/max_LCD/max_LCD.ino index 6603ab90db..6603ab90db 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/max_LCD/max_LCD.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/max_LCD/max_LCD.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino index 7c4c9f6cbe..7c4c9f6cbe 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/pl2303/pl2303_gps/pl2303_gps.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/pl2303/pl2303_gps/pl2303_gps.ino index e8c8a02230..e8c8a02230 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/pl2303/pl2303_gps/pl2303_gps.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/pl2303/pl2303_gps/pl2303_gps.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/pl2303/pl2303_tinygps/pl2303_tinygps.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/pl2303/pl2303_tinygps/pl2303_tinygps.ino index d527eabe00..d527eabe00 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/pl2303/pl2303_tinygps/pl2303_tinygps.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/pl2303/pl2303_tinygps/pl2303_tinygps.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino index 67b7dab603..67b7dab603 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/Makefile b/lib/usbhost/USB_Host_Shield_2.0/examples/testusbhostFAT/Makefile index 8a12ddc047..8a12ddc047 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/Makefile +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/testusbhostFAT/Makefile diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md b/lib/usbhost/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md index 0f2a734a65..0f2a734a65 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/testusbhostFAT.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/testusbhostFAT/testusbhostFAT.ino index e8b9cd3592..e8b9cd3592 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/testusbhostFAT.ino +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/testusbhostFAT/testusbhostFAT.ino diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/gpl2.txt b/lib/usbhost/USB_Host_Shield_2.0/gpl2.txt index 5b6e7c66c2..5b6e7c66c2 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/gpl2.txt +++ b/lib/usbhost/USB_Host_Shield_2.0/gpl2.txt diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hexdump.h b/lib/usbhost/USB_Host_Shield_2.0/hexdump.h index ffa7248b7d..ffa7248b7d 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hexdump.h +++ b/lib/usbhost/USB_Host_Shield_2.0/hexdump.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hid.cpp b/lib/usbhost/USB_Host_Shield_2.0/hid.cpp index e4c7721a3e..e4c7721a3e 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hid.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/hid.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hid.h b/lib/usbhost/USB_Host_Shield_2.0/hid.h index 72942ebc92..72942ebc92 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hid.h +++ b/lib/usbhost/USB_Host_Shield_2.0/hid.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidboot.cpp b/lib/usbhost/USB_Host_Shield_2.0/hidboot.cpp index 280b2f9788..280b2f9788 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidboot.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/hidboot.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidboot.h b/lib/usbhost/USB_Host_Shield_2.0/hidboot.h index fb63ec5e59..fb63ec5e59 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidboot.h +++ b/lib/usbhost/USB_Host_Shield_2.0/hidboot.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidescriptorparser.cpp b/lib/usbhost/USB_Host_Shield_2.0/hidescriptorparser.cpp index e4491b4e97..e4491b4e97 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidescriptorparser.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/hidescriptorparser.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidescriptorparser.h b/lib/usbhost/USB_Host_Shield_2.0/hidescriptorparser.h index f3b496ffa5..f3b496ffa5 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidescriptorparser.h +++ b/lib/usbhost/USB_Host_Shield_2.0/hidescriptorparser.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hiduniversal.cpp b/lib/usbhost/USB_Host_Shield_2.0/hiduniversal.cpp index 395aa69e34..395aa69e34 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hiduniversal.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/hiduniversal.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hiduniversal.h b/lib/usbhost/USB_Host_Shield_2.0/hiduniversal.h index d7af384068..d7af384068 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hiduniversal.h +++ b/lib/usbhost/USB_Host_Shield_2.0/hiduniversal.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidusagestr.h b/lib/usbhost/USB_Host_Shield_2.0/hidusagestr.h index 5ef48f925b..5ef48f925b 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidusagestr.h +++ b/lib/usbhost/USB_Host_Shield_2.0/hidusagestr.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidusagetitlearrays.cpp b/lib/usbhost/USB_Host_Shield_2.0/hidusagetitlearrays.cpp index ee233002ca..ee233002ca 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/hidusagetitlearrays.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/hidusagetitlearrays.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/keywords.txt b/lib/usbhost/USB_Host_Shield_2.0/keywords.txt index f4e19cd133..f4e19cd133 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/keywords.txt +++ b/lib/usbhost/USB_Host_Shield_2.0/keywords.txt diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/library.json b/lib/usbhost/USB_Host_Shield_2.0/library.json index 1d649b1e13..1d649b1e13 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/library.json +++ b/lib/usbhost/USB_Host_Shield_2.0/library.json diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/library.properties b/lib/usbhost/USB_Host_Shield_2.0/library.properties index 7881b05e9d..7881b05e9d 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/library.properties +++ b/lib/usbhost/USB_Host_Shield_2.0/library.properties diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/macros.h b/lib/usbhost/USB_Host_Shield_2.0/macros.h index e14a711fab..e14a711fab 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/macros.h +++ b/lib/usbhost/USB_Host_Shield_2.0/macros.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/masstorage.cpp b/lib/usbhost/USB_Host_Shield_2.0/masstorage.cpp index 9299f71a43..9299f71a43 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/masstorage.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/masstorage.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/masstorage.h b/lib/usbhost/USB_Host_Shield_2.0/masstorage.h index d39fd66f37..d39fd66f37 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/masstorage.h +++ b/lib/usbhost/USB_Host_Shield_2.0/masstorage.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/max3421e.h b/lib/usbhost/USB_Host_Shield_2.0/max3421e.h index 4e45a35e8d..4e45a35e8d 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/max3421e.h +++ b/lib/usbhost/USB_Host_Shield_2.0/max3421e.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/max_LCD.cpp b/lib/usbhost/USB_Host_Shield_2.0/max_LCD.cpp index f0c64666fa..f0c64666fa 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/max_LCD.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/max_LCD.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/max_LCD.h b/lib/usbhost/USB_Host_Shield_2.0/max_LCD.h index 950c9c5aa3..950c9c5aa3 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/max_LCD.h +++ b/lib/usbhost/USB_Host_Shield_2.0/max_LCD.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/message.cpp b/lib/usbhost/USB_Host_Shield_2.0/message.cpp index bdcdd18331..bdcdd18331 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/message.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/message.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/message.h b/lib/usbhost/USB_Host_Shield_2.0/message.h index c26628e7f2..c26628e7f2 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/message.h +++ b/lib/usbhost/USB_Host_Shield_2.0/message.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/parsetools.cpp b/lib/usbhost/USB_Host_Shield_2.0/parsetools.cpp index 74a8610597..74a8610597 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/parsetools.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/parsetools.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/parsetools.h b/lib/usbhost/USB_Host_Shield_2.0/parsetools.h index 66e9531c39..66e9531c39 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/parsetools.h +++ b/lib/usbhost/USB_Host_Shield_2.0/parsetools.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/printhex.h b/lib/usbhost/USB_Host_Shield_2.0/printhex.h index 369d7e1f7e..369d7e1f7e 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/printhex.h +++ b/lib/usbhost/USB_Host_Shield_2.0/printhex.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/settings.h b/lib/usbhost/USB_Host_Shield_2.0/settings.h index 5c060354ba..5c060354ba 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/settings.h +++ b/lib/usbhost/USB_Host_Shield_2.0/settings.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/sink_parser.h b/lib/usbhost/USB_Host_Shield_2.0/sink_parser.h index a23637d2b7..a23637d2b7 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/sink_parser.h +++ b/lib/usbhost/USB_Host_Shield_2.0/sink_parser.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/usb_ch9.h b/lib/usbhost/USB_Host_Shield_2.0/usb_ch9.h index 18f2d3e2e5..18f2d3e2e5 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/usb_ch9.h +++ b/lib/usbhost/USB_Host_Shield_2.0/usb_ch9.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/usbhost.h b/lib/usbhost/USB_Host_Shield_2.0/usbhost.h index eba480e60c..eba480e60c 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/usbhost.h +++ b/lib/usbhost/USB_Host_Shield_2.0/usbhost.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/usbhub.cpp b/lib/usbhost/USB_Host_Shield_2.0/usbhub.cpp index 7fed48e781..7fed48e781 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/usbhub.cpp +++ b/lib/usbhost/USB_Host_Shield_2.0/usbhub.cpp diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/usbhub.h b/lib/usbhost/USB_Host_Shield_2.0/usbhub.h index 1ac949445a..1ac949445a 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/usbhub.h +++ b/lib/usbhost/USB_Host_Shield_2.0/usbhub.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/version_helper.h b/lib/usbhost/USB_Host_Shield_2.0/version_helper.h index 0cb3b4adc0..0cb3b4adc0 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/version_helper.h +++ b/lib/usbhost/USB_Host_Shield_2.0/version_helper.h diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/xboxEnums.h b/lib/usbhost/USB_Host_Shield_2.0/xboxEnums.h index 84b137bb6e..84b137bb6e 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/xboxEnums.h +++ b/lib/usbhost/USB_Host_Shield_2.0/xboxEnums.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Arduino.h b/lib/usbhost/arduino-1.0.1/cores/arduino/Arduino.h index 830c9952fb..830c9952fb 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Arduino.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/Arduino.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp b/lib/usbhost/arduino-1.0.1/cores/arduino/CDC.cpp index 1ee3a488a5..1ee3a488a5 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/CDC.cpp diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Client.h b/lib/usbhost/arduino-1.0.1/cores/arduino/Client.h index ea134838a2..ea134838a2 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Client.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/Client.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HID.cpp b/lib/usbhost/arduino-1.0.1/cores/arduino/HID.cpp index ac63608449..ac63608449 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HID.cpp +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/HID.cpp diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.cpp b/lib/usbhost/arduino-1.0.1/cores/arduino/HardwareSerial.cpp index f40ddee060..f40ddee060 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.cpp +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/HardwareSerial.cpp diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.h b/lib/usbhost/arduino-1.0.1/cores/arduino/HardwareSerial.h index bf4924c6d4..bf4924c6d4 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/HardwareSerial.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.cpp b/lib/usbhost/arduino-1.0.1/cores/arduino/IPAddress.cpp index fe3deb77a2..fe3deb77a2 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.cpp +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/IPAddress.cpp diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.h b/lib/usbhost/arduino-1.0.1/cores/arduino/IPAddress.h index 2585aec0e4..2585aec0e4 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/IPAddress.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Platform.h b/lib/usbhost/arduino-1.0.1/cores/arduino/Platform.h index 8b8f742771..8b8f742771 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Platform.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/Platform.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.cpp b/lib/usbhost/arduino-1.0.1/cores/arduino/Print.cpp index e541a6ce71..e541a6ce71 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.cpp +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/Print.cpp diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.h b/lib/usbhost/arduino-1.0.1/cores/arduino/Print.h index 1af6b723fc..1af6b723fc 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/Print.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Printable.h b/lib/usbhost/arduino-1.0.1/cores/arduino/Printable.h index d03c9af62c..d03c9af62c 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Printable.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/Printable.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Server.h b/lib/usbhost/arduino-1.0.1/cores/arduino/Server.h index 9674c76269..9674c76269 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Server.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/Server.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp b/lib/usbhost/arduino-1.0.1/cores/arduino/Stream.cpp index aafb7fcf97..aafb7fcf97 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/Stream.cpp diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.h b/lib/usbhost/arduino-1.0.1/cores/arduino/Stream.h index 58bbf752f3..58bbf752f3 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/Stream.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp b/lib/usbhost/arduino-1.0.1/cores/arduino/Tone.cpp index 20eed3f483..20eed3f483 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/Tone.cpp diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h b/lib/usbhost/arduino-1.0.1/cores/arduino/USBAPI.h index d5abdb690d..d5abdb690d 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/USBAPI.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.cpp b/lib/usbhost/arduino-1.0.1/cores/arduino/USBCore.cpp index 6766be61ab..6766be61ab 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.cpp +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/USBCore.cpp diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.h b/lib/usbhost/arduino-1.0.1/cores/arduino/USBCore.h index 8d13806896..8d13806896 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/USBCore.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h b/lib/usbhost/arduino-1.0.1/cores/arduino/USBDesc.h index 900713e0f9..900713e0f9 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/USBDesc.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h b/lib/usbhost/arduino-1.0.1/cores/arduino/Udp.h index dc5644b9df..dc5644b9df 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/Udp.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WCharacter.h b/lib/usbhost/arduino-1.0.1/cores/arduino/WCharacter.h index 79733b50a5..79733b50a5 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WCharacter.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/WCharacter.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WInterrupts.c b/lib/usbhost/arduino-1.0.1/cores/arduino/WInterrupts.c index 8f3ec847f1..8f3ec847f1 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WInterrupts.c +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/WInterrupts.c diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WMath.cpp b/lib/usbhost/arduino-1.0.1/cores/arduino/WMath.cpp index 2120c4cc10..2120c4cc10 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WMath.cpp +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/WMath.cpp diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.cpp b/lib/usbhost/arduino-1.0.1/cores/arduino/WString.cpp index c6839fc0d9..c6839fc0d9 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.cpp +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/WString.cpp diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.h b/lib/usbhost/arduino-1.0.1/cores/arduino/WString.h index 947325e5f5..947325e5f5 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/WString.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/binary.h b/lib/usbhost/arduino-1.0.1/cores/arduino/binary.h index af1498033a..af1498033a 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/binary.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/binary.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/main.cpp b/lib/usbhost/arduino-1.0.1/cores/arduino/main.cpp index 3d4e079d2a..3d4e079d2a 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/main.cpp +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/main.cpp diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.cpp b/lib/usbhost/arduino-1.0.1/cores/arduino/new.cpp index 0f6d4220ef..0f6d4220ef 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.cpp +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/new.cpp diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h b/lib/usbhost/arduino-1.0.1/cores/arduino/new.h index cd940ce8b2..cd940ce8b2 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/new.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring.c b/lib/usbhost/arduino-1.0.1/cores/arduino/wiring.c index ac8bb6f9b4..ac8bb6f9b4 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring.c +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/wiring.c diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_analog.c b/lib/usbhost/arduino-1.0.1/cores/arduino/wiring_analog.c index 0e9881f6ac..0e9881f6ac 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_analog.c +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/wiring_analog.c diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_digital.c b/lib/usbhost/arduino-1.0.1/cores/arduino/wiring_digital.c index be323b1dfe..be323b1dfe 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_digital.c +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/wiring_digital.c diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_private.h b/lib/usbhost/arduino-1.0.1/cores/arduino/wiring_private.h index f0ceb0cc4d..f0ceb0cc4d 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_private.h +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/wiring_private.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_pulse.c b/lib/usbhost/arduino-1.0.1/cores/arduino/wiring_pulse.c index 0d968865d2..0d968865d2 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_pulse.c +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/wiring_pulse.c diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_shift.c b/lib/usbhost/arduino-1.0.1/cores/arduino/wiring_shift.c index cfe786758c..cfe786758c 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_shift.c +++ b/lib/usbhost/arduino-1.0.1/cores/arduino/wiring_shift.c diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h b/lib/usbhost/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h index 52b37efc40..52b37efc40 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h +++ b/lib/usbhost/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/leonardo/pins_arduino.h b/lib/usbhost/arduino-1.0.1/variants/leonardo/pins_arduino.h index 9f770d6cec..9f770d6cec 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/leonardo/pins_arduino.h +++ b/lib/usbhost/arduino-1.0.1/variants/leonardo/pins_arduino.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/mega/pins_arduino.h b/lib/usbhost/arduino-1.0.1/variants/mega/pins_arduino.h index 5a9b4cb09b..5a9b4cb09b 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/mega/pins_arduino.h +++ b/lib/usbhost/arduino-1.0.1/variants/mega/pins_arduino.h diff --git a/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/standard/pins_arduino.h b/lib/usbhost/arduino-1.0.1/variants/standard/pins_arduino.h index 30b4266306..30b4266306 100644 --- a/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/standard/pins_arduino.h +++ b/lib/usbhost/arduino-1.0.1/variants/standard/pins_arduino.h diff --git a/message.mk b/message.mk index da5f9fb9e3..cb4ef43719 100644 --- a/message.mk +++ b/message.mk @@ -36,6 +36,10 @@ PRINT_OK = $(SILENT) || printf " $(OK_STRING)" | $(AWK_STATUS) BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi; MAKE_MSG_FORMAT = $(AWK) '{ printf "%-118s", $$0;}' +# The UNSYNC_OUTPUT_CMD command disables the `--output-sync` for the current command, if the `--output-sync` granularity is `target` or lower. +# This is achieved by telling make to treat the current command as if it invokes a recursive make subcommand (as if by calling `$(MAKE)`). +UNSYNC_OUTPUT_CMD = +true + # Define Messages # English MSG_ERRORS_NONE = Errors: none @@ -84,14 +88,15 @@ endef MSG_AVAILABLE_KEYMAPS = $(eval $(call GENERATE_MSG_AVAILABLE_KEYMAPS))$(MSG_AVAILABLE_KEYMAPS_ACTUAL) MSG_CHECK_FILESIZE = Checking file size of $(TARGET).$(FIRMWARE_FORMAT) +MSG_CHECK_FILESIZE_SKIPPED = (Firmware size check does not yet support $(MCU_ORIG); skipping) MSG_FILE_TOO_BIG = $(ERROR_COLOR)The firmware is too large!$(NO_COLOR) $(CURRENT_SIZE)/$(MAX_SIZE) ($(OVER_SIZE) bytes over)\n MSG_FILE_TOO_SMALL = The firmware is too small! $(CURRENT_SIZE)/$(MAX_SIZE)\n MSG_FILE_JUST_RIGHT = The firmware size is fine - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n MSG_FILE_NEAR_LIMIT = The firmware size is approaching the maximum - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n -MSG_PYTHON_MISSING = $(ERROR_COLOR)ERROR:$(NO_COLOR) Can not run \"qmk\" command!\n\n\ - Please run $(BOLD)util/qmk_install.sh$(NO_COLOR) to install all the dependencies QMK requires.\n\n +MSG_PYTHON_MISSING = $(ERROR_COLOR)ERROR:$(NO_COLOR) Cannot run \"qmk hello\"!\n\n\ + Please run $(BOLD)qmk setup$(NO_COLOR) to install all the dependencies QMK requires.\n\n MSG_FLASH_BOOTLOADER = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's bootloader is not specified or is not supported by the \":flash\" target at this time.\n\n MSG_FLASH_ARCH = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's architecture is not supported by the \":flash\" target at this time.\n\n -MSG_BOOTLOADER_NOT_FOUND = $(ERROR_COLOR)ERROR:$(NO_COLOR) Bootloader not found. Trying again in 5s.\n +MSG_BOOTLOADER_NOT_FOUND = $(ERROR_COLOR)ERROR:$(NO_COLOR) Bootloader not found. Trying again in 5s (Ctrl+C to cancel)\n BOOTLOADER_RETRY_TIME ?= 0.5 -MSG_BOOTLOADER_NOT_FOUND_QUICK_RETRY = Bootloader not found. Trying again every $(BOOTLOADER_RETRY_TIME)s +MSG_BOOTLOADER_NOT_FOUND_QUICK_RETRY = Bootloader not found. Trying again every $(BOOTLOADER_RETRY_TIME)s (Ctrl+C to cancel) diff --git a/platforms/arm_atsam/flash.mk b/platforms/arm_atsam/flash.mk new file mode 100644 index 0000000000..f31d4b4d95 --- /dev/null +++ b/platforms/arm_atsam/flash.mk @@ -0,0 +1,11 @@ +# Hey Emacs, this is a -*- makefile -*- +############################################################################## +# Architecture or project specific options +# + +flash: bin +ifneq ($(strip $(PROGRAM_CMD)),) + $(UNSYNC_OUTPUT_CMD) && $(PROGRAM_CMD) +else + $(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_ARCH)" +endif diff --git a/drivers/avr/analog.c b/platforms/avr/drivers/analog.c index 8d299ffdb9..8d299ffdb9 100644 --- a/drivers/avr/analog.c +++ b/platforms/avr/drivers/analog.c diff --git a/drivers/avr/analog.h b/platforms/avr/drivers/analog.h index 058882450d..058882450d 100644 --- a/drivers/avr/analog.h +++ b/platforms/avr/drivers/analog.h diff --git a/drivers/avr/apa102.c b/platforms/avr/drivers/apa102.c index 740acb5739..740acb5739 100644 --- a/drivers/avr/apa102.c +++ b/platforms/avr/drivers/apa102.c diff --git a/drivers/avr/glcdfont.c b/platforms/avr/drivers/glcdfont.c index 5e763b054f..5e763b054f 100644 --- a/drivers/avr/glcdfont.c +++ b/platforms/avr/drivers/glcdfont.c diff --git a/drivers/avr/hd44780.c b/platforms/avr/drivers/hd44780.c index f71069dece..f71069dece 100644 --- a/drivers/avr/hd44780.c +++ b/platforms/avr/drivers/hd44780.c diff --git a/drivers/avr/hd44780.h b/platforms/avr/drivers/hd44780.h index 08e60f8a44..08e60f8a44 100644 --- a/drivers/avr/hd44780.h +++ b/platforms/avr/drivers/hd44780.h diff --git a/drivers/avr/i2c_master.c b/platforms/avr/drivers/i2c_master.c index b1e4885298..2773e00778 100644 --- a/drivers/avr/i2c_master.c +++ b/platforms/avr/drivers/i2c_master.c @@ -28,8 +28,14 @@ # define F_SCL 400000UL // SCL frequency #endif +#ifndef I2C_START_RETRY_COUNT +# define I2C_START_RETRY_COUNT 20 +#endif // I2C_START_RETRY_COUNT + #define TWBR_val (((F_CPU / F_SCL) - 16) / 2) +#define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) + void i2c_init(void) { TWSR = 0; /* no prescaler */ TWBR = (uint8_t)TWBR_val; @@ -47,7 +53,7 @@ void i2c_init(void) { #endif } -i2c_status_t i2c_start(uint8_t address, uint16_t timeout) { +static i2c_status_t i2c_start_impl(uint8_t address, uint16_t timeout) { // reset TWI control register TWCR = 0; // transmit START condition @@ -86,6 +92,17 @@ i2c_status_t i2c_start(uint8_t address, uint16_t timeout) { return I2C_STATUS_SUCCESS; } +i2c_status_t i2c_start(uint8_t address, uint16_t timeout) { + // Retry i2c_start_impl a bunch times in case the remote side has interrupts disabled. + uint16_t timeout_timer = timer_read(); + uint16_t time_slice = MAX(1, (timeout == (I2C_TIMEOUT_INFINITE)) ? 5 : (timeout / (I2C_START_RETRY_COUNT))); // if it's infinite, wait 1ms between attempts, otherwise split up the entire timeout into the number of retries + i2c_status_t status; + do { + status = i2c_start_impl(address, time_slice); + } while ((status < 0) && ((timeout == I2C_TIMEOUT_INFINITE) || (timer_elapsed(timeout_timer) < timeout))); + return status; +} + i2c_status_t i2c_write(uint8_t data, uint16_t timeout) { // load data into data register TWDR = data; diff --git a/drivers/avr/i2c_master.h b/platforms/avr/drivers/i2c_master.h index e5af73364b..e5af73364b 100644 --- a/drivers/avr/i2c_master.h +++ b/platforms/avr/drivers/i2c_master.h diff --git a/drivers/avr/i2c_slave.c b/platforms/avr/drivers/i2c_slave.c index 62a378165a..2907f164c0 100644 --- a/drivers/avr/i2c_slave.c +++ b/platforms/avr/drivers/i2c_slave.c @@ -17,6 +17,7 @@ * GitHub repository: https://github.com/g4lvanix/I2C-slave-lib */ +#include <stddef.h> #include <avr/io.h> #include <util/twi.h> #include <avr/interrupt.h> @@ -24,6 +25,12 @@ #include "i2c_slave.h" +#if defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS) +# include "transactions.h" + +static volatile bool is_callback_executor = false; +#endif // defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS) + volatile uint8_t i2c_slave_reg[I2C_SLAVE_REG_COUNT]; static volatile uint8_t buffer_address; @@ -48,11 +55,14 @@ ISR(TWI_vect) { case TW_SR_SLA_ACK: // The device is now a slave receiver slave_has_register_set = false; +#if defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS) + is_callback_executor = false; +#endif // defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS) break; case TW_SR_DATA_ACK: // This device is a slave receiver and has received data - // First byte is the location then the bytes will be writen in buffer with auto-incriment + // First byte is the location then the bytes will be writen in buffer with auto-increment if (!slave_has_register_set) { buffer_address = TWDR; @@ -60,10 +70,25 @@ ISR(TWI_vect) { ack = 0; buffer_address = 0; } - slave_has_register_set = true; // address has been receaved now fill in buffer + slave_has_register_set = true; // address has been received now fill in buffer + +#if defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS) + // Work out if we're attempting to execute a callback + is_callback_executor = buffer_address == split_transaction_table[I2C_EXECUTE_CALLBACK].initiator2target_offset; +#endif // defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS) } else { i2c_slave_reg[buffer_address] = TWDR; buffer_address++; + +#if defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS) + // If we're intending to execute a transaction callback, do so, as we've just received the transaction ID + if (is_callback_executor) { + split_transaction_desc_t *trans = &split_transaction_table[split_shmem->transaction_id]; + if (trans->slave_callback) { + trans->slave_callback(trans->initiator2target_buffer_size, split_trans_initiator2target_buffer(trans), trans->target2initiator_buffer_size, split_trans_target2initiator_buffer(trans)); + } + } +#endif // defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS) } break; diff --git a/drivers/avr/i2c_slave.h b/platforms/avr/drivers/i2c_slave.h index 1cd0625ef4..a8647c9da3 100644 --- a/drivers/avr/i2c_slave.h +++ b/platforms/avr/drivers/i2c_slave.h @@ -22,7 +22,18 @@ #pragma once -#define I2C_SLAVE_REG_COUNT 30 +#ifndef I2C_SLAVE_REG_COUNT + +# if defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS) +# include "transport.h" +# define I2C_SLAVE_REG_COUNT sizeof(split_shared_memory_t) +# else // defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS) +# define I2C_SLAVE_REG_COUNT 30 +# endif // defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS) + +#endif // I2C_SLAVE_REG_COUNT + +_Static_assert(I2C_SLAVE_REG_COUNT < 256, "I2C target registers must be single byte"); extern volatile uint8_t i2c_slave_reg[I2C_SLAVE_REG_COUNT]; diff --git a/drivers/avr/serial.c b/platforms/avr/drivers/serial.c index 84365fe8f4..82d21dfe0c 100644 --- a/drivers/avr/serial.c +++ b/platforms/avr/drivers/serial.c @@ -229,15 +229,8 @@ # 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; +# define SLAVE_INT_ACK_WIDTH_UNIT 2 +# define SLAVE_INT_ACK_WIDTH 4 inline static void serial_delay(void) ALWAYS_INLINE; inline static void serial_delay(void) { _delay_us(SERIAL_DELAY); } @@ -264,16 +257,12 @@ inline static void serial_low(void) { writePinLow(SOFT_SERIAL_PIN); } inline static void serial_high(void) ALWAYS_INLINE; inline static void serial_high(void) { writePinHigh(SOFT_SERIAL_PIN); } -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; +void soft_serial_initiator_init(void) { 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; +void soft_serial_target_init(void) { serial_input_with_pullup(); // Enable INT0-INT7 @@ -400,19 +389,14 @@ static inline uint8_t nibble_bits_count(uint8_t 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); + bits = serial_read_chunk(&pecount, 8); tid = bits >> 3; - bits = (bits & 7) != nibble_bits_count(tid); - if (bits || pecount > 0 || tid > Transaction_table_size) { + bits = (bits & 7) != (nibble_bits_count(tid) & 7); + if (bits || pecount > 0 || tid > NUM_TOTAL_TRANSACTIONS) { return; } serial_delay_half1(); @@ -420,18 +404,22 @@ ISR(SERIAL_PIN_INTERRUPT) { 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]; + split_transaction_desc_t *trans = &split_transaction_table[tid]; serial_low(); // response step2 ack high->low -# endif + + // If the transaction has a callback, we can execute it now + if (trans->slave_callback) { + trans->slave_callback(trans->initiator2target_buffer_size, split_trans_initiator2target_buffer(trans), trans->target2initiator_buffer_size, split_trans_target2initiator_buffer(trans)); + } // target send phase - if (trans->target2initiator_buffer_size > 0) serial_send_packet((uint8_t *)trans->target2initiator_buffer, trans->target2initiator_buffer_size); + if (trans->target2initiator_buffer_size > 0) serial_send_packet((uint8_t *)split_trans_target2initiator_buffer(trans), 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)) { + if (serial_recive_packet((uint8_t *)split_trans_initiator2target_buffer(trans), trans->initiator2target_buffer_size)) { *trans->status = TRANSACTION_ACCEPTED; } else { *trans->status = TRANSACTION_DATA_ERROR; @@ -453,14 +441,12 @@ ISR(SERIAL_PIN_INTERRUPT) { // 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 + if (sstd_index > NUM_TOTAL_TRANSACTIONS) return TRANSACTION_TYPE_ERROR; + split_transaction_desc_t *trans = &split_transaction_table[sstd_index]; + + if (!trans->status) return TRANSACTION_TYPE_ERROR; // not registered + cli(); // signal to the target that we want to start a transaction @@ -468,27 +454,11 @@ int soft_serial_transaction(int sstd_index) { 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_write_chunk(tid, 8); serial_delay_half1(); // wait for the target response (step1 low->high) @@ -509,12 +479,11 @@ int soft_serial_transaction(int sstd_index) { } _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)) { + if (!serial_recive_packet((uint8_t *)split_trans_target2initiator_buffer(trans), trans->target2initiator_buffer_size)) { serial_output(); serial_high(); *trans->status = TRANSACTION_DATA_ERROR; @@ -528,7 +497,7 @@ int soft_serial_transaction(int sstd_index) { // initiator send phase if (trans->initiator2target_buffer_size > 0) { - serial_send_packet((uint8_t *)trans->initiator2target_buffer, trans->initiator2target_buffer_size); + serial_send_packet((uint8_t *)split_trans_initiator2target_buffer(trans), trans->initiator2target_buffer_size); } // always, release the line when not in use @@ -539,9 +508,8 @@ int soft_serial_transaction(int sstd_index) { 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]; + split_transaction_desc_t *trans = &split_transaction_table[sstd_index]; cli(); int retval = *trans->status; *trans->status = 0; @@ -549,8 +517,6 @@ int soft_serial_get_and_clean_status(int sstd_index) { sei(); return retval; } -# endif - #endif // Helix serial.c history diff --git a/drivers/avr/spi_master.c b/platforms/avr/drivers/spi_master.c index 4e8fd3bcdf..4e8fd3bcdf 100644 --- a/drivers/avr/spi_master.c +++ b/platforms/avr/drivers/spi_master.c diff --git a/drivers/avr/spi_master.h b/platforms/avr/drivers/spi_master.h index 8a30f47ae4..8a30f47ae4 100644 --- a/drivers/avr/spi_master.h +++ b/platforms/avr/drivers/spi_master.h diff --git a/drivers/avr/ssd1306.c b/platforms/avr/drivers/ssd1306.c index 1a09a2bcb7..1a09a2bcb7 100644 --- a/drivers/avr/ssd1306.c +++ b/platforms/avr/drivers/ssd1306.c diff --git a/drivers/avr/ssd1306.h b/platforms/avr/drivers/ssd1306.h index 6eecdcfaa4..6eecdcfaa4 100644 --- a/drivers/avr/ssd1306.h +++ b/platforms/avr/drivers/ssd1306.h diff --git a/drivers/avr/uart.c b/platforms/avr/drivers/uart.c index c6abcb6fe0..c6abcb6fe0 100644 --- a/drivers/avr/uart.c +++ b/platforms/avr/drivers/uart.c diff --git a/drivers/avr/uart.h b/platforms/avr/drivers/uart.h index 602eb3d8b0..602eb3d8b0 100644 --- a/drivers/avr/uart.h +++ b/platforms/avr/drivers/uart.h diff --git a/drivers/avr/ws2812.c b/platforms/avr/drivers/ws2812.c index 77c492cd4c..77c492cd4c 100644 --- a/drivers/avr/ws2812.c +++ b/platforms/avr/drivers/ws2812.c diff --git a/drivers/avr/ws2812_i2c.c b/platforms/avr/drivers/ws2812_i2c.c index 1c332e24b6..1c332e24b6 100644 --- a/drivers/avr/ws2812_i2c.c +++ b/platforms/avr/drivers/ws2812_i2c.c diff --git a/platforms/avr/flash.mk b/platforms/avr/flash.mk new file mode 100644 index 0000000000..985cb60e52 --- /dev/null +++ b/platforms/avr/flash.mk @@ -0,0 +1,179 @@ +# Hey Emacs, this is a -*- makefile -*- +############################################################################## +# Architecture or project specific options +# + +# Autodetect teensy loader +ifndef TEENSY_LOADER_CLI + ifneq (, $(shell which teensy-loader-cli 2>/dev/null)) + TEENSY_LOADER_CLI ?= teensy-loader-cli + else + TEENSY_LOADER_CLI ?= teensy_loader_cli + endif +endif + +define EXEC_TEENSY + $(TEENSY_LOADER_CLI) -mmcu=$(MCU) -w -v $(BUILD_DIR)/$(TARGET).hex +endef + +teensy: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware + $(call EXEC_TEENSY) + +DFU_PROGRAMMER ?= dfu-programmer +GREP ?= grep + +define EXEC_DFU + if [ "$(1)" ]; then \ + echo "Flashing '$(1)' for EE_HANDS split keyboard support." ;\ + fi; \ + if ! $(DFU_PROGRAMMER) $(MCU) get bootloader-version >/dev/null 2>/dev/null; then\ + printf "$(MSG_BOOTLOADER_NOT_FOUND_QUICK_RETRY)" ;\ + sleep $(BOOTLOADER_RETRY_TIME) ;\ + while ! $(DFU_PROGRAMMER) $(MCU) get bootloader-version >/dev/null 2>/dev/null; do\ + printf "." ;\ + sleep $(BOOTLOADER_RETRY_TIME) ;\ + done ;\ + printf "\n" ;\ + fi; \ + $(DFU_PROGRAMMER) $(MCU) get bootloader-version ;\ + if $(DFU_PROGRAMMER) --version 2>&1 | $(GREP) -q 0.7 ; then\ + $(DFU_PROGRAMMER) $(MCU) erase --force; \ + if [ "$(1)" ]; then \ + $(DFU_PROGRAMMER) $(MCU) flash --force --eeprom $(QUANTUM_PATH)/split_common/$(1);\ + fi; \ + $(DFU_PROGRAMMER) $(MCU) flash --force $(BUILD_DIR)/$(TARGET).hex;\ + else \ + $(DFU_PROGRAMMER) $(MCU) erase; \ + if [ "$(1)" ]; then \ + $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(QUANTUM_PATH)/split_common/$(1);\ + fi; \ + $(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex;\ + fi; \ + $(DFU_PROGRAMMER) $(MCU) reset +endef + +dfu: $(BUILD_DIR)/$(TARGET).hex cpfirmware check-size + $(call EXEC_DFU) + +dfu-start: + $(DFU_PROGRAMMER) $(MCU) reset + $(DFU_PROGRAMMER) $(MCU) start + +dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep + if $(DFU_PROGRAMMER) --version 2>&1 | $(GREP) -q 0.7 ; then\ + $(DFU_PROGRAMMER) $(MCU) flash --force --eeprom $(BUILD_DIR)/$(TARGET).eep;\ + else\ + $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep;\ + fi + $(DFU_PROGRAMMER) $(MCU) reset + +dfu-split-left: $(BUILD_DIR)/$(TARGET).hex cpfirmware check-size + $(call EXEC_DFU,eeprom-lefthand.eep) + +dfu-split-right: $(BUILD_DIR)/$(TARGET).hex cpfirmware check-size + $(call EXEC_DFU,eeprom-righthand.eep) + +AVRDUDE_PROGRAMMER ?= avrdude + +define EXEC_AVRDUDE + list_devices() { \ + if $(GREP) -q -s icrosoft /proc/version; then \ + wmic.exe path Win32_SerialPort get DeviceID 2>/dev/null | LANG=C perl -pne 's/COM(\d+)/COM.($$1-1)/e' | sed 's!COM!/dev/ttyS!' | xargs echo -n | sort; \ + elif [ "`uname`" = "FreeBSD" ]; then \ + ls /dev/tty* | grep -v '\.lock$$' | grep -v '\.init$$'; \ + else \ + ls /dev/tty*; \ + fi; \ + }; \ + USB= ;\ + printf "Waiting for USB serial port - reset your controller now (Ctrl+C to cancel)"; \ + TMP1=`mktemp`; \ + TMP2=`mktemp`; \ + list_devices > $$TMP1; \ + while [ -z "$$USB" ]; do \ + sleep $(BOOTLOADER_RETRY_TIME); \ + printf "."; \ + list_devices > $$TMP2; \ + USB=`comm -13 $$TMP1 $$TMP2 | $(GREP) -o '/dev/tty.*'`; \ + mv $$TMP2 $$TMP1; \ + done; \ + rm $$TMP1; \ + echo ""; \ + echo "Device $$USB has appeared; assuming it is the controller."; \ + if $(GREP) -q -s 'MINGW\|MSYS\|icrosoft' /proc/version; then \ + USB=`echo "$$USB" | LANG=C perl -pne 's/\/dev\/ttyS(\d+)/COM.($$1+1)/e'`; \ + echo "Remapped USB port to $$USB"; \ + sleep 1; \ + else \ + printf "Waiting for $$USB to become writable."; \ + while [ ! -w "$$USB" ]; do sleep $(BOOTLOADER_RETRY_TIME); printf "."; done; echo ""; \ + fi; \ + if [ -z "$(1)" ]; then \ + $(AVRDUDE_PROGRAMMER) -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex; \ + else \ + $(AVRDUDE_PROGRAMMER) -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex -U eeprom:w:$(QUANTUM_PATH)/split_common/$(1); \ + fi +endef + +avrdude: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware + $(call EXEC_AVRDUDE) + +avrdude-loop: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware + while true; do \ + $(call EXEC_AVRDUDE) ; \ + done + +avrdude-split-left: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware + $(call EXEC_AVRDUDE,eeprom-lefthand.eep) + +avrdude-split-right: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware + $(call EXEC_AVRDUDE,eeprom-righthand.eep) + +define EXEC_USBASP + $(AVRDUDE_PROGRAMMER) -p $(AVRDUDE_MCU) -c usbasp -U flash:w:$(BUILD_DIR)/$(TARGET).hex +endef + +usbasp: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware + $(call EXEC_USBASP) + +BOOTLOADHID_PROGRAMMER ?= bootloadHID + +# bootloadHid executable has no cross platform detect methods +# so keep running bootloadHid if the output contains "The specified device was not found" +define EXEC_BOOTLOADHID + until $(BOOTLOADHID_PROGRAMMER) -r $(BUILD_DIR)/$(TARGET).hex 2>&1 | tee /dev/stderr | grep -v "device was not found"; do\ + printf "$(MSG_BOOTLOADER_NOT_FOUND)" ;\ + sleep 5 ;\ + done +endef + +bootloadhid: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware + $(call EXEC_BOOTLOADHID) + +HID_BOOTLOADER_CLI ?= hid_bootloader_cli + +define EXEC_HID_LUFA + $(HID_BOOTLOADER_CLI) -mmcu=$(MCU) -w -v $(BUILD_DIR)/$(TARGET).hex +endef + +hid_bootloader: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware + $(call EXEC_HID_LUFA) + +flash: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware +ifneq ($(strip $(PROGRAM_CMD)),) + $(UNSYNC_OUTPUT_CMD) && $(PROGRAM_CMD) +else ifeq ($(strip $(BOOTLOADER)), caterina) + $(UNSYNC_OUTPUT_CMD) && $(call EXEC_AVRDUDE) +else ifeq ($(strip $(BOOTLOADER)), halfkay) + $(UNSYNC_OUTPUT_CMD) && $(call EXEC_TEENSY) +else ifeq (dfu,$(findstring dfu,$(BOOTLOADER))) + $(UNSYNC_OUTPUT_CMD) && $(call EXEC_DFU) +else ifneq (,$(filter $(BOOTLOADER), usbasploader USBasp)) + $(UNSYNC_OUTPUT_CMD) && $(call EXEC_USBASP) +else ifneq (,$(filter $(BOOTLOADER), bootloadhid bootloadHID)) + $(UNSYNC_OUTPUT_CMD) && $(call EXEC_BOOTLOADHID) +else ifeq ($(strip $(BOOTLOADER)), qmk-hid) + $(UNSYNC_OUTPUT_CMD) && $(call EXEC_HID_LUFA) +else + $(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_BOOTLOADER)" +endif diff --git a/platforms/chibios/BLACKPILL_STM32_F401/board/board.mk b/platforms/chibios/boards/BLACKPILL_STM32_F401/board/board.mk index fddf7dace4..fddf7dace4 100644 --- a/platforms/chibios/BLACKPILL_STM32_F401/board/board.mk +++ b/platforms/chibios/boards/BLACKPILL_STM32_F401/board/board.mk diff --git a/platforms/chibios/BLACKPILL_STM32_F401/configs/board.h b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/board.h index 30af6b0c86..30af6b0c86 100644 --- a/platforms/chibios/BLACKPILL_STM32_F401/configs/board.h +++ b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/board.h diff --git a/platforms/chibios/BLACKPILL_STM32_F401/configs/bootloader_defs.h b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/bootloader_defs.h index 4da3d39a32..4da3d39a32 100644 --- a/platforms/chibios/BLACKPILL_STM32_F401/configs/bootloader_defs.h +++ b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/bootloader_defs.h diff --git a/platforms/chibios/BLACKPILL_STM32_F401/configs/config.h b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/config.h index e181422eba..e181422eba 100644 --- a/platforms/chibios/BLACKPILL_STM32_F401/configs/config.h +++ b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/config.h diff --git a/platforms/chibios/BLACKPILL_STM32_F401/configs/mcuconf.h b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/mcuconf.h index ba6e934fe7..ba6e934fe7 100644 --- a/platforms/chibios/BLACKPILL_STM32_F401/configs/mcuconf.h +++ b/platforms/chibios/boards/BLACKPILL_STM32_F401/configs/mcuconf.h diff --git a/platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xC_tinyuf2.ld b/platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xC_tinyuf2.ld new file mode 100644 index 0000000000..f4e487dc8f --- /dev/null +++ b/platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xC_tinyuf2.ld @@ -0,0 +1,88 @@ +/* + ChibiOS - Copyright (C) 2006..2018 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. +*/ + +/* + * STM32F401xC memory setup. + */ +MEMORY +{ + flash0 (rx) : org = 0x08000000 + 64k, len = 256k - 64k /* tinyuf2 bootloader requires app to be located at 64k offset for this MCU */ + flash1 (rx) : org = 0x00000000, len = 0 + flash2 (rx) : org = 0x00000000, len = 0 + flash3 (rx) : org = 0x00000000, len = 0 + flash4 (rx) : org = 0x00000000, len = 0 + flash5 (rx) : org = 0x00000000, len = 0 + flash6 (rx) : org = 0x00000000, len = 0 + flash7 (rx) : org = 0x00000000, len = 0 + ram0 (wx) : org = 0x20000000, len = 64k + ram1 (wx) : org = 0x00000000, len = 0 + ram2 (wx) : org = 0x00000000, len = 0 + ram3 (wx) : org = 0x00000000, len = 0 + ram4 (wx) : org = 0x00000000, len = 0 + ram5 (wx) : org = 0x00000000, len = 0 + ram6 (wx) : org = 0x00000000, len = 0 + ram7 (wx) : org = 0x00000000, len = 0 +} + +/* For each data/text section two region are defined, a virtual region + and a load region (_LMA suffix).*/ + +/* Flash region to be used for exception vectors.*/ +REGION_ALIAS("VECTORS_FLASH", flash0); +REGION_ALIAS("VECTORS_FLASH_LMA", flash0); + +/* Flash region to be used for constructors and destructors.*/ +REGION_ALIAS("XTORS_FLASH", flash0); +REGION_ALIAS("XTORS_FLASH_LMA", flash0); + +/* Flash region to be used for code text.*/ +REGION_ALIAS("TEXT_FLASH", flash0); +REGION_ALIAS("TEXT_FLASH_LMA", flash0); + +/* Flash region to be used for read only data.*/ +REGION_ALIAS("RODATA_FLASH", flash0); +REGION_ALIAS("RODATA_FLASH_LMA", flash0); + +/* Flash region to be used for various.*/ +REGION_ALIAS("VARIOUS_FLASH", flash0); +REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); + +/* Flash region to be used for RAM(n) initialization data.*/ +REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); + +/* RAM region to be used for Main stack. This stack accommodates the processing + of all exceptions and interrupts.*/ +REGION_ALIAS("MAIN_STACK_RAM", ram0); + +/* RAM region to be used for the process stack. This is the stack used by + the main() function.*/ +REGION_ALIAS("PROCESS_STACK_RAM", ram0); + +/* RAM region to be used for data segment.*/ +REGION_ALIAS("DATA_RAM", ram0); +REGION_ALIAS("DATA_RAM_LMA", flash0); + +/* RAM region to be used for BSS segment.*/ +REGION_ALIAS("BSS_RAM", ram0); + +/* RAM region to be used for the default heap.*/ +REGION_ALIAS("HEAP_RAM", ram0); + +/* Generic rules inclusion.*/ +INCLUDE rules.ld + +/* TinyUF2 bootloader reset support */ +_board_dfu_dbl_tap = ORIGIN(ram0) + 64k - 4; /* this is based off the linker file for tinyuf2 */ diff --git a/platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xE_tinyuf2.ld b/platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xE_tinyuf2.ld new file mode 100644 index 0000000000..895d13fa32 --- /dev/null +++ b/platforms/chibios/boards/BLACKPILL_STM32_F401/ld/STM32F401xE_tinyuf2.ld @@ -0,0 +1,88 @@ +/* + ChibiOS - Copyright (C) 2006..2018 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. +*/ + +/* + * STM32F401xE memory setup. + */ +MEMORY +{ + flash0 (rx) : org = 0x08000000 + 64k, len = 512k - 64k /* tinyuf2 bootloader requires app to be located at 64k offset for this MCU */ + flash1 (rx) : org = 0x00000000, len = 0 + flash2 (rx) : org = 0x00000000, len = 0 + flash3 (rx) : org = 0x00000000, len = 0 + flash4 (rx) : org = 0x00000000, len = 0 + flash5 (rx) : org = 0x00000000, len = 0 + flash6 (rx) : org = 0x00000000, len = 0 + flash7 (rx) : org = 0x00000000, len = 0 + ram0 (wx) : org = 0x20000000, len = 96k + ram1 (wx) : org = 0x00000000, len = 0 + ram2 (wx) : org = 0x00000000, len = 0 + ram3 (wx) : org = 0x00000000, len = 0 + ram4 (wx) : org = 0x00000000, len = 0 + ram5 (wx) : org = 0x00000000, len = 0 + ram6 (wx) : org = 0x00000000, len = 0 + ram7 (wx) : org = 0x00000000, len = 0 +} + +/* For each data/text section two region are defined, a virtual region + and a load region (_LMA suffix).*/ + +/* Flash region to be used for exception vectors.*/ +REGION_ALIAS("VECTORS_FLASH", flash0); +REGION_ALIAS("VECTORS_FLASH_LMA", flash0); + +/* Flash region to be used for constructors and destructors.*/ +REGION_ALIAS("XTORS_FLASH", flash0); +REGION_ALIAS("XTORS_FLASH_LMA", flash0); + +/* Flash region to be used for code text.*/ +REGION_ALIAS("TEXT_FLASH", flash0); +REGION_ALIAS("TEXT_FLASH_LMA", flash0); + +/* Flash region to be used for read only data.*/ +REGION_ALIAS("RODATA_FLASH", flash0); +REGION_ALIAS("RODATA_FLASH_LMA", flash0); + +/* Flash region to be used for various.*/ +REGION_ALIAS("VARIOUS_FLASH", flash0); +REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); + +/* Flash region to be used for RAM(n) initialization data.*/ +REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); + +/* RAM region to be used for Main stack. This stack accommodates the processing + of all exceptions and interrupts.*/ +REGION_ALIAS("MAIN_STACK_RAM", ram0); + +/* RAM region to be used for the process stack. This is the stack used by + the main() function.*/ +REGION_ALIAS("PROCESS_STACK_RAM", ram0); + +/* RAM region to be used for data segment.*/ +REGION_ALIAS("DATA_RAM", ram0); +REGION_ALIAS("DATA_RAM_LMA", flash0); + +/* RAM region to be used for BSS segment.*/ +REGION_ALIAS("BSS_RAM", ram0); + +/* RAM region to be used for the default heap.*/ +REGION_ALIAS("HEAP_RAM", ram0); + +/* Generic rules inclusion.*/ +INCLUDE rules.ld + +/* TinyUF2 bootloader reset support */ +_board_dfu_dbl_tap = ORIGIN(ram0) + 64k - 4; /* this is based off the linker file for tinyuf2 */ diff --git a/platforms/chibios/BLACKPILL_STM32_F411/board/board.mk b/platforms/chibios/boards/BLACKPILL_STM32_F411/board/board.mk index bb00b1a2b0..bb00b1a2b0 100644 --- a/platforms/chibios/BLACKPILL_STM32_F411/board/board.mk +++ b/platforms/chibios/boards/BLACKPILL_STM32_F411/board/board.mk diff --git a/platforms/chibios/BLACKPILL_STM32_F411/configs/board.h b/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/board.h index 30af6b0c86..30af6b0c86 100644 --- a/platforms/chibios/BLACKPILL_STM32_F411/configs/board.h +++ b/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/board.h diff --git a/platforms/chibios/BLACKPILL_STM32_F411/configs/bootloader_defs.h b/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/bootloader_defs.h index 4da3d39a32..4da3d39a32 100644 --- a/platforms/chibios/BLACKPILL_STM32_F411/configs/bootloader_defs.h +++ b/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/bootloader_defs.h diff --git a/platforms/chibios/BLACKPILL_STM32_F411/configs/config.h b/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/config.h index e181422eba..e181422eba 100644 --- a/platforms/chibios/BLACKPILL_STM32_F411/configs/config.h +++ b/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/config.h diff --git a/platforms/chibios/BLACKPILL_STM32_F411/configs/mcuconf.h b/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/mcuconf.h index 0394ff56bb..0394ff56bb 100644 --- a/platforms/chibios/BLACKPILL_STM32_F411/configs/mcuconf.h +++ b/platforms/chibios/boards/BLACKPILL_STM32_F411/configs/mcuconf.h diff --git a/platforms/chibios/BLACKPILL_STM32_F411/ld/STM32F411xC_tinyuf2.ld b/platforms/chibios/boards/BLACKPILL_STM32_F411/ld/STM32F411xC_tinyuf2.ld index 82253d3de5..82253d3de5 100644 --- a/platforms/chibios/BLACKPILL_STM32_F411/ld/STM32F411xC_tinyuf2.ld +++ b/platforms/chibios/boards/BLACKPILL_STM32_F411/ld/STM32F411xC_tinyuf2.ld diff --git a/platforms/chibios/BLACKPILL_STM32_F411/ld/STM32F411xE_tinyuf2.ld b/platforms/chibios/boards/BLACKPILL_STM32_F411/ld/STM32F411xE_tinyuf2.ld index 1656c67bf7..1656c67bf7 100644 --- a/platforms/chibios/BLACKPILL_STM32_F411/ld/STM32F411xE_tinyuf2.ld +++ b/platforms/chibios/boards/BLACKPILL_STM32_F411/ld/STM32F411xE_tinyuf2.ld diff --git a/platforms/chibios/GENERIC_STM32_F042X6/board/board.c b/platforms/chibios/boards/GENERIC_STM32_F042X6/board/board.c index 0d7c88756a..0d7c88756a 100644 --- a/platforms/chibios/GENERIC_STM32_F042X6/board/board.c +++ b/platforms/chibios/boards/GENERIC_STM32_F042X6/board/board.c diff --git a/platforms/chibios/GENERIC_STM32_F042X6/board/board.h b/platforms/chibios/boards/GENERIC_STM32_F042X6/board/board.h index ee9d31e04a..ee9d31e04a 100644 --- a/platforms/chibios/GENERIC_STM32_F042X6/board/board.h +++ b/platforms/chibios/boards/GENERIC_STM32_F042X6/board/board.h diff --git a/platforms/chibios/GENERIC_STM32_F042X6/board/board.mk b/platforms/chibios/boards/GENERIC_STM32_F042X6/board/board.mk index 842e335905..842e335905 100644 --- a/platforms/chibios/GENERIC_STM32_F042X6/board/board.mk +++ b/platforms/chibios/boards/GENERIC_STM32_F042X6/board/board.mk diff --git a/platforms/chibios/GENERIC_STM32_F042X6/configs/bootloader_defs.h b/platforms/chibios/boards/GENERIC_STM32_F042X6/configs/bootloader_defs.h index 25113425a6..25113425a6 100644 --- a/platforms/chibios/GENERIC_STM32_F042X6/configs/bootloader_defs.h +++ b/platforms/chibios/boards/GENERIC_STM32_F042X6/configs/bootloader_defs.h diff --git a/platforms/chibios/GENERIC_STM32_F042X6/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_F042X6/configs/config.h index a73f0c0b47..a73f0c0b47 100644 --- a/platforms/chibios/GENERIC_STM32_F042X6/configs/config.h +++ b/platforms/chibios/boards/GENERIC_STM32_F042X6/configs/config.h diff --git a/platforms/chibios/GENERIC_STM32_F042X6/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F042X6/configs/mcuconf.h index 286e1230ce..286e1230ce 100644 --- a/platforms/chibios/GENERIC_STM32_F042X6/configs/mcuconf.h +++ b/platforms/chibios/boards/GENERIC_STM32_F042X6/configs/mcuconf.h diff --git a/platforms/chibios/GENERIC_STM32_F072XB/board/board.mk b/platforms/chibios/boards/GENERIC_STM32_F072XB/board/board.mk index 3f0e6c46e8..3f0e6c46e8 100644 --- a/platforms/chibios/GENERIC_STM32_F072XB/board/board.mk +++ b/platforms/chibios/boards/GENERIC_STM32_F072XB/board/board.mk diff --git a/platforms/chibios/GENERIC_STM32_F072XB/configs/board.h b/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/board.h index 30af6b0c86..30af6b0c86 100644 --- a/platforms/chibios/GENERIC_STM32_F072XB/configs/board.h +++ b/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/board.h diff --git a/platforms/chibios/GENERIC_STM32_F072XB/configs/bootloader_defs.h b/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/bootloader_defs.h index dccd0fa5d1..dccd0fa5d1 100644 --- a/platforms/chibios/GENERIC_STM32_F072XB/configs/bootloader_defs.h +++ b/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/bootloader_defs.h diff --git a/platforms/chibios/GENERIC_STM32_F072XB/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/config.h index a73f0c0b47..a73f0c0b47 100644 --- a/platforms/chibios/GENERIC_STM32_F072XB/configs/config.h +++ b/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/config.h diff --git a/platforms/chibios/GENERIC_STM32_F072XB/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/mcuconf.h index 32b2777a81..32b2777a81 100644 --- a/platforms/chibios/GENERIC_STM32_F072XB/configs/mcuconf.h +++ b/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/mcuconf.h diff --git a/platforms/chibios/GENERIC_STM32_F303XC/board/board.mk b/platforms/chibios/boards/GENERIC_STM32_F303XC/board/board.mk index f891e65247..f891e65247 100644 --- a/platforms/chibios/GENERIC_STM32_F303XC/board/board.mk +++ b/platforms/chibios/boards/GENERIC_STM32_F303XC/board/board.mk diff --git a/platforms/chibios/GENERIC_STM32_F303XC/configs/board.h b/platforms/chibios/boards/GENERIC_STM32_F303XC/configs/board.h index 97159964d0..97159964d0 100644 --- a/platforms/chibios/GENERIC_STM32_F303XC/configs/board.h +++ b/platforms/chibios/boards/GENERIC_STM32_F303XC/configs/board.h diff --git a/platforms/chibios/GENERIC_STM32_F303XC/configs/bootloader_defs.h b/platforms/chibios/boards/GENERIC_STM32_F303XC/configs/bootloader_defs.h index 87ac7b10dc..87ac7b10dc 100644 --- a/platforms/chibios/GENERIC_STM32_F303XC/configs/bootloader_defs.h +++ b/platforms/chibios/boards/GENERIC_STM32_F303XC/configs/bootloader_defs.h diff --git a/platforms/chibios/GENERIC_STM32_F303XC/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_F303XC/configs/config.h index a73f0c0b47..a73f0c0b47 100644 --- a/platforms/chibios/GENERIC_STM32_F303XC/configs/config.h +++ b/platforms/chibios/boards/GENERIC_STM32_F303XC/configs/config.h diff --git a/platforms/chibios/GENERIC_STM32_F303XC/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F303XC/configs/mcuconf.h index c6f5a8ac52..c6f5a8ac52 100644 --- a/platforms/chibios/GENERIC_STM32_F303XC/configs/mcuconf.h +++ b/platforms/chibios/boards/GENERIC_STM32_F303XC/configs/mcuconf.h diff --git a/platforms/chibios/boards/GENERIC_STM32_F407XE/board/board.mk b/platforms/chibios/boards/GENERIC_STM32_F407XE/board/board.mk new file mode 100644 index 0000000000..6c837bb8ee --- /dev/null +++ b/platforms/chibios/boards/GENERIC_STM32_F407XE/board/board.mk @@ -0,0 +1,9 @@ +# List of all the board related files. +BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_STM32F4_DISCOVERY/board.c + +# Required include directories +BOARDINC = $(CHIBIOS)/os/hal/boards/ST_STM32F4_DISCOVERY + +# Shared variables +ALLCSRC += $(BOARDSRC) +ALLINC += $(BOARDINC)
\ No newline at end of file diff --git a/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/board.h b/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/board.h new file mode 100644 index 0000000000..22c4e4cd7e --- /dev/null +++ b/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/board.h @@ -0,0 +1,24 @@ +/* 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 STM32_HSECLK 8000000 +// The following is required to disable the pull-down on PA9, when PA9 is used for the keyboard matrix: +#define BOARD_OTG_NOVBUSSENS + +#include_next "board.h" + +#undef STM32_HSE_BYPASS
\ No newline at end of file diff --git a/platforms/chibios/GENERIC_STM32_F446XE/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/config.h index cc52a953ed..cc52a953ed 100644 --- a/platforms/chibios/GENERIC_STM32_F446XE/configs/config.h +++ b/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/config.h diff --git a/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h new file mode 100644 index 0000000000..4be47fe1b0 --- /dev/null +++ b/platforms/chibios/boards/GENERIC_STM32_F407XE/configs/mcuconf.h @@ -0,0 +1,355 @@ +/* + ChibiOS - Copyright (C) 2006..2018 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 STM32F405_MCUCONF +#define STM32F415_MCUCONF +#define STM32F407_MCUCONF +#define STM32F417_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 8 +#define STM32_PLLN_VALUE 336 +#define STM32_PLLP_VALUE 2 +#define STM32_PLLQ_VALUE 7 +#define STM32_HPRE STM32_HPRE_DIV1 +#define STM32_PPRE1 STM32_PPRE1_DIV4 +#define STM32_PPRE2 STM32_PPRE2_DIV2 +#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 + +/* + * ADC driver system settings. + */ +#define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4 +#define STM32_ADC_USE_ADC1 FALSE +#define STM32_ADC_USE_ADC2 FALSE +#define STM32_ADC_USE_ADC3 FALSE +#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4) +#define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) +#define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) +#define STM32_ADC_ADC1_DMA_PRIORITY 2 +#define STM32_ADC_ADC2_DMA_PRIORITY 2 +#define STM32_ADC_ADC3_DMA_PRIORITY 2 +#define STM32_ADC_IRQ_PRIORITY 6 +#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6 +#define STM32_ADC_ADC2_DMA_IRQ_PRIORITY 6 +#define STM32_ADC_ADC3_DMA_IRQ_PRIORITY 6 + +/* + * CAN driver system settings. + */ +#define STM32_CAN_USE_CAN1 FALSE +#define STM32_CAN_USE_CAN2 FALSE +#define STM32_CAN_CAN1_IRQ_PRIORITY 11 +#define STM32_CAN_CAN2_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(1, 5) +#define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(1, 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_TIM6 FALSE +#define STM32_GPT_USE_TIM7 FALSE +#define STM32_GPT_USE_TIM8 FALSE +#define STM32_GPT_USE_TIM9 FALSE +#define STM32_GPT_USE_TIM11 FALSE +#define STM32_GPT_USE_TIM12 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. + */ +#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_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 + +/* + * MAC driver system settings. + */ +#define STM32_MAC_TRANSMIT_BUFFERS 2 +#define STM32_MAC_RECEIVE_BUFFERS 4 +#define STM32_MAC_BUFFERS_SIZE 1522 +#define STM32_MAC_PHY_TIMEOUT 100 +#define STM32_MAC_ETH1_CHANGE_PHY_STATE TRUE +#define STM32_MAC_ETH1_IRQ_PRIORITY 13 +#define STM32_MAC_IP_CHECKSUM_OFFLOAD 0 + +/* + * 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 +#define STM32_PWM_USE_TIM4 FALSE +#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 + +/* + * 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 + +/* + * SDC driver system settings. + */ +#define STM32_SDC_SDIO_DMA_PRIORITY 3 +#define STM32_SDC_SDIO_IRQ_PRIORITY 9 +#define STM32_SDC_WRITE_TIMEOUT_MS 1000 +#define STM32_SDC_READ_TIMEOUT_MS 1000 +#define STM32_SDC_CLOCK_ACTIVATION_DELAY 10 +#define STM32_SDC_SDIO_UNALIGNED_SUPPORT TRUE +#define STM32_SDC_SDIO_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) + +/* + * SERIAL driver system settings. + */ +#define STM32_SERIAL_USE_USART1 FALSE +#define STM32_SERIAL_USE_USART2 FALSE +#define STM32_SERIAL_USE_USART3 FALSE +#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. + */ +#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_USART3 FALSE +#define STM32_UART_USE_UART4 FALSE +#define STM32_UART_USE_UART5 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_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) +#define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) +#define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) +#define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) +#define STM32_UART_UART5_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) +#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 +#define STM32_UART_UART4_DMA_PRIORITY 0 +#define STM32_UART_UART5_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_USE_OTG2 FALSE +#define STM32_USB_OTG1_IRQ_PRIORITY 14 +#define STM32_USB_OTG2_IRQ_PRIORITY 14 +#define STM32_USB_OTG1_RX_FIFO_SIZE 512 +#define STM32_USB_OTG2_RX_FIFO_SIZE 1024 +#define STM32_USB_HOST_WAKEUP_DURATION 2 + +#define STM32_USB_OTG_THREAD_PRIO NORMALPRIO+1 +#define STM32_USB_OTG_THREAD_STACK_SIZE 128 + +/* + * WDG driver system settings. + */ +#define STM32_WDG_USE_IWDG FALSE + +#endif /* MCUCONF_H */ diff --git a/platforms/chibios/GENERIC_STM32_F446XE/board/board.mk b/platforms/chibios/boards/GENERIC_STM32_F446XE/board/board.mk index 57897941ca..57897941ca 100644 --- a/platforms/chibios/GENERIC_STM32_F446XE/board/board.mk +++ b/platforms/chibios/boards/GENERIC_STM32_F446XE/board/board.mk diff --git a/platforms/chibios/GENERIC_STM32_F446XE/configs/board.h b/platforms/chibios/boards/GENERIC_STM32_F446XE/configs/board.h index 80dfcffa99..80dfcffa99 100644 --- a/platforms/chibios/GENERIC_STM32_F446XE/configs/board.h +++ b/platforms/chibios/boards/GENERIC_STM32_F446XE/configs/board.h diff --git a/platforms/chibios/boards/GENERIC_STM32_F446XE/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_F446XE/configs/config.h new file mode 100644 index 0000000000..cc52a953ed --- /dev/null +++ b/platforms/chibios/boards/GENERIC_STM32_F446XE/configs/config.h @@ -0,0 +1,23 @@ +/* Copyright 2021 Andrei Purdea + * + * 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/>. + */ + +/* Address for jumping to bootloader on STM32 chips. */ +/* It is chip dependent, the correct number can be looked up by checking against ST's application note AN2606. + */ +#define STM32_BOOTLOADER_ADDRESS 0x1FFF0000 +#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP +# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE +#endif diff --git a/platforms/chibios/GENERIC_STM32_F446XE/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F446XE/configs/mcuconf.h index d2de75590e..d2de75590e 100644 --- a/platforms/chibios/GENERIC_STM32_F446XE/configs/mcuconf.h +++ b/platforms/chibios/boards/GENERIC_STM32_F446XE/configs/mcuconf.h diff --git a/platforms/chibios/GENERIC_STM32_G431XB/board/board.mk b/platforms/chibios/boards/GENERIC_STM32_G431XB/board/board.mk index 0acbcd83c7..0acbcd83c7 100644 --- a/platforms/chibios/GENERIC_STM32_G431XB/board/board.mk +++ b/platforms/chibios/boards/GENERIC_STM32_G431XB/board/board.mk diff --git a/platforms/chibios/GENERIC_STM32_G431XB/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_G431XB/configs/config.h index 39ce627e77..39ce627e77 100644 --- a/platforms/chibios/GENERIC_STM32_G431XB/configs/config.h +++ b/platforms/chibios/boards/GENERIC_STM32_G431XB/configs/config.h diff --git a/platforms/chibios/GENERIC_STM32_G431XB/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_G431XB/configs/mcuconf.h index 182d4885d7..182d4885d7 100644 --- a/platforms/chibios/GENERIC_STM32_G431XB/configs/mcuconf.h +++ b/platforms/chibios/boards/GENERIC_STM32_G431XB/configs/mcuconf.h diff --git a/platforms/chibios/GENERIC_STM32_G474XE/board/board.mk b/platforms/chibios/boards/GENERIC_STM32_G474XE/board/board.mk index 957adf509b..957adf509b 100644 --- a/platforms/chibios/GENERIC_STM32_G474XE/board/board.mk +++ b/platforms/chibios/boards/GENERIC_STM32_G474XE/board/board.mk diff --git a/platforms/chibios/GENERIC_STM32_G474XE/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_G474XE/configs/config.h index eb74d68e85..eb74d68e85 100644 --- a/platforms/chibios/GENERIC_STM32_G474XE/configs/config.h +++ b/platforms/chibios/boards/GENERIC_STM32_G474XE/configs/config.h diff --git a/platforms/chibios/GENERIC_STM32_G474XE/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_G474XE/configs/mcuconf.h index 117e920e3b..117e920e3b 100644 --- a/platforms/chibios/GENERIC_STM32_G474XE/configs/mcuconf.h +++ b/platforms/chibios/boards/GENERIC_STM32_G474XE/configs/mcuconf.h diff --git a/platforms/chibios/GENERIC_STM32_L433XC/board/board.mk b/platforms/chibios/boards/GENERIC_STM32_L412XB/board/board.mk index 1250385eb8..1250385eb8 100644 --- a/platforms/chibios/GENERIC_STM32_L433XC/board/board.mk +++ b/platforms/chibios/boards/GENERIC_STM32_L412XB/board/board.mk diff --git a/platforms/chibios/GENERIC_STM32_L433XC/configs/board.h b/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/board.h index 51f9724f94..2e37d95fe3 100644 --- a/platforms/chibios/GENERIC_STM32_L433XC/configs/board.h +++ b/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/board.h @@ -19,6 +19,6 @@ #undef STM32L432xx -// Pretend that we're an L443xx as the ChibiOS definitions for L432/L433 mistakenly don't enable GPIOH, I2C2, or SPI2. +// 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 diff --git a/platforms/chibios/GENERIC_STM32_L433XC/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/config.h index c27c61b19a..c27c61b19a 100644 --- a/platforms/chibios/GENERIC_STM32_L433XC/configs/config.h +++ b/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/config.h diff --git a/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/mcuconf.h new file mode 100644 index 0000000000..8ad5a8da21 --- /dev/null +++ b/platforms/chibios/boards/GENERIC_STM32_L412XB/configs/mcuconf.h @@ -0,0 +1,282 @@ +/* + ChibiOS - Copyright (C) 2006..2018 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. +*/ + +/* + * STM32L4xx 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. + */ + +#ifndef MCUCONF_H +#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. + */ +#define STM32_NO_INIT FALSE +#define STM32_VOS STM32_VOS_RANGE1 +#define STM32_PVD_ENABLE FALSE +#define STM32_PLS STM32_PLS_LEV0 +#define STM32_HSI16_ENABLED TRUE +#define STM32_HSI48_ENABLED TRUE +#define STM32_LSI_ENABLED FALSE +#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_PLLP_VALUE 7 +#define STM32_PLLQ_VALUE 4 +#define STM32_PLLR_VALUE 4 +#define STM32_HPRE STM32_HPRE_DIV1 +#define STM32_PPRE1 STM32_PPRE1_DIV1 +#define STM32_PPRE2 STM32_PPRE2_DIV1 +#define STM32_STOPWUCK STM32_STOPWUCK_MSI +#define STM32_MCOSEL STM32_MCOSEL_NOCLOCK +#define STM32_MCOPRE STM32_MCOPRE_DIV1 +#define STM32_LSCOSEL STM32_LSCOSEL_NOCLOCK +#define STM32_PLLSAI1N_VALUE 72 +#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 +#define STM32_RTCSEL STM32_RTCSEL_LSI + +/* + * 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_EXTI1635_38_PRIORITY 6 +#define STM32_IRQ_EXTI18_PRIORITY 6 +#define STM32_IRQ_EXTI19_PRIORITY 6 +#define STM32_IRQ_EXTI20_PRIORITY 6 +#define STM32_IRQ_EXTI21_22_PRIORITY 15 + +#define STM32_IRQ_TIM1_BRK_TIM15_PRIORITY 7 +#define STM32_IRQ_TIM1_UP_TIM16_PRIORITY 7 +#define STM32_IRQ_TIM1_TRGCO_TIM17_PRIORITY 7 +#define STM32_IRQ_TIM1_CC_PRIORITY 7 +#define STM32_IRQ_TIM2_PRIORITY 7 +#define STM32_IRQ_TIM6_PRIORITY 7 +#define STM32_IRQ_TIM7_PRIORITY 7 + +#define STM32_IRQ_USART1_PRIORITY 12 +#define STM32_IRQ_USART2_PRIORITY 12 +#define STM32_IRQ_USART3_PRIORITY 12 +#define STM32_IRQ_LPUART1_PRIORITY 12 + +/* + * ADC driver system settings. + */ +#define STM32_ADC_COMPACT_SAMPLES FALSE +#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_ADC12_IRQ_PRIORITY 5 +#define STM32_ADC_ADC1_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. + */ +#define STM32_GPT_USE_TIM1 FALSE +#define STM32_GPT_USE_TIM2 FALSE +#define STM32_GPT_USE_TIM6 FALSE +#define STM32_GPT_USE_TIM7 FALSE +#define STM32_GPT_USE_TIM15 FALSE +#define STM32_GPT_USE_TIM16 FALSE + +/* + * I2C driver system settings. + */ +#define STM32_I2C_USE_I2C1 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, 7) +#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) +#define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) +#define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) +#define STM32_I2C_I2C1_IRQ_PRIORITY 5 +#define STM32_I2C_I2C3_IRQ_PRIORITY 5 +#define STM32_I2C_I2C1_DMA_PRIORITY 3 +#define STM32_I2C_I2C3_DMA_PRIORITY 3 +#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure") + +/* + * ICU driver system settings. + */ +#define STM32_ICU_USE_TIM1 FALSE +#define STM32_ICU_USE_TIM2 FALSE +#define STM32_ICU_USE_TIM15 FALSE +#define STM32_ICU_USE_TIM16 FALSE + +/* + * 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 +#define STM32_PWM_USE_TIM16 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_LPUART1 FALSE +#define STM32_SERIAL_USART1_PRIORITY 12 +#define STM32_SERIAL_USART2_PRIORITY 12 +#define STM32_SERIAL_LPUART1_PRIORITY 12 + +/* + * 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") + +/* + * ST driver system settings. + */ +#define STM32_ST_IRQ_PRIORITY 8 +#define STM32_ST_USE_TIMER 2 + +/* + * TRNG driver system settings. + */ +#define STM32_TRNG_USE_RNG1 FALSE + +/* + * UART driver system settings. + */ +#define STM32_UART_USE_USART1 FALSE +#define STM32_UART_USE_USART2 FALSE +#define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) +#define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 6) +#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) +#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) +#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure") + +/* + * USB driver system settings. + */ +#define STM32_USB_USE_USB1 TRUE +#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE +#define STM32_USB_USB1_HP_IRQ_PRIORITY 13 +#define STM32_USB_USB1_LP_IRQ_PRIORITY 14 + +/* + * WDG driver system settings. + */ +#define STM32_WDG_USE_IWDG FALSE + +/* + * WSPI driver system settings. + */ +#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_L433XC/board/board.mk b/platforms/chibios/boards/GENERIC_STM32_L433XC/board/board.mk new file mode 100644 index 0000000000..1250385eb8 --- /dev/null +++ b/platforms/chibios/boards/GENERIC_STM32_L433XC/board/board.mk @@ -0,0 +1,9 @@ +# List of all the board related files. +BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO32_L432KC/board.c + +# Required include directories +BOARDINC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO32_L432KC + +# Shared variables +ALLCSRC += $(BOARDSRC) +ALLINC += $(BOARDINC) diff --git a/platforms/chibios/boards/GENERIC_STM32_L433XC/configs/board.h b/platforms/chibios/boards/GENERIC_STM32_L433XC/configs/board.h new file mode 100644 index 0000000000..2e37d95fe3 --- /dev/null +++ b/platforms/chibios/boards/GENERIC_STM32_L433XC/configs/board.h @@ -0,0 +1,24 @@ +/* Copyright 2018-2021 Harrison Chan (@Xelus) + * + * 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 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 diff --git a/platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h b/platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h new file mode 100644 index 0000000000..c27c61b19a --- /dev/null +++ b/platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h @@ -0,0 +1,26 @@ +/* Copyright 2018-2021 Harrison Chan (@Xelus) + * + * 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/>. + */ + +/* Address for jumping to bootloader on STM32 chips. */ +/* It is chip dependent, the correct number can be looked up by checking against ST's application note AN2606. + */ +#define STM32_BOOTLOADER_ADDRESS 0x1FFF0000 + +#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/GENERIC_STM32_L433XC/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_L433XC/configs/mcuconf.h index 948c740f6e..948c740f6e 100644 --- a/platforms/chibios/GENERIC_STM32_L433XC/configs/mcuconf.h +++ b/platforms/chibios/boards/GENERIC_STM32_L433XC/configs/mcuconf.h diff --git a/platforms/chibios/IC_TEENSY_3_1/board/board.c b/platforms/chibios/boards/IC_TEENSY_3_1/board/board.c index 36ae8051ee..424e0c975b 100644 --- a/platforms/chibios/IC_TEENSY_3_1/board/board.c +++ b/platforms/chibios/boards/IC_TEENSY_3_1/board/board.c @@ -144,3 +144,8 @@ void __early_init(void) { * @todo Add your board-specific code, if any. */ void boardInit(void) {} + + +void restart_usb_driver(USBDriver *usbp) { + // Do nothing. Restarting the USB driver on these boards breaks it. +} diff --git a/platforms/chibios/IC_TEENSY_3_1/board/board.h b/platforms/chibios/boards/IC_TEENSY_3_1/board/board.h index c8259ab0c7..c8259ab0c7 100644 --- a/platforms/chibios/IC_TEENSY_3_1/board/board.h +++ b/platforms/chibios/boards/IC_TEENSY_3_1/board/board.h diff --git a/platforms/chibios/IC_TEENSY_3_1/board/board.mk b/platforms/chibios/boards/IC_TEENSY_3_1/board/board.mk index 842e335905..842e335905 100644 --- a/platforms/chibios/IC_TEENSY_3_1/board/board.mk +++ b/platforms/chibios/boards/IC_TEENSY_3_1/board/board.mk diff --git a/platforms/chibios/boards/IC_TEENSY_4_1/board/board.mk b/platforms/chibios/boards/IC_TEENSY_4_1/board/board.mk new file mode 100644 index 0000000000..bc242ac3c5 --- /dev/null +++ b/platforms/chibios/boards/IC_TEENSY_4_1/board/board.mk @@ -0,0 +1 @@ +include $(CHIBIOS_CONTRIB)/os/hal/boards/PJRC_TEENSY_4_1/board.mk diff --git a/platforms/chibios/boards/IC_TEENSY_4_1/rules.mk b/platforms/chibios/boards/IC_TEENSY_4_1/rules.mk new file mode 100644 index 0000000000..0c62d209c5 --- /dev/null +++ b/platforms/chibios/boards/IC_TEENSY_4_1/rules.mk @@ -0,0 +1 @@ +TEENSY_LOADER_CLI_MCU = imxrt1062 diff --git a/platforms/chibios/QMK_PROTON_C/board/board.mk b/platforms/chibios/boards/QMK_PROTON_C/board/board.mk index f891e65247..f891e65247 100644 --- a/platforms/chibios/QMK_PROTON_C/board/board.mk +++ b/platforms/chibios/boards/QMK_PROTON_C/board/board.mk diff --git a/platforms/chibios/QMK_PROTON_C/configs/board.h b/platforms/chibios/boards/QMK_PROTON_C/configs/board.h index 97159964d0..97159964d0 100644 --- a/platforms/chibios/QMK_PROTON_C/configs/board.h +++ b/platforms/chibios/boards/QMK_PROTON_C/configs/board.h diff --git a/platforms/chibios/QMK_PROTON_C/configs/bootloader_defs.h b/platforms/chibios/boards/QMK_PROTON_C/configs/bootloader_defs.h index 3b0e9d20a6..3b0e9d20a6 100644 --- a/platforms/chibios/QMK_PROTON_C/configs/bootloader_defs.h +++ b/platforms/chibios/boards/QMK_PROTON_C/configs/bootloader_defs.h diff --git a/platforms/chibios/QMK_PROTON_C/configs/chconf.h b/platforms/chibios/boards/QMK_PROTON_C/configs/chconf.h index a1cbf68086..a1cbf68086 100644 --- a/platforms/chibios/QMK_PROTON_C/configs/chconf.h +++ b/platforms/chibios/boards/QMK_PROTON_C/configs/chconf.h diff --git a/platforms/chibios/QMK_PROTON_C/configs/config.h b/platforms/chibios/boards/QMK_PROTON_C/configs/config.h index a73f0c0b47..a73f0c0b47 100644 --- a/platforms/chibios/QMK_PROTON_C/configs/config.h +++ b/platforms/chibios/boards/QMK_PROTON_C/configs/config.h diff --git a/platforms/chibios/QMK_PROTON_C/configs/halconf.h b/platforms/chibios/boards/QMK_PROTON_C/configs/halconf.h index 41fbac29e0..d7a639a6d0 100644 --- a/platforms/chibios/QMK_PROTON_C/configs/halconf.h +++ b/platforms/chibios/boards/QMK_PROTON_C/configs/halconf.h @@ -412,7 +412,7 @@ * buffers. */ #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_BUFFERS_SIZE 16 +#define SERIAL_BUFFERS_SIZE 128 #endif /*===========================================================================*/ diff --git a/platforms/chibios/QMK_PROTON_C/configs/mcuconf.h b/platforms/chibios/boards/QMK_PROTON_C/configs/mcuconf.h index 4d7b586c08..4d7b586c08 100644 --- a/platforms/chibios/QMK_PROTON_C/configs/mcuconf.h +++ b/platforms/chibios/boards/QMK_PROTON_C/configs/mcuconf.h diff --git a/platforms/chibios/QMK_PROTON_C/convert_to_proton_c.mk b/platforms/chibios/boards/QMK_PROTON_C/convert_to_proton_c.mk index 0618154678..0618154678 100644 --- a/platforms/chibios/QMK_PROTON_C/convert_to_proton_c.mk +++ b/platforms/chibios/boards/QMK_PROTON_C/convert_to_proton_c.mk diff --git a/platforms/chibios/STM32_F103_STM32DUINO/board/board.c b/platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.c index 8a34e81f25..8a34e81f25 100644 --- a/platforms/chibios/STM32_F103_STM32DUINO/board/board.c +++ b/platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.c diff --git a/platforms/chibios/STM32_F103_STM32DUINO/board/board.h b/platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.h index 09d182d6ca..09d182d6ca 100644 --- a/platforms/chibios/STM32_F103_STM32DUINO/board/board.h +++ b/platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.h diff --git a/platforms/chibios/STM32_F103_STM32DUINO/board/board.mk b/platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.mk index 842e335905..842e335905 100644 --- a/platforms/chibios/STM32_F103_STM32DUINO/board/board.mk +++ b/platforms/chibios/boards/STM32_F103_STM32DUINO/board/board.mk diff --git a/platforms/chibios/STM32_F103_STM32DUINO/configs/mcuconf.h b/platforms/chibios/boards/STM32_F103_STM32DUINO/configs/mcuconf.h index 9945e7408d..9945e7408d 100644 --- a/platforms/chibios/STM32_F103_STM32DUINO/configs/mcuconf.h +++ b/platforms/chibios/boards/STM32_F103_STM32DUINO/configs/mcuconf.h diff --git a/platforms/chibios/boards/STM32_F103_STM32DUINO/ld/STM32F103x8_stm32duino_bootloader.ld b/platforms/chibios/boards/STM32_F103_STM32DUINO/ld/STM32F103x8_stm32duino_bootloader.ld new file mode 100644 index 0000000000..a4bd566b59 --- /dev/null +++ b/platforms/chibios/boards/STM32_F103_STM32DUINO/ld/STM32F103x8_stm32duino_bootloader.ld @@ -0,0 +1,22 @@ +/* + ChibiOS - Copyright (C) 2006..2016 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. +*/ + +/* + * STM32F103x8 memory setup for use with the STM32Duino bootloader. + */ +f103_flash_size = 64k; + +INCLUDE stm32duino_bootloader_common.ld diff --git a/platforms/chibios/boards/STM32_F103_STM32DUINO/ld/STM32F103xB_stm32duino_bootloader.ld b/platforms/chibios/boards/STM32_F103_STM32DUINO/ld/STM32F103xB_stm32duino_bootloader.ld new file mode 100644 index 0000000000..dc47400dc5 --- /dev/null +++ b/platforms/chibios/boards/STM32_F103_STM32DUINO/ld/STM32F103xB_stm32duino_bootloader.ld @@ -0,0 +1,22 @@ +/* + ChibiOS - Copyright (C) 2006..2016 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. +*/ + +/* + * STM32F103xB memory setup for use with the STM32Duino bootloader. + */ +f103_flash_size = 128k; + +INCLUDE stm32duino_bootloader_common.ld diff --git a/platforms/chibios/common/ld/STM32F103x8_stm32duino_bootloader.ld b/platforms/chibios/boards/STM32_F103_STM32DUINO/ld/stm32duino_bootloader_common.ld index bb852422a3..76cd3153be 100644 --- a/platforms/chibios/common/ld/STM32F103x8_stm32duino_bootloader.ld +++ b/platforms/chibios/boards/STM32_F103_STM32DUINO/ld/stm32duino_bootloader_common.ld @@ -15,11 +15,11 @@ */ /* - * ST32F103xB memory setup for use with the maplemini bootloader. + * STM32Duino bootloader common memory setup. */ MEMORY { - flash0 : org = 0x08002000, len = 64k - 0x2000 + flash0 : org = 0x08002000, len = f103_flash_size - 0x2000 flash1 : org = 0x00000000, len = 0 flash2 : org = 0x00000000, len = 0 flash3 : org = 0x00000000, len = 0 diff --git a/platforms/chibios/common/configs/chconf.h b/platforms/chibios/boards/common/configs/chconf.h index 44327a82d7..44327a82d7 100644 --- a/platforms/chibios/common/configs/chconf.h +++ b/platforms/chibios/boards/common/configs/chconf.h diff --git a/platforms/chibios/common/configs/halconf.h b/platforms/chibios/boards/common/configs/halconf.h index 264ae4e6c1..c80f67ee27 100644 --- a/platforms/chibios/common/configs/halconf.h +++ b/platforms/chibios/boards/common/configs/halconf.h @@ -412,7 +412,7 @@ * buffers. */ #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_BUFFERS_SIZE 16 +#define SERIAL_BUFFERS_SIZE 128 #endif /*===========================================================================*/ diff --git a/platforms/chibios/common/ld/MKL26Z64.ld b/platforms/chibios/boards/common/ld/MKL26Z64.ld index c4ca8b874c..c4ca8b874c 100644 --- a/platforms/chibios/common/ld/MKL26Z64.ld +++ b/platforms/chibios/boards/common/ld/MKL26Z64.ld diff --git a/platforms/chibios/boards/common/ld/STM32L412xB.ld b/platforms/chibios/boards/common/ld/STM32L412xB.ld new file mode 100644 index 0000000000..5718d6bc71 --- /dev/null +++ b/platforms/chibios/boards/common/ld/STM32L412xB.ld @@ -0,0 +1,85 @@ +/* + ChibiOS - Copyright (C) 2006..2016 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. +*/ + +/* + * STM32L412xB memory setup. + */ +MEMORY +{ + flash0 : org = 0x08000000, len = 128k + flash1 : org = 0x00000000, len = 0 + flash2 : org = 0x00000000, len = 0 + flash3 : org = 0x00000000, len = 0 + flash4 : org = 0x00000000, len = 0 + flash5 : org = 0x00000000, len = 0 + flash6 : org = 0x00000000, len = 0 + flash7 : org = 0x00000000, len = 0 + ram0 : org = 0x20000000, len = 32k + ram1 : org = 0x00000000, len = 0 + ram2 : org = 0x00000000, len = 0 + ram3 : org = 0x00000000, len = 0 + ram4 : org = 0x00000000, len = 0 + ram5 : org = 0x00000000, len = 0 + ram6 : org = 0x00000000, len = 0 + ram7 : org = 0x00000000, len = 0 +} + +/* For each data/text section two region are defined, a virtual region + and a load region (_LMA suffix).*/ + +/* Flash region to be used for exception vectors.*/ +REGION_ALIAS("VECTORS_FLASH", flash0); +REGION_ALIAS("VECTORS_FLASH_LMA", flash0); + +/* Flash region to be used for constructors and destructors.*/ +REGION_ALIAS("XTORS_FLASH", flash0); +REGION_ALIAS("XTORS_FLASH_LMA", flash0); + +/* Flash region to be used for code text.*/ +REGION_ALIAS("TEXT_FLASH", flash0); +REGION_ALIAS("TEXT_FLASH_LMA", flash0); + +/* Flash region to be used for read only data.*/ +REGION_ALIAS("RODATA_FLASH", flash0); +REGION_ALIAS("RODATA_FLASH_LMA", flash0); + +/* Flash region to be used for various.*/ +REGION_ALIAS("VARIOUS_FLASH", flash0); +REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); + +/* Flash region to be used for RAM(n) initialization data.*/ +REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); + +/* RAM region to be used for Main stack. This stack accommodates the processing + of all exceptions and interrupts.*/ +REGION_ALIAS("MAIN_STACK_RAM", ram0); + +/* RAM region to be used for the process stack. This is the stack used by + the main() function.*/ +REGION_ALIAS("PROCESS_STACK_RAM", ram0); + +/* RAM region to be used for data segment.*/ +REGION_ALIAS("DATA_RAM", ram0); +REGION_ALIAS("DATA_RAM_LMA", flash0); + +/* RAM region to be used for BSS segment.*/ +REGION_ALIAS("BSS_RAM", ram0); + +/* RAM region to be used for the default heap.*/ +REGION_ALIAS("HEAP_RAM", ram0); + +/* Generic rules inclusion.*/ +INCLUDE rules.ld diff --git a/platforms/chibios/keyboard-config-templates/board.h b/platforms/chibios/boards/keyboard-config-templates/board.h index 5b840c389c..5b840c389c 100644 --- a/platforms/chibios/keyboard-config-templates/board.h +++ b/platforms/chibios/boards/keyboard-config-templates/board.h diff --git a/platforms/chibios/keyboard-config-templates/chconf.h b/platforms/chibios/boards/keyboard-config-templates/chconf.h index fca444747c..fca444747c 100644 --- a/platforms/chibios/keyboard-config-templates/chconf.h +++ b/platforms/chibios/boards/keyboard-config-templates/chconf.h diff --git a/platforms/chibios/keyboard-config-templates/halconf.h b/platforms/chibios/boards/keyboard-config-templates/halconf.h index 456020f16a..456020f16a 100644 --- a/platforms/chibios/keyboard-config-templates/halconf.h +++ b/platforms/chibios/boards/keyboard-config-templates/halconf.h diff --git a/platforms/chibios/keyboard-config-templates/mcuconf.h b/platforms/chibios/boards/keyboard-config-templates/mcuconf.h index c690b02f4b..c690b02f4b 100644 --- a/platforms/chibios/keyboard-config-templates/mcuconf.h +++ b/platforms/chibios/boards/keyboard-config-templates/mcuconf.h diff --git a/drivers/chibios/analog.c b/platforms/chibios/drivers/analog.c index 8c476fcac2..8c476fcac2 100644 --- a/drivers/chibios/analog.c +++ b/platforms/chibios/drivers/analog.c diff --git a/drivers/chibios/analog.h b/platforms/chibios/drivers/analog.h index e61c394265..e61c394265 100644 --- a/drivers/chibios/analog.h +++ b/platforms/chibios/drivers/analog.h diff --git a/drivers/eeprom/eeprom_stm32_L0_L1.c b/platforms/chibios/drivers/eeprom/eeprom_stm32_L0_L1.c index ed26cc7145..ed26cc7145 100644 --- a/drivers/eeprom/eeprom_stm32_L0_L1.c +++ b/platforms/chibios/drivers/eeprom/eeprom_stm32_L0_L1.c diff --git a/drivers/eeprom/eeprom_stm32_L0_L1.h b/platforms/chibios/drivers/eeprom/eeprom_stm32_L0_L1.h index a35defca8b..a35defca8b 100644 --- a/drivers/eeprom/eeprom_stm32_L0_L1.h +++ b/platforms/chibios/drivers/eeprom/eeprom_stm32_L0_L1.h diff --git a/drivers/chibios/i2c_master.c b/platforms/chibios/drivers/i2c_master.c index fc4bb2ab37..fc4bb2ab37 100644 --- a/drivers/chibios/i2c_master.c +++ b/platforms/chibios/drivers/i2c_master.c diff --git a/drivers/chibios/i2c_master.h b/platforms/chibios/drivers/i2c_master.h index c68109acbd..c68109acbd 100644 --- a/drivers/chibios/i2c_master.h +++ b/platforms/chibios/drivers/i2c_master.h diff --git a/drivers/chibios/serial.c b/platforms/chibios/drivers/serial.c index 54f7e1321f..f54fbcee4e 100644 --- a/drivers/chibios/serial.c +++ b/platforms/chibios/drivers/serial.c @@ -74,21 +74,12 @@ static THD_FUNCTION(Thread1, arg) { } } -static SSTD_t *Transaction_table = NULL; -static uint8_t Transaction_table_size = 0; - -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; - +void soft_serial_initiator_init(void) { 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; - +void soft_serial_target_init(void) { serial_input(); palEnablePadEvent(PAL_PORT(SOFT_SERIAL_PIN), PAL_PAD(SOFT_SERIAL_PIN), PAL_EVENT_MODE_FALLING_EDGE); @@ -154,16 +145,14 @@ void interrupt_handler(void *arg) { uint8_t checksum_computed = 0; int sstd_index = 0; -#ifdef SERIAL_USE_MULTI_TRANSACTION sstd_index = serial_read_byte(); sync_send(); -#endif - SSTD_t *trans = &Transaction_table[sstd_index]; + split_transaction_desc_t *trans = &split_transaction_table[sstd_index]; for (int i = 0; i < trans->initiator2target_buffer_size; ++i) { - trans->initiator2target_buffer[i] = serial_read_byte(); + split_trans_initiator2target_buffer(trans)[i] = serial_read_byte(); sync_send(); - checksum_computed += trans->initiator2target_buffer[i]; + checksum_computed += split_trans_initiator2target_buffer(trans)[i]; } checksum_computed ^= 7; uint8_t checksum_received = serial_read_byte(); @@ -172,12 +161,17 @@ void interrupt_handler(void *arg) { // wait for the sync to finish sending serial_delay(); + // Allow any slave processing to occur + if (trans->slave_callback) { + trans->slave_callback(trans->initiator2target_buffer_size, split_trans_initiator2target_buffer(trans), trans->target2initiator_buffer_size, split_trans_target2initiator_buffer(trans)); + } + uint8_t checksum = 0; for (int i = 0; i < trans->target2initiator_buffer_size; ++i) { - serial_write_byte(trans->target2initiator_buffer[i]); + serial_write_byte(split_trans_target2initiator_buffer(trans)[i]); sync_send(); serial_delay_half(); - checksum += trans->target2initiator_buffer[i]; + checksum += split_trans_target2initiator_buffer(trans)[i]; } serial_write_byte(checksum ^ 7); sync_send(); @@ -206,15 +200,10 @@ void interrupt_handler(void *arg) { // 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) { - int sstd_index = 0; -#else int soft_serial_transaction(int sstd_index) { -#endif - - if (sstd_index > Transaction_table_size) return TRANSACTION_TYPE_ERROR; - SSTD_t *trans = &Transaction_table[sstd_index]; + if (sstd_index > NUM_TOTAL_TRANSACTIONS) return TRANSACTION_TYPE_ERROR; + split_transaction_desc_t *trans = &split_transaction_table[sstd_index]; + if (!trans->status) return TRANSACTION_TYPE_ERROR; // not registered // TODO: remove extra delay between transactions serial_delay(); @@ -244,14 +233,13 @@ int soft_serial_transaction(int sstd_index) { uint8_t checksum = 0; // send data to the slave -#ifdef SERIAL_USE_MULTI_TRANSACTION serial_write_byte(sstd_index); // first chunk is transaction id sync_recv(); -#endif + for (int i = 0; i < trans->initiator2target_buffer_size; ++i) { - serial_write_byte(trans->initiator2target_buffer[i]); + serial_write_byte(split_trans_initiator2target_buffer(trans)[i]); sync_recv(); - checksum += trans->initiator2target_buffer[i]; + checksum += split_trans_initiator2target_buffer(trans)[i]; } serial_write_byte(checksum ^ 7); sync_recv(); @@ -262,9 +250,9 @@ int soft_serial_transaction(int sstd_index) { // receive data from the slave uint8_t checksum_computed = 0; for (int i = 0; i < trans->target2initiator_buffer_size; ++i) { - trans->target2initiator_buffer[i] = serial_read_byte(); + split_trans_target2initiator_buffer(trans)[i] = serial_read_byte(); sync_recv(); - checksum_computed += trans->target2initiator_buffer[i]; + checksum_computed += split_trans_target2initiator_buffer(trans)[i]; } checksum_computed ^= 7; uint8_t checksum_received = serial_read_byte(); diff --git a/platforms/chibios/drivers/serial_usart.c b/platforms/chibios/drivers/serial_usart.c new file mode 100644 index 0000000000..ea4473791c --- /dev/null +++ b/platforms/chibios/drivers/serial_usart.c @@ -0,0 +1,318 @@ +/* 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 "serial_usart.h" + +#if defined(SERIAL_USART_CONFIG) +static SerialConfig serial_config = SERIAL_USART_CONFIG; +#else +static SerialConfig serial_config = { + .speed = (SERIAL_USART_SPEED), /* speed - mandatory */ + .cr1 = (SERIAL_USART_CR1), + .cr2 = (SERIAL_USART_CR2), +# if !defined(SERIAL_USART_FULL_DUPLEX) + .cr3 = ((SERIAL_USART_CR3) | USART_CR3_HDSEL) /* activate half-duplex mode */ +# else + .cr3 = (SERIAL_USART_CR3) +# endif +}; +#endif + +static SerialDriver* serial_driver = &SERIAL_USART_DRIVER; + +static inline bool react_to_transactions(void); +static inline bool __attribute__((nonnull)) receive(uint8_t* destination, const size_t size); +static inline bool __attribute__((nonnull)) send(const uint8_t* source, const size_t size); +static inline int initiate_transaction(uint8_t sstd_index); +static inline void usart_clear(void); + +/** + * @brief Clear the receive input queue. + */ +static inline void usart_clear(void) { + osalSysLock(); + bool volatile queue_not_empty = !iqIsEmptyI(&serial_driver->iqueue); + osalSysUnlock(); + + while (queue_not_empty) { + osalSysLock(); + /* Hard reset the input queue. */ + iqResetI(&serial_driver->iqueue); + osalSysUnlock(); + /* Allow pending interrupts to preempt. + * Do not merge the lock/unlock blocks into one + * or the code will not work properly. + * The empty read adds a tiny amount of delay. */ + (void)queue_not_empty; + osalSysLock(); + queue_not_empty = !iqIsEmptyI(&serial_driver->iqueue); + osalSysUnlock(); + } +} + +/** + * @brief Blocking send of buffer with timeout. + * + * @return true Send success. + * @return false Send failed. + */ +static inline bool send(const uint8_t* source, const size_t size) { + bool success = (size_t)sdWriteTimeout(serial_driver, source, size, TIME_MS2I(SERIAL_USART_TIMEOUT)) == size; + +#if !defined(SERIAL_USART_FULL_DUPLEX) + if (success) { + /* Half duplex fills the input queue with the data we wrote - just throw it away. + Under the right circumstances (e.g. bad cables paired with high baud rates) + less bytes can be present in the input queue, therefore a timeout is needed. */ + uint8_t dump[size]; + return receive(dump, size); + } +#endif + + return success; +} + +/** + * @brief Blocking receive of size * bytes with timeout. + * + * @return true Receive success. + * @return false Receive failed. + */ +static inline bool receive(uint8_t* destination, const size_t size) { + bool success = (size_t)sdReadTimeout(serial_driver, destination, size, TIME_MS2I(SERIAL_USART_TIMEOUT)) == size; + return success; +} + +#if !defined(SERIAL_USART_FULL_DUPLEX) + +/** + * @brief Initiate pins for USART peripheral. Half-duplex configuration. + */ +__attribute__((weak)) void usart_init(void) { +# if defined(MCU_STM32) +# if defined(USE_GPIOV1) + palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_STM32_ALTERNATE_OPENDRAIN); +# else + palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_ALTERNATE(SERIAL_USART_TX_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN); +# endif + +# if defined(USART_REMAP) + USART_REMAP; +# endif +# else +# pragma message "usart_init: MCU Familiy not supported by default, please supply your own init code by implementing usart_init() in your keyboard files." +# endif +} + +#else + +/** + * @brief Initiate pins for USART peripheral. Full-duplex configuration. + */ +__attribute__((weak)) void usart_init(void) { +# if defined(MCU_STM32) +# if defined(USE_GPIOV1) + palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_STM32_ALTERNATE_PUSHPULL); + palSetLineMode(SERIAL_USART_RX_PIN, PAL_MODE_INPUT); +# else + palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_ALTERNATE(SERIAL_USART_TX_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); + palSetLineMode(SERIAL_USART_RX_PIN, PAL_MODE_ALTERNATE(SERIAL_USART_RX_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); +# endif + +# if defined(USART_REMAP) + USART_REMAP; +# endif +# else +# pragma message "usart_init: MCU Familiy not supported by default, please supply your own init code by implementing usart_init() in your keyboard files." +# endif +} + +#endif + +/** + * @brief Overridable master specific initializations. + */ +__attribute__((weak, nonnull)) void usart_master_init(SerialDriver** driver) { + (void)driver; + usart_init(); +} + +/** + * @brief Overridable slave specific initializations. + */ +__attribute__((weak, nonnull)) void usart_slave_init(SerialDriver** driver) { + (void)driver; + usart_init(); +} + +/** + * @brief This thread runs on the slave and responds to transactions initiated + * by the master. + */ +static THD_WORKING_AREA(waSlaveThread, 1024); +static THD_FUNCTION(SlaveThread, arg) { + (void)arg; + chRegSetThreadName("usart_tx_rx"); + + while (true) { + if (!react_to_transactions()) { + /* Clear the receive queue, to start with a clean slate. + * Parts of failed transactions or spurious bytes could still be in it. */ + usart_clear(); + } + } +} + +/** + * @brief Slave specific initializations. + */ +void soft_serial_target_init(void) { + usart_slave_init(&serial_driver); + + sdStart(serial_driver, &serial_config); + + /* Start transport thread. */ + chThdCreateStatic(waSlaveThread, sizeof(waSlaveThread), HIGHPRIO, SlaveThread, NULL); +} + +/** + * @brief React to transactions started by the master. + */ +static inline bool react_to_transactions(void) { + /* Wait until there is a transaction for us. */ + uint8_t sstd_index = (uint8_t)sdGet(serial_driver); + + /* Sanity check that we are actually responding to a valid transaction. */ + if (sstd_index >= NUM_TOTAL_TRANSACTIONS) { + return false; + } + + split_transaction_desc_t* trans = &split_transaction_table[sstd_index]; + + /* Send back the handshake which is XORed as a simple checksum, + to signal that the slave is ready to receive possible transaction buffers */ + sstd_index ^= HANDSHAKE_MAGIC; + if (!send(&sstd_index, sizeof(sstd_index))) { + *trans->status = TRANSACTION_DATA_ERROR; + return false; + } + + /* Receive transaction buffer from the master. If this transaction requires it.*/ + if (trans->initiator2target_buffer_size) { + if (!receive(split_trans_initiator2target_buffer(trans), trans->initiator2target_buffer_size)) { + *trans->status = TRANSACTION_DATA_ERROR; + return false; + } + } + + /* Allow any slave processing to occur. */ + if (trans->slave_callback) { + trans->slave_callback(trans->initiator2target_buffer_size, split_trans_initiator2target_buffer(trans), trans->initiator2target_buffer_size, split_trans_target2initiator_buffer(trans)); + } + + /* Send transaction buffer to the master. If this transaction requires it. */ + if (trans->target2initiator_buffer_size) { + if (!send(split_trans_target2initiator_buffer(trans), trans->target2initiator_buffer_size)) { + *trans->status = TRANSACTION_DATA_ERROR; + return false; + } + } + + *trans->status = TRANSACTION_ACCEPTED; + return true; +} + +/** + * @brief Master specific initializations. + */ +void soft_serial_initiator_init(void) { + usart_master_init(&serial_driver); + +#if defined(MCU_STM32) && defined(SERIAL_USART_PIN_SWAP) + serial_config.cr2 |= USART_CR2_SWAP; // master has swapped TX/RX pins +#endif + + sdStart(serial_driver, &serial_config); +} + +/** + * @brief Start transaction from the master half to the slave half. + * + * @param index Transaction Table index of the transaction to start. + * @return int TRANSACTION_NO_RESPONSE in case of Timeout. + * TRANSACTION_TYPE_ERROR in case of invalid transaction index. + * TRANSACTION_END in case of success. + */ +int 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); +} + +/** + * @brief Initiate transaction to slave half. + */ +static inline int initiate_transaction(uint8_t sstd_index) { + /* Sanity check that we are actually starting a valid transaction. */ + if (sstd_index >= NUM_TOTAL_TRANSACTIONS) { + dprintln("USART: Illegal transaction Id."); + return TRANSACTION_TYPE_ERROR; + } + + split_transaction_desc_t* trans = &split_transaction_table[sstd_index]; + + /* Transaction is not registered. Abort. */ + if (!trans->status) { + dprintln("USART: Transaction not registered."); + return TRANSACTION_TYPE_ERROR; + } + + /* Send transaction table index to the slave, which doubles as basic handshake token. */ + if (!send(&sstd_index, sizeof(sstd_index))) { + dprintln("USART: Send Handshake failed."); + return TRANSACTION_TYPE_ERROR; + } + + uint8_t sstd_index_shake = 0xFF; + + /* Which we always read back first so that we can error out correctly. + * - due to the half duplex limitations on return codes, we always have to read *something*. + * - without the read, write only transactions *always* succeed, even during the boot process where the slave is not ready. + */ + if (!receive(&sstd_index_shake, sizeof(sstd_index_shake)) || (sstd_index_shake != (sstd_index ^ HANDSHAKE_MAGIC))) { + dprintln("USART: Handshake failed."); + return TRANSACTION_NO_RESPONSE; + } + + /* Send transaction buffer to the slave. If this transaction requires it. */ + if (trans->initiator2target_buffer_size) { + if (!send(split_trans_initiator2target_buffer(trans), trans->initiator2target_buffer_size)) { + dprintln("USART: Send failed."); + return TRANSACTION_NO_RESPONSE; + } + } + + /* Receive transaction buffer from the slave. If this transaction requires it. */ + if (trans->target2initiator_buffer_size) { + if (!receive(split_trans_target2initiator_buffer(trans), trans->target2initiator_buffer_size)) { + dprintln("USART: Receive failed."); + return TRANSACTION_NO_RESPONSE; + } + } + + return TRANSACTION_END; +} diff --git a/drivers/chibios/serial_usart.h b/platforms/chibios/drivers/serial_usart.h index fee7b4d159..7b135b31e0 100644 --- a/drivers/chibios/serial_usart.h +++ b/platforms/chibios/drivers/serial_usart.h @@ -23,19 +23,45 @@ #include <ch.h> #include <hal.h> -#ifndef USART_CR1_M0 +#if !defined(SERIAL_USART_DRIVER) +# define SERIAL_USART_DRIVER SD1 +#endif + +#if !defined(USE_GPIOV1) +/* The default PAL alternate modes are used to signal that the pins are used for USART. */ +# if !defined(SERIAL_USART_TX_PAL_MODE) +# define SERIAL_USART_TX_PAL_MODE 7 +# endif +# if !defined(SERIAL_USART_RX_PAL_MODE) +# define SERIAL_USART_RX_PAL_MODE 7 +# endif +#endif + +#if defined(SOFT_SERIAL_PIN) +# define SERIAL_USART_TX_PIN SOFT_SERIAL_PIN +#endif + +#if !defined(SERIAL_USART_TX_PIN) +# define SERIAL_USART_TX_PIN A9 +#endif + +#if !defined(SERIAL_USART_RX_PIN) +# define SERIAL_USART_RX_PIN A10 +#endif + +#if !defined(USART_CR1_M0) # define USART_CR1_M0 USART_CR1_M // some platforms (f1xx) dont have this so #endif -#ifndef SERIAL_USART_CR1 +#if !defined(SERIAL_USART_CR1) # define SERIAL_USART_CR1 (USART_CR1_PCE | USART_CR1_PS | USART_CR1_M0) // parity enable, odd parity, 9 bit length #endif -#ifndef SERIAL_USART_CR2 +#if !defined(SERIAL_USART_CR2) # define SERIAL_USART_CR2 (USART_CR2_STOP_1) // 2 stop bits #endif -#ifndef SERIAL_USART_CR3 +#if !defined(SERIAL_USART_CR3) # define SERIAL_USART_CR3 0 #endif @@ -61,11 +87,11 @@ } while (0) #endif -#ifndef SELECT_SOFT_SERIAL_SPEED +#if !defined(SELECT_SOFT_SERIAL_SPEED) # define SELECT_SOFT_SERIAL_SPEED 1 #endif -#ifdef SERIAL_USART_SPEED +#if defined(SERIAL_USART_SPEED) // Allow advanced users to directly set SERIAL_USART_SPEED #elif SELECT_SOFT_SERIAL_SPEED == 0 # define SERIAL_USART_SPEED 460800 @@ -83,8 +109,8 @@ # error invalid SELECT_SOFT_SERIAL_SPEED value #endif -#ifndef SERIAL_USART_TIMEOUT -# define SERIAL_USART_TIMEOUT 100 +#if !defined(SERIAL_USART_TIMEOUT) +# define SERIAL_USART_TIMEOUT 20 #endif #define HANDSHAKE_MAGIC 7 diff --git a/drivers/chibios/spi_master.c b/platforms/chibios/drivers/spi_master.c index 4852a6eba4..28ddcbb2ba 100644 --- a/drivers/chibios/spi_master.c +++ b/platforms/chibios/drivers/spi_master.c @@ -18,8 +18,13 @@ #include "timer.h" -static pin_t currentSlavePin = NO_PIN; -static SPIConfig spiConfig = {false, NULL, 0, 0, 0, 0}; +static pin_t currentSlavePin = NO_PIN; + +#if defined(K20x) || defined(KL2x) +static SPIConfig spiConfig = {NULL, 0, 0, 0}; +#else +static SPIConfig spiConfig = {false, NULL, 0, 0, 0, 0}; +#endif __attribute__((weak)) void spi_init(void) { static bool is_initialised = false; @@ -27,15 +32,15 @@ __attribute__((weak)) void spi_init(void) { is_initialised = true; // Try releasing special pins for a short time - palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), PAL_MODE_INPUT); - palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), PAL_MODE_INPUT); - palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), PAL_MODE_INPUT); + setPinInput(SPI_SCK_PIN); + setPinInput(SPI_MOSI_PIN); + setPinInput(SPI_MISO_PIN); chThdSleepMilliseconds(10); #if defined(USE_GPIOV1) - palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), PAL_MODE_STM32_ALTERNATE_PUSHPULL); - palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), PAL_MODE_STM32_ALTERNATE_PUSHPULL); - palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), PAL_MODE_STM32_ALTERNATE_PUSHPULL); + palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), SPI_SCK_PAL_MODE); + palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), SPI_MOSI_PAL_MODE); + palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), SPI_MISO_PAL_MODE); #else palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), PAL_MODE_ALTERNATE(SPI_SCK_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), PAL_MODE_ALTERNATE(SPI_MOSI_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); @@ -58,6 +63,54 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) { return false; } +#if defined(K20x) || defined(KL2x) + spiConfig.tar0 = SPIx_CTARn_FMSZ(7) | SPIx_CTARn_ASC(1); + + if (lsbFirst) { + spiConfig.tar0 |= SPIx_CTARn_LSBFE; + } + + switch (mode) { + case 0: + break; + case 1: + spiConfig.tar0 |= SPIx_CTARn_CPHA; + break; + case 2: + spiConfig.tar0 |= SPIx_CTARn_CPOL; + break; + case 3: + spiConfig.tar0 |= SPIx_CTARn_CPHA | SPIx_CTARn_CPOL; + break; + } + + switch (roundedDivisor) { + case 2: + spiConfig.tar0 |= SPIx_CTARn_BR(0); + break; + case 4: + spiConfig.tar0 |= SPIx_CTARn_BR(1); + break; + case 8: + spiConfig.tar0 |= SPIx_CTARn_BR(3); + break; + case 16: + spiConfig.tar0 |= SPIx_CTARn_BR(4); + break; + case 32: + spiConfig.tar0 |= SPIx_CTARn_BR(5); + break; + case 64: + spiConfig.tar0 |= SPIx_CTARn_BR(6); + break; + case 128: + spiConfig.tar0 |= SPIx_CTARn_BR(7); + break; + case 256: + spiConfig.tar0 |= SPIx_CTARn_BR(8); + break; + } +#else spiConfig.cr1 = 0; if (lsbFirst) { @@ -103,6 +156,7 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) { spiConfig.cr1 |= SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0; break; } +#endif currentSlavePin = slavePin; spiConfig.ssport = PAL_PORT(slavePin); diff --git a/drivers/chibios/spi_master.h b/platforms/chibios/drivers/spi_master.h index e93580e319..b5a6ef1437 100644 --- a/drivers/chibios/spi_master.h +++ b/platforms/chibios/drivers/spi_master.h @@ -21,6 +21,7 @@ #include <stdbool.h> #include "gpio.h" +#include "chibios_config.h" #ifndef SPI_DRIVER # define SPI_DRIVER SPID2 @@ -31,7 +32,11 @@ #endif #ifndef SPI_SCK_PAL_MODE -# define SPI_SCK_PAL_MODE 5 +# if defined(USE_GPIOV1) +# define SPI_SCK_PAL_MODE PAL_MODE_STM32_ALTERNATE_PUSHPULL +# else +# define SPI_SCK_PAL_MODE 5 +# endif #endif #ifndef SPI_MOSI_PIN @@ -39,7 +44,11 @@ #endif #ifndef SPI_MOSI_PAL_MODE -# define SPI_MOSI_PAL_MODE 5 +# if defined(USE_GPIOV1) +# define SPI_MOSI_PAL_MODE PAL_MODE_STM32_ALTERNATE_PUSHPULL +# else +# define SPI_MOSI_PAL_MODE 5 +# endif #endif #ifndef SPI_MISO_PIN @@ -47,7 +56,11 @@ #endif #ifndef SPI_MISO_PAL_MODE -# define SPI_MISO_PAL_MODE 5 +# if defined(USE_GPIOV1) +# define SPI_MISO_PAL_MODE PAL_MODE_STM32_ALTERNATE_PUSHPULL +# else +# define SPI_MISO_PAL_MODE 5 +# endif #endif typedef int16_t spi_status_t; diff --git a/drivers/chibios/uart.c b/platforms/chibios/drivers/uart.c index 030335b342..030335b342 100644 --- a/drivers/chibios/uart.c +++ b/platforms/chibios/drivers/uart.c diff --git a/drivers/chibios/uart.h b/platforms/chibios/drivers/uart.h index b4e20e9fd3..b4e20e9fd3 100644 --- a/drivers/chibios/uart.h +++ b/platforms/chibios/drivers/uart.h diff --git a/drivers/chibios/usbpd_stm32g4.c b/platforms/chibios/drivers/usbpd_stm32g4.c index f16ca8aeae..f16ca8aeae 100644 --- a/drivers/chibios/usbpd_stm32g4.c +++ b/platforms/chibios/drivers/usbpd_stm32g4.c diff --git a/drivers/chibios/ws2812.c b/platforms/chibios/drivers/ws2812.c index 0d12e2fb79..0d12e2fb79 100644 --- a/drivers/chibios/ws2812.c +++ b/platforms/chibios/drivers/ws2812.c diff --git a/drivers/chibios/ws2812_pwm.c b/platforms/chibios/drivers/ws2812_pwm.c index e6af55b6b3..e6af55b6b3 100644 --- a/drivers/chibios/ws2812_pwm.c +++ b/platforms/chibios/drivers/ws2812_pwm.c diff --git a/drivers/chibios/ws2812_spi.c b/platforms/chibios/drivers/ws2812_spi.c index 377a929b94..fe14b478ab 100644 --- a/drivers/chibios/ws2812_spi.c +++ b/platforms/chibios/drivers/ws2812_spi.c @@ -41,23 +41,23 @@ // F072 fpclk = 48MHz // 48/16 = 3Mhz #if WS2812_SPI_DIVISOR == 2 -# define WS2812_SPI_DIVISOR (0) +# define WS2812_SPI_DIVISOR_CR1_BR_X (0) #elif WS2812_SPI_DIVISOR == 4 -# define WS2812_SPI_DIVISOR (SPI_CR1_BR_0) +# define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_0) #elif WS2812_SPI_DIVISOR == 8 -# define WS2812_SPI_DIVISOR (SPI_CR1_BR_1) +# define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_1) #elif WS2812_SPI_DIVISOR == 16 // same as default -# define WS2812_SPI_DIVISOR (SPI_CR1_BR_1 | SPI_CR1_BR_0) +# define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_1 | SPI_CR1_BR_0) #elif WS2812_SPI_DIVISOR == 32 -# define WS2812_SPI_DIVISOR (SPI_CR1_BR_2) +# define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_2) #elif WS2812_SPI_DIVISOR == 64 -# define WS2812_SPI_DIVISOR (SPI_CR1_BR_2 | SPI_CR1_BR_0) +# define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_2 | SPI_CR1_BR_0) #elif WS2812_SPI_DIVISOR == 128 -# define WS2812_SPI_DIVISOR (SPI_CR1_BR_2 | SPI_CR1_BR_1) +# define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_2 | SPI_CR1_BR_1) #elif WS2812_SPI_DIVISOR == 256 -# define WS2812_SPI_DIVISOR (SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0) +# define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0) #else -# define WS2812_SPI_DIVISOR (SPI_CR1_BR_1 | SPI_CR1_BR_0) // default +# define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_1 | SPI_CR1_BR_0) // default #endif // Use SPI circular buffer @@ -126,7 +126,7 @@ 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}; + 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}; spiAcquireBus(&WS2812_SPI); /* Acquire ownership of the bus. */ spiStart(&WS2812_SPI, &spicfg); /* Setup transfer parameters. */ diff --git a/drivers/chibios/wt_rgb_backlight.c b/platforms/chibios/drivers/wt_rgb_backlight.c index 306f8186e0..82b1fb2fb3 100644 --- a/drivers/chibios/wt_rgb_backlight.c +++ b/platforms/chibios/drivers/wt_rgb_backlight.c @@ -30,6 +30,7 @@ defined(RGB_BACKLIGHT_NEBULA68) || \ defined(RGB_BACKLIGHT_U80_A) || \ defined(RGB_BACKLIGHT_DAWN60) || \ + defined(RGB_BACKLIGHT_PORTICO) || \ defined(RGB_BACKLIGHT_WT60_B) || \ defined(RGB_BACKLIGHT_WT60_BX) || \ defined(RGB_BACKLIGHT_WT60_C) || \ @@ -53,11 +54,11 @@ #if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) && !defined(RGB_BACKLIGHT_NK87) && !defined(RGB_BACKLIGHT_NEBULA68) && !defined(RGB_BACKLIGHT_NEBULA12) && !defined (RGB_BACKLIGHT_KW_MEGA) #include <avr/interrupt.h> -#include "drivers/avr/i2c_master.h" +#include "i2c_master.h" #else #include <ch.h> #include <hal.h> -#include "drivers/chibios/i2c_master.h" +#include "i2c_master.h" #endif #if defined(RGB_BACKLIGHT_DAWN60) @@ -77,23 +78,25 @@ LED_TYPE g_ws2812_leds[WS2812_LED_TOTAL]; #endif #if defined(RGB_BACKLIGHT_M6_B) -#include "drivers/issi/is31fl3218.h" +#include "drivers/led/issi/is31fl3218.h" #define BACKLIGHT_LED_COUNT 6 #elif defined(RGB_BACKLIGHT_HS60) -#include "drivers/issi/is31fl3733.h" +#include "drivers/led/issi/is31fl3733.h" #define BACKLIGHT_LED_COUNT 64 #elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_KW_MEGA) -#include "drivers/issi/is31fl3733.h" +#include "drivers/led/issi/is31fl3733.h" #define BACKLIGHT_LED_COUNT 69 #elif defined(RGB_BACKLIGHT_NK87) -#include "drivers/issi/is31fl3733.h" +#include "drivers/led/issi/is31fl3733.h" #define BACKLIGHT_LED_COUNT 128 #else -#include "drivers/issi/is31fl3731.h" +#include "drivers/led/issi/is31fl3731.h" #if defined(RGB_BACKLIGHT_U80_A) #define BACKLIGHT_LED_COUNT 108 #elif defined(RGB_BACKLIGHT_DAWN60) #define BACKLIGHT_LED_COUNT 84 //64 + 20 +#elif defined(RGB_BACKLIGHT_PORTICO) +#define BACKLIGHT_LED_COUNT 67 //36 + 31 #elif defined(RGB_BACKLIGHT_NEBULA12) #define BACKLIGHT_LED_COUNT 16 #elif defined(RGB_BACKLIGHT_M10_C) @@ -155,7 +158,7 @@ uint32_t g_any_key_hit = 0; // ADDR_2 is not needed. it is here as a dummy #define ISSI_ADDR_1 0x50 -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | R location @@ -236,7 +239,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { #define ISSI_ADDR_1 0x50 #define ISSI_ADDR_2 0x52 -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | R location @@ -379,7 +382,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { // set to 0 for write, 1 for read (as per I2C protocol) #define ISSI_ADDR_1 0x74 -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | R location @@ -411,7 +414,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { #define ISSI_ADDR_2 0x76 // 11101[10] <- SDA #define ISSI_ADDR_3 0x75 // 11101[01] <- SCL -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | R location @@ -538,7 +541,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { #define ISSI_ADDR_1 0x74 #define ISSI_ADDR_2 0x76 -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | R location @@ -613,6 +616,91 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {1, C9_15, C8_15, C6_14}, //D15 {1, C9_16, C7_15, C6_15} //D16 }; +#elif defined(RGB_BACKLIGHT_PORTICO) +// This is a 7-bit address, that gets left-shifted and bit 0 +// set to 0 for write, 1 for read (as per I2C protocol) +#define ISSI_ADDR_1 0x74 +#define ISSI_ADDR_2 0x77 + +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { +/* Refer to IS31 manual for these locations + * driver + * | R location + * | | G location + * | | | B location + * | | | | */ + { 0, C2_1, C3_1, C4_1 }, + { 0, C1_1, C3_2, C4_2 }, + { 0, C1_2, C2_2, C4_3 }, + { 0, C1_3, C2_3, C3_3 }, + { 0, C1_4, C2_4, C3_4 }, + { 0, C1_5, C2_5, C3_5 }, + { 0, C1_6, C2_6, C3_6 }, + { 0, C1_7, C2_7, C3_7 }, + { 0, C1_8, C2_8, C3_8 }, + { 1, C2_1, C3_1, C4_1 }, + { 1, C1_1, C3_2, C4_2 }, + { 1, C1_2, C2_2, C4_3 }, + { 1, C1_3, C2_3, C3_3 }, + { 1, C1_4, C2_4, C3_4 }, + { 1, C1_5, C2_5, C3_5 }, + + { 0, C9_1, C8_1, C7_1 }, + { 0, C9_2, C8_2, C7_2 }, + { 0, C9_3, C8_3, C7_3 }, + { 0, C9_4, C8_4, C7_4 }, + { 0, C9_5, C8_5, C7_5 }, + { 0, C9_6, C8_6, C7_6 }, + { 0, C9_7, C8_7, C6_6 }, + { 0, C9_8, C7_7, C6_7 }, + { 0, C8_8, C7_8, C6_8 }, + { 1, C9_1, C8_1, C7_1 }, + { 1, C9_2, C8_2, C7_2 }, + { 1, C9_3, C8_3, C7_3 }, + { 1, C9_4, C8_4, C7_4 }, + { 1, C9_5, C8_5, C7_5 }, + { 1, C9_6, C8_6, C7_6 }, + + { 0, C1_9, C3_10, C4_10 }, + { 0, C1_10, C2_10, C4_11 }, + { 0, C1_11, C2_11, C3_11 }, + { 0, C1_12, C2_12, C3_12 }, + { 0, C1_13, C2_13, C3_13 }, + { 0, C1_14, C2_14, C3_14 }, + { 0, C1_15, C2_15, C3_15 }, + { 0, C1_16, C2_16, C3_16 }, + { 1, C1_10, C2_10, C4_11 }, + { 1, C1_11, C2_11, C3_11 }, + { 1, C1_12, C2_12, C3_12 }, + { 1, C1_13, C2_13, C3_13 }, + { 1, C1_14, C2_14, C3_14 }, + { 1, C9_7, C8_7, C6_6 }, + + { 0, C2_9, C3_9, C4_9 }, + { 0, C9_12, C8_12, C7_12 }, + { 0, C9_13, C8_13, C7_13 }, + { 0, C9_14, C8_14, C7_14 }, + { 0, C9_15, C8_15, C6_14 }, + { 0, C9_16, C7_15, C6_15 }, + { 1, C2_9, C3_9, C4_9 }, + { 1, C1_9, C3_10, C4_10 }, + { 1, C9_9, C8_9, C7_9 }, + { 1, C9_10, C8_10, C7_10 }, + { 1, C9_11, C8_11, C7_11 }, + { 1, C9_14, C8_14, C7_14 }, + { 1, C1_15, C2_15, C3_15 }, + { 1, C1_16, C2_16, C3_16 }, + + { 0, C9_9, C8_9, C7_9 }, + { 0, C9_10, C8_10, C7_10 }, + { 0, C9_11, C8_11, C7_11 }, + { 0, C8_16, C7_16, C6_16 }, + { 1, C9_12, C8_12, C7_12 }, + { 1, C9_13, C8_13, C7_13 }, + { 1, C9_15, C8_15, C6_14 }, + { 1, C9_16, C7_15, C6_15 }, + { 1, C8_16, C7_16, C6_16 } +}; #elif defined(RGB_BACKLIGHT_M6_B) // Driver has fixed mapping of index to the red, green and blue LEDs #elif defined(RGB_BACKLIGHT_M10_C) @@ -621,7 +709,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { #define ISSI_ADDR_1 0x74 #define ISSI_ADDR_2 -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { {0, C1_9, C3_10, C4_10}, // LB1 {0, C1_10, C2_10, C4_11}, // LB2 {0, C1_11, C2_11, C3_11}, // LB3 @@ -641,7 +729,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { #define ISSI_ADDR_1 0x74 #define ISSI_ADDR_2 0x76 -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | R location @@ -776,7 +864,8 @@ const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { // LC0..LC17 {112,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {64,60}, {44,60}, {24,64}, {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {255,255}, {10,48}, {4,64}, - // LD0..LD17 + // LD0..LD1762 + {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {202,48}, {224,48}, {116,48}, {132,48}, {148,48}, {164,48}, {255,255}, {160,60}, {180,64}, {208,64}, {255,255} }; @@ -1156,6 +1245,21 @@ const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { //11 - 20 {234,255}, {222,255}, {213,255}, {197,255}, {180,255}, {167,255}, {152,255}, {147,255}, {128,255}, {101,255} }; +#elif defined(RGB_BACKLIGHT_PORTICO) +const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { + { 0, 0 }, { 15, 0 }, { 30, 0 }, { 45, 0 }, { 60, 0 }, { 75, 0 }, { 90, 0 }, { 105, 0 }, { 120, 0 }, { 135, 0 }, { 150, 0 }, { 165, 0 }, { 180, 0 }, { 203, 0 }, { 224, 0 }, + { 4, 16 }, { 23, 16 }, { 38, 16 }, { 53, 16 }, { 68, 16 }, { 83, 16 }, { 98, 16 }, { 113, 16 }, { 128, 16 }, { 143, 16 }, { 158, 16 }, { 173, 16 }, { 188, 16 }, { 206, 16 }, { 224, 16 }, + { 6, 32 }, { 26, 32 }, { 41, 32 }, { 56, 32 }, { 71, 32 }, { 86, 32 }, { 101, 32 }, { 116, 32 }, { 131, 32 }, { 146, 32 }, { 161, 32 }, { 176, 32 }, { 201, 32 }, { 224, 32 }, + { 9, 48 }, { 34, 48 }, { 49, 48 }, { 64, 48 }, { 79, 48 }, { 94, 48 }, { 109, 48 }, { 124, 48 }, { 139, 48 }, { 154, 48 }, { 169, 48 }, { 189, 48 }, { 210, 48 }, { 224, 48 }, + { 2, 64 }, { 21, 64 }, { 39, 64 }, { 96, 64 }, { 152, 64 }, { 171, 64 }, { 195, 64 }, { 210, 64 }, { 224, 64 }, +}; +const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { + { 138, 240 }, { 140, 210 }, { 142, 181 }, { 145, 153 }, { 149, 126 }, { 156, 101 }, { 166, 80 }, { 182, 67 }, { 200, 68 }, { 216, 81 }, { 226, 102 }, { 232, 128 }, { 236, 155 }, { 240, 199 }, { 243, 240 }, //Done through here TM 052421 143PM + { 133, 225 }, { 134, 186 }, { 136, 156 }, { 138, 126 }, { 141, 96 }, { 147, 68 }, { 161, 44 }, { 193, 33 }, { 222, 47 }, { 235, 72 }, { 240, 100 }, { 244, 130 }, { 246, 160 }, { 247, 196 }, { 248, 233 }, //Done through here TM 052421 235PM + { 127, 218 }, { 127, 177 }, { 127, 146 }, { 127, 115 }, { 127, 84 }, { 127, 54 }, { 127, 23 }, { 0, 8 }, { 0, 39 }, { 0, 70 }, { 0, 101 }, { 0, 132 }, { 0, 183 }, { 0, 231 }, + { 121, 215 }, { 119, 164 }, { 117, 134 }, { 114, 104 }, { 109, 76 }, { 98, 50 }, { 71, 34 }, { 37, 41 }, { 22, 65 }, { 15, 93 }, { 11, 122 }, { 8, 162 }, { 7, 205 }, { 6, 233 }, + { 116, 236 }, { 113, 199 }, { 110, 164 }, { 82, 74 }, { 27, 106 }, { 20, 138 }, { 15, 183 }, { 13, 212 }, { 11, 240 } +}; #elif defined(RGB_BACKLIGHT_M50_A) const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { // LA0..LA17 @@ -1198,7 +1302,7 @@ void map_led_to_point( uint8_t index, Point *point ) point->x = pgm_read_byte(addr); point->y = pgm_read_byte(addr+1); -#if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_M10_C) || defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || \ +#if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_M10_C) || defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_PORTICO) || \ defined(RGB_BACKLIGHT_NK87) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_NEBULA12) || defined(RGB_BACKLIGHT_KW_MEGA) return; #endif @@ -1474,6 +1578,14 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { { 31+15, 31+5 , 31+4 , 31+3 , 31+2 , 31+1 , 47+9 , 47+10, 47+11, 47+12, 255 ,47+6 , 47+7 , 15+16}, { 31+16, 31+8 , 31+7 , 255 , 255 , 31+6 , 255 , 255 , 255 , 47+13, 47+14, 47+15, 47+16, 47+8 } }; +#elif defined(RGB_BACKLIGHT_PORTICO) +const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, + { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }, + { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 255, 43 }, + { 44, 255, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57 }, + { 58, 59, 60, 255, 255, 255, 61, 255, 255, 255, 62, 63, 64, 65, 66 } +}; #elif defined(RGB_BACKLIGHT_M50_A) // LA15, LA14, LA13, LA12, LA11, LA10, LA9, LB1, LB2, LB3, LB4, LB5, LB6 // LA16, LA6, LA5, LA4, LA3, LA2, LA1, LB9, LB10, LB11, LB12, LB13, LB14 @@ -1546,6 +1658,8 @@ void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) IS31FL3218_set_color( index, red, green, blue ); #elif defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_KW_MEGA) IS31FL3733_set_color( index, red, green, blue ); +#elif defined (RGB_BACKLIGHT_PORTICO) + IS31FL3731_set_color( index, red, green, blue ); #elif defined(RGB_BACKLIGHT_NK87) // This is done to avoid indicator LEDs being set if (( index != 63+64-1 ) && ( index != 48+64-1 )) { @@ -1574,6 +1688,11 @@ void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) { IS31FL3733_set_color(i, red, green, blue); } +#elif defined (RGB_BACKLIGHT_PORTICO) + // This is done to avoid indicator LEDs being set + for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) { + IS31FL3731_set_color(i, red, green, blue); + } #elif defined(RGB_BACKLIGHT_NK87) // This is done to avoid indicator LEDs being set for (int i = 0; i < BACKLIGHT_LED_COUNT; i++) { @@ -1639,6 +1758,7 @@ void backlight_timer_disable(void) { TIMSK3 &= ~_BV(OCIE3A); } + #elif defined(RGB_BACKLIGHT_NEBULA12) //STM32, use GPT with TIM3. Enable in halconf.h static void gpt_backlight_timer_task(GPTDriver *gptp); // Timer setup at 200Khz, callback at 10k ticks = 20Hz @@ -1661,6 +1781,7 @@ void backlight_timer_disable(void) { gptStopTimer(&GPTD3); } + #else //STM32, use GPT with TIM4. Enable in halconf.h static void gpt_backlight_timer_task(GPTDriver *gptp); // Timer setup at 200Khz, callback at 10k ticks = 20Hz @@ -2851,6 +2972,8 @@ void backlight_init_drivers(void) ( index == 54+17 ) ); #elif defined(RGB_BACKLIGHT_M10_C) bool enabled = true; +#elif defined(RGB_BACKLIGHT_PORTICO) + bool enabled = true; #endif // This only caches it for later IS31FL3731_set_led_control_register( index, enabled, enabled, enabled ); @@ -3121,5 +3244,3 @@ void backlight_debug_led( bool state ) } } #endif // defined(RGB_DEBUGGING_ONLY) - - diff --git a/drivers/chibios/wt_rgb_backlight.h b/platforms/chibios/drivers/wt_rgb_backlight.h index 529f84636a..529f84636a 100644 --- a/drivers/chibios/wt_rgb_backlight.h +++ b/platforms/chibios/drivers/wt_rgb_backlight.h diff --git a/drivers/chibios/wt_rgb_backlight_api.h b/platforms/chibios/drivers/wt_rgb_backlight_api.h index 0cd6b85f07..0cd6b85f07 100644 --- a/drivers/chibios/wt_rgb_backlight_api.h +++ b/platforms/chibios/drivers/wt_rgb_backlight_api.h diff --git a/drivers/chibios/wt_rgb_backlight_keycodes.h b/platforms/chibios/drivers/wt_rgb_backlight_keycodes.h index 5a43649535..5a43649535 100644 --- a/drivers/chibios/wt_rgb_backlight_keycodes.h +++ b/platforms/chibios/drivers/wt_rgb_backlight_keycodes.h diff --git a/platforms/chibios/flash.mk b/platforms/chibios/flash.mk new file mode 100644 index 0000000000..c0b32c2f2b --- /dev/null +++ b/platforms/chibios/flash.mk @@ -0,0 +1,87 @@ +# Hey Emacs, this is a -*- makefile -*- +############################################################################## +# Architecture or project specific options +# + +DFU_ARGS ?= +ifneq ("$(SERIAL)","") + DFU_ARGS += -S $(SERIAL) +endif + +DFU_UTIL ?= dfu-util + +define EXEC_DFU_UTIL + if ! $(DFU_UTIL) -l | grep -q "Found DFU"; then \ + printf "$(MSG_BOOTLOADER_NOT_FOUND_QUICK_RETRY)" ;\ + sleep $(BOOTLOADER_RETRY_TIME) ;\ + while ! $(DFU_UTIL) -l | grep -q "Found DFU"; do \ + printf "." ;\ + sleep $(BOOTLOADER_RETRY_TIME) ;\ + done ;\ + printf "\n" ;\ + fi + $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin +endef + +dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter + $(call EXEC_DFU_UTIL) + +# 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)) + OPT_DEFS += -DINIT_EE_HANDS_LEFT +endif + +ifneq (,$(filter $(MAKECMDGOALS),dfu-util-split-right)) + OPT_DEFS += -DINIT_EE_HANDS_RIGHT +endif + +dfu-util-split-left: dfu-util + +dfu-util-split-right: dfu-util + +ST_LINK_CLI ?= st-link_cli +ST_LINK_ARGS ?= + +st-link-cli: $(BUILD_DIR)/$(TARGET).hex sizeafter + $(ST_LINK_CLI) $(ST_LINK_ARGS) -q -c SWD -p $(BUILD_DIR)/$(TARGET).hex -Rst + +ST_FLASH ?= st-flash +ST_FLASH_ARGS ?= + +st-flash: $(BUILD_DIR)/$(TARGET).hex sizeafter + $(ST_FLASH) $(ST_FLASH_ARGS) --reset --format ihex write $(BUILD_DIR)/$(TARGET).hex + +# Autodetect teensy loader +ifndef TEENSY_LOADER_CLI + ifneq (, $(shell which teensy-loader-cli 2>/dev/null)) + TEENSY_LOADER_CLI ?= teensy-loader-cli + else + TEENSY_LOADER_CLI ?= teensy_loader_cli + endif +endif + +TEENSY_LOADER_CLI_MCU ?= $(MCU_LDSCRIPT) + +define EXEC_TEENSY + $(TEENSY_LOADER_CLI) -mmcu=$(TEENSY_LOADER_CLI_MCU) -w -v $(BUILD_DIR)/$(TARGET).hex +endef + +teensy: $(BUILD_DIR)/$(TARGET).hex cpfirmware sizeafter + $(call EXEC_TEENSY) + + +flash: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter +ifneq ($(strip $(PROGRAM_CMD)),) + $(UNSYNC_OUTPUT_CMD) && $(PROGRAM_CMD) +else ifeq ($(strip $(BOOTLOADER)),kiibohd) + $(UNSYNC_OUTPUT_CMD) && $(call EXEC_DFU_UTIL) +else ifeq ($(strip $(MCU_FAMILY)),KINETIS) + $(UNSYNC_OUTPUT_CMD) && $(call EXEC_TEENSY) +else ifeq ($(strip $(MCU_FAMILY)),MIMXRT1062) + $(UNSYNC_OUTPUT_CMD) && $(call EXEC_TEENSY) +else ifeq ($(strip $(MCU_FAMILY)),STM32) + $(UNSYNC_OUTPUT_CMD) && $(call EXEC_DFU_UTIL) +else + $(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_BOOTLOADER)" +endif diff --git a/tmk_core/common/action.c b/quantum/action.c index 5660c3fa1f..0946b0ca1a 100644 --- a/tmk_core/common/action.c +++ b/quantum/action.c @@ -55,12 +55,8 @@ __attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrec __attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *record) { return false; } #endif -#ifndef TAP_CODE_DELAY -# define TAP_CODE_DELAY 0 -#endif -#ifndef TAP_HOLD_CAPS_DELAY -# define TAP_HOLD_CAPS_DELAY 80 -#endif +__attribute__((weak)) bool pre_process_record_quantum(keyrecord_t *record) { return true; } + /** \brief Called to execute an action. * * FIXME: Needs documentation. @@ -106,9 +102,13 @@ void action_exec(keyevent_t event) { #endif #ifndef NO_ACTION_TAPPING - action_tapping_process(record); + if (IS_NOEVENT(record.event) || pre_process_record_quantum(&record)) { + action_tapping_process(record); + } #else - process_record(&record); + if (IS_NOEVENT(record.event) || pre_process_record_quantum(&record)) { + process_record(&record); + } if (!IS_NOEVENT(record.event)) { dprint("processed: "); debug_record(record); @@ -206,7 +206,16 @@ void process_record(keyrecord_t *record) { } void process_record_handler(keyrecord_t *record) { +#ifdef COMBO_ENABLE + action_t action; + if (record->keycode) { + action = action_for_keycode(record->keycode); + } else { + action = store_or_get_action(record->event.pressed, record->event.key); + } +#else action_t action = store_or_get_action(record->event.pressed, record->event.key); +#endif dprint("ACTION: "); debug_action(action); #ifndef NO_ACTION_LAYER @@ -995,6 +1004,24 @@ bool is_tap_key(keypos_t key) { * * FIXME: Needs documentation. */ +bool is_tap_record(keyrecord_t *record) { +#ifdef COMBO_ENABLE + action_t action; + if (record->keycode) { + action = action_for_keycode(record->keycode); + } else { + action = layer_switch_get_action(record->event.key); + } +#else + action_t action = layer_switch_get_action(record->event.key); +#endif + return is_tap_action(action); +} + +/** \brief Utilities for actions. (FIXME: Needs better description) + * + * FIXME: Needs documentation. + */ bool is_tap_action(action_t action) { switch (action.kind.id) { case ACT_LMODS_TAP: diff --git a/tmk_core/common/action.h b/quantum/action.h index 8cb4722c6e..8a357ded87 100644 --- a/tmk_core/common/action.h +++ b/quantum/action.h @@ -38,6 +38,13 @@ extern "C" { # endif #endif +#ifndef TAP_CODE_DELAY +# define TAP_CODE_DELAY 0 +#endif +#ifndef TAP_HOLD_CAPS_DELAY +# define TAP_HOLD_CAPS_DELAY 80 +#endif + /* tapping count and state */ typedef struct { bool interrupted : 1; @@ -53,6 +60,9 @@ typedef struct { #ifndef NO_ACTION_TAPPING tap_t tap; #endif +#ifdef COMBO_ENABLE + uint16_t keycode; +#endif } keyrecord_t; /* Execute action per keyevent */ @@ -60,6 +70,7 @@ void action_exec(keyevent_t event); /* action for key */ action_t action_for_key(uint8_t layer, keypos_t key); +action_t action_for_keycode(uint16_t keycode); /* macro */ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt); @@ -111,6 +122,7 @@ void clear_keyboard_but_mods(void); void clear_keyboard_but_mods_and_keys(void); void layer_switch(uint8_t new_layer); bool is_tap_key(keypos_t key); +bool is_tap_record(keyrecord_t *record); bool is_tap_action(action_t action); #ifndef NO_ACTION_TAPPING diff --git a/tmk_core/common/action_code.h b/quantum/action_code.h index eb18c36ae8..eb18c36ae8 100644 --- a/tmk_core/common/action_code.h +++ b/quantum/action_code.h diff --git a/tmk_core/common/action_layer.c b/quantum/action_layer.c index 9bd0948379..d670c5ead4 100644 --- a/tmk_core/common/action_layer.c +++ b/quantum/action_layer.c @@ -136,32 +136,32 @@ bool layer_state_cmp(layer_state_t cmp_layer_state, uint8_t layer) { if (!cmp_layer_state) { return layer == 0; } - return (cmp_layer_state & (1UL << layer)) != 0; + return (cmp_layer_state & ((layer_state_t)1 << layer)) != 0; } /** \brief Layer move * * Turns on the given layer and turn off all other layers */ -void layer_move(uint8_t layer) { layer_state_set(1UL << layer); } +void layer_move(uint8_t layer) { layer_state_set((layer_state_t)1 << layer); } /** \brief Layer on * * Turns on given layer */ -void layer_on(uint8_t layer) { layer_state_set(layer_state | (1UL << layer)); } +void layer_on(uint8_t layer) { layer_state_set(layer_state | ((layer_state_t)1 << layer)); } /** \brief Layer off * * Turns off given layer */ -void layer_off(uint8_t layer) { layer_state_set(layer_state & ~(1UL << layer)); } +void layer_off(uint8_t layer) { layer_state_set(layer_state & ~((layer_state_t)1 << layer)); } /** \brief Layer invert * * Toggle the given layer (set it if it's unset, or unset it if it's set) */ -void layer_invert(uint8_t layer) { layer_state_set(layer_state ^ (1UL << layer)); } +void layer_invert(uint8_t layer) { layer_state_set(layer_state ^ ((layer_state_t)1 << layer)); } /** \brief Layer or * @@ -263,7 +263,7 @@ uint8_t layer_switch_get_layer(keypos_t key) { layer_state_t layers = layer_state | default_layer_state; /* check top layer first */ for (int8_t i = MAX_LAYER - 1; i >= 0; i--) { - if (layers & (1UL << i)) { + if (layers & ((layer_state_t)1 << i)) { action = action_for_key(i, key); if (action.code != ACTION_TRANSPARENT) { return i; diff --git a/tmk_core/common/action_layer.h b/quantum/action_layer.h index d72cd3e3a5..b87d096eed 100644 --- a/tmk_core/common/action_layer.h +++ b/quantum/action_layer.h @@ -21,6 +21,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "keyboard.h" #include "action.h" +#ifdef DYNAMIC_KEYMAP_ENABLE +# ifndef DYNAMIC_KEYMAP_LAYER_COUNT +# define DYNAMIC_KEYMAP_LAYER_COUNT 4 +# endif +# if DYNAMIC_KEYMAP_LAYER_COUNT <= 8 +# ifndef LAYER_STATE_8BIT +# define LAYER_STATE_8BIT +# endif +# elif DYNAMIC_KEYMAP_LAYER_COUNT <= 16 +# ifndef LAYER_STATE_16BIT +# define LAYER_STATE_16BIT +# endif +# else +# ifndef LAYER_STATE_32BIT +# define LAYER_STATE_32BIT +# endif +# endif +#endif + +#if !defined(LAYER_STATE_8BIT) && !defined(LAYER_STATE_16BIT) && !defined(LAYER_STATE_32BIT) +# define LAYER_STATE_32BIT +#endif + #if defined(LAYER_STATE_8BIT) typedef uint8_t layer_state_t; # define MAX_LAYER_BITS 3 @@ -35,13 +58,15 @@ typedef uint16_t layer_state_t; # define MAX_LAYER 16 # endif # define get_highest_layer(state) biton16(state) -#else +#elif defined(LAYER_STATE_32BIT) typedef uint32_t layer_state_t; # define MAX_LAYER_BITS 5 # ifndef MAX_LAYER # define MAX_LAYER 32 # endif # define get_highest_layer(state) biton32(state) +#else +# error Layer Mask size not specified. HOW?! #endif /* @@ -92,7 +117,7 @@ layer_state_t layer_state_set_kb(layer_state_t state); # define layer_state_set(layer) # define layer_state_is(layer) (layer == 0) -# define layer_state_cmp(state, layer) (state == 0 ? layer == 0 : (state & 1UL << layer) != 0) +# define layer_state_cmp(state, layer) (state == 0 ? layer == 0 : (state & (layer_state_t)1 << layer) != 0) # define layer_debug() # define layer_clear() diff --git a/tmk_core/common/action_macro.c b/quantum/action_macro.c index 92228c0ba8..92228c0ba8 100644 --- a/tmk_core/common/action_macro.c +++ b/quantum/action_macro.c diff --git a/tmk_core/common/action_macro.h b/quantum/action_macro.h index 685e2c6ffc..685e2c6ffc 100644 --- a/tmk_core/common/action_macro.h +++ b/quantum/action_macro.h diff --git a/tmk_core/common/action_tapping.c b/quantum/action_tapping.c index 56044e096d..36839f9faf 100644 --- a/tmk_core/common/action_tapping.c +++ b/quantum/action_tapping.c @@ -18,11 +18,16 @@ # define IS_TAPPING_PRESSED() (IS_TAPPING() && tapping_key.event.pressed) # define IS_TAPPING_RELEASED() (IS_TAPPING() && !tapping_key.event.pressed) # define IS_TAPPING_KEY(k) (IS_TAPPING() && KEYEQ(tapping_key.event.key, (k))) +#ifndef COMBO_ENABLE +# define IS_TAPPING_RECORD(r) (IS_TAPPING() && KEYEQ(tapping_key.event.key, (r->event.key))) +#else +# define IS_TAPPING_RECORD(r) (IS_TAPPING() && KEYEQ(tapping_key.event.key, (r->event.key)) && tapping_key.keycode == r->keycode) +#endif __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM; } # ifdef TAPPING_TERM_PER_KEY -# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term(get_event_keycode(tapping_key.event, false), &tapping_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) < TAPPING_TERM) # endif @@ -35,6 +40,10 @@ __attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t __attribute__((weak)) bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) { return false; } # endif +# ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY +__attribute__((weak)) bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) { return false; } +# endif + static keyrecord_t tapping_key = {}; static keyrecord_t waiting_buffer[WAITING_BUFFER_SIZE] = {}; static uint8_t waiting_buffer_head = 0; @@ -103,7 +112,7 @@ bool process_tapping(keyrecord_t *keyp) { if (IS_TAPPING_PRESSED()) { if (WITHIN_TAPPING_TERM(event)) { if (tapping_key.tap.count == 0) { - if (IS_TAPPING_KEY(event.key) && !event.pressed) { + if (IS_TAPPING_RECORD(keyp) && !event.pressed) { // first tap! debug("Tapping: First tap(0->1).\n"); tapping_key.tap.count = 1; @@ -122,14 +131,14 @@ bool process_tapping(keyrecord_t *keyp) { # if defined(TAPPING_TERM_PER_KEY) || (TAPPING_TERM >= 500) || defined(PERMISSIVE_HOLD) || defined(PERMISSIVE_HOLD_PER_KEY) else if ((( # ifdef TAPPING_TERM_PER_KEY - get_tapping_term(get_event_keycode(tapping_key.event, false), keyp) + get_tapping_term(get_record_keycode(&tapping_key, false), keyp) # else TAPPING_TERM # endif >= 500) # ifdef PERMISSIVE_HOLD_PER_KEY - || get_permissive_hold(get_event_keycode(tapping_key.event, false), keyp) + || get_permissive_hold(get_record_keycode(&tapping_key, false), keyp) # elif defined(PERMISSIVE_HOLD) || true # endif @@ -170,6 +179,19 @@ bool process_tapping(keyrecord_t *keyp) { // set interrupted flag when other key preesed during tapping if (event.pressed) { tapping_key.tap.interrupted = true; +# if defined(HOLD_ON_OTHER_KEY_PRESS) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY) +# if defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY) + if (get_hold_on_other_key_press(get_record_keycode(&tapping_key, false), keyp)) +# endif + { + debug("Tapping: End. No tap. Interfered by pressed key\n"); + process_record(&tapping_key); + tapping_key = (keyrecord_t){}; + debug_tapping_key(); + // enqueue + return false; + } +# endif } // enqueue return false; @@ -177,7 +199,7 @@ bool process_tapping(keyrecord_t *keyp) { } // tap_count > 0 else { - if (IS_TAPPING_KEY(event.key) && !event.pressed) { + if (IS_TAPPING_RECORD(keyp) && !event.pressed) { debug("Tapping: Tap release("); debug_dec(tapping_key.tap.count); debug(")\n"); @@ -186,11 +208,15 @@ bool process_tapping(keyrecord_t *keyp) { tapping_key = *keyp; debug_tapping_key(); return true; - } else if (is_tap_key(event.key) && event.pressed) { + } else if (is_tap_record(keyp) && event.pressed) { if (tapping_key.tap.count > 1) { debug("Tapping: Start new tap with releasing last tap(>1).\n"); // unregister key - process_record(&(keyrecord_t){.tap = tapping_key.tap, .event.key = tapping_key.event.key, .event.time = event.time, .event.pressed = false}); + process_record(&(keyrecord_t){.tap = tapping_key.tap, .event.key = tapping_key.event.key, .event.time = event.time, .event.pressed = false, +#ifdef COMBO_ENABLE + .keycode = tapping_key.keycode, +#endif + }); } else { debug("Tapping: Start while last tap(1).\n"); } @@ -218,17 +244,21 @@ bool process_tapping(keyrecord_t *keyp) { debug_tapping_key(); return false; } else { - if (IS_TAPPING_KEY(event.key) && !event.pressed) { + if (IS_TAPPING_RECORD(keyp) && !event.pressed) { debug("Tapping: End. last timeout tap release(>0)."); keyp->tap = tapping_key.tap; process_record(keyp); tapping_key = (keyrecord_t){}; return true; - } else if (is_tap_key(event.key) && event.pressed) { + } else if (is_tap_record(keyp) && event.pressed) { if (tapping_key.tap.count > 1) { debug("Tapping: Start new tap with releasing last timeout tap(>1).\n"); // unregister key - process_record(&(keyrecord_t){.tap = tapping_key.tap, .event.key = tapping_key.event.key, .event.time = event.time, .event.pressed = false}); + process_record(&(keyrecord_t){.tap = tapping_key.tap, .event.key = tapping_key.event.key, .event.time = event.time, .event.pressed = false, +#ifdef COMBO_ENABLE + .keycode = tapping_key.keycode, +#endif + }); } else { debug("Tapping: Start while last timeout tap(1).\n"); } @@ -248,12 +278,12 @@ bool process_tapping(keyrecord_t *keyp) { } else if (IS_TAPPING_RELEASED()) { if (WITHIN_TAPPING_TERM(event)) { if (event.pressed) { - if (IS_TAPPING_KEY(event.key)) { + if (IS_TAPPING_RECORD(keyp)) { //# ifndef TAPPING_FORCE_HOLD # if !defined(TAPPING_FORCE_HOLD) || defined(TAPPING_FORCE_HOLD_PER_KEY) if ( # ifdef TAPPING_FORCE_HOLD_PER_KEY - !get_tapping_force_hold(get_event_keycode(tapping_key.event, false), keyp) && + !get_tapping_force_hold(get_record_keycode(&tapping_key, false), keyp) && # endif !tapping_key.tap.interrupted && tapping_key.tap.count > 0) { // sequential tap. @@ -271,7 +301,7 @@ bool process_tapping(keyrecord_t *keyp) { // FIX: start new tap again tapping_key = *keyp; return true; - } else if (is_tap_key(event.key)) { + } else if (is_tap_record(keyp)) { // Sequential tap can be interfered with other tap key. debug("Tapping: Start with interfering other tap.\n"); tapping_key = *keyp; @@ -303,7 +333,7 @@ bool process_tapping(keyrecord_t *keyp) { } // not tapping state else { - if (event.pressed && is_tap_key(event.key)) { + if (event.pressed && is_tap_record(keyp)) { debug("Tapping: Start(Press tap key).\n"); tapping_key = *keyp; process_record_tap_hint(&tapping_key); diff --git a/tmk_core/common/action_tapping.h b/quantum/action_tapping.h index 893ccb1ce1..7de8049c7f 100644 --- a/tmk_core/common/action_tapping.h +++ b/quantum/action_tapping.h @@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define WAITING_BUFFER_SIZE 8 #ifndef NO_ACTION_TAPPING +uint16_t get_record_keycode(keyrecord_t *record, bool update_layer_cache); uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache); void action_tapping_process(keyrecord_t record); diff --git a/tmk_core/common/action_util.c b/quantum/action_util.c index a57c8bf66a..9a85bd5040 100644 --- a/tmk_core/common/action_util.c +++ b/quantum/action_util.c @@ -27,15 +27,9 @@ extern keymap_config_t keymap_config; static uint8_t real_mods = 0; static uint8_t weak_mods = 0; static uint8_t macro_mods = 0; - -#ifdef USB_6KRO_ENABLE -# define RO_ADD(a, b) ((a + b) % KEYBOARD_REPORT_KEYS) -# define RO_SUB(a, b) ((a - b + KEYBOARD_REPORT_KEYS) % KEYBOARD_REPORT_KEYS) -# define RO_INC(a) RO_ADD(a, 1) -# define RO_DEC(a) RO_SUB(a, 1) -static int8_t cb_head = 0; -static int8_t cb_tail = 0; -static int8_t cb_count = 0; +#ifdef KEY_OVERRIDE_ENABLE +static uint8_t weak_override_mods = 0; +static uint8_t suppressed_mods = 0; #endif // TODO: pointer variable is not needed @@ -229,6 +223,7 @@ void send_keyboard_report(void) { keyboard_report->mods = real_mods; keyboard_report->mods |= weak_mods; keyboard_report->mods |= macro_mods; + #ifndef NO_ACTION_ONESHOT if (oneshot_mods) { # if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) @@ -244,6 +239,13 @@ void send_keyboard_report(void) { } #endif + +#ifdef KEY_OVERRIDE_ENABLE + // These need to be last to be able to properly control key overrides + keyboard_report->mods &= ~suppressed_mods; + keyboard_report->mods |= weak_override_mods; +#endif + host_keyboard_send(keyboard_report); } @@ -299,6 +301,22 @@ void set_weak_mods(uint8_t mods) { weak_mods = mods; } */ void clear_weak_mods(void) { weak_mods = 0; } +#ifdef KEY_OVERRIDE_ENABLE +/** \brief set weak mods used by key overrides. DO not call this manually + */ +void set_weak_override_mods(uint8_t mods) { weak_override_mods = mods; } +/** \brief clear weak mods used by key overrides. DO not call this manually + */ +void clear_weak_override_mods(void) { weak_override_mods = 0; } + +/** \brief set suppressed mods used by key overrides. DO not call this manually + */ +void set_suppressed_override_mods(uint8_t mods) { suppressed_mods = mods; } +/** \brief clear suppressed mods used by key overrides. DO not call this manually + */ +void clear_suppressed_override_mods(void) { suppressed_mods = 0; } +#endif + /* macro modifier */ /** \brief get macro mods * diff --git a/tmk_core/common/action_util.h b/quantum/action_util.h index f2b3897ae5..f2b3897ae5 100644 --- a/tmk_core/common/action_util.h +++ b/quantum/action_util.h diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c new file mode 100644 index 0000000000..49bb309e80 --- /dev/null +++ b/quantum/audio/audio.c @@ -0,0 +1,542 @@ +/* Copyright 2016-2020 Jack Humbert + * Copyright 2020 JohSchneider + + * 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 "audio.h" +#include "eeconfig.h" +#include "timer.h" +#include "wait.h" + +/* audio system: + * + * audio.[ch] takes care of all overall state, tracking the actively playing + * notes/tones; the notes a SONG consists of; + * ... + * = everything audio-related that is platform agnostic + * + * driver_[avr|chibios]_[dac|pwm] take care of the lower hardware dependent parts, + * specific to each platform and the used subsystem/driver to drive + * the output pins/channels with the calculated frequencies for each + * active tone + * as part of this, the driver has to trigger regular state updates by + * calling 'audio_update_state' through some sort of timer - be it a + * dedicated one or piggybacking on for example the timer used to + * generate a pwm signal/clock. + * + * + * A Note on terminology: + * tone, pitch and frequency are used somewhat interchangeably, in a strict Wikipedia-sense: + * "(Musical) tone, a sound characterized by its duration, pitch (=frequency), + * intensity (=volume), and timbre" + * - intensity/volume is currently not handled at all, although the 'dac_additive' driver could do so + * - timbre is handled globally (TODO: only used with the pwm drivers at the moment) + * + * in musical_note.h a 'note' is the combination of a pitch and a duration + * these are used to create SONG arrays; during playback their frequencies + * are handled as single successive tones, while the durations are + * kept track of in 'audio_update_state' + * + * 'voice' as it is used here, equates to a sort of instrument with its own + * characteristics sound and effects + * the audio system as-is deals only with (possibly multiple) tones of one + * instrument/voice at a time (think: chords). since the number of tones that + * can be reproduced depends on the hardware/driver in use: pwm can only + * reproduce one tone per output/speaker; DACs can reproduce/mix multiple + * when doing additive synthesis. + * + * 'duration' can either be in the beats-per-minute related unit found in + * musical_notes.h, OR in ms; keyboards create SONGs with the former, while + * the internal state of the audio system does its calculations with the later - ms + */ + +#ifndef AUDIO_TONE_STACKSIZE +# define AUDIO_TONE_STACKSIZE 8 +#endif +uint8_t active_tones = 0; // number of tones pushed onto the stack by audio_play_tone - might be more than the hardware is able to reproduce at any single time +musical_tone_t tones[AUDIO_TONE_STACKSIZE]; // stack of currently active tones + +bool playing_melody = false; // playing a SONG? +bool playing_note = false; // or (possibly multiple simultaneous) tones +bool state_changed = false; // global flag, which is set if anything changes with the active_tones + +// melody/SONG related state variables +float (*notes_pointer)[][2]; // SONG, an array of MUSICAL_NOTEs +uint16_t notes_count; // length of the notes_pointer array +bool notes_repeat; // PLAY_SONG or PLAY_LOOP? +uint16_t melody_current_note_duration = 0; // duration of the currently playing note from the active melody, in ms +uint8_t note_tempo = TEMPO_DEFAULT; // beats-per-minute +uint16_t current_note = 0; // index into the array at notes_pointer +bool note_resting = false; // if a short pause was introduced between two notes with the same frequency while playing a melody +uint16_t last_timestamp = 0; + +#ifdef AUDIO_ENABLE_TONE_MULTIPLEXING +# ifndef AUDIO_MAX_SIMULTANEOUS_TONES +# define AUDIO_MAX_SIMULTANEOUS_TONES 3 +# endif +uint16_t tone_multiplexing_rate = AUDIO_TONE_MULTIPLEXING_RATE_DEFAULT; +uint8_t tone_multiplexing_index_shift = 0; // offset used on active-tone array access +#endif + +// provided and used by voices.c +extern uint8_t note_timbre; +extern bool glissando; +extern bool vibrato; +extern uint16_t voices_timer; + +#ifndef STARTUP_SONG +# define STARTUP_SONG SONG(STARTUP_SOUND) +#endif +#ifndef AUDIO_ON_SONG +# define AUDIO_ON_SONG SONG(AUDIO_ON_SOUND) +#endif +#ifndef AUDIO_OFF_SONG +# define AUDIO_OFF_SONG SONG(AUDIO_OFF_SOUND) +#endif +float startup_song[][2] = STARTUP_SONG; +float audio_on_song[][2] = AUDIO_ON_SONG; +float audio_off_song[][2] = AUDIO_OFF_SONG; + +static bool audio_initialized = false; +static bool audio_driver_stopped = true; +audio_config_t audio_config; + +void audio_init() { + if (audio_initialized) { + return; + } + + // Check EEPROM +#ifdef EEPROM_ENABLE + if (!eeconfig_is_enabled()) { + eeconfig_init(); + } + audio_config.raw = eeconfig_read_audio(); +#else // EEPROM settings + audio_config.enable = true; +# ifdef AUDIO_CLICKY_ON + audio_config.clicky_enable = true; +# endif +#endif // EEPROM settings + + for (uint8_t i = 0; i < AUDIO_TONE_STACKSIZE; i++) { + tones[i] = (musical_tone_t){.time_started = 0, .pitch = -1.0f, .duration = 0}; + } + + if (!audio_initialized) { + audio_driver_initialize(); + audio_initialized = true; + } + stop_all_notes(); +#ifndef AUDIO_INIT_DELAY + audio_startup(); +#endif +} + +void audio_startup(void) { + if (audio_config.enable) { + PLAY_SONG(startup_song); + } + + last_timestamp = timer_read(); +} + +void audio_toggle(void) { + if (audio_config.enable) { + stop_all_notes(); + } + audio_config.enable ^= 1; + eeconfig_update_audio(audio_config.raw); + if (audio_config.enable) { + audio_on_user(); + } +} + +void audio_on(void) { + audio_config.enable = 1; + eeconfig_update_audio(audio_config.raw); + audio_on_user(); + PLAY_SONG(audio_on_song); +} + +void audio_off(void) { + PLAY_SONG(audio_off_song); + wait_ms(100); + audio_stop_all(); + audio_config.enable = 0; + eeconfig_update_audio(audio_config.raw); +} + +bool audio_is_on(void) { return (audio_config.enable != 0); } + +void audio_stop_all() { + if (audio_driver_stopped) { + return; + } + + active_tones = 0; + + audio_driver_stop(); + + playing_melody = false; + playing_note = false; + + melody_current_note_duration = 0; + + for (uint8_t i = 0; i < AUDIO_TONE_STACKSIZE; i++) { + tones[i] = (musical_tone_t){.time_started = 0, .pitch = -1.0f, .duration = 0}; + } + + audio_driver_stopped = true; +} + +void audio_stop_tone(float pitch) { + if (pitch < 0.0f) { + pitch = -1 * pitch; + } + + if (playing_note) { + if (!audio_initialized) { + audio_init(); + } + bool found = false; + for (int i = AUDIO_TONE_STACKSIZE - 1; i >= 0; i--) { + found = (tones[i].pitch == pitch); + if (found) { + tones[i] = (musical_tone_t){.time_started = 0, .pitch = -1.0f, .duration = 0}; + for (int j = i; (j < AUDIO_TONE_STACKSIZE - 1); j++) { + tones[j] = tones[j + 1]; + tones[j + 1] = (musical_tone_t){.time_started = 0, .pitch = -1.0f, .duration = 0}; + } + break; + } + } + if (!found) { + return; + } + + state_changed = true; + active_tones--; + if (active_tones < 0) active_tones = 0; +#ifdef AUDIO_ENABLE_TONE_MULTIPLEXING + if (tone_multiplexing_index_shift >= active_tones) { + tone_multiplexing_index_shift = 0; + } +#endif + if (active_tones == 0) { + audio_driver_stop(); + audio_driver_stopped = true; + playing_note = false; + } + } +} + +void audio_play_note(float pitch, uint16_t duration) { + if (!audio_config.enable) { + return; + } + + if (!audio_initialized) { + audio_init(); + } + + if (pitch < 0.0f) { + pitch = -1 * pitch; + } + + // round-robin: shifting out old tones, keeping only unique ones + // if the new frequency is already amongst the active tones, shift it to the top of the stack + bool found = false; + for (int i = active_tones - 1; i >= 0; i--) { + found = (tones[i].pitch == pitch); + if (found) { + for (int j = i; (j < active_tones - 1); j++) { + tones[j] = tones[j + 1]; + tones[j + 1] = (musical_tone_t){.time_started = timer_read(), .pitch = pitch, .duration = duration}; + } + return; // since this frequency played already, the hardware was already started + } + } + + // frequency/tone is actually new, so we put it on the top of the stack + active_tones++; + if (active_tones > AUDIO_TONE_STACKSIZE) { + active_tones = AUDIO_TONE_STACKSIZE; + // shift out the oldest tone to make room + for (int i = 0; i < active_tones - 1; i++) { + tones[i] = tones[i + 1]; + } + } + state_changed = true; + playing_note = true; + tones[active_tones - 1] = (musical_tone_t){.time_started = timer_read(), .pitch = pitch, .duration = duration}; + + // TODO: needs to be handled per note/tone -> use its timestamp instead? + voices_timer = timer_read(); // reset to zero, for the effects added by voices.c + + if (audio_driver_stopped) { + audio_driver_start(); + audio_driver_stopped = false; + } +} + +void audio_play_tone(float pitch) { audio_play_note(pitch, 0xffff); } + +void audio_play_melody(float (*np)[][2], uint16_t n_count, bool n_repeat) { + if (!audio_config.enable) { + audio_stop_all(); + return; + } + + if (!audio_initialized) { + audio_init(); + } + + // Cancel note if a note is playing + if (playing_note) audio_stop_all(); + + playing_melody = true; + note_resting = false; + + notes_pointer = np; + notes_count = n_count; + notes_repeat = n_repeat; + + current_note = 0; // note in the melody-array/list at note_pointer + + // start first note manually, which also starts the audio_driver + // all following/remaining notes are played by 'audio_update_state' + audio_play_note((*notes_pointer)[current_note][0], audio_duration_to_ms((*notes_pointer)[current_note][1])); + last_timestamp = timer_read(); + melody_current_note_duration = audio_duration_to_ms((*notes_pointer)[current_note][1]); +} + +float click[2][2]; +void audio_play_click(uint16_t delay, float pitch, uint16_t duration) { + uint16_t duration_tone = audio_ms_to_duration(duration); + uint16_t duration_delay = audio_ms_to_duration(delay); + + if (delay <= 0.0f) { + click[0][0] = pitch; + click[0][1] = duration_tone; + click[1][0] = 0.0f; + click[1][1] = 0.0f; + audio_play_melody(&click, 1, false); + } else { + // first note is a rest/pause + click[0][0] = 0.0f; + click[0][1] = duration_delay; + // second note is the actual click + click[1][0] = pitch; + click[1][1] = duration_tone; + audio_play_melody(&click, 2, false); + } +} + +bool audio_is_playing_note(void) { return playing_note; } + +bool audio_is_playing_melody(void) { return playing_melody; } + +uint8_t audio_get_number_of_active_tones(void) { return active_tones; } + +float audio_get_frequency(uint8_t tone_index) { + if (tone_index >= active_tones) { + return 0.0f; + } + return tones[active_tones - tone_index - 1].pitch; +} + +float audio_get_processed_frequency(uint8_t tone_index) { + if (tone_index >= active_tones) { + return 0.0f; + } + + int8_t index = active_tones - tone_index - 1; + // new tones are stacked on top (= appended at the end), so the most recent/current is MAX-1 + +#ifdef AUDIO_ENABLE_TONE_MULTIPLEXING + index = index - tone_multiplexing_index_shift; + if (index < 0) // wrap around + index += active_tones; +#endif + + if (tones[index].pitch <= 0.0f) { + return 0.0f; + } + + return voice_envelope(tones[index].pitch); +} + +bool audio_update_state(void) { + if (!playing_note && !playing_melody) { + return false; + } + + bool goto_next_note = false; + uint16_t current_time = timer_read(); + + if (playing_melody) { + goto_next_note = timer_elapsed(last_timestamp) >= melody_current_note_duration; + if (goto_next_note) { + uint16_t delta = timer_elapsed(last_timestamp) - melody_current_note_duration; + last_timestamp = current_time; + uint16_t previous_note = current_note; + current_note++; + voices_timer = timer_read(); // reset to zero, for the effects added by voices.c + + if (current_note >= notes_count) { + if (notes_repeat) { + current_note = 0; + } else { + audio_stop_all(); + return false; + } + } + + if (!note_resting && (*notes_pointer)[previous_note][0] == (*notes_pointer)[current_note][0]) { + note_resting = true; + + // special handling for successive notes of the same frequency: + // insert a short pause to separate them audibly + audio_play_note(0.0f, audio_duration_to_ms(2)); + current_note = previous_note; + melody_current_note_duration = audio_duration_to_ms(2); + + } else { + note_resting = false; + + // TODO: handle glissando here (or remember previous and current tone) + /* there would need to be a freq(here we are) -> freq(next note) + * and do slide/glissando in between problem here is to know which + * frequency on the stack relates to what other? e.g. a melody starts + * tones in a sequence, and stops expiring one, so the most recently + * stopped is the starting point for a glissando to the most recently started? + * how to detect and preserve this relation? + * and what about user input, chords, ...? + */ + + // '- delta': Skip forward in the next note's length if we've over shot + // the last, so the overall length of the song is the same + uint16_t duration = audio_duration_to_ms((*notes_pointer)[current_note][1]); + + // Skip forward past any completely missed notes + while (delta > duration && current_note < notes_count - 1) { + delta -= duration; + current_note++; + duration = audio_duration_to_ms((*notes_pointer)[current_note][1]); + } + + if (delta < duration) { + duration -= delta; + } else { + // Only way to get here is if it is the last note and + // we have completely missed it. Play it for 1ms... + duration = 1; + } + + audio_play_note((*notes_pointer)[current_note][0], duration); + melody_current_note_duration = duration; + } + } + } + + if (playing_note) { +#ifdef AUDIO_ENABLE_TONE_MULTIPLEXING + tone_multiplexing_index_shift = (int)(current_time / tone_multiplexing_rate) % MIN(AUDIO_MAX_SIMULTANEOUS_TONES, active_tones); + goto_next_note = true; +#endif + if (vibrato || glissando) { + // force update on each cycle, since vibrato shifts the frequency slightly + goto_next_note = true; + } + + // housekeeping: stop notes that have no playtime left + for (int i = 0; i < active_tones; i++) { + if ((tones[i].duration != 0xffff) // indefinitely playing notes, started by 'audio_play_tone' + && (tones[i].duration != 0) // 'uninitialized' + ) { + if (timer_elapsed(tones[i].time_started) >= tones[i].duration) { + audio_stop_tone(tones[i].pitch); // also sets 'state_changed=true' + } + } + } + } + + // state-changes have a higher priority, always triggering the hardware to update + if (state_changed) { + state_changed = false; + return true; + } + + return goto_next_note; +} + +// Tone-multiplexing functions +#ifdef AUDIO_ENABLE_TONE_MULTIPLEXING +void audio_set_tone_multiplexing_rate(uint16_t rate) { tone_multiplexing_rate = rate; } +void audio_enable_tone_multiplexing(void) { tone_multiplexing_rate = AUDIO_TONE_MULTIPLEXING_RATE_DEFAULT; } +void audio_disable_tone_multiplexing(void) { tone_multiplexing_rate = 0; } +void audio_increase_tone_multiplexing_rate(uint16_t change) { + if ((0xffff - change) > tone_multiplexing_rate) { + tone_multiplexing_rate += change; + } +} +void audio_decrease_tone_multiplexing_rate(uint16_t change) { + if (change <= tone_multiplexing_rate) { + tone_multiplexing_rate -= change; + } +} +#endif + +// Tempo functions + +void audio_set_tempo(uint8_t tempo) { + if (tempo < 10) note_tempo = 10; + // else if (tempo > 250) + // note_tempo = 250; + else + note_tempo = tempo; +} + +void audio_increase_tempo(uint8_t tempo_change) { + if (tempo_change > 255 - note_tempo) + note_tempo = 255; + else + note_tempo += tempo_change; +} + +void audio_decrease_tempo(uint8_t tempo_change) { + if (tempo_change >= note_tempo - 10) + note_tempo = 10; + else + note_tempo -= tempo_change; +} + +// TODO in the int-math version are some bugs; songs sometimes abruptly end - maybe an issue with the timer/system-tick wrapping around? +uint16_t audio_duration_to_ms(uint16_t duration_bpm) { +#if defined(__AVR__) + // doing int-math saves us some bytes in the overall firmware size, but the intermediate result is less accurate before being cast to/returned as uint + return ((uint32_t)duration_bpm * 60 * 1000) / (64 * note_tempo); + // NOTE: beware of uint16_t overflows when note_tempo is low and/or the duration is long +#else + return ((float)duration_bpm * 60) / (64 * note_tempo) * 1000; +#endif +} +uint16_t audio_ms_to_duration(uint16_t duration_ms) { +#if defined(__AVR__) + return ((uint32_t)duration_ms * 64 * note_tempo) / 60 / 1000; +#else + return ((float)duration_ms * 64 * note_tempo) / 60 / 1000; +#endif +} diff --git a/quantum/audio/luts.h b/quantum/audio/luts.h index 74980b292e..8bb0454493 100644 --- a/quantum/audio/luts.h +++ b/quantum/audio/luts.h @@ -16,14 +16,8 @@ #pragma once -#if defined(__AVR__) -# include <avr/io.h> -# include <avr/interrupt.h> -# include <avr/pgmspace.h> -#else -# include <ch.h> -# include <hal.h> -#endif +#include <float.h> +#include <stdint.h> #define VIBRATO_LUT_LENGTH 20 diff --git a/quantum/audio/voices.h b/quantum/audio/voices.h index abafa2b404..478cb1ef0b 100644 --- a/quantum/audio/voices.h +++ b/quantum/audio/voices.h @@ -18,9 +18,6 @@ #include <stdint.h> #include <stdbool.h> -#if defined(__AVR__) -# include <avr/io.h> -#endif #include "wait.h" #include "luts.h" diff --git a/quantum/bootmagic/bootmagic.h b/quantum/bootmagic/bootmagic.h index 959750178d..db826025ce 100644 --- a/quantum/bootmagic/bootmagic.h +++ b/quantum/bootmagic/bootmagic.h @@ -15,9 +15,7 @@ */ #pragma once -#if defined(BOOTMAGIC_ENABLE) -# include "bootmagic_full.h" -#elif defined(BOOTMAGIC_LITE) +#if defined(BOOTMAGIC_LITE) # include "bootmagic_lite.h" #endif diff --git a/quantum/bootmagic/bootmagic_full.c b/quantum/bootmagic/bootmagic_full.c deleted file mode 100644 index a7a0dcfcb2..0000000000 --- a/quantum/bootmagic/bootmagic_full.c +++ /dev/null @@ -1,147 +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/>. - */ -#include <stdint.h> -#include <stdbool.h> -#include "wait.h" -#include "matrix.h" -#include "bootloader.h" -#include "debug.h" -#include "keymap.h" -#include "host.h" -#include "action_layer.h" -#include "eeconfig.h" -#include "bootmagic.h" - -/** \brief Scan Keycode - * - * FIXME: needs doc - */ -static bool scan_keycode(uint8_t keycode) { - for (uint8_t r = 0; r < MATRIX_ROWS; r++) { - matrix_row_t matrix_row = matrix_get_row(r); - for (uint8_t c = 0; c < MATRIX_COLS; c++) { - if (matrix_row & ((matrix_row_t)1 << c)) { - if (keycode == keymap_key_to_keycode(0, (keypos_t){.row = r, .col = c})) { - return true; - } - } - } - } - return false; -} - -/** \brief Bootmagic Scan Keycode - * - * FIXME: needs doc - */ -static bool bootmagic_scan_keycode(uint8_t keycode) { - if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false; - - return scan_keycode(keycode); -} - -void bootmagic(void) { - /* do scans in case of bounce */ - print("bootmagic scan: ... "); - uint8_t scan = 100; - while (scan--) { - matrix_scan(); - wait_ms(10); - } - print("done.\n"); - - /* bootmagic skip */ - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SKIP)) { - return; - } - - /* eeconfig clear */ - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EEPROM_CLEAR)) { - eeconfig_init(); - } - - /* bootloader */ - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_BOOTLOADER)) { - bootloader_jump(); - } - - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_ENABLE)) { - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_MATRIX)) { - debug_config.matrix = !debug_config.matrix; - } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_KEYBOARD)) { - debug_config.keyboard = !debug_config.keyboard; - } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_MOUSE)) { - debug_config.mouse = !debug_config.mouse; - } else { - debug_config.enable = !debug_config.enable; - } - } - eeconfig_update_debug(debug_config.raw); - - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK)) { - keymap_config.swap_control_capslock = !keymap_config.swap_control_capslock; - } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL)) { - keymap_config.capslock_to_control = !keymap_config.capslock_to_control; - } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_LALT_LGUI)) { - keymap_config.swap_lalt_lgui = !keymap_config.swap_lalt_lgui; - } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_RALT_RGUI)) { - keymap_config.swap_ralt_rgui = !keymap_config.swap_ralt_rgui; - } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_NO_GUI)) { - keymap_config.no_gui = !keymap_config.no_gui; - } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_GRAVE_ESC)) { - keymap_config.swap_grave_esc = !keymap_config.swap_grave_esc; - } - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE)) { - keymap_config.swap_backslash_backspace = !keymap_config.swap_backslash_backspace; - } - if (bootmagic_scan_keycode(BOOTMAGIC_HOST_NKRO)) { - keymap_config.nkro = !keymap_config.nkro; - } - eeconfig_update_keymap(keymap_config.raw); - - /* default layer */ - uint8_t default_layer = 0; - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { - default_layer |= (1 << 0); - } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) { - default_layer |= (1 << 1); - } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) { - default_layer |= (1 << 2); - } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) { - default_layer |= (1 << 3); - } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) { - default_layer |= (1 << 4); - } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) { - default_layer |= (1 << 5); - } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) { - default_layer |= (1 << 6); - } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) { - default_layer |= (1 << 7); - } - eeconfig_update_default_layer(default_layer); - - /* EE_HANDS handedness */ - if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_LEFT)) { - eeconfig_update_handedness(true); - } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_RIGHT)) { - eeconfig_update_handedness(false); - } -} diff --git a/quantum/bootmagic/bootmagic_full.h b/quantum/bootmagic/bootmagic_full.h deleted file mode 100644 index 28f914c1b6..0000000000 --- a/quantum/bootmagic/bootmagic_full.h +++ /dev/null @@ -1,115 +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 - -/* FIXME: Add special doxygen comments for defines here. */ - -/* bootmagic salt key */ -#ifndef BOOTMAGIC_KEY_SALT -# define BOOTMAGIC_KEY_SALT KC_SPACE -#endif - -/* skip bootmagic and eeconfig */ -#ifndef BOOTMAGIC_KEY_SKIP -# define BOOTMAGIC_KEY_SKIP KC_ESC -#endif - -/* eeprom clear */ -#ifndef BOOTMAGIC_KEY_EEPROM_CLEAR -# define BOOTMAGIC_KEY_EEPROM_CLEAR KC_BSPACE -#endif - -/* kick up bootloader */ -#ifndef BOOTMAGIC_KEY_BOOTLOADER -# define BOOTMAGIC_KEY_BOOTLOADER KC_B -#endif - -/* debug enable */ -#ifndef BOOTMAGIC_KEY_DEBUG_ENABLE -# define BOOTMAGIC_KEY_DEBUG_ENABLE KC_D -#endif -#ifndef BOOTMAGIC_KEY_DEBUG_MATRIX -# define BOOTMAGIC_KEY_DEBUG_MATRIX KC_X -#endif -#ifndef BOOTMAGIC_KEY_DEBUG_KEYBOARD -# define BOOTMAGIC_KEY_DEBUG_KEYBOARD KC_K -#endif -#ifndef BOOTMAGIC_KEY_DEBUG_MOUSE -# define BOOTMAGIC_KEY_DEBUG_MOUSE KC_M -#endif -#ifndef BOOTMAGIC_KEY_EE_HANDS_LEFT -# define BOOTMAGIC_KEY_EE_HANDS_LEFT KC_L -#endif -#ifndef BOOTMAGIC_KEY_EE_HANDS_RIGHT -# define BOOTMAGIC_KEY_EE_HANDS_RIGHT KC_R -#endif - -/* - * keymap config - */ -#ifndef BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK -# define BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK KC_LCTRL -#endif -#ifndef BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL -# define BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL KC_CAPSLOCK -#endif -#ifndef BOOTMAGIC_KEY_SWAP_LALT_LGUI -# define BOOTMAGIC_KEY_SWAP_LALT_LGUI KC_LALT -#endif -#ifndef BOOTMAGIC_KEY_SWAP_RALT_RGUI -# define BOOTMAGIC_KEY_SWAP_RALT_RGUI KC_RALT -#endif -#ifndef BOOTMAGIC_KEY_NO_GUI -# define BOOTMAGIC_KEY_NO_GUI KC_LGUI -#endif -#ifndef BOOTMAGIC_KEY_SWAP_GRAVE_ESC -# define BOOTMAGIC_KEY_SWAP_GRAVE_ESC KC_GRAVE -#endif -#ifndef BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE -# define BOOTMAGIC_KEY_SWAP_BACKSLASH_BACKSPACE KC_BSLASH -#endif -#ifndef BOOTMAGIC_HOST_NKRO -# define BOOTMAGIC_HOST_NKRO KC_N -#endif - -/* - * change default layer - */ -#ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_0 -# define BOOTMAGIC_KEY_DEFAULT_LAYER_0 KC_0 -#endif -#ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_1 -# define BOOTMAGIC_KEY_DEFAULT_LAYER_1 KC_1 -#endif -#ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_2 -# define BOOTMAGIC_KEY_DEFAULT_LAYER_2 KC_2 -#endif -#ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_3 -# define BOOTMAGIC_KEY_DEFAULT_LAYER_3 KC_3 -#endif -#ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_4 -# define BOOTMAGIC_KEY_DEFAULT_LAYER_4 KC_4 -#endif -#ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_5 -# define BOOTMAGIC_KEY_DEFAULT_LAYER_5 KC_5 -#endif -#ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_6 -# define BOOTMAGIC_KEY_DEFAULT_LAYER_6 KC_6 -#endif -#ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_7 -# define BOOTMAGIC_KEY_DEFAULT_LAYER_7 KC_7 -#endif
\ No newline at end of file diff --git a/quantum/bootmagic/bootmagic_lite.c b/quantum/bootmagic/bootmagic_lite.c index 9cbdcb0bbd..54bbf5a2ee 100644 --- a/quantum/bootmagic/bootmagic_lite.c +++ b/quantum/bootmagic/bootmagic_lite.c @@ -19,13 +19,7 @@ * * ...just incase someone wants to only change the eeprom behaviour */ -__attribute__((weak)) void bootmagic_lite_reset_eeprom(void) { -#if defined(VIA_ENABLE) - via_eeprom_reset(); -#else - eeconfig_disable(); -#endif -} +__attribute__((weak)) void bootmagic_lite_reset_eeprom(void) { eeconfig_disable(); } /** \brief The lite version of TMK's bootmagic based on Wilba. * diff --git a/quantum/color.h b/quantum/color.h index 4783f6839c..e2cfc46927 100644 --- a/quantum/color.h +++ b/quantum/color.h @@ -19,6 +19,60 @@ #include <stdint.h> #include <stdbool.h> +// clang-format off + +/* + * RGB Colors + */ +#define RGB_AZURE 0x99, 0xF5, 0xFF +#define RGB_BLACK 0x00, 0x00, 0x00 +#define RGB_BLUE 0x00, 0x00, 0xFF +#define RGB_CHARTREUSE 0x80, 0xFF, 0x00 +#define RGB_CORAL 0xFF, 0x7C, 0x4D +#define RGB_CYAN 0x00, 0xFF, 0xFF +#define RGB_GOLD 0xFF, 0xD9, 0x00 +#define RGB_GOLDENROD 0xD9, 0xA5, 0x21 +#define RGB_GREEN 0x00, 0xFF, 0x00 +#define RGB_MAGENTA 0xFF, 0x00, 0xFF +#define RGB_ORANGE 0xFF, 0x80, 0x00 +#define RGB_PINK 0xFF, 0x80, 0xBF +#define RGB_PURPLE 0x7A, 0x00, 0xFF +#define RGB_RED 0xFF, 0x00, 0x00 +#define RGB_SPRINGGREEN 0x00, 0xFF, 0x80 +#define RGB_TEAL 0x00, 0x80, 0x80 +#define RGB_TURQUOISE 0x47, 0x6E, 0x6A +#define RGB_WHITE 0xFF, 0xFF, 0xFF +#define RGB_YELLOW 0xFF, 0xFF, 0x00 +#define RGB_OFF RGB_BLACK + +/* + * HSV Colors + * + * All values (including hue) are scaled to 0-255 + */ +#define HSV_AZURE 132, 102, 255 +#define HSV_BLACK 0, 0, 0 +#define HSV_BLUE 170, 255, 255 +#define HSV_CHARTREUSE 64, 255, 255 +#define HSV_CORAL 11, 176, 255 +#define HSV_CYAN 128, 255, 255 +#define HSV_GOLD 36, 255, 255 +#define HSV_GOLDENROD 30, 218, 218 +#define HSV_GREEN 85, 255, 255 +#define HSV_MAGENTA 213, 255, 255 +#define HSV_ORANGE 28, 255, 255 +#define HSV_PINK 234, 128, 255 +#define HSV_PURPLE 191, 255, 255 +#define HSV_RED 0, 255, 255 +#define HSV_SPRINGGREEN 106, 255, 255 +#define HSV_TEAL 128, 255, 128 +#define HSV_TURQUOISE 123, 90, 112 +#define HSV_WHITE 0, 0, 255 +#define HSV_YELLOW 43, 255, 255 +#define HSV_OFF HSV_BLACK + +// clang-format on + #if defined(__GNUC__) # define PACKED __attribute__((__packed__)) #else diff --git a/quantum/command.c b/quantum/command.c index 34c4b36b1c..6d56a25ea1 100644 --- a/quantum/command.c +++ b/quantum/command.c @@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # include "backlight.h" #endif -#if defined(MOUSEKEY_ENABLE) && !defined(MK_3_SPEED) +#if defined(MOUSEKEY_ENABLE) # include "mousekey.h" #endif @@ -53,9 +53,8 @@ static void print_version(void); static void print_status(void); static bool command_console(uint8_t code); static void command_console_help(void); -#if defined(MOUSEKEY_ENABLE) && !defined(MK_3_SPEED) +#if defined(MOUSEKEY_ENABLE) static bool mousekey_console(uint8_t code); -static void mousekey_console_help(void); #endif static void switch_default_layer(uint8_t layer); @@ -74,7 +73,7 @@ bool command_proc(uint8_t code) { else return (command_console_extra(code) || command_console(code)); break; -#if defined(MOUSEKEY_ENABLE) && !defined(MK_3_SPEED) +#if defined(MOUSEKEY_ENABLE) case MOUSEKEY: mousekey_console(code); break; @@ -103,190 +102,220 @@ bool command_console_extra(uint8_t code) { /*********************************************************** * Command common ***********************************************************/ + static void command_common_help(void) { - print("\n\t- Magic -\n" STR(MAGIC_KEY_DEBUG) ": Debug Message Toggle\n" STR(MAGIC_KEY_DEBUG_MATRIX) ": Matrix Debug Mode Toggle - Show keypresses in matrix grid\n" STR(MAGIC_KEY_DEBUG_KBD) ": Keyboard Debug Toggle - Show keypress report\n" STR(MAGIC_KEY_DEBUG_MOUSE) ": Debug Mouse Toggle\n" STR(MAGIC_KEY_VERSION) ": Version\n" STR(MAGIC_KEY_STATUS) ": Status\n" STR(MAGIC_KEY_CONSOLE) ": Activate Console Mode\n" + print(/* clang-format off */ + "\n\t- Magic -\n" + + STR(MAGIC_KEY_DEBUG) ": Debug Message Toggle\n" + STR(MAGIC_KEY_DEBUG_MATRIX) ": Matrix Debug Mode Toggle" + " - Show keypresses in matrix grid\n" + STR(MAGIC_KEY_DEBUG_KBD) ": Keyboard Debug Toggle" + " - Show keypress report\n" + STR(MAGIC_KEY_DEBUG_MOUSE) ": Debug Mouse Toggle\n" + STR(MAGIC_KEY_VERSION) ": Version\n" + STR(MAGIC_KEY_STATUS) ": Status\n" + STR(MAGIC_KEY_CONSOLE) ": Activate Console Mode\n" #if MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM - STR(MAGIC_KEY_LAYER0) ": Switch to Layer 0\n" STR(MAGIC_KEY_LAYER1) ": Switch to Layer 1\n" STR(MAGIC_KEY_LAYER2) ": Switch to Layer 2\n" STR(MAGIC_KEY_LAYER3) ": Switch to Layer 3\n" STR(MAGIC_KEY_LAYER4) ": Switch to Layer 4\n" STR(MAGIC_KEY_LAYER5) ": Switch to Layer 5\n" STR(MAGIC_KEY_LAYER6) ": Switch to Layer 6\n" STR(MAGIC_KEY_LAYER7) ": Switch to Layer 7\n" STR(MAGIC_KEY_LAYER8) ": Switch to Layer 8\n" STR(MAGIC_KEY_LAYER9) ": Switch to Layer 9\n" + STR(MAGIC_KEY_LAYER0) ": Switch to Layer 0\n" + STR(MAGIC_KEY_LAYER1) ": Switch to Layer 1\n" + STR(MAGIC_KEY_LAYER2) ": Switch to Layer 2\n" + STR(MAGIC_KEY_LAYER3) ": Switch to Layer 3\n" + STR(MAGIC_KEY_LAYER4) ": Switch to Layer 4\n" + STR(MAGIC_KEY_LAYER5) ": Switch to Layer 5\n" + STR(MAGIC_KEY_LAYER6) ": Switch to Layer 6\n" + STR(MAGIC_KEY_LAYER7) ": Switch to Layer 7\n" + STR(MAGIC_KEY_LAYER8) ": Switch to Layer 8\n" + STR(MAGIC_KEY_LAYER9) ": Switch to Layer 9\n" #endif #if MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS - "F1-F10: Switch to Layer 0-9 (F10 = L0)\n" + "F1-F10: Switch to Layer 0-9 (F10 = L0)\n" #endif #if MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS - "0-9: Switch to Layer 0-9\n" + "0-9: Switch to Layer 0-9\n" #endif - STR(MAGIC_KEY_LAYER0_ALT) ": Switch to Layer 0 (alternate)\n" + STR(MAGIC_KEY_LAYER0_ALT) ": Switch to Layer 0 (alternate)\n" - STR(MAGIC_KEY_BOOTLOADER) ": Jump to Bootloader\n" STR(MAGIC_KEY_BOOTLOADER_ALT) ": Jump to Bootloader (alternate)\n" + STR(MAGIC_KEY_BOOTLOADER) ": Jump to Bootloader\n" + STR(MAGIC_KEY_BOOTLOADER_ALT) ": Jump to Bootloader (alternate)\n" #ifdef KEYBOARD_LOCK_ENABLE - STR(MAGIC_KEY_LOCK) ": Lock Keyboard\n" + STR(MAGIC_KEY_LOCK) ": Lock Keyboard\n" #endif - STR(MAGIC_KEY_EEPROM) ": Print EEPROM Settings\n" STR(MAGIC_KEY_EEPROM_CLEAR) ": Clear EEPROM\n" + STR(MAGIC_KEY_EEPROM) ": Print EEPROM Settings\n" + STR(MAGIC_KEY_EEPROM_CLEAR) ": Clear EEPROM\n" #ifdef NKRO_ENABLE - STR(MAGIC_KEY_NKRO) ": NKRO Toggle\n" + STR(MAGIC_KEY_NKRO) ": NKRO Toggle\n" #endif #ifdef SLEEP_LED_ENABLE - STR(MAGIC_KEY_SLEEP_LED) ": Sleep LED Test\n" + STR(MAGIC_KEY_SLEEP_LED) ": Sleep LED Test\n" #endif - ); + ); /* clang-format on */ } static void print_version(void) { - // print version & information - print("\n\t- Version -\n"); - print("VID: " STR(VENDOR_ID) "(" STR(MANUFACTURER) ") " - "PID: " STR(PRODUCT_ID) "(" STR(PRODUCT) ") " - "VER: " STR(DEVICE_VER) "\n"); - print("BUILD: (" __DATE__ ")\n"); + print(/* clang-format off */ + "\n\t- Version -\n" + "VID: " STR(VENDOR_ID) "(" STR(MANUFACTURER) ") " + "PID: " STR(PRODUCT_ID) "(" STR(PRODUCT) ") " + "VER: " STR(DEVICE_VER) "\n" + "BUILD: (" __DATE__ ")\n" #ifndef SKIP_VERSION # ifdef PROTOCOL_CHIBIOS - print("CHIBIOS: " STR(CHIBIOS_VERSION) ", CONTRIB: " STR(CHIBIOS_CONTRIB_VERSION) "\n"); + "CHIBIOS: " STR(CHIBIOS_VERSION) + ", CONTRIB: " STR(CHIBIOS_CONTRIB_VERSION) "\n" # endif #endif /* build options */ - print("OPTIONS:" + "OPTIONS:" #ifdef PROTOCOL_LUFA - " LUFA" + " LUFA" #endif #ifdef PROTOCOL_VUSB - " VUSB" + " VUSB" #endif #ifdef BOOTMAGIC_ENABLE - " BOOTMAGIC" + " BOOTMAGIC" #endif #ifdef MOUSEKEY_ENABLE - " MOUSEKEY" + " MOUSEKEY" #endif #ifdef EXTRAKEY_ENABLE - " EXTRAKEY" + " EXTRAKEY" #endif #ifdef CONSOLE_ENABLE - " CONSOLE" + " CONSOLE" #endif #ifdef COMMAND_ENABLE - " COMMAND" + " COMMAND" #endif #ifdef NKRO_ENABLE - " NKRO" + " NKRO" #endif #ifdef LTO_ENABLE - " LTO" + " LTO" #endif - " " STR(BOOTLOADER_SIZE) "\n"); + " " STR(BOOTLOADER_SIZE) "\n" - print("GCC: " STR(__GNUC__) "." STR(__GNUC_MINOR__) "." STR(__GNUC_PATCHLEVEL__) + "GCC: " STR(__GNUC__) + "." STR(__GNUC_MINOR__) + "." STR(__GNUC_PATCHLEVEL__) #if defined(__AVR__) - " AVR-LIBC: " __AVR_LIBC_VERSION_STRING__ " AVR_ARCH: avr" STR(__AVR_ARCH__) + " AVR-LIBC: " __AVR_LIBC_VERSION_STRING__ + " AVR_ARCH: avr" STR(__AVR_ARCH__) #endif - "\n"); - - return; + "\n" + ); /* clang-format on */ } static void print_status(void) { - print("\n\t- Status -\n"); + xprintf(/* clang-format off */ + "\n\t- Status -\n" + + "host_keyboard_leds(): %02X\n" +#ifndef PROTOCOL_VUSB + "keyboard_protocol: %02X\n" + "keyboard_idle: %02X\n" +#endif +#ifdef NKRO_ENABLE + "keymap_config.nkro: %02X\n" +#endif + "timer_read32(): %08lX\n" - print_val_hex8(host_keyboard_leds()); + , host_keyboard_leds() #ifndef PROTOCOL_VUSB - // these aren't set on the V-USB protocol, so we just ignore them for now - print_val_hex8(keyboard_protocol); - print_val_hex8(keyboard_idle); + /* these aren't set on the V-USB protocol, so we just ignore them for now */ + , keyboard_protocol + , keyboard_idle #endif #ifdef NKRO_ENABLE - print_val_hex8(keymap_config.nkro); + , keymap_config.nkro #endif - print_val_hex32(timer_read32()); - return; + , timer_read32() + + ); /* clang-format on */ } -static void print_eeconfig(void) { -// Print these variables if NO_PRINT or USER_PRINT are not defined. #if !defined(NO_PRINT) && !defined(USER_PRINT) - - print("default_layer: "); - print_dec(eeconfig_read_default_layer()); - print("\n"); +static void print_eeconfig(void) { + xprintf("eeconfig:\ndefault_layer: %u\n", eeconfig_read_default_layer()); debug_config_t dc; dc.raw = eeconfig_read_debug(); - print("debug_config.raw: "); - print_hex8(dc.raw); - print("\n"); - print(".enable: "); - print_dec(dc.enable); - print("\n"); - print(".matrix: "); - print_dec(dc.matrix); - print("\n"); - print(".keyboard: "); - print_dec(dc.keyboard); - print("\n"); - print(".mouse: "); - print_dec(dc.mouse); - print("\n"); + xprintf(/* clang-format off */ + + "debug_config.raw: %02X\n" + ".enable: %u\n" + ".matrix: %u\n" + ".keyboard: %u\n" + ".mouse: %u\n" + + , dc.raw + , dc.enable + , dc.matrix + , dc.keyboard + , dc.mouse + ); /* clang-format on */ keymap_config_t kc; kc.raw = eeconfig_read_keymap(); - print("keymap_config.raw: "); - print_hex8(kc.raw); - print("\n"); - print(".swap_control_capslock: "); - print_dec(kc.swap_control_capslock); - print("\n"); - print(".capslock_to_control: "); - print_dec(kc.capslock_to_control); - print("\n"); - print(".swap_lctl_lgui: "); - print_dec(kc.swap_lctl_lgui); - print("\n"); - print(".swap_rctl_rgui: "); - print_dec(kc.swap_rctl_rgui); - print("\n"); - print(".swap_lalt_lgui: "); - print_dec(kc.swap_lalt_lgui); - print("\n"); - print(".swap_ralt_rgui: "); - print_dec(kc.swap_ralt_rgui); - print("\n"); - print(".no_gui: "); - print_dec(kc.no_gui); - print("\n"); - print(".swap_grave_esc: "); - print_dec(kc.swap_grave_esc); - print("\n"); - print(".swap_backslash_backspace: "); - print_dec(kc.swap_backslash_backspace); - print("\n"); - print(".nkro: "); - print_dec(kc.nkro); - print("\n"); + xprintf(/* clang-format off */ + + "keymap_config.raw: %02X\n" + ".swap_control_capslock: %u\n" + ".capslock_to_control: %u\n" + ".swap_lctl_lgui: %u\n" + ".swap_rctl_rgui: %u\n" + ".swap_lalt_lgui: %u\n" + ".swap_ralt_rgui: %u\n" + ".no_gui: %u\n" + ".swap_grave_esc: %u\n" + ".swap_backslash_backspace: %u\n" + ".nkro: %u\n" + + , kc.raw + , kc.swap_control_capslock + , kc.capslock_to_control + , kc.swap_lctl_lgui + , kc.swap_rctl_rgui + , kc.swap_lalt_lgui + , kc.swap_ralt_rgui + , kc.no_gui + , kc.swap_grave_esc + , kc.swap_backslash_backspace + , kc.nkro + ); /* clang-format on */ # ifdef BACKLIGHT_ENABLE + backlight_config_t bc; bc.raw = eeconfig_read_backlight(); - print("backlight_config.raw: "); - print_hex8(bc.raw); - print("\n"); - print(".enable: "); - print_dec(bc.enable); - print("\n"); - print(".level: "); - print_dec(bc.level); - print("\n"); -# endif /* BACKLIGHT_ENABLE */ + xprintf(/* clang-format off */ + "backlight_config" + + ".raw: %02X\n" + ".enable: %u\n" + ".level: %u\n" + + , bc.raw + , bc.enable + , bc.level -#endif /* !NO_PRINT */ + ); /* clang-format on */ + +# endif /* BACKLIGHT_ENABLE */ } +#endif /* !NO_PRINT && !USER_PRINT */ static bool command_common(uint8_t code) { #ifdef KEYBOARD_LOCK_ENABLE @@ -306,8 +335,9 @@ static bool command_common(uint8_t code) { // print stored eeprom config case MAGIC_KC(MAGIC_KEY_EEPROM): - print("eeconfig:\n"); +#if !defined(NO_PRINT) && !defined(USER_PRINT) print_eeconfig(); +#endif /* !NO_PRINT && !USER_PRINT */ break; // clear eeprom @@ -519,268 +549,199 @@ static bool command_console(uint8_t code) { case KC_H: case KC_SLASH: /* ? */ command_console_help(); - break; + print("C> "); + return true; case KC_Q: case KC_ESC: command_state = ONESHOT; return false; -#if defined(MOUSEKEY_ENABLE) && !defined(MK_3_SPEED) +#if defined(MOUSEKEY_ENABLE) case KC_M: - mousekey_console_help(); - print("M> "); command_state = MOUSEKEY; + mousekey_console(KC_SLASH /* ? */); return true; #endif default: print("?"); return false; } - print("C> "); - return true; } -#if defined(MOUSEKEY_ENABLE) && !defined(MK_3_SPEED) /*********************************************************** * Mousekey console ***********************************************************/ -static uint8_t mousekey_param = 0; -static void mousekey_param_print(void) { -// Print these variables if NO_PRINT or USER_PRINT are not defined. -# if !defined(NO_PRINT) && !defined(USER_PRINT) - print("\n\t- Values -\n"); - print("1: delay(*10ms): "); - print_dec(mk_delay); - print("\n"); - print("2: interval(ms): "); - print_dec(mk_interval); - print("\n"); - print("3: max_speed: "); - print_dec(mk_max_speed); - print("\n"); - print("4: time_to_max: "); - print_dec(mk_time_to_max); - print("\n"); - print("5: wheel_max_speed: "); - print_dec(mk_wheel_max_speed); - print("\n"); - print("6: wheel_time_to_max: "); - print_dec(mk_wheel_time_to_max); - print("\n"); -# endif /* !NO_PRINT */ -} +#if defined(MOUSEKEY_ENABLE) -//#define PRINT_SET_VAL(v) print(#v " = "); print_dec(v); print("\n"); -# define PRINT_SET_VAL(v) xprintf(# v " = %d\n", (v)) -static void mousekey_param_inc(uint8_t param, uint8_t inc) { - switch (param) { - case 1: - if (mk_delay + inc < UINT8_MAX) - mk_delay += inc; - else - mk_delay = UINT8_MAX; - PRINT_SET_VAL(mk_delay); - break; - case 2: - if (mk_interval + inc < UINT8_MAX) - mk_interval += inc; - else - mk_interval = UINT8_MAX; - PRINT_SET_VAL(mk_interval); - break; - case 3: - if (mk_max_speed + inc < UINT8_MAX) - mk_max_speed += inc; - else - mk_max_speed = UINT8_MAX; - PRINT_SET_VAL(mk_max_speed); - break; - case 4: - if (mk_time_to_max + inc < UINT8_MAX) - mk_time_to_max += inc; - else - mk_time_to_max = UINT8_MAX; - PRINT_SET_VAL(mk_time_to_max); - break; - case 5: - if (mk_wheel_max_speed + inc < UINT8_MAX) - mk_wheel_max_speed += inc; - else - mk_wheel_max_speed = UINT8_MAX; - PRINT_SET_VAL(mk_wheel_max_speed); - break; - case 6: - if (mk_wheel_time_to_max + inc < UINT8_MAX) - mk_wheel_time_to_max += inc; - else - mk_wheel_time_to_max = UINT8_MAX; - PRINT_SET_VAL(mk_wheel_time_to_max); - break; - } -} - -static void mousekey_param_dec(uint8_t param, uint8_t dec) { - switch (param) { - case 1: - if (mk_delay > dec) - mk_delay -= dec; - else - mk_delay = 0; - PRINT_SET_VAL(mk_delay); - break; - case 2: - if (mk_interval > dec) - mk_interval -= dec; - else - mk_interval = 0; - PRINT_SET_VAL(mk_interval); - break; - case 3: - if (mk_max_speed > dec) - mk_max_speed -= dec; - else - mk_max_speed = 0; - PRINT_SET_VAL(mk_max_speed); - break; - case 4: - if (mk_time_to_max > dec) - mk_time_to_max -= dec; - else - mk_time_to_max = 0; - PRINT_SET_VAL(mk_time_to_max); - break; - case 5: - if (mk_wheel_max_speed > dec) - mk_wheel_max_speed -= dec; - else - mk_wheel_max_speed = 0; - PRINT_SET_VAL(mk_wheel_max_speed); - break; - case 6: - if (mk_wheel_time_to_max > dec) - mk_wheel_time_to_max -= dec; - else - mk_wheel_time_to_max = 0; - PRINT_SET_VAL(mk_wheel_time_to_max); - break; - } +# if !defined(NO_PRINT) && !defined(USER_PRINT) +static void mousekey_param_print(void) { + xprintf(/* clang-format off */ + +#ifndef MK_3_SPEED + "1: delay(*10ms): %u\n" + "2: interval(ms): %u\n" + "3: max_speed: %u\n" + "4: time_to_max: %u\n" + "5: wheel_max_speed: %u\n" + "6: wheel_time_to_max: %u\n" + + , mk_delay + , mk_interval + , mk_max_speed + , mk_time_to_max + , mk_wheel_max_speed + , mk_wheel_time_to_max +#else + "no knobs sorry\n" +#endif + + ); /* clang-format on */ } +# endif /* !NO_PRINT && !USER_PRINT */ +# if !defined(NO_PRINT) && !defined(USER_PRINT) static void mousekey_console_help(void) { - print("\n\t- Mousekey -\n" - "ESC/q: quit\n" - "1: delay(*10ms)\n" - "2: interval(ms)\n" - "3: max_speed\n" - "4: time_to_max\n" - "5: wheel_max_speed\n" - "6: wheel_time_to_max\n" - "\n" - "p: print values\n" - "d: set defaults\n" - "up: +1\n" - "down: -1\n" - "pgup: +10\n" - "pgdown: -10\n" - "\n" - "speed = delta * max_speed * (repeat / time_to_max)\n"); - xprintf("where delta: cursor=%d, wheel=%d\n" - "See http://en.wikipedia.org/wiki/Mouse_keys\n", - MOUSEKEY_MOVE_DELTA, MOUSEKEY_WHEEL_DELTA); + mousekey_param_print(); + xprintf(/* clang-format off */ + "p: print values\n" + "d: set defaults\n" + "up: +1\n" + "dn: -1\n" + "lt: +10\n" + "rt: -10\n" + "ESC/q: quit\n" + +#ifndef MK_3_SPEED + "\n" + "speed = delta * max_speed * (repeat / time_to_max)\n" + "where delta: cursor=%d, wheel=%d\n" + "See http://en.wikipedia.org/wiki/Mouse_keys\n" + , MOUSEKEY_MOVE_DELTA, MOUSEKEY_WHEEL_DELTA +#endif + + ); /* clang-format on */ } +# endif /* !NO_PRINT && !USER_PRINT */ + +/* Only used by `quantum/command.c` / `command_proc()`. To avoid + * any doubt: we return `false` to return to the main console, + * which differs from the `bool` that `command_proc()` returns. */ +bool mousekey_console(uint8_t code) { + static uint8_t param = 0; + static uint8_t *pp = NULL; + static char * desc = NULL; + +# if defined(NO_PRINT) || defined(USER_PRINT) /* -Wunused-parameter */ + (void)desc; +# endif + + int8_t change = 0; -static bool mousekey_console(uint8_t code) { switch (code) { case KC_H: case KC_SLASH: /* ? */ +# if !defined(NO_PRINT) && !defined(USER_PRINT) + print("\n\t- Mousekey -\n"); mousekey_console_help(); +# endif break; + case KC_Q: case KC_ESC: - if (mousekey_param) { - mousekey_param = 0; - } else { - print("C> "); - command_state = CONSOLE; - return false; - } + print("q\n"); + if (!param) return false; + param = 0; + pp = NULL; + desc = NULL; break; + case KC_P: +# if !defined(NO_PRINT) && !defined(USER_PRINT) + print("\n\t- Values -\n"); mousekey_param_print(); +# endif break; - case KC_1: - case KC_2: - case KC_3: - case KC_4: - case KC_5: - case KC_6: - mousekey_param = numkey2num(code); - break; - case KC_UP: - mousekey_param_inc(mousekey_param, 1); - break; - case KC_DOWN: - mousekey_param_dec(mousekey_param, 1); - break; - case KC_PGUP: - mousekey_param_inc(mousekey_param, 10); - break; - case KC_PGDN: - mousekey_param_dec(mousekey_param, 10); - break; + + case KC_1 ... KC_0: /* KC_0 gives param = 10 */ + param = 1 + code - KC_1; + switch (param) { /* clang-format off */ +# define PARAM(n, v) case n: pp = &(v); desc = #v; break + +#ifndef MK_3_SPEED + PARAM(1, mk_delay); + PARAM(2, mk_interval); + PARAM(3, mk_max_speed); + PARAM(4, mk_time_to_max); + PARAM(5, mk_wheel_max_speed); + PARAM(6, mk_wheel_time_to_max); +#endif /* MK_3_SPEED */ + +# undef PARAM + default: + param = 0; + print("?\n"); + break; + } /* clang-format on */ + if (param) xprintf("%u\n", param); + break; + + /* clang-format off */ + case KC_UP: change = +1; break; + case KC_DOWN: change = -1; break; + case KC_LEFT: change = -10; break; + case KC_RIGHT: change = +10; break; + /* clang-format on */ + case KC_D: + +# ifndef MK_3_SPEED mk_delay = MOUSEKEY_DELAY / 10; mk_interval = MOUSEKEY_INTERVAL; mk_max_speed = MOUSEKEY_MAX_SPEED; mk_time_to_max = MOUSEKEY_TIME_TO_MAX; mk_wheel_max_speed = MOUSEKEY_WHEEL_MAX_SPEED; mk_wheel_time_to_max = MOUSEKEY_WHEEL_TIME_TO_MAX; - print("set default\n"); +# endif /* MK_3_SPEED */ + + print("defaults\n"); break; + default: - print("?"); - return false; + print("?\n"); + break; + } + + if (change) { + if (pp) { + int16_t val = *pp + change; + if (val > (int16_t)UINT8_MAX) + *pp = UINT8_MAX; + else if (val < 0) + *pp = 0; + else + *pp = (uint8_t)val; + xprintf("= %u\n", *pp); + } else { + print("?\n"); + } } - if (mousekey_param) { - xprintf("M%d> ", mousekey_param); + + if (param) { + xprintf("M%u:%s> ", param, desc ? desc : "???"); } else { - print("M>"); + print("M> "); } return true; } -#endif + +#endif /* MOUSEKEY_ENABLE */ /*********************************************************** * Utilities ***********************************************************/ -uint8_t numkey2num(uint8_t code) { - switch (code) { - case KC_1: - return 1; - case KC_2: - return 2; - case KC_3: - return 3; - case KC_4: - return 4; - case KC_5: - return 5; - case KC_6: - return 6; - case KC_7: - return 7; - case KC_8: - return 8; - case KC_9: - return 9; - case KC_0: - return 0; - } - return 0; -} static void switch_default_layer(uint8_t layer) { xprintf("L%d\n", layer); - default_layer_set(1UL << layer); + default_layer_set((layer_state_t)1 << layer); clear_keyboard(); } diff --git a/quantum/command.h b/quantum/command.h index 4f77be085c..676507d3bd 100644 --- a/quantum/command.h +++ b/quantum/command.h @@ -28,8 +28,7 @@ bool command_extra(uint8_t code); bool command_console_extra(uint8_t code); #ifdef COMMAND_ENABLE -uint8_t numkey2num(uint8_t code); -bool command_proc(uint8_t code); +bool command_proc(uint8_t code); #else # define command_proc(code) false #endif diff --git a/quantum/crc.c b/quantum/crc.c new file mode 100644 index 0000000000..0d8b9d6017 --- /dev/null +++ b/quantum/crc.c @@ -0,0 +1,59 @@ +/* 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 "crc.h" + +__attribute__((weak)) void crc_init(void){ + /* Software implementation nothing todo here. */ +}; + +#if defined(CRC8_USE_TABLE) +/** + * Static table used for the table_driven implementation. + */ +static const crc_t crc_table[256] = {0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d, 0x70, 0x77, 0x7e, 0x79, 0x6c, 0x6b, 0x62, 0x65, 0x48, 0x4f, 0x46, 0x41, 0x54, 0x53, 0x5a, 0x5d, 0xe0, 0xe7, 0xee, 0xe9, 0xfc, 0xfb, 0xf2, 0xf5, 0xd8, 0xdf, 0xd6, 0xd1, 0xc4, 0xc3, 0xca, 0xcd, 0x90, 0x97, 0x9e, 0x99, 0x8c, 0x8b, 0x82, 0x85, 0xa8, 0xaf, 0xa6, 0xa1, 0xb4, 0xb3, 0xba, 0xbd, 0xc7, 0xc0, 0xc9, 0xce, 0xdb, 0xdc, 0xd5, 0xd2, 0xff, 0xf8, 0xf1, 0xf6, 0xe3, 0xe4, 0xed, 0xea, 0xb7, 0xb0, 0xb9, 0xbe, 0xab, 0xac, 0xa5, 0xa2, 0x8f, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9d, 0x9a, 0x27, 0x20, 0x29, 0x2e, 0x3b, 0x3c, 0x35, 0x32, 0x1f, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0d, 0x0a, 0x57, 0x50, 0x59, 0x5e, 0x4b, 0x4c, 0x45, 0x42, 0x6f, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7d, 0x7a, + 0x89, 0x8e, 0x87, 0x80, 0x95, 0x92, 0x9b, 0x9c, 0xb1, 0xb6, 0xbf, 0xb8, 0xad, 0xaa, 0xa3, 0xa4, 0xf9, 0xfe, 0xf7, 0xf0, 0xe5, 0xe2, 0xeb, 0xec, 0xc1, 0xc6, 0xcf, 0xc8, 0xdd, 0xda, 0xd3, 0xd4, 0x69, 0x6e, 0x67, 0x60, 0x75, 0x72, 0x7b, 0x7c, 0x51, 0x56, 0x5f, 0x58, 0x4d, 0x4a, 0x43, 0x44, 0x19, 0x1e, 0x17, 0x10, 0x05, 0x02, 0x0b, 0x0c, 0x21, 0x26, 0x2f, 0x28, 0x3d, 0x3a, 0x33, 0x34, 0x4e, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5c, 0x5b, 0x76, 0x71, 0x78, 0x7f, 0x6a, 0x6d, 0x64, 0x63, 0x3e, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2c, 0x2b, 0x06, 0x01, 0x08, 0x0f, 0x1a, 0x1d, 0x14, 0x13, 0xae, 0xa9, 0xa0, 0xa7, 0xb2, 0xb5, 0xbc, 0xbb, 0x96, 0x91, 0x98, 0x9f, 0x8a, 0x8d, 0x84, 0x83, 0xde, 0xd9, 0xd0, 0xd7, 0xc2, 0xc5, 0xcc, 0xcb, 0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3}; + +__attribute__((weak)) uint8_t crc8(const void *data, size_t data_len) { + const uint8_t *d = (const uint8_t *)data; + crc_t crc = 0xff; + size_t tbl_idx; + + while (data_len--) { + tbl_idx = crc ^ *d; + crc = crc_table[tbl_idx] & 0xff; + d++; + } + return crc & 0xff; +} +#else +__attribute__((weak)) uint8_t crc8(const void *data, size_t data_len) { + const uint8_t *d = (const uint8_t *)data; + crc_t crc = 0xff; + size_t i, j; + + for (i = 0; i < data_len; i++) { + crc ^= d[i]; + for (j = 0; j < 8; j++) { + if ((crc & 0x80) != 0) + crc = (crc_t)((crc << 1) ^ 0x31); + else + crc <<= 1; + } + } + return crc; +} +#endif
\ No newline at end of file diff --git a/quantum/crc.h b/quantum/crc.h new file mode 100644 index 0000000000..c17f5888e2 --- /dev/null +++ b/quantum/crc.h @@ -0,0 +1,44 @@ +/* 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 "quantum.h" + +/** + * The type of the CRC values. + * + * This type must be big enough to contain at least 8 bits. + */ +#if defined(CRC8_OPTIMIZE_SPEED) +typedef uint_fast8_t crc_t; +#else +typedef uint_least8_t crc_t; +#endif + +/** + * Initialize crc subsystem. + */ +__attribute__((weak)) void crc_init(void); + +/** + * Generate CRC8 value from given data. + * + * \param[in] data Pointer to a buffer of \a data_len bytes. + * \param[in] data_len Number of bytes in the \a data buffer. + * \return The calculated crc value. + */ +__attribute__((weak)) uint8_t crc8(const void *data, size_t data_len);
\ No newline at end of file diff --git a/quantum/debounce.h b/quantum/debounce.h index 9ca05c6824..5043868289 100644 --- a/quantum/debounce.h +++ b/quantum/debounce.h @@ -9,3 +9,5 @@ void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool bool debounce_active(void); void debounce_init(uint8_t num_rows); + +void debounce_free(void); diff --git a/quantum/debounce/asym_eager_defer_pk.c b/quantum/debounce/asym_eager_defer_pk.c new file mode 100644 index 0000000000..24380dc5e5 --- /dev/null +++ b/quantum/debounce/asym_eager_defer_pk.c @@ -0,0 +1,171 @@ +/* + * Copyright 2017 Alex Ong <the.onga@gmail.com> + * Copyright 2020 Andrei Purdea <andrei@purdea.ro> + * Copyright 2021 Simon Arlott + * + * 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/>. + */ + +/* +Basic symmetric per-key algorithm. Uses an 8-bit counter per key. +When no state changes have occured for DEBOUNCE milliseconds, we push the state. +*/ + +#include "matrix.h" +#include "timer.h" +#include "quantum.h" +#include <stdlib.h> + +#ifdef PROTOCOL_CHIBIOS +# if CH_CFG_USE_MEMCORE == FALSE +# error ChibiOS is configured without a memory allocator. Your keyboard may have set `#define CH_CFG_USE_MEMCORE FALSE`, which is incompatible with this debounce algorithm. +# endif +#endif + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif + +// Maximum debounce: 127ms +#if DEBOUNCE > 127 +# undef DEBOUNCE +# define DEBOUNCE 127 +#endif + +#define ROW_SHIFTER ((matrix_row_t)1) + +typedef struct { + bool pressed : 1; + uint8_t time : 7; +} debounce_counter_t; + +#if DEBOUNCE > 0 +static debounce_counter_t *debounce_counters; +static fast_timer_t last_time; +static bool counters_need_update; +static bool matrix_need_update; + +#define DEBOUNCE_ELAPSED 0 + +static void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t elapsed_time); +static void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows); + +// we use num_rows rather than MATRIX_ROWS to support split keyboards +void debounce_init(uint8_t num_rows) { + debounce_counters = malloc(num_rows * MATRIX_COLS * sizeof(debounce_counter_t)); + int i = 0; + for (uint8_t r = 0; r < num_rows; r++) { + for (uint8_t c = 0; c < MATRIX_COLS; c++) { + debounce_counters[i++].time = DEBOUNCE_ELAPSED; + } + } +} + +void debounce_free(void) { + free(debounce_counters); + debounce_counters = NULL; +} + +void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { + bool updated_last = false; + + if (counters_need_update) { + fast_timer_t now = timer_read_fast(); + fast_timer_t elapsed_time = TIMER_DIFF_FAST(now, last_time); + + last_time = now; + updated_last = true; + if (elapsed_time > UINT8_MAX) { + elapsed_time = UINT8_MAX; + } + + if (elapsed_time > 0) { + update_debounce_counters_and_transfer_if_expired(raw, cooked, num_rows, elapsed_time); + } + } + + if (changed || matrix_need_update) { + if (!updated_last) { + last_time = timer_read_fast(); + } + + transfer_matrix_values(raw, cooked, num_rows); + } +} + +static void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t elapsed_time) { + debounce_counter_t *debounce_pointer = debounce_counters; + + counters_need_update = false; + matrix_need_update = false; + + for (uint8_t row = 0; row < num_rows; row++) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + matrix_row_t col_mask = (ROW_SHIFTER << col); + + if (debounce_pointer->time != DEBOUNCE_ELAPSED) { + if (debounce_pointer->time <= elapsed_time) { + debounce_pointer->time = DEBOUNCE_ELAPSED; + + if (debounce_pointer->pressed) { + // key-down: eager + matrix_need_update = true; + } else { + // key-up: defer + cooked[row] = (cooked[row] & ~col_mask) | (raw[row] & col_mask); + } + } else { + debounce_pointer->time -= elapsed_time; + counters_need_update = true; + } + } + debounce_pointer++; + } + } +} + +static void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows) { + debounce_counter_t *debounce_pointer = debounce_counters; + + for (uint8_t row = 0; row < num_rows; row++) { + matrix_row_t delta = raw[row] ^ cooked[row]; + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + matrix_row_t col_mask = (ROW_SHIFTER << col); + + if (delta & col_mask) { + if (debounce_pointer->time == DEBOUNCE_ELAPSED) { + debounce_pointer->pressed = (raw[row] & col_mask); + debounce_pointer->time = DEBOUNCE; + counters_need_update = true; + + if (debounce_pointer->pressed) { + // key-down: eager + cooked[row] ^= col_mask; + } + } + } else if (debounce_pointer->time != DEBOUNCE_ELAPSED) { + if (!debounce_pointer->pressed) { + // key-up: defer + debounce_pointer->time = DEBOUNCE_ELAPSED; + } + } + debounce_pointer++; + } + } +} + +bool debounce_active(void) { return true; } +#else +# include "none.c" +#endif diff --git a/quantum/debounce/none.c b/quantum/debounce/none.c new file mode 100644 index 0000000000..b03892bc5b --- /dev/null +++ b/quantum/debounce/none.c @@ -0,0 +1,31 @@ +/* Copyright 2021 Simon Arlott + * + * 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 "quantum.h" +#include <stdlib.h> + +void debounce_init(uint8_t num_rows) {} + +void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { + for (int i = 0; i < num_rows; i++) { + cooked[i] = raw[i]; + } +} + +bool debounce_active(void) { return false; } + +void debounce_free(void) {} diff --git a/quantum/debounce/sym_defer_g.c b/quantum/debounce/sym_defer_g.c index 3ed9055d2a..fbefd55ede 100644 --- a/quantum/debounce/sym_defer_g.c +++ b/quantum/debounce/sym_defer_g.c @@ -1,5 +1,6 @@ /* Copyright 2017 Alex Ong<the.onga@gmail.com> +Copyright 2021 Simon Arlott 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 @@ -23,30 +24,29 @@ When no state changes have occured for DEBOUNCE milliseconds, we push the state. # define DEBOUNCE 5 #endif -void debounce_init(uint8_t num_rows) {} +#if DEBOUNCE > 0 static bool debouncing = false; +static fast_timer_t debouncing_time; -#if DEBOUNCE > 0 -static uint16_t debouncing_time; -void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { +void debounce_init(uint8_t num_rows) {} + +void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { if (changed) { debouncing = true; - debouncing_time = timer_read(); + debouncing_time = timer_read_fast(); } - if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) { + if (debouncing && timer_elapsed_fast(debouncing_time) >= DEBOUNCE) { for (int i = 0; i < num_rows; i++) { cooked[i] = raw[i]; } debouncing = false; } } -#else // no debouncing. -void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { - for (int i = 0; i < num_rows; i++) { - cooked[i] = raw[i]; - } -} -#endif bool debounce_active(void) { return debouncing; } + +void debounce_free(void) {} +#else // no debouncing. +# include "none.c" +#endif diff --git a/quantum/debounce/sym_defer_pk.c b/quantum/debounce/sym_defer_pk.c index 60513f98e1..626a9be841 100644 --- a/quantum/debounce/sym_defer_pk.c +++ b/quantum/debounce/sym_defer_pk.c @@ -1,6 +1,7 @@ /* Copyright 2017 Alex Ong<the.onga@gmail.com> Copyright 2020 Andrei Purdea<andrei@purdea.ro> +Copyright 2021 Simon Arlott 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 @@ -33,28 +34,25 @@ When no state changes have occured for DEBOUNCE milliseconds, we push the state. # define DEBOUNCE 5 #endif +// Maximum debounce: 255ms +#if DEBOUNCE > UINT8_MAX +# undef DEBOUNCE +# define DEBOUNCE UINT8_MAX +#endif + #define ROW_SHIFTER ((matrix_row_t)1) -#define debounce_counter_t uint8_t +typedef uint8_t debounce_counter_t; +#if DEBOUNCE > 0 static debounce_counter_t *debounce_counters; +static fast_timer_t last_time; static bool counters_need_update; -#define DEBOUNCE_ELAPSED 251 -#define MAX_DEBOUNCE (DEBOUNCE_ELAPSED - 1) - -static uint8_t wrapping_timer_read(void) { - static uint16_t time = 0; - static uint8_t last_result = 0; - uint16_t new_time = timer_read(); - uint16_t diff = new_time - time; - time = new_time; - last_result = (last_result + diff) % (MAX_DEBOUNCE + 1); - return last_result; -} +#define DEBOUNCE_ELAPSED 0 -void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time); -void start_debounce_counters(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time); +static void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t elapsed_time); +static void start_debounce_counters(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows); // we use num_rows rather than MATRIX_ROWS to support split keyboards void debounce_init(uint8_t num_rows) { @@ -67,27 +65,49 @@ void debounce_init(uint8_t num_rows) { } } +void debounce_free(void) { + free(debounce_counters); + debounce_counters = NULL; +} + void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { - uint8_t current_time = wrapping_timer_read(); + bool updated_last = false; + if (counters_need_update) { - update_debounce_counters_and_transfer_if_expired(raw, cooked, num_rows, current_time); + fast_timer_t now = timer_read_fast(); + fast_timer_t elapsed_time = TIMER_DIFF_FAST(now, last_time); + + last_time = now; + updated_last = true; + if (elapsed_time > UINT8_MAX) { + elapsed_time = UINT8_MAX; + } + + if (elapsed_time > 0) { + update_debounce_counters_and_transfer_if_expired(raw, cooked, num_rows, elapsed_time); + } } if (changed) { - start_debounce_counters(raw, cooked, num_rows, current_time); + if (!updated_last) { + last_time = timer_read_fast(); + } + + start_debounce_counters(raw, cooked, num_rows); } } -void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time) { +static void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t elapsed_time) { counters_need_update = false; debounce_counter_t *debounce_pointer = debounce_counters; for (uint8_t row = 0; row < num_rows; row++) { for (uint8_t col = 0; col < MATRIX_COLS; col++) { if (*debounce_pointer != DEBOUNCE_ELAPSED) { - if (TIMER_DIFF(current_time, *debounce_pointer, MAX_DEBOUNCE) >= DEBOUNCE) { + if (*debounce_pointer <= elapsed_time) { *debounce_pointer = DEBOUNCE_ELAPSED; cooked[row] = (cooked[row] & ~(ROW_SHIFTER << col)) | (raw[row] & (ROW_SHIFTER << col)); } else { + *debounce_pointer -= elapsed_time; counters_need_update = true; } } @@ -96,14 +116,14 @@ void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix } } -void start_debounce_counters(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time) { +static void start_debounce_counters(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows) { debounce_counter_t *debounce_pointer = debounce_counters; for (uint8_t row = 0; row < num_rows; row++) { matrix_row_t delta = raw[row] ^ cooked[row]; for (uint8_t col = 0; col < MATRIX_COLS; col++) { if (delta & (ROW_SHIFTER << col)) { if (*debounce_pointer == DEBOUNCE_ELAPSED) { - *debounce_pointer = current_time; + *debounce_pointer = DEBOUNCE; counters_need_update = true; } } else { @@ -115,3 +135,6 @@ void start_debounce_counters(matrix_row_t raw[], matrix_row_t cooked[], uint8_t } bool debounce_active(void) { return true; } +#else +# include "none.c" +#endif diff --git a/quantum/debounce/sym_eager_pk.c b/quantum/debounce/sym_eager_pk.c index e66cf92d79..15a3242e68 100644 --- a/quantum/debounce/sym_eager_pk.c +++ b/quantum/debounce/sym_eager_pk.c @@ -1,5 +1,6 @@ /* Copyright 2017 Alex Ong<the.onga@gmail.com> +Copyright 2021 Simon Arlott 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 @@ -33,29 +34,26 @@ No further inputs are accepted until DEBOUNCE milliseconds have occurred. # define DEBOUNCE 5 #endif +// Maximum debounce: 255ms +#if DEBOUNCE > UINT8_MAX +# undef DEBOUNCE +# define DEBOUNCE UINT8_MAX +#endif + #define ROW_SHIFTER ((matrix_row_t)1) -#define debounce_counter_t uint8_t +typedef uint8_t debounce_counter_t; +#if DEBOUNCE > 0 static debounce_counter_t *debounce_counters; +static fast_timer_t last_time; static bool counters_need_update; static bool matrix_need_update; -#define DEBOUNCE_ELAPSED 251 -#define MAX_DEBOUNCE (DEBOUNCE_ELAPSED - 1) - -static uint8_t wrapping_timer_read(void) { - static uint16_t time = 0; - static uint8_t last_result = 0; - uint16_t new_time = timer_read(); - uint16_t diff = new_time - time; - time = new_time; - last_result = (last_result + diff) % (MAX_DEBOUNCE + 1); - return last_result; -} +#define DEBOUNCE_ELAPSED 0 -void update_debounce_counters(uint8_t num_rows, uint8_t current_time); -void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time); +static void update_debounce_counters(uint8_t num_rows, uint8_t elapsed_time); +static void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows); // we use num_rows rather than MATRIX_ROWS to support split keyboards void debounce_init(uint8_t num_rows) { @@ -68,27 +66,51 @@ void debounce_init(uint8_t num_rows) { } } +void debounce_free(void) { + free(debounce_counters); + debounce_counters = NULL; +} + void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { - uint8_t current_time = wrapping_timer_read(); + bool updated_last = false; + if (counters_need_update) { - update_debounce_counters(num_rows, current_time); + fast_timer_t now = timer_read_fast(); + fast_timer_t elapsed_time = TIMER_DIFF_FAST(now, last_time); + + last_time = now; + updated_last = true; + if (elapsed_time > UINT8_MAX) { + elapsed_time = UINT8_MAX; + } + + if (elapsed_time > 0) { + update_debounce_counters(num_rows, elapsed_time); + } } if (changed || matrix_need_update) { - transfer_matrix_values(raw, cooked, num_rows, current_time); + if (!updated_last) { + last_time = timer_read_fast(); + } + + transfer_matrix_values(raw, cooked, num_rows); } } // If the current time is > debounce counter, set the counter to enable input. -void update_debounce_counters(uint8_t num_rows, uint8_t current_time) { +static void update_debounce_counters(uint8_t num_rows, uint8_t elapsed_time) { counters_need_update = false; + matrix_need_update = false; debounce_counter_t *debounce_pointer = debounce_counters; for (uint8_t row = 0; row < num_rows; row++) { for (uint8_t col = 0; col < MATRIX_COLS; col++) { if (*debounce_pointer != DEBOUNCE_ELAPSED) { - if (TIMER_DIFF(current_time, *debounce_pointer, MAX_DEBOUNCE) >= DEBOUNCE) { + if (*debounce_pointer <= elapsed_time) { *debounce_pointer = DEBOUNCE_ELAPSED; + matrix_need_update = true; } else { + *debounce_pointer -= elapsed_time; counters_need_update = true; } } @@ -98,8 +120,7 @@ void update_debounce_counters(uint8_t num_rows, uint8_t current_time) { } // upload from raw_matrix to final matrix; -void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time) { - matrix_need_update = false; +static void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows) { debounce_counter_t *debounce_pointer = debounce_counters; for (uint8_t row = 0; row < num_rows; row++) { matrix_row_t delta = raw[row] ^ cooked[row]; @@ -108,11 +129,9 @@ void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t n matrix_row_t col_mask = (ROW_SHIFTER << col); if (delta & col_mask) { if (*debounce_pointer == DEBOUNCE_ELAPSED) { - *debounce_pointer = current_time; + *debounce_pointer = DEBOUNCE; counters_need_update = true; existing_row ^= col_mask; // flip the bit. - } else { - matrix_need_update = true; } } debounce_pointer++; @@ -122,3 +141,6 @@ void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t n } bool debounce_active(void) { return true; } +#else +# include "none.c" +#endif diff --git a/quantum/debounce/sym_eager_pr.c b/quantum/debounce/sym_eager_pr.c index 20ccb46f1d..2ad592c5a6 100644 --- a/quantum/debounce/sym_eager_pr.c +++ b/quantum/debounce/sym_eager_pr.c @@ -1,5 +1,6 @@ /* Copyright 2019 Alex Ong<the.onga@gmail.com> +Copyright 2021 Simon Arlott 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 @@ -33,27 +34,25 @@ No further inputs are accepted until DEBOUNCE milliseconds have occurred. # define DEBOUNCE 5 #endif -#define debounce_counter_t uint8_t +// Maximum debounce: 255ms +#if DEBOUNCE > UINT8_MAX +# undef DEBOUNCE +# define DEBOUNCE UINT8_MAX +#endif + +typedef uint8_t debounce_counter_t; + +#if DEBOUNCE > 0 static bool matrix_need_update; static debounce_counter_t *debounce_counters; +static fast_timer_t last_time; static bool counters_need_update; -#define DEBOUNCE_ELAPSED 251 -#define MAX_DEBOUNCE (DEBOUNCE_ELAPSED - 1) - -static uint8_t wrapping_timer_read(void) { - static uint16_t time = 0; - static uint8_t last_result = 0; - uint16_t new_time = timer_read(); - uint16_t diff = new_time - time; - time = new_time; - last_result = (last_result + diff) % (MAX_DEBOUNCE + 1); - return last_result; -} +#define DEBOUNCE_ELAPSED 0 -void update_debounce_counters(uint8_t num_rows, uint8_t current_time); -void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time); +static void update_debounce_counters(uint8_t num_rows, uint8_t elapsed_time); +static void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows); // we use num_rows rather than MATRIX_ROWS to support split keyboards void debounce_init(uint8_t num_rows) { @@ -63,27 +62,50 @@ void debounce_init(uint8_t num_rows) { } } +void debounce_free(void) { + free(debounce_counters); + debounce_counters = NULL; +} + void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { - uint8_t current_time = wrapping_timer_read(); - bool needed_update = counters_need_update; + bool updated_last = false; + if (counters_need_update) { - update_debounce_counters(num_rows, current_time); + fast_timer_t now = timer_read_fast(); + fast_timer_t elapsed_time = TIMER_DIFF_FAST(now, last_time); + + last_time = now; + updated_last = true; + if (elapsed_time > UINT8_MAX) { + elapsed_time = UINT8_MAX; + } + + if (elapsed_time > 0) { + update_debounce_counters(num_rows, elapsed_time); + } } - if (changed || (needed_update && !counters_need_update) || matrix_need_update) { - transfer_matrix_values(raw, cooked, num_rows, current_time); + if (changed || matrix_need_update) { + if (!updated_last) { + last_time = timer_read_fast(); + } + + transfer_matrix_values(raw, cooked, num_rows); } } // If the current time is > debounce counter, set the counter to enable input. -void update_debounce_counters(uint8_t num_rows, uint8_t current_time) { +static void update_debounce_counters(uint8_t num_rows, uint8_t elapsed_time) { counters_need_update = false; + matrix_need_update = false; debounce_counter_t *debounce_pointer = debounce_counters; for (uint8_t row = 0; row < num_rows; row++) { if (*debounce_pointer != DEBOUNCE_ELAPSED) { - if (TIMER_DIFF(current_time, *debounce_pointer, MAX_DEBOUNCE) >= DEBOUNCE) { + if (*debounce_pointer <= elapsed_time) { *debounce_pointer = DEBOUNCE_ELAPSED; + matrix_need_update = true; } else { + *debounce_pointer -= elapsed_time; counters_need_update = true; } } @@ -92,8 +114,7 @@ void update_debounce_counters(uint8_t num_rows, uint8_t current_time) { } // upload from raw_matrix to final matrix; -void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time) { - matrix_need_update = false; +static void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows) { debounce_counter_t *debounce_pointer = debounce_counters; for (uint8_t row = 0; row < num_rows; row++) { matrix_row_t existing_row = cooked[row]; @@ -102,11 +123,9 @@ void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t n // determine new value basd on debounce pointer + raw value if (existing_row != raw_row) { if (*debounce_pointer == DEBOUNCE_ELAPSED) { - *debounce_pointer = current_time; + *debounce_pointer = DEBOUNCE; cooked[row] = raw_row; counters_need_update = true; - } else { - matrix_need_update = true; } } debounce_pointer++; @@ -114,3 +133,6 @@ void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t n } bool debounce_active(void) { return true; } +#else +# include "none.c" +#endif diff --git a/quantum/debounce/tests/asym_eager_defer_pk_tests.cpp b/quantum/debounce/tests/asym_eager_defer_pk_tests.cpp new file mode 100644 index 0000000000..fe374c3dfa --- /dev/null +++ b/quantum/debounce/tests/asym_eager_defer_pk_tests.cpp @@ -0,0 +1,374 @@ +/* Copyright 2021 Simon Arlott + * + * 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 "debounce_test_common.h" + +TEST_F(DebounceTest, OneKeyShort1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + /* Release key after 1ms delay */ + {1, {{0, 1, UP}}, {}}, + + /* + * Until the eager timer on DOWN is observed to finish, the defer timer + * on UP can't start. There's no workaround for this because it's not + * possible to debounce an event that isn't being tracked. + * + * sym_defer_pk has the same problem but the test has to track that the + * key changed state so the DOWN timer is always allowed to finish + * before starting the UP timer. + */ + {5, {}, {}}, + + {10, {}, {{0, 1, UP}}}, /* 5ms+5ms after DOWN at time 0 */ + /* Press key again after 1ms delay */ + {11, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + /* Release key after 2ms delay */ + {2, {{0, 1, UP}}, {}}, + + {5, {}, {}}, /* See OneKeyShort1 */ + + {10, {}, {{0, 1, UP}}}, /* 5ms+5ms after DOWN at time 0 */ + /* Press key again after 1ms delay */ + {11, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort3) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + /* Release key after 3ms delay */ + {3, {{0, 1, UP}}, {}}, + + {5, {}, {}}, /* See OneKeyShort1 */ + + {10, {}, {{0, 1, UP}}}, /* 5ms+5ms after DOWN at time 0 */ + /* Press key again after 1ms delay */ + {11, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort4) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + /* Release key after 4ms delay */ + {4, {{0, 1, UP}}, {}}, + + {5, {}, {}}, /* See OneKeyShort1 */ + + {10, {}, {{0, 1, UP}}}, /* 5ms+5ms after DOWN at time 0 */ + /* Press key again after 1ms delay */ + {11, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort5) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Release key after 5ms delay */ + {5, {{0, 1, UP}}, {}}, + + {10, {}, {{0, 1, UP}}}, /* 5ms+5ms after DOWN at time 0 */ + /* Press key again after 1ms delay */ + {11, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort6) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Release key after 6ms delay */ + {6, {{0, 1, UP}}, {}}, + + {11, {}, {{0, 1, UP}}}, /* 5ms after UP at time 6 */ + /* Press key again after 1ms delay */ + {12, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort7) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Release key after 7ms delay */ + {7, {{0, 1, UP}}, {}}, + + {12, {}, {{0, 1, UP}}}, /* 5ms after UP at time 7 */ + /* Press key again after 1ms delay */ + {13, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort8) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + /* Release key after 1ms delay */ + {1, {{0, 1, UP}}, {}}, + + {5, {}, {}}, /* See OneKeyShort1 */ + + {10, {}, {{0, 1, UP}}}, /* 5ms after UP at time 7 */ + /* Press key again after 0ms delay (scan 2) */ + {10, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort9) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + /* Release key after 1ms delay */ + {1, {{0, 1, UP}}, {}}, + + {5, {}, {}}, /* See OneKeyShort1 */ + + /* Press key again after 0ms delay (same scan) before debounce finishes */ + {10, {{0, 1, DOWN}}, {}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyBouncing1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + {2, {{0, 1, DOWN}}, {}}, + {3, {{0, 1, UP}}, {}}, + {4, {{0, 1, DOWN}}, {}}, + {5, {{0, 1, UP}}, {}}, + {6, {{0, 1, DOWN}}, {}}, + {7, {{0, 1, UP}}, {}}, + {8, {{0, 1, DOWN}}, {}}, + {9, {{0, 1, UP}}, {}}, + {10, {{0, 1, DOWN}}, {}}, + {11, {{0, 1, UP}}, {}}, + {12, {{0, 1, DOWN}}, {}}, + {13, {{0, 1, UP}}, {}}, + {14, {{0, 1, DOWN}}, {}}, + {15, {{0, 1, UP}}, {}}, + + {20, {}, {{0, 1, UP}}}, + /* Press key again after 1ms delay */ + {21, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyBouncing2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + /* Change twice in the same time period */ + {1, {{0, 1, UP}}, {}}, + {1, {{0, 1, DOWN}}, {}}, + /* Change three times in the same time period */ + {2, {{0, 1, UP}}, {}}, + {2, {{0, 1, DOWN}}, {}}, + {2, {{0, 1, UP}}, {}}, + /* Change twice in the same time period */ + {6, {{0, 1, DOWN}}, {}}, + {6, {{0, 1, UP}}, {}}, + /* Change three times in the same time period */ + {7, {{0, 1, DOWN}}, {}}, + {7, {{0, 1, UP}}, {}}, + {7, {{0, 1, DOWN}}, {}}, + /* Change twice in the same time period */ + {8, {{0, 1, UP}}, {}}, + {8, {{0, 1, DOWN}}, {}}, + /* Change three times in the same time period */ + {9, {{0, 1, UP}}, {}}, + {9, {{0, 1, DOWN}}, {}}, + {9, {{0, 1, UP}}, {}}, + + {14, {}, {{0, 1, UP}}}, + /* Press key again after 1ms delay */ + {15, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyLong) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + {25, {{0, 1, UP}}, {}}, + + {30, {}, {{0, 1, UP}}}, + + {50, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + {75, {{0, 1, UP}}, {}}, + + {80, {}, {{0, 1, UP}}}, + + {100, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, TwoKeysShort) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 2, DOWN}}, {{0, 2, DOWN}}}, + /* Release key after 2ms delay */ + {2, {{0, 1, UP}}, {}}, + {3, {{0, 2, UP}}, {}}, + + {5, {}, {}}, /* See OneKeyShort1 */ + {6, {}, {}}, /* See OneKeyShort1 */ + + {10, {}, {{0, 1, UP}}}, /* 5ms+5ms after DOWN at time 0 */ + /* Press key again after 1ms delay */ + {11, {{0, 1, DOWN}}, {{0, 1, DOWN}, {0, 2, UP}}}, /* 5ms+5ms after DOWN at time 0 */ + {12, {{0, 2, DOWN}}, {{0, 2, DOWN}}}, /* 5ms+5ms after DOWN at time 0 */ + }); + runEvents(); +} + + +TEST_F(DebounceTest, OneKeyDelayedScan1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late, immediately release key */ + {300, {{0, 1, UP}}, {}}, + + {305, {}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late, immediately release key */ + {300, {{0, 1, UP}}, {}}, + + /* Processing is very late again */ + {600, {}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan3) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late */ + {300, {}, {}}, + /* Release key after 1ms */ + {301, {{0, 1, UP}}, {}}, + + {306, {}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan4) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late */ + {300, {}, {}}, + /* Release key after 1ms */ + {301, {{0, 1, UP}}, {}}, + + /* Processing is very late again */ + {600, {}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan5) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + {5, {{0, 1, UP}}, {}}, + + /* Processing is very late */ + {300, {}, {{0, 1, UP}}}, + /* Immediately press key again */ + {300, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan6) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + {5, {{0, 1, UP}}, {}}, + + /* Processing is very late */ + {300, {}, {{0, 1, UP}}}, + + /* Press key again after 1ms */ + {301, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan7) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + {5, {{0, 1, UP}}, {}}, + + /* Press key again before debounce expires */ + {300, {{0, 1, DOWN}}, {}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan8) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is a bit late */ + {50, {}, {}}, + /* Release key after 1ms */ + {51, {{0, 1, UP}}, {}}, + + /* Processing is a bit late again */ + {100, {}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} diff --git a/quantum/debounce/tests/debounce_test_common.cpp b/quantum/debounce/tests/debounce_test_common.cpp new file mode 100644 index 0000000000..1c5e7c9f4e --- /dev/null +++ b/quantum/debounce/tests/debounce_test_common.cpp @@ -0,0 +1,229 @@ +/* Copyright 2021 Simon Arlott + * + * 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 "debounce_test_common.h" + +#include <algorithm> +#include <iomanip> +#include <sstream> + +extern "C" { +#include "quantum.h" +#include "timer.h" +#include "debounce.h" + +void set_time(uint32_t t); +void advance_time(uint32_t ms); +} + +void DebounceTest::addEvents(std::initializer_list<DebounceTestEvent> events) { + events_.insert(events_.end(), events.begin(), events.end()); +} + +void DebounceTest::runEvents() { + /* Run the test multiple times, from 1kHz to 10kHz scan rate */ + for (extra_iterations_ = 0; extra_iterations_ < 10; extra_iterations_++) { + if (time_jumps_) { + /* Don't advance time smoothly, jump to the next event (some tests require this) */ + auto_advance_time_ = false; + runEventsInternal(); + } else { + /* Run the test with both smooth and irregular time; it must produce the same result */ + auto_advance_time_ = true; + runEventsInternal(); + auto_advance_time_ = false; + runEventsInternal(); + } + } +} + +void DebounceTest::runEventsInternal() { + fast_timer_t previous = 0; + bool first = true; + + /* Initialise keyboard with start time (offset to avoid testing at 0) and all keys UP */ + debounce_init(MATRIX_ROWS); + set_time(time_offset_); + std::fill(std::begin(input_matrix_), std::end(input_matrix_), 0); + std::fill(std::begin(output_matrix_), std::end(output_matrix_), 0); + + for (auto &event : events_) { + if (!auto_advance_time_) { + /* Jump to the next event */ + set_time(time_offset_ + event.time_); + } else if (!first && event.time_ == previous + 1) { + /* This event immediately follows the previous one, don't make extra debounce() calls */ + advance_time(1); + } else { + /* Fast forward to the time for this event, calling debounce() with no changes */ + ASSERT_LT((time_offset_ + event.time_) - timer_read_fast(), 60000) << "Test tries to advance more than 1 minute of time"; + + while (timer_read_fast() != time_offset_ + event.time_) { + runDebounce(false); + checkCookedMatrix(false, "debounce() modified cooked matrix"); + advance_time(1); + } + } + + first = false; + previous = event.time_; + + /* Prepare input matrix */ + for (auto &input : event.inputs_) { + matrixUpdate(input_matrix_, "input", input); + } + + /* Call debounce */ + runDebounce(!event.inputs_.empty()); + + /* Prepare output matrix */ + for (auto &output : event.outputs_) { + matrixUpdate(output_matrix_, "output", output); + } + + /* Check output matrix has expected change events */ + for (auto &output : event.outputs_) { + EXPECT_EQ(!!(cooked_matrix_[output.row_] & (1U << output.col_)), directionValue(output.direction_)) + << "Missing event at " << strTime() + << " expected key " << output.row_ << "," << output.col_ << " " << directionLabel(output.direction_) + << "\ninput_matrix: changed=" << !event.inputs_.empty() << "\n" << strMatrix(input_matrix_) + << "\nexpected_matrix:\n" << strMatrix(output_matrix_) + << "\nactual_matrix:\n" << strMatrix(cooked_matrix_); + } + + /* Check output matrix has no other changes */ + checkCookedMatrix(!event.inputs_.empty(), "debounce() cooked matrix does not match expected output matrix"); + + /* Perform some extra iterations of the matrix scan with no changes */ + for (int i = 0; i < extra_iterations_; i++) { + runDebounce(false); + checkCookedMatrix(false, "debounce() modified cooked matrix"); + } + } + + /* Check that no further changes happen for 1 minute */ + for (int i = 0; i < 60000; i++) { + runDebounce(false); + checkCookedMatrix(false, "debounce() modified cooked matrix"); + advance_time(1); + } + + debounce_free(); +} + +void DebounceTest::runDebounce(bool changed) { + std::copy(std::begin(input_matrix_), std::end(input_matrix_), std::begin(raw_matrix_)); + std::copy(std::begin(output_matrix_), std::end(output_matrix_), std::begin(cooked_matrix_)); + + debounce(raw_matrix_, cooked_matrix_, MATRIX_ROWS, changed); + + if (!std::equal(std::begin(input_matrix_), std::end(input_matrix_), std::begin(raw_matrix_))) { + FAIL() << "Fatal error: debounce() modified raw matrix at " << strTime() + << "\ninput_matrix: changed=" << changed << "\n" << strMatrix(input_matrix_) + << "\nraw_matrix:\n" << strMatrix(raw_matrix_); + } +} + +void DebounceTest::checkCookedMatrix(bool changed, const std::string &error_message) { + if (!std::equal(std::begin(output_matrix_), std::end(output_matrix_), std::begin(cooked_matrix_))) { + FAIL() << "Unexpected event: " << error_message << " at " << strTime() + << "\ninput_matrix: changed=" << changed << "\n" << strMatrix(input_matrix_) + << "\nexpected_matrix:\n" << strMatrix(output_matrix_) + << "\nactual_matrix:\n" << strMatrix(cooked_matrix_); + } +} + +std::string DebounceTest::strTime() { + std::stringstream text; + + text << "time " << (timer_read_fast() - time_offset_) + << " (extra_iterations=" << extra_iterations_ + << ", auto_advance_time=" << auto_advance_time_ << ")"; + + return text.str(); +} + +std::string DebounceTest::strMatrix(matrix_row_t matrix[]) { + std::stringstream text; + + text << "\t" << std::setw(3) << ""; + for (int col = 0; col < MATRIX_COLS; col++) { + text << " " << std::setw(2) << col; + } + text << "\n"; + + for (int row = 0; row < MATRIX_ROWS; row++) { + text << "\t" << std::setw(2) << row << ":"; + for (int col = 0; col < MATRIX_COLS; col++) { + text << ((matrix[row] & (1U << col)) ? " XX" : " __"); + } + + text << "\n"; + } + + return text.str(); +} + +bool DebounceTest::directionValue(Direction direction) { + switch (direction) { + case DOWN: + return true; + + case UP: + return false; + } +} + +std::string DebounceTest::directionLabel(Direction direction) { + switch (direction) { + case DOWN: + return "DOWN"; + + case UP: + return "UP"; + } +} + +/* Modify a matrix and verify that events always specify a change */ +void DebounceTest::matrixUpdate(matrix_row_t matrix[], const std::string &name, const MatrixTestEvent &event) { + ASSERT_NE(!!(matrix[event.row_] & (1U << event.col_)), directionValue(event.direction_)) + << "Test " << name << " at " << strTime() + << " sets key " << event.row_ << "," << event.col_ << " " << directionLabel(event.direction_) + << " but it is already " << directionLabel(event.direction_) + << "\n" << name << "_matrix:\n" << strMatrix(matrix); + + switch (event.direction_) { + case DOWN: + matrix[event.row_] |= (1U << event.col_); + break; + + case UP: + matrix[event.row_] &= ~(1U << event.col_); + break; + } +} + +DebounceTestEvent::DebounceTestEvent(fast_timer_t time, + std::initializer_list<MatrixTestEvent> inputs, + std::initializer_list<MatrixTestEvent> outputs) + : time_(time), inputs_(inputs), outputs_(outputs) { +} + +MatrixTestEvent::MatrixTestEvent(int row, int col, Direction direction) + : row_(row), col_(col), direction_(direction) { +} diff --git a/quantum/debounce/tests/debounce_test_common.h b/quantum/debounce/tests/debounce_test_common.h new file mode 100644 index 0000000000..d87e310594 --- /dev/null +++ b/quantum/debounce/tests/debounce_test_common.h @@ -0,0 +1,83 @@ +/* Copyright 2021 Simon Arlott + * + * 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 <initializer_list> +#include <list> +#include <string> + +extern "C" { +#include "quantum.h" +#include "timer.h" +} + +enum Direction { + DOWN, + UP, +}; + +class MatrixTestEvent { +public: + MatrixTestEvent(int row, int col, Direction direction); + + const int row_; + const int col_; + const Direction direction_; +}; + +class DebounceTestEvent { +public: + // 0, {{0, 1, DOWN}}, {{0, 1, DOWN}}) + DebounceTestEvent(fast_timer_t time, + std::initializer_list<MatrixTestEvent> inputs, + std::initializer_list<MatrixTestEvent> outputs); + + const fast_timer_t time_; + const std::list<MatrixTestEvent> inputs_; + const std::list<MatrixTestEvent> outputs_; +}; + +class DebounceTest : public ::testing::Test { +protected: + void addEvents(std::initializer_list<DebounceTestEvent> events); + void runEvents(); + + fast_timer_t time_offset_ = 7777; + bool time_jumps_ = false; + +private: + static bool directionValue(Direction direction); + static std::string directionLabel(Direction direction); + + void runEventsInternal(); + void runDebounce(bool changed); + void checkCookedMatrix(bool changed, const std::string &error_message); + void matrixUpdate(matrix_row_t matrix[], const std::string &name, const MatrixTestEvent &event); + + std::string strTime(); + std::string strMatrix(matrix_row_t matrix[]); + + std::list<DebounceTestEvent> events_; + + matrix_row_t input_matrix_[MATRIX_ROWS]; + matrix_row_t raw_matrix_[MATRIX_ROWS]; + matrix_row_t cooked_matrix_[MATRIX_ROWS]; + matrix_row_t output_matrix_[MATRIX_ROWS]; + + int extra_iterations_; + bool auto_advance_time_; +}; diff --git a/quantum/debounce/tests/rules.mk b/quantum/debounce/tests/rules.mk new file mode 100644 index 0000000000..66928d7eb6 --- /dev/null +++ b/quantum/debounce/tests/rules.mk @@ -0,0 +1,44 @@ +# Copyright 2021 Simon Arlott +# +# 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/>. + +DEBOUNCE_COMMON_DEFS := -DMATRIX_ROWS=4 -DMATRIX_COLS=10 -DDEBOUNCE=5 + +DEBOUNCE_COMMON_SRC := $(QUANTUM_PATH)/debounce/tests/debounce_test_common.cpp \ + $(TMK_PATH)/common/test/timer.c + +debounce_sym_defer_g_DEFS := $(DEBOUNCE_COMMON_DEFS) +debounce_sym_defer_g_SRC := $(DEBOUNCE_COMMON_SRC) \ + $(QUANTUM_PATH)/debounce/sym_defer_g.c \ + $(QUANTUM_PATH)/debounce/tests/sym_defer_g_tests.cpp + +debounce_sym_defer_pk_DEFS := $(DEBOUNCE_COMMON_DEFS) +debounce_sym_defer_pk_SRC := $(DEBOUNCE_COMMON_SRC) \ + $(QUANTUM_PATH)/debounce/sym_defer_pk.c \ + $(QUANTUM_PATH)/debounce/tests/sym_defer_pk_tests.cpp + +debounce_sym_eager_pk_DEFS := $(DEBOUNCE_COMMON_DEFS) +debounce_sym_eager_pk_SRC := $(DEBOUNCE_COMMON_SRC) \ + $(QUANTUM_PATH)/debounce/sym_eager_pk.c \ + $(QUANTUM_PATH)/debounce/tests/sym_eager_pk_tests.cpp + +debounce_sym_eager_pr_DEFS := $(DEBOUNCE_COMMON_DEFS) +debounce_sym_eager_pr_SRC := $(DEBOUNCE_COMMON_SRC) \ + $(QUANTUM_PATH)/debounce/sym_eager_pr.c \ + $(QUANTUM_PATH)/debounce/tests/sym_eager_pr_tests.cpp + +debounce_asym_eager_defer_pk_DEFS := $(DEBOUNCE_COMMON_DEFS) +debounce_asym_eager_defer_pk_SRC := $(DEBOUNCE_COMMON_SRC) \ + $(QUANTUM_PATH)/debounce/asym_eager_defer_pk.c \ + $(QUANTUM_PATH)/debounce/tests/asym_eager_defer_pk_tests.cpp diff --git a/quantum/debounce/tests/sym_defer_g_tests.cpp b/quantum/debounce/tests/sym_defer_g_tests.cpp new file mode 100644 index 0000000000..a56aecd8f3 --- /dev/null +++ b/quantum/debounce/tests/sym_defer_g_tests.cpp @@ -0,0 +1,223 @@ +/* Copyright 2021 Simon Arlott + * + * 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 "debounce_test_common.h" + +TEST_F(DebounceTest, OneKeyShort1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}}}, + /* 0ms delay (fast scan rate) */ + {5, {{0, 1, UP}}, {}}, + + {10, {}, {{0, 1, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}}}, + /* 1ms delay */ + {6, {{0, 1, UP}}, {}}, + + {11, {}, {{0, 1, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort3) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}}}, + /* 2ms delay */ + {7, {{0, 1, UP}}, {}}, + + {12, {}, {{0, 1, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyTooQuick1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + /* Release key exactly on the debounce time */ + {5, {{0, 1, UP}}, {}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyTooQuick2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}}}, + {6, {{0, 1, UP}}, {}}, + + /* Press key exactly on the debounce time */ + {11, {{0, 1, DOWN}}, {}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyBouncing1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + {1, {{0, 1, UP}}, {}}, + {2, {{0, 1, DOWN}}, {}}, + {3, {{0, 1, UP}}, {}}, + {4, {{0, 1, DOWN}}, {}}, + {5, {{0, 1, UP}}, {}}, + {6, {{0, 1, DOWN}}, {}}, + {11, {}, {{0, 1, DOWN}}}, /* 5ms after DOWN at time 7 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyBouncing2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + {5, {}, {{0, 1, DOWN}}}, + {6, {{0, 1, UP}}, {}}, + {7, {{0, 1, DOWN}}, {}}, + {8, {{0, 1, UP}}, {}}, + {9, {{0, 1, DOWN}}, {}}, + {10, {{0, 1, UP}}, {}}, + {15, {}, {{0, 1, UP}}}, /* 5ms after UP at time 10 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyLong) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}}}, + + {25, {{0, 1, UP}}, {}}, + + {30, {}, {{0, 1, UP}}}, + + {50, {{0, 1, DOWN}}, {}}, + + {55, {}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, TwoKeysShort) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + {1, {{0, 2, DOWN}}, {}}, + + {6, {}, {{0, 1, DOWN}, {0, 2, DOWN}}}, + + {7, {{0, 1, UP}}, {}}, + {8, {{0, 2, UP}}, {}}, + + {13, {}, {{0, 1, UP}, {0, 2, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, TwoKeysSimultaneous1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}, {0, 2, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}, {0, 2, DOWN}}}, + {6, {{0, 1, UP}, {0, 2, UP}}, {}}, + + {11, {}, {{0, 1, UP}, {0, 2, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, TwoKeysSimultaneous2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + {1, {{0, 2, DOWN}}, {}}, + + {5, {}, {}}, + {6, {}, {{0, 1, DOWN}, {0, 2, DOWN}}}, + {7, {{0, 1, UP}}, {}}, + {8, {{0, 2, UP}}, {}}, + + {13, {}, {{0, 1, UP}, {0, 2, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + /* Processing is very late */ + {300, {}, {{0, 1, DOWN}}}, + /* Immediately release key */ + {300, {{0, 1, UP}}, {}}, + + {305, {}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + /* Processing is very late */ + {300, {}, {{0, 1, DOWN}}}, + /* Release key after 1ms */ + {301, {{0, 1, UP}}, {}}, + + {306, {}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan3) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + /* Release key before debounce expires */ + {300, {{0, 1, UP}}, {}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan4) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + /* Processing is a bit late */ + {50, {}, {{0, 1, DOWN}}}, + /* Release key after 1ms */ + {51, {{0, 1, UP}}, {}}, + + {56, {}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} diff --git a/quantum/debounce/tests/sym_defer_pk_tests.cpp b/quantum/debounce/tests/sym_defer_pk_tests.cpp new file mode 100644 index 0000000000..1f3061e59c --- /dev/null +++ b/quantum/debounce/tests/sym_defer_pk_tests.cpp @@ -0,0 +1,225 @@ +/* Copyright 2021 Simon Arlott + * + * 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 "debounce_test_common.h" + +TEST_F(DebounceTest, OneKeyShort1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}}}, + /* 0ms delay (fast scan rate) */ + {5, {{0, 1, UP}}, {}}, + + {10, {}, {{0, 1, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}}}, + /* 1ms delay */ + {6, {{0, 1, UP}}, {}}, + + {11, {}, {{0, 1, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort3) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}}}, + /* 2ms delay */ + {7, {{0, 1, UP}}, {}}, + + {12, {}, {{0, 1, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyTooQuick1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + /* Release key exactly on the debounce time */ + {5, {{0, 1, UP}}, {}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyTooQuick2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}}}, + {6, {{0, 1, UP}}, {}}, + + /* Press key exactly on the debounce time */ + {11, {{0, 1, DOWN}}, {}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyBouncing1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + {1, {{0, 1, UP}}, {}}, + {2, {{0, 1, DOWN}}, {}}, + {3, {{0, 1, UP}}, {}}, + {4, {{0, 1, DOWN}}, {}}, + {5, {{0, 1, UP}}, {}}, + {6, {{0, 1, DOWN}}, {}}, + {11, {}, {{0, 1, DOWN}}}, /* 5ms after DOWN at time 7 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyBouncing2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + {5, {}, {{0, 1, DOWN}}}, + {6, {{0, 1, UP}}, {}}, + {7, {{0, 1, DOWN}}, {}}, + {8, {{0, 1, UP}}, {}}, + {9, {{0, 1, DOWN}}, {}}, + {10, {{0, 1, UP}}, {}}, + {15, {}, {{0, 1, UP}}}, /* 5ms after UP at time 10 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyLong) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}}}, + + {25, {{0, 1, UP}}, {}}, + + {30, {}, {{0, 1, UP}}}, + + {50, {{0, 1, DOWN}}, {}}, + + {55, {}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, TwoKeysShort) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + {1, {{0, 2, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}}}, + {6, {}, {{0, 2, DOWN}}}, + + {7, {{0, 1, UP}}, {}}, + {8, {{0, 2, UP}}, {}}, + + {12, {}, {{0, 1, UP}}}, + {13, {}, {{0, 2, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, TwoKeysSimultaneous1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}, {0, 2, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}, {0, 2, DOWN}}}, + {6, {{0, 1, UP}, {0, 2, UP}}, {}}, + + {11, {}, {{0, 1, UP}, {0, 2, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, TwoKeysSimultaneous2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + {1, {{0, 2, DOWN}}, {}}, + + {5, {}, {{0, 1, DOWN}}}, + {6, {{0, 1, UP}}, {{0, 2, DOWN}}}, + {7, {{0, 2, UP}}, {}}, + + {11, {}, {{0, 1, UP}}}, + {12, {}, {{0, 2, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + /* Processing is very late */ + {300, {}, {{0, 1, DOWN}}}, + /* Immediately release key */ + {300, {{0, 1, UP}}, {}}, + + {305, {}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + /* Processing is very late */ + {300, {}, {{0, 1, DOWN}}}, + /* Release key after 1ms */ + {301, {{0, 1, UP}}, {}}, + + {306, {}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan3) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + /* Release key before debounce expires */ + {300, {{0, 1, UP}}, {}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan4) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {}}, + + /* Processing is a bit late */ + {50, {}, {{0, 1, DOWN}}}, + /* Release key after 1ms */ + {51, {{0, 1, UP}}, {}}, + + {56, {}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} diff --git a/quantum/debounce/tests/sym_eager_pk_tests.cpp b/quantum/debounce/tests/sym_eager_pk_tests.cpp new file mode 100644 index 0000000000..e0fc205e33 --- /dev/null +++ b/quantum/debounce/tests/sym_eager_pk_tests.cpp @@ -0,0 +1,237 @@ +/* Copyright 2021 Simon Arlott + * + * 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 "debounce_test_common.h" + +TEST_F(DebounceTest, OneKeyShort1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key again after 1ms delay (debounce has not yet finished) */ + {6, {{0, 1, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key again after 2ms delay (debounce has not yet finished) */ + {7, {{0, 1, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort3) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key again after 3ms delay (debounce has not yet finished) */ + {8, {{0, 1, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort4) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key again after 4ms delay (debounce has not yet finished) */ + {9, {{0, 1, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort5) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key again after 5ms delay (debounce has finished) */ + {10, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort6) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key after after 6ms delay (debounce has finished) */ + {11, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyBouncing1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + {2, {{0, 1, DOWN}}, {}}, + {3, {{0, 1, UP}}, {}}, + {4, {{0, 1, DOWN}}, {}}, + {5, {{0, 1, UP}}, {{0, 1, UP}}}, + /* Press key again after 1ms delay (debounce has not yet finished) */ + {6, {{0, 1, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyBouncing2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + /* Change twice in the same time period */ + {1, {{0, 1, UP}}, {}}, + {1, {{0, 1, DOWN}}, {}}, + /* Change three times in the same time period */ + {2, {{0, 1, UP}}, {}}, + {2, {{0, 1, DOWN}}, {}}, + {2, {{0, 1, UP}}, {}}, + /* Change three times in the same time period */ + {3, {{0, 1, DOWN}}, {}}, + {3, {{0, 1, UP}}, {}}, + {3, {{0, 1, DOWN}}, {}}, + /* Change twice in the same time period */ + {4, {{0, 1, UP}}, {}}, + {4, {{0, 1, DOWN}}, {}}, + {5, {{0, 1, UP}}, {{0, 1, UP}}}, + /* Press key again after 1ms delay (debounce has not yet finished) */ + {6, {{0, 1, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyLong) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + {25, {{0, 1, UP}}, {{0, 1, UP}}}, + + {50, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, TwoKeysShort) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + {2, {{0, 2, DOWN}}, {{0, 2, DOWN}}}, + {3, {{0, 2, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key again after 1ms delay (debounce has not yet finished) */ + {6, {{0, 1, DOWN}}, {}}, + {7, {}, {{0, 2, UP}}}, + + /* Press key again after 1ms delay (debounce has not yet finished) */ + {9, {{0, 2, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + + {12, {}, {{0, 2, DOWN}}}, /* 5ms after UP at time 7 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late but the change will now be accepted */ + {300, {{0, 1, UP}}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late but the change will now be accepted even with a 1 scan delay */ + {300, {}, {}}, + {300, {{0, 1, UP}}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan3) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late but the change will now be accepted even with a 1ms delay */ + {300, {}, {}}, + {301, {{0, 1, UP}}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan4) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is a bit late but the change will now be accepted */ + {50, {{0, 1, UP}}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan5) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late but the change will now be accepted even with a 1 scan delay */ + {50, {}, {}}, + {50, {{0, 1, UP}}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan6) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late but the change will now be accepted even with a 1ms delay */ + {50, {}, {}}, + {51, {{0, 1, UP}}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} diff --git a/quantum/debounce/tests/sym_eager_pr_tests.cpp b/quantum/debounce/tests/sym_eager_pr_tests.cpp new file mode 100644 index 0000000000..2c4bca127e --- /dev/null +++ b/quantum/debounce/tests/sym_eager_pr_tests.cpp @@ -0,0 +1,280 @@ +/* Copyright 2021 Simon Arlott + * + * 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 "debounce_test_common.h" + +TEST_F(DebounceTest, OneKeyShort1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key again after 1ms delay (debounce has not yet finished) */ + {6, {{0, 1, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key again after 2ms delay (debounce has not yet finished) */ + {7, {{0, 1, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort3) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key again after 3ms delay (debounce has not yet finished) */ + {8, {{0, 1, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort4) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key again after 4ms delay (debounce has not yet finished) */ + {9, {{0, 1, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort5) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key again after 5ms delay (debounce has finished) */ + {10, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyShort6) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key after after 6ms delay (debounce has finished) */ + {11, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyBouncing1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + {2, {{0, 1, DOWN}}, {}}, + {3, {{0, 1, UP}}, {}}, + {4, {{0, 1, DOWN}}, {}}, + {5, {{0, 1, UP}}, {{0, 1, UP}}}, + /* Press key again after 1ms delay (debounce has not yet finished) */ + {6, {{0, 1, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyBouncing2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + /* Change twice in the same time period */ + {1, {{0, 1, UP}}, {}}, + {1, {{0, 1, DOWN}}, {}}, + /* Change three times in the same time period */ + {2, {{0, 1, UP}}, {}}, + {2, {{0, 1, DOWN}}, {}}, + {2, {{0, 1, UP}}, {}}, + /* Change three times in the same time period */ + {3, {{0, 1, DOWN}}, {}}, + {3, {{0, 1, UP}}, {}}, + {3, {{0, 1, DOWN}}, {}}, + /* Change twice in the same time period */ + {4, {{0, 1, UP}}, {}}, + {4, {{0, 1, DOWN}}, {}}, + {5, {{0, 1, UP}}, {{0, 1, UP}}}, + /* Press key again after 1ms delay (debounce has not yet finished) */ + {6, {{0, 1, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyLong) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + {25, {{0, 1, UP}}, {{0, 1, UP}}}, + + {50, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, TwoRowsShort) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + {2, {{2, 0, DOWN}}, {{2, 0, DOWN}}}, + {3, {{2, 0, UP}}, {}}, + + {5, {}, {{0, 1, UP}}}, + /* Press key again after 1ms delay (debounce has not yet finished) */ + {6, {{0, 1, DOWN}}, {}}, + {7, {}, {{2, 0, UP}}}, + + /* Press key again after 1ms delay (debounce has not yet finished) */ + {9, {{2, 0, DOWN}}, {}}, + {10, {}, {{0, 1, DOWN}}}, /* 5ms after UP at time 5 */ + + {12, {}, {{2, 0, DOWN}}}, /* 5ms after UP at time 7 */ + }); + runEvents(); +} + +TEST_F(DebounceTest, TwoKeysOverlap) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + {1, {{0, 1, UP}}, {}}, + /* Press a second key during the first debounce */ + {2, {{0, 2, DOWN}}, {}}, + + /* Key registers as soon as debounce finishes, 5ms after time 0 */ + {5, {}, {{0, 1, UP}, {0, 2, DOWN}}}, + {6, {{0, 1, DOWN}}, {}}, + + /* Key registers as soon as debounce finishes, 5ms after time 5 */ + {10, {}, {{0, 1, DOWN}}}, + /* Release both keys */ + {11, {{0, 1, UP}}, {}}, + {12, {{0, 2, UP}}, {}}, + + /* Keys register as soon as debounce finishes, 5ms after time 10 */ + {15, {}, {{0, 1, UP}, {0, 2, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, TwoKeysSimultaneous1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}, {0, 2, DOWN}}, {{0, 1, DOWN}, {0, 2, DOWN}}}, + {20, {{0, 1, UP}}, {{0, 1, UP}}}, + {21, {{0, 2, UP}}, {}}, + + /* Key registers as soon as debounce finishes, 5ms after time 20 */ + {25, {}, {{0, 2, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, TwoKeysSimultaneous2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}, {0, 2, DOWN}}, {{0, 1, DOWN}, {0, 2, DOWN}}}, + {20, {{0, 1, UP}, {0, 2, UP}}, {{0, 1, UP}, {0, 2, UP}}}, + }); + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan1) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late but the change will now be accepted */ + {300, {{0, 1, UP}}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan2) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late but the change will now be accepted even with a 1 scan delay */ + {300, {}, {}}, + {300, {{0, 1, UP}}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan3) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late but the change will now be accepted even with a 1ms delay */ + {300, {}, {}}, + {301, {{0, 1, UP}}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan4) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is a bit late but the change will now be accepted */ + {50, {{0, 1, UP}}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan5) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late but the change will now be accepted even with a 1 scan delay */ + {50, {}, {}}, + {50, {{0, 1, UP}}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} + +TEST_F(DebounceTest, OneKeyDelayedScan6) { + addEvents({ /* Time, Inputs, Outputs */ + {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}}, + + /* Processing is very late but the change will now be accepted even with a 1ms delay */ + {50, {}, {}}, + {51, {{0, 1, UP}}, {{0, 1, UP}}}, + }); + time_jumps_ = true; + runEvents(); +} diff --git a/quantum/debounce/tests/testlist.mk b/quantum/debounce/tests/testlist.mk new file mode 100644 index 0000000000..c54c45aa63 --- /dev/null +++ b/quantum/debounce/tests/testlist.mk @@ -0,0 +1,6 @@ +TEST_LIST += \ + debounce_sym_defer_g \ + debounce_sym_defer_pk \ + debounce_sym_eager_pk \ + debounce_sym_eager_pr \ + debounce_asym_eager_defer_pk diff --git a/quantum/digitizer.c b/quantum/digitizer.c new file mode 100644 index 0000000000..e299867429 --- /dev/null +++ b/quantum/digitizer.c @@ -0,0 +1,34 @@ +/* Copyright 2021 + * + * 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 "digitizer.h" + +digitizer_t digitizerReport = {.tipswitch = 0, .inrange = 0, .id = 0, .x = 0, .y = 0, .status = DZ_INITIALIZED}; + +__attribute__((weak)) void digitizer_send(void) { + if (digitizerReport.status & DZ_UPDATED) { + host_digitizer_send(&digitizerReport); + digitizerReport.status &= ~DZ_UPDATED; + } +} + +__attribute__((weak)) void digitizer_task(void) { digitizer_send(); } + +digitizer_t digitizer_get_report(void) { return digitizerReport; } + +void digitizer_set_report(digitizer_t newDigitizerReport) { + digitizerReport = newDigitizerReport; + digitizerReport.status |= DZ_UPDATED; +}
\ No newline at end of file diff --git a/quantum/digitizer.h b/quantum/digitizer.h new file mode 100644 index 0000000000..cef551567e --- /dev/null +++ b/quantum/digitizer.h @@ -0,0 +1,41 @@ +/* Copyright 2021 + * + * 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 "quantum.h" + +#include <stdint.h> + +enum digitizer_status { DZ_INITIALIZED = 1, DZ_UPDATED = 2 }; + +typedef struct { + int8_t tipswitch; + int8_t inrange; + uint8_t id; + float x; + float y; + uint8_t status : 2; +} digitizer_t; + +extern digitizer_t digitizer; + +digitizer_t digitizer_get_report(void); + +void digitizer_set_report(digitizer_t newDigitizerReport); + +void digitizer_task(void); + +void host_digitizer_send(digitizer_t *digitizer); diff --git a/quantum/dip_switch.c b/quantum/dip_switch.c index cda69bd0ef..133ec85027 100644 --- a/quantum/dip_switch.c +++ b/quantum/dip_switch.c @@ -17,6 +17,9 @@ */ #include "dip_switch.h" +#ifdef SPLIT_KEYBOARD +# include "split_common/split_util.h" +#endif // for memcpy #include <string.h> @@ -49,16 +52,24 @@ static uint16_t scan_count; static bool dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0}; static bool last_dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0}; -__attribute__((weak)) void dip_switch_update_user(uint8_t index, bool active) {} +__attribute__((weak)) bool dip_switch_update_user(uint8_t index, bool active) { return true; } -__attribute__((weak)) void dip_switch_update_kb(uint8_t index, bool active) { dip_switch_update_user(index, active); } +__attribute__((weak)) bool dip_switch_update_kb(uint8_t index, bool active) { return dip_switch_update_user(index, active); } -__attribute__((weak)) void dip_switch_update_mask_user(uint32_t state) {} +__attribute__((weak)) bool dip_switch_update_mask_user(uint32_t state) { return true; } -__attribute__((weak)) void dip_switch_update_mask_kb(uint32_t state) { dip_switch_update_mask_user(state); } +__attribute__((weak)) bool dip_switch_update_mask_kb(uint32_t state) { return dip_switch_update_mask_user(state); } void dip_switch_init(void) { #ifdef DIP_SWITCH_PINS +# if defined(SPLIT_KEYBOARD) && defined(DIP_SWITCH_PINS_RIGHT) + if (!isLeftHand) { + const pin_t dip_switch_pad_right[] = DIP_SWITCH_PINS_RIGHT; + for (uint8_t i = 0; i < NUMBER_OF_DIP_SWITCHES; i++) { + dip_switch_pad[i] = dip_switch_pad_right[i]; + } + } +# endif for (uint8_t i = 0; i < NUMBER_OF_DIP_SWITCHES; i++) { setPinInputHigh(dip_switch_pad[i]); } diff --git a/quantum/dip_switch.h b/quantum/dip_switch.h index 61ef1cc19d..058a10f41f 100644 --- a/quantum/dip_switch.h +++ b/quantum/dip_switch.h @@ -20,10 +20,10 @@ #include "quantum.h" -void dip_switch_update_kb(uint8_t index, bool active); -void dip_switch_update_user(uint8_t index, bool active); -void dip_switch_update_mask_user(uint32_t state); -void dip_switch_update_mask_kb(uint32_t state); +bool dip_switch_update_kb(uint8_t index, bool active); +bool dip_switch_update_user(uint8_t index, bool active); +bool dip_switch_update_mask_user(uint32_t state); +bool dip_switch_update_mask_kb(uint32_t state); void dip_switch_init(void); void dip_switch_read(bool forced); diff --git a/tmk_core/common/eeconfig.c b/quantum/eeconfig.c index 57c468ed7a..e571309a05 100644 --- a/tmk_core/common/eeconfig.c +++ b/quantum/eeconfig.c @@ -20,6 +20,12 @@ # include "haptic.h" #endif +#if defined(VIA_ENABLE) +bool via_eeprom_is_valid(void); +void via_eeprom_set_valid(bool valid); +void eeconfig_init_via(void); +#endif + /** \brief eeconfig enable * * FIXME: needs doc @@ -84,6 +90,13 @@ void eeconfig_init_quantum(void) { // when a haptic-enabled firmware is loaded onto the keyboard. eeprom_update_dword(EECONFIG_HAPTIC, 0); #endif +#if defined(VIA_ENABLE) + // Invalidate VIA eeprom config, and then reset. + // Just in case if power is lost mid init, this makes sure that it pets + // properly re-initialized. + via_eeprom_set_valid(false); + eeconfig_init_via(); +#endif eeconfig_init_kb(); } @@ -118,13 +131,29 @@ void eeconfig_disable(void) { * * FIXME: needs doc */ -bool eeconfig_is_enabled(void) { return (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER); } +bool eeconfig_is_enabled(void) { + bool is_eeprom_enabled = (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER); +#ifdef VIA_ENABLE + if (is_eeprom_enabled) { + is_eeprom_enabled = via_eeprom_is_valid(); + } +#endif + return is_eeprom_enabled; +} /** \brief eeconfig is disabled * * FIXME: needs doc */ -bool eeconfig_is_disabled(void) { return (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER_OFF); } +bool eeconfig_is_disabled(void) { + bool is_eeprom_disabled = (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER_OFF); +#ifdef VIA_ENABLE + if (!is_eeprom_disabled) { + is_eeprom_disabled = !via_eeprom_is_valid(); + } +#endif + return is_eeprom_disabled; +} /** \brief eeconfig read debug * diff --git a/tmk_core/common/eeconfig.h b/quantum/eeconfig.h index a88071729d..bd39971b2c 100644 --- a/tmk_core/common/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)0xFEEA // When changing, decrement this value to avoid future re-init issues +# define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEE9 // 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 c30bf01cb2..8fb87281c2 100644 --- a/quantum/encoder.c +++ b/quantum/encoder.c @@ -119,6 +119,11 @@ static bool encoder_update(uint8_t index, uint8_t state) { encoder_update_kb(index, ENCODER_CLOCKWISE); } encoder_pulses[i] %= resolution; +#ifdef ENCODER_DEFAULT_POS + if ((state & 0x3) == ENCODER_DEFAULT_POS) { + encoder_pulses[i] = 0; + } +#endif return changed; } diff --git a/drivers/haptic/haptic.c b/quantum/haptic.c index 828c8fba71..65abcc15fa 100644 --- a/drivers/haptic/haptic.c +++ b/quantum/haptic.c @@ -16,7 +16,6 @@ */ #include "haptic.h" #include "eeconfig.h" -#include "progmem.h" #include "debug.h" #ifdef DRV2605L # include "DRV2605L.h" @@ -28,7 +27,6 @@ haptic_config_t haptic_config; void haptic_init(void) { - debug_enable = 1; // Debug is ON! if (!eeconfig_is_enabled()) { eeconfig_init(); } @@ -65,7 +63,7 @@ void haptic_task(void) { } void eeconfig_debug_haptic(void) { - dprintf("haptic_config eprom\n"); + dprintf("haptic_config eeprom\n"); dprintf("haptic_config.enable = %d\n", haptic_config.enable); dprintf("haptic_config.mode = %d\n", haptic_config.mode); } @@ -214,6 +212,8 @@ void haptic_set_dwell(uint8_t dwell) { xprintf("haptic_config.dwell = %u\n", haptic_config.dwell); } +uint8_t haptic_get_enable(void) { return haptic_config.enable; } + uint8_t haptic_get_mode(void) { if (!haptic_config.enable) { return false; @@ -254,14 +254,11 @@ void haptic_disable_continuous(void) { } void haptic_toggle_continuous(void) { -#ifdef DRV2605L if (haptic_config.cont) { haptic_disable_continuous(); } else { haptic_enable_continuous(); } - eeconfig_update_haptic(haptic_config.raw); -#endif } void haptic_cont_increase(void) { @@ -291,103 +288,6 @@ void haptic_play(void) { #endif } -void haptic_toggle_continuous(void) { -#ifdef DRV2605L -if (haptic_config.cont) { - haptic_disable_continuous(); - } else { - haptic_enable_continuous(); - } - eeconfig_update_haptic(haptic_config.raw); -#endif -} - - -void haptic_cont_increase(void) { - uint8_t amp = haptic_config.amplitude + 10; - if (haptic_config.amplitude >= 120) { - amp = 120; - } - haptic_set_amplitude(amp); -} - -void haptic_cont_decrease(void) { - uint8_t amp = haptic_config.amplitude - 10; - if (haptic_config.amplitude < 20) { - amp = 20; - } - haptic_set_amplitude(amp); -} - - -void haptic_play(void) { -#ifdef DRV2605L - uint8_t play_eff = 0; - play_eff = haptic_config.mode; - DRV_pulse(play_eff); -#endif -#ifdef SOLENOID_ENABLE - solenoid_fire(); -#endif -} - -bool process_haptic(uint16_t keycode, keyrecord_t *record) { - if (keycode == HPT_ON && record->event.pressed) { - haptic_enable(); - } - if (keycode == HPT_OFF && record->event.pressed) { - haptic_disable(); - } - if (keycode == HPT_TOG && record->event.pressed) { - haptic_toggle(); - } - if (keycode == HPT_RST && record->event.pressed) { - haptic_reset(); - } - if (keycode == HPT_FBK && record->event.pressed) { - haptic_feedback_toggle(); - } - if (keycode == HPT_BUZ && record->event.pressed) { - haptic_buzz_toggle(); - } - if (keycode == HPT_MODI && record->event.pressed) { - haptic_mode_increase(); - } - if (keycode == HPT_MODD && record->event.pressed) { - haptic_mode_decrease(); - } - if (keycode == HPT_DWLI && record->event.pressed) { - haptic_dwell_increase(); - } - if (keycode == HPT_DWLD && record->event.pressed) { - haptic_dwell_decrease(); - } - if (keycode == HPT_CONT && record->event.pressed) { - haptic_toggle_continuous(); - } - if (keycode == HPT_CONI && record->event.pressed) { - haptic_cont_increase(); - } - if (keycode == HPT_COND && record->event.pressed) { - haptic_cont_decrease(); - } - - if (haptic_config.enable) { - if (record->event.pressed) { - // keypress - if (haptic_config.feedback < 2) { - haptic_play(); - } - } else { - // keyrelease - if (haptic_config.feedback > 0) { - haptic_play(); - } - } - } - return true; -} - void haptic_shutdown(void) { #ifdef SOLENOID_ENABLE solenoid_shutdown(); diff --git a/drivers/haptic/haptic.h b/quantum/haptic.h index ba8e0d20be..fc7ca2f3e6 100644 --- a/drivers/haptic/haptic.h +++ b/quantum/haptic.h @@ -18,10 +18,6 @@ #pragma once #include <stdint.h> #include <stdbool.h> -#include "quantum.h" -#ifdef DRV2605L -# include "DRV2605L.h" -#endif #ifndef HAPTIC_FEEDBACK_DEFAULT # define HAPTIC_FEEDBACK_DEFAULT 0 @@ -52,7 +48,6 @@ typedef enum HAPTIC_FEEDBACK { HAPTIC_FEEDBACK_MAX, } HAPTIC_FEEDBACK; -bool process_haptic(uint16_t keycode, keyrecord_t *record); void haptic_init(void); void haptic_task(void); void eeconfig_debug_haptic(void); @@ -69,6 +64,7 @@ void haptic_set_mode(uint8_t mode); void haptic_set_dwell(uint8_t dwell); void haptic_set_buzz(uint8_t buzz); void haptic_buzz_toggle(void); +uint8_t haptic_get_enable(void); uint8_t haptic_get_mode(void); uint8_t haptic_get_feedback(void); void haptic_dwell_increase(void); diff --git a/tmk_core/common/keyboard.c b/quantum/keyboard.c index 3d6092e71c..b98fc64e45 100644 --- a/tmk_core/common/keyboard.c +++ b/quantum/keyboard.c @@ -82,9 +82,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifdef QWIIC_ENABLE # include "qwiic.h" #endif -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE # include "oled_driver.h" #endif +#ifdef ST7565_ENABLE +# include "st7565.h" +#endif #ifdef VELOCIKEY_ENABLE # include "velocikey.h" #endif @@ -100,6 +103,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifdef EEPROM_DRIVER # include "eeprom_driver.h" #endif +#if defined(CRC_ENABLE) +# include "crc.h" +#endif +#ifdef DIGITIZER_ENABLE +# include "digitizer.h" +#endif static uint32_t last_input_modification_time = 0; uint32_t last_input_activity_time(void) { return last_input_modification_time; } @@ -247,6 +256,8 @@ void keyboard_setup(void) { keyboard_pre_init_kb(); } +#ifndef SPLIT_KEYBOARD + /** \brief is_keyboard_master * * FIXME: needs doc @@ -259,6 +270,8 @@ __attribute__((weak)) bool is_keyboard_master(void) { return true; } */ __attribute__((weak)) bool is_keyboard_left(void) { return true; } +#endif + /** \brief should_process_keypress * * Override this function if you have a condition where keypresses processing should change: @@ -296,16 +309,22 @@ void housekeeping_task(void) { void keyboard_init(void) { timer_init(); sync_timer_init(); - matrix_init(); #ifdef VIA_ENABLE via_init(); #endif + matrix_init(); +#if defined(CRC_ENABLE) + crc_init(); +#endif #ifdef QWIIC_ENABLE qwiic_init(); #endif -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE oled_init(OLED_ROTATION_0); #endif +#ifdef ST7565_ENABLE + st7565_init(DISPLAY_ROTATION_0); +#endif #ifdef PS2_MOUSE_ENABLE ps2_mouse_init(); #endif @@ -458,9 +477,9 @@ MATRIX_LOOP_END: qwiic_task(); #endif -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE oled_task(); -# ifndef OLED_DISABLE_TIMEOUT +# if OLED_TIMEOUT > 0 // Wake up oled if user is using those fabulous keys or spinning those encoders! # ifdef ENCODER_ENABLE if (matrix_changed || encoders_changed) oled_on(); @@ -470,6 +489,18 @@ MATRIX_LOOP_END: # endif #endif +#ifdef ST7565_ENABLE + st7565_task(); +# if ST7565_TIMEOUT > 0 + // Wake up display if user is using those fabulous keys or spinning those encoders! +# ifdef ENCODER_ENABLE + if (matrix_changed || encoders_changed) st7565_on(); +# else + if (matrix_changed) st7565_on(); +# endif +# endif +#endif + #ifdef MOUSEKEY_ENABLE // mousekey repeat & acceleration mousekey_task(); @@ -513,6 +544,10 @@ MATRIX_LOOP_END: joystick_task(); #endif +#ifdef DIGITIZER_ENABLE + digitizer_task(); +#endif + // update LED if (led_status != host_keyboard_leds()) { led_status = host_keyboard_leds(); diff --git a/tmk_core/common/keyboard.h b/quantum/keyboard.h index 08f4e84f94..08f4e84f94 100644 --- a/tmk_core/common/keyboard.h +++ b/quantum/keyboard.h diff --git a/tmk_core/common/keycode.h b/quantum/keycode.h index 8facabd818..8facabd818 100644 --- a/tmk_core/common/keycode.h +++ b/quantum/keycode.h diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 570d4798de..780c71ab9b 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -19,10 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "report.h" #include "keycode.h" #include "action_layer.h" -#if defined(__AVR__) -# include <util/delay.h> -# include <stdio.h> -#endif #include "action.h" #include "action_macro.h" #include "debug.h" @@ -44,7 +40,10 @@ extern keymap_config_t keymap_config; action_t action_for_key(uint8_t layer, keypos_t key) { // 16bit keycodes - important uint16_t keycode = keymap_key_to_keycode(layer, key); + return action_for_keycode(keycode); +}; +action_t action_for_keycode(uint16_t keycode) { // keycode remapping keycode = keycode_config(keycode); diff --git a/quantum/keymap_extras/keymap_belgian.h b/quantum/keymap_extras/keymap_belgian.h index b65db0532b..207905b291 100644 --- a/quantum/keymap_extras/keymap_belgian.h +++ b/quantum/keymap_extras/keymap_belgian.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ² │ & │ é │ " │ ' │ ( │ § │ è │ ! │ ç │ à │ ) │ - │ │ + * │ ² │ & │ é │ " │ ' │ ( │ § │ è │ ! │ ç │ à │ ) │ - │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ A │ Z │ E │ R │ T │ Y │ U │ I │ O │ P │ ^ │ $ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Q │ S │ D │ F │ G │ H │ J │ K │ L │ M │ ù │ µ │ │ + * │ │ A │ Z │ E │ R │ T │ Y │ U │ I │ O │ P │ ^ │ $ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Q │ S │ D │ F │ G │ H │ J │ K │ L │ M │ ù │ µ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ W │ X │ C │ V │ B │ N │ , │ ; │ : │ = │ │ + * │ │ < │ W │ X │ C │ V │ B │ N │ , │ ; │ : │ = │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ³ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ° │ _ │ │ + * │ ³ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ° │ _ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ * │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ % │ £ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ * │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ % │ £ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ ? │ . │ / │ + │ │ + * │ │ > │ │ │ │ │ │ │ ? │ . │ / │ + │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -128,15 +128,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ | │ @ │ # │ │ │ ^ │ │ │ { │ } │ │ │ │ + * │ │ | │ @ │ # │ │ │ ^ │ │ │ { │ } │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ € │ │ │ │ │ │ │ │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ ´ │ ` │ │ + * │ │ │ │ € │ │ │ │ │ │ │ │ [ │ ] │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ´ │ ` │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ \ │ │ │ │ │ │ │ │ │ │ ~ │ │ + * │ │ \ │ │ │ │ │ │ │ │ │ │ ~ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -156,16 +156,3 @@ // Row 4 #define BE_BSLS ALGR(BE_LABK) // (backslash) #define BE_TILD ALGR(BE_EQL) // ~ - -// DEPRECATED -#define BE_AMP BE_AMPR -#define BE_APOS BE_QUOT -#define BE_PARA BE_SECT -#define BE_MU BE_MICR -#define BE_LESS BE_LABK -#define BE_OVRR BE_DEG -#define BE_UMLT BE_DIAE -#define BE_GRTR BE_RABK -#define BE_LSBR BE_LBRC -#define BE_RSBR BE_RBRC -#define BE_TILT BE_TILD diff --git a/quantum/keymap_extras/keymap_bepo.h b/quantum/keymap_extras/keymap_bepo.h index ea04aed3c1..72d5b81f32 100644 --- a/quantum/keymap_extras/keymap_bepo.h +++ b/quantum/keymap_extras/keymap_bepo.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ $ │ " │ « │ » │ ( │ ) │ @ │ + │ - │ / │ * │ = │ % │ │ + * │ $ │ " │ « │ » │ ( │ ) │ @ │ + │ - │ / │ * │ = │ % │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ B │ É │ P │ O │ È │ ^ │ V │ D │ L │ J │ Z │ W │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ U │ I │ E │ , │ C │ T │ S │ R │ N │ M │ Ç │ │ + * │ │ B │ É │ P │ O │ È │ ^ │ V │ D │ L │ J │ Z │ W │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ U │ I │ E │ , │ C │ T │ S │ R │ N │ M │ Ç │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ Ê │ À │ Y │ X │ . │ K │ ' │ Q │ G │ H │ F │ │ + * │ │ Ê │ À │ Y │ X │ . │ K │ ' │ Q │ G │ H │ F │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ # │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ° │ ` │ │ + * │ # │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ° │ ` │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ ! │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ ; │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ ! │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ ; │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ : │ │ ? │ │ │ │ │ │ + * │ │ │ │ │ │ : │ │ ? │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -121,19 +121,19 @@ #define BP_COLN S(BP_DOT) // : #define BP_QUES S(BP_QUOT) // ? // Row 5 -#define BP_NBSP S(KC_SPC) // (non-breaking space) +#define BP_NBSP S(KC_SPC) // (non-breaking space) /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ – │ — │ < │ > │ [ │ ] │ ^ │ ± │ − │ ÷ │ × │ ≠ │ ‰ │ │ + * │ – │ — │ < │ > │ [ │ ] │ ^ │ ± │ − │ ÷ │ × │ ≠ │ ‰ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ | │ ´ │ & │ Œ │ ` │ ¡ │ ˇ │ Ð │ / │ IJ │ Ə │ ˘ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Æ │ Ù │ ¨ │ € │ │ © │ Þ │ ẞ │ ® │ ~ │ ¯ │ ¸ │ │ + * │ │ | │ ´ │ & │ Œ │ ` │ ¡ │ ˇ │ Ð │ / │ IJ │ Ə │ ˘ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Æ │ Ù │ ¨ │ € │ │ © │ Þ │ ẞ │ ® │ ~ │ ¯ │ ¸ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ \ │ { │ } │ … │ ~ │ ¿ │ ° │ │ † │ ˛ │ │ + * │ │ │ \ │ { │ } │ … │ ~ │ ¿ │ ° │ │ † │ ˛ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ _ │ │ │ │ │ + * │ │ │ │ _ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -181,7 +181,7 @@ #define BP_RCBR ALGR(BP_X) // } #define BP_ELLP ALGR(BP_DOT) // … #define BP_TILD ALGR(BP_K) // ~ -#define BP_IQUE ALGR(BP_QEST) // ¿ +#define BP_IQUE ALGR(BP_QUES) // ¿ #define BP_RNGA ALGR(BP_Q) // ° (dead) #define BP_DGRK ALGR(BP_G) // µ (dead Greek key) #define BP_DAGG ALGR(BP_H) // † @@ -191,15 +191,15 @@ /* Shift+AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ¶ │ „ │ “ │ ” │ ≤ │ ≥ │ │ ¬ │ ¼ │ ½ │ ¾ │ ′ │ ″ │ │ + * │ ¶ │ „ │ “ │ ” │ ≤ │ ≥ │ │ ¬ │ ¼ │ ½ │ ¾ │ ′ │ ″ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ ¦ │ ˝ │ § │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ ˙ │ ¤ │ ̛ │ ſ │ │ │ ™ │ │ º │ , │ │ + * │ │ ¦ │ ˝ │ § │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ ˙ │ ¤ │ ̛ │ ſ │ │ │ ™ │ │ º │ , │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ ‘ │ ’ │ · │ ⌨ │ ̉ │ ̣ │ │ ‡ │ ª │ │ + * │ │ │ │ ‘ │ ’ │ · │ ⌨ │ ̉ │ ̣ │ │ ‡ │ ª │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -237,169 +237,4 @@ #define BP_DDAG S(ALGR(BP_H)) // ‡ #define BP_FORD S(ALGR(BP_F)) // ª // Row 5 -#define BP_NNBS S(ALGR(BP_)) // (narrow non-breaking space) - -// DEPRECATED -#define BP_DOLLAR BP_DLR -#define BP_DOUBLE_QUOTE BP_DQUO -#define BP_DQOT BP_DQUO -#define BP_LEFT_GUILLEMET BP_LDAQ -#define BP_LGIL BP_LDAQ -#define BP_RIGHT_GUILLEMET BP_RDAQ -#define BP_RGIL BP_RDAQ -#define BP_LEFT_PAREN BP_LPRN -#define BP_RIGHT_PAREN BP_RPRN -#define BP_MINUS BP_MINS -#define BP_SLASH BP_SLSH -#define BP_ASTERISK BP_ASTR -#define BP_EQUAL BP_EQL -#define BP_PERCENT BP_PERC -#define BP_E_ACUTE BP_EACU -#define BP_ECUT BP_EACU -#define BP_E_GRAVE BP_EGRV -#define BP_DEAD_CIRCUMFLEX BP_DCIR -#define BP_DCRC BP_DCIR -#define BP_COMMA BP_COMM -#define BP_C_CEDILLA BP_CCED -#define BP_E_CIRCUMFLEX BP_ECIR -#define BP_ECRC BP_ECIR -#define BP_A_GRAVE BP_AGRV -#define BP_APOSTROPHE BP_QUOT -#define BP_APOS BP_QUOT -#define BP_DEGREE BP_DEG -#define BP_DEGR BP_DEG -#define BP_GRAVE BP_GRV -#define BP_EXCLAIM BP_EXLM -#define BP_SCOLON BP_SCLN -#define BP_COLON BP_COLN -#define BP_QUESTION BP_QUES -#define BP_QEST BP_QUES -#define BP_NON_BREAKING_SPACE BP_NBSP -#define BP_EN_DASH BP_NDSH -#define BP_EM_DASH BP_MDSH -#define BP_LESS BP_LABK -#define BP_GREATER BP_RABK -#define BP_GRTR BP_RABK -#define BP_LBRACKET BP_LBRC -#define BP_RBRACKET BP_RBRC -#define BP_CIRCUMFLEX CIRC -#define BP_PLUS_MINUS BP_PLMN -#define BP_PSMS BP_PLMN -#define BP_MATH_MINUS BP_MMNS -#define BP_OBELUS BP_DIV -#define BP_OBEL BP_DIV -#define BP_DIVISION_SIGN BP_DIV -#define BP_DVSN BP_DIV -#define BP_TIMES BP_MUL -#define BP_TIMS BP_MUL -#define BP_DIFFERENT BP_NEQL -#define BP_DIFF BP_NEQL -#define BP_PERMILLE BP_PERM -#define BP_PMIL BP_PERM -#define BP_DEAD_ACUTE BP_ACUT -#define BP_DACT BP_ACUT -#define BP_AMPERSAND BP_AMPR -#define BP_OE_LIGATURE BP_OE -#define BP_DEAD_GRAVE BP_DGRV -#define BP_INVERTED_EXCLAIM BP_IEXL -#define BP_IXLM BP_IEXL -#define BP_DEAD_CARON BP_CARN -#define BP_DCAR BP_CARN -#define BP_DEAD_SLASH BP_DSLS -#define BP_DSLH BP_DSLS -#define BP_IJ_LIGATURE BP_IJ -#define BP_SCHWA BP_SCHW -#define BP_SCWA BP_SCHW -#define BP_DEAD_BREVE BP_BREV -#define BP_DBRV BP_BREV -#define BP_AE_LIGATURE BP_AE -#define BP_U_GRAVE BP_UGRV -#define BP_DEAD_TREMA BP_DIAE -#define BP_DTRM BP_DIAE -#define BP_TYPOGRAPHICAL_APOSTROPHE BP_COMM -#define BP_TAPO BP_COMM -#define BP_COPYRIGHT BP_COPY -#define BP_CPRT BP_COPY -#define BP_THORN BP_THRN -#define BP_SHARP_S BP_SS -#define BP_SRPS BP_SS -#define BP_REGISTERED_TRADEMARK BP_REGD -#define BP_RTM BP_REGD -#define BP_DEAD_TILDE BP_DTIL -#define BP_DTLD BP_DTIL -#define BP_DEAD_MACRON BP_MACR -#define BP_DMCR BP_MACR -#define BP_DEAD_CEDILLA BP_CEDL -#define BP_DCED BP_CEDL -#define BP_NONUS_SLASH BP_SLSH -#define BP_NUSL BP_SLSH -#define BP_BACKSLASH BP_BSLS -#define BP_LEFT_CURLY_BRACE BP_LCBR -#define BP_RIGHT_CURLY_BRACE BP_RCBR -#define BP_ELLIPSIS BP_ELLP -#define BP_ELPS BP_ELLP -#define BP_TILDE BP_TILD -#define BP_INVERTED_QUESTION BP_IQUE -#define BP_IQST BP_IQUE -#define BP_DEAD_RING BP_RNGA -#define BP_DRNG BP_RNGA -#define BP_DEAD_GREEK BP_DGRK -#define BP_DAGGER BP_DAGG -#define BP_DAGR BP_DAGG -#define BP_DEAD_OGONEK BP_OGON -#define BP_DOGO BP_OGON -#define BP_UNDERSCORE BP_UNDS -#define BP_PARAGRAPH BP_PARA -#define BP_PARG BP_PARA -#define BP_LOW_DOUBLE_QUOTE BP_DLQU -#define BP_LWQT BP_DLQU -#define BP_LEFT_DOUBLE_QUOTE BP_RDQU -#define BP_RIGHT_DOUBLE_QUOTE BP_RDQU -#define BP_LESS_OR_EQUAL BP_LEQL -#define BP_GREATER_OR_EQUAL BP_GEQL -#define BP_NEGATION BP_NOT -#define BP_NEGT BP_NOT -#define BP_ONE_QUARTER BP_QRTR -#define BP_1QRT BP_QRTR -#define BP_ONE_HALF BP_HALF -#define BP_1HLF BP_HALF -#define BP_THREE_QUARTERS TQTR -#define BP_3QRT BP_TQTR -#define BP_MINUTES BP_PRIM -#define BP_MNUT BP_PRIM -#define BP_SECONDS BP_DPRM -#define BP_SCND BP_DPRM -#define BP_BROKEN_PIPE BP_BRKP -#define BP_BPIP BP_BRKP -#define BP_DEAD_DOUBLE_ACUTE BP_DACU -#define BP_DDCT BP_DACU -#define BP_SECTION BP_SECT -#define BP_GRAVE_BIS BP_GRV -#define BP_GRVB BP_GRV -#define BP_DEAD_DOT_ABOVE BP_DOTA -#define BP_DDTA BP_DOTA -#define BP_DEAD_CURRENCY BP_CURR -#define BP_DCUR BP_CURR -#define BP_DEAD_HORN BP_HORN -#define BP_DHRN BP_HORN -#define BP_LONG_S BP_LNGS -#define BP_TRADEMARK BP_TM -#define BP_ORDINAL_INDICATOR_O MORD -#define BP_ORDO BP_MORD -#define BP_DEAD_COMMA BP_DCMM -#define BP_DCOM BP_DCMM -#define BP_LEFT_QUOTE BP_LSQU -#define BP_LQOT BP_LSQU -#define BP_RIGHT_QUOTE BP_RSQU -#define BP_RQOT BP_RSQU -#define BP_INTERPUNCT BP_MDDT -#define BP_IPCT BP_MDDT -#define BP_DEAD_HOOK_ABOVE BP_HOKA -#define BP_DHKA BP_HOKA -#define BP_DEAD_UNDERDOT BP_DOTB -#define BP_DUDT BP_DOTB -#define BP_DOUBLE_DAGGER BP_DDAG -#define BP_DDGR BP_DDAG -#define BP_ORDINAL_INDICATOR_A BP_FORD -#define BP_ORDA BP_FORD -#define BP_NARROW_NON_BREAKING_SPACE BP_NNBS +#define BP_NNBS S(ALGR(BP_)) // (narrow non-breaking space) diff --git a/quantum/keymap_extras/keymap_br_abnt2.h b/quantum/keymap_extras/keymap_br_abnt2.h index 9d83fdf4e3..e91718013a 100644 --- a/quantum/keymap_extras/keymap_br_abnt2.h +++ b/quantum/keymap_extras/keymap_br_abnt2.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ' │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ' │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ ´ │ [ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ç │ ~ │ ] │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ ´ │ [ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ç │ ~ │ ] │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┤ - * │ │ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ ; │ / │ │ + * │ │ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ ; │ / │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬──┴─┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -92,15 +92,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ " │ ! │ @ │ # │ $ │ % │ ¨ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ " │ ! │ @ │ # │ $ │ % │ ¨ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ ` │ { │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ ^ │ } │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ` │ { │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ^ │ } │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┤ - * │ │ | │ │ │ │ │ │ │ │ < │ > │ : │ ? │ │ + * │ │ | │ │ │ │ │ │ │ │ < │ > │ : │ ? │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬──┴─┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -132,15 +132,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ ¹ │ ² │ ³ │ £ │ ¢ │ ¬ │ │ │ │ │ │ § │ │ + * │ │ ¹ │ ² │ ³ │ £ │ ¢ │ ¬ │ │ │ │ │ │ § │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ ° │ │ │ │ │ │ │ │ │ ª │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ º │ │ + * │ │ │ │ ° │ │ │ │ │ │ │ │ │ ª │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ º │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┤ - * │ │ │ │ │ ₢ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ ₢ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬──┴─┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -158,23 +158,3 @@ #define BR_MORD ALGR(BR_RBRC) // º // Row 4 #define BR_CRUZ ALGR(BR_C) // ₢ - -// DEPRECATED -#define BR_CCDL BR_CCED -#define BR_DQT BR_DQUO -#define BR_TRMA BR_DIAE -#define BR_GRAV BR_GRV -#define BR_KPDT BR_PDOT -#define BR_KPCM BR_PCMM -#define BR_1UP BR_SUP1 -#define BR_2UP BR_SUP2 -#define BR_3UP BR_SUP3 -#define BR_ASLS BR_SLSH -#define BR_AQST BR_QUES - -// Not present on Windows 10? -#define BR_NDTD ALGR(BR_TILD) // ~ -#define BR_NDAC ALGR(BR_ACUT) // ´ -#define BR_NDGV ALGR(BR_QUOT) // ` -#define BR_NDCR ALGR(BR_CIRC) // ^ -#define BR_NDTR ALGR(BR_DIAE) // ¨ diff --git a/quantum/keymap_extras/keymap_canadian_multilingual.h b/quantum/keymap_extras/keymap_canadian_multilingual.h index bb8e44d546..e328cf65e6 100644 --- a/quantum/keymap_extras/keymap_canadian_multilingual.h +++ b/quantum/keymap_extras/keymap_canadian_multilingual.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ / │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ / │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ ^ │ Ç │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ È │ À │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ ^ │ Ç │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ È │ À │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ Ù │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ É │ │ + * │ │ Ù │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ É │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ \ │ ! │ @ │ # │ $ │ % │ ? │ & │ * │ ( │ ) │ _ │ + │ │ + * │ \ │ ! │ @ │ # │ $ │ % │ ? │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ : │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ : │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ ' │ " │ │ │ + * │ │ │ │ │ │ │ │ │ │ ' │ " │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -123,15 +123,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ | │ │ │ │ ¤ │ │ │ { │ } │ [ │ ] │ │ ¬ │ │ + * │ | │ │ │ │ ¤ │ │ │ { │ } │ [ │ ] │ │ ¬ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ € │ │ │ │ │ │ │ │ ` │ ~ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ ° │ │ │ │ + * │ │ │ │ € │ │ │ │ │ │ │ │ ` │ ~ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ ° │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ « │ » │ │ │ │ │ │ < │ > │ │ │ + * │ │ │ « │ » │ │ │ │ │ │ < │ > │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -156,15 +156,15 @@ /* Right Ctrl symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ ¹ │ ² │ ³ │ ¼ │ ½ │ ¾ │ │ │ │ │ │ ¸ │ │ + * │ │ ¹ │ ² │ ³ │ ¼ │ ½ │ ¾ │ │ │ │ │ │ ¸ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Ω │ Ł │ Œ │ ¶ │ Ŧ │ ← │ ↓ │ → │ Ø │ Þ │ │ ~ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Æ │ ß │ Ð │ │ Ŋ │ Ħ │ IJ │ ĸ │ Ŀ │ ´ │ │ │ │ + * │ │ Ω │ Ł │ Œ │ ¶ │ Ŧ │ ← │ ↓ │ → │ Ø │ Þ │ │ ~ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Æ │ ß │ Ð │ │ Ŋ │ Ħ │ IJ │ ĸ │ Ŀ │ ´ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ ¢ │ “ │ ” │ ʼn │ μ │ ― │ ˙ │ │ │ + * │ │ │ │ │ ¢ │ “ │ ” │ ʼn │ μ │ ― │ ˙ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -208,19 +208,19 @@ /* Shift+Right Ctrl symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ - │ ¡ │ │ £ │ │ ⅜ │ ⅝ │ ⅞ │ ™ │ ± │ │ ¿ │ ˛ │ │ + * │ - │ ¡ │ │ £ │ │ ⅜ │ ⅝ │ ⅞ │ ™ │ ± │ │ ¿ │ ˛ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ ® │ │ ¥ │ ↑ │ ı │ │ │ ° │ ¯ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ § │ │ ª │ │ │ │ │ │ ˝ │ ˇ │ ˘ │ │ + * │ │ │ │ │ ® │ │ ¥ │ ↑ │ ı │ │ │ ° │ ¯ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ § │ │ ª │ │ │ │ │ │ ˝ │ ˇ │ ˘ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ ¦ │ │ │ © │ ‘ │ ’ │ ♪ │ º │ × │ ÷ │ │ │ + * │ │ ¦ │ │ │ © │ ‘ │ ’ │ ♪ │ º │ × │ ÷ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 -#define CA_SHYP RCTL(S(CA_SLSH)) // (soft hyphen) +#define CA_SHYP RCTL(S(CA_SLSH)) // (soft hyphen) #define CA_IEXL RCTL(S(CA_1)) // ¡ #define CA_PND RCTL(S(CA_3)) // £ #define CA_TEIG RCTL(S(CA_5)) // ⅜ @@ -252,182 +252,3 @@ #define CA_MORD RCTL(S(CA_M)) // º #define CA_MUL RCTL(S(CA_COMM)) // × #define CA_DIV RCTL(S(CA_DOT)) // ÷ - -// DEPRECATED -#define GR2A(kc) RCTL(kc) -#define CSA_SLASH CA_SLSH -#define CSA_SLSH CA_SLSH -#define CSA_DEAD_CIRCUMFLEX CA_CIRC -#define CSA_DCRC CA_CIRC -#define CSA_C_CEDILLA CA_CCED -#define CSA_CCED CA_CCED -#define CSA_E_GRAVE CA_EGRV -#define CSA_EGRV CA_EGRV -#define CSA_A_GRAVE CA_AGRV -#define CSA_AGRV CA_AGRV -#define CSA_U_GRAVE CA_UGRV -#define CSA_UGRV CA_UGRV -#define CSA_E_ACUTE CA_EACU -#define CSA_ECUT CA_EACU -#define CSA_BACKSLASH CA_BSLS -#define CSA_BSLS CA_BSLS -#define CSA_QUESTION CA_QUES -#define CSA_QEST CA_QUES -#define CSA_DEAD_TREMA CA_DIAE -#define CSA_DTRM CA_DIAE -#define CSA_APOSTROPHE CA_QUOT -#define CSA_APOS CA_QUOT -#define CSA_DOUBLE_QUOTE CA_DQUO -#define CSA_DQOT CA_DQUO -#define CSA_PIPE CA_PIPE -#define CSA_CURRENCY CA_CURR -#define CSA_CURR CA_CURR -#define CSA_LEFT_CURLY_BRACE CA_LCBR -#define CSA_LCBR CA_LCBR -#define CSA_RIGHT_CURLY_BRACE CA_RCBR -#define CSA_RCBR CA_RCBR -#define CSA_LBRACKET CA_LBRC -#define CSA_LBRC CA_LBRC -#define CSA_RBRACKET CA_RBRC -#define CSA_RBRC CA_RBRC -#define CSA_NEGATION CA_NOT -#define CSA_NEGT CA_NOT -#define CSA_EURO CA_EURO -#define CSA_DEAD_GRAVE CA_GRV -#define CSA_DGRV CA_GRV -#define CSA_DEAD_TILDE CA_DTIL -#define CSA_DTLD CA_DTIL -#define CSA_DEGREE CA_DEG -#define CSA_DEGR CA_DEG -#define CSA_LEFT_GUILLEMET CA_LDAQ -#define CSA_LGIL CA_LDAQ -#define CSA_RIGHT_GUILLEMET CA_RDAQ -#define CSA_RGIL CA_RDAQ -#define CSA_LESS CA_LABK -#define CSA_GREATER CA_RABK -#define CSA_GRTR CA_RABK -#define CSA_NON_BREAKING_SPACE ALGR(KC_SPC) -#define CSA_NBSP ALGR(KC_SPC) -#define CSA_SUPERSCRIPT_ONE CA_SUP1 -#define CSA_SUP1 CA_SUP1 -#define CSA_SUPERSCRIPT_TWO CA_SUP2 -#define CSA_SUP2 CA_SUP2 -#define CSA_SUPERSCRIPT_THREE CA_SUP3 -#define CSA_SUP3 CA_SUP3 -#define CSA_ONE_QUARTER CA_QRTR -#define CSA_1QRT CA_QRTR -#define CSA_ONE_HALF CA_HALF -#define CSA_1HLF CA_HALF -#define CSA_THREE_QUARTERS CA_TQTR -#define CSA_3QRT CA_TQTR -#define CSA_DEAD_CEDILLA CA_CEDL -#define CSA_DCED CA_CEDL -#define CSA_OMEGA CA_OMEG -#define CSA_OMEG CA_OMEG -#define CSA_L_STROKE CA_LSTR -#define CSA_LSTK CA_LSTR -#define CSA_OE_LIGATURE CA_OE -#define CSA_OE CA_OE -#define CSA_PARAGRAPH CA_PARA -#define CSA_PARG CA_PARA -#define CSA_T_STROKE CA_TSTR -#define CSA_LEFT_ARROW CA_LARR -#define CSA_LARW CA_LARR -#define CSA_DOWN_ARROW CA_DARR -#define CSA_DARW CA_DARR -#define CSA_RIGHT_ARROW CA_RARR -#define CSA_RARW CA_RARR -#define CSA_O_STROKE CA_OSTR -#define CSA_OSTK CA_OSTR -#define CSA_THORN CA_THRN -#define CSA_THRN CA_THRN -#define CSA_TILDE CA_TILD -#define CSA_TILD CA_TILD -#define CSA_AE_LIGATURE CA_AE -#define CSA_AE CA_AE -#define CSA_SHARP_S CA_SS -#define CSA_SRPS CA_SS -#define CSA_ETH CA_ETH -#define CSA_ENG CA_ENG -#define CSA_H_SRTOKE CA_HSTR -#define CSA_HSTK CA_HSTR -#define CSA_IJ_LIGATURE CA_IJ -#define CSA_IJ CA_IJ -#define CSA_KRA CA_KRA -#define CSA_L_FLOWN_DOT CA_LMDT -#define CSA_LFLD CA_LMDT -#define CSA_DEAD_ACUTE CA_ACUT -#define CSA_DACT CA_ACUT -#define CSA_CENT CA_CENT -#define CSA_LEFT_DOUBLE_QUOTE CA_LDQU -#define CSA_LDQT CA_LDQU -#define CSA_RIGHT_DOUBLE_QUOTE CA_RDQU -#define CSA_RDQT CA_RDQU -#define CSA_N_APOSTROPHE CA_APSN -#define CSA_NAPO CA_APSN -#define CSA_MU CA_MICR -#define CSA_HORIZONTAL_BAR CA_HRZB -#define CSA_HZBR CA_HRZB -#define CSA_DEAD_DOT_ABOVE CA_DOTA -#define CSA_DDTA CA_DOTA -#define CSA_SOFT_HYPHEN CA_SHYP -#define CSA_SHYP CA_SHYP -#define CSA_INVERTED_EXCLAIM CA_IEXL -#define CSA_IXLM CA_IEXL -#define CSA_POUND CA_PND -#define CSA_GBP CA_PND -#define CSA_EURO_BIS CA_EURO -#define CSA_EURB CA_EURO -#define CSA_THREE_EIGHTHS CA_TEIG -#define CSA_3ON8 CA_TEIG -#define CSA_FIVE_EIGHTHS CA_FEIG -#define CSA_5ON8 CA_FEIG -#define CSA_SEVEN_EIGHTHS CA_SEIG -#define CSA_7ON8 CA_SEIG -#define CSA_TRADEMARK CA_TM -#define CSA_TM CA_TM -#define CSA_PLUS_MINUS CA_PLMN -#define CSA_PSMS CA_PLMN -#define CSA_INVERTED_QUESTION CA_IQUE -#define CSA_IQST CA_IQUE -#define CSA_DEAD_OGONEK CA_OGON -#define CSA_DOGO CA_OGON -#define CSA_REGISTERED_TRADEMARK CA_REGD -#define CSA_RTM CA_REGD -#define CSA_YEN CA_YEN -#define CSA_YUAN CA_YEN -#define CSA_UP_ARROW CA_UARR -#define CSA_DOTLESS_I CA_DLSI -#define CSA_DLSI CA_DLSI -#define CSA_DEAD_RING CA_RNGA -#define CSA_DRNG CA_RNGA -#define CSA_DEAD_MACRON CA_MACR -#define CSA_DMCR CA_MACR -#define CSA_SECTION CA_SECT -#define CSA_SECT CA_SECT -#define CSA_ORDINAL_INDICATOR_A CA_FORD -#define CSA_ORDA CA_FORD -#define CSA_DEAD_DOUBLE_ACUTE CA_DACU -#define CSA_DDCT CA_DACU -#define CSA_DEAD_CARON CA_CARN -#define CSA_DCAR CA_CARN -#define CSA_DEAD_BREVE CA_BREV -#define CSA_DBRV CA_BREV -#define CSA_BROKEN_PIPE CA_BRKP -#define CSA_BPIP CA_BRKP -#define CSA_COPYRIGHT CA_COPY -#define CSA_CPRT CA_COPY -#define CSA_LEFT_QUOTE CA_LSQU -#define CSA_LQOT CA_LSQU -#define CSA_RIGHT_QUOTE CA_RSQU -#define CSA_RQOT CA_RSQU -#define CSA_EIGHTH_NOTE CA_ENOT -#define CSA_8NOT CA_ENOT -#define CSA_ORDINAL_INDICATOR_O CA_MORD -#define CSA_ORDO CA_MORD -#define CSA_TIMES CA_MUL -#define CSA_TIMS CA_MUL -#define CSA_OBELUS CA_DIV -#define CSA_OBEL CA_DIV -#define CSA_DIVISION_SIGN CA_DIV -#define CSA_DVSN CA_DIV diff --git a/quantum/keymap_extras/keymap_colemak.h b/quantum/keymap_extras/keymap_colemak.h index a080f03b3d..6658cc1301 100644 --- a/quantum/keymap_extras/keymap_colemak.h +++ b/quantum/keymap_extras/keymap_colemak.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ F │ P │ G │ J │ L │ U │ Y │ ; │ [ │ ] │ \ │ + * │ │ Q │ W │ F │ P │ G │ J │ L │ U │ Y │ ; │ [ │ ] │ \ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ A │ R │ S │ T │ D │ H │ N │ E │ I │ O │ ' │ │ + * │ │ A │ R │ S │ T │ D │ H │ N │ E │ I │ O │ ' │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Z │ X │ C │ V │ B │ K │ M │ , │ . │ / │ │ + * │ │ Z │ X │ C │ V │ B │ K │ M │ , │ . │ / │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ : │ { │ } │ | │ + * │ │ │ │ │ │ │ │ │ │ │ : │ { │ } │ | │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ " │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ " │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -123,35 +123,3 @@ #define CM_LABK S(CM_COMM) // < #define CM_RABK S(CM_DOT) // > #define CM_QUES S(CM_SLSH) // / - -// DEPRECATED -#define KC_CM_Q CM_Q -#define KC_CM_W CM_W -#define KC_CM_F CM_F -#define KC_CM_P CM_P -#define KC_CM_G CM_G -#define KC_CM_J CM_J -#define KC_CM_L CM_L -#define KC_CM_U CM_U -#define KC_CM_Y CM_Y -#define KC_CM_SCLN CM_SCLN -#define KC_CM_A CM_A -#define KC_CM_R CM_R -#define KC_CM_S CM_S -#define KC_CM_T CM_T -#define KC_CM_D CM_D -#define KC_CM_H CM_H -#define KC_CM_N CM_N -#define KC_CM_E CM_E -#define KC_CM_I CM_I -#define KC_CM_O CM_O -#define KC_CM_Z CM_Z -#define KC_CM_X CM_X -#define KC_CM_C CM_C -#define KC_CM_V CM_V -#define KC_CM_B CM_B -#define KC_CM_K CM_K -#define KC_CM_M CM_M -#define KC_CM_COMM CM_COMM -#define KC_CM_DOT CM_DOT -#define KC_CM_SLSH CM_SLSH diff --git a/quantum/keymap_extras/keymap_croatian.h b/quantum/keymap_extras/keymap_croatian.h index 4af5dc5875..e67b99a9a2 100644 --- a/quantum/keymap_extras/keymap_croatian.h +++ b/quantum/keymap_extras/keymap_croatian.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ¸ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ + │ │ + * │ ¸ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ Š │ Đ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Č │ Ć │ Ž │ │ + * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ Š │ Đ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Č │ Ć │ Ž │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ¨ │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ * │ │ + * │ ¨ │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ * │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -121,15 +121,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ ~ │ ˇ │ ^ │ ˘ │ ° │ ˛ │ ` │ ˙ │ ´ │ ˝ │ │ │ │ + * │ │ ~ │ ˇ │ ^ │ ˘ │ ° │ ˛ │ ` │ ˙ │ ´ │ ˝ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ \ │ | │ € │ │ │ │ │ │ │ │ ÷ │ × │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ [ │ ] │ │ │ ł │ Ł │ │ ß │ ¤ │ │ + * │ │ \ │ | │ € │ │ │ │ │ │ │ │ ÷ │ × │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ [ │ ] │ │ │ ł │ Ł │ │ ß │ ¤ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ @ │ { │ } │ § │ │ │ │ │ + * │ │ │ │ │ │ @ │ { │ } │ § │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_czech.h b/quantum/keymap_extras/keymap_czech.h index 43ba2a14ff..2b1fb5da29 100644 --- a/quantum/keymap_extras/keymap_czech.h +++ b/quantum/keymap_extras/keymap_czech.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ; │ + │ ě │ š │ č │ ř │ ž │ ý │ á │ í │ é │ = │ ´ │ │ + * │ ; │ + │ ě │ š │ č │ ř │ ž │ ý │ á │ í │ é │ = │ ´ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ ú │ ) │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ů │ § │ ¨ │ │ + * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ ú │ ) │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ů │ § │ ¨ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ \ │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ \ │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ° │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ % │ ˇ │ │ + * │ ° │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ % │ ˇ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ / │ ( │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ " │ ! │ ' │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ / │ ( │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ " │ ! │ ' │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ | │ │ │ │ │ │ │ │ ? │ : │ _ │ │ + * │ │ | │ │ │ │ │ │ │ │ ? │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -128,15 +128,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ ~ │ │ ^ │ ˘ │ │ ˛ │ ` │ ˙ │ │ ˝ │ │ ¸ │ │ + * │ │ ~ │ │ ^ │ ˘ │ │ ˛ │ ` │ ˙ │ │ ˝ │ │ ¸ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ € │ │ │ │ │ │ │ │ ÷ │ × │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ đ │ Đ │ [ │ ] │ │ │ ł │ Ł │ $ │ ß │ ¤ │ │ + * │ │ │ │ € │ │ │ │ │ │ │ │ ÷ │ × │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ đ │ Đ │ [ │ ] │ │ │ ł │ Ł │ $ │ ß │ ¤ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ # │ & │ @ │ { │ } │ │ < │ > │ * │ │ + * │ │ │ │ # │ & │ @ │ { │ } │ │ < │ > │ * │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_danish.h b/quantum/keymap_extras/keymap_danish.h index 618e42ccf1..9cf688d6f5 100644 --- a/quantum/keymap_extras/keymap_danish.h +++ b/quantum/keymap_extras/keymap_danish.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ½ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ ´ │ │ + * │ ½ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ ´ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Å │ ¨ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Æ │ Ø │ ' │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Å │ ¨ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Æ │ Ø │ ' │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ § │ ! │ " │ # │ ¤ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ + * │ § │ ! │ " │ # │ ¤ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ ^ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ^ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -125,15 +125,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ @ │ £ │ $ │ € │ │ { │ [ │ ] │ } │ │ | │ │ + * │ │ │ @ │ £ │ $ │ € │ │ { │ [ │ ] │ } │ │ | │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ ~ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ~ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ \ │ │ │ │ │ │ │ µ │ │ │ │ │ + * │ │ \ │ │ │ │ │ │ │ µ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_dvorak.h b/quantum/keymap_extras/keymap_dvorak.h index 43dea0ce4f..7aa112ebcc 100644 --- a/quantum/keymap_extras/keymap_dvorak.h +++ b/quantum/keymap_extras/keymap_dvorak.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ [ │ ] │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ [ │ ] │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ ' │ , │ . │ P │ Y │ F │ G │ C │ R │ L │ / │ = │ \ │ + * │ │ ' │ , │ . │ P │ Y │ F │ G │ C │ R │ L │ / │ = │ \ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ A │ O │ E │ U │ I │ D │ H │ T │ N │ S │ - │ │ + * │ │ A │ O │ E │ U │ I │ D │ H │ T │ N │ S │ - │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ ; │ Q │ J │ K │ X │ B │ M │ W │ V │ Z │ │ + * │ │ ; │ Q │ J │ K │ X │ B │ M │ W │ V │ Z │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ { │ } │ │ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ { │ } │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ " │ < │ > │ │ │ │ │ │ │ │ ? │ + │ | │ + * │ │ " │ < │ > │ │ │ │ │ │ │ │ ? │ + │ | │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ _ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ _ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ : │ │ │ │ │ │ │ │ │ │ │ + * │ │ : │ │ │ │ │ │ │ │ │ │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_dvorak_fr.h b/quantum/keymap_extras/keymap_dvorak_fr.h index 7bb5893d37..2dee8e32e7 100644 --- a/quantum/keymap_extras/keymap_dvorak_fr.h +++ b/quantum/keymap_extras/keymap_dvorak_fr.h @@ -30,15 +30,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ « │ » │ / │ - │ è │ \ │ ^ │ ( │ ` │ ) │ _ │ [ │ ] │ │ + * │ « │ » │ / │ - │ è │ \ │ ^ │ ( │ ` │ ) │ _ │ [ │ ] │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ : │ ' │ é │ G │ . │ H │ V │ C │ M │ K │ Z │ ¨ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ O │ A │ U │ E │ B │ F │ S │ T │ N │ D │ W │ ~ │ │ + * │ │ : │ ' │ é │ G │ . │ H │ V │ C │ M │ K │ Z │ ¨ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ O │ A │ U │ E │ B │ F │ S │ T │ N │ D │ W │ ~ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ à │ ; │ Q │ , │ I │ Y │ X │ R │ L │ P │ J │ │ + * │ │ à │ ; │ Q │ , │ I │ Y │ X │ R │ L │ P │ J │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -96,15 +96,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ * │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 0 │ 0 │ + │ % │ │ + * │ * │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 0 │ 0 │ + │ % │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ ? │ < │ > │ │ ! │ │ │ │ │ │ │ = │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ # │ │ + * │ │ ? │ < │ > │ │ ! │ │ │ │ │ │ │ = │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ # │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ ç │ | │ │ @ │ │ │ │ │ │ │ │ │ + * │ │ ç │ | │ │ @ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_dvp.h b/quantum/keymap_extras/keymap_dvp.h index 99c69a4af5..6de7033cb4 100644 --- a/quantum/keymap_extras/keymap_dvp.h +++ b/quantum/keymap_extras/keymap_dvp.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ $ │ & │ [ │ { │ } │ ( │ = │ * │ ) │ + │ ] │ ! │ # │ │ + * │ $ │ & │ [ │ { │ } │ ( │ = │ * │ ) │ + │ ] │ ! │ # │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ ; │ , │ . │ P │ Y │ F │ G │ C │ R │ L │ / │ @ │ \ │ + * │ │ ; │ , │ . │ P │ Y │ F │ G │ C │ R │ L │ / │ @ │ \ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ A │ O │ E │ U │ I │ D │ H │ T │ N │ S │ - │ │ + * │ │ A │ O │ E │ U │ I │ D │ H │ T │ N │ S │ - │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ ' │ Q │ J │ K │ X │ B │ M │ W │ V │ Z │ │ + * │ │ ' │ Q │ J │ K │ X │ B │ M │ W │ V │ Z │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ % │ 7 │ 5 │ 3 │ 1 │ 9 │ 0 │ 2 │ 4 │ 6 │ 8 │ ` │ │ + * │ ~ │ % │ 7 │ 5 │ 3 │ 1 │ 9 │ 0 │ 2 │ 4 │ 6 │ 8 │ ` │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ : │ < │ > │ │ │ │ │ │ │ │ ? │ ^ │ | │ + * │ │ : │ < │ > │ │ │ │ │ │ │ │ ? │ ^ │ | │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ _ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ _ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ " │ │ │ │ │ │ │ │ │ │ │ + * │ │ " │ │ │ │ │ │ │ │ │ │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_estonian.h b/quantum/keymap_extras/keymap_estonian.h index e806c51fed..6951baed5a 100644 --- a/quantum/keymap_extras/keymap_estonian.h +++ b/quantum/keymap_extras/keymap_estonian.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ˇ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ ´ │ │ + * │ ˇ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ ´ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Ü │ Õ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ ' │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Ü │ Õ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ ' │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ " │ # │ ¤ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ + * │ ~ │ ! │ " │ # │ ¤ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -123,15 +123,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ @ │ £ │ $ │ € │ │ { │ [ │ ] │ } │ \ │ │ │ + * │ │ │ @ │ £ │ $ │ € │ │ { │ [ │ ] │ } │ \ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ § │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ š │ │ │ │ │ │ │ │ │ ^ │ ½ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ § │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ š │ │ │ │ │ │ │ │ │ ^ │ ½ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ | │ ž │ │ │ │ │ │ │ │ │ │ │ + * │ │ | │ ž │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_finnish.h b/quantum/keymap_extras/keymap_finnish.h index 81a8027ff4..faca4e01d4 100644 --- a/quantum/keymap_extras/keymap_finnish.h +++ b/quantum/keymap_extras/keymap_finnish.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ § │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ ´ │ │ + * │ § │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ ´ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Å │ ¨ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ ' │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Å │ ¨ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ ' │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ½ │ ! │ " │ # │ ¤ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ + * │ ½ │ ! │ " │ # │ ¤ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ ^ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ^ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -125,15 +125,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ @ │ £ │ $ │ € │ │ { │ [ │ ] │ } │ \ │ │ │ + * │ │ │ @ │ £ │ $ │ € │ │ { │ [ │ ] │ } │ \ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ ~ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ~ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ | │ │ │ │ │ │ │ µ │ │ │ │ │ + * │ │ | │ │ │ │ │ │ │ µ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_fr_ch.h b/quantum/keymap_extras/keymap_fr_ch.h index 783880c113..b1f2455a68 100644 --- a/quantum/keymap_extras/keymap_fr_ch.h +++ b/quantum/keymap_extras/keymap_fr_ch.h @@ -27,15 +27,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ § │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ^ │ │ + * │ § │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ^ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ è │ ¨ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ é │ à │ $ │ │ + * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ è │ ¨ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ é │ à │ $ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -93,15 +93,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ° │ + │ " │ * │ ç │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ + * │ ° │ + │ " │ * │ ç │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ ü │ ! │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ ö │ ä │ £ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ü │ ! │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ ö │ ä │ £ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -133,15 +133,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ ¦ │ @ │ # │ │ │ ¬ │ | │ ¢ │ │ │ ´ │ ~ │ │ + * │ │ ¦ │ @ │ # │ │ │ ¬ │ | │ ¢ │ │ │ ´ │ ~ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ € │ │ │ │ │ │ │ │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ + * │ │ │ │ € │ │ │ │ │ │ │ │ [ │ ] │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ \ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ \ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -162,82 +162,3 @@ #define CH_RCBR ALGR(CH_DLR) // } // Row 4 #define CH_BSLS ALGR(CH_LABK) // (backslash) - -// DEPRECATED -#define FR_CH_Z CH_Z -#define FR_CH_Y CH_Y -#define FR_CH_A CH_A -#define FR_CH_B CH_B -#define FR_CH_C CH_C -#define FR_CH_D CH_D -#define FR_CH_E CH_E -#define FR_CH_F CH_F -#define FR_CH_G CH_G -#define FR_CH_H CH_H -#define FR_CH_I CH_I -#define FR_CH_J CH_J -#define FR_CH_K CH_K -#define FR_CH_L CH_L -#define FR_CH_M CH_M -#define FR_CH_N CH_N -#define FR_CH_O CH_O -#define FR_CH_P CH_P -#define FR_CH_Q CH_Q -#define FR_CH_R CH_R -#define FR_CH_S CH_S -#define FR_CH_T CH_T -#define FR_CH_U CH_U -#define FR_CH_V CH_V -#define FR_CH_W CH_W -#define FR_CH_X CH_X -#define FR_CH_0 CH_0 -#define FR_CH_1 CH_1 -#define FR_CH_2 CH_2 -#define FR_CH_3 CH_3 -#define FR_CH_4 CH_4 -#define FR_CH_5 CH_5 -#define FR_CH_6 CH_6 -#define FR_CH_7 CH_7 -#define FR_CH_8 CH_8 -#define FR_CH_9 CH_9 -#define FR_CH_DOT CH_DOT -#define FR_CH_COMM CH_COMM -#define FR_CH_QUOT CH_QUOT -#define FR_CH_AE CH_AGRV -#define FR_CH_UE CH_EGRV -#define FR_CH_OE CH_EACU -#define FR_CH_CIRC CH_CIRC -#define FR_CH_LESS CH_LABK -#define FR_CH_MINS CH_MINS -#define FR_CH_DLR CH_DLR -#define FR_CH_PARA CH_SECT -#define FR_CH_DIAE CH_DIAE -#define FR_CH_RING CH_DEG -#define FR_CH_EXLM CH_EXLM -#define FR_CH_PLUS CH_PLUS -#define FR_CH_DQOT CH_DQUO -#define FR_CH_ASTR CH_ASTR -#define FR_CH_PERC CH_PERC -#define FR_CH_AMPR CH_AMPR -#define FR_CH_SLSH CH_SLSH -#define FR_CH_LPRN CH_LPRN -#define FR_CH_RPRN CH_RPRN -#define FR_CH_EQL CH_EQL -#define FR_CH_QST CH_QUES -#define FR_CH_MORE CH_RABK -#define FR_CH_COLN CH_COLN -#define FR_CH_SCLN CH_SCLN -#define FR_CH_UNDS CH_UNDS -#define FR_CH_CCED CH_CCED -#define FR_CH_GRV CH_GRV -#define FR_CH_LCBR CH_LCBR -#define FR_CH_LBRC CH_LBRC -#define FR_CH_RBRC CH_RBRC -#define FR_CH_RCBR CH_RCBR -#define FR_CH_BSLS CH_BSLS -#define FR_CH_AT CH_AT -#define FR_CH_EURO CH_EURO -#define FR_CH_TILD CH_TILD -#define FR_CH_PIPE CH_PIPE -#define FR_CH_HASH CH_HASH -#define FR_CH_ACUT CH_ACUT diff --git a/quantum/keymap_extras/keymap_french.h b/quantum/keymap_extras/keymap_french.h index 7256c50022..0be53f0a9c 100644 --- a/quantum/keymap_extras/keymap_french.h +++ b/quantum/keymap_extras/keymap_french.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ² │ & │ é │ " │ ' │ ( │ - │ è │ _ │ ç │ à │ ) │ = │ │ + * │ ² │ & │ é │ " │ ' │ ( │ - │ è │ _ │ ç │ à │ ) │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ A │ Z │ E │ R │ T │ Y │ U │ I │ O │ P │ ^ │ $ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Q │ S │ D │ F │ G │ H │ J │ K │ L │ M │ ù │ * │ │ + * │ │ A │ Z │ E │ R │ T │ Y │ U │ I │ O │ P │ ^ │ $ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Q │ S │ D │ F │ G │ H │ J │ K │ L │ M │ ù │ * │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ W │ X │ C │ V │ B │ N │ , │ ; │ : │ ! │ │ + * │ │ < │ W │ X │ C │ V │ B │ N │ , │ ; │ : │ ! │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ° │ + │ │ + * │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ° │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ £ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ % │ µ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ £ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ % │ µ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ ? │ . │ / │ § │ │ + * │ │ > │ │ │ │ │ │ │ ? │ . │ / │ § │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -127,15 +127,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ ~ │ # │ { │ [ │ | │ ` │ \ │ │ @ │ ] │ } │ │ + * │ │ │ ~ │ # │ { │ [ │ | │ ` │ \ │ │ @ │ ] │ } │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ € │ │ │ │ │ │ │ │ │ ¤ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ € │ │ │ │ │ │ │ │ │ ¤ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -152,14 +152,3 @@ // Row 2 #define FR_EURO ALGR(KC_E) // € #define FR_CURR ALGR(FR_DLR) // ¤ - -// DEPRECATED -#define FR_AMP FR_AMPR -#define FR_APOS FR_QUOT -#define FR_LESS FR_LABK -#define FR_OVRR FR_DEG -#define FR_UMLT FR_DIAE -#define FR_MU FR_MICR -#define FR_GRTR FR_RABK -#define FR_CCIRC FR_CIRC -#define FR_BULT FR_CURR diff --git a/quantum/keymap_extras/keymap_french_afnor.h b/quantum/keymap_extras/keymap_french_afnor.h index be67fdc952..4b7961724f 100644 --- a/quantum/keymap_extras/keymap_french_afnor.h +++ b/quantum/keymap_extras/keymap_french_afnor.h @@ -19,10 +19,10 @@ * A standard for the French keyboard * * The project was launched at the end of 2015 on the proposal of the General - * Delegation for the French language and the languages of France (Ministry + * Delegation for the French language and the languages of France (Ministry * of Culture), starting from the observation that the current "azerty" * keyboards constrain the writing of French, languages regional and European - * languages with Latin alphabet. + * languages with Latin alphabet. * * For the first time, a standard (NF Z71-300) defines the placement of * characters on the French keyboard. It offers two layouts, one of which @@ -46,15 +46,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ @ │ à │ é │ è │ ê │ ( │ ) │ ‘ │ ’ │ « │ » │ ' │ ^ │ │ + * │ @ │ à │ é │ è │ ê │ ( │ ) │ ‘ │ ’ │ « │ » │ ' │ ^ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ A │ Z │ E │ R │ T │ Y │ U │ I │ O │ P │ - │ + │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Q │ S │ D │ F │ G │ H │ J │ K │ L │ M │ / │ * │ │ + * │ │ A │ Z │ E │ R │ T │ Y │ U │ I │ O │ P │ - │ + │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Q │ S │ D │ F │ G │ H │ J │ K │ L │ M │ / │ * │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ W │ X │ C │ V │ B │ N │ . │ , │ : │ ; │ │ + * │ │ < │ W │ X │ C │ V │ B │ N │ . │ , │ : │ ; │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -112,15 +112,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ # │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ " │ ¨ │ │ + * │ # │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ " │ ¨ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ – │ ± │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ \ │ ½ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ – │ ± │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ \ │ ½ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ ? │ ! │ … │ = │ │ + * │ │ > │ │ │ │ │ │ │ ? │ ! │ … │ = │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -152,15 +152,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ˘ │ § │ ´ │ ` │ & │ [ │ ] │ ¯ │ _ │ “ │ ” │ ° │ ˇ │ │ + * │ ˘ │ § │ ´ │ ` │ & │ [ │ ] │ ¯ │ _ │ “ │ ” │ ° │ ˇ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ æ │ £ │ € │ ® │ { │ } │ ù │ ˙ │ œ │ % │ − │ † │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ θ │ ß │ $ │ ¤ │ µ │ Eu│ │ ∕ │ | │ ∞ │ ÷ │ × │ │ + * │ │ æ │ £ │ € │ ® │ { │ } │ ù │ ˙ │ œ │ % │ − │ † │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ θ │ ß │ $ │ ¤ │ µ │ Eu│ │ ∕ │ | │ ∞ │ ÷ │ × │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ ≤ │ ʒ │ © │ ç │ ¸ │ − │ ~ │ ¿ │ ¡ │ · │ ≃ │ │ + * │ │ ≤ │ ʒ │ © │ ç │ ¸ │ − │ ~ │ ¿ │ ¡ │ · │ ≃ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -217,28 +217,28 @@ /* Shift+AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ̑ │ │ │ │ │ ˝ │ ̏ │ │ — │ ‹ │ › │ ˚ │ │ │ + * │ ̑ │ │ │ │ │ ˝ │ ̏ │ │ — │ ‹ │ › │ ˚ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ ™ │ │ │ ̣ │ │ ‰ │ ‑ │ ‡ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ ˍ │ │ │ │ │ √ │ ¼ │ │ + * │ │ │ │ │ │ ™ │ │ │ ̣ │ │ ‰ │ ‑ │ ‡ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ ˍ │ │ │ │ │ √ │ ¼ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ ≥ │ │ │ │ ˛ │ │ │ │ ̦ │ │ ≠ │ │ + * │ │ ≥ │ │ │ │ ˛ │ │ │ │ ̦ │ │ ≠ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 -#define FR_IBRV S(ALGR(FR_AT)) // ̑ (dead) +#define FR_IBRV S(ALGR(FR_AT)) // ̑ (dead) #define FR_DACU S(ALGR(FR_LPRN)) // ˝ (dead) -#define FR_DGRV S(ALGR(FR_RPRN)) // ̏ (dead) +#define FR_DGRV S(ALGR(FR_RPRN)) // ̏ (dead) #define FR_MDSH S(ALGR(FR_RSQU)) // — #define FR_LSAQ S(ALGR(FR_LDAQ)) // ‹ #define FR_RSAQ S(ALGR(FR_RDAQ)) // › #define FR_RNGA S(ALGR(FR_QUOT)) // ˚ (dead) // Row 2 #define FR_TM S(ALGR(FR_T)) // ™ -#define FR_DOTB S(ALGR(FR_I)) // ̣ (dead) +#define FR_DOTB S(ALGR(FR_I)) // ̣ (dead) #define FR_PERM S(ALGR(FR_P)) // ‰ #define FR_NBHY S(ALGR(FR_MINS)) // ‑ (non-breaking hyphen) #define FR_DDAG S(ALGR(FR_PLUS)) // ‡ @@ -249,5 +249,5 @@ // Row 4 #define FR_GEQL S(ALGR(FR_LABK)) // ≥ #define FR_OGON S(ALGR(FR_V)) // ˛ (dead) -#define FR_DCMM S(ALGR(FR_COMM)) // ̦ (dead) +#define FR_DCMM S(ALGR(FR_COMM)) // ̦ (dead) #define FR_NEQL S(ALGR(FR_SCLN)) // ≠ diff --git a/quantum/keymap_extras/keymap_french_osx.h b/quantum/keymap_extras/keymap_french_osx.h index de8dd756a1..590a57e55c 100644 --- a/quantum/keymap_extras/keymap_french_osx.h +++ b/quantum/keymap_extras/keymap_french_osx.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ @ │ & │ é │ " │ ' │ ( │ § │ è │ ! │ ç │ à │ ) │ - │ │ + * │ @ │ & │ é │ " │ ' │ ( │ § │ è │ ! │ ç │ à │ ) │ - │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ A │ Z │ E │ R │ T │ Y │ U │ I │ O │ P │ ^ │ $ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Q │ S │ D │ F │ G │ H │ J │ K │ L │ M │ ù │ ` │ │ + * │ │ A │ Z │ E │ R │ T │ Y │ U │ I │ O │ P │ ^ │ $ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Q │ S │ D │ F │ G │ H │ J │ K │ L │ M │ ù │ ` │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ < │ W │ X │ C │ V │ B │ N │ , │ ; │ : │ = │ │ + * │ │ < │ W │ X │ C │ V │ B │ N │ , │ ; │ : │ = │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ # │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ° │ _ │ │ + * │ # │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ° │ _ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ * │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ % │ £ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ * │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ % │ £ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ > │ │ │ │ │ │ │ ? │ . │ / │ + │ │ + * │ │ > │ │ │ │ │ │ │ ? │ . │ / │ + │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -128,15 +128,15 @@ /* Alted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ • │ │ ë │ “ │ ‘ │ { │ ¶ │ « │ ¡ │ Ç │ Ø │ } │ — │ │ + * │ • │ │ ë │ “ │ ‘ │ { │ ¶ │ « │ ¡ │ Ç │ Ø │ } │ — │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ Æ │  │ Ê │ ® │ † │ Ú │ º │ î │ Œ │ π │ Ô │ € │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ ‡ │ Ò │ ∂ │ ƒ │ fi │ Ì │ Ï │ È │ ¬ │ µ │ Ù │ │ │ + * │ │ Æ │  │ Ê │ ® │ † │ Ú │ º │ î │ Œ │ π │ Ô │ € │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ ‡ │ Ò │ ∂ │ ƒ │ fi │ Ì │ Ï │ È │ ¬ │ µ │ Ù │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ ≤ │ ‹ │ ≈ │ © │ ◊ │ ß │ ~ │ ∞ │ … │ ÷ │ ≠ │ │ + * │ │ ≤ │ ‹ │ ≈ │ © │ ◊ │ ß │ ~ │ ∞ │ … │ ÷ │ ≠ │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -193,15 +193,15 @@ /* Shift+Alted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ Ÿ │ ´ │ „ │ │ │ [ │ å │ » │ Û │ Á │ │ ] │ – │ │ + * │ Ÿ │ ´ │ „ │ │ │ [ │ å │ » │ Û │ Á │ │ ] │ – │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ │ Å │ │ ‚ │ ™ │ │ ª │ ï │ │ ∏ │ │ ¥ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Ω │ ∑ │ ∆ │ · │ fl │ Î │ Í │ Ë │ | │ Ó │ ‰ │ │ │ + * │ │ │ Å │ │ ‚ │ ™ │ │ ª │ ï │ │ ∏ │ │ ¥ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Ω │ ∑ │ ∆ │ · │ fl │ Î │ Í │ Ë │ | │ Ó │ ‰ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ ≥ │ › │ ⁄ │ ¢ │ √ │ ∫ │ ı │ ¿ │ │ \ │ ± │ │ + * │ │ ≥ │ › │ ⁄ │ ¢ │ √ │ ∫ │ ı │ ¿ │ │ \ │ ± │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -246,15 +246,3 @@ #define FR_IQUE S(A(FR_COMM)) // ¿ #define FR_BSLS S(A(FR_COLN)) // (backslash) #define FR_PLMN S(A(FR_EQL)) // ± - -// DEPRECATED -#define FR_AMP FR_AMPR -#define FR_EACU FR_LEAC -#define FR_APOS FR_QUOT -#define FR_EGRV FR_LEGR -#define FR_CCED FR_LCCE -#define FR_AGRV FR_LAGR -#define FR_UGRV FR_LUGR -#define FR_LESS FR_LABK -#define FR_UMLT FR_DIAE -#define FR_GRTR FR_RABK diff --git a/quantum/keymap_extras/keymap_german.h b/quantum/keymap_extras/keymap_german.h index 59198dd1be..085995b0c6 100644 --- a/quantum/keymap_extras/keymap_german.h +++ b/quantum/keymap_extras/keymap_german.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ^ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ß │ ´ │ │ + * │ ^ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ß │ ´ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ Ü │ + │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ # │ │ + * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ Ü │ + │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ # │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ° │ ! │ " │ § │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ + * │ ° │ ! │ " │ § │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ ' │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ' │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -125,15 +125,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ ² │ ³ │ │ │ │ { │ [ │ ] │ } │ \ │ │ │ + * │ │ │ ² │ ³ │ │ │ │ { │ [ │ ] │ } │ \ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ @ │ │ € │ │ │ │ │ │ │ │ │ ~ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ @ │ │ € │ │ │ │ │ │ │ │ │ ~ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ | │ │ │ │ │ │ │ µ │ │ │ │ │ + * │ │ | │ │ │ │ │ │ │ µ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -151,16 +151,3 @@ // Row 4 #define DE_PIPE ALGR(DE_LABK) // | #define DE_MICR ALGR(DE_M) // µ - -// DEPRECATED -#define DE_UE DE_UDIA -#define DE_OE DE_ODIA -#define DE_AE DE_ADIA -#define DE_LESS DE_LABK -#define DE_RING DE_DEG -#define DE_DQOT DE_DQUO -#define DE_PARA DE_SECT -#define DE_QST DE_QUES -#define DE_MORE DE_RABK -#define DE_SQ2 DE_SUP2 -#define DE_SQ3 DE_SUP3 diff --git a/quantum/keymap_extras/keymap_german_ch.h b/quantum/keymap_extras/keymap_german_ch.h index 07f4503a14..6723836870 100644 --- a/quantum/keymap_extras/keymap_german_ch.h +++ b/quantum/keymap_extras/keymap_german_ch.h @@ -27,15 +27,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ § │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ^ │ │ + * │ § │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ^ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ ü │ ¨ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ö │ ä │ $ │ │ + * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ ü │ ¨ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ö │ ä │ $ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -93,15 +93,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ° │ + │ " │ * │ ç │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ + * │ ° │ + │ " │ * │ ç │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ è │ ! │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ é │ à │ £ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ è │ ! │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ é │ à │ £ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -133,15 +133,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ ¦ │ @ │ # │ │ │ ¬ │ | │ ¢ │ │ │ ´ │ ~ │ │ + * │ │ ¦ │ @ │ # │ │ │ ¬ │ | │ ¢ │ │ │ ´ │ ~ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ € │ │ │ │ │ │ │ │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ + * │ │ │ │ € │ │ │ │ │ │ │ │ [ │ ] │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ \ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ \ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -162,21 +162,3 @@ #define CH_RCBR ALGR(CH_DLR) // } // Row 4 #define CH_BSLS ALGR(CH_LABK) // (backslash) - -// DEPRECATED -#define CH_AE CH_ADIA -#define CH_UE CH_UDIA -#define CH_OE CH_ODIA -#define CH_PARA CH_SECT -#define CH_CARR CH_CIRC -#define CH_DIER CH_DIAE -#define CH_LESS CH_LABK -#define CH_RING CH_DEG -#define CH_DQOT CH_DQUO -#define CH_PAST CH_ASTR -#define CH_CELA CH_CCED -#define CH_QST CH_QUES -#define CH_POND CH_PND -#define CH_MORE CH_RABK -#define CH_BRBR CH_BRKP -#define CH_NOTL CH_NOT diff --git a/quantum/keymap_extras/keymap_german_osx.h b/quantum/keymap_extras/keymap_german_osx.h index 0d15532e40..82404fa5fd 100644 --- a/quantum/keymap_extras/keymap_german_osx.h +++ b/quantum/keymap_extras/keymap_german_osx.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ ^ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ß │ ´ │ │ + * │ ^ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ß │ ´ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ Ü │ + │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ # │ │ + * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ Ü │ + │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ # │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ ° │ ! │ " │ § │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ + * │ ° │ ! │ " │ § │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ ' │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ' │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -125,15 +125,15 @@ /* Alted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ „ │ ¡ │ “ │ ¶ │ ¢ │ [ │ ] │ | │ { │ } │ ≠ │ ¿ │ │ │ + * │ „ │ ¡ │ “ │ ¶ │ ¢ │ [ │ ] │ | │ { │ } │ ≠ │ ¿ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ « │ ∑ │ € │ ® │ † │ Ω │ ¨ │ ⁄ │ Ø │ π │ • │ ± │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Å │ ‚ │ ∂ │ ƒ │ © │ ª │ º │ ∆ │ @ │ Œ │ Æ │ ‘ │ │ + * │ │ « │ ∑ │ € │ ® │ † │ Ω │ ¨ │ ⁄ │ Ø │ π │ • │ ± │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Å │ ‚ │ ∂ │ ƒ │ © │ ª │ º │ ∆ │ @ │ Œ │ Æ │ ‘ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ ≤ │ ¥ │ ≈ │ Ç │ √ │ ∫ │ ~ │ µ │ ∞ │ … │ – │ │ + * │ │ ≤ │ ¥ │ ≈ │ Ç │ √ │ ∫ │ ~ │ µ │ ∞ │ … │ – │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -190,15 +190,15 @@ /* Shift+Alted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ │ ¬ │ ” │ │ £ │ fi │ │ \ │ ˜ │ · │ ¯ │ ˙ │ ˚ │ │ + * │ │ ¬ │ ” │ │ £ │ fi │ │ \ │ ˜ │ · │ ¯ │ ˙ │ ˚ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ » │ │ ‰ │ ¸ │ ˝ │ ˇ │ Á │ Û │ │ ∏ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ Í │ ™ │ Ï │ Ì │ Ó │ ı │ │ fl │ │ │ │ │ + * │ │ » │ │ ‰ │ ¸ │ ˝ │ ˇ │ Á │ Û │ │ ∏ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ Í │ ™ │ Ï │ Ì │ Ó │ ı │ │ fl │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ ≥ │ ‡ │ Ù │ │ ◊ │ ‹ │ › │ ˘ │ ˛ │ ÷ │ — │ │ + * │ │ ≥ │ ‡ │ Ù │ │ ◊ │ ‹ │ › │ ˘ │ ˛ │ ÷ │ — │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -241,83 +241,3 @@ #define DE_OGON S(A(DE_COMM)) // ˛ #define DE_DIV S(A(DE_DOT)) // ÷ #define DE_MDSH S(A(DE_MINS)) // — - -// DEPRECATED -#define DE_OSX_CIRC DE_CIRC -#define DE_OSX_1 DE_1 -#define DE_OSX_2 DE_2 -#define DE_OSX_3 DE_3 -#define DE_OSX_4 DE_4 -#define DE_OSX_5 DE_5 -#define DE_OSX_6 DE_6 -#define DE_OSX_7 DE_7 -#define DE_OSX_8 DE_8 -#define DE_OSX_9 DE_9 -#define DE_OSX_0 DE_0 -#define DE_OSX_SS DE_SS -#define DE_OSX_ACUT DE_ACUT -#define DE_OSX_Q DE_Q -#define DE_OSX_W DE_W -#define DE_OSX_E DE_E -#define DE_OSX_R DE_R -#define DE_OSX_T DE_T -#define DE_OSX_Z DE_Z -#define DE_OSX_U DE_U -#define DE_OSX_I DE_I -#define DE_OSX_O DE_O -#define DE_OSX_P DE_P -#define DE_OSX_UE DE_UDIA -#define DE_OSX_PLUS DE_PLUS -#define DE_OSX_A DE_A -#define DE_OSX_S DE_S -#define DE_OSX_D DE_D -#define DE_OSX_F DE_F -#define DE_OSX_G DE_G -#define DE_OSX_H DE_H -#define DE_OSX_J DE_J -#define DE_OSX_K DE_K -#define DE_OSX_L DE_L -#define DE_OSX_OE DE_ODIA -#define DE_OSX_AE DE_ADIA -#define DE_OSX_HASH DE_HASH -#define DE_OSX_LESS DE_LABK -#define DE_OSX_Y DE_Y -#define DE_OSX_X DE_X -#define DE_OSX_C DE_C -#define DE_OSX_V DE_V -#define DE_OSX_B DE_B -#define DE_OSX_N DE_N -#define DE_OSX_M DE_M -#define DE_OSX_COMM DE_COMM -#define DE_OSX_DOT DE_DOT -#define DE_OSX_MINS DE_MINS - -#define DE_OSX_RING DE_DEG -#define DE_OSX_EXLM DE_EXLM -#define DE_OSX_DQOT DE_DQUO -#define DE_OSX_PARA DE_SECT -#define DE_OSX_DLR DE_DLR -#define DE_OSX_PERC DE_PERC -#define DE_OSX_AMPR DE_AMPR -#define DE_OSX_SLSH DE_SLSH -#define DE_OSX_LPRN DE_LPRN -#define DE_OSX_RPRN DE_RPRN -#define DE_OSX_EQL DE_EQL -#define DE_OSX_QST DE_QUES -#define DE_OSX_GRV DE_GRV -#define DE_OSX_ASTR DE_ASTR -#define DE_OSX_QUOT DE_QUOT -#define DE_OSX_MORE DE_RABK -#define DE_OSX_COLN DE_COLN -#define DE_OSX_SCLN DE_SCLN -#define DE_OSX_UNDS DE_UNDS - -#define DE_OSX_LBRC DE_LBRC -#define DE_OSX_RBRC DE_RBRC -#define DE_OSX_PIPE DE_PIPE -#define DE_OSX_LCBR DE_LCBR -#define DE_OSX_RCBR DE_RCBR -#define DE_OSX_AT DE_AT -#define DE_OSX_EURO DE_EURO -#define DE_OSX_TILD DE_TILD -#define DE_OSX_BSLS DE_BSLS diff --git a/quantum/keymap_extras/keymap_greek.h b/quantum/keymap_extras/keymap_greek.h index a2525959bc..8c23381204 100644 --- a/quantum/keymap_extras/keymap_greek.h +++ b/quantum/keymap_extras/keymap_greek.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ ; │ ς │ Ε │ Ρ │ Τ │ Υ │ Θ │ Ι │ Ο │ Π │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Α │ Σ │ Δ │ Φ │ Γ │ Η │ Ξ │ Κ │ Λ │ ΄ │ ' │ \ │ │ + * │ │ ; │ ς │ Ε │ Ρ │ Τ │ Υ │ Θ │ Ι │ Ο │ Π │ [ │ ] │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Α │ Σ │ Δ │ Φ │ Γ │ Η │ Ξ │ Κ │ Λ │ ΄ │ ' │ \ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ Ζ │ Χ │ Ψ │ Ω │ Β │ Ν │ Μ │ , │ . │ / │ │ + * │ │ │ Ζ │ Χ │ Ψ │ Ω │ Β │ Ν │ Μ │ , │ . │ / │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ : │ ΅ │ │ │ │ │ │ │ │ │ { │ } │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ ¨ │ " │ | │ │ + * │ │ : │ ΅ │ │ │ │ │ │ │ │ │ { │ } │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ ¨ │ " │ | │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -128,15 +128,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ ² │ ³ │ £ │ § │ ¶ │ │ ¤ │ ¦ │ ° │ ± │ ½ │ │ + * │ │ │ ² │ ³ │ £ │ § │ ¶ │ │ ¤ │ ¦ │ ° │ ± │ ½ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ € │ ® │ │ ¥ │ │ │ │ │ « │ » │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ ¬ │ │ + * │ │ │ │ € │ ® │ │ ¥ │ │ │ │ │ « │ » │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ¬ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ © │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ © │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_hebrew.h b/quantum/keymap_extras/keymap_hebrew.h index ea9ac5ed4c..87b488f04d 100644 --- a/quantum/keymap_extras/keymap_hebrew.h +++ b/quantum/keymap_extras/keymap_hebrew.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ; │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ; │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ / │ ' │ פ │ ם │ ן │ ו │ ט │ א │ ר │ ק │ ] │ [ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ ף │ ך │ ל │ ח │ י │ ע │ כ │ ג │ ד │ ש │ , │ \ │ │ + * │ │ / │ ' │ פ │ ם │ ן │ ו │ ט │ א │ ר │ ק │ ] │ [ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ ף │ ך │ ל │ ח │ י │ ע │ כ │ ג │ ד │ ש │ , │ \ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ ץ │ ת │ צ │ מ │ נ │ ה │ ב │ ס │ ז │ . │ │ + * │ │ │ ץ │ ת │ צ │ מ │ נ │ ה │ ב │ ס │ ז │ . │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ) │ ( │ _ │ + │ │ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ) │ ( │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ } │ { │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ : │ " │ | │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ } │ { │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ : │ " │ | │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ > │ < │ ? │ │ + * │ │ │ │ │ │ │ │ │ │ > │ < │ ? │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -126,15 +126,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ │ € │ ₪ │ ° │ │ │ × │ │ │ │ │ │ + * │ │ │ │ € │ ₪ │ ° │ │ │ × │ │ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ װ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ ײ │ ױ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ װ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ ײ │ ױ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ ÷ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ÷ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_hungarian.h b/quantum/keymap_extras/keymap_hungarian.h index d5c915d158..a4e4b1a522 100644 --- a/quantum/keymap_extras/keymap_hungarian.h +++ b/quantum/keymap_extras/keymap_hungarian.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ Ö │ Ü │ Ó │ │ + * │ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ Ö │ Ü │ Ó │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ Ő │ Ú │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ É │ Á │ Ű │ │ + * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ Ő │ Ú │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ É │ Á │ Ű │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ Í │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ Í │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ § │ ' │ " │ + │ ! │ % │ / │ = │ ( │ ) │ │ │ │ │ + * │ § │ ' │ " │ + │ ! │ % │ / │ = │ ( │ ) │ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ ? │ : │ _ │ │ + * │ │ │ │ │ │ │ │ │ │ ? │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -117,15 +117,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ ~ │ ˇ │ ^ │ ˘ │ ° │ ˛ │ ` │ ˙ │ ´ │ ˝ │ ¨ │ ¸ │ │ + * │ │ ~ │ ˇ │ ^ │ ˘ │ ° │ ˛ │ ` │ ˙ │ ´ │ ˝ │ ¨ │ ¸ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ \ │ | │ Ä │ │ │ │ € │ │ │ │ ÷ │ × │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ ä │ đ │ Đ │ [ │ ] │ │ │ ł │ Ł │ $ │ ß │ ¤ │ │ + * │ │ \ │ | │ Ä │ │ │ │ € │ │ │ │ ÷ │ × │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ ä │ đ │ Đ │ [ │ ] │ │ │ ł │ Ł │ $ │ ß │ ¤ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ > │ # │ & │ @ │ { │ } │ │ ; │ │ * │ │ + * │ │ < │ > │ # │ & │ @ │ { │ } │ │ ; │ │ * │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -169,22 +169,3 @@ #define HU_RCBR ALGR(HU_N) // } #define HU_SCLN ALGR(HU_COMM) // ; #define HU_ASTR ALGR(HU_MINS) // * - -// DEPRECATED -#define HU_OE HU_ODIA -#define HU_UE HU_UDIA -#define HU_OO HU_OACU -#define HU_OEE HU_ODAC -#define HU_UU HU_UACU -#define HU_EE HU_EACU -#define HU_AA HU_AACU -#define HU_UEE HU_UDAC -#define HU_II HU_IACU -#define HU_PARA HU_SECT -#define HU_DQOT HU_DQUO -#define HU_QST HU_QUES -#define HU_BRV HU_BREV -#define HU_RING HU_RNGA -#define HU_CRSS HU_MUL -#define HU_LESS HU_LABK -#define HU_MORE HU_RABK diff --git a/quantum/keymap_extras/keymap_icelandic.h b/quantum/keymap_extras/keymap_icelandic.h index 2ccb4b543c..43e4a6e872 100644 --- a/quantum/keymap_extras/keymap_icelandic.h +++ b/quantum/keymap_extras/keymap_icelandic.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ° │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ Ö │ - │ │ + * │ ° │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ Ö │ - │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Ð │ ' │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Æ │ ´ │ + │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Ð │ ' │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Æ │ ´ │ + │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ Þ │ │ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ Þ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ¨ │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ │ _ │ │ + * │ ¨ │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ │ _ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ ? │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ? │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -123,15 +123,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ° │ │ │ │ │ │ │ { │ [ │ ] │ } │ \ │ │ │ + * │ ° │ │ │ │ │ │ │ { │ [ │ ] │ } │ \ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ @ │ │ € │ │ │ │ │ │ │ │ │ ~ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ ^ │ ` │ │ + * │ │ @ │ │ € │ │ │ │ │ │ │ │ │ ~ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ^ │ ` │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ | │ │ │ │ │ │ │ µ │ │ │ │ │ + * │ │ | │ │ │ │ │ │ │ µ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_irish.h b/quantum/keymap_extras/keymap_irish.h index 6825d4311f..73a4c8028d 100644 --- a/quantum/keymap_extras/keymap_irish.h +++ b/quantum/keymap_extras/keymap_irish.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ # │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ # │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ + * │ │ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ¬ │ ! │ " │ £ │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ¬ │ ! │ " │ £ │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ : │ @ │ ~ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ : │ @ │ ~ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ | │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ | │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -128,15 +128,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ¦ │ │ │ │ € │ │ │ │ │ │ │ │ │ │ + * │ ¦ │ │ │ │ € │ │ │ │ │ │ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ É │ │ │ │ Ú │ Í │ Ó │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Á │ │ │ │ │ │ │ │ │ │ ´ │ │ │ + * │ │ │ │ É │ │ │ │ Ú │ Í │ Ó │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Á │ │ │ │ │ │ │ │ │ │ ´ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_italian.h b/quantum/keymap_extras/keymap_italian.h index 616b6dfce9..be495f85ba 100644 --- a/quantum/keymap_extras/keymap_italian.h +++ b/quantum/keymap_extras/keymap_italian.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ \ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ì │ │ + * │ \ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ì │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ è │ + │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ò │ à │ ù │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ è │ + │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ò │ à │ ù │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ | │ ! │ " │ £ │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ^ │ │ + * │ | │ ! │ " │ £ │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ^ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ é │ * │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ ç │ ° │ § │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ é │ * │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ ç │ ° │ § │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -128,15 +128,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ € │ │ │ │ │ │ │ │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ @ │ # │ │ │ + * │ │ │ │ € │ │ │ │ │ │ │ │ [ │ ] │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ @ │ # │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 2 @@ -149,36 +149,17 @@ /* Shift+AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 2 #define IT_LCBR S(ALGR(IT_EGRV)) // { #define IT_RCBR S(ALGR(IT_PLUS)) // } - -// DEPRECATED -#define IT_BKSL IT_BSLS -#define IT_APOS IT_QUOT -#define IT_IACC IT_IGRV -#define IT_EACC IT_EGRV -#define IT_OACC IT_OGRV -#define IT_AACC IT_AGRV -#define IT_UACC IT_UGRV -#define IT_LESS IT_LABK -#define IT_DQOT IT_DQUO -#define IT_STRL IT_PND -#define IT_QST IT_QUES -#define IT_CRC IT_CIRC -#define IT_MORE IT_RABK -#define IT_SHRP IT_HASH - -#define IT_X_PLUS X_RBRACKET -#define IT_ACUT diff --git a/quantum/keymap_extras/keymap_italian_osx_ansi.h b/quantum/keymap_extras/keymap_italian_osx_ansi.h index 1f7fe8afc9..c2b8e3cad6 100644 --- a/quantum/keymap_extras/keymap_italian_osx_ansi.h +++ b/quantum/keymap_extras/keymap_italian_osx_ansi.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ < │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ì │ │ + * │ < │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ì │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ è │ + │ ù │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ è │ + │ ù │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ò │ à │ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ò │ à │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴──────┤ - * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├─────┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ > │ ! │ " │ £ │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ^ │ │ + * │ > │ ! │ " │ £ │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ^ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ │ │ │ │ │ │ │ │ │ │ é │ * │ § │ + * │ │ │ │ │ │ │ │ │ │ │ │ é │ * │ § │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤ - * │ │ │ │ │ │ │ │ │ │ │ ç │ ° │ │ + * │ │ │ │ │ │ │ │ │ │ │ ç │ ° │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴──────┤ - * │ │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├─────┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -128,15 +128,15 @@ /* Alted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ ≤ │ « │ “ │ ‘ │ ¥ │ ~ │ ‹ │ ÷ │ ´ │ ` │ ≠ │ ¡ │ ˆ │ │ + * │ ≤ │ « │ “ │ ‘ │ ¥ │ ~ │ ‹ │ ÷ │ ´ │ ` │ ≠ │ ¡ │ ˆ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ „ │ Ω │ € │ ® │ ™ │ Æ │ ¨ │ Œ │ Ø │ π │ [ │ ] │ ¶ │ + * │ │ „ │ Ω │ € │ ® │ ™ │ Æ │ ¨ │ Œ │ Ø │ π │ [ │ ] │ ¶ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤ - * │ │ Å │ ß │ ∂ │ ƒ │ ∞ │ ∆ │ ª │ º │ ¬ │ @ │ # │ │ + * │ │ Å │ ß │ ∂ │ ƒ │ ∞ │ ∆ │ ª │ º │ ¬ │ @ │ # │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴──────┤ - * │ │ ∑ │ † │ © │ √ │ ∫ │ ˜ │ µ │ … │ • │ – │ │ + * │ │ ∑ │ † │ © │ √ │ ∫ │ ˜ │ µ │ … │ • │ – │ │ * ├─────┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -194,15 +194,15 @@ /* Shift+Alted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ ≥ │ » │ ” │ ’ │ ¢ │ ‰ │ › │ ⁄ │ │ │ ≈ │ ¿ │ ± │ │ + * │ ≥ │ » │ ” │ ’ │ ¢ │ ‰ │ › │ ⁄ │ │ │ ≈ │ ¿ │ ± │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ ‚ │ À │ È │ Ì │ Ò │ │ Ù │ │ │ ∏ │ { │ } │ ◊ │ + * │ │ ‚ │ À │ È │ Ì │ Ò │ │ Ù │ │ │ ∏ │ { │ } │ ◊ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤ - * │ │ │ ¯ │ ˘ │ ˙ │ ˚ │ ¸ │ ˝ │ ˛ │ ˇ │ Ç │ ∞ │ │ + * │ │ │ ¯ │ ˘ │ ˙ │ ˚ │ ¸ │ ˝ │ ˛ │ ˇ │ Ç │ ∞ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴──────┤ - * │ │ │ ‡ │ Á │ É │ Í │ Ó │ Ú │ │ · │ — │ │ + * │ │ │ ‡ │ Á │ É │ Í │ Ó │ Ú │ │ · │ — │ │ * ├─────┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -248,21 +248,3 @@ #define IT_CUAC S(A(IT_M)) // Ú #define IT_MDDT S(A(IT_DOT)) // · #define IT_MDSH S(A(IT_MINS)) // — - -// DEPRECATED -#define IT_LESS IT_LABK -#define IT_APOS IT_QUOT -#define IT_IACC IT_IGRV -#define IT_EACC IT_EGRV -#define IT_UACC IT_UGRV -#define IT_OACC IT_OGRV -#define IT_AACC IT_AGRV -#define IT_MORE IT_RABK -#define IT_DQOT IT_DQUO -#define IT_STRL IT_PND -#define IT_QST IT_QUES -#define IT_CRC IT_CIRC -#define IT_DEGR IT_DEG -#define IT_TILDE IT_TILD -#define IT_GRAVE IT_GRV -#define IT_SHRP IT_HASH diff --git a/quantum/keymap_extras/keymap_italian_osx_iso.h b/quantum/keymap_extras/keymap_italian_osx_iso.h index 5ed1e3abd4..61f76ddba7 100644 --- a/quantum/keymap_extras/keymap_italian_osx_iso.h +++ b/quantum/keymap_extras/keymap_italian_osx_iso.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ \ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ì │ │ + * │ \ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ì │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ è │ + │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ò │ à │ ù │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ è │ + │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ò │ à │ ù │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ | │ ! │ " │ £ │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ^ │ │ + * │ | │ ! │ " │ £ │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ^ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ │ │ │ │ │ │ │ │ │ │ é │ * │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ ç │ ° │ § │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ é │ * │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ ç │ ° │ § │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -128,15 +128,15 @@ /* Alted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ ` │ « │ “ │ ‘ │ ¥ │ ~ │ ‹ │ ÷ │ ´ │ ` │ ≠ │ ¡ │ ˆ │ │ + * │ ` │ « │ “ │ ‘ │ ¥ │ ~ │ ‹ │ ÷ │ ´ │ ` │ ≠ │ ¡ │ ˆ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ „ │ Ω │ € │ ® │ ™ │ Æ │ ¨ │ Œ │ Ø │ π │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Å │ ß │ ∂ │ ƒ │ ∞ │ ∆ │ ª │ º │ ¬ │ @ │ # │ ¶ │ │ + * │ │ „ │ Ω │ € │ ® │ ™ │ Æ │ ¨ │ Œ │ Ø │ π │ [ │ ] │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Å │ ß │ ∂ │ ƒ │ ∞ │ ∆ │ ª │ º │ ¬ │ @ │ # │ ¶ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ ≤ │ ∑ │ † │ © │ √ │ ∫ │ ˜ │ µ │ … │ • │ – │ │ + * │ │ ≤ │ ∑ │ † │ © │ √ │ ∫ │ ˜ │ µ │ … │ • │ – │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -194,15 +194,15 @@ /* Shift+Alted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ ı │ » │ ” │ ’ │ ¢ │ ‰ │ › │ ⁄ │ │ │ ≈ │ ¿ │ ± │ │ + * │ ı │ » │ ” │ ’ │ ¢ │ ‰ │ › │ ⁄ │ │ │ ≈ │ ¿ │ ± │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ ‚ │ À │ È │ Ì │ Ò │ │ Ù │ │ │ ∏ │ { │ } │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ ¯ │ ˘ │ ˙ │ ˚ │ ¸ │ ˝ │ ˛ │ ˇ │ Ç │ │ ◊ │ │ + * │ │ ‚ │ À │ È │ Ì │ Ò │ │ Ù │ │ │ ∏ │ { │ } │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ ¯ │ ˘ │ ˙ │ ˚ │ ¸ │ ˝ │ ˛ │ ˇ │ Ç │ │ ◊ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ ≥ │ │ ‡ │ Á │ É │ Í │ Ó │ Ú │ │ · │ — │ │ + * │ │ ≥ │ │ ‡ │ Á │ É │ Í │ Ó │ Ú │ │ · │ — │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -249,21 +249,3 @@ #define IT_CUAC S(A(IT_M)) // Ú #define IT_MDDT S(A(IT_DOT)) // · #define IT_MDSH S(A(IT_MINS)) // — - -// DEPRECATED -#define IT_APOS IT_QUOT -#define IT_IACC IT_IGRV -#define IT_EACC IT_EGRV -#define IT_OACC IT_OGRV -#define IT_AACC IT_AGRV -#define IT_UACC IT_UGRV -#define IT_LESS IT_LABK -#define IT_DQOT IT_DQUO -#define IT_STRL IT_PND -#define IT_QST IT_QUES -#define IT_CRC IT_CIRC -#define IT_DEGR IT_DEG -#define IT_MORE IT_RABK -#define IT_TILDE IT_TILD -#define IT_GRAVE IT_GRV -#define IT_SHRP IT_HASH diff --git a/quantum/keymap_extras/keymap_jp.h b/quantum/keymap_extras/keymap_jp.h index e608481d87..d10feb5856 100644 --- a/quantum/keymap_extras/keymap_jp.h +++ b/quantum/keymap_extras/keymap_jp.h @@ -28,15 +28,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ - * │Z↔︎H│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ ^ │ ¥ │ │ + * │Z↔︎H│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ ^ │ ¥ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ @ │ [ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ Eisū │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ : │ ] │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ @ │ [ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ Eisū │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ : │ ] │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┤ - * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ \ │ │ + * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ \ │ │ * ├─────┬──┴┬──┴──┬┴───┴┬──┴───┴──┬┴───┴┬──┴┬──┴┬──┴┬──┴┬─────┤ - * │ │ │ │Muhen│ │ Hen │K↔H│ │ │ │ │ + * │ │ │ │Muhen│ │ Hen │K↔H│ │ │ │ │ * └─────┴───┴─────┴─────┴─────────┴─────┴───┴───┴───┴───┴─────┘ */ // Row 1 @@ -100,15 +100,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ - * │ │ ! │ " │ # │ $ │ % │ & │ ' │ ( │ ) │ │ = │ ~ │ | │ │ + * │ │ ! │ " │ # │ $ │ % │ & │ ' │ ( │ ) │ │ = │ ~ │ | │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┤ - * │ │ │ │ │ │ │ │ │ │ │ │ ` │ { │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ Caps │ │ │ │ │ │ │ │ │ │ + │ * │ } │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ` │ { │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ Caps │ │ │ │ │ │ │ │ │ │ + │ * │ } │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┤ - * │ │ │ │ │ │ │ │ │ < │ > │ ? │ _ │ │ + * │ │ │ │ │ │ │ │ │ < │ > │ ? │ _ │ │ * ├─────┬──┴┬──┴──┬┴───┴┬──┴───┴──┬┴───┴┬──┴┬──┴┬──┴┬──┴┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ * └─────┴───┴─────┴─────┴─────────┴─────┴───┴───┴───┴───┴─────┘ */ // Row 1 @@ -137,12 +137,3 @@ #define JP_RABK S(JP_DOT) // > #define JP_QUES S(JP_SLSH) // ? #define JP_UNDS S(JP_BSLS) // _ - -// DEPRECATED -#define JP_ZHTG JP_ZKHK -#define JP_DQT JP_DQUO -#define JP_LT JP_LABK -#define JP_GT JP_RABK - -#define JP_MEISU KC_LANG2 // Eisū (英数) on macOS -#define JP_MKANA KC_LANG1 // Kana (かな) on macOS diff --git a/quantum/keymap_extras/keymap_korean.h b/quantum/keymap_extras/keymap_korean.h index da914767b8..23d235ef09 100644 --- a/quantum/keymap_extras/keymap_korean.h +++ b/quantum/keymap_extras/keymap_korean.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ ₩ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ ₩ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ + * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ * ├─────┬──┴┬──┴──┬┴──┬┴───┴───┴───┴──┬┴──┬┴───┴┬──┴┬───┬─────┤ - * │ │ │ │Hnj│ │H↔Y│ │ │ │ │ + * │ │ │ │Hnj│ │H↔Y│ │ │ │ │ * └─────┴───┴─────┴───┴───────────────┴───┴─────┴───┴───┴─────┘ */ // Row 1 @@ -90,15 +90,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ | │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ | │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ : │ " │ │ + * │ │ │ │ │ │ │ │ │ │ │ : │ " │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├─────┬──┴┬──┴──┬┴──┬┴───┴───┴───┴──┬┴──┬┴───┴┬──┴┬───┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ * └─────┴───┴─────┴───┴───────────────┴───┴─────┴───┴───┴─────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_latvian.h b/quantum/keymap_extras/keymap_latvian.h index 452e9167bc..3eaa2df274 100644 --- a/quantum/keymap_extras/keymap_latvian.h +++ b/quantum/keymap_extras/keymap_latvian.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ \ │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ \ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ + * │ │ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ : │ " │ | │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ : │ " │ | │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -127,19 +127,19 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ - │ │ « │ » │ € │ │ ’ │ │ │ │ │ – │ │ │ + * │ - │ │ « │ » │ € │ │ ’ │ │ │ │ │ – │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ Ē │ Ŗ │ │ │ Ū │ Ī │ Ō │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Ā │ Š │ │ │ Ģ │ │ │ Ķ │ Ļ │ │ ´ │ │ │ + * │ │ │ │ Ē │ Ŗ │ │ │ Ū │ Ī │ Ō │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Ā │ Š │ │ │ Ģ │ │ │ Ķ │ Ļ │ │ ´ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ Ž │ │ Č │ │ │ Ņ │ │ │ │ │ │ + * │ │ │ Ž │ │ Č │ │ │ Ņ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 -#define LV_SHYP ALGR(LV_GRV) // - (soft hyphen) +#define LV_SHYP ALGR(LV_GRV) // (soft hyphen) #define LV_NBSP ALGR(LV_1) // (non-breaking space) #define LV_LDAQ ALGR(LV_2) // « #define LV_RDAQ ALGR(LV_3) // » @@ -166,15 +166,15 @@ /* Shift+AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ │ │ § │ ° │ │ ± │ × │ │ │ — │ │ │ + * │ │ │ │ │ § │ ° │ │ ± │ × │ │ │ — │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_lithuanian_azerty.h b/quantum/keymap_extras/keymap_lithuanian_azerty.h index 68bcd6dc1e..8ca38129e3 100644 --- a/quantum/keymap_extras/keymap_lithuanian_azerty.h +++ b/quantum/keymap_extras/keymap_lithuanian_azerty.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ ! │ - │ / │ ; │ : │ , │ . │ = │ ( │ ) │ ? │ X │ │ + * │ ` │ ! │ - │ / │ ; │ : │ , │ . │ = │ ( │ ) │ ? │ X │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Ą │ Ž │ E │ R │ T │ Y │ U │ I │ O │ P │ Į │ W │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ Š │ G │ H │ J │ K │ L │ Ų │ Ė │ Q │ │ + * │ │ Ą │ Ž │ E │ R │ T │ Y │ U │ I │ O │ P │ Į │ W │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ Š │ G │ H │ J │ K │ L │ Ų │ Ė │ Q │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Z │ Ū │ C │ V │ B │ N │ M │ Č │ F │ Ę │ │ + * │ │ < │ Z │ Ū │ C │ V │ B │ N │ M │ Č │ F │ Ę │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ │ │ + * │ ~ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ > │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -117,15 +117,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ´ │ @ │ _ │ # │ $ │ § │ ^ │ & │ * │ [ │ ] │ ' │ % │ │ + * │ ´ │ @ │ _ │ # │ $ │ § │ ^ │ & │ * │ [ │ ] │ ' │ % │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ € │ │ │ │ │ │ │ │ { │ } │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ " │ | │ │ + * │ │ │ │ € │ │ │ │ │ │ │ │ { │ } │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ " │ | │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ – │ │ │ │ │ │ │ │ „ │ “ │ \ │ │ + * │ │ – │ │ │ │ │ │ │ │ „ │ “ │ \ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_lithuanian_qwerty.h b/quantum/keymap_extras/keymap_lithuanian_qwerty.h index 0f92562a13..2dbb3649f7 100644 --- a/quantum/keymap_extras/keymap_lithuanian_qwerty.h +++ b/quantum/keymap_extras/keymap_lithuanian_qwerty.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ Ą │ Č │ Ę │ Ė │ Į │ Š │ Ų │ Ū │ 9 │ 0 │ - │ Ž │ │ + * │ ` │ Ą │ Č │ Ę │ Ė │ Į │ Š │ Ų │ Ū │ 9 │ 0 │ - │ Ž │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ \ │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ \ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ + * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ │ │ │ │ │ │ │ │ ( │ ) │ _ │ │ │ + * │ ~ │ │ │ │ │ │ │ │ │ ( │ ) │ _ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ : │ " │ | │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ : │ " │ | │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -117,15 +117,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ │ │ │ = │ │ + * │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ │ │ │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ € │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ € │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -143,15 +143,15 @@ /* Shift+AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ │ │ │ + │ │ + * │ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ │ │ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_neo2.h b/quantum/keymap_extras/keymap_neo2.h index c34e9116bb..f9fc00d794 100644 --- a/quantum/keymap_extras/keymap_neo2.h +++ b/quantum/keymap_extras/keymap_neo2.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ^ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ ` │ │ + * │ ^ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ ` │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ X │ V │ L │ C │ W │ K │ H │ G │ F │ Q │ ß │ ´ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ L3 │ U │ I │ A │ E │ O │ S │ N │ R │ T │ D │ Y │ L3│ │ + * │ │ X │ V │ L │ C │ W │ K │ H │ G │ F │ Q │ ß │ ´ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ L3 │ U │ I │ A │ E │ O │ S │ N │ R │ T │ D │ Y │ L3│ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │L4 │ Ü │ Ö │ Ä │ P │ Z │ B │ M │ , │ . │ J │ │ + * │ │L4 │ Ü │ Ö │ Ä │ P │ Z │ B │ M │ , │ . │ J │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ L4 │ │ │ + * │ │ │ │ │ │ L4 │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,55 +88,3 @@ #define NE_J KC_SLSH // J // Row 5 #define NE_L4R KC_ALGR // (layer 4) - -// DEPRECATED -#define NEO_A NE_A -#define NEO_B NE_B -#define NEO_C NE_C -#define NEO_D NE_D -#define NEO_E NE_E -#define NEO_F NE_F -#define NEO_G NE_G -#define NEO_H NE_H -#define NEO_I NE_I -#define NEO_J NE_J -#define NEO_K NE_K -#define NEO_L NE_L -#define NEO_M NE_M -#define NEO_N NE_N -#define NEO_O NE_O -#define NEO_P NE_P -#define NEO_Q NE_Q -#define NEO_R NE_R -#define NEO_S NE_S -#define NEO_T NE_T -#define NEO_U NE_U -#define NEO_V NE_V -#define NEO_W NE_W -#define NEO_X NE_X -#define NEO_Y NE_Y -#define NEO_Z NE_Z -#define NEO_AE NE_ADIA -#define NEO_OE NE_ODIA -#define NEO_UE NE_UDIA -#define NEO_SS NE_SS -#define NEO_DOT NE_DOT -#define NEO_COMM NE_COMM -#define NEO_1 NE_1 -#define NEO_2 NE_2 -#define NEO_3 NE_3 -#define NEO_4 NE_4 -#define NEO_5 NE_5 -#define NEO_6 NE_6 -#define NEO_7 NE_7 -#define NEO_8 NE_8 -#define NEO_9 NE_9 -#define NEO_0 NE_0 -#define NEO_MINS NE_MINS -#define NEO_ACUT NE_ACUT -#define NEO_GRV NE_GRV -#define NEO_CIRC NE_CIRC -#define NEO_L1_L NE_L3L -#define NEO_L1_R NE_L3R -#define NEO_L2_L NE_L4L -#define NEO_L2_R NE_L4R diff --git a/quantum/keymap_extras/keymap_norman.h b/quantum/keymap_extras/keymap_norman.h index 45727467bc..7a5c1cbeb2 100644 --- a/quantum/keymap_extras/keymap_norman.h +++ b/quantum/keymap_extras/keymap_norman.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ D │ F │ K │ J │ U │ R │ L │ ; │ [ │ ] │ \ │ + * │ │ Q │ W │ D │ F │ K │ J │ U │ R │ L │ ; │ [ │ ] │ \ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ A │ S │ E │ T │ G │ Y │ N │ I │ O │ H │ ' │ │ + * │ │ A │ S │ E │ T │ G │ Y │ N │ I │ O │ H │ ' │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Z │ X │ C │ V │ B │ P │ M │ , │ . │ / │ │ + * │ │ Z │ X │ C │ V │ B │ P │ M │ , │ . │ / │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ ; │ { │ } │ | │ + * │ │ │ │ │ │ │ │ │ │ │ ; │ { │ } │ | │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ " │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ " │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_norwegian.h b/quantum/keymap_extras/keymap_norwegian.h index 8b6497f00f..439703973e 100644 --- a/quantum/keymap_extras/keymap_norwegian.h +++ b/quantum/keymap_extras/keymap_norwegian.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ | │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ \ │ │ + * │ | │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ \ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Å │ ¨ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ø │ Æ │ ' │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Å │ ¨ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ø │ Æ │ ' │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ § │ ! │ " │ # │ ¤ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ + * │ § │ ! │ " │ # │ ¤ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ ^ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ^ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -125,15 +125,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ @ │ £ │ $ │ € │ │ { │ [ │ ] │ } │ │ ´ │ │ + * │ │ │ @ │ £ │ $ │ € │ │ { │ [ │ ] │ } │ │ ´ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ ~ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ~ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ µ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ µ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_plover.h b/quantum/keymap_extras/keymap_plover.h index f27d2ba77a..cd07211bca 100644 --- a/quantum/keymap_extras/keymap_plover.h +++ b/quantum/keymap_extras/keymap_plover.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │Num│ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │Num│ │ │ │ │ │ │ │ │ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ S │ T │ P │ H │ │ * │ F │ P │ L │ T │ D │ │ │ + * │ │ S │ T │ P │ H │ │ * │ F │ P │ L │ T │ D │ │ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ K │ W │ R │ │ │ R │ B │ G │ S │ Z │ │ + * │ │ │ K │ W │ R │ │ │ R │ B │ G │ S │ Z │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ A │ O │ │ E │ U │ │ │ │ │ + * │ │ │ │ A │ O │ │ E │ U │ │ │ │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_polish.h b/quantum/keymap_extras/keymap_polish.h index a5c5cec543..e5a32f22db 100644 --- a/quantum/keymap_extras/keymap_polish.h +++ b/quantum/keymap_extras/keymap_polish.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ + * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ | │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ | │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ : │ " │ │ + * │ │ │ │ │ │ │ │ │ │ │ : │ " │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -126,15 +126,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ Ę │ │ │ │ € │ │ Ó │ │ │ │ │ + * │ │ │ │ Ę │ │ │ │ € │ │ Ó │ │ │ │ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ Ą │ Ś │ │ │ │ │ │ │ Ł │ │ │ │ + * │ │ Ą │ Ś │ │ │ │ │ │ │ Ł │ │ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Ż │ Ź │ Ć │ │ │ Ń │ │ │ │ │ │ + * │ │ Ż │ Ź │ Ć │ │ │ Ń │ │ │ │ │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 2 diff --git a/quantum/keymap_extras/keymap_portuguese.h b/quantum/keymap_extras/keymap_portuguese.h index 84851b334a..19d7dcd817 100644 --- a/quantum/keymap_extras/keymap_portuguese.h +++ b/quantum/keymap_extras/keymap_portuguese.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ \ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ « │ │ + * │ \ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ « │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ + │ ´ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ç │ º │ ~ │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ + │ ´ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ç │ º │ ~ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ | │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ » │ │ + * │ | │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ » │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ * │ ` │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ ª │ ^ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ * │ ` │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ª │ ^ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -127,15 +127,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ @ │ £ │ § │ │ │ { │ [ │ ] │ } │ │ │ │ + * │ │ │ @ │ £ │ § │ │ │ { │ [ │ ] │ } │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ € │ │ │ │ │ │ │ │ ¨ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ € │ │ │ │ │ │ │ │ ¨ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_portuguese_osx_iso.h b/quantum/keymap_extras/keymap_portuguese_osx_iso.h index b2e52063a9..78346af285 100644 --- a/quantum/keymap_extras/keymap_portuguese_osx_iso.h +++ b/quantum/keymap_extras/keymap_portuguese_osx_iso.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ § │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ + │ │ + * │ § │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ º │ ´ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ç │ ~ │ \ │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ º │ ´ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ç │ ~ │ \ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ ± │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ * │ │ + * │ ± │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ * │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ │ │ │ │ │ │ │ │ │ │ ª │ ` │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ ^ │ | │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ª │ ` │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ^ │ | │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -127,15 +127,15 @@ /* Alted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ │ │ @ │ € │ £ │ ‰ │ ¶ │ ÷ │ [ │ ] │ ≠ │ │ │ │ + * │ │ │ @ │ € │ £ │ ‰ │ ¶ │ ÷ │ [ │ ] │ ≠ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ Œ │ ∑ │ Æ │ ® │ ™ │ ¥ │ † │ ı │ Ø │ π │ ° │ ¨ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Å │ ß │ ∂ │ ƒ │ ˙ │ ˇ │ ¯ │ „ │ ‘ │ ¸ │ ˜ │ ‹ │ │ + * │ │ Œ │ ∑ │ Æ │ ® │ ™ │ ¥ │ † │ ı │ Ø │ π │ ° │ ¨ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Å │ ß │ ∂ │ ƒ │ ˙ │ ˇ │ ¯ │ „ │ ‘ │ ¸ │ ˜ │ ‹ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ ≤ │ Ω │ « │ © │ √ │ ∫ │ ¬ │ µ │ “ │ … │ — │ │ + * │ │ ≤ │ Ω │ « │ © │ √ │ ∫ │ ¬ │ µ │ “ │ … │ — │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 @@ -190,15 +190,15 @@ /* Shift+Alted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ - * │ │ ¡ │ fi │ fl │ ¢ │ ∞ │ • │ ⁄ │ { │ } │ ≈ │ ¿ │ ◊ │ │ + * │ │ ¡ │ fi │ fl │ ¢ │ ∞ │ • │ ⁄ │ { │ } │ ≈ │ ¿ │ ◊ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ - * │ │ │ │ │ │ │ │ ‡ │ ˚ │ │ ∏ │ │ ˝ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ ∆ │ │ │ │ │ ‚ │ ’ │ ˛ │ ˆ │ › │ │ + * │ │ │ │ │ │ │ │ ‡ │ ˚ │ │ ∏ │ │ ˝ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ ∆ │ │ │ │ │ ‚ │ ’ │ ˛ │ ˆ │ › │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ - * │ │ ≥ │ │ » │ │ │ │ │ │ ” │ · │ – │ │ + * │ │ ≥ │ │ » │ │ │ │ │ │ ” │ · │ – │ │ * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ - * │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_romanian.h b/quantum/keymap_extras/keymap_romanian.h index e2b8483dfd..27086d684c 100644 --- a/quantum/keymap_extras/keymap_romanian.h +++ b/quantum/keymap_extras/keymap_romanian.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ „ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ „ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Ă │ Î │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ș │ Ț │  │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Ă │ Î │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ș │ Ț │  │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ + * │ │ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ” │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ” │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ | │ │ │ │ │ │ │ │ ; │ : │ ? │ │ + * │ │ | │ │ │ │ │ │ │ │ ; │ : │ ? │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -121,15 +121,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ ~ │ ˇ │ ^ │ ˘ │ ° │ ˛ │ ` │ ˙ │ ´ │ ˝ │ ¨ │ ¸ │ │ + * │ ` │ ~ │ ˇ │ ^ │ ˘ │ ° │ ˛ │ ` │ ˙ │ ´ │ ˝ │ ¨ │ ¸ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ € │ │ │ │ │ │ │ § │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ ß │ Đ │ │ │ │ │ │ Ł │ │ ' │ │ │ + * │ │ │ │ € │ │ │ │ │ │ │ § │ [ │ ] │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ ß │ Đ │ │ │ │ │ │ Ł │ │ ' │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ © │ │ │ │ │ < │ > │ │ │ + * │ │ │ │ │ © │ │ │ │ │ < │ > │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -163,15 +163,15 @@ /* Shift+AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ │ │ │ │ │ │ │ │ │ │ – │ ± │ │ + * │ ~ │ │ │ │ │ │ │ │ │ │ │ – │ ± │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ " │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ " │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ « │ » │ │ │ + * │ │ │ │ │ │ │ │ │ │ « │ » │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_russian.h b/quantum/keymap_extras/keymap_russian.h index eb0581147c..71aece677d 100644 --- a/quantum/keymap_extras/keymap_russian.h +++ b/quantum/keymap_extras/keymap_russian.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ Ё │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ Ё │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Й │ Ц │ У │ К │ Е │ Н │ Г │ Ш │ Щ │ З │ Х │ Ъ │ \ │ + * │ │ Й │ Ц │ У │ К │ Е │ Н │ Г │ Ш │ Щ │ З │ Х │ Ъ │ \ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ Ф │ Ы │ В │ А │ П │ Р │ О │ Л │ Д │ Ж │ Э │ │ + * │ │ Ф │ Ы │ В │ А │ П │ Р │ О │ Л │ Д │ Ж │ Э │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Я │ Ч │ С │ М │ И │ Т │ Ь │ Б │ Ю │ . │ │ + * │ │ Я │ Ч │ С │ М │ И │ Т │ Ь │ Б │ Ю │ . │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ ! │ " │ № │ ; │ % │ : │ ? │ * │ ( │ ) │ _ │ + │ │ + * │ │ ! │ " │ № │ ; │ % │ : │ ? │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ / │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ / │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ │ │ │ │ │ │ │ , │ │ + * │ │ │ │ │ │ │ │ │ │ │ , │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -118,15 +118,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ │ │ │ │ │ │ ₽ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ ₽ │ │ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_serbian.h b/quantum/keymap_extras/keymap_serbian.h index 738a2d4afb..a17dcc5f34 100644 --- a/quantum/keymap_extras/keymap_serbian.h +++ b/quantum/keymap_extras/keymap_serbian.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ + │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Љ │ Њ │ Е │ Р │ Т │ З │ У │ И │ О │ П │ Ш │ Ђ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ А │ С │ Д │ Ф │ Г │ Х │ Ј │ К │ Л │ Ч │ Ћ │ Ж │ │ + * │ │ Љ │ Њ │ Е │ Р │ Т │ З │ У │ И │ О │ П │ Ш │ Ђ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ А │ С │ Д │ Ф │ Г │ Х │ Ј │ К │ Л │ Ч │ Ћ │ Ж │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Ѕ │ Џ │ Ц │ В │ Б │ Н │ М │ , │ . │ - │ │ + * │ │ < │ Ѕ │ Џ │ Ц │ В │ Б │ Н │ М │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ * │ │ + * │ ~ │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ * │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -121,15 +121,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ € │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ € │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 2 diff --git a/quantum/keymap_extras/keymap_serbian_latin.h b/quantum/keymap_extras/keymap_serbian_latin.h index b514102c02..13c82eb405 100644 --- a/quantum/keymap_extras/keymap_serbian_latin.h +++ b/quantum/keymap_extras/keymap_serbian_latin.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ‚ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ + │ │ + * │ ‚ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ Š │ Đ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Č │ Ć │ Ž │ │ + * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ Š │ Đ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Č │ Ć │ Ž │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ * │ │ + * │ ~ │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ * │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -121,15 +121,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ ˇ │ ^ │ ˘ │ ° │ ˛ │ ` │ ˙ │ ´ │ ˝ │ ¨ │ ¸ │ │ + * │ │ │ ˇ │ ^ │ ˘ │ ° │ ˛ │ ` │ ˙ │ ´ │ ˝ │ ¨ │ ¸ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ \ │ | │ € │ │ │ │ │ │ │ │ ÷ │ × │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ [ │ ] │ │ │ ł │ Ł │ │ ß │ ¤ │ │ + * │ │ \ │ | │ € │ │ │ │ │ │ │ │ ÷ │ × │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ [ │ ] │ │ │ ł │ Ł │ │ ß │ ¤ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ @ │ { │ } │ § │ │ │ │ │ + * │ │ │ │ │ │ @ │ { │ } │ § │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_slovak.h b/quantum/keymap_extras/keymap_slovak.h index f0bd6ae513..71344c07ff 100644 --- a/quantum/keymap_extras/keymap_slovak.h +++ b/quantum/keymap_extras/keymap_slovak.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ; │ + │ ľ │ š │ č │ ť │ ž │ ý │ á │ í │ é │ = │ ´ │ │ + * │ ; │ + │ ľ │ š │ č │ ť │ ž │ ý │ á │ í │ é │ = │ ´ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ ú │ ä │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ô │ § │ ň │ │ + * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ ú │ ä │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ô │ § │ ň │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ & │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ & │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ° │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ % │ ˇ │ │ + * │ ° │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ % │ ˇ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ / │ ( │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ " │ ! │ ) │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ / │ ( │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ " │ ! │ ) │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ * │ │ │ │ │ │ │ │ ? │ : │ _ │ │ + * │ │ * │ │ │ │ │ │ │ │ ? │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -128,15 +128,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ ~ │ │ ^ │ ˘ │ ° │ ˛ │ ` │ ˙ │ │ ˝ │ ¨ │ ¸ │ │ + * │ │ ~ │ │ ^ │ ˘ │ ° │ ˛ │ ` │ ˙ │ │ ˝ │ ¨ │ ¸ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ \ │ | │ € │ │ │ │ │ │ │ ' │ ÷ │ × │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ đ │ Đ │ [ │ ] │ │ │ ł │ Ł │ $ │ ß │ ¤ │ │ + * │ │ \ │ | │ € │ │ │ │ │ │ │ ' │ ÷ │ × │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ đ │ Đ │ [ │ ] │ │ │ ł │ Ł │ $ │ ß │ ¤ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ > │ # │ │ @ │ { │ } │ │ │ │ │ │ + * │ │ < │ > │ # │ │ @ │ { │ } │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_slovenian.h b/quantum/keymap_extras/keymap_slovenian.h index d24c9c6355..827fa06c25 100644 --- a/quantum/keymap_extras/keymap_slovenian.h +++ b/quantum/keymap_extras/keymap_slovenian.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ¸ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ + │ │ + * │ ¸ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ Š │ Đ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Č │ Ć │ Ž │ │ + * │ │ Q │ W │ E │ R │ T │ Z │ U │ I │ O │ P │ Š │ Đ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Č │ Ć │ Ž │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Y │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ¨ │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ * │ │ + * │ ¨ │ ! │ " │ # │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ * │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -121,15 +121,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ ~ │ ˇ │ ^ │ ˘ │ ° │ ˛ │ ` │ ˙ │ ´ │ ˝ │ │ │ │ + * │ │ ~ │ ˇ │ ^ │ ˘ │ ° │ ˛ │ ` │ ˙ │ ´ │ ˝ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ \ │ | │ € │ │ │ │ │ │ │ │ ÷ │ × │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ [ │ ] │ │ │ ł │ Ł │ │ ß │ ¤ │ │ + * │ │ \ │ | │ € │ │ │ │ │ │ │ │ ÷ │ × │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ [ │ ] │ │ │ ł │ Ł │ │ ß │ ¤ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ @ │ { │ } │ § │ │ │ │ │ + * │ │ │ │ │ │ @ │ { │ } │ § │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -161,11 +161,3 @@ #define SI_LCBR ALGR(SI_B) // { #define SI_RCBR ALGR(SI_N) // } #define SI_SECT ALGR(SI_M) // § - -// DEPRECATED -#define SI_QOT SI_QUOT -#define SI_SV SI_SCAR -#define SI_CV SI_CCAR -#define SI_ZV SI_ZCAR -#define SI_DQOT SI_DQUO -#define SI_QST SI_QUES diff --git a/quantum/keymap_extras/keymap_spanish.h b/quantum/keymap_extras/keymap_spanish.h index 1465ecc81b..8432c56e99 100644 --- a/quantum/keymap_extras/keymap_spanish.h +++ b/quantum/keymap_extras/keymap_spanish.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ º │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ¡ │ │ + * │ º │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ¡ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ ` │ + │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ñ │ ´ │ Ç │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ ` │ + │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ñ │ ´ │ Ç │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ª │ ! │ " │ · │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ¿ │ │ + * │ ª │ ! │ " │ · │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ¿ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ ^ │ * │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ^ │ * │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -126,15 +126,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ \ │ | │ @ │ # │ ~ │ € │ ¬ │ │ │ │ │ │ │ │ + * │ \ │ | │ @ │ # │ ~ │ € │ ¬ │ │ │ │ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ [ │ ] │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -151,12 +151,3 @@ // Row 3 #define ES_LCBR ALGR(ES_ACUT) // { #define ES_RCBR ALGR(ES_CCED) // } - -// DEPRECATED -#define ES_OVRR ES_MORD -#define ES_APOS ES_QUOT -#define ES_LESS ES_LABK -#define ES_ASML ES_FORD -#define ES_OVDT ES_BULT -#define ES_UMLT ES_DIAE -#define ES_GRTR ES_RABK diff --git a/quantum/keymap_extras/keymap_spanish_dvorak.h b/quantum/keymap_extras/keymap_spanish_dvorak.h index 8fd6214728..663be395e9 100644 --- a/quantum/keymap_extras/keymap_spanish_dvorak.h +++ b/quantum/keymap_extras/keymap_spanish_dvorak.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ º │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ¡ │ │ + * │ º │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ ' │ ¡ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ . │ , │ Ñ │ P │ Y │ F │ G │ C │ H │ L │ ` │ + │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ O │ E │ U │ I │ D │ R │ T │ N │ S │ ´ │ Ç │ │ + * │ │ . │ , │ Ñ │ P │ Y │ F │ G │ C │ H │ L │ ` │ + │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ O │ E │ U │ I │ D │ R │ T │ N │ S │ ´ │ Ç │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ - │ Q │ J │ K │ X │ B │ M │ W │ V │ Z │ │ + * │ │ < │ - │ Q │ J │ K │ X │ B │ M │ W │ V │ Z │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ª │ ! │ " │ · │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ¿ │ │ + * │ ª │ ! │ " │ · │ $ │ % │ & │ / │ ( │ ) │ = │ ? │ ¿ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ : │ ; │ │ │ │ │ │ │ │ │ ^ │ * │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ │ │ + * │ │ : │ ; │ │ │ │ │ │ │ │ │ ^ │ * │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ ¨ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ _ │ │ │ │ │ │ │ │ │ │ │ + * │ │ > │ _ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -130,15 +130,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ \ │ | │ @ │ # │ ~ │ € │ ¬ │ │ │ │ │ │ │ │ + * │ \ │ | │ @ │ # │ ~ │ € │ ¬ │ │ │ │ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ [ │ ] │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_steno.h b/quantum/keymap_extras/keymap_steno.h index b9115fb8bf..ab95b43fdd 100644 --- a/quantum/keymap_extras/keymap_steno.h +++ b/quantum/keymap_extras/keymap_steno.h @@ -72,3 +72,21 @@ enum steno_keycodes { STN_ZR, STN__MAX = STN_ZR, // must be less than QK_STENO_BOLT }; + +#ifdef STENO_COMBINEDMAP +enum steno_combined_keycodes +{ + STN_S3 = QK_STENO_COMB, + STN_TKL, + STN_PWL, + STN_HRL, + STN_FRR, + STN_PBR, + STN_LGR, + STN_TSR, + STN_DZR, + STN_AO, + STN_EU, + STN_COMB_MAX = STN_EU, +}; +#endif diff --git a/quantum/keymap_extras/keymap_swedish.h b/quantum/keymap_extras/keymap_swedish.h index 4d2eaa9783..cadb66d3bd 100644 --- a/quantum/keymap_extras/keymap_swedish.h +++ b/quantum/keymap_extras/keymap_swedish.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ § │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ ´ │ │ + * │ § │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ ´ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Å │ ¨ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ ' │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Å │ ¨ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ ' │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ½ │ ! │ " │ # │ ¤ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ + * │ ½ │ ! │ " │ # │ ¤ │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ ^ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ^ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -125,15 +125,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ @ │ £ │ $ │ € │ │ { │ [ │ ] │ } │ \ │ │ │ + * │ │ │ @ │ £ │ $ │ € │ │ { │ [ │ ] │ } │ \ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ ~ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ~ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ | │ │ │ │ │ │ │ µ │ │ │ │ │ + * │ │ | │ │ │ │ │ │ │ µ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -154,26 +154,3 @@ // DEPRECATED #include "keymap_nordic.h" - -#define SE_OSLH SE_ODIA -#define SE_APOS SE_QUOT -#define SE_LESS SE_LABK -#define SE_QUO2 SE_DQUO -#define SE_BULT SE_CURR -#define SE_GRTR SE_RABK -#define SE_AA SE_ARNG -#define SE_AE SE_ADIA -#define SE_AM SE_ARNG -#define SE_MU SE_MICR -// Swedish macOS symbols (not vetted) -#define SE_ACUT_MAC SE_ACUT -#define SE_APOS_MAC SE_LABK -#define SE_AT_MAC SE_ADIA -#define SE_BSLS_MAC S(SE_LCBR) -#define SE_DLR_MAC SE_CURR -#define SE_GRV_MAC SE_BSLS -#define SE_GRTR_MAC SE_HALF -#define SE_LCBR_MAC S(SE_LBRC) -#define SE_LESS_MAC SE_SECT -#define SE_PIPE_MAC SE_LCBR -#define SE_RCBR_MAC S(SE_RBRC) diff --git a/quantum/keymap_extras/keymap_swedish_osx_ansi.h b/quantum/keymap_extras/keymap_swedish_osx_ansi.h new file mode 100644 index 0000000000..0d0426f866 --- /dev/null +++ b/quantum/keymap_extras/keymap_swedish_osx_ansi.h @@ -0,0 +1,240 @@ +/* Copyright 2021 + * + * 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 "keymap.h" + +// clang-format off + +/* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ < │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ ´ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Å │ ¨ │ ' │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴──────┤ + * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * ├─────┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define SE_LABK KC_GRV // < +#define SE_1 KC_1 // 1 +#define SE_2 KC_2 // 2 +#define SE_3 KC_3 // 3 +#define SE_4 KC_4 // 4 +#define SE_5 KC_5 // 5 +#define SE_6 KC_6 // 6 +#define SE_7 KC_7 // 7 +#define SE_8 KC_8 // 8 +#define SE_9 KC_9 // 9 +#define SE_0 KC_0 // 0 +#define SE_PLUS KC_MINS // + +#define SE_ACUT KC_EQL // ´ (dead) +// Row 2 +#define SE_Q KC_Q // Q +#define SE_W KC_W // W +#define SE_E KC_E // E +#define SE_R KC_R // R +#define SE_T KC_T // T +#define SE_Y KC_Y // Y +#define SE_U KC_U // U +#define SE_I KC_I // I +#define SE_O KC_O // O +#define SE_P KC_P // P +#define SE_ARNG KC_LBRC // Å +#define SE_DIAE KC_RBRC // ¨ (dead) +#define SE_QUOT KC_NUHS // ' +// Row 3 +#define SE_A KC_A // A +#define SE_S KC_S // S +#define SE_D KC_D // D +#define SE_F KC_F // F +#define SE_G KC_G // G +#define SE_H KC_H // H +#define SE_J KC_J // J +#define SE_K KC_K // K +#define SE_L KC_L // L +#define SE_ODIA KC_SCLN // Ö +#define SE_ADIA KC_QUOT // Ä +// Row 4 +#define SE_Z KC_Z // Z +#define SE_X KC_X // X +#define SE_C KC_C // C +#define SE_V KC_V // V +#define SE_B KC_B // B +#define SE_N KC_N // N +#define SE_M KC_M // M +#define SE_COMM KC_COMM // , +#define SE_DOT KC_DOT // . +#define SE_MINS KC_SLSH // - + +/* Shifted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ > │ ! │ " │ # │ € │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ^ │ * │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴──────┤ + * │ │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * ├─────┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define SE_RABK S(SE_LABK) // > +#define SE_EXLM S(SE_1) // ! +#define SE_DQUO S(SE_2) // " +#define SE_HASH S(SE_3) // # +#define SE_EURO S(SE_4) // € +#define SE_PERC S(SE_5) // % +#define SE_AMPR S(SE_6) // & +#define SE_SLSH S(SE_7) // / +#define SE_LPRN S(SE_8) // ( +#define SE_RPRN S(SE_9) // ) +#define SE_EQL S(SE_0) // = +#define SE_QUES S(SE_PLUS) // ? +#define SE_GRV S(SE_ACUT) // ` +// Row 2 +#define SE_CIRC S(SE_DIAE) // ^ (dead) +#define SE_ASTR S(SE_QUOT) // * +// Row 4 +#define SE_SCLN S(SE_COMM) // ; +#define SE_COLN S(SE_DOT) // : +#define SE_UNDS S(SE_MINS) // _ + +/* Alted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ ≤ │ © │ ™ │ £ │ $ │ ∞ │ § │ | │ [ │ ] │ ≈ │ ± │ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ • │ Ω │ É │ ® │ † │ µ │ Ü │ ı │ Œ │ π │ ˙ │ ~ │ @ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤ + * │ │ │ ß │ ∂ │ ƒ │ ¸ │ ˛ │ √ │ ª │ fi │ Ø │ Æ │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴──────┤ + * │ │ ÷ │ │ Ç │ ‹ │ › │ ‘ │ ’ │ ‚ │ … │ – │ │ + * ├─────┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + * + */ +// Row 1 +#define SE_LTEQ A(SE_LABK) // ≤ +#define SE_COPY A(SE_1) // © +#define SE_TM A(SE_2) // ™ +#define SE_PND A(SE_3) // £ +#define SE_DLR A(SE_4) // $ +#define SE_INFN A(SE_5) // ∞ +#define SE_SECT A(SE_6) // § +#define SE_PIPE A(SE_7) // | +#define SE_LBRC A(SE_8) // [ +#define SE_RBRC A(SE_9) // ] +#define SE_AEQL A(SE_0) // ≈ +#define SE_PLMN A(SE_PLUS) // ± +// Row 2 +#define SE_BULT A(SE_Q) // • +#define SE_OMEG A(SE_W) // Ω +#define SE_EACU A(SE_E) // É +#define SE_REGD A(SE_R) // ® +#define SE_DAGG A(SE_T) // † +#define SE_MICR A(SE_Y) // µ +#define SE_UDIA A(SE_U) // Ü +#define SE_DLSI A(SE_I) // ı +#define SE_OE A(SE_O) // Œ +#define SE_PI A(SE_P) // π +#define SE_DOTA A(SE_ARNG) // ˙ +#define SE_TILD A(SE_DIAE) // ~ (dead) +#define SE_AT A(SE_QUOT) // @ +// Row 3 +#define SE_APPL A(SE_A) // (Apple logo) +#define SE_SS A(SE_S) // ß +#define SE_PDIF A(SE_D) // ∂ +#define SE_FHK A(SE_F) // ƒ +#define SE_CEDL A(SE_G) // ¸ +#define SE_OGON A(SE_H) // ˛ +#define SE_SQRT A(SE_J) // √ +#define SE_FORD A(SE_K) // ª +#define SE_FI A(SE_L) // fi +#define SE_OSTR A(SE_ODIA) // Ø +#define SE_AE A(SE_ADIA) // Æ +// Row 4 +#define SE_DIV A(SE_Z) // ÷ +#define SE_CCED A(SE_C) // Ç +#define SE_LSAQ A(SE_V) // ‹ +#define SE_RSAQ A(SE_B) // › +#define SE_LSQU A(SE_N) // ‘ +#define SE_RSQU A(SE_M) // ’ +#define SE_SLQU A(SE_COMM) // ‚ +#define SE_ELLP A(SE_DOT) // … +#define SE_NDSH A(SE_MINS) // – + +/* Shift+Alted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ ≥ │ ¡ │ │ ¥ │ ¢ │ ‰ │ ¶ │ \ │ { │ } │ ≠ │ ¿ │ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ ° │ ˝ │ │ │ ‡ │ ˜ │ │ ˆ │ │ ∏ │ ˚ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤ + * │ │ ◊ │ ∑ │ ∆ │ ∫ │ ¯ │ ˘ │ ¬ │ º │ fl │ │ │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴──────┤ + * │ │ ⁄ │ ˇ │ │ « │ » │ “ │ ” │ „ │ · │ — │ │ + * ├─────┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + * + */ +// Row 1 +#define SE_GTEQ S(A(SE_LABK)) // ≥ +#define SE_IEXL S(A(SE_1)) // ¡ +#define SE_YEN S(A(SE_3)) // ¥ +#define SE_CENT S(A(SE_4)) // ¢ +#define SE_PERM S(A(SE_5)) // ‰ +#define SE_PILC S(A(SE_6)) // ¶ +#define SE_BSLS S(A(SE_7)) // (backslash) +#define SE_LCBR S(A(SE_8)) // { +#define SE_RCBR S(A(SE_9)) // } +#define SE_NEQL S(A(SE_0)) // ≠ +#define SE_IQUE S(A(SE_PLUS)) // ¿ +// Row 2 +#define SE_DEG S(A(SE_Q)) // ° +#define SE_DACU S(A(SE_W)) // ˝ +#define SE_DDAG S(A(SE_T)) // ‡ +#define SE_STIL S(A(SE_Y)) // ˜ +#define SE_DCIR S(A(SE_I)) // ˆ +#define SE_NARP S(A(SE_P)) // ∏ +#define SE_RNGA S(A(SE_ARNG)) // ˚ +// Row 3 +#define SE_LOZN S(A(SE_A)) // ◊ +#define SE_NARS S(A(SE_S)) // ∑ +#define SE_INCR S(A(SE_D)) // ∆ +#define SE_INTG S(A(SE_F)) // ∫ +#define SE_MACR S(A(SE_G)) // ¯ +#define SE_BREV S(A(SE_H)) // ˘ +#define SE_NOT S(A(SE_J)) // ¬ +#define SE_MORD S(A(SE_K)) // º +#define SE_FL S(A(SE_L)) // fl +// Row 4 +#define SE_FRSL S(A(SE_Z)) // ⁄ +#define SE_CARN S(A(SE_X)) // ˇ +#define SE_LDAQ S(A(SE_V)) // « +#define SE_RDAQ S(A(SE_B)) // » +#define SE_LDQU S(A(SE_N)) // “ +#define SE_RDQU S(A(SE_M)) // ” +#define SE_DLQU S(A(SE_COMM)) // „ +#define SE_MDDT S(A(SE_DOT)) // · +#define SE_MDSH S(A(SE_MINS)) // — diff --git a/quantum/keymap_extras/keymap_swedish_osx_iso.h b/quantum/keymap_extras/keymap_swedish_osx_iso.h new file mode 100644 index 0000000000..ab155530ae --- /dev/null +++ b/quantum/keymap_extras/keymap_swedish_osx_iso.h @@ -0,0 +1,239 @@ +/* Copyright 2021 + * + * 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 "keymap.h" + +// clang-format off + +/* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ § │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ ´ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Å │ ¨ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ ' │ │ + * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define SE_SECT KC_GRV // § +#define SE_1 KC_1 // 1 +#define SE_2 KC_2 // 2 +#define SE_3 KC_3 // 3 +#define SE_4 KC_4 // 4 +#define SE_5 KC_5 // 5 +#define SE_6 KC_6 // 6 +#define SE_7 KC_7 // 7 +#define SE_8 KC_8 // 8 +#define SE_9 KC_9 // 9 +#define SE_0 KC_0 // 0 +#define SE_PLUS KC_MINS // + +#define SE_ACUT KC_EQL // ´ (dead) +// Row 2 +#define SE_Q KC_Q // Q +#define SE_W KC_W // W +#define SE_E KC_E // E +#define SE_R KC_R // R +#define SE_T KC_T // T +#define SE_Y KC_Y // Y +#define SE_U KC_U // U +#define SE_I KC_I // I +#define SE_O KC_O // O +#define SE_P KC_P // P +#define SE_ARNG KC_LBRC // Å +#define SE_DIAE KC_RBRC // ¨ (dead) +// Row 3 +#define SE_A KC_A // A +#define SE_S KC_S // S +#define SE_D KC_D // D +#define SE_F KC_F // F +#define SE_G KC_G // G +#define SE_H KC_H // H +#define SE_J KC_J // J +#define SE_K KC_K // K +#define SE_L KC_L // L +#define SE_ODIA KC_SCLN // Ö +#define SE_ADIA KC_QUOT // Ä +#define SE_QUOT KC_NUHS // ' +// Row 4 +#define SE_LABK KC_NUBS // < +#define SE_Z KC_Z // Z +#define SE_X KC_X // X +#define SE_C KC_C // C +#define SE_V KC_V // V +#define SE_B KC_B // B +#define SE_N KC_N // N +#define SE_M KC_M // M +#define SE_COMM KC_COMM // , +#define SE_DOT KC_DOT // . +#define SE_MINS KC_SLSH // - + +/* Shifted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ ° │ ! │ " │ # │ € │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ^ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ + * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define SE_DEG S(SE_SECT) // ° +#define SE_EXLM S(SE_1) // ! +#define SE_DQUO S(SE_2) // " +#define SE_HASH S(SE_3) // # +#define SE_EURO S(SE_4) // € +#define SE_PERC S(SE_5) // % +#define SE_AMPR S(SE_6) // & +#define SE_SLSH S(SE_7) // / +#define SE_LPRN S(SE_8) // ( +#define SE_RPRN S(SE_9) // ) +#define SE_EQL S(SE_0) // = +#define SE_QUES S(SE_PLUS) // ? +#define SE_GRV S(SE_ACUT) // ` +// Row 2 +#define SE_CIRC S(SE_DIAE) // ^ (dead) +// Row 3 +#define SE_ASTR S(SE_QUOT) // * +// Row 4 +#define SE_RABK S(SE_LABK) // > +#define SE_SCLN S(SE_COMM) // ; +#define SE_COLN S(SE_DOT) // : +#define SE_UNDS S(SE_MINS) // _ + +/* Alted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ ¶ │ © │ ™ │ £ │ $ │ ∞ │ │ | │ [ │ ] │ ≈ │ ± │ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ • │ Ω │ É │ ® │ † │ µ │ Ü │ ı │ Œ │ π │ ˙ │ ~ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ ß │ ∂ │ ƒ │ ¸ │ ˛ │ √ │ ª │ fi │ Ø │ Æ │ @ │ │ + * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ + * │ │ ≤ │ ÷ │ │ Ç │ ‹ │ › │ ‘ │ ’ │ ‚ │ … │ – │ │ + * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define SE_PILC A(SE_SECT) // ¶ +#define SE_COPY A(SE_1) // © +#define SE_TM A(SE_2) // ™ +#define SE_PND A(SE_3) // £ +#define SE_DLR A(SE_4) // $ +#define SE_INFN A(SE_5) // ∞ +#define SE_PIPE A(SE_7) // | +#define SE_LBRC A(SE_8) // [ +#define SE_RBRC A(SE_9) // ] +#define SE_AEQL A(SE_0) // ≈ +#define SE_PLMN A(SE_PLUS) // ± +// Row 2 +#define SE_BULT A(SE_Q) // • +#define SE_OMEG A(SE_W) // Ω +#define SE_EACU A(SE_E) // É +#define SE_REGD A(SE_R) // ® +#define SE_DAGG A(SE_T) // † +#define SE_MICR A(SE_Y) // µ +#define SE_UDIA A(SE_U) // Ü +#define SE_DLSI A(SE_I) // ı +#define SE_OE A(SE_O) // Œ +#define SE_PI A(SE_P) // π +#define SE_DOTA A(SE_ARNG) // ˙ +#define SE_TILD A(SE_DIAE) // ~ (dead) +// Row 3 +#define SE_APPL A(SE_A) // (Apple logo) +#define SE_SS A(SE_S) // ß +#define SE_PDIF A(SE_D) // ∂ +#define SE_FHK A(SE_F) // ƒ +#define SE_CEDL A(SE_G) // ¸ +#define SE_OGON A(SE_H) // ˛ +#define SE_SQRT A(SE_J) // √ +#define SE_FORD A(SE_K) // ª +#define SE_FI A(SE_L) // fi +#define SE_OSTR A(SE_ODIA) // Ø +#define SE_AE A(SE_ADIA) // Æ +#define SE_AT A(SE_QUOT) // @ +// Row 4 +#define SE_LTEQ A(SE_LABK) // ≤ +#define SE_DIV A(SE_Z) // ÷ +#define SE_CCED A(SE_C) // Ç +#define SE_LSAQ A(SE_V) // ‹ +#define SE_RSAQ A(SE_B) // › +#define SE_LSQU A(SE_N) // ‘ +#define SE_RSQU A(SE_M) // ’ +#define SE_SLQU A(SE_COMM) // ‚ +#define SE_ELLP A(SE_DOT) // … +#define SE_NDSH A(SE_MINS) // – + +/* Shift+Alted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ │ ¡ │ ” │ ¥ │ ¢ │ ‰ │ │ \ │ { │ } │ ≠ │ ¿ │ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ │ ˝ │ │ │ ‡ │ ˜ │ │ ˆ │ │ ∏ │ ˚ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ ◊ │ ∑ │ ∆ │ ∫ │ ¯ │ ˘ │ ¬ │ º │ fl │ │ │ │ │ + * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ + * │ │ ≥ │ ⁄ │ ˇ │ │ « │ » │ “ │ ” │ „ │ · │ — │ │ + * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define SE_IEXL S(A(SE_1)) // ¡ +#define SE_YEN S(A(SE_3)) // ¥ +#define SE_CENT S(A(SE_4)) // ¢ +#define SE_PERM S(A(SE_5)) // ‰ +#define SE_BSLS S(A(SE_7)) // (backslash) +#define SE_LCBR S(A(SE_8)) // { +#define SE_RCBR S(A(SE_9)) // } +#define SE_NEQL S(A(SE_0)) // ≠ +#define SE_IQUE S(A(SE_PLUS)) // ¿ +// Row 2 +#define SE_DACU S(A(SE_W)) // ˝ +#define SE_DDAG S(A(SE_T)) // ‡ +#define SE_STIL S(A(SE_Y)) // ˜ +#define SE_DCIR S(A(SE_I)) // ˆ +#define SE_NARP S(A(SE_P)) // ∏ +#define SE_RNGA S(A(SE_ARNG)) // ˚ +// Row 3 +#define SE_LOZN S(A(SE_A)) // ◊ +#define SE_NARS S(A(SE_S)) // ∑ +#define SE_INCR S(A(SE_D)) // ∆ +#define SE_INTG S(A(SE_F)) // ∫ +#define SE_MACR S(A(SE_G)) // ¯ +#define SE_BREV S(A(SE_H)) // ˘ +#define SE_NOT S(A(SE_J)) // ¬ +#define SE_MORD S(A(SE_K)) // º +#define SE_FL S(A(SE_L)) // fl +// Row 4 +#define SE_GTEQ S(A(SE_LABK)) // ≥ +#define SE_FRSL S(A(SE_Z)) // ⁄ +#define SE_CARN S(A(SE_X)) // ˇ +#define SE_LDAQ S(A(SE_V)) // « +#define SE_RDAQ S(A(SE_B)) // » +#define SE_LDQU S(A(SE_N)) // “ +#define SE_RDQU S(A(SE_M)) // ” +#define SE_DLQU S(A(SE_COMM)) // „ +#define SE_MDDT S(A(SE_DOT)) // · +#define SE_MDSH S(A(SE_MINS)) // — diff --git a/quantum/keymap_extras/keymap_swedish_pro_osx_ansi.h b/quantum/keymap_extras/keymap_swedish_pro_osx_ansi.h new file mode 100644 index 0000000000..9b44517625 --- /dev/null +++ b/quantum/keymap_extras/keymap_swedish_pro_osx_ansi.h @@ -0,0 +1,240 @@ +/* Copyright 2021 + * + * 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 "keymap.h" + +// clang-format off + +/* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ < │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ ´ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Å │ ¨ │ ' │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴──────┤ + * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * ├─────┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define SE_LABK KC_GRV // < +#define SE_1 KC_1 // 1 +#define SE_2 KC_2 // 2 +#define SE_3 KC_3 // 3 +#define SE_4 KC_4 // 4 +#define SE_5 KC_5 // 5 +#define SE_6 KC_6 // 6 +#define SE_7 KC_7 // 7 +#define SE_8 KC_8 // 8 +#define SE_9 KC_9 // 9 +#define SE_0 KC_0 // 0 +#define SE_PLUS KC_MINS // + +#define SE_ACUT KC_EQL // ´ (dead) +// Row 2 +#define SE_Q KC_Q // Q +#define SE_W KC_W // W +#define SE_E KC_E // E +#define SE_R KC_R // R +#define SE_T KC_T // T +#define SE_Y KC_Y // Y +#define SE_U KC_U // U +#define SE_I KC_I // I +#define SE_O KC_O // O +#define SE_P KC_P // P +#define SE_ARNG KC_LBRC // Å +#define SE_DIAE KC_RBRC // ¨ (dead) +#define SE_QUOT KC_NUHS // ' +// Row 3 +#define SE_A KC_A // A +#define SE_S KC_S // S +#define SE_D KC_D // D +#define SE_F KC_F // F +#define SE_G KC_G // G +#define SE_H KC_H // H +#define SE_J KC_J // J +#define SE_K KC_K // K +#define SE_L KC_L // L +#define SE_ODIA KC_SCLN // Ö +#define SE_ADIA KC_QUOT // Ä +// Row 4 +#define SE_Z KC_Z // Z +#define SE_X KC_X // X +#define SE_C KC_C // C +#define SE_V KC_V // V +#define SE_B KC_B // B +#define SE_N KC_N // N +#define SE_M KC_M // M +#define SE_COMM KC_COMM // , +#define SE_DOT KC_DOT // . +#define SE_MINS KC_SLSH // - + +/* Shifted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ > │ ! │ " │ # │ € │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ^ │ * │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴──────┤ + * │ │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * ├─────┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define SE_RABK S(SE_LABK) // > +#define SE_EXLM S(SE_1) // ! +#define SE_DQUO S(SE_2) // " +#define SE_HASH S(SE_3) // # +#define SE_EURO S(SE_4) // € +#define SE_PERC S(SE_5) // % +#define SE_AMPR S(SE_6) // & +#define SE_SLSH S(SE_7) // / +#define SE_LPRN S(SE_8) // ( +#define SE_RPRN S(SE_9) // ) +#define SE_EQL S(SE_0) // = +#define SE_QUES S(SE_PLUS) // ? +#define SE_GRV S(SE_ACUT) // ` +// Row 2 +#define SE_CIRC S(SE_DIAE) // ^ (dead) +#define SE_ASTR S(SE_QUOT) // * +// Row 4 +#define SE_SCLN S(SE_COMM) // ; +#define SE_COLN S(SE_DOT) // : +#define SE_UNDS S(SE_MINS) // _ + +/* Alted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ ≤ │ © │ @ │ £ │ $ │ ∞ │ § │ | │ [ │ ] │ ≈ │ ± │ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ • │ Ω │ É │ ® │ † │ µ │ Ü │ ı │ Œ │ π │ ˙ │ ~ │ ™ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤ + * │ │ │ ß │ ∂ │ ƒ │ ¸ │ ˛ │ √ │ ª │ fi │ Ø │ Æ │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴──────┤ + * │ │ ÷ │ │ Ç │ ‹ │ › │ ‘ │ ’ │ ‚ │ … │ – │ │ + * ├─────┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + * + */ +// Row 1 +#define SE_LTEQ A(SE_LABK) // ≤ +#define SE_COPY A(SE_1) // © +#define SE_AT A(SE_2) // @ +#define SE_PND A(SE_3) // £ +#define SE_DLR A(SE_4) // $ +#define SE_INFN A(SE_5) // ∞ +#define SE_SECT A(SE_6) // § +#define SE_PIPE A(SE_7) // | +#define SE_LBRC A(SE_8) // [ +#define SE_RBRC A(SE_9) // ] +#define SE_AEQL A(SE_0) // ≈ +#define SE_PLMN A(SE_PLUS) // ± +// Row 2 +#define SE_BULT A(SE_Q) // • +#define SE_OMEG A(SE_W) // Ω +#define SE_EACU A(SE_E) // É +#define SE_REGD A(SE_R) // ® +#define SE_DAGG A(SE_T) // † +#define SE_MICR A(SE_Y) // µ +#define SE_UDIA A(SE_U) // Ü +#define SE_DLSI A(SE_I) // ı +#define SE_OE A(SE_O) // Œ +#define SE_PI A(SE_P) // π +#define SE_DOTA A(SE_ARNG) // ˙ +#define SE_TILD A(SE_DIAE) // ~ (dead) +#define SE_TM A(SE_QUOT) // ™ +// Row 3 +#define SE_APPL A(SE_A) // (Apple logo) +#define SE_SS A(SE_S) // ß +#define SE_PDIF A(SE_D) // ∂ +#define SE_FHK A(SE_F) // ƒ +#define SE_CEDL A(SE_G) // ¸ +#define SE_OGON A(SE_H) // ˛ +#define SE_SQRT A(SE_J) // √ +#define SE_FORD A(SE_K) // ª +#define SE_FI A(SE_L) // fi +#define SE_OSTR A(SE_ODIA) // Ø +#define SE_AE A(SE_ADIA) // Æ +// Row 4 +#define SE_DIV A(SE_Z) // ÷ +#define SE_CCED A(SE_C) // Ç +#define SE_LSAQ A(SE_V) // ‹ +#define SE_RSAQ A(SE_B) // › +#define SE_LSQU A(SE_N) // ‘ +#define SE_RSQU A(SE_M) // ’ +#define SE_SLQU A(SE_COMM) // ‚ +#define SE_ELLP A(SE_DOT) // … +#define SE_NDSH A(SE_MINS) // – + +/* Shift+Alted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ ≥ │ ¡ │ │ ¥ │ ¢ │ ‰ │ ¶ │ \ │ { │ } │ ≠ │ ¿ │ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ ° │ ˝ │ │ │ ‡ │ ˜ │ │ ˆ │ │ ∏ │ ˚ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤ + * │ │ ◊ │ ∑ │ ∆ │ ∫ │ ¯ │ ˘ │ ¬ │ º │ fl │ │ │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴──────┤ + * │ │ ⁄ │ ˇ │ │ « │ » │ “ │ ” │ „ │ · │ — │ │ + * ├─────┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + * + */ +// Row 1 +#define SE_GTEQ S(A(SE_LABK)) // ≥ +#define SE_IEXL S(A(SE_1)) // ¡ +#define SE_YEN S(A(SE_3)) // ¥ +#define SE_CENT S(A(SE_4)) // ¢ +#define SE_PERM S(A(SE_5)) // ‰ +#define SE_PILC S(A(SE_6)) // ¶ +#define SE_BSLS S(A(SE_7)) // (backslash) +#define SE_LCBR S(A(SE_8)) // { +#define SE_RCBR S(A(SE_9)) // } +#define SE_NEQL S(A(SE_0)) // ≠ +#define SE_IQUE S(A(SE_PLUS)) // ¿ +// Row 2 +#define SE_DEG S(A(SE_Q)) // ° +#define SE_DACU S(A(SE_W)) // ˝ +#define SE_DDAG S(A(SE_T)) // ‡ +#define SE_STIL S(A(SE_Y)) // ˜ +#define SE_DCIR S(A(SE_I)) // ˆ +#define SE_NARP S(A(SE_P)) // ∏ +#define SE_RNGA S(A(SE_ARNG)) // ˚ +// Row 3 +#define SE_LOZN S(A(SE_A)) // ◊ +#define SE_NARS S(A(SE_S)) // ∑ +#define SE_INCR S(A(SE_D)) // ∆ +#define SE_INTG S(A(SE_F)) // ∫ +#define SE_MACR S(A(SE_G)) // ¯ +#define SE_BREV S(A(SE_H)) // ˘ +#define SE_NOT S(A(SE_J)) // ¬ +#define SE_MORD S(A(SE_K)) // º +#define SE_FL S(A(SE_L)) // fl +// Row 4 +#define SE_FRSL S(A(SE_Z)) // ⁄ +#define SE_CARN S(A(SE_X)) // ˇ +#define SE_LDAQ S(A(SE_V)) // « +#define SE_RDAQ S(A(SE_B)) // » +#define SE_LDQU S(A(SE_N)) // “ +#define SE_RDQU S(A(SE_M)) // ” +#define SE_DLQU S(A(SE_COMM)) // „ +#define SE_MDDT S(A(SE_DOT)) // · +#define SE_MDSH S(A(SE_MINS)) // — diff --git a/quantum/keymap_extras/keymap_swedish_pro_osx_iso.h b/quantum/keymap_extras/keymap_swedish_pro_osx_iso.h new file mode 100644 index 0000000000..f2d6605865 --- /dev/null +++ b/quantum/keymap_extras/keymap_swedish_pro_osx_iso.h @@ -0,0 +1,239 @@ +/* Copyright 2021 + * + * 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 "keymap.h" + +// clang-format off + +/* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ § │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ + │ ´ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Å │ ¨ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ö │ Ä │ ' │ │ + * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ - │ │ + * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define SE_SECT KC_GRV // § +#define SE_1 KC_1 // 1 +#define SE_2 KC_2 // 2 +#define SE_3 KC_3 // 3 +#define SE_4 KC_4 // 4 +#define SE_5 KC_5 // 5 +#define SE_6 KC_6 // 6 +#define SE_7 KC_7 // 7 +#define SE_8 KC_8 // 8 +#define SE_9 KC_9 // 9 +#define SE_0 KC_0 // 0 +#define SE_PLUS KC_MINS // + +#define SE_ACUT KC_EQL // ´ (dead) +// Row 2 +#define SE_Q KC_Q // Q +#define SE_W KC_W // W +#define SE_E KC_E // E +#define SE_R KC_R // R +#define SE_T KC_T // T +#define SE_Y KC_Y // Y +#define SE_U KC_U // U +#define SE_I KC_I // I +#define SE_O KC_O // O +#define SE_P KC_P // P +#define SE_ARNG KC_LBRC // Å +#define SE_DIAE KC_RBRC // ¨ (dead) +// Row 3 +#define SE_A KC_A // A +#define SE_S KC_S // S +#define SE_D KC_D // D +#define SE_F KC_F // F +#define SE_G KC_G // G +#define SE_H KC_H // H +#define SE_J KC_J // J +#define SE_K KC_K // K +#define SE_L KC_L // L +#define SE_ODIA KC_SCLN // Ö +#define SE_ADIA KC_QUOT // Ä +#define SE_QUOT KC_NUHS // ' +// Row 4 +#define SE_LABK KC_NUBS // < +#define SE_Z KC_Z // Z +#define SE_X KC_X // X +#define SE_C KC_C // C +#define SE_V KC_V // V +#define SE_B KC_B // B +#define SE_N KC_N // N +#define SE_M KC_M // M +#define SE_COMM KC_COMM // , +#define SE_DOT KC_DOT // . +#define SE_MINS KC_SLSH // - + +/* Shifted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ ° │ ! │ " │ # │ € │ % │ & │ / │ ( │ ) │ = │ ? │ ` │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ^ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ * │ │ + * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ + * │ │ > │ │ │ │ │ │ │ │ ; │ : │ _ │ │ + * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define SE_DEG S(SE_SECT) // ° +#define SE_EXLM S(SE_1) // ! +#define SE_DQUO S(SE_2) // " +#define SE_HASH S(SE_3) // # +#define SE_EURO S(SE_4) // € +#define SE_PERC S(SE_5) // % +#define SE_AMPR S(SE_6) // & +#define SE_SLSH S(SE_7) // / +#define SE_LPRN S(SE_8) // ( +#define SE_RPRN S(SE_9) // ) +#define SE_EQL S(SE_0) // = +#define SE_QUES S(SE_PLUS) // ? +#define SE_GRV S(SE_ACUT) // ` +// Row 2 +#define SE_CIRC S(SE_DIAE) // ^ (dead) +// Row 3 +#define SE_ASTR S(SE_QUOT) // * +// Row 4 +#define SE_RABK S(SE_LABK) // > +#define SE_SCLN S(SE_COMM) // ; +#define SE_COLN S(SE_DOT) // : +#define SE_UNDS S(SE_MINS) // _ + +/* Alted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ ¶ │ © │ @ │ £ │ $ │ ∞ │ │ | │ [ │ ] │ ≈ │ ± │ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ • │ Ω │ É │ ® │ † │ µ │ Ü │ ı │ Œ │ π │ ˙ │ ~ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ ß │ ∂ │ ƒ │ ¸ │ ˛ │ √ │ ª │ fi │ Ø │ Æ │ ™ │ │ + * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ + * │ │ ≤ │ ÷ │ │ Ç │ ‹ │ › │ ‘ │ ’ │ ‚ │ … │ – │ │ + * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define SE_PILC A(SE_SECT) // ¶ +#define SE_COPY A(SE_1) // © +#define SE_AT A(SE_2) // @ +#define SE_PND A(SE_3) // £ +#define SE_DLR A(SE_4) // $ +#define SE_INFN A(SE_5) // ∞ +#define SE_PIPE A(SE_7) // | +#define SE_LBRC A(SE_8) // [ +#define SE_RBRC A(SE_9) // ] +#define SE_AEQL A(SE_0) // ≈ +#define SE_PLMN A(SE_PLUS) // ± +// Row 2 +#define SE_BULT A(SE_Q) // • +#define SE_OMEG A(SE_W) // Ω +#define SE_EACU A(SE_E) // É +#define SE_REGD A(SE_R) // ® +#define SE_DAGG A(SE_T) // † +#define SE_MICR A(SE_Y) // µ +#define SE_UDIA A(SE_U) // Ü +#define SE_DLSI A(SE_I) // ı +#define SE_OE A(SE_O) // Œ +#define SE_PI A(SE_P) // π +#define SE_DOTA A(SE_ARNG) // ˙ +#define SE_TILD A(SE_DIAE) // ~ (dead) +// Row 3 +#define SE_APPL A(SE_A) // (Apple logo) +#define SE_SS A(SE_S) // ß +#define SE_PDIF A(SE_D) // ∂ +#define SE_FHK A(SE_F) // ƒ +#define SE_CEDL A(SE_G) // ¸ +#define SE_OGON A(SE_H) // ˛ +#define SE_SQRT A(SE_J) // √ +#define SE_FORD A(SE_K) // ª +#define SE_FI A(SE_L) // fi +#define SE_OSTR A(SE_ODIA) // Ø +#define SE_AE A(SE_ADIA) // Æ +#define SE_TM A(SE_QUOT) // ™ +// Row 4 +#define SE_LTEQ A(SE_LABK) // ≤ +#define SE_DIV A(SE_Z) // ÷ +#define SE_CCED A(SE_C) // Ç +#define SE_LSAQ A(SE_V) // ‹ +#define SE_RSAQ A(SE_B) // › +#define SE_LSQU A(SE_N) // ‘ +#define SE_RSQU A(SE_M) // ’ +#define SE_SLQU A(SE_COMM) // ‚ +#define SE_ELLP A(SE_DOT) // … +#define SE_NDSH A(SE_MINS) // – + +/* Shift+Alted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬─────┐ + * │ │ ¡ │ ” │ ¥ │ ¢ │ ‰ │ │ \ │ { │ } │ ≠ │ ¿ │ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬───┤ + * │ │ │ ˝ │ │ │ ‡ │ ˜ │ │ ˆ │ │ ∏ │ ˚ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ ◊ │ ∑ │ ∆ │ ∫ │ ¯ │ ˘ │ ¬ │ º │ fl │ │ │ │ │ + * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴──┤ + * │ │ ≥ │ ⁄ │ ˇ │ │ « │ » │ “ │ ” │ „ │ · │ — │ │ + * ├────┴┬──┴─┬─┴───┼───┴───┴───┴───┴───┴───┼───┴─┬─┴──┬─────┤ + * │ │ │ │ │ │ │ │ + * └─────┴────┴─────┴───────────────────────┴─────┴────┴─────┘ + */ +// Row 1 +#define SE_IEXL S(A(SE_1)) // ¡ +#define SE_YEN S(A(SE_3)) // ¥ +#define SE_CENT S(A(SE_4)) // ¢ +#define SE_PERM S(A(SE_5)) // ‰ +#define SE_BSLS S(A(SE_7)) // (backslash) +#define SE_LCBR S(A(SE_8)) // { +#define SE_RCBR S(A(SE_9)) // } +#define SE_NEQL S(A(SE_0)) // ≠ +#define SE_IQUE S(A(SE_PLUS)) // ¿ +// Row 2 +#define SE_DACU S(A(SE_W)) // ˝ +#define SE_DDAG S(A(SE_T)) // ‡ +#define SE_STIL S(A(SE_Y)) // ˜ +#define SE_DCIR S(A(SE_I)) // ˆ +#define SE_NARP S(A(SE_P)) // ∏ +#define SE_RNGA S(A(SE_ARNG)) // ˚ +// Row 3 +#define SE_LOZN S(A(SE_A)) // ◊ +#define SE_NARS S(A(SE_S)) // ∑ +#define SE_INCR S(A(SE_D)) // ∆ +#define SE_INTG S(A(SE_F)) // ∫ +#define SE_MACR S(A(SE_G)) // ¯ +#define SE_BREV S(A(SE_H)) // ˘ +#define SE_NOT S(A(SE_J)) // ¬ +#define SE_MORD S(A(SE_K)) // º +#define SE_FL S(A(SE_L)) // fl +// Row 4 +#define SE_GTEQ S(A(SE_LABK)) // ≥ +#define SE_FRSL S(A(SE_Z)) // ⁄ +#define SE_CARN S(A(SE_X)) // ˇ +#define SE_LDAQ S(A(SE_V)) // « +#define SE_RDAQ S(A(SE_B)) // » +#define SE_LDQU S(A(SE_N)) // “ +#define SE_RDQU S(A(SE_M)) // ” +#define SE_DLQU S(A(SE_COMM)) // „ +#define SE_MDDT S(A(SE_DOT)) // · +#define SE_MDSH S(A(SE_MINS)) // — diff --git a/quantum/keymap_extras/keymap_turkish_f.h b/quantum/keymap_extras/keymap_turkish_f.h index acb130c838..226f8cbeb0 100644 --- a/quantum/keymap_extras/keymap_turkish_f.h +++ b/quantum/keymap_extras/keymap_turkish_f.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ + │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ / │ - │ │ + * │ + │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ / │ - │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ F │ G │ Ğ │ I │ O │ D │ R │ N │ H │ P │ Q │ W │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ U │ İ │ E │ A │ Ü │ T │ K │ M │ L │ Y │ Ş │ X │ │ + * │ │ F │ G │ Ğ │ I │ O │ D │ R │ N │ H │ P │ Q │ W │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ U │ İ │ E │ A │ Ü │ T │ K │ M │ L │ Y │ Ş │ X │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ J │ Ö │ V │ C │ Ç │ Z │ S │ B │ . │ , │ │ + * │ │ < │ J │ Ö │ V │ C │ Ç │ Z │ S │ B │ . │ , │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ * │ ! │ " │ ^ │ $ │ % │ & │ ' │ ( │ ) │ = │ ? │ _ │ │ + * │ * │ ! │ " │ ^ │ $ │ % │ & │ ' │ ( │ ) │ = │ ? │ _ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ │ : │ ; │ │ + * │ │ > │ │ │ │ │ │ │ │ │ : │ ; │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -120,15 +120,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ¬ │ ¹ │ ² │ # │ ¼ │ ½ │ ¾ │ { │ [ │ ] │ } │ \ │ | │ │ + * │ ¬ │ ¹ │ ² │ # │ ¼ │ ½ │ ¾ │ { │ [ │ ] │ } │ \ │ | │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ @ │ │ │ ¶ │ │ ¥ │ │ │ Ø │ £ │ ¨ │ ~ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Æ │ ß │ € │ │ │ ₺ │ │ │ │ ´ │ │ ` │ │ + * │ │ @ │ │ │ ¶ │ │ ¥ │ │ │ Ø │ £ │ ¨ │ ~ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Æ │ ß │ € │ │ │ ₺ │ │ │ │ ´ │ │ ` │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ « │ » │ ¢ │ │ │ │ µ │ × │ ÷ │ - │ │ + * │ │ │ « │ » │ ¢ │ │ │ │ µ │ × │ ÷ │ - │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -167,19 +167,19 @@ #define TR_MICR ALGR(TR_S) // µ #define TR_MUL ALGR(TR_B) // × #define TR_DIV ALGR(TR_DOT) // ÷ -#define TR_SHYP ALGR(TR_COMM) // (soft hyphen) +#define TR_SHYP ALGR(TR_COMM) // (soft hyphen) /* Shift+AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ │ ³ │ ¤ │ │ │ │ │ │ │ ¿ │ │ │ + * │ │ │ │ ³ │ ¤ │ │ │ │ │ │ │ ¿ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ ® │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ § │ │ ª │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ ® │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ § │ │ ª │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ ¦ │ │ │ © │ │ │ │ º │ │ │ │ │ + * │ │ ¦ │ │ │ © │ │ │ │ º │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_turkish_q.h b/quantum/keymap_extras/keymap_turkish_q.h index 738718d2d4..120e2b8d92 100644 --- a/quantum/keymap_extras/keymap_turkish_q.h +++ b/quantum/keymap_extras/keymap_turkish_q.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ " │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ * │ - │ │ + * │ " │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ * │ - │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Ğ │ Ü │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ş │ İ │ , │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ Ğ │ Ü │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Ş │ İ │ , │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ Ö │ Ç │ . │ │ + * │ │ < │ Z │ X │ C │ V │ B │ N │ M │ Ö │ Ç │ . │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ é │ ! │ ' │ ^ │ + │ % │ & │ / │ ( │ ) │ = │ ? │ _ │ │ + * │ é │ ! │ ' │ ^ │ + │ % │ & │ / │ ( │ ) │ = │ ? │ _ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ │ │ ; │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ ; │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ > │ │ │ │ │ │ │ │ │ │ : │ │ + * │ │ > │ │ │ │ │ │ │ │ │ │ : │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -121,15 +121,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ │ £ │ # │ $ │ ½ │ │ { │ [ │ ] │ } │ \ │ | │ │ + * │ │ │ £ │ # │ $ │ ½ │ │ { │ [ │ ] │ } │ \ │ | │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ @ │ │ € │ │ ₺ │ │ │ │ │ │ ¨ │ ~ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Æ │ ß │ │ │ │ │ │ │ │ ´ │ │ ` │ │ + * │ │ @ │ │ € │ │ ₺ │ │ │ │ │ │ ¨ │ ~ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Æ │ ß │ │ │ │ │ │ │ │ ´ │ │ ` │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_uk.h b/quantum/keymap_extras/keymap_uk.h index d790179ab3..03fe8149f0 100644 --- a/quantum/keymap_extras/keymap_uk.h +++ b/quantum/keymap_extras/keymap_uk.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ # │ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ # │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ + * │ │ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -88,15 +88,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ¬ │ ! │ " │ £ │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ¬ │ ! │ " │ £ │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ │ │ │ │ │ │ │ │ │ : │ @ │ ~ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ │ │ │ │ │ │ │ │ │ : │ @ │ ~ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ | │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ | │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -128,15 +128,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ¦ │ │ │ │ € │ │ │ │ │ │ │ │ │ │ + * │ ¦ │ │ │ │ € │ │ │ │ │ │ │ │ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ É │ │ │ │ Ú │ Í │ Ó │ │ │ │ │ - * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ - * │ │ Á │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ É │ │ │ │ Ú │ Í │ Ó │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐ │ + * │ │ Á │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ * ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -149,78 +149,3 @@ #define UK_OACU ALGR(KC_O) // Ó // Row 3 #define UK_AACU ALGR(KC_A) // Á - -// DEPRECATED -#define UK_ESC KC_ESC -#define UK_F1 KC_F1 -#define UK_F2 KC_F2 -#define UK_F3 KC_F3 -#define UK_F4 KC_F4 -#define UK_F5 KC_F5 -#define UK_F6 KC_F6 -#define UK_F7 KC_F7 -#define UK_F8 KC_F8 -#define UK_F9 KC_F9 -#define UK_F10 KC_F10 -#define UK_F11 KC_F11 -#define UK_F12 KC_F12 -#define UK_PSCR KC_PSCR -#define UK_SLCK KC_SLCK -#define UK_PAUS KC_PAUS -#define UK_BSPC KC_BSPC -#define UK_TAB KC_TAB -#define UK_ENT KC_ENT -#define UK_LSFT KC_LSFT -#define UK_RSFT KC_RSFT -#define UK_LCTL KC_LCTL -#define UK_LGUI KC_LGUI -#define UK_LALT KC_LALT -#define UK_SPC KC_SPC -#define UK_RALT KC_RALT -#define UK_RGUI KC_RGUI -#define UK_RCTL KC_RCTL -#define UK_INS KC_INS -#define UK_DEL KC_DEL -#define UK_HOME KC_HOME -#define UK_END KC_END -#define UK_PGUP KC_PGUP -#define UK_PGDN KC_PGDN -#define UK_UP KC_UP -#define UK_LEFT KC_LEFT -#define UK_DOWN KC_DOWN -#define UK_RGHT KC_RGHT -#define UK_PSLS KC_PSLS -#define UK_PAST KC_PAST -#define UK_PMNS KC_PMNS -#define UK_PPLS KC_PPLS -#define UK_PENT KC_PENT -#define UK_P1 KC_P1 -#define UK_P2 KC_P2 -#define UK_P3 KC_P3 -#define UK_P4 KC_P4 -#define UK_P5 KC_P5 -#define UK_P6 KC_P6 -#define UK_P7 KC_P7 -#define UK_P8 KC_P8 -#define UK_P9 KC_P9 -#define UK_P0 KC_P0 -#define UK_PDOT KC_PDOT -#define UK_PEQL KC_PEQL -#define UK_PCMM KC_PCMM -#define UK_F13 KC_F13 -#define UK_F14 KC_F14 -#define UK_F15 KC_F15 -#define UK_F16 KC_F16 -#define UK_F17 KC_F17 -#define UK_F18 KC_F18 -#define UK_F19 KC_F19 -#define UK_F20 KC_F20 -#define UK_F21 KC_F21 -#define UK_F22 KC_F22 -#define UK_F23 KC_F23 -#define UK_F24 KC_F24 -#define UK_EACT UK_EACU -#define UK_UACT UK_UACU -#define UK_IACT UK_IACU -#define UK_OACT UK_OACU -#define UK_AACT UK_OACU diff --git a/quantum/keymap_extras/keymap_us_extended.h b/quantum/keymap_extras/keymap_us_extended.h index b2b3a734c9..fb3e9c7d36 100644 --- a/quantum/keymap_extras/keymap_us_extended.h +++ b/quantum/keymap_extras/keymap_us_extended.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ + * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ | │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ | │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ : │ " │ │ + * │ │ │ │ │ │ │ │ │ │ │ : │ " │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -126,15 +126,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ ¹ │ ² │ ³ │ ¤ │ € │ ^ │ ̛ │ ¾ │ ‘ │ ’ │ ¥ │ × │ │ + * │ ` │ ¹ │ ² │ ³ │ ¤ │ € │ ^ │ ̛ │ ¾ │ ‘ │ ’ │ ¥ │ × │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Ä │ Å │ É │ ® │ Þ │ Ü │ Ú │ Í │ Ó │ Ö │ « │ » │ ¬ │ + * │ │ Ä │ Å │ É │ ® │ Þ │ Ü │ Ú │ Í │ Ó │ Ö │ « │ » │ ¬ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ Á │ ß │ Ð │ │ │ │ Ï │ Œ │ Ø │ ¶ │ ' │ │ + * │ │ Á │ ß │ Ð │ │ │ │ Ï │ Œ │ Ø │ ¶ │ ' │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Æ │ │ © │ │ │ Ñ │ µ │ Ç │ ˙ │ ¿ │ │ + * │ │ Æ │ │ © │ │ │ Ñ │ µ │ Ç │ ˙ │ ¿ │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -187,15 +187,15 @@ /* Shift+AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ¡ │ ˝ │ ¯ │ £ │ ¸ │ ¼ │ ½ │ ¾ │ ˘ │ ° │ ̣ │ ÷ │ │ + * │ ~ │ ¡ │ ˝ │ ¯ │ £ │ ¸ │ ¼ │ ½ │ ¾ │ ˘ │ ° │ ̣ │ ÷ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ “ │ ” │ ¦ │ + * │ │ │ │ │ │ │ │ │ │ │ │ “ │ ” │ ¦ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ § │ │ │ │ │ │ │ │ ° │ " │ │ + * │ │ │ § │ │ │ │ │ │ │ │ ° │ " │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ ¢ │ │ │ │ │ │ ˇ │ ̉ │ │ + * │ │ │ │ ¢ │ │ │ │ │ │ ˇ │ ̉ │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -214,7 +214,7 @@ #define US_DIV S(ALGR(US_EQL)) // ÷ // Row 2 #define US_LDQU S(ALGR(US_LBRC)) // “ -#define US_RDQU S(ALGR(US_LBRC)) // ” +#define US_RDQU S(ALGR(US_RBRC)) // ” #define US_BRKP S(ALGR(US_BSLS)) // ¦ // Row 3 #define US_SECT S(ALGR(US_S)) // § diff --git a/quantum/keymap_extras/keymap_us_international.h b/quantum/keymap_extras/keymap_us_international.h index 49afcc4fb2..d491a38f52 100644 --- a/quantum/keymap_extras/keymap_us_international.h +++ b/quantum/keymap_extras/keymap_us_international.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ´ │ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ´ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ + * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ | │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ | │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ : │ ¨ │ │ + * │ │ │ │ │ │ │ │ │ │ │ : │ ¨ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -126,15 +126,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ ¡ │ ² │ ³ │ ¤ │ € │ ¼ │ ½ │ ¾ │ ‘ │ ’ │ ¥ │ × │ │ + * │ │ ¡ │ ² │ ³ │ ¤ │ € │ ¼ │ ½ │ ¾ │ ‘ │ ’ │ ¥ │ × │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Ä │ Å │ É │ ® │ Þ │ Ü │ Ú │ Í │ Ó │ Ö │ « │ » │ ¬ │ + * │ │ Ä │ Å │ É │ ® │ Þ │ Ü │ Ú │ Í │ Ó │ Ö │ « │ » │ ¬ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ Á │ ß │ Ð │ │ │ │ │ │ Ø │ ¶ │ ´ │ │ + * │ │ Á │ ß │ Ð │ │ │ │ │ │ Ø │ ¶ │ ´ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Æ │ │ © │ │ │ Ñ │ µ │ Ç │ │ ¿ │ │ + * │ │ Æ │ │ © │ │ │ Ñ │ µ │ Ç │ │ ¿ │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -181,15 +181,15 @@ /* Shift+AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ │ ¹ │ │ │ £ │ │ │ │ │ │ │ │ ÷ │ │ + * │ │ ¹ │ │ │ £ │ │ │ │ │ │ │ │ ÷ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ │ │ ¦ │ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ ¦ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ § │ │ │ │ │ │ │ │ ° │ ¨ │ │ + * │ │ │ § │ │ │ │ │ │ │ │ ° │ ¨ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ ¢ │ │ │ │ │ │ │ │ │ + * │ │ │ │ ¢ │ │ │ │ │ │ │ │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/keymap_extras/keymap_us_international_linux.h b/quantum/keymap_extras/keymap_us_international_linux.h index 2c3e230393..e0c08200b9 100644 --- a/quantum/keymap_extras/keymap_us_international_linux.h +++ b/quantum/keymap_extras/keymap_us_international_linux.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ + * │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ´ │ │ + * │ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ´ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ + * │ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ | │ + * │ │ │ │ │ │ │ │ │ │ │ │ { │ } │ | │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ : │ ¨ │ │ + * │ │ │ │ │ │ │ │ │ │ │ : │ ¨ │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -126,15 +126,15 @@ /* AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ ¡ │ ² │ ³ │ ¤ │ € │ ¼ │ ½ │ ¾ │ ‘ │ ’ │ ¥ │ × │ │ + * │ ` │ ¡ │ ² │ ³ │ ¤ │ € │ ¼ │ ½ │ ¾ │ ‘ │ ’ │ ¥ │ × │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Ä │ Å │ É │ ® │ Þ │ Ü │ Ú │ Í │ Ó │ Ö │ « │ » │ ¬ │ + * │ │ Ä │ Å │ É │ ® │ Þ │ Ü │ Ú │ Í │ Ó │ Ö │ « │ » │ ¬ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ Á │ ß │ Ð │ │ │ │ │ Œ │ Ø │ ¶ │ ' │ │ + * │ │ Á │ ß │ Ð │ │ │ │ │ Œ │ Ø │ ¶ │ ' │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Æ │ │ © │ │ │ Ñ │ µ │ Ç │ ˙ │ ¿ │ │ + * │ │ Æ │ │ © │ │ │ Ñ │ µ │ Ç │ ˙ │ ¿ │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ @@ -185,15 +185,15 @@ /* Shift+AltGr symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ¹ │ ˝ │ ¯ │ £ │ ¸ │ ^ │ ̛ │ ˛ │ ˘ │ ° │ ̣ │ ÷ │ │ + * │ ~ │ ¹ │ ˝ │ ¯ │ £ │ ¸ │ ^ │ ̛ │ ˛ │ ˘ │ ° │ ̣ │ ÷ │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ “ │ ” │ ¦ │ + * │ │ │ │ │ │ │ │ │ │ │ │ “ │ ” │ ¦ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ § │ │ │ │ │ │ │ │ ° │ " │ │ + * │ │ │ § │ │ │ │ │ │ │ │ ° │ " │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ ¢ │ │ │ │ │ │ ˇ │ ̉ │ │ + * │ │ │ │ ¢ │ │ │ │ │ │ ˇ │ ̉ │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -204,15 +204,15 @@ #define US_PND S(ALGR(US_4)) // £ #define US_CEDL S(ALGR(US_5)) // ¸ (dead) #define US_CIRC S(ALGR(US_6)) // ^ -#define US_HORN S(ALGR(US_7)) // ̛ (dead) +#define US_HORN S(ALGR(US_7)) // ̛ (dead) #define US_OGON S(ALGR(US_8)) // ˛ (dead) #define US_BREV S(ALGR(US_9)) // ˘ (dead) #define US_RNGA S(ALGR(US_0)) // ° (dead) -#define US_DOTB S(ALGR(US_MINS)) // ̣ (dead) +#define US_DOTB S(ALGR(US_MINS)) // ̣ (dead) #define US_DIV S(ALGR(US_EQL)) // ÷ // Row 2 #define US_LDQU S(ALGR(US_LBRC)) // “ -#define US_RDQU S(ALGR(US_LBRC)) // ” +#define US_RDQU S(ALGR(US_RBRC)) // ” #define US_BRKP S(ALGR(US_BSLS)) // ¦ // Row 3 #define US_SECT S(ALGR(US_S)) // § @@ -221,4 +221,4 @@ // Row 4 #define US_CENT S(ALGR(US_C)) // ¢ #define US_CARN S(ALGR(US_DOT)) // ˇ (dead) -#define US_HOKA S(ALGR(US_SLSH)) // ̉ (dead) +#define US_HOKA S(ALGR(US_SLSH)) // ̉ (dead) diff --git a/quantum/keymap_extras/keymap_workman.h b/quantum/keymap_extras/keymap_workman.h index bab1ea1797..6367d68351 100644 --- a/quantum/keymap_extras/keymap_workman.h +++ b/quantum/keymap_extras/keymap_workman.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ D │ R │ W │ B │ J │ F │ U │ P │ ; │ [ │ ] │ \ │ + * │ │ Q │ D │ R │ W │ B │ J │ F │ U │ P │ ; │ [ │ ] │ \ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ A │ S │ H │ T │ G │ Y │ N │ E │ O │ I │ ' │ │ + * │ │ A │ S │ H │ T │ G │ Y │ N │ E │ O │ I │ ' │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Z │ X │ M │ C │ V │ K │ L │ , │ . │ / │ │ + * │ │ Z │ X │ M │ C │ V │ K │ L │ , │ . │ / │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ : │ { │ } │ | │ + * │ │ │ │ │ │ │ │ │ │ │ : │ { │ } │ | │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ " │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ " │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -123,32 +123,3 @@ #define WK_LABK S(WK_COMM) // < #define WK_RABK S(WK_DOT) // > #define WK_QUES S(WK_SLSH) // ? - -// DEPRECATED -#define KC_WK_Q WK_Q -#define KC_WK_D WK_D -#define KC_WK_R WK_R -#define KC_WK_W WK_W -#define KC_WK_B WK_B -#define KC_WK_J WK_J -#define KC_WK_F WK_F -#define KC_WK_U WK_U -#define KC_WK_P WK_P -#define KC_WK_SCLN WK_SCLN -#define KC_WK_A WK_A -#define KC_WK_S WK_S -#define KC_WK_H WK_H -#define KC_WK_T WK_T -#define KC_WK_G WK_G -#define KC_WK_Y WK_Y -#define KC_WK_N WK_N -#define KC_WK_E WK_E -#define KC_WK_O WK_O -#define KC_WK_I WK_I -#define KC_WK_Z WK_Z -#define KC_WK_X WK_X -#define KC_WK_M WK_M -#define KC_WK_C WK_C -#define KC_WK_V WK_V -#define KC_WK_K WK_K -#define KC_WK_L WK_L diff --git a/quantum/keymap_extras/keymap_workman_zxcvm.h b/quantum/keymap_extras/keymap_workman_zxcvm.h index 4ba2ada9e7..01eb83c397 100644 --- a/quantum/keymap_extras/keymap_workman_zxcvm.h +++ b/quantum/keymap_extras/keymap_workman_zxcvm.h @@ -22,15 +22,15 @@ /* * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ Q │ D │ R │ W │ B │ J │ F │ U │ P │ ; │ [ │ ] │ \ │ + * │ │ Q │ D │ R │ W │ B │ J │ F │ U │ P │ ; │ [ │ ] │ \ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ A │ S │ H │ T │ G │ Y │ N │ E │ O │ I │ ' │ │ + * │ │ A │ S │ H │ T │ G │ Y │ N │ E │ O │ I │ ' │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ Z │ X │ C │ V │ M │ K │ L │ , │ . │ / │ │ + * │ │ Z │ X │ C │ V │ M │ K │ L │ , │ . │ / │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 @@ -87,15 +87,15 @@ /* Shifted symbols * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ - * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ - * │ │ │ │ │ │ │ │ │ │ │ : │ { │ } │ | │ + * │ │ │ │ │ │ │ │ │ │ │ : │ { │ } │ | │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │ │ │ │ │ │ │ │ │ │ │ │ " │ │ + * │ │ │ │ │ │ │ │ │ │ │ │ " │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ - * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ + * │ │ │ │ │ │ │ │ │ < │ > │ ? │ │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ - * │ │ │ │ │ │ │ │ │ + * │ │ │ │ │ │ │ │ │ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 diff --git a/quantum/led_matrix_animations/alpha_mods_anim.h b/quantum/led_matrix/animations/alpha_mods_anim.h index 6f69f6892b..14038cd082 100644 --- a/quantum/led_matrix_animations/alpha_mods_anim.h +++ b/quantum/led_matrix/animations/alpha_mods_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_ALPHAS_MODS +#ifdef ENABLE_LED_MATRIX_ALPHAS_MODS LED_MATRIX_EFFECT(ALPHAS_MODS) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS @@ -21,4 +21,4 @@ bool ALPHAS_MODS(effect_params_t* params) { } # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_LED_MATRIX_ALPHAS_MODS +#endif // DISABLE_LED_MATRIX_ALPHAS_MODS diff --git a/quantum/led_matrix_animations/band_anim.h b/quantum/led_matrix/animations/band_anim.h index 523dba1b78..5548787b88 100644 --- a/quantum/led_matrix_animations/band_anim.h +++ b/quantum/led_matrix/animations/band_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_BAND +#ifdef ENABLE_LED_MATRIX_BAND LED_MATRIX_EFFECT(BAND) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS @@ -10,4 +10,4 @@ static uint8_t BAND_math(uint8_t val, uint8_t i, uint8_t time) { bool BAND(effect_params_t* params) { return effect_runner_i(params, &BAND_math); } # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_LED_MATRIX_BAND +#endif // DISABLE_LED_MATRIX_BAND diff --git a/quantum/led_matrix_animations/band_pinwheel_anim.h b/quantum/led_matrix/animations/band_pinwheel_anim.h index fb3b835cad..89651582d5 100644 --- a/quantum/led_matrix_animations/band_pinwheel_anim.h +++ b/quantum/led_matrix/animations/band_pinwheel_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_BAND_PINWHEEL +#ifdef ENABLE_LED_MATRIX_BAND_PINWHEEL LED_MATRIX_EFFECT(BAND_PINWHEEL) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS @@ -7,4 +7,4 @@ static uint8_t BAND_PINWHEEL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t t bool BAND_PINWHEEL(effect_params_t* params) { return effect_runner_dx_dy(params, &BAND_PINWHEEL_math); } # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_LED_MATRIX_BAND_PINWHEEL +#endif // DISABLE_LED_MATRIX_BAND_PINWHEEL diff --git a/quantum/led_matrix_animations/band_spiral_anim.h b/quantum/led_matrix/animations/band_spiral_anim.h index fca22aad9c..70b0ffaea9 100644 --- a/quantum/led_matrix_animations/band_spiral_anim.h +++ b/quantum/led_matrix/animations/band_spiral_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_BAND_SPIRAL +#ifdef ENABLE_LED_MATRIX_BAND_SPIRAL LED_MATRIX_EFFECT(BAND_SPIRAL) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS @@ -7,4 +7,4 @@ static uint8_t BAND_SPIRAL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dis bool BAND_SPIRAL(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_math); } # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_LED_MATRIX_BAND_SPIRAL +#endif // DISABLE_LED_MATRIX_BAND_SPIRAL diff --git a/quantum/led_matrix_animations/breathing_anim.h b/quantum/led_matrix/animations/breathing_anim.h index 00310e3f65..e3f600c45c 100644 --- a/quantum/led_matrix_animations/breathing_anim.h +++ b/quantum/led_matrix/animations/breathing_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_BREATHING +#ifdef ENABLE_LED_MATRIX_BREATHING LED_MATRIX_EFFECT(BREATHING) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS @@ -16,4 +16,4 @@ bool BREATHING(effect_params_t* params) { } # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_LED_MATRIX_BREATHING +#endif // DISABLE_LED_MATRIX_BREATHING diff --git a/quantum/led_matrix_animations/cycle_left_right_anim.h b/quantum/led_matrix/animations/cycle_left_right_anim.h index 51e81d57ca..769e6d7942 100644 --- a/quantum/led_matrix_animations/cycle_left_right_anim.h +++ b/quantum/led_matrix/animations/cycle_left_right_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT +#ifdef ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT LED_MATRIX_EFFECT(CYCLE_LEFT_RIGHT) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS @@ -7,4 +7,4 @@ static uint8_t CYCLE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { ret bool CYCLE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math); } # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT +#endif // DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT diff --git a/quantum/led_matrix_animations/cycle_out_in_anim.h b/quantum/led_matrix/animations/cycle_out_in_anim.h index f62061552c..6adf9c25ff 100644 --- a/quantum/led_matrix_animations/cycle_out_in_anim.h +++ b/quantum/led_matrix/animations/cycle_out_in_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_CYCLE_OUT_IN +#ifdef ENABLE_LED_MATRIX_CYCLE_OUT_IN LED_MATRIX_EFFECT(CYCLE_OUT_IN) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS @@ -7,4 +7,4 @@ static uint8_t CYCLE_OUT_IN_math(uint8_t val, int16_t dx, int16_t dy, uint8_t di bool CYCLE_OUT_IN(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math); } # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_LED_MATRIX_CYCLE_OUT_IN +#endif // DISABLE_LED_MATRIX_CYCLE_OUT_IN diff --git a/quantum/led_matrix_animations/cycle_up_down_anim.h b/quantum/led_matrix/animations/cycle_up_down_anim.h index bd1d125672..7a5868ac26 100644 --- a/quantum/led_matrix_animations/cycle_up_down_anim.h +++ b/quantum/led_matrix/animations/cycle_up_down_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_CYCLE_UP_DOWN +#ifdef ENABLE_LED_MATRIX_CYCLE_UP_DOWN LED_MATRIX_EFFECT(CYCLE_UP_DOWN) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS @@ -7,4 +7,4 @@ static uint8_t CYCLE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { return bool CYCLE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &CYCLE_UP_DOWN_math); } # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_LED_MATRIX_CYCLE_UP_DOWN +#endif // DISABLE_LED_MATRIX_CYCLE_UP_DOWN diff --git a/quantum/led_matrix_animations/dual_beacon_anim.h b/quantum/led_matrix/animations/dual_beacon_anim.h index 9b8a7877c9..3552c9fc39 100644 --- a/quantum/led_matrix_animations/dual_beacon_anim.h +++ b/quantum/led_matrix/animations/dual_beacon_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_DUAL_BEACON +#ifdef ENABLE_LED_MATRIX_DUAL_BEACON LED_MATRIX_EFFECT(DUAL_BEACON) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS @@ -7,4 +7,4 @@ static uint8_t DUAL_BEACON_math(uint8_t val, int8_t sin, int8_t cos, uint8_t i, bool DUAL_BEACON(effect_params_t* params) { return effect_runner_sin_cos_i(params, &DUAL_BEACON_math); } # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_LED_MATRIX_DUAL_BEACON +#endif // DISABLE_LED_MATRIX_DUAL_BEACON diff --git a/quantum/led_matrix/animations/led_matrix_effects.inc b/quantum/led_matrix/animations/led_matrix_effects.inc new file mode 100644 index 0000000000..ad1f46b242 --- /dev/null +++ b/quantum/led_matrix/animations/led_matrix_effects.inc @@ -0,0 +1,18 @@ +// Add your new core led matrix effect here, order determines enum order +#include "solid_anim.h" +#include "alpha_mods_anim.h" +#include "breathing_anim.h" +#include "band_anim.h" +#include "band_pinwheel_anim.h" +#include "band_spiral_anim.h" +#include "cycle_left_right_anim.h" +#include "cycle_up_down_anim.h" +#include "cycle_out_in_anim.h" +#include "dual_beacon_anim.h" +#include "solid_reactive_simple_anim.h" +#include "solid_reactive_wide.h" +#include "solid_reactive_cross.h" +#include "solid_reactive_nexus.h" +#include "solid_splash_anim.h" +#include "wave_left_right_anim.h" +#include "wave_up_down_anim.h" diff --git a/quantum/led_matrix_runners/effect_runner_dx_dy.h b/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h index ef97631b90..ef97631b90 100644 --- a/quantum/led_matrix_runners/effect_runner_dx_dy.h +++ b/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h diff --git a/quantum/led_matrix_runners/effect_runner_dx_dy_dist.h b/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h index 5ef5938be0..5ef5938be0 100644 --- a/quantum/led_matrix_runners/effect_runner_dx_dy_dist.h +++ b/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h diff --git a/quantum/led_matrix_runners/effect_runner_i.h b/quantum/led_matrix/animations/runners/effect_runner_i.h index b3015759be..b3015759be 100644 --- a/quantum/led_matrix_runners/effect_runner_i.h +++ b/quantum/led_matrix/animations/runners/effect_runner_i.h diff --git a/quantum/led_matrix_runners/effect_runner_reactive.h b/quantum/led_matrix/animations/runners/effect_runner_reactive.h index 4369ea8c49..4369ea8c49 100644 --- a/quantum/led_matrix_runners/effect_runner_reactive.h +++ b/quantum/led_matrix/animations/runners/effect_runner_reactive.h diff --git a/quantum/led_matrix_runners/effect_runner_reactive_splash.h b/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h index d6eb9731ee..d6eb9731ee 100644 --- a/quantum/led_matrix_runners/effect_runner_reactive_splash.h +++ b/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h diff --git a/quantum/led_matrix_runners/effect_runner_sin_cos_i.h b/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h index 4a5219abd1..4a5219abd1 100644 --- a/quantum/led_matrix_runners/effect_runner_sin_cos_i.h +++ b/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h diff --git a/quantum/led_matrix/animations/runners/led_matrix_runners.inc b/quantum/led_matrix/animations/runners/led_matrix_runners.inc new file mode 100644 index 0000000000..c09022bb0f --- /dev/null +++ b/quantum/led_matrix/animations/runners/led_matrix_runners.inc @@ -0,0 +1,6 @@ +#include "effect_runner_dx_dy_dist.h" +#include "effect_runner_dx_dy.h" +#include "effect_runner_i.h" +#include "effect_runner_sin_cos_i.h" +#include "effect_runner_reactive.h" +#include "effect_runner_reactive_splash.h" diff --git a/quantum/led_matrix_animations/solid_anim.h b/quantum/led_matrix/animations/solid_anim.h index 4c9e43c581..4c9e43c581 100644 --- a/quantum/led_matrix_animations/solid_anim.h +++ b/quantum/led_matrix/animations/solid_anim.h diff --git a/quantum/led_matrix_animations/solid_reactive_cross.h b/quantum/led_matrix/animations/solid_reactive_cross.h index f402d99b37..3a3c46be13 100644 --- a/quantum/led_matrix_animations/solid_reactive_cross.h +++ b/quantum/led_matrix/animations/solid_reactive_cross.h @@ -1,11 +1,11 @@ #ifdef LED_MATRIX_KEYREACTIVE_ENABLED # if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS) -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS LED_MATRIX_EFFECT(SOLID_REACTIVE_CROSS) # endif -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS) # endif @@ -22,14 +22,14 @@ static uint8_t SOLID_REACTIVE_CROSS_math(uint8_t val, int16_t dx, int16_t dy, ui return qadd8(val, 255 - effect); } -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS bool SOLID_REACTIVE_CROSS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math); } # endif -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); } # endif # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS) -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS) +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix_animations/solid_reactive_nexus.h b/quantum/led_matrix/animations/solid_reactive_nexus.h index 4d0d252263..2520b8e1df 100644 --- a/quantum/led_matrix_animations/solid_reactive_nexus.h +++ b/quantum/led_matrix/animations/solid_reactive_nexus.h @@ -1,11 +1,11 @@ #ifdef LED_MATRIX_KEYREACTIVE_ENABLED -# if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS) +# if defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS) -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS LED_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS) # endif -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS) # endif @@ -19,14 +19,14 @@ static uint8_t SOLID_REACTIVE_NEXUS_math(uint8_t val, int16_t dx, int16_t dy, ui return qadd8(val, 255 - effect); } -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS bool SOLID_REACTIVE_NEXUS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math); } # endif -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); } # endif # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS) -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS) +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix_animations/solid_reactive_simple_anim.h b/quantum/led_matrix/animations/solid_reactive_simple_anim.h index 30e2527f60..43f6ad9ab4 100644 --- a/quantum/led_matrix_animations/solid_reactive_simple_anim.h +++ b/quantum/led_matrix/animations/solid_reactive_simple_anim.h @@ -1,5 +1,5 @@ #ifdef LED_MATRIX_KEYREACTIVE_ENABLED -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE LED_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS @@ -8,5 +8,5 @@ static uint8_t SOLID_REACTIVE_SIMPLE_math(uint8_t val, uint16_t offset) { return bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math); } # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix_animations/solid_reactive_wide.h b/quantum/led_matrix/animations/solid_reactive_wide.h index 34a230c259..d683b02510 100644 --- a/quantum/led_matrix_animations/solid_reactive_wide.h +++ b/quantum/led_matrix/animations/solid_reactive_wide.h @@ -1,11 +1,11 @@ #ifdef LED_MATRIX_KEYREACTIVE_ENABLED # if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE) -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE LED_MATRIX_EFFECT(SOLID_REACTIVE_WIDE) # endif -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE) # endif @@ -17,14 +17,14 @@ static uint8_t SOLID_REACTIVE_WIDE_math(uint8_t val, int16_t dx, int16_t dy, uin return qadd8(val, 255 - effect); } -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE bool SOLID_REACTIVE_WIDE(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math); } # endif -# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE +# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); } # endif # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE) -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE) +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix_animations/solid_splash_anim.h b/quantum/led_matrix/animations/solid_splash_anim.h index 4f6ba3d343..cf599c8fe6 100644 --- a/quantum/led_matrix_animations/solid_splash_anim.h +++ b/quantum/led_matrix/animations/solid_splash_anim.h @@ -1,11 +1,11 @@ #ifdef LED_MATRIX_KEYREACTIVE_ENABLED # if !defined(DISABLE_LED_MATRIX_SOLID_SPLASH) || !defined(DISABLE_LED_MATRIX_SOLID_MULTISPLASH) -# ifndef DISABLE_LED_MATRIX_SOLID_SPLASH +# ifdef ENABLE_LED_MATRIX_SOLID_SPLASH LED_MATRIX_EFFECT(SOLID_SPLASH) # endif -# ifndef DISABLE_LED_MATRIX_SOLID_MULTISPLASH +# ifdef ENABLE_LED_MATRIX_SOLID_MULTISPLASH LED_MATRIX_EFFECT(SOLID_MULTISPLASH) # endif @@ -17,14 +17,14 @@ uint8_t SOLID_SPLASH_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uin return qadd8(val, 255 - effect); } -# ifndef DISABLE_LED_MATRIX_SOLID_SPLASH +# ifdef ENABLE_LED_MATRIX_SOLID_SPLASH bool SOLID_SPLASH(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); } # endif -# ifndef DISABLE_LED_MATRIX_SOLID_MULTISPLASH +# ifdef ENABLE_LED_MATRIX_SOLID_MULTISPLASH bool SOLID_MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); } # endif # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(DISABLE_LED_MATRIX_SPLASH) && !defined(DISABLE_LED_MATRIX_MULTISPLASH) -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // !defined(DISABLE_LED_MATRIX_SPLASH) && !defined(DISABLE_LED_MATRIX_MULTISPLASH) +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix_animations/wave_left_right_anim.h b/quantum/led_matrix/animations/wave_left_right_anim.h index 736f22ddc5..c062cf968e 100644 --- a/quantum/led_matrix_animations/wave_left_right_anim.h +++ b/quantum/led_matrix/animations/wave_left_right_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT +#ifdef ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT LED_MATRIX_EFFECT(WAVE_LEFT_RIGHT) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS @@ -7,4 +7,4 @@ static uint8_t WAVE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { retu bool WAVE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &WAVE_LEFT_RIGHT_math); } # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT +#endif // DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT diff --git a/quantum/led_matrix_animations/wave_up_down_anim.h b/quantum/led_matrix/animations/wave_up_down_anim.h index 3cab0597d4..5e612f6b6d 100644 --- a/quantum/led_matrix_animations/wave_up_down_anim.h +++ b/quantum/led_matrix/animations/wave_up_down_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_LED_MATRIX_WAVE_UP_DOWN +#ifdef ENABLE_LED_MATRIX_WAVE_UP_DOWN LED_MATRIX_EFFECT(WAVE_UP_DOWN) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS @@ -7,4 +7,4 @@ static uint8_t WAVE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { return bool WAVE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &WAVE_UP_DOWN_math); } # endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_LED_MATRIX_WAVE_UP_DOWN +#endif // DISABLE_LED_MATRIX_WAVE_UP_DOWN diff --git a/quantum/led_matrix.c b/quantum/led_matrix/led_matrix.c index 7e0fdf896a..50510e49aa 100644 --- a/quantum/led_matrix.c +++ b/quantum/led_matrix/led_matrix.c @@ -33,20 +33,23 @@ const led_point_t k_led_matrix_center = {112, 32}; const led_point_t k_led_matrix_center = LED_MATRIX_CENTER; #endif +// clang-format off +#ifndef LED_MATRIX_IMMEDIATE_EEPROM +# define led_eeconfig_update(v) led_update_eeprom |= v +#else +# define led_eeconfig_update(v) if (v) eeconfig_update_led_matrix() +#endif +// clang-format on + // Generic effect runners -#include "led_matrix_runners/effect_runner_dx_dy_dist.h" -#include "led_matrix_runners/effect_runner_dx_dy.h" -#include "led_matrix_runners/effect_runner_i.h" -#include "led_matrix_runners/effect_runner_sin_cos_i.h" -#include "led_matrix_runners/effect_runner_reactive.h" -#include "led_matrix_runners/effect_runner_reactive_splash.h" +#include "led_matrix_runners.inc" // ------------------------------------------ // -----Begin led effect includes macros----- #define LED_MATRIX_EFFECT(name) #define LED_MATRIX_CUSTOM_EFFECT_IMPLS -#include "led_matrix_animations/led_matrix_effects.inc" +#include "led_matrix_effects.inc" #ifdef LED_MATRIX_CUSTOM_KB # include "led_matrix_kb.inc" #endif @@ -67,10 +70,6 @@ const led_point_t k_led_matrix_center = LED_MATRIX_CENTER; # define LED_DISABLE_TIMEOUT 0 #endif -#if LED_DISABLE_WHEN_USB_SUSPENDED != 1 -# undef LED_DISABLE_WHEN_USB_SUSPENDED -#endif - #if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX # undef LED_MATRIX_MAXIMUM_BRIGHTNESS # define LED_MATRIX_MAXIMUM_BRIGHTNESS UINT8_MAX @@ -108,6 +107,7 @@ last_hit_t g_last_hit_tracker; // internals static bool suspend_state = false; +static bool led_update_eeprom = false; static uint8_t led_last_enable = UINT8_MAX; static uint8_t led_last_effect = UINT8_MAX; static effect_params_t led_effect_params = {0, LED_FLAG_ALL, false}; @@ -219,7 +219,7 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed) { memcpy(&last_hit_buffer.y[0], &last_hit_buffer.y[led_count], LED_HITS_TO_REMEMBER - led_count); memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit memcpy(&last_hit_buffer.index[0], &last_hit_buffer.index[led_count], LED_HITS_TO_REMEMBER - led_count); - last_hit_buffer.count--; + last_hit_buffer.count = LED_HITS_TO_REMEMBER - led_count; } for (uint8_t i = 0; i < led_count; i++) { @@ -280,6 +280,8 @@ static void led_task_timers(void) { static void led_task_sync(void) { // next task + if (led_update_eeprom) eeconfig_update_led_matrix(); + led_update_eeprom = false; if (sync_timer_elapsed32(g_led_timer) >= LED_MATRIX_LED_FLUSH_LIMIT) led_task_state = STARTING; } @@ -318,7 +320,7 @@ static void led_task_render(uint8_t effect) { case LED_MATRIX_##name: \ rendering = name(&led_effect_params); \ break; -#include "led_matrix_animations/led_matrix_effects.inc" +#include "led_matrix_effects.inc" #undef LED_MATRIX_EFFECT #if defined(LED_MATRIX_CUSTOM_KB) || defined(LED_MATRIX_CUSTOM_USER) @@ -457,8 +459,9 @@ void led_matrix_init(void) { void led_matrix_set_suspend_state(bool state) { #ifdef LED_DISABLE_WHEN_USB_SUSPENDED - if (state) { - led_matrix_set_value_all(0); // turn off all LEDs when suspending + if (state && !suspend_state && is_keyboard_master()) { // only run if turning off, and only once + led_task_render(0); // turn off all LEDs when suspending + led_task_flush(0); // and actually flash led state to LEDs } suspend_state = state; #endif @@ -469,9 +472,7 @@ bool led_matrix_get_suspend_state(void) { return suspend_state; } void led_matrix_toggle_eeprom_helper(bool write_to_eeprom) { led_matrix_eeconfig.enable ^= 1; led_task_state = STARTING; - if (write_to_eeprom) { - eeconfig_update_led_matrix(); - } + led_eeconfig_update(write_to_eeprom); dprintf("led matrix toggle [%s]: led_matrix_eeconfig.enable = %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.enable); } void led_matrix_toggle_noeeprom(void) { led_matrix_toggle_eeprom_helper(false); } @@ -479,7 +480,7 @@ void led_matrix_toggle(void) { led_matrix_toggle_eeprom_helper(true); } void led_matrix_enable(void) { led_matrix_enable_noeeprom(); - eeconfig_update_led_matrix(); + led_eeconfig_update(true); } void led_matrix_enable_noeeprom(void) { @@ -489,7 +490,7 @@ void led_matrix_enable_noeeprom(void) { void led_matrix_disable(void) { led_matrix_disable_noeeprom(); - eeconfig_update_led_matrix(); + led_eeconfig_update(true); } void led_matrix_disable_noeeprom(void) { @@ -511,9 +512,7 @@ void led_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { led_matrix_eeconfig.mode = mode; } led_task_state = STARTING; - if (write_to_eeprom) { - eeconfig_update_led_matrix(); - } + led_eeconfig_update(write_to_eeprom); dprintf("led matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.mode); } void led_matrix_mode_noeeprom(uint8_t mode) { led_matrix_mode_eeprom_helper(mode, false); } @@ -540,9 +539,7 @@ void led_matrix_set_val_eeprom_helper(uint8_t val, bool write_to_eeprom) { return; } led_matrix_eeconfig.val = (val > LED_MATRIX_MAXIMUM_BRIGHTNESS) ? LED_MATRIX_MAXIMUM_BRIGHTNESS : val; - if (write_to_eeprom) { - eeconfig_update_led_matrix(); - } + led_eeconfig_update(write_to_eeprom); dprintf("led matrix set val [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.val); } void led_matrix_set_val_noeeprom(uint8_t val) { led_matrix_set_val_eeprom_helper(val, false); } @@ -560,9 +557,7 @@ void led_matrix_decrease_val(void) { led_matrix_decrease_val_helper(true); } void led_matrix_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) { led_matrix_eeconfig.speed = speed; - if (write_to_eeprom) { - eeconfig_update_led_matrix(); - } + led_eeconfig_update(write_to_eeprom); dprintf("led matrix set speed [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.speed); } void led_matrix_set_speed_noeeprom(uint8_t speed) { led_matrix_set_speed_eeprom_helper(speed, false); } diff --git a/quantum/led_matrix.h b/quantum/led_matrix/led_matrix.h index 0984de73b3..a7a1c983f7 100644 --- a/quantum/led_matrix.h +++ b/quantum/led_matrix/led_matrix.h @@ -23,6 +23,7 @@ #include <stdbool.h> #include "led_matrix_types.h" #include "quantum.h" +#include "led_matrix_legacy_enables.h" #ifdef IS31FL3731 # include "is31fl3731-simple.h" @@ -56,7 +57,7 @@ enum led_matrix_effects { // -------------------------------------- // -----Begin led effect enum macros----- #define LED_MATRIX_EFFECT(name, ...) LED_MATRIX_##name, -#include "led_matrix_animations/led_matrix_effects.inc" +#include "led_matrix_effects.inc" #undef LED_MATRIX_EFFECT #if defined(LED_MATRIX_CUSTOM_KB) || defined(LED_MATRIX_CUSTOM_USER) diff --git a/quantum/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c index 1d46b2c506..1d46b2c506 100644 --- a/quantum/led_matrix_drivers.c +++ b/quantum/led_matrix/led_matrix_drivers.c diff --git a/quantum/led_matrix/led_matrix_legacy_enables.h b/quantum/led_matrix/led_matrix_legacy_enables.h new file mode 100644 index 0000000000..7738d2f34e --- /dev/null +++ b/quantum/led_matrix/led_matrix_legacy_enables.h @@ -0,0 +1,82 @@ +/* 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/>. + */ + +// to-do: remove this + +#pragma once + +#ifndef DISABLE_LED_MATRIX_ALPHAS_MODS +# define ENABLE_LED_MATRIX_ALPHAS_MODS +#endif +#ifndef DISABLE_LED_MATRIX_BREATHING +# define ENABLE_LED_MATRIX_BREATHING +#endif +#ifndef DISABLE_LED_MATRIX_BAND +# define ENABLE_LED_MATRIX_BAND +#endif +#ifndef DISABLE_LED_MATRIX_BAND_PINWHEEL +# define ENABLE_LED_MATRIX_BAND_PINWHEEL +#endif +#ifndef DISABLE_LED_MATRIX_BAND_SPIRAL +# define ENABLE_LED_MATRIX_BAND_SPIRAL +#endif +#ifndef DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT +#endif +#ifndef DISABLE_LED_MATRIX_CYCLE_UP_DOWN +# define ENABLE_LED_MATRIX_CYCLE_UP_DOWN +#endif +#ifndef DISABLE_LED_MATRIX_CYCLE_OUT_IN +# define ENABLE_LED_MATRIX_CYCLE_OUT_IN +#endif +#ifndef DISABLE_LED_MATRIX_DUAL_BEACON +# define ENABLE_LED_MATRIX_DUAL_BEACON +#endif +#if defined(LED_MATRIX_KEYREACTIVE_ENABLED) +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE +# endif +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE +# endif +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE +# endif +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS +# endif +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS +# endif +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS +# endif +# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS +# define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS +# endif +# ifndef DISABLE_LED_MATRIX_SPLASH +# define ENABLE_LED_MATRIX_SPLASH +# endif +# ifndef DISABLE_LED_MATRIX_MULTISPLASH +# define ENABLE_LED_MATRIX_MULTISPLASH +# endif +#endif +#ifndef DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT +# define ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT +#endif +#ifndef DISABLE_LED_MATRIX_WAVE_UP_DOWN +# define ENABLE_LED_MATRIX_WAVE_UP_DOWN +#endif diff --git a/quantum/led_matrix_types.h b/quantum/led_matrix/led_matrix_types.h index 61cdbd9b8e..61cdbd9b8e 100644 --- a/quantum/led_matrix_types.h +++ b/quantum/led_matrix/led_matrix_types.h diff --git a/quantum/led_matrix_animations/led_matrix_effects.inc b/quantum/led_matrix_animations/led_matrix_effects.inc deleted file mode 100644 index 67237c5683..0000000000 --- a/quantum/led_matrix_animations/led_matrix_effects.inc +++ /dev/null @@ -1,18 +0,0 @@ -// Add your new core led matrix effect here, order determins enum order, requires "led_matrix_animations/ directory -#include "led_matrix_animations/solid_anim.h" -#include "led_matrix_animations/alpha_mods_anim.h" -#include "led_matrix_animations/breathing_anim.h" -#include "led_matrix_animations/band_anim.h" -#include "led_matrix_animations/band_pinwheel_anim.h" -#include "led_matrix_animations/band_spiral_anim.h" -#include "led_matrix_animations/cycle_left_right_anim.h" -#include "led_matrix_animations/cycle_up_down_anim.h" -#include "led_matrix_animations/cycle_out_in_anim.h" -#include "led_matrix_animations/dual_beacon_anim.h" -#include "led_matrix_animations/solid_reactive_simple_anim.h" -#include "led_matrix_animations/solid_reactive_wide.h" -#include "led_matrix_animations/solid_reactive_cross.h" -#include "led_matrix_animations/solid_reactive_nexus.h" -#include "led_matrix_animations/solid_splash_anim.h" -#include "led_matrix_animations/wave_left_right_anim.h" -#include "led_matrix_animations/wave_up_down_anim.h" diff --git a/tmk_core/common/debug.c b/quantum/logging/debug.c index ea62deaa8c..ea62deaa8c 100644 --- a/tmk_core/common/debug.c +++ b/quantum/logging/debug.c diff --git a/tmk_core/common/debug.h b/quantum/logging/debug.h index 3d2e2315ef..8415310356 100644 --- a/tmk_core/common/debug.h +++ b/quantum/logging/debug.h @@ -67,7 +67,7 @@ extern debug_config_t debug_config; do { \ if (debug_enable) xprintf(fmt, ##__VA_ARGS__); \ } while (0) -# define dmsg(s) dprintf("%s at %s: %S\n", __FILE__, __LINE__, PSTR(s)) +# define dmsg(s) dprintf("%s at %d: %s\n", __FILE__, __LINE__, s) /* Deprecated. DO NOT USE these anymore, use dprintf instead. */ # define debug(s) \ diff --git a/tmk_core/common/nodebug.h b/quantum/logging/nodebug.h index 0b176684bd..0b176684bd 100644 --- a/tmk_core/common/nodebug.h +++ b/quantum/logging/nodebug.h diff --git a/tmk_core/common/printf.c b/quantum/logging/print.c index e8440e55ee..e8440e55ee 100644 --- a/tmk_core/common/printf.c +++ b/quantum/logging/print.c diff --git a/tmk_core/common/print.h b/quantum/logging/print.h index 48f91e6342..8c055f549e 100644 --- a/tmk_core/common/print.h +++ b/quantum/logging/print.h @@ -47,7 +47,7 @@ void print_set_sendchar(sendchar_func_t func); # define uprintln(s) printf(s "\r\n") # define uprintf printf -# endif /* __AVR__ / PROTOCOL_CHIBIOS / PROTOCOL_ARM_ATSAM */ +# endif /* __has_include_next("_print.h") */ #else /* NO_PRINT */ # undef xprintf // Remove print defines diff --git a/quantum/logging/print.mk b/quantum/logging/print.mk new file mode 100644 index 0000000000..67c004192d --- /dev/null +++ b/quantum/logging/print.mk @@ -0,0 +1,9 @@ +PRINTF_PATH = $(LIB_PATH)/printf + +VPATH += $(PRINTF_PATH) +SRC += $(PRINTF_PATH)/printf.c +QUANTUM_SRC +=$(QUANTUM_DIR)/logging/print.c +OPT_DEFS += -DPRINTF_DISABLE_SUPPORT_FLOAT +OPT_DEFS += -DPRINTF_DISABLE_SUPPORT_EXPONENTIAL +OPT_DEFS += -DPRINTF_DISABLE_SUPPORT_LONG_LONG +OPT_DEFS += -DPRINTF_DISABLE_SUPPORT_PTRDIFF_T diff --git a/tmk_core/common/sendchar_null.c b/quantum/logging/sendchar.c index fb67f70866..9422382f6f 100644 --- a/tmk_core/common/sendchar_null.c +++ b/quantum/logging/sendchar.c @@ -16,4 +16,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "sendchar.h" +/* default noop "null" implementation */ __attribute__((weak)) int8_t sendchar(uint8_t c) { return 0; } diff --git a/tmk_core/common/sendchar.h b/quantum/logging/sendchar.h index edcddaa6bb..edcddaa6bb 100644 --- a/tmk_core/common/sendchar.h +++ b/quantum/logging/sendchar.h diff --git a/quantum/main.c b/quantum/main.c new file mode 100644 index 0000000000..2cbcd73d8f --- /dev/null +++ b/quantum/main.c @@ -0,0 +1,41 @@ +/* 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 "keyboard.h" + +void platform_setup(void); + +void protocol_setup(void); +void protocol_init(void); +void protocol_task(void); + +/** \brief Main + * + * FIXME: Needs doc + */ +int main(void) __attribute__((weak)); +int main(void) { + platform_setup(); + protocol_setup(); + + protocol_init(); + + /* Main loop */ + while (true) { + protocol_task(); + housekeeping_task(); + } +} diff --git a/quantum/matrix.c b/quantum/matrix.c index 34d6af2e6d..33586c431b 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c @@ -16,22 +16,65 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdint.h> #include <stdbool.h> +#include <string.h> #include "util.h" #include "matrix.h" #include "debounce.h" #include "quantum.h" +#ifdef SPLIT_KEYBOARD +# include "split_common/split_util.h" +# include "split_common/transactions.h" + +# define ROWS_PER_HAND (MATRIX_ROWS / 2) +#else +# define ROWS_PER_HAND (MATRIX_ROWS) +#endif + +#ifdef DIRECT_PINS_RIGHT +# define SPLIT_MUTABLE +#else +# define SPLIT_MUTABLE const +#endif +#ifdef MATRIX_ROW_PINS_RIGHT +# define SPLIT_MUTABLE_ROW +#else +# define SPLIT_MUTABLE_ROW const +#endif +#ifdef MATRIX_COL_PINS_RIGHT +# define SPLIT_MUTABLE_COL +#else +# define SPLIT_MUTABLE_COL const +#endif #ifdef DIRECT_PINS -static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS; +static SPLIT_MUTABLE 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; +# ifdef MATRIX_ROW_PINS +static SPLIT_MUTABLE_ROW pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +# endif // MATRIX_ROW_PINS +# ifdef MATRIX_COL_PINS +static SPLIT_MUTABLE_COL pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; +# endif // MATRIX_COL_PINS #endif /* matrix state(1:on, 0:off) */ extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values +#ifdef SPLIT_KEYBOARD +// row offsets for each hand +uint8_t thisHand, thatHand; +#endif + +// user-defined overridable functions +__attribute__((weak)) void matrix_init_pins(void); +__attribute__((weak)) void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row); +__attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col); +#ifdef SPLIT_KEYBOARD +__attribute__((weak)) void matrix_slave_scan_kb(void) { matrix_slave_scan_user(); } +__attribute__((weak)) void matrix_slave_scan_user(void) {} +#endif + static inline void setPinOutput_writeLow(pin_t pin) { ATOMIC_BLOCK_FORCEON { setPinOutput(pin); @@ -43,11 +86,19 @@ static inline void setPinInputHigh_atomic(pin_t pin) { ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } } +static inline uint8_t readMatrixPin(pin_t pin) { + if (pin != NO_PIN) { + return readPin(pin); + } else { + return 1; + } +} + // matrix code #ifdef DIRECT_PINS -static void init_pins(void) { +__attribute__((weak)) void matrix_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]; @@ -58,7 +109,7 @@ static void init_pins(void) { } } -static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { +__attribute__((weak)) void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { // Start with a clear matrix row matrix_row_t current_row_value = 0; @@ -69,46 +120,57 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) } } - // If the row has changed, store the row and return the changed flag. - if (current_matrix[current_row] != current_row_value) { - current_matrix[current_row] = current_row_value; - return true; - } - return false; + // Update the matrix + current_matrix[current_row] = current_row_value; } #elif defined(DIODE_DIRECTION) -# if (DIODE_DIRECTION == COL2ROW) +# if defined(MATRIX_ROW_PINS) && defined(MATRIX_COL_PINS) +# if (DIODE_DIRECTION == COL2ROW) -static void select_row(uint8_t row) { setPinOutput_writeLow(row_pins[row]); } +static bool select_row(uint8_t row) { + pin_t pin = row_pins[row]; + if (pin != NO_PIN) { + setPinOutput_writeLow(pin); + return true; + } + return false; +} -static void unselect_row(uint8_t row) { setPinInputHigh_atomic(row_pins[row]); } +static void unselect_row(uint8_t row) { + pin_t pin = row_pins[row]; + if (pin != NO_PIN) { + setPinInputHigh_atomic(pin); + } +} static void unselect_rows(void) { - for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh_atomic(row_pins[x]); + for (uint8_t x = 0; x < ROWS_PER_HAND; x++) { + unselect_row(x); } } -static void init_pins(void) { +__attribute__((weak)) void matrix_init_pins(void) { unselect_rows(); for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh_atomic(col_pins[x]); + if (col_pins[x] != NO_PIN) { + setPinInputHigh_atomic(col_pins[x]); + } } } -static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { +__attribute__((weak)) void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { // Start with a clear matrix row matrix_row_t current_row_value = 0; - // Select row - select_row(current_row); + if (!select_row(current_row)) { // Select row + return; // skip NO_PIN row + } matrix_output_select_delay(); // 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]); + uint8_t pin_state = readMatrixPin(col_pins[col_index]); // Populate the matrix row with the state of the col pin current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); @@ -116,81 +178,114 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) // Unselect row unselect_row(current_row); - matrix_output_unselect_delay(); // wait for all Col signals to go HIGH + matrix_output_unselect_delay(current_row, current_row_value != 0); // wait for all Col signals to go HIGH - // If the row has changed, store the row and return the changed flag. - if (current_matrix[current_row] != current_row_value) { - current_matrix[current_row] = current_row_value; + // Update the matrix + current_matrix[current_row] = current_row_value; +} + +# elif (DIODE_DIRECTION == ROW2COL) + +static bool select_col(uint8_t col) { + pin_t pin = col_pins[col]; + if (pin != NO_PIN) { + setPinOutput_writeLow(pin); return true; } return false; } -# elif (DIODE_DIRECTION == ROW2COL) - -static void select_col(uint8_t col) { setPinOutput_writeLow(col_pins[col]); } - -static void unselect_col(uint8_t col) { setPinInputHigh_atomic(col_pins[col]); } +static void unselect_col(uint8_t col) { + pin_t pin = col_pins[col]; + if (pin != NO_PIN) { + setPinInputHigh_atomic(pin); + } +} static void unselect_cols(void) { for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh_atomic(col_pins[x]); + unselect_col(x); } } -static void init_pins(void) { +__attribute__((weak)) void matrix_init_pins(void) { unselect_cols(); - for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInputHigh_atomic(row_pins[x]); + for (uint8_t x = 0; x < ROWS_PER_HAND; x++) { + if (row_pins[x] != NO_PIN) { + setPinInputHigh_atomic(row_pins[x]); + } } } -static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { - bool matrix_changed = false; +__attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { + bool key_pressed = false; // Select col - select_col(current_col); + if (!select_col(current_col)) { // select col + return; // skip NO_PIN col + } matrix_output_select_delay(); // 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]; - matrix_row_t current_row_value = last_row_value; - + for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) { // Check row pin state - if (readPin(row_pins[row_index]) == 0) { + if (readMatrixPin(row_pins[row_index]) == 0) { // Pin LO, set col bit - current_row_value |= (MATRIX_ROW_SHIFTER << current_col); + current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col); + key_pressed = true; } else { // Pin HI, clear col bit - current_row_value &= ~(MATRIX_ROW_SHIFTER << current_col); - } - - // Determine if the matrix changed state - if ((last_row_value != current_row_value)) { - matrix_changed |= true; - current_matrix[row_index] = current_row_value; + current_matrix[row_index] &= ~(MATRIX_ROW_SHIFTER << current_col); } } // Unselect col unselect_col(current_col); - matrix_output_unselect_delay(); // wait for all Row signals to go HIGH - - return matrix_changed; + matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH } -# else -# error DIODE_DIRECTION must be one of COL2ROW or ROW2COL! -# endif +# else +# error DIODE_DIRECTION must be one of COL2ROW or ROW2COL! +# endif +# endif // defined(MATRIX_ROW_PINS) && defined(MATRIX_COL_PINS) #else # error DIODE_DIRECTION is not defined! #endif void matrix_init(void) { +#ifdef SPLIT_KEYBOARD + split_pre_init(); + + // Set pinout for right half if pinout for that half is defined + if (!isLeftHand) { +# ifdef DIRECT_PINS_RIGHT + const pin_t direct_pins_right[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS_RIGHT; + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + for (uint8_t j = 0; j < MATRIX_COLS; j++) { + direct_pins[i][j] = direct_pins_right[i][j]; + } + } +# endif +# ifdef MATRIX_ROW_PINS_RIGHT + const pin_t row_pins_right[MATRIX_ROWS] = MATRIX_ROW_PINS_RIGHT; + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + row_pins[i] = row_pins_right[i]; + } +# endif +# ifdef MATRIX_COL_PINS_RIGHT + const pin_t col_pins_right[MATRIX_COLS] = MATRIX_COL_PINS_RIGHT; + for (uint8_t i = 0; i < MATRIX_COLS; i++) { + col_pins[i] = col_pins_right[i]; + } +# endif + } + + thisHand = isLeftHand ? 0 : (ROWS_PER_HAND); + thatHand = ROWS_PER_HAND - thisHand; +#endif + // initialize key pins - init_pins(); + matrix_init_pins(); // initialize matrix state: all keys off for (uint8_t i = 0; i < MATRIX_ROWS; i++) { @@ -198,28 +293,78 @@ void matrix_init(void) { matrix[i] = 0; } - debounce_init(MATRIX_ROWS); + debounce_init(ROWS_PER_HAND); matrix_init_quantum(); + +#ifdef SPLIT_KEYBOARD + split_post_init(); +#endif } -uint8_t matrix_scan(void) { +#ifdef SPLIT_KEYBOARD +// Fallback implementation for keyboards not using the standard split_util.c +__attribute__((weak)) bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + transport_master(master_matrix, slave_matrix); + return true; // Treat the transport as always connected +} + +bool matrix_post_scan(void) { bool changed = false; + if (is_keyboard_master()) { + matrix_row_t slave_matrix[ROWS_PER_HAND] = {0}; + if (transport_master_if_connected(matrix + thisHand, slave_matrix)) { + for (int i = 0; i < ROWS_PER_HAND; ++i) { + if (matrix[thatHand + i] != slave_matrix[i]) { + matrix[thatHand + i] = slave_matrix[i]; + changed = true; + } + } + } else { + // reset other half if disconnected + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[thatHand + i] = 0; + slave_matrix[i] = 0; + } + + changed = true; + } + + matrix_scan_quantum(); + } else { + transport_slave(matrix + thatHand, matrix + thisHand); + + matrix_slave_scan_kb(); + } + + return changed; +} +#endif + +uint8_t matrix_scan(void) { + matrix_row_t curr_matrix[MATRIX_ROWS] = {0}; #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(raw_matrix, current_row); + for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) { + matrix_read_cols_on_row(curr_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(raw_matrix, current_col); + matrix_read_rows_on_col(curr_matrix, current_col); } #endif - debounce(raw_matrix, matrix, MATRIX_ROWS, changed); + bool changed = memcmp(raw_matrix, curr_matrix, sizeof(curr_matrix)) != 0; + if (changed) memcpy(raw_matrix, curr_matrix, sizeof(curr_matrix)); +#ifdef SPLIT_KEYBOARD + debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, changed); + changed = (changed || matrix_post_scan()); +#else + debounce(raw_matrix, matrix, ROWS_PER_HAND, changed); matrix_scan_quantum(); +#endif return (uint8_t)changed; } diff --git a/quantum/matrix.h b/quantum/matrix.h index 3fe691aaee..5c696622fc 100644 --- a/quantum/matrix.h +++ b/quantum/matrix.h @@ -56,7 +56,7 @@ matrix_row_t matrix_get_row(uint8_t row); void matrix_print(void); /* delay between changing matrix pin state and reading values */ void matrix_output_select_delay(void); -void matrix_output_unselect_delay(void); +void matrix_output_unselect_delay(uint8_t line, bool key_pressed); /* only for backwards compatibility. delay between changing matrix pin state and reading values */ void matrix_io_delay(void); diff --git a/quantum/matrix_common.c b/quantum/matrix_common.c index efbad6a5fd..66c89970b1 100644 --- a/quantum/matrix_common.c +++ b/quantum/matrix_common.c @@ -88,7 +88,7 @@ uint8_t matrix_key_count(void) { __attribute__((weak)) void matrix_io_delay(void) { wait_us(MATRIX_IO_DELAY); } __attribute__((weak)) void matrix_output_select_delay(void) { waitInputPinDelay(); } -__attribute__((weak)) void matrix_output_unselect_delay(void) { matrix_io_delay(); } +__attribute__((weak)) void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { matrix_io_delay(); } // CUSTOM MATRIX 'LITE' __attribute__((weak)) void matrix_init_custom(void) {} diff --git a/quantum/mcu_selection.mk b/quantum/mcu_selection.mk index 9268c4522e..f7eaeec8ac 100644 --- a/quantum/mcu_selection.mk +++ b/quantum/mcu_selection.mk @@ -136,10 +136,6 @@ ifneq ($(findstring STM32F042, $(MCU)),) USE_FPU ?= no - # Options to pass to dfu-util when flashing - DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave - DFU_SUFFIX_ARGS ?= -v 0483 -p DF11 - # UF2 settings UF2_FAMILY ?= STM32F0 endif @@ -172,10 +168,6 @@ ifneq ($(findstring STM32F072, $(MCU)),) USE_FPU ?= no - # Options to pass to dfu-util when flashing - DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave - DFU_SUFFIX_ARGS ?= -v 0483 -p DF11 - # UF2 settings UF2_FAMILY ?= STM32F0 endif @@ -208,10 +200,6 @@ ifneq ($(findstring STM32F103, $(MCU)),) USE_FPU ?= no - # Options to pass to dfu-util when flashing - DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave - DFU_SUFFIX_ARGS ?= -v 0483 -p DF11 - # UF2 settings UF2_FAMILY ?= STM32F1 endif @@ -244,10 +232,6 @@ ifneq ($(findstring STM32F303, $(MCU)),) USE_FPU ?= yes - # Options to pass to dfu-util when flashing - DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave - DFU_SUFFIX_ARGS ?= -v 0483 -p DF11 - # UF2 settings UF2_FAMILY ?= STM32F3 endif @@ -268,7 +252,12 @@ ifneq ($(findstring STM32F401, $(MCU)),) # Linker script to use # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ # or <keyboard_dir>/ld/ - MCU_LDSCRIPT ?= STM32F401xC + ifeq ($(strip $(BOOTLOADER)), tinyuf2) + MCU_LDSCRIPT ?= STM32F401xC_tinyuf2 + FIRMWARE_FORMAT ?= uf2 + else + MCU_LDSCRIPT ?= STM32F401xC + endif # Startup code to use # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ @@ -280,9 +269,37 @@ ifneq ($(findstring STM32F401, $(MCU)),) USE_FPU ?= yes - # Options to pass to dfu-util when flashing - DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave - DFU_SUFFIX_ARGS ?= -v 0483 -p DF11 + # UF2 settings + UF2_FAMILY ?= STM32F4 +endif + +ifneq ($(findstring STM32F407, $(MCU)),) + # Cortex version + MCU = cortex-m4 + + # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 + ARMV = 7 + + ## chip/board settings + # - the next two should match the directories in + # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) + MCU_FAMILY = STM32 + MCU_SERIES = STM32F4xx + + # Linker script to use + # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ + # or <keyboard_dir>/ld/ + MCU_LDSCRIPT ?= STM32F407xE + + # Startup code to use + # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ + MCU_STARTUP ?= stm32f4xx + + # Board: it should exist either in <chibios>/os/hal/boards/, + # <keyboard_dir>/boards/, or drivers/boards/ + BOARD ?= GENERIC_STM32_F407XE + + USE_FPU ?= yes # UF2 settings UF2_FAMILY ?= STM32F4 @@ -321,10 +338,6 @@ ifneq ($(findstring STM32F411, $(MCU)),) USE_FPU ?= yes - # Options to pass to dfu-util when flashing - DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave - DFU_SUFFIX_ARGS ?= -v 0483 -p DF11 - # UF2 settings UF2_FAMILY ?= STM32F4 endif @@ -357,10 +370,6 @@ ifneq ($(findstring STM32F446, $(MCU)),) BOARD ?= GENERIC_STM32_F446XE USE_FPU ?= yes - - # Options to pass to dfu-util when flashing - DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave - DFU_SUFFIX_ARGS ?= -v 0483 -p DF11 endif ifneq ($(findstring STM32G431, $(MCU)),) @@ -391,10 +400,6 @@ ifneq ($(findstring STM32G431, $(MCU)),) USE_FPU ?= yes - # Options to pass to dfu-util when flashing - DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave - DFU_SUFFIX_ARGS ?= -v 0483 -p DF11 - # UF2 settings UF2_FAMILY ?= STM32G4 endif @@ -427,10 +432,6 @@ ifneq ($(findstring STM32G474, $(MCU)),) USE_FPU ?= yes - # Options to pass to dfu-util when flashing - DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave - DFU_SUFFIX_ARGS ?= -v 0483 -p DF11 - # UF2 settings UF2_FAMILY ?= STM32G4 endif @@ -465,9 +466,39 @@ ifneq (,$(filter $(MCU),STM32L433 STM32L443)) USE_FPU ?= yes - # Options to pass to dfu-util when flashing - DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave - DFU_SUFFIX_ARGS ?= -v 0483 -p DF11 + # UF2 settings + UF2_FAMILY ?= STM32L4 +endif + +ifneq (,$(filter $(MCU),STM32L412 STM32L422)) + # Cortex version + MCU = cortex-m4 + + # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 + ARMV = 7 + + ## chip/board settings + # - the next two should match the directories in + # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) + MCU_FAMILY = STM32 + MCU_SERIES = STM32L4xx + + # Linker script to use + # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ + # or <keyboard_dir>/ld/ + MCU_LDSCRIPT ?= STM32L412xB + + # Startup code to use + # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ + MCU_STARTUP ?= stm32l4xx + + # Board: it should exist either in <chibios>/os/hal/boards/, + # <keyboard_dir>/boards/, or drivers/boards/ + BOARD ?= GENERIC_STM32_L412XB + + PLATFORM_NAME ?= platform_l432 + + USE_FPU ?= yes # UF2 settings UF2_FAMILY ?= STM32L4 diff --git a/quantum/mousekey.c b/quantum/mousekey.c index 99bfd6b96f..c2291fb397 100644 --- a/quantum/mousekey.c +++ b/quantum/mousekey.c @@ -486,3 +486,5 @@ static void mousekey_debug(void) { print_dec(mousekey_accel); print(")\n"); } + +report_mouse_t mousekey_get_report(void) { return mouse_report; } diff --git a/quantum/mousekey.h b/quantum/mousekey.h index 70dc4bb5c5..56c91b5f1b 100644 --- a/quantum/mousekey.h +++ b/quantum/mousekey.h @@ -168,11 +168,12 @@ extern uint8_t mk_time_to_max; extern uint8_t mk_wheel_max_speed; extern uint8_t mk_wheel_time_to_max; -void mousekey_task(void); -void mousekey_on(uint8_t code); -void mousekey_off(uint8_t code); -void mousekey_clear(void); -void mousekey_send(void); +void mousekey_task(void); +void mousekey_on(uint8_t code); +void mousekey_off(uint8_t code); +void mousekey_clear(void); +void mousekey_send(void); +report_mouse_t mousekey_get_report(void); #ifdef __cplusplus } diff --git a/quantum/process_keycode/process_combo.c b/quantum/process_keycode/process_combo.c index f38d7d47a0..e8661839c7 100644 --- a/quantum/process_keycode/process_combo.c +++ b/quantum/process_keycode/process_combo.c @@ -16,114 +16,449 @@ #include "print.h" #include "process_combo.h" +#include "action_tapping.h" -#ifndef COMBO_VARIABLE_LEN -__attribute__((weak)) combo_t key_combos[COMBO_COUNT] = {}; + +#ifdef COMBO_COUNT +__attribute__((weak)) combo_t key_combos[COMBO_COUNT]; +uint16_t COMBO_LEN = COMBO_COUNT; #else extern combo_t key_combos[]; -extern int COMBO_LEN; +extern uint16_t COMBO_LEN; #endif __attribute__((weak)) void process_combo_event(uint16_t combo_index, bool pressed) {} -static uint16_t timer = 0; -static uint16_t current_combo_index = 0; -static bool drop_buffer = false; -static bool is_active = false; -static bool b_combo_enable = true; // defaults to enabled +#ifdef COMBO_MUST_HOLD_PER_COMBO +__attribute__((weak)) bool get_combo_must_hold(uint16_t index, combo_t *combo) { return false; } +#endif + +#ifdef COMBO_MUST_TAP_PER_COMBO +__attribute__((weak)) bool get_combo_must_tap(uint16_t index, combo_t *combo) { return false; } +#endif + +#ifdef COMBO_TERM_PER_COMBO +__attribute__((weak)) uint16_t get_combo_term(uint16_t index, combo_t *combo) { return COMBO_TERM; } +#endif + +#ifdef COMBO_PROCESS_KEY_RELEASE +__attribute__((weak)) bool process_combo_key_release(uint16_t combo_index, combo_t *combo, uint8_t key_index, uint16_t keycode) { return false; } +#endif -static uint8_t buffer_size = 0; -#ifdef COMBO_ALLOW_ACTION_KEYS -static keyrecord_t key_buffer[MAX_COMBO_LENGTH]; +#ifndef COMBO_NO_TIMER +static uint16_t timer = 0; +#endif +static bool b_combo_enable = true; // defaults to enabled +static uint16_t longest_term = 0; + +typedef struct { + keyrecord_t record; + uint16_t combo_index; + uint16_t keycode; +} queued_record_t; +static uint8_t key_buffer_size = 0; +static queued_record_t key_buffer[COMBO_KEY_BUFFER_LENGTH]; + +typedef struct { + uint16_t combo_index; +} queued_combo_t; +static uint8_t combo_buffer_write= 0; +static uint8_t combo_buffer_read = 0; +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) +# define COMBO_DISABLED(combo) (combo->disabled) +# define COMBO_STATE(combo) (combo->state) + +# define ACTIVATE_COMBO(combo) do {combo->active = true;}while(0) +# define DEACTIVATE_COMBO(combo) do {combo->active = false;}while(0) +# define DISABLE_COMBO(combo) do {combo->disabled = true;}while(0) +# define RESET_COMBO_STATE(combo) do { \ + combo->disabled = false; \ + combo->state = 0; \ +}while(0) #else -static uint16_t key_buffer[MAX_COMBO_LENGTH]; +/* flags are at the two high bits of state. */ +# define COMBO_ACTIVE(combo) (combo->state & 0x80) +# define COMBO_DISABLED(combo) (combo->state & 0x40) +# define COMBO_STATE(combo) (combo->state & 0x3F) + +# define ACTIVATE_COMBO(combo) do {combo->state |= 0x80;}while(0) +# define DEACTIVATE_COMBO(combo) do {combo->state &= ~0x80;}while(0) +# define DISABLE_COMBO(combo) do {combo->state |= 0x40;}while(0) +# define RESET_COMBO_STATE(combo) do {combo->state &= ~0x7F;}while(0) #endif -static inline void send_combo(uint16_t action, bool pressed) { - if (action) { - if (pressed) { - register_code16(action); - } else { - unregister_code16(action); - } +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, + }, + .keycode = combo->keycode, + }; +#ifndef NO_ACTION_TAPPING + action_tapping_process(record); +#else + process_record(&record); +#endif } else { - process_combo_event(current_combo_index, pressed); + process_combo_event(combo_index, false); } + DEACTIVATE_COMBO(combo); +} + +static inline bool _get_combo_must_hold(uint16_t combo_index, combo_t *combo) { +#ifdef COMBO_NO_TIMER + return false; +#elif defined(COMBO_MUST_HOLD_PER_COMBO) + return get_combo_must_hold(combo_index, combo); +#elif defined(COMBO_MUST_HOLD_MODS) + return (KEYCODE_IS_MOD(combo->keycode) || + (combo->keycode >= QK_MOMENTARY && combo->keycode <= QK_MOMENTARY_MAX)); +#endif + return false; +} + +static inline uint16_t _get_wait_time(uint16_t combo_index, combo_t *combo ) { + if (_get_combo_must_hold(combo_index, combo) +#ifdef COMBO_MUST_TAP_PER_COMBO + || get_combo_must_tap(combo_index, combo) +#endif + ) { + if (longest_term < COMBO_HOLD_TERM) { + return COMBO_HOLD_TERM; + } + } + + return longest_term; +} + +static inline uint16_t _get_combo_term(uint16_t combo_index, combo_t *combo) { + +#if defined(COMBO_TERM_PER_COMBO) + return get_combo_term(combo_index, combo); +#endif + + return COMBO_TERM; } -static inline void dump_key_buffer(bool emit) { - if (buffer_size == 0) { +void clear_combos(void) { + uint16_t index = 0; + longest_term = 0; + for (index = 0; index < COMBO_LEN; ++index) { + combo_t *combo = &key_combos[index]; + if (!COMBO_ACTIVE(combo)) { + RESET_COMBO_STATE(combo); + } + } +} + +static inline void dump_key_buffer(void) { + /* First call start from 0 index; recursive calls need to start from i+1 index */ + static uint8_t key_buffer_next = 0; + + if (key_buffer_size == 0) { return; } - if (emit) { - for (uint8_t i = 0; i < buffer_size; i++) { -#ifdef COMBO_ALLOW_ACTION_KEYS - const action_t action = store_or_get_action(key_buffer[i].event.pressed, key_buffer[i].event.key); - process_action(&(key_buffer[i]), action); + for (uint8_t key_buffer_i = key_buffer_next; key_buffer_i < key_buffer_size; key_buffer_i++) { + key_buffer_next = key_buffer_i + 1; + + queued_record_t *qrecord = &key_buffer[key_buffer_i]; + keyrecord_t *record = &qrecord->record; + + if (IS_NOEVENT(record->event)) { + continue; + } + + if (!record->keycode && qrecord->combo_index != (uint16_t)-1) { + process_combo_event(qrecord->combo_index, true); + } else { +#ifndef NO_ACTION_TAPPING + action_tapping_process(*record); #else - register_code16(key_buffer[i]); - send_keyboard_report(); + process_record(record); #endif } + record->event.time = 0; } - buffer_size = 0; + key_buffer_next = key_buffer_size = 0; } -#define ALL_COMBO_KEYS_ARE_DOWN (((1 << count) - 1) == combo->state) -#define KEY_STATE_DOWN(key) \ - do { \ - combo->state |= (1 << key); \ +#define NO_COMBO_KEYS_ARE_DOWN (0 == COMBO_STATE(combo)) +#define ALL_COMBO_KEYS_ARE_DOWN(state, key_count) (((1 << key_count) - 1) == state) +#define ONLY_ONE_KEY_IS_DOWN(state) !(state & (state - 1)) +#define KEY_NOT_YET_RELEASED(state, key_index) ((1 << key_index) & state) +#define KEY_STATE_DOWN(state, key_index) \ + do { \ + state |= (1 << key_index); \ } while (0) -#define KEY_STATE_UP(key) \ - do { \ - combo->state &= ~(1 << key); \ +#define KEY_STATE_UP(state, key_index) \ + do { \ + state &= ~(1 << key_index); \ } while (0) -static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *record) { - uint8_t count = 0; - uint16_t index = -1; - /* Find index of keycode and number of combo keys */ - for (const uint16_t *keys = combo->keys;; ++count) { - uint16_t key = pgm_read_word(&keys[count]); - if (keycode == key) index = count; +static inline void _find_key_index_and_count(const uint16_t *keys, uint16_t keycode, uint16_t *key_index, uint8_t *key_count) { + while (true) { + uint16_t key = pgm_read_word(&keys[*key_count]); + if (keycode == key) *key_index = *key_count; if (COMBO_END == key) break; + (*key_count)++; + } +} + +void drop_combo_from_buffer(uint16_t combo_index) { + /* Mark a combo as processed from the buffer. If the buffer is in the + * beginning of the buffer, drop it. */ + uint8_t i = combo_buffer_read; + while (i != combo_buffer_write) { + queued_combo_t *qcombo = &combo_buffer[i]; + + if (qcombo->combo_index == combo_index) { + combo_t *combo = &key_combos[combo_index]; + DISABLE_COMBO(combo); + + if (i == combo_buffer_read) { + INCREMENT_MOD(combo_buffer_read); + } + break; + } + INCREMENT_MOD(i); } +} + +void apply_combo(uint16_t combo_index, combo_t *combo) { + /* Apply combo's result keycode to the last chord key of the combo and + * disable the other keys. */ - /* Continue processing if not a combo key */ - if (-1 == (int8_t)index) return false; + if (COMBO_DISABLED(combo)) { return; } - bool is_combo_active = is_active; + // state to check against so we find the last key of the combo from the buffer +#if defined(EXTRA_EXTRA_LONG_COMBOS) + uint32_t state = 0; +#elif defined(EXTRA_LONG_COMBOS) + uint16_t state = 0; +#else + uint8_t state = 0; +#endif + + for (uint8_t key_buffer_i = 0; key_buffer_i < key_buffer_size; key_buffer_i++) { + + queued_record_t *qrecord = &key_buffer[key_buffer_i]; + keyrecord_t *record = &qrecord->record; + uint16_t keycode = qrecord->keycode; + + uint8_t key_count = 0; + uint16_t key_index = -1; + _find_key_index_and_count(combo->keys, keycode, &key_index, &key_count); + + if (-1 == (int16_t)key_index) { + // key not part of this combo + continue; + } - if (record->event.pressed) { - KEY_STATE_DOWN(index); + KEY_STATE_DOWN(state, key_index); + 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; - if (is_combo_active) { - if (ALL_COMBO_KEYS_ARE_DOWN) { /* Combo was pressed */ - send_combo(combo->keycode, true); - drop_buffer = true; + qrecord->combo_index = combo_index; + ACTIVATE_COMBO(combo); + + break; + } else { + // key was part of the combo but not the last one, "disable" it + // by making it a TICK event. + record->event.time = 0; + } + + } + drop_combo_from_buffer(combo_index); +} + +static inline void apply_combos(void) { + // Apply all buffered normal combos. + for (uint8_t i = combo_buffer_read; + i != combo_buffer_write; + INCREMENT_MOD(i)) { + + queued_combo_t *buffered_combo = &combo_buffer[i]; + combo_t *combo = &key_combos[buffered_combo->combo_index]; + +#ifdef COMBO_MUST_TAP_PER_COMBO + if (get_combo_must_tap(buffered_combo->combo_index, combo)) { + // Tap-only combos are applied on key release only, so let's drop 'em here. + drop_combo_from_buffer(buffered_combo->combo_index); + continue; + } +#endif + apply_combo(buffered_combo->combo_index, combo); + } + dump_key_buffer(); + clear_combos(); +} + +combo_t* overlaps(combo_t *combo1, combo_t *combo2) { + /* Checks if the combos overlap and returns the combo that should be + * dropped from the combo buffer. + * The combo that has less keys will be dropped. If they have the same + * amount of keys, drop combo1. */ + + uint8_t idx1 = 0, idx2 = 0; + uint16_t key1, key2; + bool overlaps = false; + + while ((key1 = pgm_read_word(&combo1->keys[idx1])) != COMBO_END) { + idx2 = 0; + while ((key2 = pgm_read_word(&combo2->keys[idx2])) != COMBO_END) { + if (key1 == key2) overlaps = true; + idx2 += 1; + } + idx1 += 1; + } + + if (!overlaps) return NULL; + if (idx2 < idx1) return combo2; + return combo1; +} + +static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *record, uint16_t combo_index) { + uint8_t key_count = 0; + uint16_t key_index = -1; + _find_key_index_and_count(combo->keys, keycode, &key_index, &key_count); + + /* Continue processing if key isn't part of current combo. */ + if (-1 == (int16_t)key_index) { + return false; + } + + bool key_is_part_of_combo = !COMBO_DISABLED(combo) && is_combo_enabled(); + + if (record->event.pressed && key_is_part_of_combo) { + uint16_t time = _get_combo_term(combo_index, combo); + if (!COMBO_ACTIVE(combo)) { + KEY_STATE_DOWN(combo->state, key_index); + if (longest_term < time) { + longest_term = time; } } + if (ALL_COMBO_KEYS_ARE_DOWN(COMBO_STATE(combo), key_count)) { + /* Combo was fully pressed */ + /* Buffer the combo so we can fire it after COMBO_TERM */ + +#ifndef COMBO_NO_TIMER + /* Don't buffer this combo if its combo term has passed. */ + if (timer && timer_elapsed(timer) > time) { + DISABLE_COMBO(combo); + return true; + } else +#endif + { + + // disable readied combos that overlap with this combo + combo_t *drop = NULL; + for (uint8_t combo_buffer_i = combo_buffer_read; + combo_buffer_i != combo_buffer_write; + INCREMENT_MOD(combo_buffer_i)) { + + queued_combo_t *qcombo = &combo_buffer[combo_buffer_i]; + combo_t *buffered_combo = &key_combos[qcombo->combo_index]; + + if ((drop = overlaps(buffered_combo, combo))) { + DISABLE_COMBO(drop); + if (drop == combo) { + // stop checking for overlaps if dropped combo was current combo. + break; + } else if (combo_buffer_i == combo_buffer_read && drop == buffered_combo) { + /* Drop the disabled buffered combo from the buffer if + * it is in the beginning of the buffer. */ + INCREMENT_MOD(combo_buffer_read); + } + } + + } + + if (drop != combo) { + // save this combo to buffer + combo_buffer[combo_buffer_write] = (queued_combo_t){ + .combo_index=combo_index, + }; + INCREMENT_MOD(combo_buffer_write); + + // get possible longer waiting time for tap-/hold-only combos. + longest_term = _get_wait_time(combo_index, combo); + } + } // if timer elapsed end + + } } else { - if (ALL_COMBO_KEYS_ARE_DOWN) { /* Combo was released */ - send_combo(combo->keycode, false); + // chord releases + if (!COMBO_ACTIVE(combo) && ALL_COMBO_KEYS_ARE_DOWN(COMBO_STATE(combo), key_count)) { + /* First key quickly released */ + if (COMBO_DISABLED(combo) || _get_combo_must_hold(combo_index, combo)) { + // combo wasn't tappable, disable it and drop it from buffer. + drop_combo_from_buffer(combo_index); + key_is_part_of_combo = false; + } +#ifdef COMBO_MUST_TAP_PER_COMBO + else if (get_combo_must_tap(combo_index, combo)) { + // immediately apply tap-only combo + apply_combo(combo_index, combo); + apply_combos(); // also apply other prepared combos and dump key buffer +# ifdef COMBO_PROCESS_KEY_RELEASE + if (process_combo_key_release(combo_index, combo, key_index, keycode)) { + release_combo(combo_index, combo); + } +# endif + } +#endif + } else if (COMBO_ACTIVE(combo) + && ONLY_ONE_KEY_IS_DOWN(COMBO_STATE(combo)) + && KEY_NOT_YET_RELEASED(COMBO_STATE(combo), key_index) + ) { + /* last key released */ + release_combo(combo_index, combo); + key_is_part_of_combo = true; + +#ifdef COMBO_PROCESS_KEY_RELEASE + process_combo_key_release(combo_index, combo, key_index, keycode); +#endif + } else if (COMBO_ACTIVE(combo) + && KEY_NOT_YET_RELEASED(COMBO_STATE(combo), key_index) + ) { + /* first or middle key released */ + key_is_part_of_combo = true; + +#ifdef COMBO_PROCESS_KEY_RELEASE + if (process_combo_key_release(combo_index, combo, key_index, keycode)) { + release_combo(combo_index, combo); + } +#endif } else { - /* continue processing without immediately returning */ - is_combo_active = false; + /* The released key was part of an incomplete combo */ + key_is_part_of_combo = false; } - KEY_STATE_UP(index); + KEY_STATE_UP(combo->state, key_index); } - return is_combo_active; + return key_is_part_of_combo; } -#define NO_COMBO_KEYS_ARE_DOWN (0 == combo->state) - bool process_combo(uint16_t keycode, keyrecord_t *record) { bool is_combo_key = false; - drop_buffer = false; bool no_combo_keys_pressed = true; if (keycode == CMB_ON && record->event.pressed) { @@ -141,65 +476,82 @@ bool process_combo(uint16_t keycode, keyrecord_t *record) { return true; } - if (!is_combo_enabled()) { - return true; - } -#ifndef COMBO_VARIABLE_LEN - for (current_combo_index = 0; current_combo_index < COMBO_COUNT; ++current_combo_index) { -#else - for (current_combo_index = 0; current_combo_index < COMBO_LEN; ++current_combo_index) { +#ifdef COMBO_ONLY_FROM_LAYER + /* Only check keycodes from one layer. */ + keycode = keymap_key_to_keycode(COMBO_ONLY_FROM_LAYER, record->event.key); #endif - combo_t *combo = &key_combos[current_combo_index]; - is_combo_key |= process_single_combo(combo, keycode, record); - no_combo_keys_pressed = no_combo_keys_pressed && NO_COMBO_KEYS_ARE_DOWN; + + for (uint16_t idx = 0; idx < COMBO_LEN; ++idx) { + combo_t *combo = &key_combos[idx]; + is_combo_key |= process_single_combo(combo, keycode, record, idx); + no_combo_keys_pressed = no_combo_keys_pressed && (NO_COMBO_KEYS_ARE_DOWN || COMBO_ACTIVE(combo) || COMBO_DISABLED(combo)); } - if (drop_buffer) { - /* buffer is only dropped when we complete a combo, so we refresh the timer - * here */ - timer = timer_read(); - dump_key_buffer(false); - } else if (!is_combo_key) { - /* if no combos claim the key we need to emit the keybuffer */ - dump_key_buffer(true); - - // reset state if there are no combo keys pressed at all - if (no_combo_keys_pressed) { - timer = 0; - is_active = true; - } - } else if (record->event.pressed && is_active) { - /* otherwise the key is consumed and placed in the buffer */ + if (record->event.pressed && is_combo_key) { +#ifndef COMBO_NO_TIMER +# ifdef COMBO_STRICT_TIMER + if (!timer) { + // timer is set only on the first key + timer = timer_read(); + } +# else timer = timer_read(); +# endif +#endif - if (buffer_size < MAX_COMBO_LENGTH) { -#ifdef COMBO_ALLOW_ACTION_KEYS - key_buffer[buffer_size++] = *record; -#else - key_buffer[buffer_size++] = keycode; + if (key_buffer_size < COMBO_KEY_BUFFER_LENGTH) { + key_buffer[key_buffer_size++] = (queued_record_t){ + .record = *record, + .keycode = keycode, + .combo_index = -1, // this will be set when applying combos + }; + } + } else { + if (combo_buffer_read != combo_buffer_write) { + // some combo is prepared + apply_combos(); + } else { + // reset state if there are no combo keys pressed at all + dump_key_buffer(); +#ifndef COMBO_NO_TIMER + timer = 0; #endif + clear_combos(); } } - return !is_combo_key; } -void matrix_scan_combo(void) { - if (b_combo_enable && is_active && timer && timer_elapsed(timer) > COMBO_TERM) { - /* This disables the combo, meaning key events for this - * combo will be handled by the next processors in the chain - */ - is_active = false; - dump_key_buffer(true); +void combo_task(void) { + if (!b_combo_enable) { + return; } + +#ifndef COMBO_NO_TIMER + if (timer && timer_elapsed(timer) > longest_term) { + if (combo_buffer_read != combo_buffer_write) { + apply_combos(); + longest_term = 0; + timer = 0; + } else { + dump_key_buffer(); + timer = 0; + clear_combos(); + } + } +#endif } void combo_enable(void) { b_combo_enable = true; } void combo_disable(void) { - b_combo_enable = is_active = false; +#ifndef COMBO_NO_TIMER timer = 0; - dump_key_buffer(true); +#endif + b_combo_enable = false; + combo_buffer_read = combo_buffer_write; + clear_combos(); + dump_key_buffer(); } void combo_toggle(void) { diff --git a/quantum/process_keycode/process_combo.h b/quantum/process_keycode/process_combo.h index e51a2f1f4e..43c36d79e6 100644 --- a/quantum/process_keycode/process_combo.h +++ b/quantum/process_keycode/process_combo.h @@ -20,23 +20,38 @@ #include "quantum.h" #include <stdint.h> -#ifdef EXTRA_EXTRA_LONG_COMBOS +#ifdef EXTRA_SHORT_COMBOS +# define MAX_COMBO_LENGTH 6 +#elif defined(EXTRA_EXTRA_LONG_COMBOS) # define MAX_COMBO_LENGTH 32 -#elif EXTRA_LONG_COMBOS +#elif defined(EXTRA_LONG_COMBOS) # define MAX_COMBO_LENGTH 16 #else # define MAX_COMBO_LENGTH 8 #endif +#ifndef COMBO_KEY_BUFFER_LENGTH +# define COMBO_KEY_BUFFER_LENGTH MAX_COMBO_LENGTH +#endif +#ifndef COMBO_BUFFER_LENGTH +# define COMBO_BUFFER_LENGTH 4 +#endif + typedef struct { const uint16_t *keys; uint16_t keycode; -#ifdef EXTRA_EXTRA_LONG_COMBOS +#ifdef EXTRA_SHORT_COMBOS + uint8_t state; +#else + bool disabled; + bool active; +# if defined(EXTRA_EXTRA_LONG_COMBOS) uint32_t state; -#elif EXTRA_LONG_COMBOS +# elif defined(EXTRA_LONG_COMBOS) uint16_t state; -#else +# else uint8_t state; +# endif #endif } combo_t; @@ -46,15 +61,18 @@ typedef struct { { .keys = &(ck)[0] } #define COMBO_END 0 -#ifndef COMBO_COUNT -# define COMBO_COUNT 0 -#endif #ifndef COMBO_TERM -# define COMBO_TERM TAPPING_TERM +# define COMBO_TERM 50 #endif +#ifndef COMBO_HOLD_TERM +# define COMBO_HOLD_TERM TAPPING_TERM +#endif + +/* check if keycode is only modifiers */ +#define KEYCODE_IS_MOD(code) (IS_MOD(code) || (code >= QK_MODS && code <= QK_MODS_MAX && !(code & QK_BASIC_MAX))) bool process_combo(uint16_t keycode, keyrecord_t *record); -void matrix_scan_combo(void); +void combo_task(void); void process_combo_event(uint16_t combo_index, bool pressed); void combo_enable(void); diff --git a/quantum/process_keycode/process_haptic.c b/quantum/process_keycode/process_haptic.c new file mode 100644 index 0000000000..64d455d009 --- /dev/null +++ b/quantum/process_keycode/process_haptic.c @@ -0,0 +1,148 @@ +/* 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 "haptic.h" +#include "process_haptic.h" +#include "quantum_keycodes.h" +#include "action_tapping.h" + +__attribute__((weak)) bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { +#ifdef NO_HAPTIC_MOD + case QK_MOD_TAP ... QK_MOD_TAP_MAX: + if (record->tap.count == 0) return false; + break; + case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX: + if (record->tap.count != TAPPING_TOGGLE) return false; + break; + case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: + if (record->tap.count == 0) return false; + break; + case KC_LCTRL ... KC_RGUI: + case QK_MOMENTARY ... QK_MOMENTARY_MAX: +#endif +#ifdef NO_HAPTIC_FN + case KC_FN0 ... KC_FN31: +#endif +#ifdef NO_HAPTIC_ALPHA + case KC_A ... KC_Z: +#endif +#ifdef NO_HAPTIC_PUNCTUATION + case KC_ENTER: + case KC_ESCAPE: + case KC_BSPACE: + case KC_SPACE: + case KC_MINUS: + case KC_EQUAL: + case KC_LBRACKET: + case KC_RBRACKET: + case KC_BSLASH: + case KC_NONUS_HASH: + case KC_SCOLON: + case KC_QUOTE: + case KC_GRAVE: + case KC_COMMA: + case KC_SLASH: + case KC_DOT: + case KC_NONUS_BSLASH: +#endif +#ifdef NO_HAPTIC_LOCKKEYS + case KC_CAPSLOCK: + case KC_SCROLLLOCK: + case KC_NUMLOCK: +#endif +#ifdef NO_HAPTIC_NAV + case KC_PSCREEN: + case KC_PAUSE: + case KC_INSERT: + case KC_DELETE: + case KC_PGDOWN: + case KC_PGUP: + case KC_LEFT: + case KC_UP: + case KC_RIGHT: + case KC_DOWN: + case KC_END: + case KC_HOME: +#endif +#ifdef NO_HAPTIC_NUMERIC + case KC_1 ... KC_0: +#endif + return false; + } + return true; +} + +bool process_haptic(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + switch (keycode) { + case HPT_ON: + haptic_enable(); + break; + case HPT_OFF: + haptic_disable(); + break; + case HPT_TOG: + haptic_toggle(); + break; + case HPT_RST: + haptic_reset(); + break; + case HPT_FBK: + haptic_feedback_toggle(); + break; + case HPT_BUZ: + haptic_buzz_toggle(); + break; + case HPT_MODI: + haptic_mode_increase(); + break; + case HPT_MODD: + haptic_mode_decrease(); + break; + case HPT_DWLI: + haptic_dwell_increase(); + break; + case HPT_DWLD: + haptic_dwell_decrease(); + break; + case HPT_CONT: + haptic_toggle_continuous(); + break; + case HPT_CONI: + haptic_cont_increase(); + break; + case HPT_COND: + haptic_cont_decrease(); + break; + } + } + + if (haptic_get_enable()) { + if (record->event.pressed) { + // keypress + if (haptic_get_feedback() < 2 && get_haptic_enabled_key(keycode, record)) { + haptic_play(); + } + } else { + // keyrelease + if (haptic_get_feedback() > 0 && get_haptic_enabled_key(keycode, record)) { + haptic_play(); + } + } + } + + return true; +} diff --git a/quantum/process_keycode/process_haptic.h b/quantum/process_keycode/process_haptic.h new file mode 100644 index 0000000000..6dbb0f014d --- /dev/null +++ b/quantum/process_keycode/process_haptic.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 <stdbool.h> +#include "action.h" + +bool process_haptic(uint16_t keycode, keyrecord_t *record); diff --git a/quantum/process_keycode/process_key_override.c b/quantum/process_keycode/process_key_override.c new file mode 100644 index 0000000000..09b2725079 --- /dev/null +++ b/quantum/process_keycode/process_key_override.c @@ -0,0 +1,518 @@ +/* + * Copyright 2021 Jonas Gessner + * + * 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 "quantum.h" +#include "report.h" +#include "timer.h" +#include "process_key_override.h" + +#include <debug.h> + +#ifndef KEY_OVERRIDE_REPEAT_DELAY +# define KEY_OVERRIDE_REPEAT_DELAY 500 +#endif + +// For benchmarking the time it takes to call process_key_override on every key press (needs keyboard debugging enabled as well) +// #define BENCH_KEY_OVERRIDE + +// For debug output (needs keyboard debugging enabled as well) +// #define DEBUG_KEY_OVERRIDE + +#ifdef DEBUG_KEY_OVERRIDE +# define key_override_printf dprintf +#else +# define key_override_printf(str, ...) \ + {} +#endif + +// Helpers + +// Private functions implemented elsewhere in qmk/tmk +extern uint8_t extract_mod_bits(uint16_t code); +extern void set_weak_override_mods(uint8_t mods); +extern void clear_weak_override_mods(void); +extern void set_suppressed_override_mods(uint8_t mods); +extern void clear_suppressed_override_mods(void); + +static uint16_t clear_mods_from(uint16_t keycode) { + switch (keycode) { + case QK_MODS ... QK_MODS_MAX: + break; + default: + return keycode; + } + + static const uint16_t all_mods = QK_LCTL | QK_LSFT | QK_LALT | QK_LGUI | QK_RCTL | QK_RSFT | QK_RALT | QK_RGUI; + + return (keycode & ~(all_mods)); +} + +// Internal variables +static const key_override_t *active_override = NULL; +static bool active_override_trigger_is_down = false; + +// Used to keep track of what non-modifier key was last pressed down. We never want to activate an override for a trigger key that is not the last non-mod key that was pressed down. OSes internally completely unregister a key that is held when a different key is held down after. We want to respect this here. +static uint16_t last_key_down = 0; +// When was the last key pressed down? +static uint32_t last_key_down_time = 0; + +// What timestamp are we comparing to when waiting to register a deferred key? +static uint32_t defer_reference_time = 0; +// What delay should pass until deferred key is registered? +static uint32_t defer_delay = 0; + +// Holds the keycode that should be registered at a later time, in order to not get false key presses +static uint16_t deferred_register = 0; + +// TODO: in future maybe save in EEPROM? +static bool enabled = true; + +// Public variables +__attribute__((weak)) const key_override_t **key_overrides = NULL; + +// Forward decls +static const key_override_t *clear_active_override(const bool allow_reregister); + +void key_override_on(void) { + enabled = true; + key_override_printf("Key override ON\n"); +} + +void key_override_off(void) { + enabled = false; + clear_active_override(false); + key_override_printf("Key override OFF\n"); +} + +void key_override_toggle(void) { + if (key_override_is_enabled()) { + key_override_off(); + } else { + key_override_on(); + } +} + +bool key_override_is_enabled(void) { return enabled; } + +// Returns whether the modifiers that are pressed are such that the override should activate +static bool key_override_matches_active_modifiers(const key_override_t *override, const uint8_t mods) { + // Check that negative keys pass + if ((override->negative_mod_mask & mods) != 0) { + return false; + } + + // Immediately return true if the override requires no mods down + if (override->trigger_mods == 0) { + return true; + } + + if ((override->options & ko_option_one_mod) != 0) { + // At least one of the trigger modifiers must be down + return (override->trigger_mods & mods) != 0; + } else { + // All trigger modifiers must be down, but each mod can be active on either side (if both sides are specified). + + // Which mods, regardless of side, are required? + uint8_t one_sided_required_mods = (override->trigger_mods & 0b1111) | (override->trigger_mods >> 4); + + // Which of the required modifiers are active? + uint8_t active_required_mods = override->trigger_mods & mods; + + // Move the active requird mods to one side + uint8_t one_sided_active_required_mods = (active_required_mods & 0b1111) | (active_required_mods >> 4); + + // Check that there is a full match between the required one-sided mods and active required one sided mods + return one_sided_active_required_mods == one_sided_required_mods; + } + + return false; +} + +static void schedule_deferred_register(const uint16_t keycode) { + if (timer_elapsed32(last_key_down_time) < KEY_OVERRIDE_REPEAT_DELAY) { + // Defer until KEY_OVERRIDE_REPEAT_DELAY has passed since the trigger key was pressed down. This emulates the behavior as holding down a key x, then holding down shift shortly after. Usually the shifted key X is not immediately produced, but rather a 'key repeat delay' passes before any repeated character is output. + defer_reference_time = last_key_down_time; + defer_delay = KEY_OVERRIDE_REPEAT_DELAY; + } else { + // Wait a very short time when a modifier event triggers the override to avoid false activations when e.g. a modifier is pressed just before a key is released (with the intention of pairing the modifier with a different key), or a modifier is lifted shortly before the trigger key is lifted. Operating systems by default reject modifier-events that happen very close to a non-modifier event. + defer_reference_time = timer_read32(); + defer_delay = 50; // 50ms + } + deferred_register = keycode; +} + +const key_override_t *clear_active_override(const bool allow_reregister) { + if (active_override == NULL) { + return NULL; + } + + key_override_printf("Deactivating override\n"); + + deferred_register = 0; + + // Clear the suppressed mods + clear_suppressed_override_mods(); + + // Unregister the replacement. First remove the weak override mods + clear_weak_override_mods(); + + const key_override_t *const old = active_override; + + const uint8_t mod_free_replacement = clear_mods_from(active_override->replacement); + + bool unregister_replacement = mod_free_replacement != KC_NO && // KC_NO is never registered + mod_free_replacement < SAFE_RANGE; // Custom keycodes are never registered + + // Try firing the custom handler + if (active_override->custom_action != NULL) { + unregister_replacement &= active_override->custom_action(false, active_override->context); + } + + // Then unregister the mod-free replacement key if desired + if (unregister_replacement) { + if (IS_KEY(mod_free_replacement)) { + del_key(mod_free_replacement); + } else { + key_override_printf("NOT KEY 1\n"); + send_keyboard_report(); + unregister_code(mod_free_replacement); + } + } + + const uint16_t trigger = active_override->trigger; + + const bool reregister_trigger = allow_reregister && // Check if allowed from caller + (active_override->options & ko_option_no_reregister_trigger) == 0 && // Check if override allows + active_override_trigger_is_down && // Check if trigger is even down + trigger != KC_NO && // KC_NO is never registered + trigger < SAFE_RANGE; // A custom keycode should not be registered + + // Optionally re-register the trigger if it is still down + if (reregister_trigger) { + key_override_printf("Re-registering trigger deferred: %u\n", trigger); + + // This will always be a modifier event, so defer always + schedule_deferred_register(trigger); + } + + send_keyboard_report(); + + active_override = NULL; + active_override_trigger_is_down = false; + + return old; +} + +/** Checks if the key event is an allowed activation event for the provided override. Does not check things like whether the correct mods or correct trigger key is down. */ +static bool check_activation_event(const key_override_t *override, const bool key_down, const bool is_mod) { + ko_option_t options = override->options; + + if ((options & ko_options_all_activations) == 0) { + // No activation option provided at all. This is wrong, but let's assume the default activations (ko_options_all_activations) were meant... + options = ko_options_all_activations; + } + + if (is_mod) { + if (key_down) { + return (options & ko_option_activation_required_mod_down) != 0; + } else { + return (options & ko_option_activation_negative_mod_up) != 0; + } + } else { + if (key_down) { + return (options & ko_option_activation_trigger_down) != 0; + } else { + return false; + } + } +} + +/** Iterates through the list of key overrides and tries activating each, until it finds one that activates or reaches the end of overrides. Returns true if the key action for `keycode` should be sent */ +static bool try_activating_override(const uint16_t keycode, const uint8_t layer, const bool key_down, const bool is_mod, const uint8_t active_mods, bool *activated) { + if (key_overrides == NULL) { + return true; + } + + for (uint8_t i = 0;; i++) { + const key_override_t *const override = key_overrides[i]; + + // End of array + if (override == NULL) { + break; + } + + // Fast, but not full mods check. Most key presses will not have any mods down, and most overrides will require mods. Hence here we filter overrides that require mods to be down while no mods are down + if (active_mods == 0 && override->trigger_mods != 0) { + key_override_printf("Not activating override: Modifiers don't match\n"); + continue; + } + + // Check layer + if ((override->layers & (1 << layer)) == 0) { + key_override_printf("Not activating override: Not set to activate on pressed layer\n"); + continue; + } + + // Check allowed activation events + if (!check_activation_event(override, key_down, is_mod)) { + key_override_printf("Not activating override: Activation event not allowed\n"); + continue; + } + + const bool is_trigger = override->trigger == keycode; + + // Check if trigger lifted. This is a small optimization in order to skip the remaining checks + if (is_trigger && !key_down) { + key_override_printf("Not activating override: Trigger lifted\n"); + continue; + } + + // If the trigger is KC_NO it means 'no key', so only the required modifiers need to be down. + const bool no_trigger = override->trigger == KC_NO; + + // Check if aleady active + if (override == active_override) { + key_override_printf("Not activating override: Alerady actived\n"); + continue; + } + + // Check if enabled + if (override->enabled != NULL && !((*(override->enabled) & 1))) { + key_override_printf("Not activating override: Not enabled\n"); + continue; + } + + // Check mods precisely + if (!key_override_matches_active_modifiers(override, active_mods)) { + key_override_printf("Not activating override: Modifiers don't match\n"); + continue; + } + + // Check if trigger key is down. + const bool trigger_down = is_trigger && key_down; + + // At this point, all requirements for activation are checked, except whether the trigger key is pressed. Now we check if the required trigger is down + // If no trigger key is required, yes. + // If the trigger was just pressed, yes. + // If the last non-mod key that was pressed down is the trigger key, yes. + bool should_activate = no_trigger || trigger_down || last_key_down == override->trigger; + + if (!should_activate) { + key_override_printf("Not activating override. Trigger not down\n"); + continue; + } + + key_override_printf("Activating override\n"); + + clear_active_override(false); + + active_override = override; + active_override_trigger_is_down = true; + + set_suppressed_override_mods(override->suppressed_mods); + + if (!trigger_down && !no_trigger) { + // When activating a key override the trigger is is always unregistered. In the case where the key that newly pressed is not the trigger key, we have to explicitly remove the trigger key from the keyboard report. If the trigger was just pressed down we simply suppress the event which also has the effect of the trigger key not being registered in the keyboard report. + if (IS_KEY(override->trigger)) { + del_key(override->trigger); + } else { + unregister_code(override->trigger); + } + } + + const uint16_t mod_free_replacement = clear_mods_from(override->replacement); + + bool register_replacement = mod_free_replacement != KC_NO && // KC_NO is never registered + mod_free_replacement < SAFE_RANGE; // Custom keycodes are never registered + + // Try firing the custom handler + if (override->custom_action != NULL) { + register_replacement &= override->custom_action(true, override->context); + } + + if (register_replacement) { + const uint8_t override_mods = extract_mod_bits(override->replacement); + set_weak_override_mods(override_mods); + + // If this is a modifier event that activates the key override we _always_ defer the actual full activation of the override + if (is_mod) { + key_override_printf("Deferring register replacement key\n"); + schedule_deferred_register(mod_free_replacement); + send_keyboard_report(); + } else { + if (IS_KEY(mod_free_replacement)) { + add_key(mod_free_replacement); + } else { + key_override_printf("NOT KEY 2\n"); + send_keyboard_report(); + // On macOS there seems to be a race condition when it comes to the keyboard report and consumer keycodes. It seems the OS may recognize a consumer keycode before an updated keyboard report, even if the keyboard report is actually sent before the consumer key. I assume it is some sort of race condition because it happens infrequently and very irregularly. Waiting for about at least 10ms between sending the keyboard report and sending the consumer code has shown to fix this. + wait_ms(10); + register_code(mod_free_replacement); + } + } + } else { + // If not registering the replacement key send keyboard report to update the unregistered keys. + send_keyboard_report(); + } + + *activated = true; + + // If the trigger is down, suppress the event so that it does not get added to the keyboard report. + return !trigger_down; + } + + *activated = false; + + return true; +} + +void key_override_task(void) { + if (deferred_register == 0) { + return; + } + + if (timer_elapsed32(defer_reference_time) >= defer_delay) { + key_override_printf("Registering deferred key\n"); + register_code16(deferred_register); + deferred_register = 0; + defer_reference_time = 0; + defer_delay = 0; + } +} + +bool process_key_override(const uint16_t keycode, const keyrecord_t *const record) { +#ifdef BENCH_KEY_OVERRIDE + uint16_t start = timer_read(); +#endif + + const bool key_down = record->event.pressed; + const bool is_mod = IS_MOD(keycode); + + if (key_down) { + switch (keycode) { + case KEY_OVERRIDE_TOGGLE: + key_override_toggle(); + return false; + + case KEY_OVERRIDE_ON: + key_override_on(); + return false; + + case KEY_OVERRIDE_OFF: + key_override_off(); + return false; + + default: + break; + } + } + + if (!enabled) { + return true; + } + + uint8_t effective_mods = get_mods(); + +#ifdef KEY_OVERRIDE_INCLUDE_WEAK_MODS + effective_mods |= get_weak_mods(); +#endif + +#ifndef NO_ACTION_ONESHOT + // Locked one shot mods are added to get_mods(), I think (why??) while oneshot mods are in get_oneshot_mods(). Still OR with get_locked_oneshot_mods because that's where those mods _should_ be saved. + effective_mods |= get_oneshot_locked_mods() | get_oneshot_mods(); +#endif + + if (is_mod) { + // The mods returned from get_mods() will be updated with this new event _after_ this code runs. Hence we manually update the effective mods here to really know the effective mods. + if (key_down) { + effective_mods |= MOD_BIT(keycode); + } else { + effective_mods &= ~MOD_BIT(keycode); + } + } else { + if (key_down) { + last_key_down = keycode; + last_key_down_time = timer_read32(); + deferred_register = 0; + } + + // The last key that was pressed was just released. No more keys are therefore sending input + if (!key_down && keycode == last_key_down) { + last_key_down = 0; + last_key_down_time = 0; + // We also cancel any deferred registers because, again, no keys are sending any input. Only the last key that is pressed creates an input – this key was just lifted. + deferred_register = 0; + } + } + + key_override_printf("key down: %u keycode: %u is mod: %u effective mods: %u\n", key_down, keycode, is_mod, effective_mods); + + bool send_key_action = true; + bool activated = false; + + // Non-mod key up events never activate a key override + if (is_mod || key_down) { + // Get the exact layer that was hit. It will be cached at this point + const uint8_t layer = read_source_layers_cache(record->event.key); + + // Use blocked to ensure the same override is not activated again immediately after it is deactivated + send_key_action = try_activating_override(keycode, layer, key_down, is_mod, effective_mods, &activated); + + if (!send_key_action) { + send_keyboard_report(); + } + } + + if (!activated && active_override != NULL) { + if (is_mod) { + // Check if necessary modifier of current override goes up or a negative mod goes down + if (!key_override_matches_active_modifiers(active_override, effective_mods)) { + key_override_printf("Deactivating override because necessary modifier lifted or negative mod pressed\n"); + clear_active_override(true); + } + } else { + // Check if trigger of current override goes up or if override does not allow additional keys to be down and another key goes down + const bool is_trigger = keycode == active_override->trigger; + bool should_deactivate = false; + + // Check if trigger key lifted + if (is_trigger && !key_down) { + should_deactivate = true; + active_override_trigger_is_down = false; + key_override_printf("Deactivating override because trigger key up\n"); + } + + // Check if another key was pressed + if (key_down && (active_override->options & ko_option_no_unregister_on_other_key_down) == 0) { + should_deactivate = true; + key_override_printf("Deactivating override because another key was pressed\n"); + } + + if (should_deactivate) { + clear_active_override(false); + } + } + } + +#ifdef BENCH_KEY_OVERRIDE + uint16_t elapsed = timer_elapsed(start); + + dprintf("Processing key overrides took: %u ms\n", elapsed); +#endif + + return send_key_action; +} diff --git a/quantum/process_keycode/process_key_override.h b/quantum/process_keycode/process_key_override.h new file mode 100644 index 0000000000..fd76f297a8 --- /dev/null +++ b/quantum/process_keycode/process_key_override.h @@ -0,0 +1,153 @@ +/* + * Copyright 2021 Jonas Gessner + * + * 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 <stddef.h> +#include <stdint.h> + +#include "action_layer.h" + +/** + * Key overrides allow you to send a different key-modifier combination or perform a custom action when a certain modifier-key combination is pressed. + * + * For example, you may configure a key override to send the delete key when shift + backspace are pressed together, or that your volume keys become screen brightness keys when holding ctrl. The possibilities are quite vast and the documentation contains a few examples for inspiration. + * + * See the documentation and examples here: https://docs.qmk.fm/#/feature_key_overrides + */ + +/** Bitfield with various options controlling the behavior of a key override. */ +typedef enum { + /** Allow activating when the trigger key is pressed down. */ + ko_option_activation_trigger_down = (1 << 0), + /** Allow activating when a necessary modifier is pressed down. */ + ko_option_activation_required_mod_down = (1 << 1), + /** Allow activating when a negative modifier is released. */ + ko_option_activation_negative_mod_up = (1 << 2), + + ko_options_all_activations = ko_option_activation_negative_mod_up | ko_option_activation_required_mod_down | ko_option_activation_trigger_down, + + /** If set, any of the modifiers in trigger_mods will be enough to activate the override (logical OR of modifiers). If not set, all the modifiers in trigger_mods have to be pressed (logical AND of modifiers). */ + ko_option_one_mod = (1 << 3), + + /** If set, the trigger key will never be registered again after the override is deactivated. */ + ko_option_no_reregister_trigger = (1 << 4), + + /** If set, the override will not deactivate when another key is pressed down. Use only if you really know you need this. */ + ko_option_no_unregister_on_other_key_down = (1 << 5), + + /** The default options used by the ko_make_xxx functions. */ + ko_options_default = ko_options_all_activations, +} ko_option_t; + +/** Defines a single key override */ +typedef struct { + // The non-modifier keycode that triggers the override. This keycode, and the necessary modifiers (trigger_mods) must be pressed to activate this override. Set this to the keycode of the key that should activate the override. Set to KC_NO to require only the necessary modifiers to be pressed and no non-modifier. + uint16_t trigger; + + // Which mods need to be down for activation. If both sides of a modifier are set (e.g. left ctrl and right ctrl) then only one is required to be pressed (e.g. left ctrl suffices). Use the MOD_MASK_XXX and MOD_BIT() macros for this. + uint8_t trigger_mods; + + // This is a BITMASK (!), defining which layers this override applies to. To use this override on layer i set the ith bit (1 << i). + layer_state_t layers; + + // Which modifiers cannot be down. It must hold that (active_mods & negative_mod_mask) == 0, otherwise the key override will not be activated. An active override will be deactivated once this is no longer true. + uint8_t negative_mod_mask; + + // Modifiers to 'suppress' while the override is active. To suppress a modifier means that even though the modifier key is held down, the host OS sees the modifier as not pressed. Can be used to suppress the trigger modifiers, as a trivial example. + uint8_t suppressed_mods; + + // The complex keycode to send as replacement when this override is triggered. This can be a simple keycode, a key-modifier combination (e.g. C(KC_A)), or KC_NO (to register no replacement keycode). Use in combination with suppressed_mods to get the correct modifiers to be sent. + uint16_t replacement; + + // Options controlling the behavior of the override, such as what actions are allowed to activate the override. + ko_option_t options; + + // If not NULL, this function will be called right before the replacement key is registered, along with the provided context and a flag indicating whether the override was activated or deactivated. This function allows you to run some custom actions for specific key overrides. If you return `false`, the replacement key is not registered/unregistered as it would normally. Return `true` to register and unregister the override normally. + bool (*custom_action)(bool activated, void *context); + + // A context that will be passed to the custom action function. + void *context; + + // If this points to false this override will not be used. Set to NULL to always have this override enabled. + bool *enabled; +} key_override_t; + +/** Define this as a null-terminated array of pointers to key overrides. These key overrides will be used by qmk. */ +extern const key_override_t **key_overrides; + +/** Turns key overrides on */ +void key_override_on(void); + +/** Turns key overrides off */ +void key_override_off(void); + +/** Toggles key overrides on */ +void key_override_toggle(void); + +/** Returns whether key overrides are enabled */ +bool key_override_is_enabled(void); + +/** Handling of key overrides and its implemented keycodes */ +bool process_key_override(const uint16_t keycode, const keyrecord_t *const record); + +/** Perform any deferred keys */ +void key_override_task(void); + +/** + * Preferrably use these macros to create key overrides. They fix many of the options to a standard setting that should satisfy most basic use-cases. Only directly create a key_override_t struct when you really need to. + */ + +// clang-format off + +/** + * Convenience initializer to create a basic key override. Activates the override on all layers. + */ +#define ko_make_basic(trigger_mods, trigger_key, replacement_key) \ + ko_make_with_layers(trigger_mods, trigger_key, replacement_key, ~0) + +/** + * Convenience initializer to create a basic key override. Provide a bitmap (of type layer_state_t) with the bits set for each layer on which the override should activate. + */ +#define ko_make_with_layers(trigger_mods, trigger_key, replacement_key, layers) \ + ko_make_with_layers_and_negmods(trigger_mods, trigger_key, replacement_key, layers, 0) + +/** + * Convenience initializer to create a basic key override. Provide a bitmap with the bits set for each layer on which the override should activate. Also provide a negative modifier mask, that is used to define which modifiers may not be pressed. + */ +#define ko_make_with_layers_and_negmods(trigger_mods, trigger_key, replacement_key, layers, negative_mask) \ + ko_make_with_layers_negmods_and_options(trigger_mods, trigger_key, replacement_key, layers, negative_mask, ko_options_default) + + /** + * Convenience initializer to create a basic key override. Provide a bitmap with the bits set for each layer on which the override should activate. Also provide a negative modifier mask, that is used to define which modifiers may not be pressed. Provide options for additional control of the behavior of the override. + */ +#define ko_make_with_layers_negmods_and_options(trigger_mods_, trigger_key, replacement_key, layer_mask, negative_mask, options_) \ + ((const key_override_t){ \ + .trigger_mods = (trigger_mods_), \ + .layers = (layer_mask), \ + .suppressed_mods = (trigger_mods_), \ + .options = (options_), \ + .negative_mod_mask = (negative_mask), \ + .custom_action = NULL, \ + .context = NULL, \ + .trigger = (trigger_key), \ + .replacement = (replacement_key), \ + .enabled = NULL \ + }) + +// clang-format on diff --git a/quantum/process_keycode/process_magic.c b/quantum/process_keycode/process_magic.c index 44dd5f0579..01f2fb9289 100644 --- a/quantum/process_keycode/process_magic.c +++ b/quantum/process_keycode/process_magic.c @@ -164,6 +164,9 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) { case MAGIC_EE_HANDS_RIGHT: eeconfig_update_handedness(false); break; + case MAGIC_TOGGLE_GUI: + keymap_config.no_gui = !keymap_config.no_gui; + break; } eeconfig_update_keymap(keymap_config.raw); diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c index eb06be96c2..2beccbd8f9 100644 --- a/quantum/process_keycode/process_music.c +++ b/quantum/process_keycode/process_music.c @@ -296,7 +296,7 @@ void music_mode_cycle(void) { # endif } -void matrix_scan_music(void) { +void music_task(void) { if (music_sequence_playing) { if ((music_sequence_timer == 0) || (timer_elapsed(music_sequence_timer) > music_sequence_interval)) { music_sequence_timer = timer_read(); diff --git a/quantum/process_keycode/process_music.h b/quantum/process_keycode/process_music.h index 01014aa6c2..e275cd9d26 100644 --- a/quantum/process_keycode/process_music.h +++ b/quantum/process_keycode/process_music.h @@ -44,7 +44,7 @@ void music_scale_user(void); void music_all_notes_off(void); void music_mode_cycle(void); -void matrix_scan_music(void); +void music_task(void); bool music_mask(uint16_t keycode); bool music_mask_kb(uint16_t keycode); diff --git a/quantum/process_keycode/process_rgb.c b/quantum/process_keycode/process_rgb.c index 167c0c03c9..69853cd5c4 100644 --- a/quantum/process_keycode/process_rgb.c +++ b/quantum/process_keycode/process_rgb.c @@ -14,7 +14,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "process_rgb.h" -#include "rgb.h" typedef void (*rgb_func_pointer)(void); @@ -162,7 +161,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) { #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) && defined(RGBLIGHT_EFFECT_BREATHING) handleKeycodeRGBMode(RGBLIGHT_MODE_BREATHING, RGBLIGHT_MODE_BREATHING_end); #endif -#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && !defined(DISABLE_RGB_MATRIX_BREATHING) +#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && defined(ENABLE_RGB_MATRIX_BREATHING) rgb_matrix_mode(RGB_MATRIX_BREATHING); #endif return false; @@ -170,7 +169,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) { #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) && defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) handleKeycodeRGBMode(RGBLIGHT_MODE_RAINBOW_MOOD, RGBLIGHT_MODE_RAINBOW_MOOD_end); #endif -#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && !defined(DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT) +#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && defined(ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT) rgb_matrix_mode(RGB_MATRIX_CYCLE_LEFT_RIGHT); #endif return false; @@ -178,7 +177,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) { #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) && defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) handleKeycodeRGBMode(RGBLIGHT_MODE_RAINBOW_SWIRL, RGBLIGHT_MODE_RAINBOW_SWIRL_end); #endif -#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && !defined(DISABLE_RGB_MATRIX_CYCLE_PINWHEEL) +#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && defined(ENABLE_RGB_MATRIX_CYCLE_PINWHEEL) rgb_matrix_mode(RGB_MATRIX_CYCLE_PINWHEEL); #endif return false; diff --git a/quantum/process_keycode/process_steno.c b/quantum/process_keycode/process_steno.c index 57e279f211..a964aead35 100644 --- a/quantum/process_keycode/process_steno.c +++ b/quantum/process_keycode/process_steno.c @@ -65,6 +65,12 @@ static steno_mode_t mode; static const uint8_t boltmap[64] PROGMEM = {TXB_NUL, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_S_L, TXB_S_L, TXB_T_L, TXB_K_L, TXB_P_L, TXB_W_L, TXB_H_L, TXB_R_L, TXB_A_L, TXB_O_L, TXB_STR, TXB_STR, TXB_NUL, TXB_NUL, TXB_NUL, TXB_STR, TXB_STR, TXB_E_R, TXB_U_R, TXB_F_R, TXB_R_R, TXB_P_R, TXB_B_R, TXB_L_R, TXB_G_R, TXB_T_R, TXB_S_R, TXB_D_R, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_Z_R}; +#ifdef STENO_COMBINEDMAP +/* Used to look up when pressing the middle row key to combine two consonant or vowel keys */ +static const uint16_t combinedmap_first[] PROGMEM = {STN_S1, STN_TL, STN_PL, STN_HL, STN_FR, STN_PR, STN_LR, STN_TR, STN_DR, STN_A, STN_E}; +static const uint16_t combinedmap_second[] PROGMEM = {STN_S2, STN_KL, STN_WL, STN_RL, STN_RR, STN_BR, STN_GR, STN_SR, STN_ZR, STN_O, STN_U}; +#endif + static void steno_clear_state(void) { memset(state, 0, sizeof(state)); memset(chord, 0, sizeof(chord)); @@ -167,6 +173,15 @@ bool process_steno(uint16_t keycode, keyrecord_t *record) { } return false; +#ifdef STENO_COMBINEDMAP + case QK_STENO_COMB ... QK_STENO_COMB_MAX: + { + uint8_t result; + result = process_steno(combinedmap_first[keycode-QK_STENO_COMB], record); + result &= process_steno(combinedmap_second[keycode-QK_STENO_COMB], record); + return result; + } +#endif case STN__MIN ... STN__MAX: if (!process_steno_user(keycode, record)) { return false; diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index 17dc540a64..225b36cd5f 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -44,6 +44,7 @@ void qk_tap_dance_pair_finished(qk_tap_dance_state_t *state, void *user_data) { void qk_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; + wait_ms(TAP_CODE_DELAY); if (state->count == 1) { unregister_code16(pair->kc1); } else if (state->count == 2) { @@ -74,6 +75,7 @@ void qk_tap_dance_dual_role_reset(qk_tap_dance_state_t *state, void *user_data) qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data; if (state->count == 1) { + wait_ms(TAP_CODE_DELAY); unregister_code16(pair->kc); } } @@ -161,7 +163,7 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { return true; } -void matrix_scan_tap_dance() { +void tap_dance_task() { if (highest_td == -1) return; uint16_t tap_user_defined; diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index a013c5cabf..d9ffb1e73d 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h @@ -85,7 +85,7 @@ extern qk_tap_dance_action_t tap_dance_actions[]; void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record); bool process_tap_dance(uint16_t keycode, keyrecord_t *record); -void matrix_scan_tap_dance(void); +void tap_dance_task(void); void reset_tap_dance(qk_tap_dance_state_t *state); void qk_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data); diff --git a/quantum/quantum.c b/quantum/quantum.c index a9f5f5d95f..14f25597ca 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -50,21 +50,18 @@ float goodbye_song[][2] = GOODBYE_SONG; # ifdef DEFAULT_LAYER_SONGS float default_layer_songs[][16][2] = DEFAULT_LAYER_SONGS; # endif -# ifdef SENDSTRING_BELL -float bell_song[][2] = SONG(TERMINAL_SOUND); -# endif #endif #ifdef AUTO_SHIFT_ENABLE # include "process_auto_shift.h" #endif -static void do_code16(uint16_t code, void (*f)(uint8_t)) { +uint8_t extract_mod_bits(uint16_t code) { switch (code) { case QK_MODS ... QK_MODS_MAX: break; default: - return; + return 0; } uint8_t mods_to_send = 0; @@ -81,9 +78,11 @@ static void do_code16(uint16_t code, void (*f)(uint8_t)) { if (code & QK_LGUI) mods_to_send |= MOD_BIT(KC_LGUI); } - f(mods_to_send); + return mods_to_send; } +static void do_code16(uint16_t code, void (*f)(uint8_t)) { f(extract_mod_bits(code)); } + void register_code16(uint16_t code) { if (IS_MOD(code) || code == KC_NO) { do_code16(code, register_mods); @@ -145,7 +144,14 @@ void reset_keyboard(void) { } /* Convert record into usable keycode via the contained event. */ -uint16_t get_record_keycode(keyrecord_t *record, bool update_layer_cache) { return get_event_keycode(record->event, update_layer_cache); } +uint16_t get_record_keycode(keyrecord_t *record, bool update_layer_cache) { +#ifdef COMBO_ENABLE + if (record->keycode) { return record->keycode; } +#endif + return get_event_keycode(record->event, update_layer_cache); +} + + /* Convert event into usable keycode. Checks the layer cache to ensure that it * retains the correct keycode after a layer change, if the key is still pressed. * "update_layer_cache" is to ensure that it only updates the layer cache when @@ -170,6 +176,18 @@ uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache) { return keymap_key_to_keycode(layer_switch_get_layer(event.key), event.key); } +/* Get keycode, and then process pre tapping functionality */ +bool pre_process_record_quantum(keyrecord_t *record) { + if (!( +#ifdef COMBO_ENABLE + process_combo(get_record_keycode(record, true), record) && +#endif + true)) { + return false; + } + return true; // continue processing +} + /* Get keycode, and then call keyboard function */ void post_process_record_quantum(keyrecord_t *record) { uint16_t keycode = get_record_keycode(record, false); @@ -217,7 +235,7 @@ bool process_record_quantum(keyrecord_t *record) { #endif #if defined(AUDIO_ENABLE) && defined(AUDIO_CLICKY) process_clicky(keycode, record) && -#endif // AUDIO_CLICKY +#endif #ifdef HAPTIC_ENABLE process_haptic(keycode, record) && #endif // HAPTIC_ENABLE @@ -246,6 +264,9 @@ bool process_record_quantum(keyrecord_t *record) { #if (defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))) && !defined(NO_MUSIC_MODE) process_music(keycode, record) && #endif +#ifdef KEY_OVERRIDE_ENABLE + process_key_override(keycode, record) && +#endif #ifdef TAP_DANCE_ENABLE process_tap_dance(keycode, record) && #endif @@ -255,9 +276,6 @@ bool process_record_quantum(keyrecord_t *record) { #ifdef LEADER_ENABLE process_leader(keycode, record) && #endif -#ifdef COMBO_ENABLE - process_combo(keycode, record) && -#endif #ifdef PRINTING_ENABLE process_printer(keycode, record) && #endif @@ -344,13 +362,13 @@ void set_single_persistent_default_layer(uint8_t default_layer) { #if defined(AUDIO_ENABLE) && defined(DEFAULT_LAYER_SONGS) PLAY_SONG(default_layer_songs[default_layer]); #endif - eeconfig_update_default_layer(1U << default_layer); - default_layer_set(1U << default_layer); + eeconfig_update_default_layer((layer_state_t)1 << default_layer); + default_layer_set((layer_state_t)1 << default_layer); } layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3) { - layer_state_t mask12 = (1UL << layer1) | (1UL << layer2); - layer_state_t mask3 = 1UL << layer3; + layer_state_t mask12 = ((layer_state_t)1 << layer1) | ((layer_state_t)1 << layer2); + layer_state_t mask3 = (layer_state_t)1 << layer3; return (state & mask12) == mask12 ? (state | mask3) : (state & ~mask3); } @@ -394,7 +412,7 @@ void matrix_init_quantum() { } void matrix_scan_quantum() { -#if defined(AUDIO_ENABLE) +#if defined(AUDIO_ENABLE) && defined(AUDIO_INIT_DELAY) // There are some tasks that need to be run a little bit // after keyboard startup, or else they will not work correctly // because of interaction with the USB device state, which @@ -415,19 +433,23 @@ void matrix_scan_quantum() { #endif #if defined(AUDIO_ENABLE) && !defined(NO_MUSIC_MODE) - matrix_scan_music(); + music_task(); +#endif + +#ifdef KEY_OVERRIDE_ENABLE + key_override_task(); #endif #ifdef SEQUENCER_ENABLE - matrix_scan_sequencer(); + sequencer_task(); #endif #ifdef TAP_DANCE_ENABLE - matrix_scan_tap_dance(); + tap_dance_task(); #endif #ifdef COMBO_ENABLE - matrix_scan_combo(); + combo_task(); #endif #ifdef LED_MATRIX_ENABLE diff --git a/quantum/quantum.h b/quantum/quantum.h index 9df15d4cac..22afacec0d 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -15,16 +15,7 @@ */ #pragma once -#if defined(__AVR__) -# include <avr/pgmspace.h> -# include <avr/io.h> -# include <avr/interrupt.h> -#endif -#if defined(PROTOCOL_CHIBIOS) -# include <hal.h> -# include "chibios_config.h" -#endif - +#include "platform_deps.h" #include "wait.h" #include "matrix.h" #include "keymap.h" @@ -39,10 +30,6 @@ #if defined(RGBLIGHT_ENABLE) # include "rgblight.h" -#elif defined(RGB_MATRIX_ENABLE) -// Dummy define RGBLIGHT_MODE_xxxx -# define RGBLIGHT_H_DUMMY_DEFINE -# include "rgblight.h" #endif #ifdef RGB_MATRIX_ENABLE @@ -118,6 +105,10 @@ extern layer_state_t layer_state; # include "process_unicodemap.h" #endif +#ifdef KEY_OVERRIDE_ENABLE +# include "process_key_override.h" +#endif + #ifdef TAP_DANCE_ENABLE # include "process_tap_dance.h" #endif @@ -170,12 +161,17 @@ extern layer_state_t layer_state; #ifdef HAPTIC_ENABLE # include "haptic.h" +# include "process_haptic.h" #endif -#ifdef OLED_DRIVER_ENABLE +#ifdef OLED_ENABLE # include "oled_driver.h" #endif +#ifdef ST7565_ENABLE +# include "st7565.h" +#endif + #ifdef DIP_SWITCH_ENABLE #include "dip_switch.h" #endif @@ -226,10 +222,6 @@ void set_single_persistent_default_layer(uint8_t default_layer); #define IS_LAYER_ON_STATE(state, layer) layer_state_cmp(state, layer) #define IS_LAYER_OFF_STATE(state, layer) !layer_state_cmp(state, layer) -void matrix_init_kb(void); -void matrix_scan_kb(void); -void matrix_init_user(void); -void matrix_scan_user(void); uint16_t get_record_keycode(keyrecord_t *record, bool update_layer_cache); uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache); bool process_action_kb(keyrecord_t *record); diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 0ab3a535df..6cce7808f1 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -66,6 +66,8 @@ enum quantum_keycodes { QK_STENO = 0x5A00, QK_STENO_BOLT = 0x5A30, QK_STENO_GEMINI = 0x5A31, + QK_STENO_COMB = 0x5A32, + QK_STENO_COMB_MAX = 0x5A3C, QK_STENO_MAX = 0x5A3F, // 0x5C00 - 0x5FFF are reserved, see below QK_MOD_TAP = 0x6000, @@ -516,6 +518,14 @@ enum quantum_keycodes { // RGB underglow/matrix (continued) RGB_MODE_TWINKLE, + // Key Overrides + KEY_OVERRIDE_TOGGLE, + KEY_OVERRIDE_ON, + KEY_OVERRIDE_OFF, + + // Additional magic key + MAGIC_TOGGLE_GUI, + // Start of custom keycode range for keyboards and keymaps - always leave at the end SAFE_RANGE }; @@ -689,6 +699,7 @@ enum quantum_keycodes { #define GUI_OFF MAGIC_NO_GUI #define GUI_ON MAGIC_UNNO_GUI +#define GUI_TOG MAGIC_TOGGLE_GUI #define GE_SWAP MAGIC_SWAP_GRAVE_ESC #define GE_NORM MAGIC_UNSWAP_GRAVE_ESC diff --git a/quantum/rgb.h b/quantum/rgb.h deleted file mode 100644 index 2602fc0b20..0000000000 --- a/quantum/rgb.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright 2017 Jack Humbert - * - * 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 - -__attribute__((weak)) void rgblight_toggle(void){}; - -__attribute__((weak)) void rgblight_step(void){}; - -__attribute__((weak)) void rgblight_step_reverse(void){}; - -__attribute__((weak)) void rgblight_increase_hue(void){}; - -__attribute__((weak)) void rgblight_decrease_hue(void){}; - -__attribute__((weak)) void rgblight_increase_sat(void){}; - -__attribute__((weak)) void rgblight_decrease_sat(void){}; - -__attribute__((weak)) void rgblight_increase_val(void){}; - -__attribute__((weak)) void rgblight_decrease_val(void){}; - -__attribute__((weak)) void rgblight_increase_speed(void){}; - -__attribute__((weak)) void rgblight_decrease_speed(void){}; diff --git a/quantum/rgb_matrix_animations/alpha_mods_anim.h b/quantum/rgb_matrix/animations/alpha_mods_anim.h index 426d88ef35..3f2c9b799a 100644 --- a/quantum/rgb_matrix_animations/alpha_mods_anim.h +++ b/quantum/rgb_matrix/animations/alpha_mods_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS +#ifdef ENABLE_RGB_MATRIX_ALPHAS_MODS RGB_MATRIX_EFFECT(ALPHAS_MODS) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/breathing_anim.h b/quantum/rgb_matrix/animations/breathing_anim.h index 340bd93e5d..a00ccb83a2 100644 --- a/quantum/rgb_matrix_animations/breathing_anim.h +++ b/quantum/rgb_matrix/animations/breathing_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_BREATHING +#ifdef ENABLE_RGB_MATRIX_BREATHING RGB_MATRIX_EFFECT(BREATHING) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h b/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h index 3df3cfda7d..ac95789228 100644 --- a/quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h +++ b/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +#ifdef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT RGB_MATRIX_EFFECT(BAND_PINWHEEL_SAT) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h b/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h index 7d80074fd5..f7fe4b76e9 100644 --- a/quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h +++ b/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +#ifdef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/colorband_sat_anim.h b/quantum/rgb_matrix/animations/colorband_sat_anim.h index 35b830af6b..96a6cbf5cd 100644 --- a/quantum/rgb_matrix_animations/colorband_sat_anim.h +++ b/quantum/rgb_matrix/animations/colorband_sat_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_BAND_SAT +#ifdef ENABLE_RGB_MATRIX_BAND_SAT RGB_MATRIX_EFFECT(BAND_SAT) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h b/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h index 048157aa1b..52f6040d81 100644 --- a/quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h +++ b/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT +#ifdef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT RGB_MATRIX_EFFECT(BAND_SPIRAL_SAT) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/colorband_spiral_val_anim.h b/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h index bff2da1616..d5752e27fb 100644 --- a/quantum/rgb_matrix_animations/colorband_spiral_val_anim.h +++ b/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL +#ifdef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL RGB_MATRIX_EFFECT(BAND_SPIRAL_VAL) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/colorband_val_anim.h b/quantum/rgb_matrix/animations/colorband_val_anim.h index f1aaf1d067..32bc6f52a5 100644 --- a/quantum/rgb_matrix_animations/colorband_val_anim.h +++ b/quantum/rgb_matrix/animations/colorband_val_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_BAND_VAL +#ifdef ENABLE_RGB_MATRIX_BAND_VAL RGB_MATRIX_EFFECT(BAND_VAL) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/cycle_all_anim.h b/quantum/rgb_matrix/animations/cycle_all_anim.h index faf8598a39..20af94b6ba 100644 --- a/quantum/rgb_matrix_animations/cycle_all_anim.h +++ b/quantum/rgb_matrix/animations/cycle_all_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL +#ifdef ENABLE_RGB_MATRIX_CYCLE_ALL RGB_MATRIX_EFFECT(CYCLE_ALL) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/cycle_left_right_anim.h b/quantum/rgb_matrix/animations/cycle_left_right_anim.h index cf911eb937..7f84f4bd59 100644 --- a/quantum/rgb_matrix_animations/cycle_left_right_anim.h +++ b/quantum/rgb_matrix/animations/cycle_left_right_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +#ifdef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT RGB_MATRIX_EFFECT(CYCLE_LEFT_RIGHT) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/cycle_out_in_anim.h b/quantum/rgb_matrix/animations/cycle_out_in_anim.h index d66acd4b2b..2277f16a2f 100644 --- a/quantum/rgb_matrix_animations/cycle_out_in_anim.h +++ b/quantum/rgb_matrix/animations/cycle_out_in_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN +#ifdef ENABLE_RGB_MATRIX_CYCLE_OUT_IN RGB_MATRIX_EFFECT(CYCLE_OUT_IN) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h b/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h index fe8396140f..981c0afd05 100644 --- a/quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h +++ b/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +#ifdef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL RGB_MATRIX_EFFECT(CYCLE_OUT_IN_DUAL) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/cycle_pinwheel_anim.h b/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h index 7799887099..1a7db4a4c7 100644 --- a/quantum/rgb_matrix_animations/cycle_pinwheel_anim.h +++ b/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_CYCLE_PINWHEEL +#ifdef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL RGB_MATRIX_EFFECT(CYCLE_PINWHEEL) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/cycle_spiral_anim.h b/quantum/rgb_matrix/animations/cycle_spiral_anim.h index 80cfb0dbc7..245cdc237f 100644 --- a/quantum/rgb_matrix_animations/cycle_spiral_anim.h +++ b/quantum/rgb_matrix/animations/cycle_spiral_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_CYCLE_SPIRAL +#ifdef ENABLE_RGB_MATRIX_CYCLE_SPIRAL RGB_MATRIX_EFFECT(CYCLE_SPIRAL) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/cycle_up_down_anim.h b/quantum/rgb_matrix/animations/cycle_up_down_anim.h index 5016f739d6..c9b5a54133 100644 --- a/quantum/rgb_matrix_animations/cycle_up_down_anim.h +++ b/quantum/rgb_matrix/animations/cycle_up_down_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN +#ifdef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN RGB_MATRIX_EFFECT(CYCLE_UP_DOWN) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/digital_rain_anim.h b/quantum/rgb_matrix/animations/digital_rain_anim.h index 1de45f8e8d..1de45f8e8d 100644 --- a/quantum/rgb_matrix_animations/digital_rain_anim.h +++ b/quantum/rgb_matrix/animations/digital_rain_anim.h diff --git a/quantum/rgb_matrix_animations/dual_beacon_anim.h b/quantum/rgb_matrix/animations/dual_beacon_anim.h index ce94871681..5c06080a26 100644 --- a/quantum/rgb_matrix_animations/dual_beacon_anim.h +++ b/quantum/rgb_matrix/animations/dual_beacon_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON +#ifdef ENABLE_RGB_MATRIX_DUAL_BEACON RGB_MATRIX_EFFECT(DUAL_BEACON) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/gradient_left_right_anim.h b/quantum/rgb_matrix/animations/gradient_left_right_anim.h index 53dfd04e2c..b4f2752ff7 100644 --- a/quantum/rgb_matrix_animations/gradient_left_right_anim.h +++ b/quantum/rgb_matrix/animations/gradient_left_right_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +#ifdef ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT RGB_MATRIX_EFFECT(GRADIENT_LEFT_RIGHT) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/gradient_up_down_anim.h b/quantum/rgb_matrix/animations/gradient_up_down_anim.h index 7e0d2898cf..3fd45cf99b 100644 --- a/quantum/rgb_matrix_animations/gradient_up_down_anim.h +++ b/quantum/rgb_matrix/animations/gradient_up_down_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN +#ifdef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/hue_breathing_anim.h b/quantum/rgb_matrix/animations/hue_breathing_anim.h index 54dea958af..6d974b8c39 100644 --- a/quantum/rgb_matrix_animations/hue_breathing_anim.h +++ b/quantum/rgb_matrix/animations/hue_breathing_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_HUE_BREATHING +#ifdef ENABLE_RGB_MATRIX_HUE_BREATHING RGB_MATRIX_EFFECT(HUE_BREATHING) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/hue_pendulum_anim.h b/quantum/rgb_matrix/animations/hue_pendulum_anim.h index 2d8d36174f..a6e1c1074d 100644 --- a/quantum/rgb_matrix_animations/hue_pendulum_anim.h +++ b/quantum/rgb_matrix/animations/hue_pendulum_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_HUE_PENDULUM +#ifdef ENABLE_RGB_MATRIX_HUE_PENDULUM RGB_MATRIX_EFFECT(HUE_PENDULUM) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/hue_wave_anim.h b/quantum/rgb_matrix/animations/hue_wave_anim.h index fd9026fc90..b1c72b7336 100644 --- a/quantum/rgb_matrix_animations/hue_wave_anim.h +++ b/quantum/rgb_matrix/animations/hue_wave_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_HUE_WAVE +#ifdef ENABLE_RGB_MATRIX_HUE_WAVE RGB_MATRIX_EFFECT(HUE_WAVE) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h index 9493b38508..7d8eafffb9 100644 --- a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h +++ b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h @@ -1,10 +1,10 @@ -#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +#ifdef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS static void jellybean_raindrops_set_color(int i, effect_params_t* params) { if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; - HSV hsv = {rand() & 0xFF, rand() & 0xFF, rgb_matrix_config.hsv.v}; + HSV hsv = {rand() & 0xFF, qadd8(rand() & 0x7F, 0x80), rgb_matrix_config.hsv.v}; RGB rgb = rgb_matrix_hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/quantum/rgb_matrix_animations/rainbow_beacon_anim.h b/quantum/rgb_matrix/animations/rainbow_beacon_anim.h index 977261182f..b54d997f63 100644 --- a/quantum/rgb_matrix_animations/rainbow_beacon_anim.h +++ b/quantum/rgb_matrix/animations/rainbow_beacon_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON +#ifdef ENABLE_RGB_MATRIX_RAINBOW_BEACON RGB_MATRIX_EFFECT(RAINBOW_BEACON) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h b/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h index e51e7b2516..50db922014 100644 --- a/quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h +++ b/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +#ifdef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON RGB_MATRIX_EFFECT(RAINBOW_MOVING_CHEVRON) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h b/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h index 1cd4ed2acf..3299f15df1 100644 --- a/quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h +++ b/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS +#ifdef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS RGB_MATRIX_EFFECT(RAINBOW_PINWHEELS) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix_animations/raindrops_anim.h b/quantum/rgb_matrix/animations/raindrops_anim.h index 38359cdca7..c01688e2c7 100644 --- a/quantum/rgb_matrix_animations/raindrops_anim.h +++ b/quantum/rgb_matrix/animations/raindrops_anim.h @@ -1,4 +1,4 @@ -#ifndef DISABLE_RGB_MATRIX_RAINDROPS +#ifdef ENABLE_RGB_MATRIX_RAINDROPS RGB_MATRIX_EFFECT(RAINDROPS) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix/animations/rgb_matrix_effects.inc b/quantum/rgb_matrix/animations/rgb_matrix_effects.inc new file mode 100644 index 0000000000..302ad79c04 --- /dev/null +++ b/quantum/rgb_matrix/animations/rgb_matrix_effects.inc @@ -0,0 +1,37 @@ +// Add your new core rgb matrix effect here, order determines enum order +#include "solid_color_anim.h" +#include "alpha_mods_anim.h" +#include "gradient_up_down_anim.h" +#include "gradient_left_right_anim.h" +#include "breathing_anim.h" +#include "colorband_sat_anim.h" +#include "colorband_val_anim.h" +#include "colorband_pinwheel_sat_anim.h" +#include "colorband_pinwheel_val_anim.h" +#include "colorband_spiral_sat_anim.h" +#include "colorband_spiral_val_anim.h" +#include "cycle_all_anim.h" +#include "cycle_left_right_anim.h" +#include "cycle_up_down_anim.h" +#include "rainbow_moving_chevron_anim.h" +#include "cycle_out_in_anim.h" +#include "cycle_out_in_dual_anim.h" +#include "cycle_pinwheel_anim.h" +#include "cycle_spiral_anim.h" +#include "dual_beacon_anim.h" +#include "rainbow_beacon_anim.h" +#include "rainbow_pinwheels_anim.h" +#include "raindrops_anim.h" +#include "jellybean_raindrops_anim.h" +#include "hue_breathing_anim.h" +#include "hue_pendulum_anim.h" +#include "hue_wave_anim.h" +#include "typing_heatmap_anim.h" +#include "digital_rain_anim.h" +#include "solid_reactive_simple_anim.h" +#include "solid_reactive_anim.h" +#include "solid_reactive_wide.h" +#include "solid_reactive_cross.h" +#include "solid_reactive_nexus.h" +#include "splash_anim.h" +#include "solid_splash_anim.h" diff --git a/quantum/rgb_matrix_runners/effect_runner_dx_dy.h b/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy.h index 4867609c81..4867609c81 100644 --- a/quantum/rgb_matrix_runners/effect_runner_dx_dy.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy.h diff --git a/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h b/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy_dist.h index 9545b418d9..9545b418d9 100644 --- a/quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_dx_dy_dist.h diff --git a/quantum/rgb_matrix_runners/effect_runner_i.h b/quantum/rgb_matrix/animations/runners/effect_runner_i.h index 1881cd6c60..1881cd6c60 100644 --- a/quantum/rgb_matrix_runners/effect_runner_i.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_i.h diff --git a/quantum/rgb_matrix_runners/effect_runner_reactive.h b/quantum/rgb_matrix/animations/runners/effect_runner_reactive.h index 75b7c0df4e..75b7c0df4e 100644 --- a/quantum/rgb_matrix_runners/effect_runner_reactive.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_reactive.h diff --git a/quantum/rgb_matrix_runners/effect_runner_reactive_splash.h b/quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h index 2e46ffb350..2e46ffb350 100644 --- a/quantum/rgb_matrix_runners/effect_runner_reactive_splash.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h diff --git a/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h b/quantum/rgb_matrix/animations/runners/effect_runner_sin_cos_i.h index 02351de51e..02351de51e 100644 --- a/quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_sin_cos_i.h diff --git a/quantum/rgb_matrix/animations/runners/rgb_matrix_runners.inc b/quantum/rgb_matrix/animations/runners/rgb_matrix_runners.inc new file mode 100644 index 0000000000..c09022bb0f --- /dev/null +++ b/quantum/rgb_matrix/animations/runners/rgb_matrix_runners.inc @@ -0,0 +1,6 @@ +#include "effect_runner_dx_dy_dist.h" +#include "effect_runner_dx_dy.h" +#include "effect_runner_i.h" +#include "effect_runner_sin_cos_i.h" +#include "effect_runner_reactive.h" +#include "effect_runner_reactive_splash.h" diff --git a/quantum/rgb_matrix_animations/solid_color_anim.h b/quantum/rgb_matrix/animations/solid_color_anim.h index 79d63cf133..79d63cf133 100644 --- a/quantum/rgb_matrix_animations/solid_color_anim.h +++ b/quantum/rgb_matrix/animations/solid_color_anim.h diff --git a/quantum/rgb_matrix_animations/solid_reactive_anim.h b/quantum/rgb_matrix/animations/solid_reactive_anim.h index d45bb961bc..d45bb961bc 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_anim.h +++ b/quantum/rgb_matrix/animations/solid_reactive_anim.h diff --git a/quantum/rgb_matrix_animations/solid_reactive_cross.h b/quantum/rgb_matrix/animations/solid_reactive_cross.h index f76c68e8c7..f76c68e8c7 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_cross.h +++ b/quantum/rgb_matrix/animations/solid_reactive_cross.h diff --git a/quantum/rgb_matrix_animations/solid_reactive_nexus.h b/quantum/rgb_matrix/animations/solid_reactive_nexus.h index 17f94e3c18..17f94e3c18 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_nexus.h +++ b/quantum/rgb_matrix/animations/solid_reactive_nexus.h diff --git a/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h b/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h index 12eb248cc0..12eb248cc0 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_simple_anim.h +++ b/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h diff --git a/quantum/rgb_matrix_animations/solid_reactive_wide.h b/quantum/rgb_matrix/animations/solid_reactive_wide.h index 1cc4dca728..1cc4dca728 100644 --- a/quantum/rgb_matrix_animations/solid_reactive_wide.h +++ b/quantum/rgb_matrix/animations/solid_reactive_wide.h diff --git a/quantum/rgb_matrix_animations/solid_splash_anim.h b/quantum/rgb_matrix/animations/solid_splash_anim.h index 99efb4996a..99efb4996a 100644 --- a/quantum/rgb_matrix_animations/solid_splash_anim.h +++ b/quantum/rgb_matrix/animations/solid_splash_anim.h diff --git a/quantum/rgb_matrix_animations/splash_anim.h b/quantum/rgb_matrix/animations/splash_anim.h index 1415bcc0fa..1415bcc0fa 100644 --- a/quantum/rgb_matrix_animations/splash_anim.h +++ b/quantum/rgb_matrix/animations/splash_anim.h diff --git a/quantum/rgb_matrix_animations/typing_heatmap_anim.h b/quantum/rgb_matrix/animations/typing_heatmap_anim.h index e7dda11a2f..28f040109d 100644 --- a/quantum/rgb_matrix_animations/typing_heatmap_anim.h +++ b/quantum/rgb_matrix/animations/typing_heatmap_anim.h @@ -1,4 +1,4 @@ -#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) +#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) RGB_MATRIX_EFFECT(TYPING_HEATMAP) # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c index ab8dbd849b..8f00b40877 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix/rgb_matrix.c @@ -31,22 +31,25 @@ const led_point_t k_rgb_matrix_center = {112, 32}; const led_point_t k_rgb_matrix_center = RGB_MATRIX_CENTER; #endif +// clang-format off +#ifndef RGB_MATRIX_IMMEDIATE_EEPROM +# define rgb_eeconfig_update(v) rgb_update_eeprom |= v +#else +# define rgb_eeconfig_update(v) if (v) eeconfig_update_rgb_matrix() +#endif +// clang-format on + __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv); } // Generic effect runners -#include "rgb_matrix_runners/effect_runner_dx_dy_dist.h" -#include "rgb_matrix_runners/effect_runner_dx_dy.h" -#include "rgb_matrix_runners/effect_runner_i.h" -#include "rgb_matrix_runners/effect_runner_sin_cos_i.h" -#include "rgb_matrix_runners/effect_runner_reactive.h" -#include "rgb_matrix_runners/effect_runner_reactive_splash.h" +#include "rgb_matrix_runners.inc" // ------------------------------------------ // -----Begin rgb effect includes macros----- #define RGB_MATRIX_EFFECT(name) #define RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#include "rgb_matrix_animations/rgb_matrix_effects.inc" +#include "rgb_matrix_effects.inc" #ifdef RGB_MATRIX_CUSTOM_KB # include "rgb_matrix_kb.inc" #endif @@ -67,10 +70,6 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv # define RGB_DISABLE_TIMEOUT 0 #endif -#if RGB_DISABLE_WHEN_USB_SUSPENDED != 1 -# undef RGB_DISABLE_WHEN_USB_SUSPENDED -#endif - #if !defined(RGB_MATRIX_MAXIMUM_BRIGHTNESS) || RGB_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX # undef RGB_MATRIX_MAXIMUM_BRIGHTNESS # define RGB_MATRIX_MAXIMUM_BRIGHTNESS UINT8_MAX @@ -93,7 +92,7 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv #endif #if !defined(RGB_MATRIX_STARTUP_MODE) -# ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# ifdef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT # define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT # else // fallback to solid colors if RGB_MATRIX_CYCLE_LEFT_RIGHT is disabled in userspace @@ -129,6 +128,7 @@ last_hit_t g_last_hit_tracker; // internals static bool suspend_state = false; +static bool rgb_update_eeprom = false; static uint8_t rgb_last_enable = UINT8_MAX; static uint8_t rgb_last_effect = UINT8_MAX; static effect_params_t rgb_effect_params = {0, LED_FLAG_ALL, false}; @@ -230,7 +230,7 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) { memcpy(&last_hit_buffer.y[0], &last_hit_buffer.y[led_count], LED_HITS_TO_REMEMBER - led_count); memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit memcpy(&last_hit_buffer.index[0], &last_hit_buffer.index[led_count], LED_HITS_TO_REMEMBER - led_count); - last_hit_buffer.count--; + last_hit_buffer.count = LED_HITS_TO_REMEMBER - led_count; } for (uint8_t i = 0; i < led_count; i++) { @@ -243,11 +243,11 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) { } #endif // RGB_MATRIX_KEYREACTIVE_ENABLED -#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) +#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) if (rgb_matrix_config.mode == RGB_MATRIX_TYPING_HEATMAP) { process_rgb_matrix_typing_heatmap(row, col); } -#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP) +#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) } void rgb_matrix_test(void) { @@ -315,6 +315,8 @@ static void rgb_task_timers(void) { static void rgb_task_sync(void) { // next task + if (rgb_update_eeprom) eeconfig_update_rgb_matrix(); + rgb_update_eeprom = false; if (sync_timer_elapsed32(g_rgb_timer) >= RGB_MATRIX_LED_FLUSH_LIMIT) rgb_task_state = STARTING; } @@ -353,7 +355,7 @@ static void rgb_task_render(uint8_t effect) { case RGB_MATRIX_##name: \ rendering = name(&rgb_effect_params); \ break; -#include "rgb_matrix_animations/rgb_matrix_effects.inc" +#include "rgb_matrix_effects.inc" #undef RGB_MATRIX_EFFECT #if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER) @@ -499,8 +501,9 @@ void rgb_matrix_init(void) { void rgb_matrix_set_suspend_state(bool state) { #ifdef RGB_DISABLE_WHEN_USB_SUSPENDED - if (state) { - rgb_matrix_set_color_all(0, 0, 0); // turn off all LEDs when suspending + if (state && !suspend_state) { // only run if turning off, and only once + rgb_task_render(0); // turn off all LEDs when suspending + rgb_task_flush(0); // and actually flash led state to LEDs } suspend_state = state; #endif @@ -511,9 +514,7 @@ bool rgb_matrix_get_suspend_state(void) { return suspend_state; } void rgb_matrix_toggle_eeprom_helper(bool write_to_eeprom) { rgb_matrix_config.enable ^= 1; rgb_task_state = STARTING; - if (write_to_eeprom) { - eeconfig_update_rgb_matrix(); - } + rgb_eeconfig_update(write_to_eeprom); dprintf("rgb matrix toggle [%s]: rgb_matrix_config.enable = %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.enable); } void rgb_matrix_toggle_noeeprom(void) { rgb_matrix_toggle_eeprom_helper(false); } @@ -521,7 +522,7 @@ void rgb_matrix_toggle(void) { rgb_matrix_toggle_eeprom_helper(true); } void rgb_matrix_enable(void) { rgb_matrix_enable_noeeprom(); - eeconfig_update_rgb_matrix(); + rgb_eeconfig_update(true); } void rgb_matrix_enable_noeeprom(void) { @@ -531,7 +532,7 @@ void rgb_matrix_enable_noeeprom(void) { void rgb_matrix_disable(void) { rgb_matrix_disable_noeeprom(); - eeconfig_update_rgb_matrix(); + rgb_eeconfig_update(true); } void rgb_matrix_disable_noeeprom(void) { @@ -553,9 +554,7 @@ void rgb_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { rgb_matrix_config.mode = mode; } rgb_task_state = STARTING; - if (write_to_eeprom) { - eeconfig_update_rgb_matrix(); - } + rgb_eeconfig_update(write_to_eeprom); dprintf("rgb matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.mode); } void rgb_matrix_mode_noeeprom(uint8_t mode) { rgb_matrix_mode_eeprom_helper(mode, false); } @@ -584,9 +583,7 @@ void rgb_matrix_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, boo rgb_matrix_config.hsv.h = hue; rgb_matrix_config.hsv.s = sat; rgb_matrix_config.hsv.v = (val > RGB_MATRIX_MAXIMUM_BRIGHTNESS) ? RGB_MATRIX_MAXIMUM_BRIGHTNESS : val; - if (write_to_eeprom) { - eeconfig_update_rgb_matrix(); - } + rgb_eeconfig_update(write_to_eeprom); dprintf("rgb matrix set hsv [%s]: %u,%u,%u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v); } void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { rgb_matrix_sethsv_eeprom_helper(hue, sat, val, false); } @@ -623,9 +620,7 @@ void rgb_matrix_decrease_val(void) { rgb_matrix_decrease_val_helper(true); } void rgb_matrix_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) { rgb_matrix_config.speed = speed; - if (write_to_eeprom) { - eeconfig_update_rgb_matrix(); - } + rgb_eeconfig_update(write_to_eeprom); dprintf("rgb matrix set speed [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.speed); } void rgb_matrix_set_speed_noeeprom(uint8_t speed) { rgb_matrix_set_speed_eeprom_helper(speed, false); } diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h index a615b8422c..f53e011c1b 100644 --- a/quantum/rgb_matrix.h +++ b/quantum/rgb_matrix/rgb_matrix.h @@ -23,7 +23,7 @@ #include "rgb_matrix_types.h" #include "color.h" #include "quantum.h" -#include "rgblight_list.h" +#include "rgb_matrix_legacy_enables.h" #ifdef IS31FL3731 # include "is31fl3731.h" @@ -33,6 +33,8 @@ # include "is31fl3737.h" #elif defined(IS31FL3741) # include "is31fl3741.h" +#elif defined(AW20216) +# include "aw20216.h" #elif defined(WS2812) # include "ws2812.h" #endif @@ -70,7 +72,7 @@ enum rgb_matrix_effects { // -------------------------------------- // -----Begin rgb effect enum macros----- #define RGB_MATRIX_EFFECT(name, ...) RGB_MATRIX_##name, -#include "rgb_matrix_animations/rgb_matrix_effects.inc" +#include "rgb_matrix_effects.inc" #undef RGB_MATRIX_EFFECT #if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER) diff --git a/quantum/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c index 896fa6d0ef..2cec162e22 100644 --- a/quantum/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix/rgb_matrix_drivers.c @@ -65,6 +65,9 @@ static void init(void) { # endif # elif defined(IS31FL3737) IS31FL3737_init(DRIVER_ADDR_1); +# if defined(DRIVER_ADDR_2) && (DRIVER_ADDR_2 != DRIVER_ADDR_1) // provides backward compatibility + IS31FL3737_init(DRIVER_ADDR_2); +# endif # else IS31FL3741_init(DRIVER_ADDR_1); # endif @@ -105,7 +108,10 @@ static void init(void) { IS31FL3733_update_led_control_registers(DRIVER_ADDR_4, 3); # endif # elif defined(IS31FL3737) - IS31FL3737_update_led_control_registers(DRIVER_ADDR_1, DRIVER_ADDR_2); + IS31FL3737_update_led_control_registers(DRIVER_ADDR_1, 0); +# if defined(DRIVER_ADDR_2) && (DRIVER_ADDR_2 != DRIVER_ADDR_1) // provides backward compatibility + IS31FL3737_update_led_control_registers(DRIVER_ADDR_2, 1); +# endif # else IS31FL3741_update_led_control_registers(DRIVER_ADDR_1, 0); # endif @@ -152,7 +158,12 @@ const rgb_matrix_driver_t rgb_matrix_driver = { .set_color_all = IS31FL3733_set_color_all, }; # elif defined(IS31FL3737) -static void flush(void) { IS31FL3737_update_pwm_buffers(DRIVER_ADDR_1, DRIVER_ADDR_2); } +static void flush(void) { + IS31FL3737_update_pwm_buffers(DRIVER_ADDR_1, 0); +# if defined(DRIVER_ADDR_2) && (DRIVER_ADDR_2 != DRIVER_ADDR_1) // provides backward compatibility + IS31FL3737_update_pwm_buffers(DRIVER_ADDR_2, 1); +# endif +} const rgb_matrix_driver_t rgb_matrix_driver = { .init = init, @@ -161,7 +172,12 @@ const rgb_matrix_driver_t rgb_matrix_driver = { .set_color_all = IS31FL3737_set_color_all, }; # else -static void flush(void) { IS31FL3741_update_pwm_buffers(DRIVER_ADDR_1, DRIVER_ADDR_2); } +static void flush(void) { + IS31FL3741_update_pwm_buffers(DRIVER_ADDR_1, 0); +# if defined(DRIVER_ADDR_2) && (DRIVER_ADDR_2 != DRIVER_ADDR_1) // provides backward compatibility + IS31FL3741_update_pwm_buffers(DRIVER_ADDR_2, 1); +# endif +} const rgb_matrix_driver_t rgb_matrix_driver = { .init = init, @@ -171,6 +187,30 @@ const rgb_matrix_driver_t rgb_matrix_driver = { }; # endif +#elif defined(AW20216) +# include "spi_master.h" +static void init(void) { + spi_init(); + AW20216_init(DRIVER_1_CS, DRIVER_1_EN); +# ifdef DRIVER_2_CS + AW20216_init(DRIVER_2_CS, DRIVER_2_EN); +# endif +} + +static void flush(void) { + AW20216_update_pwm_buffers(DRIVER_1_CS, 0); +# ifdef DRIVER_2_CS + AW20216_update_pwm_buffers(DRIVER_2_CS, 1); +# endif +} + +const rgb_matrix_driver_t rgb_matrix_driver = { + .init = init, + .flush = flush, + .set_color = AW20216_set_color, + .set_color_all = AW20216_set_color_all, +}; + #elif defined(WS2812) # if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_CUSTOM_DRIVER) # pragma message "Cannot use RGBLIGHT and RGB Matrix using WS2812 at the same time." diff --git a/quantum/rgb_matrix/rgb_matrix_legacy_enables.h b/quantum/rgb_matrix/rgb_matrix_legacy_enables.h new file mode 100644 index 0000000000..398858ebc8 --- /dev/null +++ b/quantum/rgb_matrix/rgb_matrix_legacy_enables.h @@ -0,0 +1,153 @@ +/* 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/>. + */ + +// to-do: remove this + +#pragma once + +#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS +# define ENABLE_RGB_MATRIX_ALPHAS_MODS +#endif +#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN +# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +#endif +#ifndef DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +#endif +#ifndef DISABLE_RGB_MATRIX_BREATHING +# define ENABLE_RGB_MATRIX_BREATHING +#endif +#ifndef DISABLE_RGB_MATRIX_BAND_SAT +# define ENABLE_RGB_MATRIX_BAND_SAT +#endif +#ifndef DISABLE_RGB_MATRIX_BAND_VAL +# define ENABLE_RGB_MATRIX_BAND_VAL +#endif +#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +#endif +#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +#endif +#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +#endif +#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +#endif +#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_ALL +#endif +#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +#endif +#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +#endif +#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +#endif +#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +#endif +#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +#endif +#ifndef DISABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +#endif +#ifndef DISABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +#endif +#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON +# define ENABLE_RGB_MATRIX_DUAL_BEACON +#endif +#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_BEACON +#endif +#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS +# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +#endif +#ifndef DISABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_RAINDROPS +#endif +#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +#endif +#ifndef DISABLE_RGB_MATRIX_HUE_BREATHING +# define ENABLE_RGB_MATRIX_HUE_BREATHING +#endif +#ifndef DISABLE_RGB_MATRIX_HUE_PENDULUM +# define ENABLE_RGB_MATRIX_HUE_PENDULUM +#endif +#ifndef DISABLE_RGB_MATRIX_HUE_WAVE +# define ENABLE_RGB_MATRIX_HUE_WAVE +#endif +#ifndef DISABLE_RGB_MATRIX_PIXEL_RAIN +# define ENABLE_RGB_MATRIX_PIXEL_RAIN +#endif +#ifndef DISABLE_RGB_MATRIX_PIXEL_FLOW +# define ENABLE_RGB_MATRIX_PIXEL_FLOW +#endif +#ifndef DISABLE_RGB_MATRIX_PIXEL_FRACTAL +# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL +#endif +#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) +# ifndef DISABLE_RGB_MATRIX_TYPING_HEATMAP +# define ENABLE_RGB_MATRIX_TYPING_HEATMAP +# endif +# ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN +# define ENABLE_RGB_MATRIX_DIGITAL_RAIN +# endif +#endif +#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) +# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +# endif +# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE +# endif +# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +# endif +# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +# endif +# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +# endif +# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +# endif +# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +# endif +# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +# endif +# ifndef DISABLE_RGB_MATRIX_SPLASH +# define ENABLE_RGB_MATRIX_SPLASH +# endif +# ifndef DISABLE_RGB_MATRIX_MULTISPLASH +# define ENABLE_RGB_MATRIX_MULTISPLASH +# endif +# ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH +# define ENABLE_RGB_MATRIX_SOLID_SPLASH +# endif +# ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH +# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH +# endif +#endif diff --git a/quantum/rgb_matrix_types.h b/quantum/rgb_matrix/rgb_matrix_types.h index df575d6577..df575d6577 100644 --- a/quantum/rgb_matrix_types.h +++ b/quantum/rgb_matrix/rgb_matrix_types.h diff --git a/quantum/rgb_matrix_animations/rgb_matrix_effects.inc b/quantum/rgb_matrix_animations/rgb_matrix_effects.inc deleted file mode 100644 index 053d441506..0000000000 --- a/quantum/rgb_matrix_animations/rgb_matrix_effects.inc +++ /dev/null @@ -1,37 +0,0 @@ -// Add your new core rgb matrix effect here, order determins enum order, requires "rgb_matrix_animations/ directory -#include "rgb_matrix_animations/solid_color_anim.h" -#include "rgb_matrix_animations/alpha_mods_anim.h" -#include "rgb_matrix_animations/gradient_up_down_anim.h" -#include "rgb_matrix_animations/gradient_left_right_anim.h" -#include "rgb_matrix_animations/breathing_anim.h" -#include "rgb_matrix_animations/colorband_sat_anim.h" -#include "rgb_matrix_animations/colorband_val_anim.h" -#include "rgb_matrix_animations/colorband_pinwheel_sat_anim.h" -#include "rgb_matrix_animations/colorband_pinwheel_val_anim.h" -#include "rgb_matrix_animations/colorband_spiral_sat_anim.h" -#include "rgb_matrix_animations/colorband_spiral_val_anim.h" -#include "rgb_matrix_animations/cycle_all_anim.h" -#include "rgb_matrix_animations/cycle_left_right_anim.h" -#include "rgb_matrix_animations/cycle_up_down_anim.h" -#include "rgb_matrix_animations/rainbow_moving_chevron_anim.h" -#include "rgb_matrix_animations/cycle_out_in_anim.h" -#include "rgb_matrix_animations/cycle_out_in_dual_anim.h" -#include "rgb_matrix_animations/cycle_pinwheel_anim.h" -#include "rgb_matrix_animations/cycle_spiral_anim.h" -#include "rgb_matrix_animations/dual_beacon_anim.h" -#include "rgb_matrix_animations/rainbow_beacon_anim.h" -#include "rgb_matrix_animations/rainbow_pinwheels_anim.h" -#include "rgb_matrix_animations/raindrops_anim.h" -#include "rgb_matrix_animations/jellybean_raindrops_anim.h" -#include "rgb_matrix_animations/hue_breathing_anim.h" -#include "rgb_matrix_animations/hue_pendulum_anim.h" -#include "rgb_matrix_animations/hue_wave_anim.h" -#include "rgb_matrix_animations/typing_heatmap_anim.h" -#include "rgb_matrix_animations/digital_rain_anim.h" -#include "rgb_matrix_animations/solid_reactive_simple_anim.h" -#include "rgb_matrix_animations/solid_reactive_anim.h" -#include "rgb_matrix_animations/solid_reactive_wide.h" -#include "rgb_matrix_animations/solid_reactive_cross.h" -#include "rgb_matrix_animations/solid_reactive_nexus.h" -#include "rgb_matrix_animations/splash_anim.h" -#include "rgb_matrix_animations/solid_splash_anim.h" diff --git a/quantum/rgblight.c b/quantum/rgblight/rgblight.c index baa10ec416..148dae78f4 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight/rgblight.c @@ -16,17 +16,6 @@ #include <math.h> #include <string.h> #include <stdlib.h> -#ifdef __AVR__ -# include <avr/eeprom.h> -# include <avr/interrupt.h> -#endif -#ifdef EEPROM_ENABLE -# include "eeprom.h" -#endif -#ifdef STM32_EEPROM_ENABLE -# include <hal.h> -# include "eeprom_stm32.h" -#endif #include "wait.h" #include "progmem.h" #include "sync_timer.h" @@ -35,6 +24,9 @@ #include "debug.h" #include "led_tables.h" #include <lib/lib8tion/lib8tion.h> +#ifdef EEPROM_ENABLE +# include "eeprom.h" +#endif #ifdef VELOCIKEY_ENABLE # include "velocikey.h" #endif @@ -694,6 +686,9 @@ bool rgblight_get_layer_state(uint8_t layer) { // Write any enabled LED layers into the buffer static void rgblight_layers_write(void) { +# ifdef RGBLIGHT_LAYERS_RETAIN_VAL + uint8_t current_val = rgblight_get_val(); +# endif uint8_t i = 0; // For each layer for (const rgblight_segment_t *const *layer_ptr = rgblight_layers; i < RGBLIGHT_MAX_LAYERS; layer_ptr++, i++) { @@ -714,7 +709,11 @@ static void rgblight_layers_write(void) { // Write segment.count LEDs LED_TYPE *const limit = &led[MIN(segment.index + segment.count, RGBLED_NUM)]; for (LED_TYPE *led_ptr = &led[segment.index]; led_ptr < limit; led_ptr++) { +# ifdef RGBLIGHT_LAYERS_RETAIN_VAL + sethsv(segment.hue, segment.sat, current_val, led_ptr); +# else sethsv(segment.hue, segment.sat, segment.val, led_ptr); +# endif } segment_ptr++; } @@ -890,7 +889,7 @@ void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom) { animation_status.restart = true; } # endif /* RGBLIGHT_SPLIT_NO_ANIMATION_SYNC */ -# endif /* RGBLIGHT_USE_TIMER */ +# endif /* RGBLIGHT_USE_TIMER */ } #endif /* RGBLIGHT_SPLIT */ diff --git a/quantum/rgblight.h b/quantum/rgblight/rgblight.h index bec2c66955..5b90b8f49e 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight/rgblight.h @@ -79,7 +79,6 @@ # define RGBLIGHT_EFFECT_STATIC_GRADIENT # define RGBLIGHT_EFFECT_RGB_TEST # define RGBLIGHT_EFFECT_ALTERNATING -# define RGBLIGHT_EFFECT_TWINKLE #endif #ifdef RGBLIGHT_STATIC_PATTERNS @@ -115,73 +114,68 @@ enum RGBLIGHT_EFFECT_MODE { RGBLIGHT_MODE_last }; -#ifndef RGBLIGHT_H_DUMMY_DEFINE - -# define RGBLIGHT_MODES (RGBLIGHT_MODE_last - 1) +#define RGBLIGHT_MODES (RGBLIGHT_MODE_last - 1) // sample: #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 -# ifndef RGBLIGHT_EFFECT_BREATHE_MAX -# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255 -# endif - -# ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH -# define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 -# endif +#ifndef RGBLIGHT_EFFECT_BREATHE_MAX +# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255 +#endif -# ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH -# define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 -# endif +#ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH +# define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 +#endif -# ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET -# define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0 -# endif +#ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH +# define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 +#endif -# ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM -# define RGBLIGHT_EFFECT_KNIGHT_LED_NUM (rgblight_ranges.effect_num_leds) -# endif +#ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET +# define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0 +#endif -# ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL -# define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 40 -# endif +#ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM +# define RGBLIGHT_EFFECT_KNIGHT_LED_NUM (rgblight_ranges.effect_num_leds) +#endif -# ifndef RGBLIGHT_EFFECT_CHRISTMAS_STEP -# define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2 -# endif +#ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL +# define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 40 +#endif -# ifndef RGBLIGHT_EFFECT_TWINKLE_LIFE -# define RGBLIGHT_EFFECT_TWINKLE_LIFE 200 -# endif +#ifndef RGBLIGHT_EFFECT_CHRISTMAS_STEP +# define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2 +#endif -# ifndef RGBLIGHT_EFFECT_TWINKLE_PROBABILITY -# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 127 -# endif +#ifndef RGBLIGHT_EFFECT_TWINKLE_LIFE +# define RGBLIGHT_EFFECT_TWINKLE_LIFE 200 +#endif -# ifndef RGBLIGHT_HUE_STEP -# define RGBLIGHT_HUE_STEP 8 -# endif -# ifndef RGBLIGHT_SAT_STEP -# define RGBLIGHT_SAT_STEP 17 -# endif -# ifndef RGBLIGHT_VAL_STEP -# define RGBLIGHT_VAL_STEP 17 -# endif -# ifndef RGBLIGHT_LIMIT_VAL -# define RGBLIGHT_LIMIT_VAL 255 -# endif +#ifndef RGBLIGHT_EFFECT_TWINKLE_PROBABILITY +# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 127 +#endif -# include <stdint.h> -# include <stdbool.h> -# include "eeconfig.h" -# include "ws2812.h" -# include "color.h" -# include "rgblight_list.h" +#ifndef RGBLIGHT_HUE_STEP +# define RGBLIGHT_HUE_STEP 8 +#endif +#ifndef RGBLIGHT_SAT_STEP +# define RGBLIGHT_SAT_STEP 17 +#endif +#ifndef RGBLIGHT_VAL_STEP +# define RGBLIGHT_VAL_STEP 17 +#endif +#ifndef RGBLIGHT_LIMIT_VAL +# define RGBLIGHT_LIMIT_VAL 255 +#endif -# if defined(__AVR__) -# include <avr/pgmspace.h> -# endif +#include <stdint.h> +#include <stdbool.h> +#include "progmem.h" +#include "eeconfig.h" +#include "ws2812.h" +#include "color.h" +#include "rgblight_list.h" -# ifdef RGBLIGHT_LAYERS +#ifdef RGBLIGHT_LAYERS typedef struct { uint8_t index; // The first LED to light uint8_t count; // The number of LEDs to light @@ -190,27 +184,27 @@ typedef struct { uint8_t val; } rgblight_segment_t; -# define RGBLIGHT_END_SEGMENT_INDEX (255) -# define RGBLIGHT_END_SEGMENTS \ - { RGBLIGHT_END_SEGMENT_INDEX, 0, 0, 0 } -# ifndef RGBLIGHT_MAX_LAYERS -# define RGBLIGHT_MAX_LAYERS 8 -# endif -# if RGBLIGHT_MAX_LAYERS <= 0 -# error invalid RGBLIGHT_MAX_LAYERS value (must be >= 1) -# elif RGBLIGHT_MAX_LAYERS <= 8 +# define RGBLIGHT_END_SEGMENT_INDEX (255) +# define RGBLIGHT_END_SEGMENTS \ + { RGBLIGHT_END_SEGMENT_INDEX, 0, 0, 0 } +# ifndef RGBLIGHT_MAX_LAYERS +# define RGBLIGHT_MAX_LAYERS 8 +# endif +# if RGBLIGHT_MAX_LAYERS <= 0 +# error invalid RGBLIGHT_MAX_LAYERS value (must be >= 1) +# elif RGBLIGHT_MAX_LAYERS <= 8 typedef uint8_t rgblight_layer_mask_t; -# elif RGBLIGHT_MAX_LAYERS <= 16 +# elif RGBLIGHT_MAX_LAYERS <= 16 typedef uint16_t rgblight_layer_mask_t; -# elif RGBLIGHT_MAX_LAYERS <= 32 +# elif RGBLIGHT_MAX_LAYERS <= 32 typedef uint32_t rgblight_layer_mask_t; -# else -# error invalid RGBLIGHT_MAX_LAYERS value (must be <= 32) -# endif -# define RGBLIGHT_LAYER_SEGMENTS(...) \ - { __VA_ARGS__, RGBLIGHT_END_SEGMENTS } -# define RGBLIGHT_LAYERS_LIST(...) \ - { __VA_ARGS__, NULL } +# else +# error invalid RGBLIGHT_MAX_LAYERS value (must be <= 32) +# endif +# define RGBLIGHT_LAYER_SEGMENTS(...) \ + { __VA_ARGS__, RGBLIGHT_END_SEGMENTS } +# define RGBLIGHT_LAYERS_LIST(...) \ + { __VA_ARGS__, NULL } // Get/set enabled rgblight layers void rgblight_set_layer_state(uint8_t layer, bool enabled); @@ -219,14 +213,14 @@ bool rgblight_get_layer_state(uint8_t layer); // Point this to an array of rgblight_segment_t arrays in keyboard_post_init_user to use rgblight layers extern const rgblight_segment_t *const *rgblight_layers; -# ifdef RGBLIGHT_LAYER_BLINK -# define RGBLIGHT_USE_TIMER +# ifdef RGBLIGHT_LAYER_BLINK +# 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); -# endif - # endif +#endif + extern LED_TYPE led[RGBLED_NUM]; extern const uint8_t RGBLED_BREATHING_INTERVALS[4] PROGMEM; @@ -254,12 +248,12 @@ typedef union { typedef struct _rgblight_status_t { uint8_t base_mode; bool timer_enabled; -# ifdef RGBLIGHT_SPLIT +#ifdef RGBLIGHT_SPLIT uint8_t change_flags; -# endif -# ifdef RGBLIGHT_LAYERS +#endif +#ifdef RGBLIGHT_LAYERS rgblight_layer_mask_t enabled_layer_mask; -# endif +#endif } rgblight_status_t; /* @@ -295,12 +289,12 @@ void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8 void rgblight_sethsv_range(uint8_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end); void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b); -# ifndef RGBLIGHT_SPLIT +#ifndef RGBLIGHT_SPLIT void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b); void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b); void rgblight_sethsv_master(uint8_t hue, uint8_t sat, uint8_t val); void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val); -# endif +#endif /* effect mode change */ void rgblight_mode(uint8_t mode); @@ -374,29 +368,29 @@ void rgb_matrix_decrease(void); void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom); void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom); -# define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) +#define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b); -# ifdef RGBLIGHT_USE_TIMER +#ifdef RGBLIGHT_USE_TIMER void rgblight_task(void); void rgblight_timer_init(void); void rgblight_timer_enable(void); void rgblight_timer_disable(void); void rgblight_timer_toggle(void); -# else -# define rgblight_task() -# define rgblight_timer_init() -# define rgblight_timer_enable() -# define rgblight_timer_disable() -# define rgblight_timer_toggle() -# endif +#else +# define rgblight_task() +# define rgblight_timer_init() +# define rgblight_timer_enable() +# define rgblight_timer_disable() +# define rgblight_timer_toggle() +#endif -# ifdef RGBLIGHT_SPLIT -# define RGBLIGHT_STATUS_CHANGE_MODE (1 << 0) -# define RGBLIGHT_STATUS_CHANGE_HSVS (1 << 1) -# define RGBLIGHT_STATUS_CHANGE_TIMER (1 << 2) -# define RGBLIGHT_STATUS_ANIMATION_TICK (1 << 3) -# define RGBLIGHT_STATUS_CHANGE_LAYERS (1 << 4) +#ifdef RGBLIGHT_SPLIT +# define RGBLIGHT_STATUS_CHANGE_MODE (1 << 0) +# define RGBLIGHT_STATUS_CHANGE_HSVS (1 << 1) +# define RGBLIGHT_STATUS_CHANGE_TIMER (1 << 2) +# define RGBLIGHT_STATUS_ANIMATION_TICK (1 << 3) +# define RGBLIGHT_STATUS_CHANGE_LAYERS (1 << 4) typedef struct _rgblight_syncinfo_t { rgblight_config_t config; @@ -409,9 +403,9 @@ void rgblight_clear_change_flags(void); void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo); /* for split keyboard slave side */ void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom); -# endif +#endif -# ifdef RGBLIGHT_USE_TIMER +#ifdef RGBLIGHT_USE_TIMER typedef struct _animation_status_t { uint16_t last_timer; @@ -437,6 +431,4 @@ void rgblight_effect_rgbtest(animation_status_t *anim); void rgblight_effect_alternating(animation_status_t *anim); void rgblight_effect_twinkle(animation_status_t *anim); -# endif - -#endif // #ifndef RGBLIGHT_H_DUMMY_DEFINE +#endif diff --git a/quantum/rgblight_breathe_table.h b/quantum/rgblight/rgblight_breathe_table.h index 30245318b6..30245318b6 100644 --- a/quantum/rgblight_breathe_table.h +++ b/quantum/rgblight/rgblight_breathe_table.h diff --git a/quantum/rgblight_list.h b/quantum/rgblight/rgblight_list.h index f29a646b66..0fd68b75f3 100644 --- a/quantum/rgblight_list.h +++ b/quantum/rgblight/rgblight_list.h @@ -15,49 +15,7 @@ */ #pragma once -/* RGB COLORS */ -#define RGB_WHITE 0xFF, 0xFF, 0xFF -#define RGB_RED 0xFF, 0x00, 0x00 -#define RGB_CORAL 0xFF, 0x7C, 0x4D -#define RGB_ORANGE 0xFF, 0x80, 0x00 -#define RGB_GOLDENROD 0xD9, 0xA5, 0x21 -#define RGB_GOLD 0xFF, 0xD9, 0x00 -#define RGB_YELLOW 0xFF, 0xFF, 0x00 -#define RGB_CHARTREUSE 0x80, 0xFF, 0x00 -#define RGB_GREEN 0x00, 0xFF, 0x00 -#define RGB_SPRINGGREEN 0x00, 0xFF, 0x80 -#define RGB_TURQUOISE 0x47, 0x6E, 0x6A -#define RGB_TEAL 0x00, 0x80, 0x80 -#define RGB_CYAN 0x00, 0xFF, 0xFF -#define RGB_AZURE 0x99, 0xf5, 0xFF -#define RGB_BLUE 0x00, 0x00, 0xFF -#define RGB_PURPLE 0x7A, 0x00, 0xFF -#define RGB_MAGENTA 0xFF, 0x00, 0xFF -#define RGB_PINK 0xFF, 0x80, 0xBF -#define RGB_BLACK 0x00, 0x00, 0x00 -#define RGB_OFF RGB_BLACK - -/* HSV COLORS */ -#define HSV_WHITE 0, 0, 255 -#define HSV_RED 0, 255, 255 -#define HSV_CORAL 11, 176, 255 -#define HSV_ORANGE 28, 255, 255 -#define HSV_GOLDENROD 30, 218, 218 -#define HSV_GOLD 36, 255, 255 -#define HSV_YELLOW 43, 255, 255 -#define HSV_CHARTREUSE 64, 255, 255 -#define HSV_GREEN 85, 255, 255 -#define HSV_SPRINGGREEN 106, 255, 255 -#define HSV_TURQUOISE 123, 90, 112 -#define HSV_TEAL 128, 255, 128 -#define HSV_CYAN 128, 255, 255 -#define HSV_AZURE 132, 102, 255 -#define HSV_BLUE 170, 255, 255 -#define HSV_PURPLE 191, 255, 255 -#define HSV_MAGENTA 213, 255, 255 -#define HSV_PINK 234, 128, 255 -#define HSV_BLACK 0, 0, 0 -#define HSV_OFF HSV_BLACK +#include "color.h" /* ######################################################################################## @@ -66,7 +24,7 @@ ## ## ## The functions below have been deprecated and may be removed in a future release. ## ## ## -## Please use the values above with the RGB functions. ## +## Please use the values in color.h with the RGB functions. ## ## ## ## ## ## ## diff --git a/quantum/rgblight_modes.h b/quantum/rgblight/rgblight_modes.h index 7abdb87bc6..7abdb87bc6 100644 --- a/quantum/rgblight_modes.h +++ b/quantum/rgblight/rgblight_modes.h diff --git a/quantum/rgblight_post_config.h b/quantum/rgblight/rgblight_post_config.h index 3c14cb6109..3c14cb6109 100644 --- a/quantum/rgblight_post_config.h +++ b/quantum/rgblight/rgblight_post_config.h diff --git a/quantum/send_string.c b/quantum/send_string.c index 7d096b4273..1a7f7a1315 100644 --- a/quantum/send_string.c +++ b/quantum/send_string.c @@ -20,6 +20,14 @@ #include "send_string.h" +#if defined(AUDIO_ENABLE) && defined(SENDSTRING_BELL) +# include "audio.h" +# ifndef BELL_SOUND +# define BELL_SOUND TERMINAL_SOUND +# endif +float bell_song[][2] = SONG(BELL_SOUND); +#endif + // clang-format off /* Bit-Packed look-up table to convert an ASCII character to whether diff --git a/quantum/sequencer/sequencer.c b/quantum/sequencer/sequencer.c index 0eaf3a17aa..18a83661ec 100644 --- a/quantum/sequencer/sequencer.c +++ b/quantum/sequencer/sequencer.c @@ -211,7 +211,7 @@ void sequencer_phase_pause(void) { sequencer_internal_state.phase = SEQUENCER_PHASE_ATTACK; } -void matrix_scan_sequencer(void) { +void sequencer_task(void) { if (!sequencer_config.enabled) { return; } diff --git a/quantum/sequencer/sequencer.h b/quantum/sequencer/sequencer.h index aeca7a1e9b..4017ae764e 100644 --- a/quantum/sequencer/sequencer.h +++ b/quantum/sequencer/sequencer.h @@ -119,4 +119,4 @@ uint16_t sequencer_get_step_duration(void); uint16_t get_beat_duration(uint8_t tempo); uint16_t get_step_duration(uint8_t tempo, sequencer_resolution_t resolution); -void matrix_scan_sequencer(void); +void sequencer_task(void); diff --git a/quantum/sequencer/tests/sequencer_tests.cpp b/quantum/sequencer/tests/sequencer_tests.cpp index e81984e5b5..290605a52a 100644 --- a/quantum/sequencer/tests/sequencer_tests.cpp +++ b/quantum/sequencer/tests/sequencer_tests.cpp @@ -386,7 +386,7 @@ void setUpMatrixScanSequencerTest(void) { TEST_F(SequencerTest, TestMatrixScanSequencerShouldAttackFirstTrackOfFirstStep) { setUpMatrixScanSequencerTest(); - matrix_scan_sequencer(); + sequencer_task(); EXPECT_EQ(last_noteon, MI_C); EXPECT_EQ(last_noteoff, 0); } @@ -394,7 +394,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldAttackFirstTrackOfFirstStep) TEST_F(SequencerTest, TestMatrixScanSequencerShouldAttackSecondTrackAfterFirstTrackOfFirstStep) { setUpMatrixScanSequencerTest(); - matrix_scan_sequencer(); + sequencer_task(); EXPECT_EQ(sequencer_internal_state.current_step, 0); EXPECT_EQ(sequencer_internal_state.current_track, 1); EXPECT_EQ(sequencer_internal_state.phase, SEQUENCER_PHASE_ATTACK); @@ -409,7 +409,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldNotAttackInactiveTrackFirstSt // Wait some time after the first track has been attacked advance_time(SEQUENCER_TRACK_THROTTLE); - matrix_scan_sequencer(); + sequencer_task(); EXPECT_EQ(last_noteon, 0); EXPECT_EQ(last_noteoff, 0); } @@ -423,7 +423,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldAttackThirdTrackAfterSecondTr // Wait some time after the second track has been attacked advance_time(2 * SEQUENCER_TRACK_THROTTLE); - matrix_scan_sequencer(); + sequencer_task(); EXPECT_EQ(sequencer_internal_state.current_step, 0); EXPECT_EQ(sequencer_internal_state.current_track, 2); EXPECT_EQ(sequencer_internal_state.phase, SEQUENCER_PHASE_ATTACK); @@ -438,7 +438,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldEnterReleasePhaseAfterLastTra // Wait until all notes have been attacked advance_time((SEQUENCER_TRACKS - 1) * SEQUENCER_TRACK_THROTTLE); - matrix_scan_sequencer(); + sequencer_task(); EXPECT_EQ(last_noteon, 0); EXPECT_EQ(last_noteoff, 0); EXPECT_EQ(sequencer_internal_state.current_step, 0); @@ -458,7 +458,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldReleaseBackwards) { // + the release timeout advance_time(SEQUENCER_PHASE_RELEASE_TIMEOUT); - matrix_scan_sequencer(); + sequencer_task(); EXPECT_EQ(sequencer_internal_state.current_step, 0); EXPECT_EQ(sequencer_internal_state.current_track, SEQUENCER_TRACKS - 2); EXPECT_EQ(sequencer_internal_state.phase, SEQUENCER_PHASE_RELEASE); @@ -476,7 +476,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldNotReleaseInactiveTrackFirstS // + the release timeout advance_time(SEQUENCER_PHASE_RELEASE_TIMEOUT); - matrix_scan_sequencer(); + sequencer_task(); EXPECT_EQ(last_noteon, 0); EXPECT_EQ(last_noteoff, 0); } @@ -495,7 +495,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldReleaseFirstTrackFirstStep) { // + all the other notes have been released advance_time((SEQUENCER_TRACKS - 1) * SEQUENCER_TRACK_THROTTLE); - matrix_scan_sequencer(); + sequencer_task(); EXPECT_EQ(last_noteon, 0); EXPECT_EQ(last_noteoff, MI_C); } @@ -514,7 +514,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldEnterPausePhaseAfterRelease) // + all the other notes have been released advance_time((SEQUENCER_TRACKS - 1) * SEQUENCER_TRACK_THROTTLE); - matrix_scan_sequencer(); + sequencer_task(); EXPECT_EQ(sequencer_internal_state.current_step, 0); EXPECT_EQ(sequencer_internal_state.current_track, 0); EXPECT_EQ(sequencer_internal_state.phase, SEQUENCER_PHASE_PAUSE); @@ -536,7 +536,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldProcessFirstTrackOfSecondStep // + the step duration (one 16th at tempo=120 lasts 125ms) advance_time(125); - matrix_scan_sequencer(); + sequencer_task(); EXPECT_EQ(sequencer_internal_state.current_step, 1); EXPECT_EQ(sequencer_internal_state.current_track, 1); EXPECT_EQ(sequencer_internal_state.phase, SEQUENCER_PHASE_ATTACK); @@ -548,7 +548,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldProcessSecondTrackTooEarly) { sequencer_internal_state.current_step = 2; sequencer_internal_state.current_track = 1; - matrix_scan_sequencer(); + sequencer_task(); EXPECT_EQ(last_noteon, 0); EXPECT_EQ(last_noteoff, 0); } @@ -562,7 +562,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldProcessSecondTrackOnTime) { // Wait until first track has been attacked advance_time(SEQUENCER_TRACK_THROTTLE); - matrix_scan_sequencer(); + sequencer_task(); EXPECT_EQ(last_noteon, MI_D); EXPECT_EQ(last_noteoff, 0); } @@ -583,7 +583,7 @@ TEST_F(SequencerTest, TestMatrixScanSequencerShouldLoopOnceSequenceIsOver) { // + the step duration (one 16th at tempo=120 lasts 125ms) advance_time(125); - matrix_scan_sequencer(); + sequencer_task(); EXPECT_EQ(sequencer_internal_state.current_step, 0); EXPECT_EQ(sequencer_internal_state.current_track, 1); EXPECT_EQ(sequencer_internal_state.phase, SEQUENCER_PHASE_ATTACK); diff --git a/quantum/serial_link/system/serial_link.c b/quantum/serial_link/system/serial_link.c index f77483ad8c..6363f8ff3b 100644 --- a/quantum/serial_link/system/serial_link.c +++ b/quantum/serial_link/system/serial_link.c @@ -29,10 +29,13 @@ SOFTWARE. #include "serial_link/protocol/transport.h" #include "serial_link/protocol/frame_router.h" #include "matrix.h" +#include "sync_timer.h" #include <stdbool.h> #include "print.h" #include "config.h" +#define SYNC_TIMER_OFFSET 2 + static event_source_t new_data_event; static bool serial_link_connected; static bool is_master = false; @@ -159,10 +162,16 @@ static matrix_object_t last_matrix = {}; SLAVE_TO_MASTER_OBJECT(keyboard_matrix, matrix_object_t); MASTER_TO_ALL_SLAVES_OBJECT(serial_link_connected, bool); +#ifndef DISABLE_SYNC_TIMER +MASTER_TO_ALL_SLAVES_OBJECT(sync_timer, uint32_t); +#endif static remote_object_t* remote_objects[] = { REMOTE_OBJECT(serial_link_connected), REMOTE_OBJECT(keyboard_matrix), +#ifndef DISABLE_SYNC_TIMER + REMOTE_OBJECT(sync_timer), +#endif }; void init_serial_link(void) { @@ -200,14 +209,27 @@ void serial_link_update(void) { m->rows[i] = matrix.rows[i]; } end_write_keyboard_matrix(); + *begin_write_serial_link_connected() = true; end_write_serial_link_connected(); + +#ifndef DISABLE_SYNC_TIMER + *begin_write_sync_timer() = sync_timer_read32() + SYNC_TIMER_OFFSET; + end_write_sync_timer(); +#endif } matrix_object_t* m = read_keyboard_matrix(0); if (m) { matrix_set_remote(m->rows, 0); } + +#ifndef DISABLE_SYNC_TIMER + uint32_t* t = read_sync_timer(); + if (t) { + sync_timer_update(*t); + } +#endif } void signal_data_written(void) { chEvtBroadcast(&new_data_event); } diff --git a/quantum/split_common/matrix.c b/quantum/split_common/matrix.c deleted file mode 100644 index 039e7d9773..0000000000 --- a/quantum/split_common/matrix.c +++ /dev/null @@ -1,309 +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/>. -*/ -#include <stdint.h> -#include <stdbool.h> -#include "util.h" -#include "matrix.h" -#include "debounce.h" -#include "quantum.h" -#include "split_util.h" -#include "config.h" -#include "transport.h" - -#define ERROR_DISCONNECT_COUNT 5 - -#define ROWS_PER_HAND (MATRIX_ROWS / 2) - -#ifdef DIRECT_PINS -static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS; -#elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW) -static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; -static pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; -#endif - -/* matrix state(1:on, 0:off) */ -extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values -extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values - -// row offsets for each hand -uint8_t thisHand, thatHand; - -// user-defined overridable functions -__attribute__((weak)) void matrix_slave_scan_kb(void) { matrix_slave_scan_user(); } -__attribute__((weak)) void matrix_slave_scan_user(void) {} - -static inline void setPinOutput_writeLow(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinOutput(pin); - writePinLow(pin); - } -} - -static inline void setPinInputHigh_atomic(pin_t pin) { - ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } -} - -// 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) { - // Start with a clear matrix row - matrix_row_t current_row_value = 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_row_value |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); - } - } - - // If the row has changed, store the row and return the changed flag. - if (current_matrix[current_row] != current_row_value) { - current_matrix[current_row] = current_row_value; - return true; - } - return false; -} - -#elif defined(DIODE_DIRECTION) -# if (DIODE_DIRECTION == COL2ROW) - -static void select_row(uint8_t row) { setPinOutput_writeLow(row_pins[row]); } - -static void unselect_row(uint8_t row) { setPinInputHigh_atomic(row_pins[row]); } - -static void unselect_rows(void) { - for (uint8_t x = 0; x < ROWS_PER_HAND; x++) { - setPinInputHigh_atomic(row_pins[x]); - } -} - -static void init_pins(void) { - unselect_rows(); - for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh_atomic(col_pins[x]); - } -} - -static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { - // Start with a clear matrix row - matrix_row_t current_row_value = 0; - - // Select row - select_row(current_row); - matrix_output_select_delay(); - - // 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_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); - } - - // Unselect row - unselect_row(current_row); - matrix_output_unselect_delay(); // wait for all Col signals to go HIGH - - // If the row has changed, store the row and return the changed flag. - if (current_matrix[current_row] != current_row_value) { - current_matrix[current_row] = current_row_value; - return true; - } - return false; -} - -# elif (DIODE_DIRECTION == ROW2COL) - -static void select_col(uint8_t col) { setPinOutput_writeLow(col_pins[col]); } - -static void unselect_col(uint8_t col) { setPinInputHigh_atomic(col_pins[col]); } - -static void unselect_cols(void) { - for (uint8_t x = 0; x < MATRIX_COLS; x++) { - setPinInputHigh_atomic(col_pins[x]); - } -} - -static void init_pins(void) { - unselect_cols(); - for (uint8_t x = 0; x < ROWS_PER_HAND; x++) { - setPinInputHigh_atomic(row_pins[x]); - } -} - -static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { - bool matrix_changed = false; - - // Select col - select_col(current_col); - matrix_output_select_delay(); - - // For each row... - for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) { - // Store last value of row prior to reading - matrix_row_t last_row_value = current_matrix[row_index]; - matrix_row_t current_row_value = last_row_value; - - // Check row pin state - if (readPin(row_pins[row_index]) == 0) { - // Pin LO, set col bit - current_row_value |= (MATRIX_ROW_SHIFTER << current_col); - } else { - // Pin HI, clear col bit - current_row_value &= ~(MATRIX_ROW_SHIFTER << current_col); - } - - // Determine if the matrix changed state - if ((last_row_value != current_row_value)) { - matrix_changed |= true; - current_matrix[row_index] = current_row_value; - } - } - - // Unselect col - unselect_col(current_col); - matrix_output_unselect_delay(); // wait for all Row signals to go HIGH - - return matrix_changed; -} - -# else -# error DIODE_DIRECTION must be one of COL2ROW or ROW2COL! -# endif -#else -# error DIODE_DIRECTION is not defined! -#endif - -void matrix_init(void) { - split_pre_init(); - - // Set pinout for right half if pinout for that half is defined - if (!isLeftHand) { -#ifdef DIRECT_PINS_RIGHT - const pin_t direct_pins_right[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS_RIGHT; - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - for (uint8_t j = 0; j < MATRIX_COLS; j++) { - direct_pins[i][j] = direct_pins_right[i][j]; - } - } -#endif -#ifdef MATRIX_ROW_PINS_RIGHT - const pin_t row_pins_right[MATRIX_ROWS] = MATRIX_ROW_PINS_RIGHT; - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - row_pins[i] = row_pins_right[i]; - } -#endif -#ifdef MATRIX_COL_PINS_RIGHT - const pin_t col_pins_right[MATRIX_COLS] = MATRIX_COL_PINS_RIGHT; - for (uint8_t i = 0; i < MATRIX_COLS; i++) { - col_pins[i] = col_pins_right[i]; - } -#endif - } - - thisHand = isLeftHand ? 0 : (ROWS_PER_HAND); - thatHand = ROWS_PER_HAND - thisHand; - - // initialize key pins - init_pins(); - - // initialize matrix state: all keys off - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - raw_matrix[i] = 0; - matrix[i] = 0; - } - - debounce_init(ROWS_PER_HAND); - - matrix_init_quantum(); - - split_post_init(); -} - -bool matrix_post_scan(void) { - bool changed = false; - if (is_keyboard_master()) { - static uint8_t error_count; - - matrix_row_t slave_matrix[ROWS_PER_HAND] = {0}; - if (!transport_master(matrix + thisHand, slave_matrix)) { - error_count++; - - if (error_count > ERROR_DISCONNECT_COUNT) { - // reset other half if disconnected - for (int i = 0; i < ROWS_PER_HAND; ++i) { - matrix[thatHand + i] = 0; - slave_matrix[i] = 0; - } - - changed = true; - } - } else { - error_count = 0; - - for (int i = 0; i < ROWS_PER_HAND; ++i) { - if (matrix[thatHand + i] != slave_matrix[i]) { - matrix[thatHand + i] = slave_matrix[i]; - changed = true; - } - } - } - - matrix_scan_quantum(); - } else { - transport_slave(matrix + thatHand, matrix + thisHand); - - matrix_slave_scan_kb(); - } - - return changed; -} - -uint8_t matrix_scan(void) { - bool local_changed = false; - -#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW) - // Set row, read cols - for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) { - local_changed |= read_cols_on_row(raw_matrix, current_row); - } -#elif (DIODE_DIRECTION == ROW2COL) - // Set col, read rows - for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { - local_changed |= read_rows_on_col(raw_matrix, current_col); - } -#endif - - debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, local_changed); - - bool remote_changed = matrix_post_scan(); - return (uint8_t)(local_changed || remote_changed); -} diff --git a/quantum/split_common/post_config.h b/quantum/split_common/post_config.h index 4ae1d52732..a4c0a1956b 100644 --- a/quantum/split_common/post_config.h +++ b/quantum/split_common/post_config.h @@ -7,13 +7,4 @@ # ifndef F_SCL # define F_SCL 100000UL // SCL frequency # endif - -#else // use serial -// When using serial, the user must define RGBLIGHT_SPLIT explicitly -// in config.h as needed. -// see quantum/rgblight_post_config.h -# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) -// When using serial and RGBLIGHT_SPLIT need separate transaction -# define SERIAL_USE_MULTI_TRANSACTION -# endif #endif diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c index 9e75e19ce0..35f0a9d181 100644 --- a/quantum/split_common/split_util.c +++ b/quantum/split_common/split_util.c @@ -39,6 +39,21 @@ # define SPLIT_USB_TIMEOUT_POLL 10 #endif +// Max number of consecutive failed communications (one per scan cycle) before the communication is seen as disconnected. +// Set to 0 to disable the disconnection check altogether. +#ifndef SPLIT_MAX_CONNECTION_ERRORS +# define SPLIT_MAX_CONNECTION_ERRORS 10 +#endif // SPLIT_MAX_CONNECTION_ERRORS + +// How long (in milliseconds) to block all connection attempts after the communication has been flagged as disconnected. +// One communication attempt will be allowed everytime this amount of time has passed since the last attempt. If that attempt succeeds, the communication is seen as working again. +// Set to 0 to disable communication throttling while disconnected +#ifndef SPLIT_CONNECTION_CHECK_TIMEOUT +# define SPLIT_CONNECTION_CHECK_TIMEOUT 500 +#endif // SPLIT_CONNECTION_CHECK_TIMEOUT + +static uint8_t connection_errors = 0; + volatile bool isLeftHand = true; #if defined(SPLIT_USB_DETECT) @@ -77,7 +92,11 @@ __attribute__((weak)) 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); +# ifdef SPLIT_HAND_PIN_LOW_IS_LEFT + return !readPin(SPLIT_HAND_PIN); +# else return readPin(SPLIT_HAND_PIN); +# endif #elif defined(SPLIT_HAND_MATRIX_GRID) # ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT return peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID); @@ -102,7 +121,7 @@ __attribute__((weak)) bool is_keyboard_master(void) { // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow if (usbstate == SLAVE) { - usb_disable(); + usb_disconnect(); } } @@ -138,3 +157,39 @@ void split_post_init(void) { transport_slave_init(); } } + +bool is_transport_connected(void) { return connection_errors < SPLIT_MAX_CONNECTION_ERRORS; } + +bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { +#if SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0 + // Throttle transaction attempts if target doesn't seem to be connected + // Without this, a solo half becomes unusable due to constant read timeouts + static uint16_t connection_check_timer = 0; + const bool is_disconnected = !is_transport_connected(); + if (is_disconnected && timer_elapsed(connection_check_timer) < SPLIT_CONNECTION_CHECK_TIMEOUT) { + return false; + } +#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0 + + __attribute__((unused)) bool okay = transport_master(master_matrix, slave_matrix); +#if SPLIT_MAX_CONNECTION_ERRORS > 0 + if (!okay) { + if (connection_errors < UINT8_MAX) { + connection_errors++; + } +# if SPLIT_CONNECTION_CHECK_TIMEOUT > 0 + bool connected = is_transport_connected(); + if (!connected) { + connection_check_timer = timer_read(); + dprintln("Target disconnected, throttling connection attempts"); + } + return connected; + } else if (is_disconnected) { + dprintln("Target connected"); +# endif // SPLIT_CONNECTION_CHECK_TIMEOUT > 0 + } + + connection_errors = 0; +#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 + return true; +} diff --git a/quantum/split_common/split_util.h b/quantum/split_common/split_util.h index a4c12519e0..ef72043bb7 100644 --- a/quantum/split_common/split_util.h +++ b/quantum/split_common/split_util.h @@ -5,8 +5,13 @@ #include <stdio.h> #include <stdlib.h> +#include "matrix.h" + extern volatile bool isLeftHand; void matrix_master_OLED_init(void); void split_pre_init(void); void split_post_init(void); + +bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]); +bool is_transport_connected(void); diff --git a/quantum/split_common/transaction_id_define.h b/quantum/split_common/transaction_id_define.h new file mode 100644 index 0000000000..535bc21aea --- /dev/null +++ b/quantum/split_common/transaction_id_define.h @@ -0,0 +1,102 @@ +/* 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 + +enum serial_transaction_id { +#ifdef USE_I2C + I2C_EXECUTE_CALLBACK, +#endif // USE_I2C + + GET_SLAVE_MATRIX_CHECKSUM, + GET_SLAVE_MATRIX_DATA, + +#ifdef SPLIT_TRANSPORT_MIRROR + PUT_MASTER_MATRIX, +#endif // SPLIT_TRANSPORT_MIRROR + +#ifdef ENCODER_ENABLE + GET_ENCODERS_CHECKSUM, + GET_ENCODERS_DATA, +#endif // ENCODER_ENABLE + +#ifndef DISABLE_SYNC_TIMER + PUT_SYNC_TIMER, +#endif // DISABLE_SYNC_TIMER + +#if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) + PUT_LAYER_STATE, + PUT_DEFAULT_LAYER_STATE, +#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) + +#ifdef SPLIT_LED_STATE_ENABLE + PUT_LED_STATE, +#endif // SPLIT_LED_STATE_ENABLE + +#ifdef SPLIT_MODS_ENABLE + PUT_MODS, +#endif // SPLIT_MODS_ENABLE + +#ifdef BACKLIGHT_ENABLE + PUT_BACKLIGHT, +#endif // BACKLIGHT_ENABLE + +#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + PUT_RGBLIGHT, +#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + +#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) + PUT_LED_MATRIX, +#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) + +#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) + PUT_RGB_MATRIX, +#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + +#if defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) + PUT_WPM, +#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) + +#if defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) + PUT_OLED, +#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) + +#if defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) + PUT_ST7565, +#endif // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) + +#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) + PUT_RPC_INFO, + PUT_RPC_REQ_DATA, + EXECUTE_RPC, + GET_RPC_RESP_DATA, +#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) + +// keyboard-specific +#ifdef SPLIT_TRANSACTION_IDS_KB + SPLIT_TRANSACTION_IDS_KB, +#endif // SPLIT_TRANSACTION_IDS_KB + +// user/keymap-specific +#ifdef SPLIT_TRANSACTION_IDS_USER + SPLIT_TRANSACTION_IDS_USER, +#endif // SPLIT_TRANSACTION_IDS_USER + + NUM_TOTAL_TRANSACTIONS +}; + +// Ensure we only use 5 bits for transaction +_Static_assert(NUM_TOTAL_TRANSACTIONS <= (1 << 5), "Max number of usable transactions exceeded"); diff --git a/quantum/split_common/transactions.c b/quantum/split_common/transactions.c new file mode 100644 index 0000000000..fd676f0729 --- /dev/null +++ b/quantum/split_common/transactions.c @@ -0,0 +1,723 @@ +/* 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 <string.h> +#include <stddef.h> + +#include "crc.h" +#include "debug.h" +#include "matrix.h" +#include "quantum.h" +#include "transactions.h" +#include "transport.h" +#include "split_util.h" +#include "transaction_id_define.h" + +#define SYNC_TIMER_OFFSET 2 + +#ifndef FORCED_SYNC_THROTTLE_MS +# define FORCED_SYNC_THROTTLE_MS 100 +#endif // FORCED_SYNC_THROTTLE_MS + +#define sizeof_member(type, member) sizeof(((type *)NULL)->member) + +#define trans_initiator2target_initializer_cb(member, cb) \ + { &dummy, sizeof_member(split_shared_memory_t, member), offsetof(split_shared_memory_t, member), 0, 0, cb } +#define trans_initiator2target_initializer(member) trans_initiator2target_initializer_cb(member, NULL) + +#define trans_target2initiator_initializer_cb(member, cb) \ + { &dummy, 0, 0, sizeof_member(split_shared_memory_t, member), offsetof(split_shared_memory_t, member), cb } +#define trans_target2initiator_initializer(member) trans_target2initiator_initializer_cb(member, NULL) + +#define transport_write(id, data, length) transport_execute_transaction(id, data, length, NULL, 0) +#define transport_read(id, data, length) transport_execute_transaction(id, NULL, 0, data, length) + +#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) +// Forward-declare the RPC callback handlers +void slave_rpc_info_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer); +void slave_rpc_exec_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer); +#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) + +//////////////////////////////////////////////////// +// Helpers + +static bool transaction_handler_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[], const char *prefix, bool (*handler)(matrix_row_t master_matrix[], matrix_row_t slave_matrix[])) { + int num_retries = is_transport_connected() ? 10 : 1; + for (int iter = 1; iter <= num_retries; ++iter) { + if (iter > 1) { + for (int i = 0; i < iter * iter; ++i) { + wait_us(10); + } + } + bool this_okay = true; + ATOMIC_BLOCK_FORCEON { this_okay = handler(master_matrix, slave_matrix); }; + if (this_okay) return true; + } + dprintf("Failed to execute %s\n", prefix); + return false; +} + +#define TRANSACTION_HANDLER_MASTER(prefix) \ + do { \ + 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); }; \ + } 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) { + uint8_t curr_checksum; + bool okay = transport_read(trans_id_checksum, &curr_checksum, sizeof(curr_checksum)); + if (okay && (timer_elapsed32(*last_update) >= FORCED_SYNC_THROTTLE_MS || curr_checksum != crc8(equiv_shmem, length))) { + okay &= transport_read(trans_id_retrieve, destination, length); + okay &= curr_checksum == crc8(equiv_shmem, length); + if (okay) { + *last_update = timer_read32(); + } + } else { + memcpy(destination, equiv_shmem, length); + } + return okay; +} + +inline static bool send_if_condition(int8_t trans_id, uint32_t *last_update, bool condition, void *source, size_t length) { + bool okay = true; + if (timer_elapsed32(*last_update) >= FORCED_SYNC_THROTTLE_MS || condition) { + okay &= transport_write(trans_id, source, length); + if (okay) { + *last_update = timer_read32(); + } + } + return okay; +} + +inline static bool send_if_data_mismatch(int8_t trans_id, uint32_t *last_update, void *source, const void *equiv_shmem, size_t length) { + // Just run a memcmp to compare the source and equivalent shmem location + return send_if_condition(trans_id, last_update, (memcmp(source, equiv_shmem, length) != 0), source, length); +} + +//////////////////////////////////////////////////// +// Slave matrix + +static bool slave_matrix_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_update = 0; + static matrix_row_t last_matrix[(MATRIX_ROWS) / 2] = {0}; // last successfully-read matrix, so we can replicate if there are checksum errors + matrix_row_t temp_matrix[(MATRIX_ROWS) / 2]; // holding area while we test whether or not checksum is correct + + bool okay = read_if_checksum_mismatch(GET_SLAVE_MATRIX_CHECKSUM, GET_SLAVE_MATRIX_DATA, &last_update, temp_matrix, split_shmem->smatrix.matrix, sizeof(split_shmem->smatrix.matrix)); + if (okay) { + // Checksum matches the received data, save as the last matrix state + memcpy(last_matrix, temp_matrix, sizeof(temp_matrix)); + } + // Copy out the last-known-good matrix state to the slave matrix + memcpy(slave_matrix, last_matrix, sizeof(last_matrix)); + return okay; +} + +static void slave_matrix_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + memcpy(split_shmem->smatrix.matrix, slave_matrix, sizeof(split_shmem->smatrix.matrix)); + split_shmem->smatrix.checksum = crc8(split_shmem->smatrix.matrix, sizeof(split_shmem->smatrix.matrix)); +} + +// clang-format off +#define TRANSACTIONS_SLAVE_MATRIX_MASTER() TRANSACTION_HANDLER_MASTER(slave_matrix) +#define TRANSACTIONS_SLAVE_MATRIX_SLAVE() TRANSACTION_HANDLER_SLAVE(slave_matrix) +#define TRANSACTIONS_SLAVE_MATRIX_REGISTRATIONS \ + [GET_SLAVE_MATRIX_CHECKSUM] = trans_target2initiator_initializer(smatrix.checksum), \ + [GET_SLAVE_MATRIX_DATA] = trans_target2initiator_initializer(smatrix.matrix), +// clang-format on + +//////////////////////////////////////////////////// +// Master matrix + +#ifdef SPLIT_TRANSPORT_MIRROR + +static bool master_matrix_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_update = 0; + return send_if_data_mismatch(PUT_MASTER_MATRIX, &last_update, master_matrix, split_shmem->mmatrix.matrix, sizeof(split_shmem->mmatrix.matrix)); +} + +static void master_matrix_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + // Always copy to the master matrix + memcpy(master_matrix, split_shmem->mmatrix.matrix, sizeof(split_shmem->mmatrix.matrix)); +} + +# define TRANSACTIONS_MASTER_MATRIX_MASTER() TRANSACTION_HANDLER_MASTER(master_matrix) +# define TRANSACTIONS_MASTER_MATRIX_SLAVE() TRANSACTION_HANDLER_SLAVE(master_matrix) +# define TRANSACTIONS_MASTER_MATRIX_REGISTRATIONS [PUT_MASTER_MATRIX] = trans_initiator2target_initializer(mmatrix.matrix), + +#else // SPLIT_TRANSPORT_MIRROR + +# define TRANSACTIONS_MASTER_MATRIX_MASTER() +# define TRANSACTIONS_MASTER_MATRIX_SLAVE() +# define TRANSACTIONS_MASTER_MATRIX_REGISTRATIONS + +#endif // SPLIT_TRANSPORT_MIRROR + +//////////////////////////////////////////////////// +// Encoders + +#ifdef ENCODER_ENABLE + +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]; + + 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); + return okay; +} + +static void encoder_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + uint8_t encoder_state[NUMBER_OF_ENCODERS]; + encoder_state_raw(encoder_state); + // Always prepare the encoder state for read. + memcpy(split_shmem->encoders.state, encoder_state, sizeof(encoder_state)); + // Now update the checksum given that the encoders has been written to + split_shmem->encoders.checksum = crc8(encoder_state, sizeof(encoder_state)); +} + +// clang-format off +# define TRANSACTIONS_ENCODERS_MASTER() TRANSACTION_HANDLER_MASTER(encoder) +# define TRANSACTIONS_ENCODERS_SLAVE() TRANSACTION_HANDLER_SLAVE(encoder) +# define TRANSACTIONS_ENCODERS_REGISTRATIONS \ + [GET_ENCODERS_CHECKSUM] = trans_target2initiator_initializer(encoders.checksum), \ + [GET_ENCODERS_DATA] = trans_target2initiator_initializer(encoders.state), +// clang-format on + +#else // ENCODER_ENABLE + +# define TRANSACTIONS_ENCODERS_MASTER() +# define TRANSACTIONS_ENCODERS_SLAVE() +# define TRANSACTIONS_ENCODERS_REGISTRATIONS + +#endif // ENCODER_ENABLE + +//////////////////////////////////////////////////// +// Sync timer + +#ifndef DISABLE_SYNC_TIMER + +static bool sync_timer_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_update = 0; + + bool okay = true; + if (timer_elapsed32(last_update) >= FORCED_SYNC_THROTTLE_MS) { + uint32_t sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; + okay &= transport_write(PUT_SYNC_TIMER, &sync_timer, sizeof(sync_timer)); + if (okay) { + last_update = timer_read32(); + } + } + return okay; +} + +static void sync_timer_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_sync_timer = 0; + if (last_sync_timer != split_shmem->sync_timer) { + last_sync_timer = split_shmem->sync_timer; + sync_timer_update(last_sync_timer); + } +} + +# define TRANSACTIONS_SYNC_TIMER_MASTER() TRANSACTION_HANDLER_MASTER(sync_timer) +# define TRANSACTIONS_SYNC_TIMER_SLAVE() TRANSACTION_HANDLER_SLAVE(sync_timer) +# define TRANSACTIONS_SYNC_TIMER_REGISTRATIONS [PUT_SYNC_TIMER] = trans_initiator2target_initializer(sync_timer), + +#else // DISABLE_SYNC_TIMER + +# define TRANSACTIONS_SYNC_TIMER_MASTER() +# define TRANSACTIONS_SYNC_TIMER_SLAVE() +# define TRANSACTIONS_SYNC_TIMER_REGISTRATIONS + +#endif // DISABLE_SYNC_TIMER + +//////////////////////////////////////////////////// +// Layer state + +#if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) + +static bool layer_state_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_layer_state_update = 0; + static uint32_t last_default_layer_state_update = 0; + + bool okay = send_if_condition(PUT_LAYER_STATE, &last_layer_state_update, (layer_state != split_shmem->layers.layer_state), &layer_state, sizeof(layer_state)); + if (okay) { + okay &= send_if_condition(PUT_DEFAULT_LAYER_STATE, &last_default_layer_state_update, (default_layer_state != split_shmem->layers.default_layer_state), &default_layer_state, sizeof(default_layer_state)); + } + return okay; +} + +static void layer_state_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + layer_state = split_shmem->layers.layer_state; + default_layer_state = split_shmem->layers.default_layer_state; +} + +// clang-format off +# define TRANSACTIONS_LAYER_STATE_MASTER() TRANSACTION_HANDLER_MASTER(layer_state) +# define TRANSACTIONS_LAYER_STATE_SLAVE() TRANSACTION_HANDLER_SLAVE(layer_state) +# define TRANSACTIONS_LAYER_STATE_REGISTRATIONS \ + [PUT_LAYER_STATE] = trans_initiator2target_initializer(layers.layer_state), \ + [PUT_DEFAULT_LAYER_STATE] = trans_initiator2target_initializer(layers.default_layer_state), +// clang-format on + +#else // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) + +# define TRANSACTIONS_LAYER_STATE_MASTER() +# define TRANSACTIONS_LAYER_STATE_SLAVE() +# define TRANSACTIONS_LAYER_STATE_REGISTRATIONS + +#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) + +//////////////////////////////////////////////////// +// LED state + +#ifdef SPLIT_LED_STATE_ENABLE + +static bool led_state_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_update = 0; + uint8_t led_state = host_keyboard_leds(); + return send_if_data_mismatch(PUT_LED_STATE, &last_update, &led_state, &split_shmem->led_state, sizeof(led_state)); +} + +static void led_state_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + void set_split_host_keyboard_leds(uint8_t led_state); + set_split_host_keyboard_leds(split_shmem->led_state); +} + +# define TRANSACTIONS_LED_STATE_MASTER() TRANSACTION_HANDLER_MASTER(led_state) +# define TRANSACTIONS_LED_STATE_SLAVE() TRANSACTION_HANDLER_SLAVE(led_state) +# define TRANSACTIONS_LED_STATE_REGISTRATIONS [PUT_LED_STATE] = trans_initiator2target_initializer(led_state), + +#else // SPLIT_LED_STATE_ENABLE + +# define TRANSACTIONS_LED_STATE_MASTER() +# define TRANSACTIONS_LED_STATE_SLAVE() +# define TRANSACTIONS_LED_STATE_REGISTRATIONS + +#endif // SPLIT_LED_STATE_ENABLE + +//////////////////////////////////////////////////// +// Mods + +#ifdef SPLIT_MODS_ENABLE + +static bool mods_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_update = 0; + bool mods_need_sync = timer_elapsed32(last_update) >= FORCED_SYNC_THROTTLE_MS; + split_mods_sync_t new_mods; + new_mods.real_mods = get_mods(); + if (!mods_need_sync && new_mods.real_mods != split_shmem->mods.real_mods) { + mods_need_sync = true; + } + + new_mods.weak_mods = get_weak_mods(); + if (!mods_need_sync && new_mods.weak_mods != split_shmem->mods.weak_mods) { + mods_need_sync = true; + } + +# ifndef NO_ACTION_ONESHOT + new_mods.oneshot_mods = get_oneshot_mods(); + if (!mods_need_sync && new_mods.oneshot_mods != split_shmem->mods.oneshot_mods) { + mods_need_sync = true; + } +# endif // NO_ACTION_ONESHOT + + bool okay = true; + if (mods_need_sync) { + okay &= transport_write(PUT_MODS, &new_mods, sizeof(new_mods)); + if (okay) { + last_update = timer_read32(); + } + } + + return okay; +} + +static void mods_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + set_mods(split_shmem->mods.real_mods); + set_weak_mods(split_shmem->mods.weak_mods); +# ifndef NO_ACTION_ONESHOT + set_oneshot_mods(split_shmem->mods.oneshot_mods); +# endif +} + +# define TRANSACTIONS_MODS_MASTER() TRANSACTION_HANDLER_MASTER(mods) +# define TRANSACTIONS_MODS_SLAVE() TRANSACTION_HANDLER_SLAVE(mods) +# define TRANSACTIONS_MODS_REGISTRATIONS [PUT_MODS] = trans_initiator2target_initializer(mods), + +#else // SPLIT_MODS_ENABLE + +# define TRANSACTIONS_MODS_MASTER() +# define TRANSACTIONS_MODS_SLAVE() +# define TRANSACTIONS_MODS_REGISTRATIONS + +#endif // SPLIT_MODS_ENABLE + +//////////////////////////////////////////////////// +// Backlight + +#ifdef BACKLIGHT_ENABLE + +static bool backlight_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_update = 0; + uint8_t level = is_backlight_enabled() ? get_backlight_level() : 0; + return send_if_condition(PUT_BACKLIGHT, &last_update, (level != split_shmem->backlight_level), &level, sizeof(level)); +} + +static void backlight_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { backlight_set(split_shmem->backlight_level); } + +# define TRANSACTIONS_BACKLIGHT_MASTER() TRANSACTION_HANDLER_MASTER(backlight) +# define TRANSACTIONS_BACKLIGHT_SLAVE() TRANSACTION_HANDLER_SLAVE(backlight) +# define TRANSACTIONS_BACKLIGHT_REGISTRATIONS [PUT_BACKLIGHT] = trans_initiator2target_initializer(backlight_level), + +#else // BACKLIGHT_ENABLE + +# define TRANSACTIONS_BACKLIGHT_MASTER() +# define TRANSACTIONS_BACKLIGHT_SLAVE() +# define TRANSACTIONS_BACKLIGHT_REGISTRATIONS + +#endif // BACKLIGHT_ENABLE + +//////////////////////////////////////////////////// +// RGBLIGHT + +#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + +static bool rgblight_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_update = 0; + rgblight_syncinfo_t rgblight_sync; + rgblight_get_syncinfo(&rgblight_sync); + if (send_if_condition(PUT_RGBLIGHT, &last_update, (rgblight_sync.status.change_flags != 0), &rgblight_sync, sizeof(rgblight_sync))) { + rgblight_clear_change_flags(); + } else { + return false; + } + return true; +} + +static void rgblight_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + // Update the RGB with the new data + if (split_shmem->rgblight_sync.status.change_flags != 0) { + rgblight_update_sync(&split_shmem->rgblight_sync, false); + split_shmem->rgblight_sync.status.change_flags = 0; + } +} + +# define TRANSACTIONS_RGBLIGHT_MASTER() TRANSACTION_HANDLER_MASTER(rgblight) +# define TRANSACTIONS_RGBLIGHT_SLAVE() TRANSACTION_HANDLER_SLAVE(rgblight) +# define TRANSACTIONS_RGBLIGHT_REGISTRATIONS [PUT_RGBLIGHT] = trans_initiator2target_initializer(rgblight_sync), + +#else // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + +# define TRANSACTIONS_RGBLIGHT_MASTER() +# define TRANSACTIONS_RGBLIGHT_SLAVE() +# define TRANSACTIONS_RGBLIGHT_REGISTRATIONS + +#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + +//////////////////////////////////////////////////// +// LED Matrix + +#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) + +static bool led_matrix_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_update = 0; + led_matrix_sync_t led_matrix_sync; + memcpy(&led_matrix_sync.led_matrix, &led_matrix_eeconfig, sizeof(led_eeconfig_t)); + led_matrix_sync.led_suspend_state = led_matrix_get_suspend_state(); + return send_if_data_mismatch(PUT_LED_MATRIX, &last_update, &led_matrix_sync, &split_shmem->led_matrix_sync, sizeof(led_matrix_sync)); +} + +static void led_matrix_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + memcpy(&led_matrix_eeconfig, &split_shmem->led_matrix_sync.led_matrix, sizeof(led_eeconfig_t)); + led_matrix_set_suspend_state(split_shmem->led_matrix_sync.led_suspend_state); +} + +# define TRANSACTIONS_LED_MATRIX_MASTER() TRANSACTION_HANDLER_MASTER(led_matrix) +# define TRANSACTIONS_LED_MATRIX_SLAVE() TRANSACTION_HANDLER_SLAVE(led_matrix) +# define TRANSACTIONS_LED_MATRIX_REGISTRATIONS [PUT_LED_MATRIX] = trans_initiator2target_initializer(led_matrix_sync), + +#else // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) + +# define TRANSACTIONS_LED_MATRIX_MASTER() +# define TRANSACTIONS_LED_MATRIX_SLAVE() +# define TRANSACTIONS_LED_MATRIX_REGISTRATIONS + +#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) + +//////////////////////////////////////////////////// +// RGB Matrix + +#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) + +static bool rgb_matrix_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_update = 0; + rgb_matrix_sync_t rgb_matrix_sync; + memcpy(&rgb_matrix_sync.rgb_matrix, &rgb_matrix_config, sizeof(rgb_config_t)); + rgb_matrix_sync.rgb_suspend_state = rgb_matrix_get_suspend_state(); + return send_if_data_mismatch(PUT_RGB_MATRIX, &last_update, &rgb_matrix_sync, &split_shmem->rgb_matrix_sync, sizeof(rgb_matrix_sync)); +} + +static void rgb_matrix_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + memcpy(&rgb_matrix_config, &split_shmem->rgb_matrix_sync.rgb_matrix, sizeof(rgb_config_t)); + rgb_matrix_set_suspend_state(split_shmem->rgb_matrix_sync.rgb_suspend_state); +} + +# define TRANSACTIONS_RGB_MATRIX_MASTER() TRANSACTION_HANDLER_MASTER(rgb_matrix) +# define TRANSACTIONS_RGB_MATRIX_SLAVE() TRANSACTION_HANDLER_SLAVE(rgb_matrix) +# define TRANSACTIONS_RGB_MATRIX_REGISTRATIONS [PUT_RGB_MATRIX] = trans_initiator2target_initializer(rgb_matrix_sync), + +#else // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) + +# define TRANSACTIONS_RGB_MATRIX_MASTER() +# define TRANSACTIONS_RGB_MATRIX_SLAVE() +# define TRANSACTIONS_RGB_MATRIX_REGISTRATIONS + +#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) + +//////////////////////////////////////////////////// +// WPM + +#if defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) + +static bool wpm_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_update = 0; + uint8_t current_wpm = get_current_wpm(); + return send_if_condition(PUT_WPM, &last_update, (current_wpm != split_shmem->current_wpm), ¤t_wpm, sizeof(current_wpm)); +} + +static void wpm_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { set_current_wpm(split_shmem->current_wpm); } + +# define TRANSACTIONS_WPM_MASTER() TRANSACTION_HANDLER_MASTER(wpm) +# define TRANSACTIONS_WPM_SLAVE() TRANSACTION_HANDLER_SLAVE(wpm) +# define TRANSACTIONS_WPM_REGISTRATIONS [PUT_WPM] = trans_initiator2target_initializer(current_wpm), + +#else // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) + +# define TRANSACTIONS_WPM_MASTER() +# define TRANSACTIONS_WPM_SLAVE() +# define TRANSACTIONS_WPM_REGISTRATIONS + +#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) + +//////////////////////////////////////////////////// +// OLED + +#if defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) + +static bool oled_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_update = 0; + bool current_oled_state = is_oled_on(); + return send_if_condition(PUT_OLED, &last_update, (current_oled_state != split_shmem->current_oled_state), ¤t_oled_state, sizeof(current_oled_state)); +} + +static void oled_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + if (split_shmem->current_oled_state) { + oled_on(); + } else { + oled_off(); + } +} + +# define TRANSACTIONS_OLED_MASTER() TRANSACTION_HANDLER_MASTER(oled) +# define TRANSACTIONS_OLED_SLAVE() TRANSACTION_HANDLER_SLAVE(oled) +# define TRANSACTIONS_OLED_REGISTRATIONS [PUT_OLED] = trans_initiator2target_initializer(current_oled_state), + +#else // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) + +# define TRANSACTIONS_OLED_MASTER() +# define TRANSACTIONS_OLED_SLAVE() +# define TRANSACTIONS_OLED_REGISTRATIONS + +#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) + +//////////////////////////////////////////////////// +// ST7565 + +#if defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) + +static bool st7565_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + static uint32_t last_update = 0; + bool current_st7565_state = st7565_is_on(); + return send_if_condition(PUT_ST7565, &last_update, (current_st7565_state != split_shmem->current_st7565_state), ¤t_st7565_state, sizeof(current_st7565_state)); +} + +static void st7565_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + if (split_shmem->current_st7565_state) { + st7565_on(); + } else { + st7565_off(); + } +} + +# define TRANSACTIONS_ST7565_MASTER() TRANSACTION_HANDLER_MASTER(st7565) +# define TRANSACTIONS_ST7565_SLAVE() TRANSACTION_HANDLER_SLAVE(st7565) +# define TRANSACTIONS_ST7565_REGISTRATIONS [PUT_ST7565] = trans_initiator2target_initializer(current_st7565_state), + +#else // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) + +# define TRANSACTIONS_ST7565_MASTER() +# define TRANSACTIONS_ST7565_SLAVE() +# define TRANSACTIONS_ST7565_REGISTRATIONS + +#endif // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) + +//////////////////////////////////////////////////// + +uint8_t dummy; +split_transaction_desc_t split_transaction_table[NUM_TOTAL_TRANSACTIONS] = { + // Set defaults + [0 ...(NUM_TOTAL_TRANSACTIONS - 1)] = {NULL, 0, 0, 0, 0, 0}, + +#ifdef USE_I2C + [I2C_EXECUTE_CALLBACK] = trans_initiator2target_initializer(transaction_id), +#endif // USE_I2C + + // clang-format off + TRANSACTIONS_SLAVE_MATRIX_REGISTRATIONS + TRANSACTIONS_MASTER_MATRIX_REGISTRATIONS + TRANSACTIONS_ENCODERS_REGISTRATIONS + TRANSACTIONS_SYNC_TIMER_REGISTRATIONS + TRANSACTIONS_LAYER_STATE_REGISTRATIONS + TRANSACTIONS_LED_STATE_REGISTRATIONS + TRANSACTIONS_MODS_REGISTRATIONS + TRANSACTIONS_BACKLIGHT_REGISTRATIONS + TRANSACTIONS_RGBLIGHT_REGISTRATIONS + TRANSACTIONS_LED_MATRIX_REGISTRATIONS + TRANSACTIONS_RGB_MATRIX_REGISTRATIONS + TRANSACTIONS_WPM_REGISTRATIONS + TRANSACTIONS_OLED_REGISTRATIONS + TRANSACTIONS_ST7565_REGISTRATIONS +// clang-format on + +#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) + [PUT_RPC_INFO] = trans_initiator2target_initializer_cb(rpc_info, slave_rpc_info_callback), + [PUT_RPC_REQ_DATA] = trans_initiator2target_initializer(rpc_m2s_buffer), + [EXECUTE_RPC] = trans_initiator2target_initializer_cb(rpc_info.transaction_id, slave_rpc_exec_callback), + [GET_RPC_RESP_DATA] = trans_target2initiator_initializer(rpc_s2m_buffer), +#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) +}; + +bool transactions_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + TRANSACTIONS_SLAVE_MATRIX_MASTER(); + TRANSACTIONS_MASTER_MATRIX_MASTER(); + TRANSACTIONS_ENCODERS_MASTER(); + TRANSACTIONS_SYNC_TIMER_MASTER(); + TRANSACTIONS_LAYER_STATE_MASTER(); + TRANSACTIONS_LED_STATE_MASTER(); + TRANSACTIONS_MODS_MASTER(); + TRANSACTIONS_BACKLIGHT_MASTER(); + TRANSACTIONS_RGBLIGHT_MASTER(); + TRANSACTIONS_LED_MATRIX_MASTER(); + TRANSACTIONS_RGB_MATRIX_MASTER(); + TRANSACTIONS_WPM_MASTER(); + TRANSACTIONS_OLED_MASTER(); + TRANSACTIONS_ST7565_MASTER(); + return true; +} + +void transactions_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + TRANSACTIONS_SLAVE_MATRIX_SLAVE(); + TRANSACTIONS_MASTER_MATRIX_SLAVE(); + TRANSACTIONS_ENCODERS_SLAVE(); + TRANSACTIONS_SYNC_TIMER_SLAVE(); + TRANSACTIONS_LAYER_STATE_SLAVE(); + TRANSACTIONS_LED_STATE_SLAVE(); + TRANSACTIONS_MODS_SLAVE(); + TRANSACTIONS_BACKLIGHT_SLAVE(); + TRANSACTIONS_RGBLIGHT_SLAVE(); + TRANSACTIONS_LED_MATRIX_SLAVE(); + TRANSACTIONS_RGB_MATRIX_SLAVE(); + TRANSACTIONS_WPM_SLAVE(); + TRANSACTIONS_OLED_SLAVE(); + TRANSACTIONS_ST7565_SLAVE(); +} + +#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) + +void transaction_register_rpc(int8_t transaction_id, slave_callback_t callback) { + // Prevent invoking RPC on QMK core sync data + if (transaction_id <= GET_RPC_RESP_DATA) return; + + // Set the callback + split_transaction_table[transaction_id].slave_callback = callback; + split_transaction_table[transaction_id].initiator2target_offset = offsetof(split_shared_memory_t, rpc_m2s_buffer); + split_transaction_table[transaction_id].target2initiator_offset = offsetof(split_shared_memory_t, rpc_s2m_buffer); +} + +bool transaction_rpc_exec(int8_t transaction_id, uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer) { + // Prevent transaction attempts while transport is disconnected + if (!is_transport_connected()) { + return false; + } + // Prevent invoking RPC on QMK core sync data + if (transaction_id <= GET_RPC_RESP_DATA) return false; + // Prevent sizing issues + if (initiator2target_buffer_size > RPC_M2S_BUFFER_SIZE) return false; + if (target2initiator_buffer_size > RPC_S2M_BUFFER_SIZE) return false; + + // Prepare the metadata block + rpc_sync_info_t info = {.transaction_id = transaction_id, .m2s_length = initiator2target_buffer_size, .s2m_length = target2initiator_buffer_size}; + + // Make sure the local side knows that we're not sending the full block of data + split_transaction_table[PUT_RPC_REQ_DATA].initiator2target_buffer_size = initiator2target_buffer_size; + split_transaction_table[GET_RPC_RESP_DATA].target2initiator_buffer_size = target2initiator_buffer_size; + + // Run through the sequence: + // * set the transaction ID and lengths + // * send the request data + // * execute RPC callback + // * retrieve the response data + if (!transport_write(PUT_RPC_INFO, &info, sizeof(info))) { + return false; + } + if (!transport_write(PUT_RPC_REQ_DATA, initiator2target_buffer, initiator2target_buffer_size)) { + return false; + } + if (!transport_write(EXECUTE_RPC, &transaction_id, sizeof(transaction_id))) { + return false; + } + if (!transport_read(GET_RPC_RESP_DATA, target2initiator_buffer, target2initiator_buffer_size)) { + return false; + } + return true; +} + +void slave_rpc_info_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer) { + // The RPC info block contains the intended transaction ID, as well as the sizes for both inbound and outbound data. + // Ignore the args -- the `split_shmem` already has the info, we just need to act upon it. + // We must keep the `split_transaction_table` non-const, so that it is able to be modified at runtime. + + split_transaction_table[PUT_RPC_REQ_DATA].initiator2target_buffer_size = split_shmem->rpc_info.m2s_length; + split_transaction_table[GET_RPC_RESP_DATA].target2initiator_buffer_size = split_shmem->rpc_info.s2m_length; +} + +void slave_rpc_exec_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer) { + // We can assume that the buffer lengths are correctly set, now, given that sequentially the rpc_info callback was already executed. + // Go through the rpc_info and execute _that_ transaction's callback, with the scratch buffers as inputs. + int8_t transaction_id = split_shmem->rpc_info.transaction_id; + if (transaction_id < NUM_TOTAL_TRANSACTIONS) { + split_transaction_desc_t *trans = &split_transaction_table[transaction_id]; + if (trans->slave_callback) { + trans->slave_callback(split_shmem->rpc_info.m2s_length, split_shmem->rpc_m2s_buffer, split_shmem->rpc_info.s2m_length, split_shmem->rpc_s2m_buffer); + } + } +} + +#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) diff --git a/quantum/split_common/transactions.h b/quantum/split_common/transactions.h new file mode 100644 index 0000000000..53610d6f8e --- /dev/null +++ b/quantum/split_common/transactions.h @@ -0,0 +1,54 @@ +/* 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" +#include "stdbool.h" + +#include "matrix.h" +#include "transaction_id_define.h" +#include "transport.h" + +typedef void (*slave_callback_t)(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer); + +// Split transaction Descriptor +typedef struct _split_transaction_desc_t { + uint8_t * status; + uint8_t initiator2target_buffer_size; + uint16_t initiator2target_offset; + uint8_t target2initiator_buffer_size; + uint16_t target2initiator_offset; + slave_callback_t slave_callback; +} split_transaction_desc_t; + +// Forward declaration for the split transactions +extern split_transaction_desc_t split_transaction_table[NUM_TOTAL_TRANSACTIONS]; + +#define split_shmem_offset_ptr(offset) (((uint8_t *)split_shmem) + (offset)) +#define split_trans_initiator2target_buffer(trans) (split_shmem_offset_ptr((trans)->initiator2target_offset)) +#define split_trans_target2initiator_buffer(trans) (split_shmem_offset_ptr((trans)->target2initiator_offset)) + +// returns false if valid data not received from slave +bool transactions_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]); +void transactions_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]); + +void transaction_register_rpc(int8_t transaction_id, slave_callback_t callback); + +bool transaction_rpc_exec(int8_t transaction_id, uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer); + +#define transaction_rpc_send(transaction_id, initiator2target_buffer_size, initiator2target_buffer) transaction_rpc_exec(transaction_id, initiator2target_buffer_size, initiator2target_buffer, 0, NULL) +#define transaction_rpc_recv(transaction_id, target2initiator_buffer_size, target2initiator_buffer) transaction_rpc_exec(transaction_id, 0, NULL, target2initiator_buffer_size, target2initiator_buffer) diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index 9ed0f7591b..bcc0261417 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c @@ -1,452 +1,118 @@ -#include <string.h> -#include <stddef.h> - -#include "config.h" -#include "matrix.h" -#include "quantum.h" - -#define ROWS_PER_HAND (MATRIX_ROWS / 2) -#define SYNC_TIMER_OFFSET 2 - -#ifdef RGBLIGHT_ENABLE -# include "rgblight.h" -#endif - -#ifdef BACKLIGHT_ENABLE -# include "backlight.h" -#endif - -#ifdef ENCODER_ENABLE -# include "encoder.h" -static pin_t encoders_pad[] = ENCODERS_PAD_A; -# define NUMBER_OF_ENCODERS (sizeof(encoders_pad) / sizeof(pin_t)) -#endif - -#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) -# include "led_matrix.h" -#endif -#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) -# include "rgb_matrix.h" -#endif - -#if defined(USE_I2C) +/* 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 "i2c_master.h" -# include "i2c_slave.h" - -typedef struct _I2C_slave_buffer_t { -# ifndef DISABLE_SYNC_TIMER - uint32_t sync_timer; -# endif -# ifdef SPLIT_TRANSPORT_MIRROR - matrix_row_t mmatrix[ROWS_PER_HAND]; -# endif - matrix_row_t smatrix[ROWS_PER_HAND]; -# ifdef SPLIT_MODS_ENABLE - uint8_t real_mods; - uint8_t weak_mods; -# ifndef NO_ACTION_ONESHOT - uint8_t oneshot_mods; -# endif -# endif -# ifdef BACKLIGHT_ENABLE - uint8_t backlight_level; -# endif -# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) - rgblight_syncinfo_t rgblight_sync; -# endif -# ifdef ENCODER_ENABLE - uint8_t encoder_state[NUMBER_OF_ENCODERS]; -# endif -# ifdef WPM_ENABLE - uint8_t current_wpm; -# endif -# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) - led_eeconfig_t led_matrix; - bool led_suspend_state; -# endif -# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) - rgb_config_t rgb_matrix; - bool rgb_suspend_state; -# endif -} I2C_slave_buffer_t; +#include <string.h> +#include <debug.h> -static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg; +#include "transactions.h" +#include "transport.h" +#include "transaction_id_define.h" +#include "atomic_util.h" -# define I2C_SYNC_TIME_START offsetof(I2C_slave_buffer_t, sync_timer) -# define I2C_KEYMAP_MASTER_START offsetof(I2C_slave_buffer_t, mmatrix) -# define I2C_KEYMAP_SLAVE_START offsetof(I2C_slave_buffer_t, smatrix) -# define I2C_REAL_MODS_START offsetof(I2C_slave_buffer_t, real_mods) -# define I2C_WEAK_MODS_START offsetof(I2C_slave_buffer_t, weak_mods) -# define I2C_ONESHOT_MODS_START offsetof(I2C_slave_buffer_t, oneshot_mods) -# define I2C_BACKLIGHT_START offsetof(I2C_slave_buffer_t, backlight_level) -# define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync) -# define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state) -# define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm) -# define I2C_LED_MATRIX_START offsetof(I2C_slave_buffer_t, led_matrix) -# define I2C_LED_SUSPEND_START offsetof(I2C_slave_buffer_t, led_suspend_state) -# define I2C_RGB_MATRIX_START offsetof(I2C_slave_buffer_t, rgb_matrix) -# define I2C_RGB_SUSPEND_START offsetof(I2C_slave_buffer_t, rgb_suspend_state) +#ifdef USE_I2C -# define TIMEOUT 100 +# ifndef SLAVE_I2C_TIMEOUT +# define SLAVE_I2C_TIMEOUT 100 +# endif // SLAVE_I2C_TIMEOUT # ifndef SLAVE_I2C_ADDRESS # define SLAVE_I2C_ADDRESS 0x32 # endif -// Get rows from other half over i2c -bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { - i2c_readReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_SLAVE_START, (void *)slave_matrix, sizeof(i2c_buffer->smatrix), TIMEOUT); -# ifdef SPLIT_TRANSPORT_MIRROR - i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_MASTER_START, (void *)master_matrix, sizeof(i2c_buffer->mmatrix), TIMEOUT); -# endif +# include "i2c_master.h" +# include "i2c_slave.h" - // write backlight info -# ifdef BACKLIGHT_ENABLE - uint8_t level = is_backlight_enabled() ? get_backlight_level() : 0; - if (level != i2c_buffer->backlight_level) { - if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_BACKLIGHT_START, (void *)&level, sizeof(level), TIMEOUT) >= 0) { - i2c_buffer->backlight_level = level; - } - } -# endif +// Ensure the I2C buffer has enough space +_Static_assert(sizeof(split_shared_memory_t) <= I2C_SLAVE_REG_COUNT, "split_shared_memory_t too large for I2C_SLAVE_REG_COUNT"); -# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) - if (rgblight_get_change_flags()) { - rgblight_syncinfo_t rgblight_sync; - rgblight_get_syncinfo(&rgblight_sync); - if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_START, (void *)&rgblight_sync, sizeof(rgblight_sync), TIMEOUT) >= 0) { - rgblight_clear_change_flags(); - } - } -# endif +split_shared_memory_t *const split_shmem = (split_shared_memory_t *)i2c_slave_reg; -# ifdef ENCODER_ENABLE - i2c_readReg(SLAVE_I2C_ADDRESS, I2C_ENCODER_START, (void *)i2c_buffer->encoder_state, sizeof(i2c_buffer->encoder_state), TIMEOUT); - encoder_update_raw(i2c_buffer->encoder_state); -# endif +void transport_master_init(void) { i2c_init(); } +void transport_slave_init(void) { i2c_slave_init(SLAVE_I2C_ADDRESS); } -# ifdef WPM_ENABLE - uint8_t current_wpm = get_current_wpm(); - if (current_wpm != i2c_buffer->current_wpm) { - if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_WPM_START, (void *)¤t_wpm, sizeof(current_wpm), TIMEOUT) >= 0) { - i2c_buffer->current_wpm = current_wpm; - } +i2c_status_t transport_trigger_callback(int8_t id) { + // If there's no callback, indicate that we were successful + if (!split_transaction_table[id].slave_callback) { + return I2C_STATUS_SUCCESS; } -# endif -# ifdef SPLIT_MODS_ENABLE - uint8_t real_mods = get_mods(); - if (real_mods != i2c_buffer->real_mods) { - if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_REAL_MODS_START, (void *)&real_mods, sizeof(real_mods), TIMEOUT) >= 0) { - i2c_buffer->real_mods = real_mods; + // Kick off the "callback executor", now that data has been written to the slave + split_shmem->transaction_id = id; + split_transaction_desc_t *trans = &split_transaction_table[I2C_EXECUTE_CALLBACK]; + return i2c_writeReg(SLAVE_I2C_ADDRESS, trans->initiator2target_offset, split_trans_initiator2target_buffer(trans), trans->initiator2target_buffer_size, SLAVE_I2C_TIMEOUT); +} + +bool transport_execute_transaction(int8_t id, const void *initiator2target_buf, uint16_t initiator2target_length, void *target2initiator_buf, uint16_t target2initiator_length) { + i2c_status_t status; + split_transaction_desc_t *trans = &split_transaction_table[id]; + if (initiator2target_length > 0) { + size_t len = trans->initiator2target_buffer_size < initiator2target_length ? trans->initiator2target_buffer_size : initiator2target_length; + memcpy(split_trans_initiator2target_buffer(trans), initiator2target_buf, len); + if ((status = i2c_writeReg(SLAVE_I2C_ADDRESS, trans->initiator2target_offset, split_trans_initiator2target_buffer(trans), len, SLAVE_I2C_TIMEOUT)) < 0) { + return false; } } - uint8_t weak_mods = get_weak_mods(); - if (weak_mods != i2c_buffer->weak_mods) { - if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_WEAK_MODS_START, (void *)&weak_mods, sizeof(weak_mods), TIMEOUT) >= 0) { - i2c_buffer->weak_mods = weak_mods; - } + // If we need to execute a callback on the slave, do so + if ((status = transport_trigger_callback(id)) < 0) { + return false; } -# ifndef NO_ACTION_ONESHOT - uint8_t oneshot_mods = get_oneshot_mods(); - if (oneshot_mods != i2c_buffer->oneshot_mods) { - if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_ONESHOT_MODS_START, (void *)&oneshot_mods, sizeof(oneshot_mods), TIMEOUT) >= 0) { - i2c_buffer->oneshot_mods = oneshot_mods; + if (target2initiator_length > 0) { + size_t len = trans->target2initiator_buffer_size < target2initiator_length ? trans->target2initiator_buffer_size : target2initiator_length; + if ((status = i2c_readReg(SLAVE_I2C_ADDRESS, trans->target2initiator_offset, split_trans_target2initiator_buffer(trans), len, SLAVE_I2C_TIMEOUT)) < 0) { + return false; } + memcpy(target2initiator_buf, split_trans_target2initiator_buffer(trans), len); } -# endif -# endif -# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) - i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LED_MATRIX_START, (void *)led_matrix_eeconfig, sizeof(i2c_buffer->led_matrix), TIMEOUT); - bool suspend_state = led_matrix_get_suspend_state(); - i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LED_SUSPEND_START, (void *)suspend_state, sizeof(i2c_buffer->led_suspend_state), TIMEOUT); -# endif -# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) - i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_MATRIX_START, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix), TIMEOUT); - bool suspend_state = rgb_matrix_get_suspend_state(); - i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_SUSPEND_START, (void *)suspend_state, sizeof(i2c_buffer->rgb_suspend_state), TIMEOUT); -# endif - -# ifndef DISABLE_SYNC_TIMER - i2c_buffer->sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; - i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_SYNC_TIME_START, (void *)&i2c_buffer->sync_timer, sizeof(i2c_buffer->sync_timer), TIMEOUT); -# endif return true; } -void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { -# ifndef DISABLE_SYNC_TIMER - sync_timer_update(i2c_buffer->sync_timer); -# endif - // Copy matrix to I2C buffer - memcpy((void *)i2c_buffer->smatrix, (void *)slave_matrix, sizeof(i2c_buffer->smatrix)); -# ifdef SPLIT_TRANSPORT_MIRROR - memcpy((void *)master_matrix, (void *)i2c_buffer->mmatrix, sizeof(i2c_buffer->mmatrix)); -# endif - -// Read Backlight Info -# ifdef BACKLIGHT_ENABLE - backlight_set(i2c_buffer->backlight_level); -# endif - -# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) - // Update the RGB with the new data - if (i2c_buffer->rgblight_sync.status.change_flags != 0) { - rgblight_update_sync(&i2c_buffer->rgblight_sync, false); - i2c_buffer->rgblight_sync.status.change_flags = 0; - } -# endif - -# ifdef ENCODER_ENABLE - encoder_state_raw(i2c_buffer->encoder_state); -# endif - -# ifdef WPM_ENABLE - set_current_wpm(i2c_buffer->current_wpm); -# endif - -# ifdef SPLIT_MODS_ENABLE - set_mods(i2c_buffer->real_mods); - set_weak_mods(i2c_buffer->weak_mods); -# ifndef NO_ACTION_ONESHOT - set_oneshot_mods(i2c_buffer->oneshot_mods); -# endif -# endif - -# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) - memcpy((void *)i2c_buffer->led_matrix, (void *)led_matrix_eeconfig, sizeof(i2c_buffer->led_matrix)); - led_matrix_set_suspend_state(i2c_buffer->led_suspend_state); -# endif -# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) - memcpy((void *)i2c_buffer->rgb_matrix, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix)); - rgb_matrix_set_suspend_state(i2c_buffer->rgb_suspend_state); -# endif -} - -void transport_master_init(void) { i2c_init(); } - -void transport_slave_init(void) { i2c_slave_init(SLAVE_I2C_ADDRESS); } - -#else // USE_SERIAL +#else // USE_I2C # include "serial.h" -typedef struct _Serial_s2m_buffer_t { - // TODO: if MATRIX_COLS > 8 change to uint8_t packed_matrix[] for pack/unpack - matrix_row_t smatrix[ROWS_PER_HAND]; - -# ifdef ENCODER_ENABLE - uint8_t encoder_state[NUMBER_OF_ENCODERS]; -# endif - -} Serial_s2m_buffer_t; - -typedef struct _Serial_m2s_buffer_t { -# ifdef SPLIT_MODS_ENABLE - uint8_t real_mods; - uint8_t weak_mods; -# ifndef NO_ACTION_ONESHOT - uint8_t oneshot_mods; -# endif -# endif -# ifndef DISABLE_SYNC_TIMER - uint32_t sync_timer; -# endif -# ifdef SPLIT_TRANSPORT_MIRROR - matrix_row_t mmatrix[ROWS_PER_HAND]; -# endif -# ifdef BACKLIGHT_ENABLE - uint8_t backlight_level; -# endif -# ifdef WPM_ENABLE - uint8_t current_wpm; -# endif -# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) - led_eeconfig_t led_matrix; - bool led_suspend_state; -# endif -# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) - rgb_config_t rgb_matrix; - bool rgb_suspend_state; -# endif -} Serial_m2s_buffer_t; - -# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) -// When MCUs on both sides drive their respective RGB LED chains, -// it is necessary to synchronize, so it is necessary to communicate RGB -// information. In that case, define RGBLIGHT_SPLIT with info on the number -// of LEDs on each half. -// -// Otherwise, if the master side MCU drives both sides RGB LED chains, -// there is no need to communicate. - -typedef struct _Serial_rgblight_t { - rgblight_syncinfo_t rgblight_sync; -} Serial_rgblight_t; +static split_shared_memory_t shared_memory; +split_shared_memory_t *const split_shmem = &shared_memory; -volatile Serial_rgblight_t serial_rgblight = {}; -uint8_t volatile status_rgblight = 0; -# endif - -volatile Serial_s2m_buffer_t serial_s2m_buffer = {}; -volatile Serial_m2s_buffer_t serial_m2s_buffer = {}; -uint8_t volatile status0 = 0; - -enum serial_transaction_id { - GET_SLAVE_MATRIX = 0, -# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) - PUT_RGBLIGHT, -# endif -}; - -SSTD_t transactions[] = { - [GET_SLAVE_MATRIX] = - { - (uint8_t *)&status0, - sizeof(serial_m2s_buffer), - (uint8_t *)&serial_m2s_buffer, - sizeof(serial_s2m_buffer), - (uint8_t *)&serial_s2m_buffer, - }, -# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) - [PUT_RGBLIGHT] = - { - (uint8_t *)&status_rgblight, sizeof(serial_rgblight), (uint8_t *)&serial_rgblight, 0, NULL // no slave to master transfer - }, -# endif -}; - -void transport_master_init(void) { soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); } - -void transport_slave_init(void) { soft_serial_target_init(transactions, TID_LIMIT(transactions)); } +void transport_master_init(void) { soft_serial_initiator_init(); } +void transport_slave_init(void) { soft_serial_target_init(); } -# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) - -// rgblight synchronization information communication. - -void transport_rgblight_master(void) { - if (rgblight_get_change_flags()) { - rgblight_get_syncinfo((rgblight_syncinfo_t *)&serial_rgblight.rgblight_sync); - if (soft_serial_transaction(PUT_RGBLIGHT) == TRANSACTION_END) { - rgblight_clear_change_flags(); - } - } -} - -void transport_rgblight_slave(void) { - if (status_rgblight == TRANSACTION_ACCEPTED) { - rgblight_update_sync((rgblight_syncinfo_t *)&serial_rgblight.rgblight_sync, false); - status_rgblight = TRANSACTION_END; +bool transport_execute_transaction(int8_t id, const void *initiator2target_buf, uint16_t initiator2target_length, void *target2initiator_buf, uint16_t target2initiator_length) { + split_transaction_desc_t *trans = &split_transaction_table[id]; + if (initiator2target_length > 0) { + size_t len = trans->initiator2target_buffer_size < initiator2target_length ? trans->initiator2target_buffer_size : initiator2target_length; + memcpy(split_trans_initiator2target_buffer(trans), initiator2target_buf, len); } -} -# else -# define transport_rgblight_master() -# define transport_rgblight_slave() -# endif - -bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { -# ifndef SERIAL_USE_MULTI_TRANSACTION - if (soft_serial_transaction() != TRANSACTION_END) { - return false; - } -# else - transport_rgblight_master(); - if (soft_serial_transaction(GET_SLAVE_MATRIX) != TRANSACTION_END) { + if (soft_serial_transaction(id) != TRANSACTION_END) { return false; } -# endif - // TODO: if MATRIX_COLS > 8 change to unpack() - for (int i = 0; i < ROWS_PER_HAND; ++i) { - slave_matrix[i] = serial_s2m_buffer.smatrix[i]; -# ifdef SPLIT_TRANSPORT_MIRROR - serial_m2s_buffer.mmatrix[i] = master_matrix[i]; -# endif + if (target2initiator_length > 0) { + size_t len = trans->target2initiator_buffer_size < target2initiator_length ? trans->target2initiator_buffer_size : target2initiator_length; + memcpy(target2initiator_buf, split_trans_target2initiator_buffer(trans), len); } -# ifdef BACKLIGHT_ENABLE - // Write backlight level for slave to read - serial_m2s_buffer.backlight_level = is_backlight_enabled() ? get_backlight_level() : 0; -# endif - -# ifdef ENCODER_ENABLE - encoder_update_raw((uint8_t *)serial_s2m_buffer.encoder_state); -# endif - -# ifdef WPM_ENABLE - // Write wpm to slave - serial_m2s_buffer.current_wpm = get_current_wpm(); -# endif - -# ifdef SPLIT_MODS_ENABLE - serial_m2s_buffer.real_mods = get_mods(); - serial_m2s_buffer.weak_mods = get_weak_mods(); -# ifndef NO_ACTION_ONESHOT - serial_m2s_buffer.oneshot_mods = get_oneshot_mods(); -# endif -# endif - -# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) - serial_m2s_buffer.led_matrix = led_matrix_eeconfig; - serial_m2s_buffer.led_suspend_state = led_matrix_get_suspend_state(); -# endif -# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) - serial_m2s_buffer.rgb_matrix = rgb_matrix_config; - serial_m2s_buffer.rgb_suspend_state = rgb_matrix_get_suspend_state(); -# endif - -# ifndef DISABLE_SYNC_TIMER - serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; -# endif return true; } -void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { - transport_rgblight_slave(); -# ifndef DISABLE_SYNC_TIMER - sync_timer_update(serial_m2s_buffer.sync_timer); -# endif - - // TODO: if MATRIX_COLS > 8 change to pack() - for (int i = 0; i < ROWS_PER_HAND; ++i) { - serial_s2m_buffer.smatrix[i] = slave_matrix[i]; -# ifdef SPLIT_TRANSPORT_MIRROR - master_matrix[i] = serial_m2s_buffer.mmatrix[i]; -# endif - } -# ifdef BACKLIGHT_ENABLE - backlight_set(serial_m2s_buffer.backlight_level); -# endif - -# ifdef ENCODER_ENABLE - encoder_state_raw((uint8_t *)serial_s2m_buffer.encoder_state); -# endif +#endif // USE_I2C -# ifdef WPM_ENABLE - set_current_wpm(serial_m2s_buffer.current_wpm); -# endif - -# ifdef SPLIT_MODS_ENABLE - set_mods(serial_m2s_buffer.real_mods); - set_weak_mods(serial_m2s_buffer.weak_mods); -# ifndef NO_ACTION_ONESHOT - set_oneshot_mods(serial_m2s_buffer.oneshot_mods); -# endif -# endif - -# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) - led_matrix_eeconfig = serial_m2s_buffer.led_matrix; - led_matrix_set_suspend_state(serial_m2s_buffer.led_suspend_state); -# endif -# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) - rgb_matrix_config = serial_m2s_buffer.rgb_matrix; - rgb_matrix_set_suspend_state(serial_m2s_buffer.rgb_suspend_state); -# endif -} +bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { return transactions_master(master_matrix, slave_matrix); } -#endif +void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { transactions_slave(master_matrix, slave_matrix); } diff --git a/quantum/split_common/transport.h b/quantum/split_common/transport.h index a9f66301bf..1d4f6ed0cd 100644 --- a/quantum/split_common/transport.h +++ b/quantum/split_common/transport.h @@ -1,10 +1,183 @@ +/* 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" +#include "stdbool.h" + +#include "progmem.h" +#include "action_layer.h" #include "matrix.h" +#ifndef RPC_M2S_BUFFER_SIZE +# define RPC_M2S_BUFFER_SIZE 32 +#endif // RPC_M2S_BUFFER_SIZE + +#ifndef RPC_S2M_BUFFER_SIZE +# define RPC_S2M_BUFFER_SIZE 32 +#endif // RPC_S2M_BUFFER_SIZE + void transport_master_init(void); void transport_slave_init(void); // returns false if valid data not received from slave bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]); void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]); + +bool transport_execute_transaction(int8_t id, const void *initiator2target_buf, uint16_t initiator2target_length, void *target2initiator_buf, uint16_t target2initiator_length); + +#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 +# include "backlight.h" +#endif // BACKLIGHT_ENABLE + +#ifdef RGBLIGHT_ENABLE +# include "rgblight.h" +#endif // RGBLIGHT_ENABLE + +typedef struct _split_slave_matrix_sync_t { + uint8_t checksum; + matrix_row_t matrix[(MATRIX_ROWS) / 2]; +} split_slave_matrix_sync_t; + +#ifdef SPLIT_TRANSPORT_MIRROR +typedef struct _split_master_matrix_sync_t { + matrix_row_t matrix[(MATRIX_ROWS) / 2]; +} split_master_matrix_sync_t; +#endif // SPLIT_TRANSPORT_MIRROR + +#ifdef ENCODER_ENABLE +typedef struct _split_slave_encoder_sync_t { + uint8_t checksum; + uint8_t state[NUMBER_OF_ENCODERS]; +} split_slave_encoder_sync_t; +#endif // ENCODER_ENABLE + +#if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) +typedef struct _split_layers_sync_t { + layer_state_t layer_state; + layer_state_t default_layer_state; +} split_layers_sync_t; +#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) + +#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) +# include "led_matrix.h" + +typedef struct _led_matrix_sync_t { + led_eeconfig_t led_matrix; + bool led_suspend_state; +} led_matrix_sync_t; +#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) + +#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) +# include "rgb_matrix.h" + +typedef struct _rgb_matrix_sync_t { + rgb_config_t rgb_matrix; + bool rgb_suspend_state; +} rgb_matrix_sync_t; +#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) + +#ifdef SPLIT_MODS_ENABLE +typedef struct _split_mods_sync_t { + uint8_t real_mods; + uint8_t weak_mods; +# ifndef NO_ACTION_ONESHOT + uint8_t oneshot_mods; +# endif // NO_ACTION_ONESHOT +} split_mods_sync_t; +#endif // SPLIT_MODS_ENABLE + +#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) +typedef struct _rpc_sync_info_t { + int8_t transaction_id; + uint8_t m2s_length; + uint8_t s2m_length; +} rpc_sync_info_t; +#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) + +typedef struct _split_shared_memory_t { +#ifdef USE_I2C + int8_t transaction_id; +#endif // USE_I2C + + split_slave_matrix_sync_t smatrix; + +#ifdef SPLIT_TRANSPORT_MIRROR + split_master_matrix_sync_t mmatrix; +#endif // SPLIT_TRANSPORT_MIRROR + +#ifdef ENCODER_ENABLE + split_slave_encoder_sync_t encoders; +#endif // ENCODER_ENABLE + +#ifndef DISABLE_SYNC_TIMER + uint32_t sync_timer; +#endif // DISABLE_SYNC_TIMER + +#if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) + split_layers_sync_t layers; +#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) + +#ifdef SPLIT_LED_STATE_ENABLE + uint8_t led_state; +#endif // SPLIT_LED_STATE_ENABLE + +#ifdef SPLIT_MODS_ENABLE + split_mods_sync_t mods; +#endif // SPLIT_MODS_ENABLE + +#ifdef BACKLIGHT_ENABLE + uint8_t backlight_level; +#endif // BACKLIGHT_ENABLE + +#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + rgblight_syncinfo_t rgblight_sync; +#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) + +#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) + led_matrix_sync_t led_matrix_sync; +#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) + +#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) + rgb_matrix_sync_t rgb_matrix_sync; +#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) + +#if defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) + uint8_t current_wpm; +#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) + +#if defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) + uint8_t current_oled_state; +#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) + +#if defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) + uint8_t current_st7565_state; +#endif // ST7565_ENABLE(OLED_ENABLE) && defined(SPLIT_ST7565_ENABLE) + +#if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) + rpc_sync_info_t rpc_info; + uint8_t rpc_m2s_buffer[RPC_M2S_BUFFER_SIZE]; + uint8_t rpc_s2m_buffer[RPC_S2M_BUFFER_SIZE]; +#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) +} split_shared_memory_t; + +extern split_shared_memory_t *const split_shmem; diff --git a/quantum/tools/readme.md b/quantum/tools/readme.md deleted file mode 100644 index 5f355256de..0000000000 --- a/quantum/tools/readme.md +++ /dev/null @@ -1,6 +0,0 @@ -`eeprom_reset.hex` is to reset the eeprom on the Atmega32u4, like this: - - dfu-programmer atmega32u4 erase - dfu-programmer atmega32u4 flash --eeprom eeprom_reset.hex - - You'll need to reflash afterwards, because DFU requires the flash to be erased before messing with the eeprom. diff --git a/quantum/via.c b/quantum/via.c index c89b663b9b..1b2dbcf08d 100644 --- a/quantum/via.c +++ b/quantum/via.c @@ -83,16 +83,6 @@ void via_eeprom_set_valid(bool valid) { eeprom_update_byte((void *)VIA_EEPROM_MAGIC_ADDR + 2, valid ? magic2 : 0xFF); } -// Flag QMK and VIA/keyboard level EEPROM as invalid. -// Used in bootmagic_lite() and VIA command handler. -// Keyboard level code should not need to call this. -void via_eeprom_reset(void) { - // Set the VIA specific EEPROM state as invalid. - via_eeprom_set_valid(false); - // Set the TMK/QMK EEPROM state as invalid. - eeconfig_disable(); -} - // Override this at the keyboard code level to check // VIA's EEPROM valid state and reset to defaults as needed. // Used by keyboards that store their own state in EEPROM, @@ -109,19 +99,24 @@ void via_init(void) { // If the EEPROM has the magic, the data is good. // OK to load from EEPROM. - if (via_eeprom_is_valid()) { - } else { - // This resets the layout options - via_set_layout_options(VIA_EEPROM_LAYOUT_OPTIONS_DEFAULT); - // This resets the keymaps in EEPROM to what is in flash. - dynamic_keymap_reset(); - // This resets the macros in EEPROM to nothing. - dynamic_keymap_macro_reset(); - // Save the magic number last, in case saving was interrupted - via_eeprom_set_valid(true); + if (!via_eeprom_is_valid()) { + eeconfig_init_via(); } } +void eeconfig_init_via(void) { + // set the magic number to false, in case this gets interrupted + via_eeprom_set_valid(false); + // This resets the layout options + via_set_layout_options(VIA_EEPROM_LAYOUT_OPTIONS_DEFAULT); + // This resets the keymaps in EEPROM to what is in flash. + dynamic_keymap_reset(); + // This resets the macros in EEPROM to nothing. + dynamic_keymap_macro_reset(); + // Save the magic number last, in case saving was interrupted + via_eeprom_set_valid(true); +} + // This is generalized so the layout options EEPROM usage can be // variable, between 1 and 4 bytes. uint32_t via_get_layout_options(void) { @@ -329,6 +324,13 @@ void raw_hid_receive(uint8_t *data, uint8_t length) { #endif break; } +#ifdef VIA_EEPROM_ALLOW_RESET + case id_eeprom_reset: { + via_eeprom_set_valid(false); + eeconfig_init_via(); + break; + } +#endif case id_dynamic_keymap_macro_get_count: { command_data[0] = dynamic_keymap_macro_get_count(); break; diff --git a/quantum/via.h b/quantum/via.h index d0510fcabd..3db318a454 100644 --- a/quantum/via.h +++ b/quantum/via.h @@ -16,7 +16,7 @@ #pragma once -#include "tmk_core/common/eeconfig.h" // for EECONFIG_SIZE +#include "eeconfig.h" // for EECONFIG_SIZE // Keyboard level code can change where VIA stores the magic. // The magic is the build date YYMMDD encoded as BCD in 3 bytes, @@ -152,12 +152,8 @@ bool via_eeprom_is_valid(void); // Keyboard level code (eg. via_init_kb()) should not call this void via_eeprom_set_valid(bool valid); -// Flag QMK and VIA/keyboard level EEPROM as invalid. -// Used in bootmagic_lite() and VIA command handler. -// Keyboard level code should not need to call this. -void via_eeprom_reset(void); - // Called by QMK core to initialize dynamic keymaps etc. +void eeconfig_init_via(void); void via_init(void); // Used by VIA to store and retrieve the layout options. diff --git a/quantum/wpm.c b/quantum/wpm.c index bec419a48e..e711e9fe73 100644 --- a/quantum/wpm.c +++ b/quantum/wpm.c @@ -17,6 +17,8 @@ #include "wpm.h" +#include <math.h> + // WPM Stuff static uint8_t current_wpm = 0; static uint16_t wpm_timer = 0; @@ -69,14 +71,22 @@ __attribute__((weak)) uint8_t wpm_regress_count(uint16_t keycode) { void update_wpm(uint16_t keycode) { if (wpm_keycode(keycode)) { if (wpm_timer > 0) { - current_wpm += ((60000 / timer_elapsed(wpm_timer) / WPM_ESTIMATED_WORD_SIZE) - current_wpm) * wpm_smoothing; + uint16_t latest_wpm = 60000 / timer_elapsed(wpm_timer) / WPM_ESTIMATED_WORD_SIZE; + if (latest_wpm > UINT8_MAX) { + latest_wpm = UINT8_MAX; + } + current_wpm += ceilf((latest_wpm - current_wpm) * wpm_smoothing); } wpm_timer = timer_read(); } #ifdef WPM_ALLOW_COUNT_REGRESSION uint8_t regress = wpm_regress_count(keycode); if (regress) { - current_wpm -= regress; + if (current_wpm < regress) { + current_wpm = 0; + } else { + current_wpm -= regress; + } wpm_timer = timer_read(); } #endif @@ -1,11 +1,11 @@ -# ZSA's fork of QMK Firmware +# ZSA's fork of QMK Firmware [![Current Version](https://img.shields.io/github/tag/ErgoDox-EZ/qmk_firmware.svg)](https://github.com/ErgoDox-EZ/qmk_firmware/tags) [![Build Status](https://travis-ci.org/ErgoDox-EZ/qmk_firmware.svg?branch=master)](https://travis-ci.org/ErgoDox-EZ/qmk_firmware) [![GitHub contributors](https://img.shields.io/github/contributors/ErgoDox-EZ/qmk_firmware.svg)](https://github.com/ErgoDox-EZ/qmk_firmware/pulse/monthly) [![GitHub forks](https://img.shields.io/github/forks/ErgoDox-EZ/qmk_firmware.svg?style=social&label=Fork)](https://github.com/ErgoDox-EZ/qmk_firmware/) -This purpose of this fork is maintain a clean repo that only contains the keyboard code that we need, and as little else as possible. This is to keep it lightweight, since we only need a couple of keyboards. This is the repo that the EZ Configurator will pull from. +This purpose of this fork is maintain a clean repo that only contains the keyboard code that we need, and as little else as possible. This is to keep it lightweight, since we only need a couple of keyboards. This is the repo that the EZ Configurator will pull from. ## Documentation * [See the official documentation on docs.qmk.fm](https://docs.qmk.fm) @@ -24,7 +24,7 @@ You can request changes by making a fork and opening a [pull request](https://gi ## Building To set up the local build enviroment to create the firmware image manually, head to the [Newbs guide from QMK](https://docs.qmk.fm/#/newbs). -And instead of using just `qmk setup`, you will want to run this instead: +And instead of using just `qmk setup`, you will want to run this instead: ```sh qmk setup zsa/qmk_firmware -b firmware20 @@ -49,8 +49,8 @@ QMK is developed and maintained by Jack Humbert of OLKB with contributions from - [https://github.com/qmk/qmk_firmware/commits/master/lib](https://github.com/qmk/qmk_firmware/commits/master/lib) - These folders are the important ones for maintaining the repo and keeping it properly up to date. Most, but not all, changes on this list should be pulled into our repo. 4. `git merge (hash|tag)` - - `git rm -rf docs users layouts .vscode` to remove the docs and user code that we don't want. - - To remove all of the keyboard exept the ones we want: + - `git rm -rf docs users layouts .vscode` to remove the docs and user code that we don't want. + - To remove all of the keyboard exept the ones we want: ```sh find ./keyboards -mindepth 1 -maxdepth 1 -type d -not -name ergodox_ez -not -name planck -not -name moonlander -exec git rm -rf '{}' \;` find ./keyboards/planck -mindepth 1 -maxdepth 1 -type d -not -name ez -not -name keymaps -exec git rm -rf '{}' \; @@ -62,7 +62,7 @@ QMK is developed and maintained by Jack Humbert of OLKB with contributions from - Resolve merge conflicts, and commit. 4. Commit update - * Include commit info in `[changelog.md](http://changelog.md)` + * Include commit info in `[changelog.md](http://changelog.md)` 5. Open Pull request, and include information about the commit ## Strategy diff --git a/requirements.txt b/requirements.txt index 3e23a6f333..92381d7d51 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,10 +2,10 @@ appdirs argcomplete colorama -dotty-dict hid hjson jsonschema>=3 milc>=1.4.2 pygments pyusb +qmk-dotty-dict diff --git a/secrets.tar.enc b/secrets.tar.enc Binary files differdeleted file mode 100644 index 6c613fed98..0000000000 --- a/secrets.tar.enc +++ /dev/null @@ -1,7 +1,7 @@ { avr ? true, arm ? true, teensy ? true }: let # We specify sources via Niv: use "niv update nixpkgs" to update nixpkgs, for example. - sources = import ./nix/sources.nix { }; + sources = import ./util/nix/sources.nix { }; pkgs = import sources.nixpkgs { }; poetry2nix = pkgs.callPackage (import sources.poetry2nix) { }; @@ -11,7 +11,14 @@ let # --lock" etc. in the nix folder to adjust the contents of those # files if the requirements*.txt files change pythonEnv = poetry2nix.mkPoetryEnv { - projectDir = ./nix; + projectDir = ./util/nix; + overrides = poetry2nix.overrides.withDefaults (self: super: { + qmk = super.qmk.overridePythonAttrs(old: { + # Allow QMK CLI to run "bin/qmk" as a subprocess (the wrapper changes + # $PATH and breaks these invocations). + dontWrapPythonPrograms = true; + }); + }); }; in diff --git a/show_options.mk b/show_options.mk index cd04f6a0d7..b17d8c7d9d 100644 --- a/show_options.mk +++ b/show_options.mk @@ -16,7 +16,7 @@ BUILD_OPTION_NAMES = \ HARDWARE_OPTION_NAMES = \ SLEEP_LED_ENABLE \ BACKLIGHT_ENABLE \ - BACKLIGHT_CUSTOM_DRIVER \ + BACKLIGHT_DRIVER \ RGBLIGHT_ENABLE \ RGBLIGHT_CUSTOM_DRIVER \ RGB_MATRIX_ENABLE \ @@ -44,13 +44,14 @@ OTHER_OPTION_NAMES = \ AUTO_SHIFT_MODIFIERS \ COMBO_ENABLE \ KEY_LOCK_ENABLE \ + KEY_OVERRIDE_ENABLE \ LEADER_ENABLE \ PRINTING_ENABLE \ STENO_ENABLE \ TAP_DANCE_ENABLE \ VIRTSER_ENABLE \ - OLED_DRIVER_ENABLE \ OLED_ENABLE \ + OLED_DRIVER \ LED_BACK_ENABLE \ LED_UNDERGLOW_ENABLE \ LED_ANIMATIONS \ @@ -68,11 +69,10 @@ OTHER_OPTION_NAMES = \ KEYLOGGER_ENABLE \ LCD_BACKLIGHT_ENABLE \ MACROS_ENABLED \ - ONEHAND_ENABLE \ PS2_MOUSE_ENABLE \ RAW_ENABLE \ SWAP_HANDS_ENABLE \ - USB_6KRO_ENABLE \ + RING_BUFFERED_6KRO_REPORT_ENABLE \ WATCHDOG_ENABLE \ XT_ENABLE \ ERGOINU \ @@ -86,17 +86,23 @@ OTHER_OPTION_NAMES = \ LTO_ENABLE define NAME_ECHO - @echo " $1 = $($1) # $(origin $1)" + @printf " %-30s = %-16s # %s\\n" "$1" "$($1)" "$(origin $1)" + +endef + +define YAML_NAME_ECHO + @echo ' $1 : "$(strip $($1))"' endef .PHONY: show_build_options0 show_build_options show_build_options0: - @echo " KEYBOARD = $(KEYBOARD)" - @echo " KEYMAP = $(KEYMAP)" - @echo " MCU = $(MCU)" - @echo " MCU_SERIES = $(MCU_SERIES)" - @echo " PLATFORM = $(PLATFORM)" + @echo " KEYBOARD = $(KEYBOARD)" + @echo " KEYMAP = $(KEYMAP)" + @echo " MCU = $(MCU)" + @echo " MCU_SERIES = $(MCU_SERIES)" + @echo " PLATFORM = $(PLATFORM)" + @echo " BOOTLOADER = $(BOOTLOADER)" @echo " FIRMWARE_FORMAT = $(FIRMWARE_FORMAT)" @echo @echo "Build Options:" @@ -129,3 +135,18 @@ show_full_features: show_build_options0 @echo "Other Options:" $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\ $(call NAME_ECHO,$(A_OPTION_NAME))) + +.PHONY: yaml_build_options +yaml_build_options: + @echo '- KEYBOARD : "$(KEYBOARD)"' + @echo ' KEYMAP : "$(KEYMAP)"' + @echo ' MCU : "$(MCU)"' + @echo ' MCU_SERIES : "$(MCU_SERIES)"' + @echo ' PLATFORM : "$(PLATFORM)"' + @echo ' FIRMWARE_FORMAT : "$(FIRMWARE_FORMAT)"' + $(foreach A_OPTION_NAME,$(sort $(BUILD_OPTION_NAMES)),\ + $(call YAML_NAME_ECHO,$(A_OPTION_NAME))) + $(foreach A_OPTION_NAME,$(sort $(HARDWARE_OPTION_NAMES)),\ + $(if $($(A_OPTION_NAME)),$(call YAML_NAME_ECHO,$(A_OPTION_NAME)))) + $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\ + $(if $($(A_OPTION_NAME)),$(call YAML_NAME_ECHO,$(A_OPTION_NAME)))) diff --git a/testlist.mk b/testlist.mk index 0d7609b9f0..b66b93d295 100644 --- a/testlist.mk +++ b/testlist.mk @@ -1,8 +1,10 @@ TEST_LIST = $(notdir $(patsubst %/rules.mk,%,$(wildcard $(ROOT_DIR)/tests/*/rules.mk))) FULL_TESTS := $(TEST_LIST) +include $(ROOT_DIR)/quantum/debounce/tests/testlist.mk include $(ROOT_DIR)/quantum/sequencer/tests/testlist.mk include $(ROOT_DIR)/quantum/serial_link/tests/testlist.mk +include $(ROOT_DIR)/tmk_core/common/test/testlist.mk define VALIDATE_TEST_LIST ifneq ($1,) diff --git a/tests/test_common/keyboard_report_util.cpp b/tests/test_common/keyboard_report_util.cpp index cb044c92b3..f73cf239e0 100644 --- a/tests/test_common/keyboard_report_util.cpp +++ b/tests/test_common/keyboard_report_util.cpp @@ -24,7 +24,7 @@ std::vector<uint8_t> get_keys(const report_keyboard_t& report) { std::vector<uint8_t> result; #if defined(NKRO_ENABLE) # error NKRO support not implemented yet -#elif defined(USB_6KRO_ENABLE) +#elif defined(RING_BUFFERED_6KRO_REPORT_ENABLE) # error 6KRO support not implemented yet #else for (size_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { diff --git a/tests/test_common/main.cpp b/tests/test_common/main.cpp new file mode 100644 index 0000000000..3e4b4c0f95 --- /dev/null +++ b/tests/test_common/main.cpp @@ -0,0 +1,32 @@ +#include "gtest/gtest.h" + +extern "C" { +#include "stdio.h" +#include "debug.h" + +int8_t sendchar(uint8_t c) { + fprintf(stderr, "%c", c); + return 0; +} + +__attribute__((weak)) debug_config_t debug_config = {0}; + +void init_logging(void) { + print_set_sendchar(sendchar); + + // Customise these values to desired behaviour + // debug_enable = true; + // debug_matrix = true; + // debug_keyboard = true; + // debug_mouse = true; + debug_config.raw = 0xFF; +} +} + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + + init_logging(); + + return RUN_ALL_TESTS(); +}
\ No newline at end of file diff --git a/tests/test_common/test_fixture.cpp b/tests/test_common/test_fixture.cpp index 20ed838eb6..e041df7128 100644 --- a/tests/test_common/test_fixture.cpp +++ b/tests/test_common/test_fixture.cpp @@ -7,10 +7,10 @@ #include "action_tapping.h" extern "C" { +#include "debug.h" +#include "eeconfig.h" #include "action_layer.h" -} -extern "C" { void set_time(uint32_t t); void advance_time(uint32_t ms); } @@ -21,6 +21,10 @@ using testing::Between; using testing::Return; void TestFixture::SetUpTestCase() { + // The following is enough to bootstrap the values set in main + eeconfig_init_quantum(); + eeconfig_update_debug(debug_config.raw); + TestDriver driver; EXPECT_CALL(driver, send_keyboard_mock(_)); keyboard_init(); diff --git a/tmk_core/arm_atsam.mk b/tmk_core/arm_atsam.mk index e4bf60e1af..b29de9132b 100644 --- a/tmk_core/arm_atsam.mk +++ b/tmk_core/arm_atsam.mk @@ -50,14 +50,18 @@ MCUFLAGS += -D__$(ARM_ATSAM)__ # For a directory that has spaces, enclose it in quotes. EXTRALIBDIRS = +cpfirmware: warn-arm_atsam +.INTERMEDIATE: warn-arm_atsam +warn-arm_atsam: $(FIRMWARE_FORMAT) + $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@) + $(info This MCU support package has a lack of support from the upstream provider (Massdrop).) + $(info There are currently questions about valid licensing, and at this stage it's likely) + $(info their boards and supporting code will be removed from QMK in the near future. Please) + $(info contact Massdrop for support, and encourage them to align their future board design) + $(info choices to gain proper license compatibility with QMK.) + $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@) + # Convert hex to bin. bin: $(BUILD_DIR)/$(TARGET).hex $(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin; - -flash: bin -ifneq ($(strip $(PROGRAM_CMD)),) - $(PROGRAM_CMD) -else - $(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_ARCH)" -endif diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index eb934ffe60..940e95397b 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -12,8 +12,6 @@ HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) BIN = -COMMON_VPATH += $(DRIVER_PATH)/avr - COMPILEFLAGS += -funsigned-char COMPILEFLAGS += -funsigned-bitfields COMPILEFLAGS += -ffunction-sections @@ -89,157 +87,15 @@ DEBUG_PORT = 4242 DEBUG_HOST = localhost #============================================================================ -# Autodetect teensy loader -ifndef TEENSY_LOADER_CLI - ifneq (, $(shell which teensy-loader-cli 2>/dev/null)) - TEENSY_LOADER_CLI ?= teensy-loader-cli - else - TEENSY_LOADER_CLI ?= teensy_loader_cli - endif -endif - -define EXEC_TEENSY - $(TEENSY_LOADER_CLI) -mmcu=$(MCU) -w -v $(BUILD_DIR)/$(TARGET).hex -endef - -teensy: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware - $(call EXEC_TEENSY) - -DFU_PROGRAMMER ?= dfu-programmer -GREP ?= grep - - -define EXEC_DFU - if [ "$(1)" ]; then \ - echo "Flashing '$(1)' for EE_HANDS split keyboard support." ;\ - fi; \ - if ! $(DFU_PROGRAMMER) $(MCU) get bootloader-version >/dev/null 2>/dev/null; then\ - printf "$(MSG_BOOTLOADER_NOT_FOUND_QUICK_RETRY)" ;\ - sleep $(BOOTLOADER_RETRY_TIME) ;\ - while ! $(DFU_PROGRAMMER) $(MCU) get bootloader-version >/dev/null 2>/dev/null; do\ - printf "." ;\ - sleep $(BOOTLOADER_RETRY_TIME) ;\ - done ;\ - printf "\n" ;\ - fi; \ - $(DFU_PROGRAMMER) $(MCU) get bootloader-version ;\ - if $(DFU_PROGRAMMER) --version 2>&1 | $(GREP) -q 0.7 ; then\ - $(DFU_PROGRAMMER) $(MCU) erase --force; \ - if [ "$(1)" ]; then \ - $(DFU_PROGRAMMER) $(MCU) flash --force --eeprom $(QUANTUM_PATH)/split_common/$(1);\ - fi; \ - $(DFU_PROGRAMMER) $(MCU) flash --force $(BUILD_DIR)/$(TARGET).hex;\ - else \ - $(DFU_PROGRAMMER) $(MCU) erase; \ - if [ "$(1)" ]; then \ - $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(QUANTUM_PATH)/split_common/$(1);\ - fi; \ - $(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex;\ - fi; \ - $(DFU_PROGRAMMER) $(MCU) reset -endef - -dfu: $(BUILD_DIR)/$(TARGET).hex cpfirmware check-size - $(call EXEC_DFU) - -dfu-start: - $(DFU_PROGRAMMER) $(MCU) reset - $(DFU_PROGRAMMER) $(MCU) start - -dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep - if $(DFU_PROGRAMMER) --version 2>&1 | $(GREP) -q 0.7 ; then\ - $(DFU_PROGRAMMER) $(MCU) flash --force --eeprom $(BUILD_DIR)/$(TARGET).eep;\ - else\ - $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep;\ - fi - $(DFU_PROGRAMMER) $(MCU) reset - -dfu-split-left: $(BUILD_DIR)/$(TARGET).hex cpfirmware check-size - $(call EXEC_DFU,eeprom-lefthand.eep) - -dfu-split-right: $(BUILD_DIR)/$(TARGET).hex cpfirmware check-size - $(call EXEC_DFU,eeprom-righthand.eep) - -AVRDUDE_PROGRAMMER ?= avrdude - -define EXEC_AVRDUDE - list_devices() { \ - if $(GREP) -q -s icrosoft /proc/version; then \ - wmic.exe path Win32_SerialPort get DeviceID 2>/dev/null | LANG=C perl -pne 's/COM(\d+)/COM.($$1-1)/e' | sed 's!COM!/dev/ttyS!' | xargs echo -n | sort; \ - elif [ "`uname`" = "FreeBSD" ]; then \ - ls /dev/tty* | grep -v '\.lock$$' | grep -v '\.init$$'; \ - else \ - ls /dev/tty*; \ - fi; \ - }; \ - USB= ;\ - printf "Detecting USB port, reset your controller now."; \ - TMP1=`mktemp`; \ - TMP2=`mktemp`; \ - list_devices > $$TMP1; \ - while [ -z "$$USB" ]; do \ - sleep $(BOOTLOADER_RETRY_TIME); \ - printf "."; \ - list_devices > $$TMP2; \ - USB=`comm -13 $$TMP1 $$TMP2 | $(GREP) -o '/dev/tty.*'`; \ - mv $$TMP2 $$TMP1; \ - done; \ - rm $$TMP1; \ - echo ""; \ - echo "Device $$USB has appeared; assuming it is the controller."; \ - if $(GREP) -q -s 'MINGW\|MSYS\|icrosoft' /proc/version; then \ - USB=`echo "$$USB" | LANG=C perl -pne 's/\/dev\/ttyS(\d+)/COM.($$1+1)/e'`; \ - echo "Remapped USB port to $$USB"; \ - sleep 1; \ - else \ - printf "Waiting for $$USB to become writable."; \ - while [ ! -w "$$USB" ]; do sleep $(BOOTLOADER_RETRY_TIME); printf "."; done; echo ""; \ - fi; \ - if [ -z "$(1)" ]; then \ - $(AVRDUDE_PROGRAMMER) -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex; \ - else \ - $(AVRDUDE_PROGRAMMER) -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex -U eeprom:w:$(QUANTUM_PATH)/split_common/$(1); \ - fi -endef - -avrdude: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware - $(call EXEC_AVRDUDE) - -avrdude-loop: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware - while true; do \ - $(call EXEC_AVRDUDE) ; \ - done - -avrdude-split-left: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware - $(call EXEC_AVRDUDE,eeprom-lefthand.eep) - -avrdude-split-right: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware - $(call EXEC_AVRDUDE,eeprom-righthand.eep) - -define EXEC_USBASP - $(AVRDUDE_PROGRAMMER) -p $(AVRDUDE_MCU) -c usbasp -U flash:w:$(BUILD_DIR)/$(TARGET).hex -endef - -usbasp: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware - $(call EXEC_USBASP) - -BOOTLOADHID_PROGRAMMER ?= bootloadHID - -define EXEC_BOOTLOADHID - # bootloadHid executable has no cross platform detect methods - # so keep running bootloadHid if the output contains "The specified device was not found" - until $(BOOTLOADHID_PROGRAMMER) -r $(BUILD_DIR)/$(TARGET).hex 2>&1 | tee /dev/stderr | grep -v "device was not found"; do\ - printf "$(MSG_BOOTLOADER_NOT_FOUND)" ;\ - sleep 5 ;\ - done -endef - -bootloadHID: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware - $(call EXEC_BOOTLOADHID) # Convert hex to bin. bin: $(BUILD_DIR)/$(TARGET).hex +ifeq ($(BOOTLOADER),lufa-ms) + $(eval BIN_PADDING=$(shell n=`expr 32768 - $(BOOTLOADER_SIZE)` && echo $$(($$n)) || echo 0)) + $(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin --pad-to $(BIN_PADDING) +else $(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin +endif $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin; # copy bin to FLASH.bin @@ -295,39 +151,29 @@ extcoff: $(BUILD_DIR)/$(TARGET).elf @$(SECHO) $(MSG_EXTENDED_COFF) $(BUILD_DIR)/$(TARGET).cof $(COFFCONVERT) -O coff-ext-avr $< $(BUILD_DIR)/$(TARGET).cof -bootloader: -ifneq ($(strip $(BOOTLOADER)), qmk-dfu) - $(error Please set BOOTLOADER = qmk-dfu first!) +ifeq ($(strip $(BOOTLOADER)), qmk-dfu) +QMK_BOOTLOADER_TYPE = DFU +else ifeq ($(strip $(BOOTLOADER)), qmk-hid) +QMK_BOOTLOADER_TYPE = HID endif - make -C lib/lufa/Bootloaders/DFU/ clean - $(QMK_BIN) generate-dfu-header --quiet --keyboard $(KEYBOARD) --output lib/lufa/Bootloaders/DFU/Keyboard.h - $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0)) + +bootloader: +ifeq ($(strip $(QMK_BOOTLOADER_TYPE)),) + $(error Please set BOOTLOADER to "qmk-dfu" or "qmk-hid" first!) +else + make -C lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/ clean + $(QMK_BIN) generate-dfu-header --quiet --keyboard $(KEYBOARD) --output lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/Keyboard.h + $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) -D__ASSEMBLER__ $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0)) $(eval PROGRAM_SIZE_KB=$(shell n=`expr $(MAX_SIZE) / 1024` && echo $$(($$n)) || echo 0)) $(eval BOOT_SECTION_SIZE_KB=$(shell n=`expr $(BOOTLOADER_SIZE) / 1024` && echo $$(($$n)) || echo 0)) $(eval FLASH_SIZE_KB=$(shell n=`expr $(PROGRAM_SIZE_KB) + $(BOOT_SECTION_SIZE_KB)` && echo $$(($$n)) || echo 0)) - make -C lib/lufa/Bootloaders/DFU/ MCU=$(MCU) ARCH=$(ARCH) F_CPU=$(F_CPU) FLASH_SIZE_KB=$(FLASH_SIZE_KB) BOOT_SECTION_SIZE_KB=$(BOOT_SECTION_SIZE_KB) - printf "BootloaderDFU.hex copied to $(TARGET)_bootloader.hex\n" - cp lib/lufa/Bootloaders/DFU/BootloaderDFU.hex $(TARGET)_bootloader.hex + make -C lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/ MCU=$(MCU) ARCH=$(ARCH) F_CPU=$(F_CPU) FLASH_SIZE_KB=$(FLASH_SIZE_KB) BOOT_SECTION_SIZE_KB=$(BOOT_SECTION_SIZE_KB) + printf "Bootloader$(QMK_BOOTLOADER_TYPE).hex copied to $(TARGET)_bootloader.hex\n" + cp lib/lufa/Bootloaders/$(QMK_BOOTLOADER_TYPE)/Bootloader$(QMK_BOOTLOADER_TYPE).hex $(TARGET)_bootloader.hex +endif production: $(BUILD_DIR)/$(TARGET).hex bootloader cpfirmware @cat $(BUILD_DIR)/$(TARGET).hex | awk '/^:00000001FF/ == 0' > $(TARGET)_production.hex @cat $(TARGET)_bootloader.hex >> $(TARGET)_production.hex echo "File sizes:" $(SIZE) $(TARGET).hex $(TARGET)_bootloader.hex $(TARGET)_production.hex - -flash: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware -ifneq ($(strip $(PROGRAM_CMD)),) - $(PROGRAM_CMD) -else ifeq ($(strip $(BOOTLOADER)), caterina) - $(call EXEC_AVRDUDE) -else ifeq ($(strip $(BOOTLOADER)), halfkay) - $(call EXEC_TEENSY) -else ifeq (dfu,$(findstring dfu,$(BOOTLOADER))) - $(call EXEC_DFU) -else ifeq ($(strip $(BOOTLOADER)), USBasp) - $(call EXEC_USBASP) -else ifeq ($(strip $(BOOTLOADER)), bootloadHID) - $(call EXEC_BOOTLOADHID) -else - $(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_BOOTLOADER)" -endif diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index 97299b7d32..18839710be 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -67,9 +67,9 @@ else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/boards/$(BOARD)/board.mk)","") else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/boards/$(BOARD)/board.mk)","") BOARD_PATH = $(KEYBOARD_PATH_1) BOARD_MK += $(KEYBOARD_PATH_1)/boards/$(BOARD)/board.mk -else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/$(BOARD)/board/board.mk)","") - BOARD_PATH = $(TOP_DIR)/platforms/chibios/$(BOARD) - BOARD_MK += $(TOP_DIR)/platforms/chibios/$(BOARD)/board/board.mk +else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/board/board.mk)","") + BOARD_PATH = $(TOP_DIR)/platforms/chibios/boards/$(BOARD) + BOARD_MK += $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/board/board.mk KEYBOARD_PATHS += $(BOARD_PATH)/configs ifneq ("$(wildcard $(BOARD_PATH)/rules.mk)","") include $(BOARD_PATH)/rules.mk @@ -124,10 +124,10 @@ else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/chconf.h)","") CHCONFDIR = $(KEYBOARD_PATH_2) else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/chconf.h)","") CHCONFDIR = $(KEYBOARD_PATH_1) -else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/$(BOARD)/configs/chconf.h)","") - CHCONFDIR = $(TOP_DIR)/platforms/chibios/$(BOARD)/configs -else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/common/configs/chconf.h)","") - CHCONFDIR = $(TOP_DIR)/platforms/chibios/common/configs +else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/configs/chconf.h)","") + CHCONFDIR = $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/configs +else ifneq ("$(wildcard $(TOP_DIR)/platforms/boards/chibios/common/configs/chconf.h)","") + CHCONFDIR = $(TOP_DIR)/platforms/chibios/boards/common/configs endif ifneq ("$(wildcard $(KEYBOARD_PATH_5)/halconf.h)","") @@ -140,10 +140,10 @@ else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/halconf.h)","") HALCONFDIR = $(KEYBOARD_PATH_2) else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/halconf.h)","") HALCONFDIR = $(KEYBOARD_PATH_1) -else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/$(BOARD)/configs/halconf.h)","") - HALCONFDIR = $(TOP_DIR)/platforms/chibios/$(BOARD)/configs -else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/common/configs/halconf.h)","") - HALCONFDIR = $(TOP_DIR)/platforms/chibios/common/configs +else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/configs/halconf.h)","") + HALCONFDIR = $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/configs +else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/boards/common/configs/halconf.h)","") + HALCONFDIR = $(TOP_DIR)/platforms/chibios/boards/common/configs endif # HAL-OSAL files (optional). @@ -190,10 +190,11 @@ else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/ld/$(MCU_LDSCRIPT).ld)","") LDSCRIPT = $(KEYBOARD_PATH_2)/ld/$(MCU_LDSCRIPT).ld else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/ld/$(MCU_LDSCRIPT).ld)","") LDSCRIPT = $(KEYBOARD_PATH_1)/ld/$(MCU_LDSCRIPT).ld -else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/$(BOARD)/ld/$(MCU_LDSCRIPT).ld)","") - LDSCRIPT = $(TOP_DIR)/platforms/chibios/$(BOARD)/ld/$(MCU_LDSCRIPT).ld -else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/common/ld/$(MCU_LDSCRIPT).ld)","") - LDSCRIPT = $(TOP_DIR)/platforms/chibios/common/ld/$(MCU_LDSCRIPT).ld +else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/ld/$(MCU_LDSCRIPT).ld)","") + LDFLAGS += -L$(TOP_DIR)/platforms/chibios/boards/$(BOARD)/ld + LDSCRIPT = $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/ld/$(MCU_LDSCRIPT).ld +else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/boards/common/ld/$(MCU_LDSCRIPT).ld)","") + LDSCRIPT = $(TOP_DIR)/platforms/chibios/boards/common/ld/$(MCU_LDSCRIPT).ld else ifneq ("$(wildcard $(STARTUPLD_CONTRIB)/$(MCU_LDSCRIPT).ld)","") LDSCRIPT = $(STARTUPLD_CONTRIB)/$(MCU_LDSCRIPT).ld USE_CHIBIOS_CONTRIB = yes @@ -210,7 +211,8 @@ CHIBISRC = $(STARTUPSRC) \ $(BOARDSRC) \ $(STREAMSSRC) \ $(CHIBIOS)/os/various/syscalls.c \ - $(PLATFORM_COMMON_DIR)/syscall-fallbacks.c + $(PLATFORM_COMMON_DIR)/syscall-fallbacks.c \ + $(PLATFORM_COMMON_DIR)/wait.c # Ensure the ASM files are not subjected to LTO -- it'll strip out interrupt handlers otherwise. QUANTUM_LIB_SRC += $(STARTUPASM) $(PORTASM) $(OSALASM) $(PLATFORMASM) @@ -218,8 +220,8 @@ QUANTUM_LIB_SRC += $(STARTUPASM) $(PORTASM) $(OSALASM) $(PLATFORMASM) CHIBISRC := $(patsubst $(TOP_DIR)/%,%,$(CHIBISRC)) EXTRAINCDIRS += $(CHIBIOS)/os/license $(CHIBIOS)/os/oslib/include \ - $(TOP_DIR)/platforms/chibios/$(BOARD)/configs \ - $(TOP_DIR)/platforms/chibios/common/configs \ + $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/configs \ + $(TOP_DIR)/platforms/chibios/boards/common/configs \ $(HALCONFDIR) $(CHCONFDIR) \ $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ @@ -240,7 +242,7 @@ else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/halconf_community.h)","") USE_CHIBIOS_CONTRIB = yes else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/halconf_community.h)","") USE_CHIBIOS_CONTRIB = yes -else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/$(BOARD)/configs/halconf_community.h)","") +else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/boards/$(BOARD)/configs/halconf_community.h)","") USE_CHIBIOS_CONTRIB = yes endif @@ -277,8 +279,6 @@ HEX = $(OBJCOPY) -O $(FORMAT) EEP = BIN = $(OBJCOPY) -O binary -COMMON_VPATH += $(DRIVER_PATH)/chibios - THUMBFLAGS = -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB COMPILEFLAGS += -fomit-frame-pointer @@ -325,91 +325,8 @@ MCUFLAGS = -mcpu=$(MCU) DEBUG = gdb -DFU_ARGS ?= -ifneq ("$(SERIAL)","") - DFU_ARGS += -S $(SERIAL) -endif - -ST_LINK_ARGS ?= -ST_FLASH_ARGS ?= - # List any extra directories to look for libraries here. EXTRALIBDIRS = $(RULESPATH)/ld -DFU_UTIL ?= dfu-util -ST_LINK_CLI ?= st-link_cli -ST_FLASH ?= st-flash - -define EXEC_DFU_UTIL - if ! $(DFU_UTIL) -l | grep -q "Found DFU"; then \ - printf "$(MSG_BOOTLOADER_NOT_FOUND_QUICK_RETRY)" ;\ - sleep $(BOOTLOADER_RETRY_TIME) ;\ - while ! $(DFU_UTIL) -l | grep -q "Found DFU"; do \ - printf "." ;\ - sleep $(BOOTLOADER_RETRY_TIME) ;\ - done ;\ - printf "\n" ;\ - fi - $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin -endef - -dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter - $(call EXEC_DFU_UTIL) - -# Legacy alias -dfu-util-wait: dfu-util - -# 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)) - OPT_DEFS += -DINIT_EE_HANDS_LEFT -endif - -ifneq (,$(filter $(MAKECMDGOALS),dfu-util-split-right)) - OPT_DEFS += -DINIT_EE_HANDS_RIGHT -endif - -dfu-util-split-left: dfu-util - -dfu-util-split-right: dfu-util - - -st-link-cli: $(BUILD_DIR)/$(TARGET).hex sizeafter - $(ST_LINK_CLI) $(ST_LINK_ARGS) -q -c SWD -p $(BUILD_DIR)/$(TARGET).hex -Rst - -st-flash: $(BUILD_DIR)/$(TARGET).hex sizeafter - $(ST_FLASH) $(ST_FLASH_ARGS) --reset --format ihex write $(BUILD_DIR)/$(TARGET).hex - - -# Autodetect teensy loader -ifndef TEENSY_LOADER_CLI - ifneq (, $(shell which teensy-loader-cli 2>/dev/null)) - TEENSY_LOADER_CLI ?= teensy-loader-cli - else - TEENSY_LOADER_CLI ?= teensy_loader_cli - endif -endif - -define EXEC_TEENSY - $(TEENSY_LOADER_CLI) -mmcu=$(MCU_LDSCRIPT) -w -v $(BUILD_DIR)/$(TARGET).hex -endef - -teensy: $(BUILD_DIR)/$(TARGET).hex cpfirmware sizeafter - $(call EXEC_TEENSY) - bin: $(BUILD_DIR)/$(TARGET).bin sizeafter $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin; - - -flash: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter -ifneq ($(strip $(PROGRAM_CMD)),) - $(PROGRAM_CMD) -else ifeq ($(strip $(BOOTLOADER)),kiibohd) - $(call EXEC_DFU_UTIL) -else ifeq ($(strip $(MCU_FAMILY)),KINETIS) - $(call EXEC_TEENSY) -else ifeq ($(strip $(MCU_FAMILY)),STM32) - $(call EXEC_DFU_UTIL) -else - $(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_BOOTLOADER)" -endif diff --git a/tmk_core/common.mk b/tmk_core/common.mk index d34d8368f3..b7b7db207a 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -3,29 +3,18 @@ PRINTF_PATH = $(LIB_PATH)/printf COMMON_DIR = common PLATFORM_COMMON_DIR = $(COMMON_DIR)/$(PLATFORM_KEY) -TMK_COMMON_SRC += $(COMMON_DIR)/host.c \ - $(COMMON_DIR)/keyboard.c \ - $(COMMON_DIR)/action.c \ - $(COMMON_DIR)/action_tapping.c \ - $(COMMON_DIR)/action_macro.c \ - $(COMMON_DIR)/action_layer.c \ - $(COMMON_DIR)/action_util.c \ - $(COMMON_DIR)/debug.c \ - $(COMMON_DIR)/sendchar_null.c \ - $(COMMON_DIR)/eeconfig.c \ +TMK_COMMON_SRC += \ + $(COMMON_DIR)/host.c \ $(COMMON_DIR)/report.c \ + $(COMMON_DIR)/sync_timer.c \ $(COMMON_DIR)/usb_util.c \ + $(PLATFORM_COMMON_DIR)/platform.c \ $(PLATFORM_COMMON_DIR)/suspend.c \ $(PLATFORM_COMMON_DIR)/timer.c \ - $(COMMON_DIR)/sync_timer.c \ $(PLATFORM_COMMON_DIR)/bootloader.c \ -# Use platform provided print - fall back to lib/printf -ifneq ("$(wildcard $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk)","") - include $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk -else - include $(TMK_PATH)/$(COMMON_DIR)/lib_printf.mk -endif +# Use platform provided print if it exists +-include $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk SHARED_EP_ENABLE = no MOUSE_SHARED_EP ?= yes @@ -38,7 +27,8 @@ ifeq ($(strip $(KEYBOARD_SHARED_EP)), yes) MOUSE_SHARED_EP = yes endif -ifeq ($(strip $(MOUSEKEY_ENABLE)), yes) +ifeq ($(strip $(MOUSE_ENABLE)), yes) + OPT_DEFS += -DMOUSE_ENABLE ifeq ($(strip $(MOUSE_SHARED_EP)), yes) TMK_COMMON_DEFS += -DMOUSE_SHARED_EP SHARED_EP_ENABLE = yes @@ -62,6 +52,7 @@ endif ifeq ($(strip $(CONSOLE_ENABLE)), yes) TMK_COMMON_DEFS += -DCONSOLE_ENABLE else + # TODO: decouple this so other print backends can exist TMK_COMMON_DEFS += -DNO_PRINT TMK_COMMON_DEFS += -DNO_DEBUG endif @@ -79,8 +70,8 @@ ifeq ($(strip $(NKRO_ENABLE)), yes) endif endif -ifeq ($(strip $(USB_6KRO_ENABLE)), yes) - TMK_COMMON_DEFS += -DUSB_6KRO_ENABLE +ifeq ($(strip $(RING_BUFFERED_6KRO_REPORT_ENABLE)), yes) + TMK_COMMON_DEFS += -DRING_BUFFERED_6KRO_REPORT_ENABLE endif ifeq ($(strip $(SLEEP_LED_ENABLE)), yes) @@ -110,9 +101,6 @@ ifeq ($(strip $(BLUETOOTH)), RN42) TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK endif -ifeq ($(strip $(ONEHAND_ENABLE)), yes) - SWAP_HANDS_ENABLE = yes # backwards compatibility -endif ifeq ($(strip $(SWAP_HANDS_ENABLE)), yes) TMK_COMMON_DEFS += -DSWAP_HANDS_ENABLE endif @@ -121,6 +109,19 @@ ifeq ($(strip $(NO_USB_STARTUP_CHECK)), yes) TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK endif +ifeq ($(strip $(DIGITIZER_SHARED_EP)), yes) + TMK_COMMON_DEFS += -DDIGITIZER_SHARED_EP + SHARED_EP_ENABLE = yes +endif + +ifeq ($(strip $(DIGITIZER_ENABLE)), yes) + TMK_COMMON_DEFS += -DDIGITIZER_ENABLE + ifeq ($(strip $(SHARED_EP_ENABLE)), yes) + TMK_COMMON_DEFS += -DDIGITIZER_SHARED_EP + SHARED_EP_ENABLE = yes + endif +endif + ifeq ($(strip $(SHARED_EP_ENABLE)), yes) TMK_COMMON_DEFS += -DSHARED_EP_ENABLE endif @@ -140,3 +141,4 @@ endif # Search Path VPATH += $(TMK_PATH)/$(COMMON_DIR) VPATH += $(TMK_PATH)/$(PLATFORM_COMMON_DIR) +VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR) diff --git a/tmk_core/common/arm_atsam/_print.h b/tmk_core/common/arm_atsam/_print.h deleted file mode 100644 index 04320ee38b..0000000000 --- a/tmk_core/common/arm_atsam/_print.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright 2012 Jun Wako <wakojun@gmail.com> */ -/* Very basic print functions, intended to be used with usb_debug_only.c - * http://www.pjrc.com/teensy/ - * Copyright (c) 2008 PJRC.COM, LLC - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#pragma once - -#include "arm_atsam/printf.h" - -// Create user & normal print defines -#define xprintf(fmt, ...) __xprintf(fmt, ##__VA_ARGS__) -#define print(s) __xprintf(s) -#define println(s) __xprintf(s "\r\n") -#define uprint(s) __xprintf(s) -#define uprintln(s) __xprintf(s "\r\n") -#define uprintf(fmt, ...) __xprintf(fmt, ##__VA_ARGS__) diff --git a/tmk_core/common/arm_atsam/_timer.h b/tmk_core/common/arm_atsam/_timer.h new file mode 100644 index 0000000000..77402b612a --- /dev/null +++ b/tmk_core/common/arm_atsam/_timer.h @@ -0,0 +1,19 @@ +/* Copyright 2021 Simon Arlott + * + * 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 + +// The platform is 32-bit, so prefer 32-bit timers to avoid overflow +#define FAST_TIMER_T_SIZE 32 diff --git a/tmk_core/common/arm_atsam/atomic_util.h b/tmk_core/common/arm_atsam/atomic_util.h new file mode 100644 index 0000000000..848542d23a --- /dev/null +++ b/tmk_core/common/arm_atsam/atomic_util.h @@ -0,0 +1,37 @@ +/* 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 + +#include "samd51j18a.h" + +static __inline__ uint8_t __interrupt_disable__(void) { + __disable_irq(); + + return 1; +} + +static __inline__ void __interrupt_enable__(const uint8_t *__s) { + __enable_irq(); + + __asm__ volatile("" ::: "memory"); + (void)__s; +} + +#define ATOMIC_BLOCK(type) for (type, __ToDo = __interrupt_disable__(); __ToDo; __ToDo = 0) +#define ATOMIC_FORCEON uint8_t sreg_save __attribute__((__cleanup__(__interrupt_enable__))) = 0 + +#define ATOMIC_BLOCK_RESTORESTATE _Static_assert(0, "ATOMIC_BLOCK_RESTORESTATE not implemented") +#define ATOMIC_BLOCK_FORCEON ATOMIC_BLOCK(ATOMIC_FORCEON) diff --git a/tmk_core/common/arm_atsam/gpio.h b/tmk_core/common/arm_atsam/gpio.h new file mode 100644 index 0000000000..c2d5a30889 --- /dev/null +++ b/tmk_core/common/arm_atsam/gpio.h @@ -0,0 +1,71 @@ +/* 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 + +#include "stdint.h" +#include "samd51j18a.h" + +#include "pin_defs.h" + +typedef uint8_t pin_t; + +#define SAMD_PORT(pin) ((pin & 0x20) >> 5) +#define SAMD_PIN(pin) (pin & 0x1f) +#define SAMD_PIN_MASK(pin) (1 << (pin & 0x1f)) + +#define setPinInput(pin) \ + do { \ + PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.INEN = 1; \ + PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \ + } while (0) + +#define setPinInputHigh(pin) \ + do { \ + PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \ + PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \ + PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.INEN = 1; \ + PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.PULLEN = 1; \ + } while (0) + +#define setPinInputLow(pin) \ + do { \ + PORT->Group[SAMD_PORT(pin)].DIRCLR.reg = SAMD_PIN_MASK(pin); \ + PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \ + PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.INEN = 1; \ + PORT->Group[SAMD_PORT(pin)].PINCFG[SAMD_PIN(pin)].bit.PULLEN = 1; \ + } while (0) + +#define setPinOutput(pin) \ + do { \ + PORT->Group[SAMD_PORT(pin)].DIRSET.reg = SAMD_PIN_MASK(pin); \ + PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \ + } while (0) + +#define writePinHigh(pin) \ + do { \ + PORT->Group[SAMD_PORT(pin)].OUTSET.reg = SAMD_PIN_MASK(pin); \ + } while (0) + +#define writePinLow(pin) \ + do { \ + PORT->Group[SAMD_PORT(pin)].OUTCLR.reg = SAMD_PIN_MASK(pin); \ + } while (0) + +#define writePin(pin, level) ((level) ? (writePinHigh(pin)) : (writePinLow(pin))) + +#define readPin(pin) ((PORT->Group[SAMD_PORT(pin)].IN.reg & SAMD_PIN_MASK(pin)) != 0) + +#define togglePin(pin) (PORT->Group[SAMD_PORT(pin)].OUTTGL.reg = SAMD_PIN_MASK(pin)) diff --git a/tmk_core/common/arm_atsam/pin_defs.h b/tmk_core/common/arm_atsam/pin_defs.h new file mode 100644 index 0000000000..5b50b23910 --- /dev/null +++ b/tmk_core/common/arm_atsam/pin_defs.h @@ -0,0 +1,84 @@ +/* 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 + +#include "samd51j18a.h" + +#define A00 PIN_PA00 +#define A01 PIN_PA01 +#define A02 PIN_PA02 +#define A03 PIN_PA03 +#define A04 PIN_PA04 +#define A05 PIN_PA05 +#define A06 PIN_PA06 +#define A07 PIN_PA07 +#define A08 PIN_PA08 +#define A09 PIN_PA09 +#define A10 PIN_PA10 +#define A11 PIN_PA11 +#define A12 PIN_PA12 +#define A13 PIN_PA13 +#define A14 PIN_PA14 +#define A15 PIN_PA15 +#define A16 PIN_PA16 +#define A17 PIN_PA17 +#define A18 PIN_PA18 +#define A19 PIN_PA19 +#define A20 PIN_PA20 +#define A21 PIN_PA21 +#define A22 PIN_PA22 +#define A23 PIN_PA23 +#define A24 PIN_PA24 +#define A25 PIN_PA25 +#define A26 PIN_PA26 +#define A27 PIN_PA27 +#define A28 PIN_PA28 +#define A29 PIN_PA29 +#define A30 PIN_PA30 +#define A31 PIN_PA31 + +#define B00 PIN_PB00 +#define B01 PIN_PB01 +#define B02 PIN_PB02 +#define B03 PIN_PB03 +#define B04 PIN_PB04 +#define B05 PIN_PB05 +#define B06 PIN_PB06 +#define B07 PIN_PB07 +#define B08 PIN_PB08 +#define B09 PIN_PB09 +#define B10 PIN_PB10 +#define B11 PIN_PB11 +#define B12 PIN_PB12 +#define B13 PIN_PB13 +#define B14 PIN_PB14 +#define B15 PIN_PB15 +#define B16 PIN_PB16 +#define B17 PIN_PB17 +#define B18 PIN_PB18 +#define B19 PIN_PB19 +#define B20 PIN_PB20 +#define B21 PIN_PB21 +#define B22 PIN_PB22 +#define B23 PIN_PB23 +#define B24 PIN_PB24 +#define B25 PIN_PB25 +#define B26 PIN_PB26 +#define B27 PIN_PB27 +#define B28 PIN_PB28 +#define B29 PIN_PB29 +#define B30 PIN_PB30 +#define B31 PIN_PB31 diff --git a/tmk_core/common/arm_atsam/platform.c b/tmk_core/common/arm_atsam/platform.c new file mode 100644 index 0000000000..3e35b4fe4c --- /dev/null +++ b/tmk_core/common/arm_atsam/platform.c @@ -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 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 "platform_deps.h" + +void platform_setup(void) { + // do nothing +} diff --git a/tmk_core/common/arm_atsam/platform_deps.h b/tmk_core/common/arm_atsam/platform_deps.h new file mode 100644 index 0000000000..f296d1d535 --- /dev/null +++ b/tmk_core/common/arm_atsam/platform_deps.h @@ -0,0 +1,18 @@ +/* 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 + +// here just to please the build diff --git a/tmk_core/common/arm_atsam/printf.c b/tmk_core/common/arm_atsam/printf.c deleted file mode 100644 index 6f7e8d343f..0000000000 --- a/tmk_core/common/arm_atsam/printf.c +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright 2018 Massdrop Inc. - -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 "printf.h" -#include "sendchar.h" - -#ifdef CONSOLE_ENABLE - -# include "samd51j18a.h" -# include "arm_atsam_protocol.h" -# include <string.h> -# include <stdarg.h> - -void console_printf(char *fmt, ...) { - while (udi_hid_con_b_report_trans_ongoing) { - } // Wait for any previous transfers to complete - - static char console_printbuf[CONSOLE_PRINTBUF_SIZE]; // Print and send buffer - va_list va; - int result; - - va_start(va, fmt); - result = vsnprintf(console_printbuf, CONSOLE_PRINTBUF_SIZE, fmt, va); - va_end(va); - - uint32_t irqflags; - char * pconbuf = console_printbuf; // Pointer to start send from - int send_out = CONSOLE_EPSIZE; // Bytes to send per transfer - - while (result > 0) { // While not error and bytes remain - while (udi_hid_con_b_report_trans_ongoing) { - } // Wait for any previous transfers to complete - - irqflags = __get_PRIMASK(); - __disable_irq(); - __DMB(); - - if (result < CONSOLE_EPSIZE) { // If remaining bytes are less than console epsize - memset(udi_hid_con_report, 0, CONSOLE_EPSIZE); // Clear the buffer - send_out = result; // Send remaining size - } - - memcpy(udi_hid_con_report, pconbuf, send_out); // Copy data into the send buffer - - udi_hid_con_b_report_valid = 1; // Set report valid - udi_hid_con_send_report(); // Send report - - __DMB(); - __set_PRIMASK(irqflags); - - result -= send_out; // Decrement result by bytes sent - pconbuf += send_out; // Increment buffer point by bytes sent - } -} - -#endif // CONSOLE_ENABLE -<<<<<<< HEAD -======= - -void print_set_sendchar(sendchar_func_t send) {} ->>>>>>> 0.12.52~1 diff --git a/tmk_core/common/arm_atsam/printf.h b/tmk_core/common/arm_atsam/printf.h deleted file mode 100644 index 95557f5b01..0000000000 --- a/tmk_core/common/arm_atsam/printf.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#define CONSOLE_PRINTBUF_SIZE 512 - -void console_printf(char *fmt, ...); - -#define __xprintf console_printf diff --git a/tmk_core/common/arm_atsam/printf.mk b/tmk_core/common/arm_atsam/printf.mk deleted file mode 100644 index f70e02731f..0000000000 --- a/tmk_core/common/arm_atsam/printf.mk +++ /dev/null @@ -1 +0,0 @@ -TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/printf.c diff --git a/tmk_core/common/avr/_timer.h b/tmk_core/common/avr/_timer.h new file mode 100644 index 0000000000..b81e0f68b7 --- /dev/null +++ b/tmk_core/common/avr/_timer.h @@ -0,0 +1,19 @@ +/* Copyright 2021 Simon Arlott + * + * 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 + +// The platform is 8-bit, so prefer 16-bit timers to reduce code size +#define FAST_TIMER_T_SIZE 16 diff --git a/tmk_core/common/avr/_wait.h b/tmk_core/common/avr/_wait.h index 56eb316faf..683db6ae57 100644 --- a/tmk_core/common/avr/_wait.h +++ b/tmk_core/common/avr/_wait.h @@ -17,8 +17,28 @@ #include <util/delay.h> -#define wait_ms(ms) _delay_ms(ms) -#define wait_us(us) _delay_us(us) +#define wait_ms(ms) \ + do { \ + if (__builtin_constant_p(ms)) { \ + _delay_ms(ms); \ + } else { \ + for (uint16_t i = ms; i > 0; i--) { \ + _delay_ms(1); \ + } \ + } \ + } while (0) +#define wait_us(us) \ + do { \ + if (__builtin_constant_p(us)) { \ + _delay_us(us); \ + } else { \ + for (uint16_t i = us; i > 0; i--) { \ + _delay_us(1); \ + } \ + } \ + } while (0) +#define wait_cpuclock(n) __builtin_avr_delay_cycles(n) +#define CPU_CLOCK F_CPU /* The AVR series GPIOs have a one clock read delay for changes in the digital input signal. * But here's more margin to make it two clocks. */ @@ -26,4 +46,4 @@ # define GPIO_INPUT_PIN_DELAY 2 #endif -#define waitInputPinDelay() __builtin_avr_delay_cycles(GPIO_INPUT_PIN_DELAY) +#define waitInputPinDelay() wait_cpuclock(GPIO_INPUT_PIN_DELAY) diff --git a/tmk_core/common/avr/gpio.h b/tmk_core/common/avr/gpio.h index 231556c29c..e9be68491d 100644 --- a/tmk_core/common/avr/gpio.h +++ b/tmk_core/common/avr/gpio.h @@ -20,6 +20,8 @@ typedef uint8_t pin_t; +/* Operation of GPIO by pin. */ + #define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF)) #define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) |= _BV((pin)&0xF)) #define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low") @@ -32,3 +34,16 @@ typedef uint8_t pin_t; #define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF))) #define togglePin(pin) (PORTx_ADDRESS(pin) ^= _BV((pin)&0xF)) + +/* Operation of GPIO by port. */ + +typedef uint8_t port_data_t; + +#define readPort(port) PINx_ADDRESS(port) + +#define setPortBitInput(port, bit) (DDRx_ADDRESS(port) &= ~_BV((bit)&0xF), PORTx_ADDRESS(port) &= ~_BV((bit)&0xF)) +#define setPortBitInputHigh(port, bit) (DDRx_ADDRESS(port) &= ~_BV((bit)&0xF), PORTx_ADDRESS(port) |= _BV((bit)&0xF)) +#define setPortBitOutput(port, bit) (DDRx_ADDRESS(port) |= _BV((bit)&0xF)) + +#define writePortBitLow(port, bit) (PORTx_ADDRESS(port) &= ~_BV((bit)&0xF)) +#define writePortBitHigh(port, bit) (PORTx_ADDRESS(port) |= _BV((bit)&0xF)) diff --git a/tmk_core/common/avr/platform.c b/tmk_core/common/avr/platform.c new file mode 100644 index 0000000000..3e35b4fe4c --- /dev/null +++ b/tmk_core/common/avr/platform.c @@ -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 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 "platform_deps.h" + +void platform_setup(void) { + // do nothing +} diff --git a/tmk_core/common/avr/platform_deps.h b/tmk_core/common/avr/platform_deps.h new file mode 100644 index 0000000000..45d9dcebfa --- /dev/null +++ b/tmk_core/common/avr/platform_deps.h @@ -0,0 +1,20 @@ +/* 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 + +#include <avr/pgmspace.h> +#include <avr/io.h> +#include <avr/interrupt.h> diff --git a/tmk_core/common/chibios/_timer.h b/tmk_core/common/chibios/_timer.h new file mode 100644 index 0000000000..77402b612a --- /dev/null +++ b/tmk_core/common/chibios/_timer.h @@ -0,0 +1,19 @@ +/* Copyright 2021 Simon Arlott + * + * 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 + +// The platform is 32-bit, so prefer 32-bit timers to avoid overflow +#define FAST_TIMER_T_SIZE 32 diff --git a/tmk_core/common/chibios/_wait.c b/tmk_core/common/chibios/_wait.c new file mode 100644 index 0000000000..1fbea2dd5e --- /dev/null +++ b/tmk_core/common/chibios/_wait.c @@ -0,0 +1,89 @@ +/* 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/>. + */ + +#ifndef __OPTIMIZE__ +# pragma message "Compiler optimizations disabled; wait_cpuclock() won't work as designed" +#endif + +#define CLOCK_DELAY_NOP8 "nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t" + +__attribute__((always_inline)) static inline void wait_cpuclock(unsigned int n) { /* n: 1..135 */ + /* The argument n must be a constant expression. + * That way, compiler optimization will remove unnecessary code. */ + if (n < 1) { + return; + } + if (n > 8) { + unsigned int n8 = n / 8; + n = n - n8 * 8; + switch (n8) { + case 16: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 15: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 14: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 13: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 12: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 11: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 10: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 9: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 8: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 7: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 6: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 5: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 4: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 3: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 2: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 1: + asm volatile(CLOCK_DELAY_NOP8::: "memory"); + case 0: + break; + } + } + switch (n) { + case 8: + asm volatile("nop" ::: "memory"); + case 7: + asm volatile("nop" ::: "memory"); + case 6: + asm volatile("nop" ::: "memory"); + case 5: + asm volatile("nop" ::: "memory"); + case 4: + asm volatile("nop" ::: "memory"); + case 3: + asm volatile("nop" ::: "memory"); + case 2: + asm volatile("nop" ::: "memory"); + case 1: + asm volatile("nop" ::: "memory"); + case 0: + break; + } +} diff --git a/tmk_core/common/chibios/_wait.h b/tmk_core/common/chibios/_wait.h index 5bface53e1..b740afbd24 100644 --- a/tmk_core/common/chibios/_wait.h +++ b/tmk_core/common/chibios/_wait.h @@ -16,6 +16,7 @@ #pragma once #include <ch.h> +#include <hal.h> /* chThdSleepX of zero maps to infinite - so we map to a tiny delay to still yield */ #define wait_ms(ms) \ @@ -26,14 +27,23 @@ chThdSleepMicroseconds(1); \ } \ } while (0) -#define wait_us(us) \ - do { \ - if (us != 0) { \ - chThdSleepMicroseconds(us); \ - } else { \ - chThdSleepMicroseconds(1); \ - } \ - } while (0) + +#ifdef WAIT_US_TIMER +void wait_us(uint16_t duration); +#else +# define wait_us(us) \ + do { \ + if (us != 0) { \ + chThdSleepMicroseconds(us); \ + } else { \ + chThdSleepMicroseconds(1); \ + } \ + } while (0) +#endif + +#include "_wait.c" + +#define CPU_CLOCK STM32_SYSCLK /* For GPIOs on ARM-based MCUs, the input pins are sampled by the clock of the bus * to which the GPIO is connected. @@ -45,11 +55,8 @@ * If the GPIO_INPUT_PIN_DELAY macro is not defined, the following default values will be used. * (A fairly large value of 0.25 microseconds is set.) */ - -#include "wait.c" - #ifndef GPIO_INPUT_PIN_DELAY -# define GPIO_INPUT_PIN_DELAY (STM32_SYSCLK / 1000000L / 4) +# define GPIO_INPUT_PIN_DELAY (CPU_CLOCK / 1000000L / 4) #endif #define waitInputPinDelay() wait_cpuclock(GPIO_INPUT_PIN_DELAY) diff --git a/tmk_core/common/chibios/bootloader.c b/tmk_core/common/chibios/bootloader.c index 11f7abf432..f9514ee5f3 100644 --- a/tmk_core/common/chibios/bootloader.c +++ b/tmk_core/common/chibios/bootloader.c @@ -95,7 +95,7 @@ void enter_bootloader_mode_if_requested(void) { } } -#elif defined(KL2x) || defined(K20x) || defined(MK66F18) // STM32_BOOTLOADER_DUAL_BANK // STM32_BOOTLOADER_ADDRESS +#elif defined(KL2x) || defined(K20x) || defined(MK66F18) || defined(MIMXRT1062) // STM32_BOOTLOADER_DUAL_BANK // STM32_BOOTLOADER_ADDRESS /* Kinetis */ # if defined(BOOTLOADER_KIIBOHD) @@ -103,7 +103,8 @@ void enter_bootloader_mode_if_requested(void) { # define SCB_AIRCR_VECTKEY_WRITEMAGIC 0x05FA0000 const uint8_t sys_reset_to_loader_magic[] = "\xff\x00\x7fRESET TO LOADER\x7f\x00\xff"; __attribute__((weak)) void bootloader_jump(void) { - __builtin_memcpy((void *)VBAT, (const void *)sys_reset_to_loader_magic, sizeof(sys_reset_to_loader_magic)); + void *volatile vbat = (void *)VBAT; + __builtin_memcpy(vbat, (const void *)sys_reset_to_loader_magic, sizeof(sys_reset_to_loader_magic)); // request reset SCB->AIRCR = SCB_AIRCR_VECTKEY_WRITEMAGIC | SCB_AIRCR_SYSRESETREQ_Msk; } diff --git a/tmk_core/common/chibios/chibios_config.h b/tmk_core/common/chibios/chibios_config.h index 1d8ace4955..23c65f9428 100644 --- a/tmk_core/common/chibios/chibios_config.h +++ b/tmk_core/common/chibios/chibios_config.h @@ -15,7 +15,9 @@ */ #pragma once -#define SPLIT_USB_DETECT // Force this on for now +#ifndef USB_VBUS_PIN +# define SPLIT_USB_DETECT // Force this on when dedicated pin is not used +#endif #if defined(STM32F1XX) # define USE_GPIOV1 diff --git a/tmk_core/common/chibios/eeprom_stm32.c b/tmk_core/common/chibios/eeprom_stm32.c index ea51989728..1fdf8c1e29 100644 --- a/tmk_core/common/chibios/eeprom_stm32.c +++ b/tmk_core/common/chibios/eeprom_stm32.c @@ -14,185 +14,713 @@ * Artur F. * * Modifications for QMK and STM32F303 by Yiancar + * Modifications to add flash wear leveling by Ilya Zhuravlev + * Modifications to increase flash density by Don Kjer */ #include <stdio.h> -#include <string.h> +#include <stdbool.h> +#include "util.h" +#include "debug.h" #include "eeprom_stm32.h" -/***************************************************************************** - * Allows to use the internal flash to store non volatile data. To initialize - * the functionality use the EEPROM_Init() function. Be sure that by reprogramming - * of the controller just affected pages will be deleted. In other case the non - * volatile data will be lost. - ******************************************************************************/ +#include "flash_stm32.h" + +/* + * We emulate eeprom by writing a snapshot compacted view of eeprom contents, + * followed by a write log of any change since that snapshot: + * + * === SIMULATED EEPROM CONTENTS === + * + * ┌─ Compacted ┬ Write Log ─┐ + * │............│[BYTE][BYTE]│ + * │FFFF....FFFF│[WRD0][WRD1]│ + * │FFFFFFFFFFFF│[WORD][NEXT]│ + * │....FFFFFFFF│[BYTE][WRD0]│ + * ├────────────┼────────────┤ + * └──PAGE_BASE │ │ + * PAGE_LAST─┴─WRITE_BASE │ + * WRITE_LAST ┘ + * + * Compacted contents are the 1's complement of the actual EEPROM contents. + * e.g. An 'FFFF' represents a '0000' value. + * + * The size of the 'compacted' area is equal to the size of the 'emulated' eeprom. + * The size of the compacted-area and write log are configurable, and the combined + * size of Compacted + WriteLog is a multiple FEE_PAGE_SIZE, which is MCU dependent. + * Simulated Eeprom contents are located at the end of available flash space. + * + * The following configuration defines can be set: + * + * FEE_PAGE_COUNT # Total number of pages to use for eeprom simulation (Compact + Write log) + * FEE_DENSITY_BYTES # Size of simulated eeprom. (Defaults to half the space allocated by FEE_PAGE_COUNT) + * NOTE: The current implementation does not include page swapping, + * and FEE_DENSITY_BYTES will consume that amount of RAM as a cached view of actual EEPROM contents. + * + * The maximum size of FEE_DENSITY_BYTES is currently 16384. The write log size equals + * FEE_PAGE_COUNT * FEE_PAGE_SIZE - FEE_DENSITY_BYTES. + * The larger the write log, the less frequently the compacted area needs to be rewritten. + * + * + * *** General Algorithm *** + * + * During initialization: + * The contents of the Compacted-flash area are loaded and the 1's complement value + * is cached into memory (e.g. 0xFFFF in Flash represents 0x0000 in cache). + * Write log entries are processed until a 0xFFFF is reached. + * Each log entry updates a byte or word in the cache. + * + * During reads: + * EEPROM contents are given back directly from the cache in memory. + * + * During writes: + * The contents of the cache is updated first. + * If the Compacted-flash area corresponding to the write address is unprogrammed, the 1's complement of the value is written directly into Compacted-flash + * Otherwise: + * If the write log is full, erase both the Compacted-flash area and the Write log, then write cached contents to the Compacted-flash area. + * Otherwise a Write log entry is constructed and appended to the next free position in the Write log. + * + * + * *** Write Log Structure *** + * + * Write log entries allow for optimized byte writes to addresses below 128. Writing 0 or 1 words are also optimized when word-aligned. + * + * === WRITE LOG ENTRY FORMATS === + * + * ╔═══ Byte-Entry ══╗ + * ║0XXXXXXX║YYYYYYYY║ + * ║ └──┬──┘║└──┬───┘║ + * ║ Address║ Value ║ + * ╚════════╩════════╝ + * 0 <= Address < 0x80 (128) + * + * ╔ Word-Encoded 0 ╗ + * ║100XXXXXXXXXXXXX║ + * ║ │└─────┬─────┘║ + * ║ │Address >> 1 ║ + * ║ └── Value: 0 ║ + * ╚════════════════╝ + * 0 <= Address <= 0x3FFE (16382) + * + * ╔ Word-Encoded 1 ╗ + * ║101XXXXXXXXXXXXX║ + * ║ │└─────┬─────┘║ + * ║ │Address >> 1 ║ + * ║ └── Value: 1 ║ + * ╚════════════════╝ + * 0 <= Address <= 0x3FFE (16382) + * + * ╔═══ Reserved ═══╗ + * ║110XXXXXXXXXXXXX║ + * ╚════════════════╝ + * + * ╔═══════════ Word-Next ═══════════╗ + * ║111XXXXXXXXXXXXX║YYYYYYYYYYYYYYYY║ + * ║ └─────┬─────┘║└───────┬──────┘║ + * ║(Address-128)>>1║ ~Value ║ + * ╚════════════════╩════════════════╝ + * ( 0 <= Address < 0x0080 (128): Reserved) + * 0x80 <= Address <= 0x3FFE (16382) + * + * Write Log entry ranges: + * 0x0000 ... 0x7FFF - Byte-Entry; address is (Entry & 0x7F00) >> 4; value is (Entry & 0xFF) + * 0x8000 ... 0x9FFF - Word-Encoded 0; address is (Entry & 0x1FFF) << 1; value is 0 + * 0xA000 ... 0xBFFF - Word-Encoded 1; address is (Entry & 0x1FFF) << 1; value is 1 + * 0xC000 ... 0xDFFF - Reserved + * 0xE000 ... 0xFFBF - Word-Next; address is (Entry & 0x1FFF) << 1 + 0x80; value is ~(Next_Entry) + * 0xFFC0 ... 0xFFFE - Reserved + * 0xFFFF - Unprogrammed + * + */ -/* Private macro -------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ -/* Functions -----------------------------------------------------------------*/ +#include "eeprom_stm32_defs.h" +#if !defined(FEE_PAGE_SIZE) || !defined(FEE_PAGE_COUNT) || !defined(FEE_MCU_FLASH_SIZE) || !defined(FEE_PAGE_BASE_ADDRESS) +# error "not implemented." +#endif + +/* These bits are used for optimizing encoding of bytes, 0 and 1 */ +#define FEE_WORD_ENCODING 0x8000 +#define FEE_VALUE_NEXT 0x6000 +#define FEE_VALUE_RESERVED 0x4000 +#define FEE_VALUE_ENCODED 0x2000 +#define FEE_BYTE_RANGE 0x80 + +/* Addressable range 16KByte: 0 <-> (0x1FFF << 1) */ +#define FEE_ADDRESS_MAX_SIZE 0x4000 + +/* Flash word value after erase */ +#define FEE_EMPTY_WORD ((uint16_t)0xFFFF) + +/* Size of combined compacted eeprom and write log pages */ +#define FEE_DENSITY_MAX_SIZE (FEE_PAGE_COUNT * FEE_PAGE_SIZE) + +#ifndef FEE_MCU_FLASH_SIZE_IGNORE_CHECK /* *TODO: Get rid of this check */ +# if FEE_DENSITY_MAX_SIZE > (FEE_MCU_FLASH_SIZE * 1024) +# pragma message STR(FEE_DENSITY_MAX_SIZE) " > " STR(FEE_MCU_FLASH_SIZE * 1024) +# error emulated eeprom: FEE_DENSITY_MAX_SIZE is greater than available flash size +# endif +#endif + +/* Size of emulated eeprom */ +#ifdef FEE_DENSITY_BYTES +# if (FEE_DENSITY_BYTES > FEE_DENSITY_MAX_SIZE) +# pragma message STR(FEE_DENSITY_BYTES) " > " STR(FEE_DENSITY_MAX_SIZE) +# error emulated eeprom: FEE_DENSITY_BYTES exceeds FEE_DENSITY_MAX_SIZE +# endif +# if (FEE_DENSITY_BYTES == FEE_DENSITY_MAX_SIZE) +# pragma message STR(FEE_DENSITY_BYTES) " == " STR(FEE_DENSITY_MAX_SIZE) +# warning emulated eeprom: FEE_DENSITY_BYTES leaves no room for a write log. This will greatly increase the flash wear rate! +# endif +# if FEE_DENSITY_BYTES > FEE_ADDRESS_MAX_SIZE +# pragma message STR(FEE_DENSITY_BYTES) " > " STR(FEE_ADDRESS_MAX_SIZE) +# error emulated eeprom: FEE_DENSITY_BYTES is greater than FEE_ADDRESS_MAX_SIZE allows +# endif +# if ((FEE_DENSITY_BYTES) % 2) == 1 +# error emulated eeprom: FEE_DENSITY_BYTES must be even +# endif +#else +/* Default to half of allocated space used for emulated eeprom, half for write log */ +# define FEE_DENSITY_BYTES (FEE_PAGE_COUNT * FEE_PAGE_SIZE / 2) +#endif + +/* Size of write log */ +#ifdef FEE_WRITE_LOG_BYTES +# if ((FEE_DENSITY_BYTES + FEE_WRITE_LOG_BYTES) > FEE_DENSITY_MAX_SIZE) +# pragma message STR(FEE_DENSITY_BYTES) " + " STR(FEE_WRITE_LOG_BYTES) " > " STR(FEE_DENSITY_MAX_SIZE) +# error emulated eeprom: FEE_WRITE_LOG_BYTES exceeds remaining FEE_DENSITY_MAX_SIZE +# endif +# if ((FEE_WRITE_LOG_BYTES) % 2) == 1 +# error emulated eeprom: FEE_WRITE_LOG_BYTES must be even +# endif +#else +/* Default to use all remaining space */ +# define FEE_WRITE_LOG_BYTES (FEE_PAGE_COUNT * FEE_PAGE_SIZE - FEE_DENSITY_BYTES) +#endif + +/* Start of the emulated eeprom compacted flash area */ +#define FEE_COMPACTED_BASE_ADDRESS FEE_PAGE_BASE_ADDRESS +/* End of the emulated eeprom compacted flash area */ +#define FEE_COMPACTED_LAST_ADDRESS (FEE_COMPACTED_BASE_ADDRESS + FEE_DENSITY_BYTES) +/* Start of the emulated eeprom write log */ +#define FEE_WRITE_LOG_BASE_ADDRESS FEE_COMPACTED_LAST_ADDRESS +/* End of the emulated eeprom write log */ +#define FEE_WRITE_LOG_LAST_ADDRESS (FEE_WRITE_LOG_BASE_ADDRESS + FEE_WRITE_LOG_BYTES) + +#if defined(DYNAMIC_KEYMAP_EEPROM_MAX_ADDR) && (DYNAMIC_KEYMAP_EEPROM_MAX_ADDR >= FEE_DENSITY_BYTES) +# error emulated eeprom: DYNAMIC_KEYMAP_EEPROM_MAX_ADDR is greater than the FEE_DENSITY_BYTES available +#endif + +/* In-memory contents of emulated eeprom for faster access */ +/* *TODO: Implement page swapping */ +static uint16_t WordBuf[FEE_DENSITY_BYTES / 2]; +static uint8_t *DataBuf = (uint8_t *)WordBuf; + +/* Pointer to the first available slot within the write log */ +static uint16_t *empty_slot; + +// #define DEBUG_EEPROM_OUTPUT + +/* + * Debug print utils + */ + +#if defined(DEBUG_EEPROM_OUTPUT) + +# define debug_eeprom debug_enable +# define eeprom_println(s) println(s) +# define eeprom_printf(fmt, ...) xprintf(fmt, ##__VA_ARGS__); + +#else /* NO_DEBUG */ + +# define debug_eeprom false +# define eeprom_println(s) +# define eeprom_printf(fmt, ...) + +#endif /* NO_DEBUG */ + +void print_eeprom(void) { +#ifndef NO_DEBUG + int empty_rows = 0; + for (uint16_t i = 0; i < FEE_DENSITY_BYTES; i++) { + if (i % 16 == 0) { + if (i >= FEE_DENSITY_BYTES - 16) { + /* Make sure we display the last row */ + empty_rows = 0; + } + /* Check if this row is uninitialized */ + ++empty_rows; + for (uint16_t j = 0; j < 16; j++) { + if (DataBuf[i + j]) { + empty_rows = 0; + break; + } + } + if (empty_rows > 1) { + /* Repeat empty row */ + if (empty_rows == 2) { + /* Only display the first repeat empty row */ + println("*"); + } + i += 15; + continue; + } + xprintf("%04x", i); + } + if (i % 8 == 0) print(" "); + + xprintf(" %02x", DataBuf[i]); + if ((i + 1) % 16 == 0) { + println(""); + } + } +#endif +} -uint8_t DataBuf[FEE_PAGE_SIZE]; -/***************************************************************************** - * Delete Flash Space used for user Data, deletes the whole space between - * RW_PAGE_BASE_ADDRESS and the last uC Flash Page - ******************************************************************************/ uint16_t EEPROM_Init(void) { - // unlock flash - FLASH_Unlock(); + /* Load emulated eeprom contents from compacted flash into memory */ + uint16_t *src = (uint16_t *)FEE_COMPACTED_BASE_ADDRESS; + uint16_t *dest = (uint16_t *)DataBuf; + for (; src < (uint16_t *)FEE_COMPACTED_LAST_ADDRESS; ++src, ++dest) { + *dest = ~*src; + } + + if (debug_eeprom) { + println("EEPROM_Init Compacted Pages:"); + print_eeprom(); + println("EEPROM_Init Write Log:"); + } - // Clear Flags - // FLASH_ClearFlag(FLASH_SR_EOP|FLASH_SR_PGERR|FLASH_SR_WRPERR); + /* Replay write log */ + uint16_t *log_addr; + for (log_addr = (uint16_t *)FEE_WRITE_LOG_BASE_ADDRESS; log_addr < (uint16_t *)FEE_WRITE_LOG_LAST_ADDRESS; ++log_addr) { + uint16_t address = *log_addr; + if (address == FEE_EMPTY_WORD) { + break; + } + /* Check for lowest 128-bytes optimization */ + if (!(address & FEE_WORD_ENCODING)) { + uint8_t bvalue = (uint8_t)address; + address >>= 8; + DataBuf[address] = bvalue; + eeprom_printf("DataBuf[0x%02x] = 0x%02x;\n", address, bvalue); + } else { + uint16_t wvalue; + /* Check if value is in next word */ + if ((address & FEE_VALUE_NEXT) == FEE_VALUE_NEXT) { + /* Read value from next word */ + if (++log_addr >= (uint16_t *)FEE_WRITE_LOG_LAST_ADDRESS) { + break; + } + wvalue = ~*log_addr; + if (!wvalue) { + eeprom_printf("Incomplete write at log_addr: 0x%04x;\n", (uint32_t)log_addr); + /* Possibly incomplete write. Ignore and continue */ + continue; + } + address &= 0x1FFF; + address <<= 1; + /* Writes to addresses less than 128 are byte log entries */ + address += FEE_BYTE_RANGE; + } else { + /* Reserved for future use */ + if (address & FEE_VALUE_RESERVED) { + eeprom_printf("Reserved encoded value at log_addr: 0x%04x;\n", (uint32_t)log_addr); + continue; + } + /* Optimization for 0 or 1 values. */ + wvalue = (address & FEE_VALUE_ENCODED) >> 13; + address &= 0x1FFF; + address <<= 1; + } + if (address < FEE_DENSITY_BYTES) { + eeprom_printf("DataBuf[0x%04x] = 0x%04x;\n", address, wvalue); + *(uint16_t *)(&DataBuf[address]) = wvalue; + } else { + eeprom_printf("DataBuf[0x%04x] cannot be set to 0x%04x [BAD ADDRESS]\n", address, wvalue); + } + } + } + + empty_slot = log_addr; + + if (debug_eeprom) { + println("EEPROM_Init Final DataBuf:"); + print_eeprom(); + } return FEE_DENSITY_BYTES; } -/***************************************************************************** - * Erase the whole reserved Flash Space used for user Data - ******************************************************************************/ -void EEPROM_Erase(void) { - int page_num = 0; - // delete all pages from specified start page to the last page - do { +/* Clear flash contents (doesn't touch in-memory DataBuf) */ +static void eeprom_clear(void) { + FLASH_Unlock(); + + for (uint16_t page_num = 0; page_num < FEE_PAGE_COUNT; ++page_num) { + eeprom_printf("FLASH_ErasePage(0x%04x)\n", (uint32_t)(FEE_PAGE_BASE_ADDRESS + (page_num * FEE_PAGE_SIZE))); FLASH_ErasePage(FEE_PAGE_BASE_ADDRESS + (page_num * FEE_PAGE_SIZE)); - page_num++; - } while (page_num < FEE_DENSITY_PAGES); + } + + FLASH_Lock(); + + empty_slot = (uint16_t *)FEE_WRITE_LOG_BASE_ADDRESS; + eeprom_printf("eeprom_clear empty_slot: 0x%08x\n", (uint32_t)empty_slot); } -/***************************************************************************** - * Writes once data byte to flash on specified address. If a byte is already - * written, the whole page must be copied to a buffer, the byte changed and - * the manipulated buffer written after PageErase. - *******************************************************************************/ -uint16_t EEPROM_WriteDataByte(uint16_t Address, uint8_t DataByte) { - FLASH_Status FlashStatus = FLASH_COMPLETE; - uint32_t page; - int i; +/* Erase emulated eeprom */ +void EEPROM_Erase(void) { + eeprom_println("EEPROM_Erase"); + /* Erase compacted pages and write log */ + eeprom_clear(); + /* re-initialize to reset DataBuf */ + EEPROM_Init(); +} - // exit if desired address is above the limit (e.G. under 2048 Bytes for 4 pages) - if (Address > FEE_DENSITY_BYTES) { - return 0; +/* Compact write log */ +static uint8_t eeprom_compact(void) { + /* Erase compacted pages and write log */ + eeprom_clear(); + + FLASH_Unlock(); + + FLASH_Status final_status = FLASH_COMPLETE; + + /* Write emulated eeprom contents from memory to compacted flash */ + uint16_t *src = (uint16_t *)DataBuf; + uintptr_t dest = FEE_COMPACTED_BASE_ADDRESS; + uint16_t value; + for (; dest < FEE_COMPACTED_LAST_ADDRESS; ++src, dest += 2) { + value = *src; + if (value) { + eeprom_printf("FLASH_ProgramHalfWord(0x%04x, 0x%04x)\n", (uint32_t)dest, ~value); + FLASH_Status status = FLASH_ProgramHalfWord(dest, ~value); + if (status != FLASH_COMPLETE) final_status = status; + } } - // calculate which page is affected (Pagenum1/Pagenum2...PagenumN) - page = FEE_ADDR_OFFSET(Address) / FEE_PAGE_SIZE; + FLASH_Lock(); - // if current data is 0xFF, the byte is empty, just overwrite with the new one - if ((*(__IO uint16_t *)(FEE_PAGE_BASE_ADDRESS + FEE_ADDR_OFFSET(Address))) == FEE_EMPTY_WORD) { - FlashStatus = FLASH_ProgramHalfWord(FEE_PAGE_BASE_ADDRESS + FEE_ADDR_OFFSET(Address), (uint16_t)(0x00FF & DataByte)); + if (debug_eeprom) { + println("eeprom_compacted:"); + print_eeprom(); + } + + return final_status; +} + +static uint8_t eeprom_write_direct_entry(uint16_t Address) { + /* Check if we can just write this directly to the compacted flash area */ + uintptr_t directAddress = FEE_COMPACTED_BASE_ADDRESS + (Address & 0xFFFE); + if (*(uint16_t *)directAddress == FEE_EMPTY_WORD) { + /* Write the value directly to the compacted area without a log entry */ + uint16_t value = ~*(uint16_t *)(&DataBuf[Address & 0xFFFE]); + /* Early exit if a write isn't needed */ + if (value == FEE_EMPTY_WORD) return FLASH_COMPLETE; + + FLASH_Unlock(); + + eeprom_printf("FLASH_ProgramHalfWord(0x%08x, 0x%04x) [DIRECT]\n", (uint32_t)directAddress, value); + FLASH_Status status = FLASH_ProgramHalfWord(directAddress, value); + + FLASH_Lock(); + return status; + } + return 0; +} + +static uint8_t eeprom_write_log_word_entry(uint16_t Address) { + FLASH_Status final_status = FLASH_COMPLETE; + + uint16_t value = *(uint16_t *)(&DataBuf[Address]); + eeprom_printf("eeprom_write_log_word_entry(0x%04x): 0x%04x\n", Address, value); + + /* MSB signifies the lowest 128-byte optimization is not in effect */ + uint16_t encoding = FEE_WORD_ENCODING; + uint8_t entry_size; + if (value <= 1) { + encoding |= value << 13; + entry_size = 2; } else { - // Copy Page to a buffer - memcpy(DataBuf, (uint8_t *)FEE_PAGE_BASE_ADDRESS + (page * FEE_PAGE_SIZE), FEE_PAGE_SIZE); // !!! Calculate base address for the desired page + encoding |= FEE_VALUE_NEXT; + entry_size = 4; + /* Writes to addresses less than 128 are byte log entries */ + Address -= FEE_BYTE_RANGE; + } + + /* if we can't find an empty spot, we must compact emulated eeprom */ + if (empty_slot > (uint16_t *)(FEE_WRITE_LOG_LAST_ADDRESS - entry_size)) { + /* compact the write log into the compacted flash area */ + return eeprom_compact(); + } + + /* Word log writes should be word-aligned. Take back a bit */ + Address >>= 1; + Address |= encoding; + + /* ok we found a place let's write our data */ + FLASH_Unlock(); + + /* address */ + eeprom_printf("FLASH_ProgramHalfWord(0x%08x, 0x%04x)\n", (uint32_t)empty_slot, Address); + final_status = FLASH_ProgramHalfWord((uintptr_t)empty_slot++, Address); + + /* value */ + if (encoding == (FEE_WORD_ENCODING | FEE_VALUE_NEXT)) { + eeprom_printf("FLASH_ProgramHalfWord(0x%08x, 0x%04x)\n", (uint32_t)empty_slot, ~value); + FLASH_Status status = FLASH_ProgramHalfWord((uintptr_t)empty_slot++, ~value); + if (status != FLASH_COMPLETE) final_status = status; + } + + FLASH_Lock(); + + return final_status; +} + +static uint8_t eeprom_write_log_byte_entry(uint16_t Address) { + eeprom_printf("eeprom_write_log_byte_entry(0x%04x): 0x%02x\n", Address, DataBuf[Address]); + + /* if couldn't find an empty spot, we must compact emulated eeprom */ + if (empty_slot >= (uint16_t *)FEE_WRITE_LOG_LAST_ADDRESS) { + /* compact the write log into the compacted flash area */ + return eeprom_compact(); + } + + /* ok we found a place let's write our data */ + FLASH_Unlock(); + + /* Pack address and value into the same word */ + uint16_t value = (Address << 8) | DataBuf[Address]; + + /* write to flash */ + eeprom_printf("FLASH_ProgramHalfWord(0x%08x, 0x%04x)\n", (uint32_t)empty_slot, value); + FLASH_Status status = FLASH_ProgramHalfWord((uintptr_t)empty_slot++, value); + + FLASH_Lock(); + + return status; +} + +uint8_t EEPROM_WriteDataByte(uint16_t Address, uint8_t DataByte) { + /* if the address is out-of-bounds, do nothing */ + if (Address >= FEE_DENSITY_BYTES) { + eeprom_printf("EEPROM_WriteDataByte(0x%04x, 0x%02x) [BAD ADDRESS]\n", Address, DataByte); + return FLASH_BAD_ADDRESS; + } + + /* if the value is the same, don't bother writing it */ + if (DataBuf[Address] == DataByte) { + eeprom_printf("EEPROM_WriteDataByte(0x%04x, 0x%02x) [SKIP SAME]\n", Address, DataByte); + return 0; + } + + /* keep DataBuf cache in sync */ + DataBuf[Address] = DataByte; + eeprom_printf("EEPROM_WriteDataByte DataBuf[0x%04x] = 0x%02x\n", Address, DataBuf[Address]); + + /* perform the write into flash memory */ + /* First, attempt to write directly into the compacted flash area */ + FLASH_Status status = eeprom_write_direct_entry(Address); + if (!status) { + /* Otherwise append to the write log */ + if (Address < FEE_BYTE_RANGE) { + status = eeprom_write_log_byte_entry(Address); + } else { + status = eeprom_write_log_word_entry(Address & 0xFFFE); + } + } + if (status != 0 && status != FLASH_COMPLETE) { + eeprom_printf("EEPROM_WriteDataByte [STATUS == %d]\n", status); + } + return status; +} + +uint8_t EEPROM_WriteDataWord(uint16_t Address, uint16_t DataWord) { + /* if the address is out-of-bounds, do nothing */ + if (Address >= FEE_DENSITY_BYTES) { + eeprom_printf("EEPROM_WriteDataWord(0x%04x, 0x%04x) [BAD ADDRESS]\n", Address, DataWord); + return FLASH_BAD_ADDRESS; + } - // check if new data is differ to current data, return if not, proceed if yes - if (DataByte == *(__IO uint8_t *)(FEE_PAGE_BASE_ADDRESS + FEE_ADDR_OFFSET(Address))) { - return 0; + /* Check for word alignment */ + FLASH_Status final_status = FLASH_COMPLETE; + if (Address % 2) { + final_status = EEPROM_WriteDataByte(Address, DataWord); + FLASH_Status status = EEPROM_WriteDataByte(Address + 1, DataWord >> 8); + if (status != FLASH_COMPLETE) final_status = status; + if (final_status != 0 && final_status != FLASH_COMPLETE) { + eeprom_printf("EEPROM_WriteDataWord [STATUS == %d]\n", final_status); } + return final_status; + } - // manipulate desired data byte in temp data array if new byte is differ to the current - DataBuf[FEE_ADDR_OFFSET(Address) % FEE_PAGE_SIZE] = DataByte; + /* if the value is the same, don't bother writing it */ + uint16_t oldValue = *(uint16_t *)(&DataBuf[Address]); + if (oldValue == DataWord) { + eeprom_printf("EEPROM_WriteDataWord(0x%04x, 0x%04x) [SKIP SAME]\n", Address, DataWord); + return 0; + } - // Erase Page - FlashStatus = FLASH_ErasePage(FEE_PAGE_BASE_ADDRESS + (page * FEE_PAGE_SIZE)); + /* keep DataBuf cache in sync */ + *(uint16_t *)(&DataBuf[Address]) = DataWord; + eeprom_printf("EEPROM_WriteDataWord DataBuf[0x%04x] = 0x%04x\n", Address, *(uint16_t *)(&DataBuf[Address])); - // Write new data (whole page) to flash if data has been changed - for (i = 0; i < (FEE_PAGE_SIZE / 2); i++) { - if ((__IO uint16_t)(0xFF00 | DataBuf[FEE_ADDR_OFFSET(i)]) != 0xFFFF) { - FlashStatus = FLASH_ProgramHalfWord((FEE_PAGE_BASE_ADDRESS + (page * FEE_PAGE_SIZE)) + (i * 2), (uint16_t)(0xFF00 | DataBuf[FEE_ADDR_OFFSET(i)])); + /* perform the write into flash memory */ + /* First, attempt to write directly into the compacted flash area */ + final_status = eeprom_write_direct_entry(Address); + if (!final_status) { + /* Otherwise append to the write log */ + /* Check if we need to fall back to byte write */ + if (Address < FEE_BYTE_RANGE) { + final_status = FLASH_COMPLETE; + /* Only write a byte if it has changed */ + if ((uint8_t)oldValue != (uint8_t)DataWord) { + final_status = eeprom_write_log_byte_entry(Address); } + FLASH_Status status = FLASH_COMPLETE; + /* Only write a byte if it has changed */ + if ((oldValue >> 8) != (DataWord >> 8)) { + status = eeprom_write_log_byte_entry(Address + 1); + } + if (status != FLASH_COMPLETE) final_status = status; + } else { + final_status = eeprom_write_log_word_entry(Address); } } - return FlashStatus; + if (final_status != 0 && final_status != FLASH_COMPLETE) { + eeprom_printf("EEPROM_WriteDataWord [STATUS == %d]\n", final_status); + } + return final_status; } -/***************************************************************************** - * Read once data byte from a specified address. - *******************************************************************************/ + uint8_t EEPROM_ReadDataByte(uint16_t Address) { uint8_t DataByte = 0xFF; - // Get Byte from specified address - DataByte = (*(__IO uint8_t *)(FEE_PAGE_BASE_ADDRESS + FEE_ADDR_OFFSET(Address))); + if (Address < FEE_DENSITY_BYTES) { + DataByte = DataBuf[Address]; + } + + eeprom_printf("EEPROM_ReadDataByte(0x%04x): 0x%02x\n", Address, DataByte); return DataByte; } +uint16_t EEPROM_ReadDataWord(uint16_t Address) { + uint16_t DataWord = 0xFFFF; + + if (Address < FEE_DENSITY_BYTES - 1) { + /* Check word alignment */ + if (Address % 2) { + DataWord = DataBuf[Address] | (DataBuf[Address + 1] << 8); + } else { + DataWord = *(uint16_t *)(&DataBuf[Address]); + } + } + + eeprom_printf("EEPROM_ReadDataWord(0x%04x): 0x%04x\n", Address, DataWord); + + return DataWord; +} + /***************************************************************************** * Wrap library in AVR style functions. *******************************************************************************/ -uint8_t eeprom_read_byte(const uint8_t *Address) { - const uint16_t p = (const uint32_t)Address; - return EEPROM_ReadDataByte(p); -} +uint8_t eeprom_read_byte(const uint8_t *Address) { return EEPROM_ReadDataByte((const uintptr_t)Address); } -void eeprom_write_byte(uint8_t *Address, uint8_t Value) { - uint16_t p = (uint32_t)Address; - EEPROM_WriteDataByte(p, Value); -} +void eeprom_write_byte(uint8_t *Address, uint8_t Value) { EEPROM_WriteDataByte((uintptr_t)Address, Value); } -void eeprom_update_byte(uint8_t *Address, uint8_t Value) { - uint16_t p = (uint32_t)Address; - EEPROM_WriteDataByte(p, Value); -} +void eeprom_update_byte(uint8_t *Address, uint8_t Value) { EEPROM_WriteDataByte((uintptr_t)Address, Value); } -uint16_t eeprom_read_word(const uint16_t *Address) { - const uint16_t p = (const uint32_t)Address; - return EEPROM_ReadDataByte(p) | (EEPROM_ReadDataByte(p + 1) << 8); -} +uint16_t eeprom_read_word(const uint16_t *Address) { return EEPROM_ReadDataWord((const uintptr_t)Address); } -void eeprom_write_word(uint16_t *Address, uint16_t Value) { - uint16_t p = (uint32_t)Address; - EEPROM_WriteDataByte(p, (uint8_t)Value); - EEPROM_WriteDataByte(p + 1, (uint8_t)(Value >> 8)); -} +void eeprom_write_word(uint16_t *Address, uint16_t Value) { EEPROM_WriteDataWord((uintptr_t)Address, Value); } -void eeprom_update_word(uint16_t *Address, uint16_t Value) { - uint16_t p = (uint32_t)Address; - EEPROM_WriteDataByte(p, (uint8_t)Value); - EEPROM_WriteDataByte(p + 1, (uint8_t)(Value >> 8)); -} +void eeprom_update_word(uint16_t *Address, uint16_t Value) { EEPROM_WriteDataWord((uintptr_t)Address, Value); } uint32_t eeprom_read_dword(const uint32_t *Address) { - const uint16_t p = (const uint32_t)Address; - return EEPROM_ReadDataByte(p) | (EEPROM_ReadDataByte(p + 1) << 8) | (EEPROM_ReadDataByte(p + 2) << 16) | (EEPROM_ReadDataByte(p + 3) << 24); + const uint16_t p = (const uintptr_t)Address; + /* Check word alignment */ + if (p % 2) { + /* Not aligned */ + return (uint32_t)EEPROM_ReadDataByte(p) | (uint32_t)(EEPROM_ReadDataWord(p + 1) << 8) | (uint32_t)(EEPROM_ReadDataByte(p + 3) << 24); + } else { + /* Aligned */ + return EEPROM_ReadDataWord(p) | (EEPROM_ReadDataWord(p + 2) << 16); + } } void eeprom_write_dword(uint32_t *Address, uint32_t Value) { - uint16_t p = (const uint32_t)Address; - EEPROM_WriteDataByte(p, (uint8_t)Value); - EEPROM_WriteDataByte(p + 1, (uint8_t)(Value >> 8)); - EEPROM_WriteDataByte(p + 2, (uint8_t)(Value >> 16)); - EEPROM_WriteDataByte(p + 3, (uint8_t)(Value >> 24)); -} - -void eeprom_update_dword(uint32_t *Address, uint32_t Value) { - uint16_t p = (const uint32_t)Address; - uint32_t existingValue = EEPROM_ReadDataByte(p) | (EEPROM_ReadDataByte(p + 1) << 8) | (EEPROM_ReadDataByte(p + 2) << 16) | (EEPROM_ReadDataByte(p + 3) << 24); - if (Value != existingValue) { + uint16_t p = (const uintptr_t)Address; + /* Check word alignment */ + if (p % 2) { + /* Not aligned */ EEPROM_WriteDataByte(p, (uint8_t)Value); - EEPROM_WriteDataByte(p + 1, (uint8_t)(Value >> 8)); - EEPROM_WriteDataByte(p + 2, (uint8_t)(Value >> 16)); + EEPROM_WriteDataWord(p + 1, (uint16_t)(Value >> 8)); EEPROM_WriteDataByte(p + 3, (uint8_t)(Value >> 24)); + } else { + /* Aligned */ + EEPROM_WriteDataWord(p, (uint16_t)Value); + EEPROM_WriteDataWord(p + 2, (uint16_t)(Value >> 16)); } } +void eeprom_update_dword(uint32_t *Address, uint32_t Value) { eeprom_write_dword(Address, Value); } + void eeprom_read_block(void *buf, const void *addr, size_t len) { - const uint8_t *p = (const uint8_t *)addr; + const uint8_t *src = (const uint8_t *)addr; uint8_t * dest = (uint8_t *)buf; - while (len--) { - *dest++ = eeprom_read_byte(p++); + + /* Check word alignment */ + if (len && (uintptr_t)src % 2) { + /* Read the unaligned first byte */ + *dest++ = eeprom_read_byte(src++); + --len; + } + + uint16_t value; + bool aligned = ((uintptr_t)dest % 2 == 0); + while (len > 1) { + value = eeprom_read_word((uint16_t *)src); + if (aligned) { + *(uint16_t *)dest = value; + dest += 2; + } else { + *dest++ = value; + *dest++ = value >> 8; + } + src += 2; + len -= 2; + } + if (len) { + *dest = eeprom_read_byte(src); } } void eeprom_write_block(const void *buf, void *addr, size_t len) { - uint8_t * p = (uint8_t *)addr; - const uint8_t *src = (const uint8_t *)buf; - while (len--) { - eeprom_write_byte(p++, *src++); + uint8_t * dest = (uint8_t *)addr; + const uint8_t *src = (const uint8_t *)buf; + + /* Check word alignment */ + if (len && (uintptr_t)dest % 2) { + /* Write the unaligned first byte */ + eeprom_write_byte(dest++, *src++); + --len; } -} -void eeprom_update_block(const void *buf, void *addr, size_t len) { - uint8_t * p = (uint8_t *)addr; - const uint8_t *src = (const uint8_t *)buf; - while (len--) { - eeprom_write_byte(p++, *src++); + uint16_t value; + bool aligned = ((uintptr_t)src % 2 == 0); + while (len > 1) { + if (aligned) { + value = *(uint16_t *)src; + } else { + value = *(uint8_t *)src | (*(uint8_t *)(src + 1) << 8); + } + eeprom_write_word((uint16_t *)dest, value); + dest += 2; + src += 2; + len -= 2; + } + + if (len) { + eeprom_write_byte(dest, *src); } } + +void eeprom_update_block(const void *buf, void *addr, size_t len) { eeprom_write_block(buf, addr, len); } diff --git a/tmk_core/common/chibios/eeprom_stm32.h b/tmk_core/common/chibios/eeprom_stm32.h index 4dac7c1b59..8fcfb556b8 100644 --- a/tmk_core/common/chibios/eeprom_stm32.h +++ b/tmk_core/common/chibios/eeprom_stm32.h @@ -23,62 +23,11 @@ #pragma once -#include <ch.h> -#include <hal.h> -#include "flash_stm32.h" - -// HACK ALERT. This definition may not match your processor -// To Do. Work out correct value for EEPROM_PAGE_SIZE on the STM32F103CT6 etc -#if defined(EEPROM_EMU_STM32F303xC) -# define MCU_STM32F303CC -#elif defined(EEPROM_EMU_STM32F103xB) -# define MCU_STM32F103RB -#elif defined(EEPROM_EMU_STM32F072xB) -# define MCU_STM32F072CB -#elif defined(EEPROM_EMU_STM32F042x6) -# define MCU_STM32F042K6 -#else -# error "not implemented." -#endif - -#ifndef EEPROM_PAGE_SIZE -# if defined(MCU_STM32F103RB) || defined(MCU_STM32F042K6) -# define FEE_PAGE_SIZE (uint16_t)0x400 // Page size = 1KByte -# define FEE_DENSITY_PAGES 2 // How many pages are used -# elif defined(MCU_STM32F103ZE) || defined(MCU_STM32F103RE) || defined(MCU_STM32F103RD) || defined(MCU_STM32F303CC) || defined(MCU_STM32F072CB) -# define FEE_PAGE_SIZE (uint16_t)0x800 // Page size = 2KByte -# define FEE_DENSITY_PAGES 4 // How many pages are used -# else -# error "No MCU type specified. Add something like -DMCU_STM32F103RB to your compiler arguments (probably in a Makefile)." -# endif -#endif - -#ifndef EEPROM_START_ADDRESS -# if defined(MCU_STM32F103RB) || defined(MCU_STM32F072CB) -# define FEE_MCU_FLASH_SIZE 128 // Size in Kb -# elif defined(MCU_STM32F042K6) -# define FEE_MCU_FLASH_SIZE 32 // Size in Kb -# elif defined(MCU_STM32F103ZE) || defined(MCU_STM32F103RE) -# define FEE_MCU_FLASH_SIZE 512 // Size in Kb -# elif defined(MCU_STM32F103RD) -# define FEE_MCU_FLASH_SIZE 384 // Size in Kb -# elif defined(MCU_STM32F303CC) -# define FEE_MCU_FLASH_SIZE 256 // Size in Kb -# else -# error "No MCU type specified. Add something like -DMCU_STM32F103RB to your compiler arguments (probably in a Makefile)." -# endif -#endif - -// DONT CHANGE -// Choose location for the first EEPROM Page address on the top of flash -#define FEE_PAGE_BASE_ADDRESS ((uint32_t)(0x8000000 + FEE_MCU_FLASH_SIZE * 1024 - FEE_DENSITY_PAGES * FEE_PAGE_SIZE)) -#define FEE_DENSITY_BYTES ((FEE_PAGE_SIZE / 2) * FEE_DENSITY_PAGES - 1) -#define FEE_LAST_PAGE_ADDRESS (FEE_PAGE_BASE_ADDRESS + (FEE_PAGE_SIZE * FEE_DENSITY_PAGES)) -#define FEE_EMPTY_WORD ((uint16_t)0xFFFF) -#define FEE_ADDR_OFFSET(Address) (Address * 2) // 1Byte per Word will be saved to preserve Flash - -// Use this function to initialize the functionality uint16_t EEPROM_Init(void); void EEPROM_Erase(void); -uint16_t EEPROM_WriteDataByte(uint16_t Address, uint8_t DataByte); +uint8_t EEPROM_WriteDataByte(uint16_t Address, uint8_t DataByte); +uint8_t EEPROM_WriteDataWord(uint16_t Address, uint16_t DataWord); uint8_t EEPROM_ReadDataByte(uint16_t Address); +uint16_t EEPROM_ReadDataWord(uint16_t Address); + +void print_eeprom(void); diff --git a/tmk_core/common/chibios/eeprom_stm32_defs.h b/tmk_core/common/chibios/eeprom_stm32_defs.h new file mode 100644 index 0000000000..22b4ab858e --- /dev/null +++ b/tmk_core/common/chibios/eeprom_stm32_defs.h @@ -0,0 +1,61 @@ +/* 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 + +#include <hal.h> + +#if !defined(FEE_PAGE_SIZE) || !defined(FEE_PAGE_COUNT) +# if defined(STM32F103xB) || defined(STM32F042x6) +# ifndef FEE_PAGE_SIZE +# define FEE_PAGE_SIZE 0x400 // Page size = 1KByte +# endif +# ifndef FEE_PAGE_COUNT +# define FEE_PAGE_COUNT 2 // How many pages are used +# endif +# elif defined(STM32F103xE) || defined(STM32F303xC) || defined(STM32F072xB) || defined(STM32F070xB) +# ifndef FEE_PAGE_SIZE +# define FEE_PAGE_SIZE 0x800 // Page size = 2KByte +# endif +# ifndef FEE_PAGE_COUNT +# define FEE_PAGE_COUNT 4 // How many pages are used +# endif +# endif +#endif + +#if !defined(FEE_MCU_FLASH_SIZE) +# if defined(STM32F042x6) +# define FEE_MCU_FLASH_SIZE 32 // Size in Kb +# elif defined(STM32F103xB) || defined(STM32F072xB) || defined(STM32F070xB) +# define FEE_MCU_FLASH_SIZE 128 // Size in Kb +# elif defined(STM32F303xC) +# define FEE_MCU_FLASH_SIZE 256 // Size in Kb +# elif defined(STM32F103xE) +# define FEE_MCU_FLASH_SIZE 512 // Size in Kb +# endif +#endif + +/* Start of the emulated eeprom */ +#if !defined(FEE_PAGE_BASE_ADDRESS) +# if 0 +/* TODO: Add support for F4 */ +# else +# ifndef FEE_FLASH_BASE +# define FEE_FLASH_BASE 0x8000000 +# endif +/* Default to end of flash */ +# define FEE_PAGE_BASE_ADDRESS ((uintptr_t)(FEE_FLASH_BASE) + FEE_MCU_FLASH_SIZE * 1024 - (FEE_PAGE_COUNT * FEE_PAGE_SIZE)) +# endif +#endif diff --git a/tmk_core/common/chibios/flash_stm32.c b/tmk_core/common/chibios/flash_stm32.c index e8b3dc4bc9..6b80ff71c3 100644 --- a/tmk_core/common/chibios/flash_stm32.c +++ b/tmk_core/common/chibios/flash_stm32.c @@ -16,22 +16,7 @@ * Modifications for QMK and STM32F303 by Yiancar */ -#if defined(EEPROM_EMU_STM32F303xC) -# define STM32F303xC -# include "stm32f3xx.h" -#elif defined(EEPROM_EMU_STM32F103xB) -# define STM32F103xB -# include "stm32f1xx.h" -#elif defined(EEPROM_EMU_STM32F072xB) -# define STM32F072xB -# include "stm32f0xx.h" -#elif defined(EEPROM_EMU_STM32F042x6) -# define STM32F042x6 -# include "stm32f0xx.h" -#else -# error "not implemented." -#endif - +#include <hal.h> #include "flash_stm32.h" #if defined(EEPROM_EMU_STM32F103xB) @@ -161,9 +146,11 @@ FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data) { * @retval None */ void FLASH_Unlock(void) { - /* Authorize the FPEC Access */ - FLASH->KEYR = FLASH_KEY1; - FLASH->KEYR = FLASH_KEY2; + if (FLASH->CR & FLASH_CR_LOCK) { + /* Authorize the FPEC Access */ + FLASH->KEYR = FLASH_KEY1; + FLASH->KEYR = FLASH_KEY2; + } } /** @@ -175,17 +162,3 @@ void FLASH_Lock(void) { /* Set the Lock Bit to lock the FPEC and the FCR */ FLASH->CR |= FLASH_CR_LOCK; } - -/** - * @brief Clears the FLASH's pending flags. - * @param FLASH_FLAG: specifies the FLASH flags to clear. - * This parameter can be any combination of the following values: - * @arg FLASH_FLAG_PGERR: FLASH Programming error flag flag - * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag - * @arg FLASH_FLAG_EOP: FLASH End of Programming flag - * @retval None - */ -void FLASH_ClearFlag(uint32_t FLASH_FLAG) { - /* Clear the flags */ - FLASH->SR = FLASH_FLAG; -} diff --git a/tmk_core/common/chibios/flash_stm32.h b/tmk_core/common/chibios/flash_stm32.h index 90d5bff47e..6c66642ec5 100644 --- a/tmk_core/common/chibios/flash_stm32.h +++ b/tmk_core/common/chibios/flash_stm32.h @@ -22,8 +22,11 @@ extern "C" { #endif -#include <ch.h> -#include <hal.h> +#include <stdint.h> + +#ifdef FLASH_STM32_MOCKED +extern uint8_t FlashBuf[MOCK_FLASH_SIZE]; +#endif typedef enum { FLASH_BUSY = 1, FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_ERROR_OPT, FLASH_COMPLETE, FLASH_TIMEOUT, FLASH_BAD_ADDRESS } FLASH_Status; @@ -35,7 +38,6 @@ FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data); void FLASH_Unlock(void); void FLASH_Lock(void); -void FLASH_ClearFlag(uint32_t FLASH_FLAG); #ifdef __cplusplus } diff --git a/tmk_core/common/chibios/gpio.h b/tmk_core/common/chibios/gpio.h index 5d0e142abc..4d057f1cab 100644 --- a/tmk_core/common/chibios/gpio.h +++ b/tmk_core/common/chibios/gpio.h @@ -20,6 +20,8 @@ typedef ioline_t pin_t; +/* Operation of GPIO by pin. */ + #define setPinInput(pin) palSetLineMode(pin, PAL_MODE_INPUT) #define setPinInputHigh(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLUP) #define setPinInputLow(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLDOWN) @@ -32,3 +34,17 @@ typedef ioline_t pin_t; #define readPin(pin) palReadLine(pin) #define togglePin(pin) palToggleLine(pin) + +/* Operation of GPIO by port. */ + +typedef uint16_t port_data_t; + +#define readPort(pin) palReadPort(PAL_PORT(pin)) + +#define setPortBitInput(pin, bit) palSetPadMode(PAL_PORT(pin), bit, PAL_MODE_INPUT) +#define setPortBitInputHigh(pin, bit) palSetPadMode(PAL_PORT(pin), bit, PAL_MODE_INPUT_PULLUP) +#define setPortBitInputLow(pin, bit) palSetPadMode(PAL_PORT(pin), bit, PAL_MODE_INPUT_PULLDOWN) +#define setPortBitOutput(pin, bit) palSetPadMode(PAL_PORT(pin), bit, PAL_MODE_OUTPUT_PUSHPULL) + +#define writePortBitLow(pin, bit) palClearLine(PAL_LINE(PAL_PORT(pin), bit)) +#define writePortBitHigh(pin, bit) palSetLine(PAL_LINE(PAL_PORT(pin), bit)) diff --git a/tmk_core/common/chibios/platform.c b/tmk_core/common/chibios/platform.c new file mode 100644 index 0000000000..d4a229f278 --- /dev/null +++ b/tmk_core/common/chibios/platform.c @@ -0,0 +1,22 @@ +/* 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 "platform_deps.h" + +void platform_setup(void) { + halInit(); + chSysInit(); +}
\ No newline at end of file diff --git a/tmk_core/common/chibios/platform_deps.h b/tmk_core/common/chibios/platform_deps.h new file mode 100644 index 0000000000..8243dcec53 --- /dev/null +++ b/tmk_core/common/chibios/platform_deps.h @@ -0,0 +1,19 @@ +/* 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 + +#include <hal.h> +#include "chibios_config.h" diff --git a/tmk_core/common/chibios/wait.c b/tmk_core/common/chibios/wait.c index c6270fd95e..56fd6ffcec 100644 --- a/tmk_core/common/chibios/wait.c +++ b/tmk_core/common/chibios/wait.c @@ -14,76 +14,28 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __OPTIMIZE__ -# pragma message "Compiler optimizations disabled; wait_cpuclock() won't work as designed" -#endif +#include <ch.h> +#include <hal.h> -#define CLOCK_DELAY_NOP8 "nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t" +#include "_wait.h" -__attribute__((always_inline)) static inline void wait_cpuclock(unsigned int n) { /* n: 1..135 */ - /* The argument n must be a constant expression. - * That way, compiler optimization will remove unnecessary code. */ - if (n < 1) { - return; - } - if (n > 8) { - unsigned int n8 = n / 8; - n = n - n8 * 8; - switch (n8) { - case 16: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 15: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 14: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 13: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 12: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 11: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 10: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 9: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 8: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 7: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 6: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 5: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 4: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 3: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 2: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 1: - asm volatile(CLOCK_DELAY_NOP8::: "memory"); - case 0: - break; - } +#ifdef WAIT_US_TIMER +void wait_us(uint16_t duration) { + static const GPTConfig gpt_cfg = {1000000, NULL, 0, 0}; /* 1MHz timer, no callback */ + + if (duration == 0) { + duration = 1; } - switch (n) { - case 8: - asm volatile("nop" ::: "memory"); - case 7: - asm volatile("nop" ::: "memory"); - case 6: - asm volatile("nop" ::: "memory"); - case 5: - asm volatile("nop" ::: "memory"); - case 4: - asm volatile("nop" ::: "memory"); - case 3: - asm volatile("nop" ::: "memory"); - case 2: - asm volatile("nop" ::: "memory"); - case 1: - asm volatile("nop" ::: "memory"); - case 0: - break; + + /* + * 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))) { + gptStart(&WAIT_US_TIMER, &gpt_cfg); + gptPolledDelay(&WAIT_US_TIMER, duration); + } else { + chThdSleepMicroseconds(duration); } -}
\ No newline at end of file +} +#endif diff --git a/tmk_core/common/host.c b/tmk_core/common/host.c index e7d92cfac6..f0c396b189 100644 --- a/tmk_core/common/host.c +++ b/tmk_core/common/host.c @@ -17,10 +17,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <stdint.h> //#include <avr/interrupt.h> +#include "keyboard.h" #include "keycode.h" #include "host.h" #include "util.h" #include "debug.h" +#include "digitizer.h" #ifdef NKRO_ENABLE # include "keycode_config.h" @@ -35,15 +37,20 @@ void host_set_driver(host_driver_t *d) { driver = d; } host_driver_t *host_get_driver(void) { return driver; } +#ifdef SPLIT_KEYBOARD +uint8_t split_led_state = 0; +void set_split_host_keyboard_leds(uint8_t led_state) { split_led_state = led_state; } +#endif + uint8_t host_keyboard_leds(void) { +#ifdef SPLIT_KEYBOARD + if (!is_keyboard_master()) return split_led_state; +#endif if (!driver) return 0; return (*driver->keyboard_leds)(); } -led_t host_keyboard_led_state(void) { - if (!driver) return (led_t){0}; - return (led_t)((*driver->keyboard_leds)()); -} +led_t host_keyboard_led_state(void) { return (led_t)host_keyboard_leds(); } /* send report */ void host_keyboard_send(report_keyboard_t *report) { @@ -97,6 +104,24 @@ void host_consumer_send(uint16_t report) { (*driver->send_consumer)(report); } +void host_digitizer_send(digitizer_t *digitizer) { + if (!driver) return; + + report_digitizer_t report = { +#ifdef DIGITIZER_SHARED_EP + .report_id = REPORT_ID_DIGITIZER, +#endif + .tip = digitizer->tipswitch & 0x1, + .inrange = digitizer->inrange & 0x1, + .x = (uint16_t)(digitizer->x * 0x7FFF), + .y = (uint16_t)(digitizer->y * 0x7FFF), + }; + + send_digitizer(&report); +} + +__attribute__((weak)) void send_digitizer(report_digitizer_t *report) {} + uint16_t host_last_system_report(void) { return last_system_report; } uint16_t host_last_consumer_report(void) { return last_consumer_report; } diff --git a/tmk_core/common/host_driver.h b/tmk_core/common/host_driver.h index f34a220530..2aebca043d 100644 --- a/tmk_core/common/host_driver.h +++ b/tmk_core/common/host_driver.h @@ -30,3 +30,5 @@ typedef struct { void (*send_system)(uint16_t); void (*send_consumer)(uint16_t); } host_driver_t; + +void send_digitizer(report_digitizer_t *report);
\ No newline at end of file diff --git a/tmk_core/common/lib_printf.mk b/tmk_core/common/lib_printf.mk deleted file mode 100644 index 10d2d8468d..0000000000 --- a/tmk_core/common/lib_printf.mk +++ /dev/null @@ -1,9 +0,0 @@ -PRINTF_PATH = $(LIB_PATH)/printf - -TMK_COMMON_SRC += $(PRINTF_PATH)/printf.c -TMK_COMMON_SRC += $(COMMON_DIR)/printf.c -TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_FLOAT -TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_EXPONENTIAL -TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_LONG_LONG -TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_PTRDIFF_T -VPATH += $(PRINTF_PATH) diff --git a/tmk_core/common/progmem.h b/tmk_core/common/progmem.h index 4e4771e523..a70d8e299f 100644 --- a/tmk_core/common/progmem.h +++ b/tmk_core/common/progmem.h @@ -3,7 +3,9 @@ #if defined(__AVR__) # include <avr/pgmspace.h> #else +# include <string.h> # define PROGMEM +# define __flash # define PSTR(x) x # define PGM_P const char* # define memcpy_P(dest, src, n) memcpy(dest, src, n) diff --git a/tmk_core/common/report.c b/tmk_core/common/report.c index 1bcb6f2adb..2a7fc006c4 100644 --- a/tmk_core/common/report.c +++ b/tmk_core/common/report.c @@ -21,6 +21,16 @@ #include "util.h" #include <string.h> +#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE +# define RO_ADD(a, b) ((a + b) % KEYBOARD_REPORT_KEYS) +# define RO_SUB(a, b) ((a - b + KEYBOARD_REPORT_KEYS) % KEYBOARD_REPORT_KEYS) +# define RO_INC(a) RO_ADD(a, 1) +# define RO_DEC(a) RO_SUB(a, 1) +static int8_t cb_head = 0; +static int8_t cb_tail = 0; +static int8_t cb_count = 0; +#endif + /** \brief has_anykey * * FIXME: Needs doc @@ -54,7 +64,7 @@ uint8_t get_first_key(report_keyboard_t* keyboard_report) { return i << 3 | biton(keyboard_report->nkro.bits[i]); } #endif -#ifdef USB_6KRO_ENABLE +#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE uint8_t i = cb_head; do { if (keyboard_report->keys[i] != 0) { @@ -99,7 +109,7 @@ bool is_key_pressed(report_keyboard_t* keyboard_report, uint8_t key) { * FIXME: Needs doc */ void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) { -#ifdef USB_6KRO_ENABLE +#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE int8_t i = cb_head; int8_t empty = -1; if (cb_count) { @@ -166,7 +176,7 @@ void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code) { * FIXME: Needs doc */ void del_key_byte(report_keyboard_t* keyboard_report, uint8_t code) { -#ifdef USB_6KRO_ENABLE +#ifdef RING_BUFFERED_6KRO_REPORT_ENABLE uint8_t i = cb_head; if (cb_count) { do { diff --git a/tmk_core/common/report.h b/tmk_core/common/report.h index db6370657d..f2223e8063 100644 --- a/tmk_core/common/report.h +++ b/tmk_core/common/report.h @@ -30,7 +30,8 @@ enum hid_report_ids { REPORT_ID_SYSTEM, REPORT_ID_CONSUMER, REPORT_ID_NKRO, - REPORT_ID_JOYSTICK + REPORT_ID_JOYSTICK, + REPORT_ID_DIGITIZER }; /* Mouse buttons */ @@ -206,6 +207,17 @@ typedef struct { } __attribute__((packed)) report_mouse_t; typedef struct { +#ifdef DIGITIZER_SHARED_EP + uint8_t report_id; +#endif + uint8_t tip : 1; + uint8_t inrange : 1; + uint8_t pad2 : 6; + uint16_t x; + uint16_t y; +} __attribute__((packed)) report_digitizer_t; + +typedef struct { #if JOYSTICK_AXES_COUNT > 0 # if JOYSTICK_AXES_RESOLUTION > 8 int16_t axes[JOYSTICK_AXES_COUNT]; diff --git a/tmk_core/common/sendchar_uart.c b/tmk_core/common/sendchar_uart.c deleted file mode 100644 index 2fc48bafff..0000000000 --- a/tmk_core/common/sendchar_uart.c +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2011 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/>. -*/ -#include "uart.h" -#include "sendchar.h" - -int8_t sendchar(uint8_t c) { - uart_putchar(c); - return 0; -} diff --git a/tmk_core/common/sync_timer.c b/tmk_core/common/sync_timer.c index de24b463b6..68b92d8b43 100644 --- a/tmk_core/common/sync_timer.c +++ b/tmk_core/common/sync_timer.c @@ -26,7 +26,7 @@ SOFTWARE. #include "sync_timer.h" #include "keyboard.h" -#if defined(SPLIT_KEYBOARD) && !defined(DISABLE_SYNC_TIMER) +#if (defined(SPLIT_KEYBOARD) || defined(SERIAL_LINK_ENABLE)) && !defined(DISABLE_SYNC_TIMER) volatile int32_t sync_timer_ms; void sync_timer_init(void) { sync_timer_ms = 0; } diff --git a/tmk_core/common/sync_timer.h b/tmk_core/common/sync_timer.h index 9ddef45bb2..744e2b50d5 100644 --- a/tmk_core/common/sync_timer.h +++ b/tmk_core/common/sync_timer.h @@ -32,7 +32,7 @@ SOFTWARE. extern "C" { #endif -#if defined(SPLIT_KEYBOARD) && !defined(DISABLE_SYNC_TIMER) +#if (defined(SPLIT_KEYBOARD) || defined(SERIAL_LINK_ENABLE)) && !defined(DISABLE_SYNC_TIMER) void sync_timer_init(void); void sync_timer_update(uint32_t time); uint16_t sync_timer_read(void); diff --git a/tmk_core/common/test/eeprom_stm32_tests.cpp b/tmk_core/common/test/eeprom_stm32_tests.cpp new file mode 100644 index 0000000000..5bc8d87900 --- /dev/null +++ b/tmk_core/common/test/eeprom_stm32_tests.cpp @@ -0,0 +1,438 @@ +/* Copyright 2021 by Don Kjer + * + * 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" + +extern "C" { +#include "flash_stm32.h" +#include "eeprom_stm32.h" +#include "eeprom.h" +} + +/* Mock Flash Parameters: + * + * === Large Layout === + * flash size: 65536 + * page size: 2048 + * density pages: 16 + * Simulated EEPROM size: 16384 + * + * FlashBuf Layout: + * [Unused | Compact | Write Log ] + * [0......|32768......|49152......65535] + * + * === Tiny Layout === + * flash size: 1024 + * page size: 512 + * density pages: 1 + * Simulated EEPROM size: 256 + * + * FlashBuf Layout: + * [Unused | Compact | Write Log ] + * [0......|512......|768......1023] + * + */ + +#define EEPROM_SIZE (FEE_PAGE_SIZE * FEE_PAGE_COUNT / 2) +#define LOG_SIZE EEPROM_SIZE +#define LOG_BASE (MOCK_FLASH_SIZE - LOG_SIZE) +#define EEPROM_BASE (LOG_BASE - EEPROM_SIZE) + +/* Log encoding helpers */ +#define BYTE_VALUE(addr, value) (((addr) << 8) | (value)) +#define WORD_ZERO(addr) (0x8000 | ((addr) >> 1)) +#define WORD_ONE(addr) (0xA000 | ((addr) >> 1)) +#define WORD_NEXT(addr) (0xE000 | (((addr)-0x80) >> 1)) + +class EepromStm32Test : public testing::Test { + public: + EepromStm32Test() {} + ~EepromStm32Test() {} + + protected: + void SetUp() override { EEPROM_Erase(); } + + void TearDown() override { +#ifdef EEPROM_DEBUG + dumpEepromDataBuf(); +#endif + } +}; + +TEST_F(EepromStm32Test, TestErase) { + EEPROM_WriteDataByte(0, 0x42); + EEPROM_Erase(); + EXPECT_EQ(EEPROM_ReadDataByte(0), 0); + EXPECT_EQ(EEPROM_ReadDataByte(1), 0); +} + +TEST_F(EepromStm32Test, TestReadGarbage) { + uint8_t garbage = 0x3c; + for (int i = 0; i < MOCK_FLASH_SIZE; ++i) { + garbage ^= 0xa3; + garbage += i; + FlashBuf[i] = garbage; + } + EEPROM_Init(); // Just verify we don't crash +} + +TEST_F(EepromStm32Test, TestWriteBadAddress) { + EXPECT_EQ(EEPROM_WriteDataByte(EEPROM_SIZE, 0x42), FLASH_BAD_ADDRESS); + EXPECT_EQ(EEPROM_WriteDataWord(EEPROM_SIZE - 1, 0xbeef), FLASH_BAD_ADDRESS); + EXPECT_EQ(EEPROM_WriteDataWord(EEPROM_SIZE, 0xbeef), FLASH_BAD_ADDRESS); +} + +TEST_F(EepromStm32Test, TestReadBadAddress) { + EXPECT_EQ(EEPROM_ReadDataByte(EEPROM_SIZE), 0xFF); + EXPECT_EQ(EEPROM_ReadDataWord(EEPROM_SIZE - 1), 0xFFFF); + EXPECT_EQ(EEPROM_ReadDataWord(EEPROM_SIZE), 0xFFFF); + EXPECT_EQ(eeprom_read_dword((uint32_t*)(EEPROM_SIZE - 4)), 0); + EXPECT_EQ(eeprom_read_dword((uint32_t*)(EEPROM_SIZE - 3)), 0xFF000000); + EXPECT_EQ(eeprom_read_dword((uint32_t*)EEPROM_SIZE), 0xFFFFFFFF); +} + +TEST_F(EepromStm32Test, TestReadByte) { + /* Direct compacted-area baseline: Address < 0x80 */ + FlashBuf[EEPROM_BASE + 2] = ~0xef; + FlashBuf[EEPROM_BASE + 3] = ~0xbe; + /* Direct compacted-area baseline: Address >= 0x80 */ + FlashBuf[EEPROM_BASE + EEPROM_SIZE - 2] = ~0x78; + FlashBuf[EEPROM_BASE + EEPROM_SIZE - 1] = ~0x56; + /* Check values */ + EEPROM_Init(); + EXPECT_EQ(EEPROM_ReadDataByte(2), 0xef); + EXPECT_EQ(EEPROM_ReadDataByte(3), 0xbe); + EXPECT_EQ(EEPROM_ReadDataByte(EEPROM_SIZE - 2), 0x78); + EXPECT_EQ(EEPROM_ReadDataByte(EEPROM_SIZE - 1), 0x56); + /* Write Log byte value */ + FlashBuf[LOG_BASE] = 0x65; + FlashBuf[LOG_BASE + 1] = 3; + /* Write Log word value */ + *(uint16_t*)&FlashBuf[LOG_BASE + 2] = WORD_NEXT(EEPROM_SIZE - 2); + *(uint16_t*)&FlashBuf[LOG_BASE + 4] = ~0x9abc; + /* Check values */ + EEPROM_Init(); + EXPECT_EQ(EEPROM_ReadDataByte(2), 0xef); + EXPECT_EQ(EEPROM_ReadDataByte(3), 0x65); + EXPECT_EQ(EEPROM_ReadDataByte(EEPROM_SIZE - 2), 0xbc); + EXPECT_EQ(EEPROM_ReadDataByte(EEPROM_SIZE - 1), 0x9a); +} + +TEST_F(EepromStm32Test, TestWriteByte) { + /* Direct compacted-area baseline: Address < 0x80 */ + EEPROM_WriteDataByte(2, 0xef); + EEPROM_WriteDataByte(3, 0xbe); + /* Direct compacted-area baseline: Address >= 0x80 */ + EEPROM_WriteDataByte(EEPROM_SIZE - 2, 0x78); + EEPROM_WriteDataByte(EEPROM_SIZE - 1, 0x56); + /* Check values */ + /* First write in each aligned word should have been direct */ + EXPECT_EQ(FlashBuf[EEPROM_BASE + 2], (uint8_t)~0xef); + EXPECT_EQ(FlashBuf[EEPROM_BASE + EEPROM_SIZE - 2], (uint8_t)~0x78); + + /* Second write per aligned word requires a log entry */ + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE], BYTE_VALUE(3, 0xbe)); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 2], WORD_NEXT(EEPROM_SIZE - 1)); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 4], (uint16_t)~0x5678); +} + +TEST_F(EepromStm32Test, TestByteRoundTrip) { + /* Direct compacted-area: Address < 0x80 */ + EEPROM_WriteDataWord(0, 0xdead); + EEPROM_WriteDataByte(2, 0xef); + EEPROM_WriteDataByte(3, 0xbe); + /* Direct compacted-area: Address >= 0x80 */ + EEPROM_WriteDataByte(EEPROM_SIZE - 2, 0x78); + EEPROM_WriteDataByte(EEPROM_SIZE - 1, 0x56); + /* Check values */ + EEPROM_Init(); + EXPECT_EQ(EEPROM_ReadDataByte(0), 0xad); + EXPECT_EQ(EEPROM_ReadDataByte(1), 0xde); + EXPECT_EQ(EEPROM_ReadDataByte(2), 0xef); + EXPECT_EQ(EEPROM_ReadDataByte(3), 0xbe); + EXPECT_EQ(EEPROM_ReadDataByte(EEPROM_SIZE - 2), 0x78); + EXPECT_EQ(EEPROM_ReadDataByte(EEPROM_SIZE - 1), 0x56); + /* Write log entries */ + EEPROM_WriteDataByte(2, 0x80); + EEPROM_WriteDataByte(EEPROM_SIZE - 2, 0x3c); + /* Check values */ + EEPROM_Init(); + EXPECT_EQ(EEPROM_ReadDataByte(2), 0x80); + EXPECT_EQ(EEPROM_ReadDataByte(3), 0xbe); + EXPECT_EQ(EEPROM_ReadDataByte(EEPROM_SIZE - 2), 0x3c); + EXPECT_EQ(EEPROM_ReadDataByte(EEPROM_SIZE - 1), 0x56); +} + +TEST_F(EepromStm32Test, TestReadWord) { + /* Direct compacted-area baseline: Address < 0x80 */ + FlashBuf[EEPROM_BASE + 0] = ~0xad; + FlashBuf[EEPROM_BASE + 1] = ~0xde; + /* Direct compacted-area baseline: Address >= 0x80 */ + FlashBuf[EEPROM_BASE + 200] = ~0xcd; + FlashBuf[EEPROM_BASE + 201] = ~0xab; + FlashBuf[EEPROM_BASE + EEPROM_SIZE - 4] = ~0x34; + FlashBuf[EEPROM_BASE + EEPROM_SIZE - 3] = ~0x12; + FlashBuf[EEPROM_BASE + EEPROM_SIZE - 2] = ~0x78; + FlashBuf[EEPROM_BASE + EEPROM_SIZE - 1] = ~0x56; + /* Check values */ + EEPROM_Init(); + EXPECT_EQ(EEPROM_ReadDataWord(0), 0xdead); + EXPECT_EQ(EEPROM_ReadDataWord(200), 0xabcd); + EXPECT_EQ(EEPROM_ReadDataWord(EEPROM_SIZE - 4), 0x1234); + EXPECT_EQ(EEPROM_ReadDataWord(EEPROM_SIZE - 2), 0x5678); + /* Write Log word zero-encoded */ + *(uint16_t*)&FlashBuf[LOG_BASE] = WORD_ZERO(200); + /* Write Log word one-encoded */ + *(uint16_t*)&FlashBuf[LOG_BASE + 2] = WORD_ONE(EEPROM_SIZE - 4); + /* Write Log word value */ + *(uint16_t*)&FlashBuf[LOG_BASE + 4] = WORD_NEXT(EEPROM_SIZE - 2); + *(uint16_t*)&FlashBuf[LOG_BASE + 6] = ~0x9abc; + /* Check values */ + EEPROM_Init(); + EXPECT_EQ(EEPROM_ReadDataWord(200), 0); + EXPECT_EQ(EEPROM_ReadDataWord(EEPROM_SIZE - 4), 1); + EXPECT_EQ(EEPROM_ReadDataWord(EEPROM_SIZE - 2), 0x9abc); +} + +TEST_F(EepromStm32Test, TestWriteWord) { + /* Direct compacted-area: Address < 0x80 */ + EEPROM_WriteDataWord(0, 0xdead); // Aligned + EEPROM_WriteDataWord(3, 0xbeef); // Unaligned + /* Direct compacted-area: Address >= 0x80 */ + EEPROM_WriteDataWord(200, 0xabcd); // Aligned + EEPROM_WriteDataWord(203, 0x9876); // Unaligned + EEPROM_WriteDataWord(EEPROM_SIZE - 4, 0x1234); + EEPROM_WriteDataWord(EEPROM_SIZE - 2, 0x5678); + /* Write Log word zero-encoded */ + EEPROM_WriteDataWord(EEPROM_SIZE - 4, 0); + /* Write Log word one-encoded */ + EEPROM_WriteDataWord(EEPROM_SIZE - 2, 1); + /* Write Log word value aligned */ + EEPROM_WriteDataWord(200, 0x4321); // Aligned + /* Write Log word value unaligned */ + EEPROM_WriteDataByte(202, 0x3c); // Set neighboring byte + EEPROM_WriteDataWord(203, 0xcdef); // Unaligned + /* Check values */ + /* Direct compacted-area */ + EXPECT_EQ(*(uint16_t*)&FlashBuf[EEPROM_BASE], (uint16_t)~0xdead); + EXPECT_EQ(*(uint16_t*)&FlashBuf[EEPROM_BASE + 3], (uint16_t)~0xbeef); + EXPECT_EQ(*(uint16_t*)&FlashBuf[EEPROM_BASE + 200], (uint16_t)~0xabcd); + EXPECT_EQ(FlashBuf[EEPROM_BASE + 203], (uint8_t)~0x76); + EXPECT_EQ(FlashBuf[EEPROM_BASE + 204], (uint8_t)~0x98); + EXPECT_EQ(*(uint16_t*)&FlashBuf[EEPROM_BASE + EEPROM_SIZE - 4], (uint16_t)~0x1234); + EXPECT_EQ(*(uint16_t*)&FlashBuf[EEPROM_BASE + EEPROM_SIZE - 2], (uint16_t)~0x5678); + /* Write Log word zero-encoded */ + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE], WORD_ZERO(EEPROM_SIZE - 4)); + /* Write Log word one-encoded */ + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 2], WORD_ONE(EEPROM_SIZE - 2)); + /* Write Log word value aligned */ + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 4], WORD_NEXT(200)); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 6], (uint16_t)~0x4321); + /* Write Log word value unaligned */ + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 8], WORD_NEXT(202)); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 10], (uint16_t)~0x763c); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 12], WORD_NEXT(202)); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 14], (uint16_t)~0xef3c); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 16], WORD_NEXT(204)); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 18], (uint16_t)~0x00cd); +} + +TEST_F(EepromStm32Test, TestWordRoundTrip) { + /* Direct compacted-area: Address < 0x80 */ + EEPROM_WriteDataWord(0, 0xdead); // Aligned + EEPROM_WriteDataWord(3, 0xbeef); // Unaligned + /* Direct compacted-area: Address >= 0x80 */ + EEPROM_WriteDataWord(200, 0xabcd); // Aligned + EEPROM_WriteDataWord(203, 0x9876); // Unaligned + EEPROM_WriteDataWord(EEPROM_SIZE - 4, 0x1234); + EEPROM_WriteDataWord(EEPROM_SIZE - 2, 0x5678); + /* Check values */ + EEPROM_Init(); + EXPECT_EQ(EEPROM_ReadDataWord(0), 0xdead); + EXPECT_EQ(EEPROM_ReadDataWord(3), 0xbeef); + EXPECT_EQ(EEPROM_ReadDataWord(200), 0xabcd); + EXPECT_EQ(EEPROM_ReadDataWord(203), 0x9876); + EXPECT_EQ(EEPROM_ReadDataWord(EEPROM_SIZE - 4), 0x1234); + EXPECT_EQ(EEPROM_ReadDataWord(EEPROM_SIZE - 2), 0x5678); + + /* Write Log word zero-encoded */ + EEPROM_WriteDataWord(EEPROM_SIZE - 4, 0); + /* Write Log word one-encoded */ + EEPROM_WriteDataWord(EEPROM_SIZE - 2, 1); + /* Write Log word value aligned */ + EEPROM_WriteDataWord(200, 0x4321); // Aligned + /* Write Log word value unaligned */ + EEPROM_WriteDataByte(202, 0x3c); // Set neighboring byte + EEPROM_WriteDataWord(203, 0xcdef); // Unaligned + /* Check values */ + EEPROM_Init(); + EXPECT_EQ(EEPROM_ReadDataWord(200), 0x4321); + EXPECT_EQ(EEPROM_ReadDataByte(202), 0x3c); + EXPECT_EQ(EEPROM_ReadDataWord(203), 0xcdef); + EXPECT_EQ(EEPROM_ReadDataWord(EEPROM_SIZE - 4), 0); + EXPECT_EQ(EEPROM_ReadDataWord(EEPROM_SIZE - 2), 1); +} + +TEST_F(EepromStm32Test, TestByteWordBoundary) { + /* Direct compacted-area write */ + EEPROM_WriteDataWord(0x7e, 0xdead); + EEPROM_WriteDataWord(0x80, 0xbeef); + /* Byte log entry */ + EEPROM_WriteDataByte(0x7f, 0x3c); + /* Word log entry */ + EEPROM_WriteDataByte(0x80, 0x18); + /* Check values */ + EEPROM_Init(); + EXPECT_EQ(EEPROM_ReadDataWord(0x7e), 0x3cad); + EXPECT_EQ(EEPROM_ReadDataWord(0x80), 0xbe18); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE], BYTE_VALUE(0x7f, 0x3c)); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 2], WORD_NEXT(0x80)); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 4], (uint16_t)~0xbe18); + /* Byte log entries */ + EEPROM_WriteDataWord(0x7e, 0xcafe); + /* Check values */ + EEPROM_Init(); + EXPECT_EQ(EEPROM_ReadDataWord(0x7e), 0xcafe); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 6], BYTE_VALUE(0x7e, 0xfe)); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 8], BYTE_VALUE(0x7f, 0xca)); + /* Byte and Word log entries */ + EEPROM_WriteDataWord(0x7f, 0xba5e); + /* Check values */ + EEPROM_Init(); + EXPECT_EQ(EEPROM_ReadDataWord(0x7f), 0xba5e); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 10], BYTE_VALUE(0x7f, 0x5e)); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 12], WORD_NEXT(0x80)); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 14], (uint16_t)~0xbeba); + /* Word log entry */ + EEPROM_WriteDataWord(0x80, 0xf00d); + /* Check values */ + EEPROM_Init(); + EXPECT_EQ(EEPROM_ReadDataWord(0x80), 0xf00d); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 16], WORD_NEXT(0x80)); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + 18], (uint16_t)~0xf00d); +} + +TEST_F(EepromStm32Test, TestDWordRoundTrip) { + /* Direct compacted-area: Address < 0x80 */ + eeprom_write_dword((uint32_t*)0, 0xdeadbeef); // Aligned + eeprom_write_dword((uint32_t*)9, 0x12345678); // Unaligned + /* Direct compacted-area: Address >= 0x80 */ + eeprom_write_dword((uint32_t*)200, 0xfacef00d); + eeprom_write_dword((uint32_t*)(EEPROM_SIZE - 4), 0xba5eba11); // Aligned + eeprom_write_dword((uint32_t*)(EEPROM_SIZE - 9), 0xcafed00d); // Unaligned + /* Check direct values */ + EEPROM_Init(); + EXPECT_EQ(eeprom_read_dword((uint32_t*)0), 0xdeadbeef); + EXPECT_EQ(eeprom_read_dword((uint32_t*)9), 0x12345678); + EXPECT_EQ(eeprom_read_dword((uint32_t*)200), 0xfacef00d); + EXPECT_EQ(eeprom_read_dword((uint32_t*)(EEPROM_SIZE - 4)), 0xba5eba11); // Aligned + EXPECT_EQ(eeprom_read_dword((uint32_t*)(EEPROM_SIZE - 9)), 0xcafed00d); // Unaligned + /* Write Log byte encoded */ + eeprom_write_dword((uint32_t*)0, 0xdecafbad); + eeprom_write_dword((uint32_t*)9, 0x87654321); + /* Write Log word encoded */ + eeprom_write_dword((uint32_t*)200, 1); + /* Write Log word value aligned */ + eeprom_write_dword((uint32_t*)(EEPROM_SIZE - 4), 0xdeadc0de); // Aligned + eeprom_write_dword((uint32_t*)(EEPROM_SIZE - 9), 0x6789abcd); // Unaligned + /* Check log values */ + EEPROM_Init(); + EXPECT_EQ(eeprom_read_dword((uint32_t*)0), 0xdecafbad); + EXPECT_EQ(eeprom_read_dword((uint32_t*)9), 0x87654321); + EXPECT_EQ(eeprom_read_dword((uint32_t*)200), 1); + EXPECT_EQ(eeprom_read_dword((uint32_t*)(EEPROM_SIZE - 4)), 0xdeadc0de); // Aligned + EXPECT_EQ(eeprom_read_dword((uint32_t*)(EEPROM_SIZE - 9)), 0x6789abcd); // Unaligned +} + +TEST_F(EepromStm32Test, TestBlockRoundTrip) { + char src0[] = "0123456789abcdef"; + void* src1 = (void*)&src0[1]; + /* Various alignments of src & dst, Address < 0x80 */ + eeprom_write_block(src0, (void*)0, sizeof(src0)); + eeprom_write_block(src0, (void*)21, sizeof(src0)); + eeprom_write_block(src1, (void*)40, sizeof(src0) - 1); + eeprom_write_block(src1, (void*)61, sizeof(src0) - 1); + /* Various alignments of src & dst, Address >= 0x80 */ + eeprom_write_block(src0, (void*)140, sizeof(src0)); + eeprom_write_block(src0, (void*)161, sizeof(src0)); + eeprom_write_block(src1, (void*)180, sizeof(src0) - 1); + eeprom_write_block(src1, (void*)201, sizeof(src0) - 1); + + /* Check values */ + EEPROM_Init(); + + char dstBuf[256] = {0}; + char* dst0a = (char*)dstBuf; + char* dst0b = (char*)&dstBuf[20]; + char* dst1a = (char*)&dstBuf[41]; + char* dst1b = (char*)&dstBuf[61]; + char* dst0c = (char*)&dstBuf[80]; + char* dst0d = (char*)&dstBuf[100]; + char* dst1c = (char*)&dstBuf[121]; + char* dst1d = (char*)&dstBuf[141]; + eeprom_read_block((void*)dst0a, (void*)0, sizeof(src0)); + eeprom_read_block((void*)dst0b, (void*)21, sizeof(src0)); + eeprom_read_block((void*)dst1a, (void*)40, sizeof(src0) - 1); + eeprom_read_block((void*)dst1b, (void*)61, sizeof(src0) - 1); + eeprom_read_block((void*)dst0c, (void*)140, sizeof(src0)); + eeprom_read_block((void*)dst0d, (void*)161, sizeof(src0)); + eeprom_read_block((void*)dst1c, (void*)180, sizeof(src0) - 1); + eeprom_read_block((void*)dst1d, (void*)201, sizeof(src0) - 1); + EXPECT_EQ(strcmp((char*)src0, dst0a), 0); + EXPECT_EQ(strcmp((char*)src0, dst0b), 0); + EXPECT_EQ(strcmp((char*)src0, dst0c), 0); + EXPECT_EQ(strcmp((char*)src0, dst0d), 0); + EXPECT_EQ(strcmp((char*)src1, dst1a), 0); + EXPECT_EQ(strcmp((char*)src1, dst1b), 0); + EXPECT_EQ(strcmp((char*)src1, dst1c), 0); + EXPECT_EQ(strcmp((char*)src1, dst1d), 0); +} + +TEST_F(EepromStm32Test, TestCompaction) { + /* Direct writes */ + eeprom_write_dword((uint32_t*)0, 0xdeadbeef); + eeprom_write_byte((uint8_t*)4, 0x3c); + eeprom_write_word((uint16_t*)6, 0xd00d); + eeprom_write_dword((uint32_t*)150, 0xcafef00d); + eeprom_write_dword((uint32_t*)200, 0x12345678); + /* Fill write log entries */ + uint32_t i; + uint32_t val = 0xd8453c6b; + for (i = 0; i < (LOG_SIZE / (sizeof(uint32_t) * 2)); i++) { + val ^= 0x593ca5b3; + val += i; + eeprom_write_dword((uint32_t*)200, val); + } + /* Check values pre-compaction */ + EEPROM_Init(); + EXPECT_EQ(eeprom_read_dword((uint32_t*)0), 0xdeadbeef); + EXPECT_EQ(eeprom_read_byte((uint8_t*)4), 0x3c); + EXPECT_EQ(eeprom_read_word((uint16_t*)6), 0xd00d); + EXPECT_EQ(eeprom_read_dword((uint32_t*)150), 0xcafef00d); + EXPECT_EQ(eeprom_read_dword((uint32_t*)200), val); + EXPECT_NE(*(uint16_t*)&FlashBuf[LOG_BASE], 0xFFFF); + EXPECT_NE(*(uint16_t*)&FlashBuf[LOG_BASE + LOG_SIZE - 2], 0xFFFF); + /* Run compaction */ + eeprom_write_byte((uint8_t*)4, 0x1f); + EEPROM_Init(); + EXPECT_EQ(eeprom_read_dword((uint32_t*)0), 0xdeadbeef); + EXPECT_EQ(eeprom_read_byte((uint8_t*)4), 0x1f); + EXPECT_EQ(eeprom_read_word((uint16_t*)6), 0xd00d); + EXPECT_EQ(eeprom_read_dword((uint32_t*)150), 0xcafef00d); + EXPECT_EQ(eeprom_read_dword((uint32_t*)200), val); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE], 0xFFFF); + EXPECT_EQ(*(uint16_t*)&FlashBuf[LOG_BASE + LOG_SIZE - 2], 0xFFFF); +} diff --git a/tmk_core/common/test/flash_stm32_mock.c b/tmk_core/common/test/flash_stm32_mock.c new file mode 100644 index 0000000000..222a004bc7 --- /dev/null +++ b/tmk_core/common/test/flash_stm32_mock.c @@ -0,0 +1,49 @@ +/* Copyright 2021 by Don Kjer + * + * 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 <string.h> +#include <stdbool.h> +#include "flash_stm32.h" + +uint8_t FlashBuf[MOCK_FLASH_SIZE] = {0}; + +static bool flash_locked = true; + +FLASH_Status FLASH_ErasePage(uint32_t Page_Address) { + if (flash_locked) return FLASH_ERROR_WRP; + Page_Address -= (uintptr_t)FlashBuf; + Page_Address -= (Page_Address % FEE_PAGE_SIZE); + if (Page_Address >= MOCK_FLASH_SIZE) return FLASH_BAD_ADDRESS; + memset(&FlashBuf[Page_Address], '\xff', FEE_PAGE_SIZE); + return FLASH_COMPLETE; +} + +FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data) { + if (flash_locked) return FLASH_ERROR_WRP; + Address -= (uintptr_t)FlashBuf; + if (Address >= MOCK_FLASH_SIZE) return FLASH_BAD_ADDRESS; + uint16_t oldData = *(uint16_t*)&FlashBuf[Address]; + if (oldData == 0xFFFF || Data == 0) { + *(uint16_t*)&FlashBuf[Address] = Data; + return FLASH_COMPLETE; + } else { + return FLASH_ERROR_PG; + } +} + +FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout) { return FLASH_COMPLETE; } +void FLASH_Unlock(void) { flash_locked = false; } +void FLASH_Lock(void) { flash_locked = true; } diff --git a/tmk_core/common/test/hal.h b/tmk_core/common/test/hal.h new file mode 100644 index 0000000000..2d268ad54c --- /dev/null +++ b/tmk_core/common/test/hal.h @@ -0,0 +1,18 @@ +/* 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 + +// Just here to please eeprom tests diff --git a/tmk_core/common/test/platform.c b/tmk_core/common/test/platform.c new file mode 100644 index 0000000000..8ddceeda8f --- /dev/null +++ b/tmk_core/common/test/platform.c @@ -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 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 "platform_deps.h" + +void platform_setup(void) { + // do nothing +}
\ No newline at end of file diff --git a/tmk_core/common/test/platform.h b/tmk_core/common/test/platform.h new file mode 100644 index 0000000000..f296d1d535 --- /dev/null +++ b/tmk_core/common/test/platform.h @@ -0,0 +1,18 @@ +/* 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 + +// here just to please the build diff --git a/tmk_core/common/test/platform_deps.h b/tmk_core/common/test/platform_deps.h new file mode 100644 index 0000000000..f296d1d535 --- /dev/null +++ b/tmk_core/common/test/platform_deps.h @@ -0,0 +1,18 @@ +/* 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 + +// here just to please the build diff --git a/tmk_core/common/test/rules.mk b/tmk_core/common/test/rules.mk new file mode 100644 index 0000000000..48632a095b --- /dev/null +++ b/tmk_core/common/test/rules.mk @@ -0,0 +1,23 @@ +eeprom_stm32_DEFS := -DFLASH_STM32_MOCKED -DNO_PRINT -DFEE_FLASH_BASE=FlashBuf +eeprom_stm32_tiny_DEFS := $(eeprom_stm32_DEFS) \ + -DFEE_MCU_FLASH_SIZE=1 \ + -DMOCK_FLASH_SIZE=1024 \ + -DFEE_PAGE_SIZE=512 \ + -DFEE_PAGE_COUNT=1 +eeprom_stm32_large_DEFS := $(eeprom_stm32_DEFS) \ + -DFEE_MCU_FLASH_SIZE=64 \ + -DMOCK_FLASH_SIZE=65536 \ + -DFEE_PAGE_SIZE=2048 \ + -DFEE_PAGE_COUNT=16 + +eeprom_stm32_INC := \ + $(TMK_PATH)/common/chibios/ +eeprom_stm32_tiny_INC := $(eeprom_stm32_INC) +eeprom_stm32_large_INC := $(eeprom_stm32_INC) + +eeprom_stm32_SRC := \ + $(TMK_PATH)/common/test/eeprom_stm32_tests.cpp \ + $(TMK_PATH)/common/test/flash_stm32_mock.c \ + $(TMK_PATH)/common/chibios/eeprom_stm32.c +eeprom_stm32_tiny_SRC := $(eeprom_stm32_SRC) +eeprom_stm32_large_SRC := $(eeprom_stm32_SRC) diff --git a/tmk_core/common/test/testlist.mk b/tmk_core/common/test/testlist.mk new file mode 100644 index 0000000000..51a9638bb9 --- /dev/null +++ b/tmk_core/common/test/testlist.mk @@ -0,0 +1 @@ +TEST_LIST += eeprom_stm32_tiny eeprom_stm32_large diff --git a/tmk_core/common/timer.h b/tmk_core/common/timer.h index 58f637dd93..02e39e79e7 100644 --- a/tmk_core/common/timer.h +++ b/tmk_core/common/timer.h @@ -1,5 +1,6 @@ /* Copyright 2011 Jun Wako <wakojun@gmail.com> +Copyright 2021 Simon Arlott 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 @@ -17,13 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once -#include <stdint.h> -#include <stdbool.h> - -#if defined(__AVR__) -# include "avr/timer_avr.h" +#if __has_include_next("_timer.h") +# include_next "_timer.h" /* Include the platform's _timer.h */ #endif +#include <stdint.h> + #define TIMER_DIFF(a, b, max) ((max == UINT8_MAX) ? ((uint8_t)((a) - (b))) : ((max == UINT16_MAX) ? ((uint16_t)((a) - (b))) : ((max == UINT32_MAX) ? ((uint32_t)((a) - (b))) : ((a) >= (b) ? (a) - (b) : (max) + 1 - (b) + (a))))) #define TIMER_DIFF_8(a, b) TIMER_DIFF(a, b, UINT8_MAX) #define TIMER_DIFF_16(a, b) TIMER_DIFF(a, b, UINT16_MAX) @@ -47,6 +47,21 @@ uint32_t timer_elapsed32(uint32_t last); #define timer_expired(current, future) ((uint16_t)(current - future) < UINT16_MAX / 2) #define timer_expired32(current, future) ((uint32_t)(current - future) < UINT32_MAX / 2) +// Use an appropriate timer integer size based on architecture (16-bit will overflow sooner) +#if FAST_TIMER_T_SIZE < 32 +# define TIMER_DIFF_FAST(a, b) TIMER_DIFF_16(a, b) +# define timer_expired_fast(current, future) timer_expired(current, future) +typedef uint16_t fast_timer_t; +fast_timer_t inline timer_read_fast(void) { return timer_read(); } +fast_timer_t inline timer_elapsed_fast(fast_timer_t last) { return timer_elapsed(last); } +#else +# define TIMER_DIFF_FAST(a, b) TIMER_DIFF_32(a, b) +# define timer_expired_fast(current, future) timer_expired32(current, future) +typedef uint32_t fast_timer_t; +fast_timer_t inline timer_read_fast(void) { return timer_read32(); } +fast_timer_t inline timer_elapsed_fast(fast_timer_t last) { return timer_elapsed32(last); } +#endif + #ifdef __cplusplus } #endif diff --git a/tmk_core/common/usb_util.c b/tmk_core/common/usb_util.c index e4c50fcb10..dd1deeaa11 100644 --- a/tmk_core/common/usb_util.c +++ b/tmk_core/common/usb_util.c @@ -13,10 +13,10 @@ * 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 "quantum.h" #include "usb_util.h" -#include "wait.h" -__attribute__((weak)) void usb_disable(void) {} +__attribute__((weak)) void usb_disconnect(void) {} __attribute__((weak)) bool usb_connected_state(void) { return true; } __attribute__((weak)) bool usb_vbus_state(void) { #ifdef USB_VBUS_PIN diff --git a/tmk_core/common/usb_util.h b/tmk_core/common/usb_util.h index 4ebedb1e71..13db9fbfbd 100644 --- a/tmk_core/common/usb_util.h +++ b/tmk_core/common/usb_util.h @@ -17,6 +17,6 @@ #include <stdbool.h> -void usb_disable(void); +void usb_disconnect(void); bool usb_connected_state(void); bool usb_vbus_state(void); diff --git a/tmk_core/native.mk b/tmk_core/native.mk index 3caf644546..f609fd0e6f 100644 --- a/tmk_core/native.mk +++ b/tmk_core/native.mk @@ -1,4 +1,5 @@ SYSTEM_TYPE := $(shell gcc -dumpmachine) +GCC_VERSION := $(shell gcc --version 2>/dev/null) CC = gcc OBJCOPY = @@ -12,7 +13,9 @@ BIN = COMPILEFLAGS += -funsigned-char +ifeq ($(findstring clang, ${GCC_VERSION}),) COMPILEFLAGS += -funsigned-bitfields +endif COMPILEFLAGS += -ffunction-sections COMPILEFLAGS += -fdata-sections COMPILEFLAGS += -fshort-enums @@ -21,7 +24,9 @@ COMPILEFLAGS += -mno-ms-bitfields endif CFLAGS += $(COMPILEFLAGS) +ifeq ($(findstring clang, ${GCC_VERSION}),) CFLAGS += -fno-inline-small-functions +endif CFLAGS += -fno-strict-aliasing CXXFLAGS += $(COMPILEFLAGS) diff --git a/tmk_core/protocol.mk b/tmk_core/protocol.mk index cc87e83478..b61f2f5463 100644 --- a/tmk_core/protocol.mk +++ b/tmk_core/protocol.mk @@ -14,13 +14,13 @@ endif ifeq ($(strip $(PS2_USE_INT)), yes) SRC += protocol/ps2_interrupt.c - SRC += protocol/ps2_io_avr.c + SRC += protocol/ps2_io_$(PLATFORM_KEY).c OPT_DEFS += -DPS2_USE_INT endif ifeq ($(strip $(PS2_USE_USART)), yes) SRC += protocol/ps2_usart.c - SRC += protocol/ps2_io_avr.c + SRC += protocol/ps2_io_$(PLATFORM_KEY).c OPT_DEFS += -DPS2_USE_USART endif diff --git a/tmk_core/protocol/arm_atsam/main_arm_atsam.c b/tmk_core/protocol/arm_atsam/main_arm_atsam.c index ce0f54593c..858b4cd9fc 100644 --- a/tmk_core/protocol/arm_atsam/main_arm_atsam.c +++ b/tmk_core/protocol/arm_atsam/main_arm_atsam.c @@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "samd51j18a.h" -#include "tmk_core/common/keyboard.h" +#include "keyboard.h" #include "report.h" #include "host.h" @@ -140,6 +140,57 @@ void send_consumer(uint16_t data) { #endif // EXTRAKEY_ENABLE } +#ifdef CONSOLE_ENABLE +# define CONSOLE_PRINTBUF_SIZE 512 +static char console_printbuf[CONSOLE_PRINTBUF_SIZE]; +static uint16_t console_printbuf_len = 0; + +int8_t sendchar(uint8_t c) { + if (console_printbuf_len >= CONSOLE_PRINTBUF_SIZE) return -1; + + console_printbuf[console_printbuf_len++] = c; + return 0; +} + +void main_subtask_console_flush(void) { + while (udi_hid_con_b_report_trans_ongoing) { + } // Wait for any previous transfers to complete + + uint16_t result = console_printbuf_len; + uint32_t irqflags; + char * pconbuf = console_printbuf; // Pointer to start send from + int send_out = CONSOLE_EPSIZE; // Bytes to send per transfer + + while (result > 0) { // While not error and bytes remain + while (udi_hid_con_b_report_trans_ongoing) { + } // Wait for any previous transfers to complete + + irqflags = __get_PRIMASK(); + __disable_irq(); + __DMB(); + + if (result < CONSOLE_EPSIZE) { // If remaining bytes are less than console epsize + memset(udi_hid_con_report, 0, CONSOLE_EPSIZE); // Clear the buffer + send_out = result; // Send remaining size + } + + memcpy(udi_hid_con_report, pconbuf, send_out); // Copy data into the send buffer + + udi_hid_con_b_report_valid = 1; // Set report valid + udi_hid_con_send_report(); // Send report + + __DMB(); + __set_PRIMASK(irqflags); + + result -= send_out; // Decrement result by bytes sent + pconbuf += send_out; // Increment buffer point by bytes sent + } + + console_printbuf_len = 0; +} + +#endif // CONSOLE_ENABLE + void main_subtask_usb_state(void) { static uint64_t fsmstate_on_delay = 0; // Delay timer to be sure USB is actually operating before bringing up hardware uint8_t fsmstate_now = USB->DEVICE.FSMSTATUS.reg; // Current state from hardware register @@ -214,6 +265,9 @@ void main_subtasks(void) { main_subtask_usb_state(); main_subtask_power_check(); main_subtask_usb_extra_device(); +#ifdef CONSOLE_ENABLE + main_subtask_console_flush(); +#endif #ifdef RAW_ENABLE main_subtask_raw(); #endif diff --git a/tmk_core/protocol/arm_atsam/md_rgb_matrix.c b/tmk_core/protocol/arm_atsam/md_rgb_matrix.c index 2b0805dc86..ddd74f1680 100644 --- a/tmk_core/protocol/arm_atsam/md_rgb_matrix.c +++ b/tmk_core/protocol/arm_atsam/md_rgb_matrix.c @@ -291,10 +291,10 @@ static void flush(void) { i2c_led_q_run(); } -void md_rgb_matrix_indicators(void) { +void md_rgb_matrix_indicators_advanced(uint8_t led_min, uint8_t led_max) { uint8_t kbled = keyboard_leds(); if (kbled && rgb_matrix_config.enable) { - for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) { + for (uint8_t i = led_min; i < led_max; i++) { if ( # if USB_LED_NUM_LOCK_SCANCODE != 255 (led_map[i].scan == USB_LED_NUM_LOCK_SCANCODE && (kbled & (1 << USB_LED_NUM_LOCK))) || diff --git a/tmk_core/protocol/arm_atsam/md_rgb_matrix.h b/tmk_core/protocol/arm_atsam/md_rgb_matrix.h index 322b0f99d1..76ccaa678b 100644 --- a/tmk_core/protocol/arm_atsam/md_rgb_matrix.h +++ b/tmk_core/protocol/arm_atsam/md_rgb_matrix.h @@ -86,7 +86,7 @@ extern uint8_t gcr_actual_last; void gcr_compute(void); -void md_rgb_matrix_indicators(void); +void md_rgb_matrix_indicators_advanced(uint8_t led_min, uint8_t led_max); /*------------------------- Legacy Lighting Support ------------------------*/ diff --git a/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h b/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h index 9c9d94789d..1c0983115c 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h +++ b/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h @@ -23,6 +23,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "compiler.h" #include "usb_protocol_hid.h" +#ifndef USB_POLLING_INTERVAL_MS +# define USB_POLLING_INTERVAL_MS 10 +#endif + #ifdef VIRTSER_ENABLE // because CDC uses IAD (interface association descriptor // per USB Interface Association Descriptor Device Class Code and Use Model 7/23/2003 Rev 1.0) @@ -118,7 +122,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define UDI_HID_KBD_EP_IN KEYBOARD_IN_EPNUM #define NEXT_IN_EPNUM_1 (KEYBOARD_IN_EPNUM + 1) #define UDI_HID_KBD_EP_SIZE KEYBOARD_EPSIZE -#define KBD_POLLING_INTERVAL 10 +#define KBD_POLLING_INTERVAL USB_POLLING_INTERVAL_MS #ifndef UDI_HID_KBD_STRING_ID # define UDI_HID_KBD_STRING_ID 0 #endif @@ -128,7 +132,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define NEXT_IN_EPNUM_2 (MOUSE_IN_EPNUM + 1) # define UDI_HID_MOU_EP_IN MOUSE_IN_EPNUM # define UDI_HID_MOU_EP_SIZE MOUSE_EPSIZE -# define MOU_POLLING_INTERVAL 10 +# define MOU_POLLING_INTERVAL USB_POLLING_INTERVAL_MS # ifndef UDI_HID_MOU_STRING_ID # define UDI_HID_MOU_STRING_ID 0 # endif @@ -141,7 +145,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define UDI_HID_EXK_EP_IN EXTRAKEY_IN_EPNUM # define NEXT_IN_EPNUM_3 (EXTRAKEY_IN_EPNUM + 1) # define UDI_HID_EXK_EP_SIZE EXTRAKEY_EPSIZE -# define EXTRAKEY_POLLING_INTERVAL 10 +# define EXTRAKEY_POLLING_INTERVAL USB_POLLING_INTERVAL_MS # ifndef UDI_HID_EXK_STRING_ID # define UDI_HID_EXK_STRING_ID 0 # endif diff --git a/tmk_core/protocol/chibios.mk b/tmk_core/protocol/chibios.mk index d01697835b..a7f2d8e93d 100644 --- a/tmk_core/protocol/chibios.mk +++ b/tmk_core/protocol/chibios.mk @@ -3,7 +3,7 @@ CHIBIOS_DIR = $(PROTOCOL_DIR)/chibios SRC += $(CHIBIOS_DIR)/usb_main.c -SRC += $(CHIBIOS_DIR)/main.c +SRC += $(CHIBIOS_DIR)/chibios.c SRC += usb_descriptor.c SRC += $(CHIBIOS_DIR)/usb_driver.c SRC += $(CHIBIOS_DIR)/usb_util.c diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/chibios.c index 2661e58873..fece8903d2 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/chibios.c @@ -65,6 +65,7 @@ void send_keyboard(report_keyboard_t *report); void send_mouse(report_mouse_t *report); void send_system(uint16_t data); void send_consumer(uint16_t data); +void send_digitizer(report_digitizer_t *report); /* host struct */ host_driver_t chibios_driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer}; @@ -141,18 +142,14 @@ void boardInit(void) { board_init(); } -/* Main thread - */ -int main(void) { - /* ChibiOS/RT init */ - halInit(); - chSysInit(); - +void protocol_setup(void) { // TESTING // chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); keyboard_setup(); +} +void protocol_init(void) { /* Init USB */ usb_event_queue_init(); init_usb_driver(&USB_DRIVER); @@ -210,60 +207,57 @@ int main(void) { #endif print("Keyboard start.\n"); +} - /* Main loop */ - while (true) { - usb_event_queue_task(); +void protocol_task(void) { + usb_event_queue_task(); #if !defined(NO_USB_STARTUP_CHECK) - if (USB_DRIVER.state == USB_SUSPENDED) { - print("[s]"); + if (USB_DRIVER.state == USB_SUSPENDED) { + print("[s]"); # ifdef VISUALIZER_ENABLE - visualizer_suspend(); + visualizer_suspend(); # endif - while (USB_DRIVER.state == USB_SUSPENDED) { - /* Do this in the suspended state */ + while (USB_DRIVER.state == USB_SUSPENDED) { + /* Do this in the suspended state */ # ifdef SERIAL_LINK_ENABLE - serial_link_update(); + serial_link_update(); # endif - suspend_power_down(); // on AVR this deep sleeps for 15ms - /* Remote wakeup */ - if (suspend_wakeup_condition()) { - usbWakeupHost(&USB_DRIVER); - restart_usb_driver(&USB_DRIVER); - } + suspend_power_down(); // on AVR this deep sleeps for 15ms + /* Remote wakeup */ + if (suspend_wakeup_condition()) { + usbWakeupHost(&USB_DRIVER); + restart_usb_driver(&USB_DRIVER); } - /* Woken up */ - // variables has been already cleared by the wakeup hook - send_keyboard_report(); + } + /* Woken up */ + // variables has been already cleared by the wakeup hook + send_keyboard_report(); # ifdef MOUSEKEY_ENABLE - mousekey_send(); + mousekey_send(); # endif /* MOUSEKEY_ENABLE */ # ifdef VISUALIZER_ENABLE - visualizer_resume(); + visualizer_resume(); # endif - } + } #endif - keyboard_task(); + keyboard_task(); #ifdef CONSOLE_ENABLE - console_task(); + console_task(); #endif #ifdef MIDI_ENABLE - midi_ep_task(); + midi_ep_task(); #endif #ifdef VIRTSER_ENABLE - virtser_task(); + virtser_task(); #endif #ifdef RAW_ENABLE - raw_hid_task(); + raw_hid_task(); #endif #ifdef WEBUSB_ENABLE - webusb_task(); + webusb_task(); #endif - // Run housekeeping - housekeeping_task(); - } } diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 990dc1b91c..697566e27a 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -340,6 +340,9 @@ typedef struct { #ifdef JOYSTICK_ENABLE usb_driver_config_t joystick_driver; #endif +#if defined(DIGITIZER_ENABLE) && !defined(DIGITIZER_SHARED_EP) + usb_driver_config_t digitizer_driver; +#endif }; usb_driver_config_t array[0]; }; @@ -391,6 +394,14 @@ static usb_driver_configs_t drivers = { # define JOYSTICK_OUT_MODE USB_EP_MODE_TYPE_BULK .joystick_driver = QMK_USB_DRIVER_CONFIG(JOYSTICK, 0, false), #endif + +#if defined(DIGITIZER_ENABLE) && !defined(DIGITIZER_SHARED_EP) +# define DIGITIZER_IN_CAPACITY 4 +# define DIGITIZER_OUT_CAPACITY 4 +# define DIGITIZER_IN_MODE USB_EP_MODE_TYPE_BULK +# define DIGITIZER_OUT_MODE USB_EP_MODE_TYPE_BULK + .digitizer_driver = QMK_USB_DRIVER_CONFIG(DIGITIZER, 0, false), +#endif }; #define NUM_USB_DRIVERS (sizeof(drivers) / sizeof(usb_driver_config_t)) @@ -446,14 +457,18 @@ static inline void usb_event_wakeup_handler(void) { #endif /* SLEEP_LED_ENABLE */ } +bool last_suspend_state = false; + void usb_event_queue_task(void) { usbevent_t event; while (usb_event_queue_dequeue(&event)) { switch (event) { case USB_EVENT_SUSPEND: + last_suspend_state = true; usb_event_suspend_handler(); break; case USB_EVENT_WAKEUP: + last_suspend_state = false; usb_event_wakeup_handler(); break; default: @@ -495,6 +510,9 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) { qmkusbConfigureHookI(&drivers.array[i].driver); } osalSysUnlockFromISR(); + if (last_suspend_state) { + usb_event_queue_enqueue(USB_EVENT_WAKEUP); + } return; case USB_EVENT_SUSPEND: usb_event_queue_enqueue(USB_EVENT_SUSPEND); @@ -549,7 +567,7 @@ static uint16_t get_hword(uint8_t *p) { * Other Device Required Optional Optional Optional Optional Optional */ -static uint8_t set_report_buf[2] __attribute__((aligned(2))); +static uint8_t set_report_buf[2] __attribute__((aligned(4))); static void set_led_transfer_cb(USBDriver *usbp) { if (usbp->setup[6] == 2) { /* LSB(wLength) */ uint8_t report_id = set_report_buf[0]; @@ -757,7 +775,7 @@ void init_usb_driver(USBDriver *usbp) { chVTObjectInit(&keyboard_idle_timer); } -void restart_usb_driver(USBDriver *usbp) { +__attribute__((weak)) void restart_usb_driver(USBDriver *usbp) { usbStop(usbp); usbDisconnectBus(usbp); @@ -955,7 +973,8 @@ static void send_extra(uint8_t report_id, uint16_t data) { return; } - report_extra_t report = {.report_id = report_id, .usage = data}; + static report_extra_t report; + report = (report_extra_t){.report_id = report_id, .usage = data}; usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)&report, sizeof(report_extra_t)); osalSysUnlock(); @@ -974,6 +993,23 @@ void send_consumer(uint16_t data) { #endif } +void send_digitizer(report_digitizer_t *report) { +#ifdef DIGITIZER_ENABLE +# ifdef DIGITIZER_SHARED_EP + osalSysLock(); + if (usbGetDriverStateI(&USB_DRIVER) != USB_ACTIVE) { + osalSysUnlock(); + return; + } + + usbStartTransmitI(&USB_DRIVER, DIGITIZER_IN_EPNUM, (uint8_t *)report, sizeof(report_digitizer_t)); + osalSysUnlock(); +# else + chnWrite(&drivers.digitizer_driver.driver, (uint8_t *)report, sizeof(report_digitizer_t)); +# endif +#endif +} + /* --------------------------------------------------------- * Console functions * --------------------------------------------------------- @@ -1128,45 +1164,44 @@ void virtser_task(void) { #ifdef JOYSTICK_ENABLE void send_joystick_packet(joystick_t *joystick) { - joystick_report_t rep = { + static joystick_report_t rep; + rep = (joystick_report_t) { # if JOYSTICK_AXES_COUNT > 0 .axes = - { - joystick->axes[0], + { joystick->axes[0], # if JOYSTICK_AXES_COUNT >= 2 - joystick->axes[1], + joystick->axes[1], # endif # if JOYSTICK_AXES_COUNT >= 3 - joystick->axes[2], + joystick->axes[2], # endif # if JOYSTICK_AXES_COUNT >= 4 - joystick->axes[3], + joystick->axes[3], # endif # if JOYSTICK_AXES_COUNT >= 5 - joystick->axes[4], + joystick->axes[4], # endif # if JOYSTICK_AXES_COUNT >= 6 - joystick->axes[5], + joystick->axes[5], # endif - }, + }, # endif // JOYSTICK_AXES_COUNT>0 # if JOYSTICK_BUTTON_COUNT > 0 - .buttons = - { - joystick->buttons[0], + .buttons = { + joystick->buttons[0], # if JOYSTICK_BUTTON_COUNT > 8 - joystick->buttons[1], + joystick->buttons[1], # endif # if JOYSTICK_BUTTON_COUNT > 16 - joystick->buttons[2], + joystick->buttons[2], # endif # if JOYSTICK_BUTTON_COUNT > 24 - joystick->buttons[3], + joystick->buttons[3], # endif - } + } # endif // JOYSTICK_BUTTON_COUNT>0 }; diff --git a/tmk_core/protocol/chibios/usb_util.c b/tmk_core/protocol/chibios/usb_util.c index 5945e8a8de..e32d6ebfa4 100644 --- a/tmk_core/protocol/chibios/usb_util.c +++ b/tmk_core/protocol/chibios/usb_util.c @@ -16,6 +16,6 @@ #include <hal.h> #include "usb_util.h" -void usb_disable(void) { usbStop(&USBD1); } +void usb_disconnect(void) { usbStop(&USBD1); } bool usb_connected_state(void) { return usbGetDriverStateI(&USBD1) == USB_ACTIVE; } diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk index 514d5fac41..c8935dacb7 100644 --- a/tmk_core/protocol/lufa.mk +++ b/tmk_core/protocol/lufa.mk @@ -49,7 +49,6 @@ SRC += $(LUFA_DIR)/usb_util.c # Search Path VPATH += $(TMK_PATH)/$(LUFA_DIR) VPATH += $(LUFA_PATH) -VPATH += $(DRIVER_PATH)/avr # Option modules #ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE) diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 5976470b6e..92070a8fa3 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -145,9 +145,7 @@ static void send_keyboard(report_keyboard_t *report); static void send_mouse(report_mouse_t *report); static void send_system(uint16_t data); static void send_consumer(uint16_t data); -host_driver_t lufa_driver = { - keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer, -}; +host_driver_t lufa_driver = {keyboard_leds, send_keyboard, send_mouse, send_system, send_consumer}; #ifdef VIRTSER_ENABLE // clang-format off @@ -377,45 +375,44 @@ const WebUSB_URL_Descriptor_t PROGMEM WebUSB_LandingPage = WEBUSB_URL_DESCRIPTOR void send_joystick_packet(joystick_t *joystick) { uint8_t timeout = 255; - joystick_report_t r = { + static joystick_report_t r; + r = (joystick_report_t) { # if JOYSTICK_AXES_COUNT > 0 .axes = - { - joystick->axes[0], + { joystick->axes[0], # if JOYSTICK_AXES_COUNT >= 2 - joystick->axes[1], + joystick->axes[1], # endif # if JOYSTICK_AXES_COUNT >= 3 - joystick->axes[2], + joystick->axes[2], # endif # if JOYSTICK_AXES_COUNT >= 4 - joystick->axes[3], + joystick->axes[3], # endif # if JOYSTICK_AXES_COUNT >= 5 - joystick->axes[4], + joystick->axes[4], # endif # if JOYSTICK_AXES_COUNT >= 6 - joystick->axes[5], + joystick->axes[5], # endif - }, + }, # endif // JOYSTICK_AXES_COUNT>0 # if JOYSTICK_BUTTON_COUNT > 0 - .buttons = - { - joystick->buttons[0], + .buttons = { + joystick->buttons[0], # if JOYSTICK_BUTTON_COUNT > 8 - joystick->buttons[1], + joystick->buttons[1], # endif # if JOYSTICK_BUTTON_COUNT > 16 - joystick->buttons[2], + joystick->buttons[2], # endif # if JOYSTICK_BUTTON_COUNT > 24 - joystick->buttons[3], + joystick->buttons[3], # endif - } + } # endif // JOYSTICK_BUTTON_COUNT>0 }; @@ -595,6 +592,11 @@ void EVENT_USB_Device_ConfigurationChanged(void) { /* Setup joystick endpoint */ ConfigSuccess &= Endpoint_ConfigureEndpoint((JOYSTICK_IN_EPNUM | ENDPOINT_DIR_IN), EP_TYPE_INTERRUPT, JOYSTICK_EPSIZE, 1); #endif + +#if defined(DIGITIZER_ENABLE) && !defined(DIGITIZER_SHARED_EP) + /* Setup digitizer endpoint */ + ConfigSuccess &= Endpoint_ConfigureEndpoint((DIGITIZER_IN_EPNUM | ENDPOINT_DIR_IN), EP_TYPE_INTERRUPT, DIGITIZER_EPSIZE, 1); +#endif } /* FIXME: Expose this table in the docs somehow @@ -879,7 +881,8 @@ static void send_extra(uint8_t report_id, uint16_t data) { if (USB_DeviceState != DEVICE_STATE_Configured) return; - report_extra_t r = {.report_id = report_id, .usage = data}; + static report_extra_t r; + r = (report_extra_t){.report_id = report_id, .usage = data}; Endpoint_SelectEndpoint(SHARED_IN_EPNUM); /* Check if write ready for a polling interval around 10ms */ @@ -1110,6 +1113,23 @@ void virtser_send(const uint8_t byte) { } #endif +void send_digitizer(report_digitizer_t *report) { +#ifdef DIGITIZER_ENABLE + uint8_t timeout = 255; + + if (USB_DeviceState != DEVICE_STATE_Configured) return; + + Endpoint_SelectEndpoint(DIGITIZER_IN_EPNUM); + + /* Check if write ready for a polling interval around 10ms */ + while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40); + if (!Endpoint_IsReadWriteAllowed()) return; + + Endpoint_Write_Stream_LE(report, sizeof(report_digitizer_t), NULL); + Endpoint_ClearIN(); +#endif +} + /******************************************************************************* * main ******************************************************************************/ @@ -1122,8 +1142,13 @@ static void setup_mcu(void) { MCUSR &= ~_BV(WDRF); wdt_disable(); - /* Disable clock division */ +// For boards running at 3.3V and crystal at 16 MHz +#if (F_CPU == 8000000 && F_USB == 16000000) + /* Divide clock by 2 */ + clock_prescale_set(clock_div_2); +#else /* Disable clock division */ clock_prescale_set(clock_div_1); +#endif } /** \brief Setup USB @@ -1140,18 +1165,16 @@ static void setup_usb(void) { USB_Device_EnableSOFEvents(); } -/** \brief Main - * - * FIXME: Needs doc - */ -int main(void) __attribute__((weak)); -int main(void) { +void protocol_setup(void) { #ifdef MIDI_ENABLE setup_midi(); #endif setup_mcu(); keyboard_setup(); +} + +void protocol_init(void) { setup_usb(); sei(); @@ -1185,48 +1208,50 @@ int main(void) { #endif print("Keyboard start.\n"); - while (1) { +} + +void protocol_task(void) { #if !defined(NO_USB_STARTUP_CHECK) - if (USB_DeviceState == DEVICE_STATE_Suspended) { - print("[s]"); - while (USB_DeviceState == DEVICE_STATE_Suspended) { - suspend_power_down(); - if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) { - USB_Device_SendRemoteWakeup(); - clear_keyboard(); + if (USB_DeviceState == DEVICE_STATE_Suspended) { + print("[s]"); + while (USB_DeviceState == DEVICE_STATE_Suspended) { + suspend_power_down(); + if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) { + USB_Device_SendRemoteWakeup(); + clear_keyboard(); # if USB_SUSPEND_WAKEUP_DELAY > 0 - // Some hubs, kvm switches, and monitors do - // weird things, with USB device state bouncing - // around wildly on wakeup, yielding race - // conditions that can corrupt the keyboard state. - // - // Pause for a while to let things settle... - wait_ms(USB_SUSPEND_WAKEUP_DELAY); + // Some hubs, kvm switches, and monitors do + // weird things, with USB device state bouncing + // around wildly on wakeup, yielding race + // conditions that can corrupt the keyboard state. + // + // Pause for a while to let things settle... + wait_ms(USB_SUSPEND_WAKEUP_DELAY); # endif - } } - suspend_wakeup_init(); } + suspend_wakeup_init(); + } #endif - keyboard_task(); + keyboard_task(); #ifdef MIDI_ENABLE - MIDI_Device_USBTask(&USB_MIDI_Interface); + MIDI_Device_USBTask(&USB_MIDI_Interface); #endif #ifdef MODULE_ADAFRUIT_BLE - adafruit_ble_task(); + adafruit_ble_task(); #endif #ifdef VIRTSER_ENABLE - virtser_task(); - CDC_Device_USBTask(&cdc_device); + virtser_task(); + CDC_Device_USBTask(&cdc_device); #endif #ifdef RAW_ENABLE - raw_hid_task(); + raw_hid_task(); #endif #ifdef WEBUSB_ENABLE @@ -1234,12 +1259,8 @@ int main(void) { #endif #if !defined(INTERRUPT_CONTROL_ENDPOINT) - USB_USBTask(); + USB_USBTask(); #endif - - // Run housekeeping - housekeeping_task(); - } } uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint16_t wIndex, const void **const DescriptorAddress) { return get_usb_descriptor(wValue, wIndex, DescriptorAddress); } diff --git a/tmk_core/protocol/lufa/usb_util.c b/tmk_core/protocol/lufa/usb_util.c index 9e943a21b9..9691eff1e4 100644 --- a/tmk_core/protocol/lufa/usb_util.c +++ b/tmk_core/protocol/lufa/usb_util.c @@ -17,7 +17,7 @@ #include "usb_util.h" #include "wait.h" -void usb_disable(void) { +void usb_disconnect(void) { USB_Disable(); USB_DeviceState = DEVICE_STATE_Unattached; } diff --git a/tmk_core/protocol/ps2_interrupt.c b/tmk_core/protocol/ps2_interrupt.c index 5afc8a82e4..780040d152 100644 --- a/tmk_core/protocol/ps2_interrupt.c +++ b/tmk_core/protocol/ps2_interrupt.c @@ -40,11 +40,19 @@ POSSIBILITY OF SUCH DAMAGE. */ #include <stdbool.h> -#include <avr/interrupt.h> -#include <util/delay.h> + +#if defined(__AVR__) +# include <avr/interrupt.h> +#elif defined(PROTOCOL_CHIBIOS) // TODO: or STM32 ? +// chibiOS headers +# include "ch.h" +# include "hal.h" +#endif + #include "ps2.h" #include "ps2_io.h" #include "print.h" +#include "wait.h" #define WAIT(stat, us, err) \ do { \ @@ -61,12 +69,30 @@ static inline void pbuf_enqueue(uint8_t data); static inline bool pbuf_has_data(void); static inline void pbuf_clear(void); +#if defined(PROTOCOL_CHIBIOS) +void ps2_interrupt_service_routine(void); +void palCallback(void *arg) { ps2_interrupt_service_routine(); } + +# define PS2_INT_INIT() \ + { palSetLineMode(PS2_CLOCK, PAL_MODE_INPUT); } \ + while (0) +# define PS2_INT_ON() \ + { \ + palEnableLineEvent(PS2_CLOCK, PAL_EVENT_MODE_FALLING_EDGE); \ + palSetLineCallback(PS2_CLOCK, palCallback, NULL); \ + } \ + while (0) +# define PS2_INT_OFF() \ + { palDisableLineEvent(PS2_CLOCK); } \ + while (0) +#endif // PROTOCOL_CHIBIOS + void ps2_host_init(void) { idle(); PS2_INT_INIT(); PS2_INT_ON(); // POR(150-2000ms) plus BAT(300-500ms) may take 2.5sec([3]p.20) - //_delay_ms(2500); + // wait_ms(2500); } uint8_t ps2_host_send(uint8_t data) { @@ -77,7 +103,7 @@ uint8_t ps2_host_send(uint8_t data) { /* terminate a transmission if we have */ inhibit(); - _delay_us(100); // 100us [4]p.13, [5]p.50 + wait_us(100); // 100us [4]p.13, [5]p.50 /* 'Request to Send' and Start bit */ data_lo(); @@ -86,7 +112,6 @@ uint8_t ps2_host_send(uint8_t data) { /* Data bit[2-9] */ for (uint8_t i = 0; i < 8; i++) { - _delay_us(15); if (data & (1 << i)) { parity = !parity; data_hi(); @@ -98,7 +123,7 @@ uint8_t ps2_host_send(uint8_t data) { } /* Parity bit */ - _delay_us(15); + wait_us(15); if (parity) { data_hi(); } else { @@ -108,7 +133,7 @@ uint8_t ps2_host_send(uint8_t data) { WAIT(clock_lo, 50, 5); /* Stop bit */ - _delay_us(15); + wait_us(15); data_hi(); /* Ack */ @@ -132,7 +157,7 @@ uint8_t ps2_host_recv_response(void) { // Command may take 25ms/20ms at most([5]p.46, [3]p.21) uint8_t retry = 25; while (retry-- && !pbuf_has_data()) { - _delay_ms(1); + wait_ms(1); } return pbuf_dequeue(); } @@ -148,7 +173,7 @@ uint8_t ps2_host_recv(void) { } } -ISR(PS2_INT_VECT) { +void ps2_interrupt_service_routine(void) { static enum { INIT, START, @@ -218,6 +243,10 @@ RETURN: return; } +#if defined(__AVR__) +ISR(PS2_INT_VECT) { ps2_interrupt_service_routine(); } +#endif + /* send LED state to keyboard */ void ps2_host_set_led(uint8_t led) { ps2_host_send(0xED); @@ -232,8 +261,13 @@ static uint8_t pbuf[PBUF_SIZE]; static uint8_t pbuf_head = 0; static uint8_t pbuf_tail = 0; static inline void pbuf_enqueue(uint8_t data) { +#if defined(__AVR__) uint8_t sreg = SREG; cli(); +#elif defined(PROTOCOL_CHIBIOS) + chSysLockFromISR(); +#endif + uint8_t next = (pbuf_head + 1) % PBUF_SIZE; if (next != pbuf_tail) { pbuf[pbuf_head] = data; @@ -241,31 +275,66 @@ static inline void pbuf_enqueue(uint8_t data) { } else { print("pbuf: full\n"); } + +#if defined(__AVR__) SREG = sreg; +#elif defined(PROTOCOL_CHIBIOS) + chSysUnlockFromISR(); +#endif } static inline uint8_t pbuf_dequeue(void) { uint8_t val = 0; +#if defined(__AVR__) uint8_t sreg = SREG; cli(); +#elif defined(PROTOCOL_CHIBIOS) + chSysLock(); +#endif + if (pbuf_head != pbuf_tail) { val = pbuf[pbuf_tail]; pbuf_tail = (pbuf_tail + 1) % PBUF_SIZE; } + +#if defined(__AVR__) SREG = sreg; +#elif defined(PROTOCOL_CHIBIOS) + chSysUnlock(); +#endif return val; } static inline bool pbuf_has_data(void) { +#if defined(__AVR__) uint8_t sreg = SREG; cli(); +#elif defined(PROTOCOL_CHIBIOS) + chSysLock(); +#endif + bool has_data = (pbuf_head != pbuf_tail); - SREG = sreg; + +#if defined(__AVR__) + SREG = sreg; +#elif defined(PROTOCOL_CHIBIOS) + chSysUnlock(); +#endif return has_data; } static inline void pbuf_clear(void) { +#if defined(__AVR__) uint8_t sreg = SREG; cli(); +#elif defined(PROTOCOL_CHIBIOS) + chSysLock(); +#endif + pbuf_head = pbuf_tail = 0; - SREG = sreg; + +#if defined(__AVR__) + SREG = sreg; +#elif defined(PROTOCOL_CHIBIOS) + chSysUnlock(); +#endif } diff --git a/tmk_core/protocol/ps2_io_chibios.c b/tmk_core/protocol/ps2_io_chibios.c new file mode 100644 index 0000000000..b672bd1f47 --- /dev/null +++ b/tmk_core/protocol/ps2_io_chibios.c @@ -0,0 +1,55 @@ +#include <stdbool.h> +#include "ps2_io.h" + +// chibiOS headers +#include "ch.h" +#include "hal.h" + +/* Check port settings for clock and data line */ +#if !(defined(PS2_CLOCK)) +# error "PS/2 clock setting is required in config.h" +#endif + +#if !(defined(PS2_DATA)) +# error "PS/2 data setting is required in config.h" +#endif + +/* + * Clock + */ +void clock_init(void) {} + +void clock_lo(void) { + palSetLineMode(PS2_CLOCK, PAL_MODE_OUTPUT_OPENDRAIN); + palWriteLine(PS2_CLOCK, PAL_LOW); +} + +void clock_hi(void) { + palSetLineMode(PS2_CLOCK, PAL_MODE_OUTPUT_OPENDRAIN); + palWriteLine(PS2_CLOCK, PAL_HIGH); +} + +bool clock_in(void) { + palSetLineMode(PS2_CLOCK, PAL_MODE_INPUT); + return palReadLine(PS2_CLOCK); +} + +/* + * Data + */ +void data_init(void) {} + +void data_lo(void) { + palSetLineMode(PS2_DATA, PAL_MODE_OUTPUT_OPENDRAIN); + palWriteLine(PS2_DATA, PAL_LOW); +} + +void data_hi(void) { + palSetLineMode(PS2_DATA, PAL_MODE_OUTPUT_OPENDRAIN); + palWriteLine(PS2_DATA, PAL_HIGH); +} + +bool data_in(void) { + palSetLineMode(PS2_DATA, PAL_MODE_INPUT); + return palReadLine(PS2_DATA); +} diff --git a/tmk_core/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c index 5415453a05..39251a6434 100644 --- a/tmk_core/protocol/ps2_mouse.c +++ b/tmk_core/protocol/ps2_mouse.c @@ -16,9 +16,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdbool.h> -#include <avr/io.h> -#include <util/delay.h> + +#if defined(__AVR__) +# include <avr/io.h> +#endif + #include "ps2_mouse.h" +#include "wait.h" #include "host.h" #include "timer.h" #include "print.h" @@ -42,7 +46,7 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report); void ps2_mouse_init(void) { ps2_host_init(); - _delay_ms(PS2_MOUSE_INIT_DELAY); // wait for powering up + wait_ms(PS2_MOUSE_INIT_DELAY); // wait for powering up PS2_MOUSE_SEND(PS2_MOUSE_RESET, "ps2_mouse_init: sending reset"); @@ -152,8 +156,15 @@ static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report) mouse_report->x = X_IS_NEG ? ((!X_IS_OVF && -127 <= mouse_report->x && mouse_report->x <= -1) ? mouse_report->x : -127) : ((!X_IS_OVF && 0 <= mouse_report->x && mouse_report->x <= 127) ? mouse_report->x : 127); mouse_report->y = Y_IS_NEG ? ((!Y_IS_OVF && -127 <= mouse_report->y && mouse_report->y <= -1) ? mouse_report->y : -127) : ((!Y_IS_OVF && 0 <= mouse_report->y && mouse_report->y <= 127) ? mouse_report->y : 127); +#ifdef PS2_MOUSE_INVERT_BUTTONS + // swap left & right buttons + uint8_t needs_left = mouse_report->buttons & PS2_MOUSE_BTN_RIGHT; + uint8_t needs_right = mouse_report->buttons & PS2_MOUSE_BTN_LEFT; + mouse_report->buttons = (mouse_report->buttons & ~(PS2_MOUSE_BTN_MASK)) | (needs_left ? PS2_MOUSE_BTN_LEFT : 0) | (needs_right ? PS2_MOUSE_BTN_RIGHT : 0); +#else // remove sign and overflow flags mouse_report->buttons &= PS2_MOUSE_BTN_MASK; +#endif #ifdef PS2_MOUSE_INVERT_X mouse_report->x = -mouse_report->x; @@ -210,7 +221,7 @@ static inline void ps2_mouse_enable_scrolling(void) { PS2_MOUSE_SEND(PS2_MOUSE_SET_SAMPLE_RATE, "Set sample rate"); PS2_MOUSE_SEND(80, "80"); PS2_MOUSE_SEND(PS2_MOUSE_GET_DEVICE_ID, "Finished enabling scroll wheel"); - _delay_ms(20); + wait_ms(20); } #define PRESS_SCROLL_BUTTONS mouse_report->buttons |= (PS2_MOUSE_SCROLL_BTN_MASK) @@ -252,7 +263,7 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) { if (scroll_state == SCROLL_BTN && timer_elapsed(scroll_button_time) < PS2_MOUSE_SCROLL_BTN_SEND) { PRESS_SCROLL_BUTTONS; host_mouse_send(mouse_report); - _delay_ms(100); + wait_ms(100); RELEASE_SCROLL_BUTTONS; } #endif diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c index 5c23309b1e..9688d6d656 100644 --- a/tmk_core/protocol/usb_descriptor.c +++ b/tmk_core/protocol/usb_descriptor.c @@ -161,6 +161,53 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM SharedReport[] = { # endif #endif +#ifdef DIGITIZER_ENABLE +# ifndef DIGITIZER_SHARED_EP +const USB_Descriptor_HIDReport_Datatype_t PROGMEM DigitizerReport[] = { +# elif !defined(SHARED_REPORT_STARTED) +const USB_Descriptor_HIDReport_Datatype_t PROGMEM SharedReport[] = { +# define SHARED_REPORT_STARTED +# endif + HID_RI_USAGE_PAGE(8, 0x0D), // Digitizers + HID_RI_USAGE(8, 0x01), // Digitizer + HID_RI_COLLECTION(8, 0x01), // Application +# ifdef DIGITIZER_SHARED_EP + HID_RI_REPORT_ID(8, REPORT_ID_DIGITIZER), +# endif + HID_RI_USAGE(8, 0x20), // Stylus + HID_RI_COLLECTION(8, 0x00), // Physical + // Tip Switch (1 bit) + HID_RI_USAGE(8, 0x42), // Tip Switch + HID_RI_LOGICAL_MINIMUM(8, 0x00), + HID_RI_LOGICAL_MAXIMUM(8, 0x01), + HID_RI_REPORT_SIZE(8, 0x01), + HID_RI_REPORT_COUNT(8, 0x01), + HID_RI_INPUT(8, HID_IOF_VARIABLE), + // In Range (1 bit) + HID_RI_USAGE(8, 0x32), // In Range + HID_RI_INPUT(8, HID_IOF_VARIABLE), + // Padding (6 bits) + HID_RI_REPORT_COUNT(8, 0x06), + HID_RI_INPUT(8, HID_IOF_CONSTANT | HID_IOF_VARIABLE), + + // X/Y Position (4 bytes) + HID_RI_USAGE_PAGE(8, 0x01), // Generic Desktop + HID_RI_LOGICAL_MAXIMUM(16, 0x7FFF), + HID_RI_REPORT_SIZE(8, 0x10), + HID_RI_REPORT_COUNT(8, 0x01), + HID_RI_UNIT(8, 0x33), // Inch, English Linear + HID_RI_UNIT_EXPONENT(8, 0x0E), // -2 + HID_RI_USAGE(8, 0x30), // X + HID_RI_INPUT(8, HID_IOF_VARIABLE), + HID_RI_USAGE(8, 0x31), // Y + HID_RI_INPUT(8, HID_IOF_VARIABLE), + HID_RI_END_COLLECTION(0), + HID_RI_END_COLLECTION(0), +# ifndef DIGITIZER_SHARED_EP +}; +# endif +#endif + #if defined(SHARED_EP_ENABLE) && !defined(SHARED_REPORT_STARTED) const USB_Descriptor_HIDReport_Datatype_t PROGMEM SharedReport[] = { #endif @@ -230,6 +277,7 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM SharedReport[] = { HID_RI_OUTPUT(8, HID_IOF_CONSTANT), HID_RI_END_COLLECTION(0), #endif + #ifdef SHARED_EP_ENABLE }; #endif @@ -966,6 +1014,46 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .PollingIntervalMS = USB_POLLING_INTERVAL_MS } #endif + +#if defined(DIGITIZER_ENABLE) && !defined(DIGITIZER_SHARED_EP) + /* + * Digitizer + */ + .Digitizer_Interface = { + .Header = { + .Size = sizeof(USB_Descriptor_Interface_t), + .Type = DTYPE_Interface + }, + .InterfaceNumber = DIGITIZER_INTERFACE, + .AlternateSetting = 0x00, + .TotalEndpoints = 1, + .Class = HID_CSCP_HIDClass, + .SubClass = HID_CSCP_NonBootSubclass, + .Protocol = HID_CSCP_NonBootProtocol, + .InterfaceStrIndex = NO_DESCRIPTOR + }, + .Digitizer_HID = { + .Header = { + .Size = sizeof(USB_HID_Descriptor_HID_t), + .Type = HID_DTYPE_HID + }, + .HIDSpec = VERSION_BCD(1, 1, 1), + .CountryCode = 0x00, + .TotalReportDescriptors = 1, + .HIDReportType = HID_DTYPE_Report, + .HIDReportLength = sizeof(DigitizerReport) + }, + .Digitizer_INEndpoint = { + .Header = { + .Size = sizeof(USB_Descriptor_Endpoint_t), + .Type = DTYPE_Endpoint + }, + .EndpointAddress = (ENDPOINT_DIR_IN | DIGITIZER_IN_EPNUM), + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = DIGITIZER_EPSIZE, + .PollingIntervalMS = USB_POLLING_INTERVAL_MS + }, +#endif }; /* @@ -998,10 +1086,10 @@ const USB_Descriptor_String_t PROGMEM ProductString = { #if defined(SERIAL_NUMBER) const USB_Descriptor_String_t PROGMEM SerialNumberString = { .Header = { - .Size = USB_STRING_LEN(sizeof(STR(SERIAL_NUMBER)) - 1), // Subtract 1 for null terminator + .Size = USB_STRING_LEN(sizeof(SERIAL_NUMBER) - 1), // Subtract 1 for null terminator .Type = DTYPE_String }, - .UnicodeString = LSTR(SERIAL_NUMBER) + .UnicodeString = USBSTR(SERIAL_NUMBER) }; #endif @@ -1111,6 +1199,13 @@ uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const Size = sizeof(USB_HID_Descriptor_HID_t); break; #endif +#if defined(DIGITIZER_ENABLE) && !defined(DIGITIZER_SHARED_EP) + case DIGITIZER_INTERFACE: + Address = &ConfigurationDescriptor.Digitizer_HID; + Size = sizeof(USB_HID_Descriptor_HID_t); + + break; +#endif } break; @@ -1161,6 +1256,12 @@ uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const Size = sizeof(JoystickReport); break; #endif +#if defined(DIGITIZER_ENABLE) && !defined(DIGITIZER_SHARED_EP) + case DIGITIZER_INTERFACE: + Address = &DigitizerReport; + Size = sizeof(DigitizerReport); + break; +#endif } break; diff --git a/tmk_core/protocol/usb_descriptor.h b/tmk_core/protocol/usb_descriptor.h index 2ea4861f36..93304f4450 100644 --- a/tmk_core/protocol/usb_descriptor.h +++ b/tmk_core/protocol/usb_descriptor.h @@ -144,6 +144,13 @@ typedef struct { USB_HID_Descriptor_HID_t Joystick_HID; USB_Descriptor_Endpoint_t Joystick_INEndpoint; #endif + +#if defined(DIGITIZER_ENABLE) && !defined(DIGITIZER_SHARED_EP) + // Digitizer HID Interface + USB_Descriptor_Interface_t Digitizer_Interface; + USB_HID_Descriptor_HID_t Digitizer_HID; + USB_Descriptor_Endpoint_t Digitizer_INEndpoint; +#endif } USB_Descriptor_Configuration_t; /* @@ -193,6 +200,10 @@ enum usb_interfaces { #if defined(JOYSTICK_ENABLE) JOYSTICK_INTERFACE, #endif + +#if defined(DIGITIZER_ENABLE) && !defined(DIGITIZER_SHARED_EP) + DIGITIZER_INTERFACE, +#endif TOTAL_INTERFACES }; @@ -239,7 +250,7 @@ enum usb_endpoints { # if STM32_USB_USE_OTG1 # define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM # else - CONSOLE_OUT_EPNUM = NEXT_EPNUM, + CONSOLE_OUT_EPNUM = NEXT_EPNUM, # endif # else # define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM @@ -280,6 +291,19 @@ enum usb_endpoints { JOYSTICK_OUT_EPNUM = NEXT_EPNUM, # endif #endif + +#ifdef DIGITIZER_ENABLE +# if !defined(DIGITIZER_SHARED_EP) + DIGITIZER_IN_EPNUM = NEXT_EPNUM, +# if STM32_USB_USE_OTG1 + DIGITIZER_OUT_EPNUM = DIGITIZER_IN_EPNUM, +# else + DIGITIZER_OUT_EPNUM = NEXT_EPNUM, +# endif +# else +# define DIGITIZER_IN_EPNUM SHARED_IN_EPNUM +# endif +#endif }; #ifdef PROTOCOL_LUFA @@ -306,5 +330,6 @@ enum usb_endpoints { #define CDC_EPSIZE 16 #define WEBUSB_EPSIZE 64 #define JOYSTICK_EPSIZE 8 +#define DIGITIZER_EPSIZE 8 uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const void** const DescriptorAddress); diff --git a/tmk_core/protocol/usb_descriptor_common.h b/tmk_core/protocol/usb_descriptor_common.h index b1f602c82e..ce0cf09763 100644 --- a/tmk_core/protocol/usb_descriptor_common.h +++ b/tmk_core/protocol/usb_descriptor_common.h @@ -16,6 +16,10 @@ #pragma once +// Prefix string literal with L for descriptors +#define USBCONCAT(a, b) a##b +#define USBSTR(s) USBCONCAT(L, s) + ///////////////////// // RAW Usage page and ID configuration diff --git a/tmk_core/protocol/usb_hid.mk b/tmk_core/protocol/usb_hid.mk index e720080979..c0c157c043 100644 --- a/tmk_core/protocol/usb_hid.mk +++ b/tmk_core/protocol/usb_hid.mk @@ -1,10 +1,10 @@ USB_HID_DIR = protocol/usb_hid - +USB_HOST_LIB_DIR = $(LIB_PATH)/usbhost # # USB Host Shield # -USB_HOST_SHIELD_DIR = $(USB_HID_DIR)/USB_Host_Shield_2.0 +USB_HOST_SHIELD_DIR = $(USB_HOST_LIB_DIR)/USB_Host_Shield_2.0 USB_HOST_SHIELD_SRC = \ $(USB_HOST_SHIELD_DIR)/Usb.cpp \ $(USB_HOST_SHIELD_DIR)/hid.cpp \ @@ -17,7 +17,7 @@ USB_HOST_SHIELD_SRC = \ # # Arduino # -ARDUINO_DIR = $(USB_HID_DIR)/arduino-1.0.1 +ARDUINO_DIR = $(USB_HOST_LIB_DIR)/arduino-1.0.1 ARDUINO_CORES_DIR = $(ARDUINO_DIR)/cores/arduino ARDUINO_CORES_SRC = \ $(ARDUINO_CORES_DIR)/Print.cpp \ @@ -58,13 +58,13 @@ OPT_DEFS += -DARDUINO=101 # Search Path # VPATH += $(TMK_DIR)/$(USB_HID_DIR) -VPATH += $(TMK_DIR)/$(USB_HOST_SHIELD_DIR) +VPATH += $(USB_HOST_SHIELD_DIR) # for #include "Arduino.h" -VPATH += $(TMK_DIR)/$(ARDUINO_CORES_DIR) +VPATH += $(ARDUINO_CORES_DIR) # for #include "pins_arduino.h" -VPATH += $(TMK_DIR)/$(ARDUINO_DIR)/variants/leonardo +VPATH += $(ARDUINO_DIR)/variants/leonardo # ad hoc workaround for compile problem on Windows: # Windows doesn't know difference between common/print.h and arduino/Print.h. diff --git a/tmk_core/protocol/vusb.mk b/tmk_core/protocol/vusb.mk index e4d013b38d..5572597e21 100644 --- a/tmk_core/protocol/vusb.mk +++ b/tmk_core/protocol/vusb.mk @@ -3,7 +3,7 @@ VUSB_DIR = protocol/vusb # Path to the V-USB library VUSB_PATH = $(LIB_PATH)/vusb -SRC += $(VUSB_DIR)/main.c \ +SRC += $(VUSB_DIR)/protocol.c \ $(VUSB_DIR)/vusb.c \ $(VUSB_DIR)/usb_util.c \ $(VUSB_PATH)/usbdrv/usbdrv.c \ diff --git a/tmk_core/protocol/vusb/main.c b/tmk_core/protocol/vusb/protocol.c index 53926a7493..89dc795b21 100644 --- a/tmk_core/protocol/vusb/main.c +++ b/tmk_core/protocol/vusb/protocol.c @@ -99,14 +99,11 @@ static void vusb_wakeup(void) { */ static void setup_usb(void) { initForUsbConnectivity(); } -/** \brief Main - * - * FIXME: Needs doc - */ -int main(void) __attribute__((weak)); -int main(void) { +uint16_t sof_timer = 0; + +void protocol_setup(void) { #if USB_COUNT_SOF - uint16_t sof_timer = timer_read(); + sof_timer = timer_read(); #endif #ifdef CLKPR @@ -115,9 +112,14 @@ int main(void) { clock_prescale_set(clock_div_1); #endif keyboard_setup(); +} + +void protocol_init(void) { setup_usb(); sei(); + keyboard_init(); + host_set_driver(vusb_driver()); wait_ms(50); @@ -125,55 +127,52 @@ int main(void) { #ifdef SLEEP_LED_ENABLE sleep_led_init(); #endif +} - while (1) { +void protocol_task(void) { #if USB_COUNT_SOF - if (usbSofCount != 0) { - usbSofCount = 0; - sof_timer = timer_read(); - if (vusb_suspended) { - vusb_wakeup(); - } - } else { - // Suspend when no SOF in 3ms-10ms(7.1.7.4 Suspending of USB1.1) - if (!vusb_suspended && timer_elapsed(sof_timer) > 5) { - vusb_suspend(); - } - } -#endif + if (usbSofCount != 0) { + usbSofCount = 0; + sof_timer = timer_read(); if (vusb_suspended) { + vusb_wakeup(); + } + } else { + // Suspend when no SOF in 3ms-10ms(7.1.7.4 Suspending of USB1.1) + if (!vusb_suspended && timer_elapsed(sof_timer) > 5) { vusb_suspend(); - if (suspend_wakeup_condition()) { - vusb_send_remote_wakeup(); - } - } else { - usbPoll(); - - // TODO: configuration process is inconsistent. it sometime fails. - // To prevent failing to configure NOT scan keyboard during configuration - if (usbConfiguration && usbInterruptIsReady()) { - keyboard_task(); - } - vusb_transfer_keyboard(); + } + } +#endif + if (vusb_suspended) { + vusb_suspend(); + if (suspend_wakeup_condition()) { + vusb_send_remote_wakeup(); + } + } else { + usbPoll(); + + // TODO: configuration process is inconsistent. it sometime fails. + // To prevent failing to configure NOT scan keyboard during configuration + if (usbConfiguration && usbInterruptIsReady()) { + keyboard_task(); + } + vusb_transfer_keyboard(); #ifdef RAW_ENABLE - usbPoll(); + usbPoll(); - if (usbConfiguration && usbInterruptIsReady3()) { - raw_hid_task(); - } + if (usbConfiguration && usbInterruptIsReady3()) { + raw_hid_task(); + } #endif #ifdef CONSOLE_ENABLE - usbPoll(); + usbPoll(); - if (usbConfiguration && usbInterruptIsReady3()) { - console_task(); - } -#endif - - // Run housekeeping - housekeeping_task(); + if (usbConfiguration && usbInterruptIsReady3()) { + console_task(); } +#endif } } diff --git a/tmk_core/protocol/vusb/usb_util.c b/tmk_core/protocol/vusb/usb_util.c index 602854dbe6..4ee2d3188b 100644 --- a/tmk_core/protocol/vusb/usb_util.c +++ b/tmk_core/protocol/vusb/usb_util.c @@ -16,7 +16,7 @@ #include <usbdrv/usbdrv.h> #include "usb_util.h" -void usb_disable(void) { usbDeviceDisconnect(); } +void usb_disconnect(void) { usbDeviceDisconnect(); } bool usb_connected_state(void) { usbPoll(); diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c index 9362fbde78..485b20c900 100644 --- a/tmk_core/protocol/vusb/vusb.c +++ b/tmk_core/protocol/vusb/vusb.c @@ -272,7 +272,8 @@ static void send_extra(uint8_t report_id, uint16_t data) { last_id = report_id; last_data = data; - report_extra_t report = {.report_id = report_id, .usage = data}; + static report_extra_t report; + report = (report_extra_t){.report_id = report_id, .usage = data}; if (usbInterruptIsReadyShared()) { usbSetInterruptShared((void *)&report, sizeof(report_extra_t)); } @@ -291,6 +292,14 @@ static void send_consumer(uint16_t data) { #endif } +void send_digitizer(report_digitizer_t *report) { +#ifdef DIGITIZER_ENABLE + if (usbInterruptIsReadyShared()) { + usbSetInterruptShared((void *)report, sizeof(report_digitizer_t)); + } +#endif +} + /*------------------------------------------------------------------* * Request from host * *------------------------------------------------------------------*/ @@ -509,8 +518,46 @@ const PROGMEM uchar shared_hid_report[] = { 0x95, 0x01, // Report Count (1) 0x75, 0x10, // Report Size (16) 0x81, 0x00, // Input (Data, Array, Absolute) - 0xC0 // End Collection + 0xC0, // End Collection +#endif + +#ifdef DIGITIZER_ENABLE + // Digitizer report descriptor + 0x05, 0x0D, // Usage Page (Digitizers) + 0x09, 0x01, // Usage (Digitizer) + 0xA1, 0x01, // Collection (Application) + 0x85, REPORT_ID_DIGITIZER, // Report ID + 0x09, 0x22, // Usage (Finger) + 0xA1, 0x00, // Collection (Physical) + // Tip Switch (1 bit) + 0x09, 0x42, // Usage (Tip Switch) + 0x15, 0x00, // Logical Minimum + 0x25, 0x01, // Logical Maximum + 0x95, 0x01, // Report Count (1) + 0x75, 0x01, // Report Size (16) + 0x81, 0x02, // Input (Data, Variable, Absolute) + // In Range (1 bit) + 0x09, 0x32, // Usage (In Range) + 0x81, 0x02, // Input (Data, Variable, Absolute) + // Padding (6 bits) + 0x95, 0x06, // Report Count (6) + 0x81, 0x03, // Input (Constant) + + // X/Y Position (4 bytes) + 0x05, 0x01, // Usage Page (Generic Desktop) + 0x26, 0xFF, 0x7F, // Logical Maximum (32767) + 0x95, 0x01, // Report Count (1) + 0x75, 0x10, // Report Size (16) + 0x65, 0x33, // Unit (Inch, English Linear) + 0x55, 0x0E, // Unit Exponent (-2) + 0x09, 0x30, // Usage (X) + 0x81, 0x02, // Input (Data, Variable, Absolute) + 0x09, 0x31, // Usage (Y) + 0x81, 0x02, // Input (Data, Variable, Absolute) + 0xC0, // End Collection + 0xC0 // End Collection #endif + #ifdef SHARED_EP_ENABLE }; #endif @@ -598,10 +645,10 @@ const PROGMEM usbStringDescriptor_t usbStringDescriptorProduct = { #if defined(SERIAL_NUMBER) const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = { .header = { - .bLength = USB_STRING_LEN(sizeof(STR(SERIAL_NUMBER)) - 1), + .bLength = USB_STRING_LEN(sizeof(SERIAL_NUMBER) - 1), .bDescriptorType = USBDESCR_STRING }, - .bString = LSTR(SERIAL_NUMBER) + .bString = USBSTR(SERIAL_NUMBER) }; #endif diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index fc2dc68be2..5a629d1eb0 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -105,7 +105,10 @@ endif #CFLAGS += -Wundef #CFLAGS += -Wunreachable-code #CFLAGS += -Wsign-compare +GCC_VERSION := $(shell gcc --version 2>/dev/null) +ifeq ($(findstring clang, ${GCC_VERSION}),) CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) +endif CFLAGS += $(CSTANDARD) # This fixes lots of keyboards linking errors but SHOULDN'T BE A FINAL SOLUTION @@ -137,7 +140,9 @@ endif #CXXFLAGS += -Wstrict-prototypes #CXXFLAGS += -Wunreachable-code #CXXFLAGS += -Wsign-compare +ifeq ($(findstring clang, ${GCC_VERSION}),) CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) +endif #CXXFLAGS += $(CSTANDARD) #---------------- Assembler Options ---------------- @@ -150,11 +155,13 @@ CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) # -listing-cont-lines: Sets the maximum number of continuation lines of hex # dump that will be displayed for a given single line of source input. ASFLAGS += $(ADEFS) +ifeq ($(findstring clang, ${GCC_VERSION}),) ifeq ($(strip $(DEBUG_ENABLE)),yes) ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100 else ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100 endif +endif ifeq ($(VERBOSE_AS_CMD),yes) ASFLAGS += -v endif @@ -458,7 +465,7 @@ ifeq ($(findstring avr-gcc,$(CC)),avr-gcc) SIZE_MARGIN = 1024 check-size: - $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0)) + $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) -D__ASSEMBLER__ $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0)) $(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi)) $(eval FREE_SIZE=$(shell expr $(MAX_SIZE) - $(CURRENT_SIZE))) $(eval OVER_SIZE=$(shell expr $(CURRENT_SIZE) - $(MAX_SIZE))) @@ -472,12 +479,12 @@ check-size: $(PRINT_WARNING_PLAIN); printf " * $(MSG_FILE_NEAR_LIMIT)"; \ else \ $(PRINT_OK); $(SILENT) || printf " * $(MSG_FILE_JUST_RIGHT)"; \ - fi \ - fi \ + fi ; \ + fi ; \ fi else check-size: - $(SILENT) || echo "(Firmware size check does not yet support $(MCU) microprocessors; skipping.)" + $(SILENT) || echo "$(MSG_CHECK_FILESIZE_SKIPPED)" endif check-md5: diff --git a/util/bootloader_at90usb128_1.0.1.hex b/util/bootloader_at90usb128_1.0.1.hex index 90491a82a6..5ecbed2880 100644 --- a/util/bootloader_at90usb128_1.0.1.hex +++ b/util/bootloader_at90usb128_1.0.1.hex @@ -269,7 +269,7 @@ :10F11A002A2F0C946CF00E9451F780E090E0A0E056 :10F12A00B0E08C019D010E94BEF780509F4FAF4F07 :10F13A00BF4F8F3F0FED900701E0A007B80788F394 -:10F14A00E4E00C9462F712010020FE010020EB03B8 +:10F14A00E4E00C9462F712010002FF010020EB03D5 :10F15A00FB2F0000010203010902120001010080D5 :10F16A00320904000000000000000C0341005400B2 :10F17A004D0045004C001E03410054003900300088 diff --git a/util/bootloader_at90usb64_1.0.0.hex b/util/bootloader_at90usb64_1.0.0.hex index 69dd45bbd6..5b443d7195 100644 --- a/util/bootloader_at90usb64_1.0.0.hex +++ b/util/bootloader_at90usb64_1.0.0.hex @@ -1,7 +1,7 @@ :020000020000FC :04F000000C94B97E35 :04F028000C94C77D00 -:10F08B0012010020FE010020EB03F92F000000000D +:10F08B0012010002FF010020EB03F92F000000002A :10F09B000001090212000101008032090400000086 :04F0AB000000000061 :10F0B0000000827E0800717E747E767E787E7A7E85 diff --git a/util/chibios_conf_updater.sh b/util/chibios_conf_updater.sh index 70bd80da1e..5ba8aa677b 100755 --- a/util/chibios_conf_updater.sh +++ b/util/chibios_conf_updater.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -eEuo pipefail umask 022 diff --git a/util/docker_build.sh b/util/docker_build.sh index 2c2a26e776..368b0f13fc 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -81,5 +81,5 @@ fi -e ALT_GET_KEYBOARDS=true \ -e SKIP_GIT="$SKIP_GIT" \ -e MAKEFLAGS="$MAKEFLAGS" \ - qmkfm/base_container \ + qmkfm/qmk_cli \ make "$keyboard${keymap:+:$keymap}${target:+:$target}" diff --git a/util/generate_internal_docs.sh b/util/generate_internal_docs.sh index bfee797d3a..b107a37ad6 100755 --- a/util/generate_internal_docs.sh +++ b/util/generate_internal_docs.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -x diff --git a/util/install/arch.sh b/util/install/arch.sh index eac4ad64ef..bef98ac37f 100755 --- a/util/install/arch.sh +++ b/util/install/arch.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash _qmk_install() { echo "Installing dependencies" diff --git a/util/install/debian.sh b/util/install/debian.sh index 9e12996976..57588e371a 100755 --- a/util/install/debian.sh +++ b/util/install/debian.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true diff --git a/util/install/fedora.sh b/util/install/fedora.sh index 3f9695356c..e123447d3f 100755 --- a/util/install/fedora.sh +++ b/util/install/fedora.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash _qmk_install() { echo "Installing dependencies" diff --git a/util/install/freebsd.sh b/util/install/freebsd.sh index d9399a5de9..595911969d 100755 --- a/util/install/freebsd.sh +++ b/util/install/freebsd.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash _qmk_install_prepare() { sudo pkg update $SKIP_PROMPT diff --git a/util/install/gentoo.sh b/util/install/gentoo.sh index 604d07bf84..b031fc7629 100755 --- a/util/install/gentoo.sh +++ b/util/install/gentoo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash _qmk_install_prepare() { echo "This script will make a USE change in order to ensure that that QMK works on your system." diff --git a/util/install/linux_shared.sh b/util/install/linux_shared.sh index cb81e8611f..e060f425f5 100755 --- a/util/install/linux_shared.sh +++ b/util/install/linux_shared.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # For those distros that do not package bootloadHID _qmk_install_bootloadhid() { diff --git a/util/install/macos.sh b/util/install/macos.sh index 4b87217ba0..870b4bec94 100755 --- a/util/install/macos.sh +++ b/util/install/macos.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash _qmk_install_prepare() { echo "Checking Homebrew installation" @@ -9,7 +9,7 @@ _qmk_install_prepare() { return 1 fi - brew update && brew upgrade --ignore-pinned + brew update && brew upgrade --formulae --ignore-pinned } _qmk_install() { diff --git a/util/install/msys2.sh b/util/install/msys2.sh index b027ff53d2..203f8eff0c 100755 --- a/util/install/msys2.sh +++ b/util/install/msys2.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash _qmk_install_prepare() { pacman -Syu $MSYS2_CONFIRM diff --git a/util/install/slackware.sh b/util/install/slackware.sh index d73303159d..df4d073e7b 100755 --- a/util/install/slackware.sh +++ b/util/install/slackware.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash _qmk_install_prepare() { echo "Before you continue, please ensure that your user is added to sudoers and that sboinstall is configured." diff --git a/util/install/solus.sh b/util/install/solus.sh index 5633f7039c..fad0605cf6 100755 --- a/util/install/solus.sh +++ b/util/install/solus.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash _qmk_install_prepare() { sudo eopkg -y update-repo diff --git a/util/install/void.sh b/util/install/void.sh index c49c3ef63f..6aeb8e00ae 100755 --- a/util/install/void.sh +++ b/util/install/void.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash _qmk_install() { echo "Installing dependencies" diff --git a/util/new_keyboard.sh b/util/new_keyboard.sh index cf3339f9a7..62e8cb9e13 100755 --- a/util/new_keyboard.sh +++ b/util/new_keyboard.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/usr/bin/env bash # This script generates a new keyboard directory under keyboards/, -# and copies the template files from quantum/template/ into it. +# and copies the template files from data/templates/ into it. # Print an error message with the word "ERROR" in red. echo_error() { @@ -35,11 +35,11 @@ copy_templates() { mkdir -p "$keyboard_dir" echo -n "Copying base template files..." - cp -r "quantum/template/base/." "${keyboard_dir}" + cp -r "data/templates/base/." "${keyboard_dir}" echo " done" echo -n "Copying $keyboard_type template files..." - cp -r "quantum/template/${keyboard_type}/." "${keyboard_dir}" + cp -r "data/templates/${keyboard_type}/." "${keyboard_dir}" echo " done" echo -n "Renaming keyboard files..." @@ -129,6 +129,12 @@ if [ ! -d "quantum" ]; then exit 1 fi +echo_bold "########################################" +echo_bold "# NOTICE #" +echo_bold "# This script has been deprecated. #" +echo_bold "# Please use qmk new-keyboard instead. #" +echo_bold "########################################" +echo echo_bold "Generating a new QMK keyboard directory" echo diff --git a/nix/poetry.lock b/util/nix/poetry.lock index 1a1aefe21a..9bb0f64deb 100644 --- a/nix/poetry.lock +++ b/util/nix/poetry.lock @@ -43,7 +43,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" name = "coverage" version = "5.5" description = "Code coverage measurement for Python" -category = "main" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" @@ -51,21 +51,10 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" toml = ["toml"] [[package]] -name = "dotty-dict" -version = "1.3.0" -description = "Dictionary wrapper for quick access to deeply nested keys." -category = "main" -optional = false -python-versions = "*" - -[package.dependencies] -setuptools_scm = "*" - -[[package]] name = "flake8" version = "3.9.2" description = "the modular source code checker: pep8 pyflakes and co" -category = "main" +category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" @@ -151,13 +140,13 @@ colorama = ">=0.3.9" name = "mccabe" version = "0.6.1" description = "McCabe checker, plugin for flake8" -category = "main" +category = "dev" optional = false python-versions = "*" [[package]] name = "milc" -version = "1.4.2" +version = "1.6.2" description = "Opinionated Batteries-Included Python 3 CLI Framework." category = "main" optional = false @@ -174,7 +163,7 @@ spinners = "*" name = "nose2" version = "0.10.0" description = "unittest2 with plugins, the succesor to nose" -category = "main" +category = "dev" optional = false python-versions = "*" @@ -188,20 +177,21 @@ dev = ["Sphinx (>=1.6.5)", "sphinx-rtd-theme", "mock", "coverage"] [[package]] name = "pep8-naming" -version = "0.11.1" +version = "0.12.1" description = "Check PEP-8 naming conventions, plugin for flake8" category = "dev" optional = false python-versions = "*" [package.dependencies] +flake8 = ">=3.9.1" flake8-polyfill = ">=1.0.2,<2" [[package]] name = "pycodestyle" version = "2.7.0" description = "Python style guide checker" -category = "main" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" @@ -209,13 +199,13 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" name = "pyflakes" version = "2.3.1" description = "passive checker of Python programs" -category = "main" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "pygments" -version = "2.9.0" +version = "2.10.0" description = "Pygments is a syntax highlighting package written in Python." category = "main" optional = false @@ -223,50 +213,44 @@ python-versions = ">=3.5" [[package]] name = "pyrsistent" -version = "0.17.3" +version = "0.18.0" description = "Persistent/Functional/Immutable data structures" category = "main" optional = false -python-versions = ">=3.5" +python-versions = ">=3.6" [[package]] name = "pyusb" -version = "1.1.1" +version = "1.2.1" description = "Python USB access module" category = "main" optional = false -python-versions = "*" +python-versions = ">=3.6.0" [[package]] name = "qmk" -version = "0.0.51" +version = "1.0.0" description = "A program to help users work with QMK Firmware." category = "main" optional = false -python-versions = ">=3.7" +python-versions = "*" [package.dependencies] -dotty-dict = "*" -flake8 = "*" hid = "*" hjson = "*" jsonschema = ">=3" -milc = ">=1.4.0" -nose2 = "*" +milc = ">=1.4.2" pygments = "*" pyusb = "*" -yapf = "*" +qmk-dotty-dict = "*" [[package]] -name = "setuptools-scm" -version = "6.0.1" -description = "the blessed package to manage your versions by scm tags" +name = "qmk-dotty-dict" +version = "1.3.0.post1" +description = "Dictionary wrapper for quick access to deeply nested keys." category = "main" optional = false -python-versions = ">=3.6" - -[package.extras] -toml = ["toml"] +python-versions = "*" [[package]] name = "six" @@ -294,16 +278,16 @@ python-versions = "*" [[package]] name = "yapf" -version = "0.30.0" +version = "0.31.0" description = "A formatter for Python code." -category = "main" +category = "dev" optional = false python-versions = "*" [metadata] lock-version = "1.1" python-versions = "^3.8" -content-hash = "5e181d51536240d08c74ba6a46bd0988ee4ca72ac3d5b388965ca8023e9b9a99" +content-hash = "468ae51aaddfe2ce62938f131c688bbc447e41608d4dd7d30db36391c38bda20" [metadata.files] appdirs = [ @@ -376,9 +360,6 @@ coverage = [ {file = "coverage-5.5-pp37-none-any.whl", hash = "sha256:2a3859cb82dcbda1cfd3e6f71c27081d18aa251d20a17d87d26d4cd216fb0af4"}, {file = "coverage-5.5.tar.gz", hash = "sha256:ebe78fe9a0e874362175b02371bdfbee64d8edc42a044253ddf4ee7d3c15212c"}, ] -dotty-dict = [ - {file = "dotty_dict-1.3.0.tar.gz", hash = "sha256:eb0035a3629ecd84397a68f1f42f1e94abd1c34577a19cd3eacad331ee7cbaf0"}, -] flake8 = [ {file = "flake8-3.9.2-py2.py3-none-any.whl", hash = "sha256:bf8fd333346d844f616e8d47905ef3a3384edae6b4e9beb0c5101e25e3110907"}, {file = "flake8-3.9.2.tar.gz", hash = "sha256:07528381786f2a6237b061f6e96610a4167b226cb926e2aa2b6b1d78057c576b"}, @@ -412,16 +393,16 @@ mccabe = [ {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, ] milc = [ - {file = "milc-1.4.2-py2.py3-none-any.whl", hash = "sha256:65ee004caa769b1ee144b15be7908d1f623920ab6f356e5c5c95be9457aa15d8"}, - {file = "milc-1.4.2.tar.gz", hash = "sha256:c6b2f19e3196b00a0060f8c883533e356f2054a9f81692b7b97ccee0d01626fd"}, + {file = "milc-1.6.2-py2.py3-none-any.whl", hash = "sha256:cb26404c7f3d6797c9c42005de732161e45e21294cde85845e914b279321bdad"}, + {file = "milc-1.6.2.tar.gz", hash = "sha256:779710a0b9300bef3c5748158887e6c734659e147d55548d9e4701d7a7d5dddf"}, ] nose2 = [ {file = "nose2-0.10.0-py2.py3-none-any.whl", hash = "sha256:aa620e759f2c5018d9ba041340391913e282ecebd3c392027f1575847b093ec6"}, {file = "nose2-0.10.0.tar.gz", hash = "sha256:886ba617a96de0130c54b24479bd5c2d74d5c940d40f3809c3a275511a0c4a60"}, ] pep8-naming = [ - {file = "pep8-naming-0.11.1.tar.gz", hash = "sha256:a1dd47dd243adfe8a83616e27cf03164960b507530f155db94e10b36a6cd6724"}, - {file = "pep8_naming-0.11.1-py2.py3-none-any.whl", hash = "sha256:f43bfe3eea7e0d73e8b5d07d6407ab47f2476ccaeff6937c84275cd30b016738"}, + {file = "pep8-naming-0.12.1.tar.gz", hash = "sha256:bb2455947757d162aa4cad55dba4ce029005cd1692f2899a21d51d8630ca7841"}, + {file = "pep8_naming-0.12.1-py2.py3-none-any.whl", hash = "sha256:4a8daeaeb33cfcde779309fc0c9c0a68a3bbe2ad8a8308b763c5068f86eb9f37"}, ] pycodestyle = [ {file = "pycodestyle-2.7.0-py2.py3-none-any.whl", hash = "sha256:514f76d918fcc0b55c6680472f0a37970994e07bbb80725808c17089be302068"}, @@ -432,23 +413,43 @@ pyflakes = [ {file = "pyflakes-2.3.1.tar.gz", hash = "sha256:f5bc8ecabc05bb9d291eb5203d6810b49040f6ff446a756326104746cc00c1db"}, ] pygments = [ - {file = "Pygments-2.9.0-py3-none-any.whl", hash = "sha256:d66e804411278594d764fc69ec36ec13d9ae9147193a1740cd34d272ca383b8e"}, - {file = "Pygments-2.9.0.tar.gz", hash = "sha256:a18f47b506a429f6f4b9df81bb02beab9ca21d0a5fee38ed15aef65f0545519f"}, + {file = "Pygments-2.10.0-py3-none-any.whl", hash = "sha256:b8e67fe6af78f492b3c4b3e2970c0624cbf08beb1e493b2c99b9fa1b67a20380"}, + {file = "Pygments-2.10.0.tar.gz", hash = "sha256:f398865f7eb6874156579fdf36bc840a03cab64d1cde9e93d68f46a425ec52c6"}, ] pyrsistent = [ - {file = "pyrsistent-0.17.3.tar.gz", hash = "sha256:2e636185d9eb976a18a8a8e96efce62f2905fea90041958d8cc2a189756ebf3e"}, + {file = "pyrsistent-0.18.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f4c8cabb46ff8e5d61f56a037974228e978f26bfefce4f61a4b1ac0ba7a2ab72"}, + {file = "pyrsistent-0.18.0-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:da6e5e818d18459fa46fac0a4a4e543507fe1110e808101277c5a2b5bab0cd2d"}, + {file = "pyrsistent-0.18.0-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:5e4395bbf841693eaebaa5bb5c8f5cdbb1d139e07c975c682ec4e4f8126e03d2"}, + {file = "pyrsistent-0.18.0-cp36-cp36m-win32.whl", hash = "sha256:527be2bfa8dc80f6f8ddd65242ba476a6c4fb4e3aedbf281dfbac1b1ed4165b1"}, + {file = "pyrsistent-0.18.0-cp36-cp36m-win_amd64.whl", hash = "sha256:2aaf19dc8ce517a8653746d98e962ef480ff34b6bc563fc067be6401ffb457c7"}, + {file = "pyrsistent-0.18.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:58a70d93fb79dc585b21f9d72487b929a6fe58da0754fa4cb9f279bb92369396"}, + {file = "pyrsistent-0.18.0-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:4916c10896721e472ee12c95cdc2891ce5890898d2f9907b1b4ae0f53588b710"}, + {file = "pyrsistent-0.18.0-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:73ff61b1411e3fb0ba144b8f08d6749749775fe89688093e1efef9839d2dcc35"}, + {file = "pyrsistent-0.18.0-cp37-cp37m-win32.whl", hash = "sha256:b29b869cf58412ca5738d23691e96d8aff535e17390128a1a52717c9a109da4f"}, + {file = "pyrsistent-0.18.0-cp37-cp37m-win_amd64.whl", hash = "sha256:097b96f129dd36a8c9e33594e7ebb151b1515eb52cceb08474c10a5479e799f2"}, + {file = "pyrsistent-0.18.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:772e94c2c6864f2cd2ffbe58bb3bdefbe2a32afa0acb1a77e472aac831f83427"}, + {file = "pyrsistent-0.18.0-cp38-cp38-manylinux1_i686.whl", hash = "sha256:c1a9ff320fa699337e05edcaae79ef8c2880b52720bc031b219e5b5008ebbdef"}, + {file = "pyrsistent-0.18.0-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:cd3caef37a415fd0dae6148a1b6957a8c5f275a62cca02e18474608cb263640c"}, + {file = "pyrsistent-0.18.0-cp38-cp38-win32.whl", hash = "sha256:e79d94ca58fcafef6395f6352383fa1a76922268fa02caa2272fff501c2fdc78"}, + {file = "pyrsistent-0.18.0-cp38-cp38-win_amd64.whl", hash = "sha256:a0c772d791c38bbc77be659af29bb14c38ced151433592e326361610250c605b"}, + {file = "pyrsistent-0.18.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d5ec194c9c573aafaceebf05fc400656722793dac57f254cd4741f3c27ae57b4"}, + {file = "pyrsistent-0.18.0-cp39-cp39-manylinux1_i686.whl", hash = "sha256:6b5eed00e597b5b5773b4ca30bd48a5774ef1e96f2a45d105db5b4ebb4bca680"}, + {file = "pyrsistent-0.18.0-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:48578680353f41dca1ca3dc48629fb77dfc745128b56fc01096b2530c13fd426"}, + {file = "pyrsistent-0.18.0-cp39-cp39-win32.whl", hash = "sha256:f3ef98d7b76da5eb19c37fda834d50262ff9167c65658d1d8f974d2e4d90676b"}, + {file = "pyrsistent-0.18.0-cp39-cp39-win_amd64.whl", hash = "sha256:404e1f1d254d314d55adb8d87f4f465c8693d6f902f67eb6ef5b4526dc58e6ea"}, + {file = "pyrsistent-0.18.0.tar.gz", hash = "sha256:773c781216f8c2900b42a7b638d5b517bb134ae1acbebe4d1e8f1f41ea60eb4b"}, ] pyusb = [ - {file = "pyusb-1.1.1-py3-none-any.whl", hash = "sha256:f18eb813d3a1439918071234589162c2f209a19adbeffeb1377ce078a4aebc70"}, - {file = "pyusb-1.1.1.tar.gz", hash = "sha256:7d449ad916ce58aff60b89aae0b65ac130f289c24d6a5b7b317742eccffafc38"}, + {file = "pyusb-1.2.1-py3-none-any.whl", hash = "sha256:2b4c7cb86dbadf044dfb9d3a4ff69fd217013dbe78a792177a3feb172449ea36"}, + {file = "pyusb-1.2.1.tar.gz", hash = "sha256:a4cc7404a203144754164b8b40994e2849fde1cfff06b08492f12fff9d9de7b9"}, ] qmk = [ - {file = "qmk-0.0.51-py2.py3-none-any.whl", hash = "sha256:5f676f389b2450b0956d7eb8e7e378d2e6690d5859a887c91876da0a5faf75ed"}, - {file = "qmk-0.0.51.tar.gz", hash = "sha256:efeef209cde1df92b9823db686d9684962cd00aae9f45ba5e3d494aa5b3c6b9a"}, + {file = "qmk-1.0.0-py2.py3-none-any.whl", hash = "sha256:63d69b97a533d91b0cfa7887e68cac7df52c6f7bddf4bf44d17ef1241d85ffff"}, + {file = "qmk-1.0.0.tar.gz", hash = "sha256:da62eec73c4548cc37b0b9be3937202dc3a301dc2f2663610ecca751a610f9ca"}, ] -setuptools-scm = [ - {file = "setuptools_scm-6.0.1-py3-none-any.whl", hash = "sha256:c3bd5f701c8def44a5c0bfe8d407bef3f80342217ef3492b951f3777bd2d915c"}, - {file = "setuptools_scm-6.0.1.tar.gz", hash = "sha256:d1925a69cb07e9b29416a275b9fadb009a23c148ace905b2fb220649a6c18e92"}, +qmk-dotty-dict = [ + {file = "qmk_dotty_dict-1.3.0.post1-py3-none-any.whl", hash = "sha256:a9cb7fc3ff9631190fee0ecac14986a0ac7b4b6892347dc9d7486a4c4ea24492"}, + {file = "qmk_dotty_dict-1.3.0.post1.tar.gz", hash = "sha256:3b611e393660bfaa6835c68e94784bae80fe07b8490978b5ecab03a0d2fc7ea2"}, ] six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, @@ -462,6 +463,6 @@ termcolor = [ {file = "termcolor-1.1.0.tar.gz", hash = "sha256:1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b"}, ] yapf = [ - {file = "yapf-0.30.0-py2.py3-none-any.whl", hash = "sha256:3abf61ba67cf603069710d30acbc88cfe565d907e16ad81429ae90ce9651e0c9"}, - {file = "yapf-0.30.0.tar.gz", hash = "sha256:3000abee4c28daebad55da6c85f3cd07b8062ce48e2e9943c8da1b9667d48427"}, + {file = "yapf-0.31.0-py2.py3-none-any.whl", hash = "sha256:e3a234ba8455fe201eaa649cdac872d590089a18b661e39bbac7020978dd9c2e"}, + {file = "yapf-0.31.0.tar.gz", hash = "sha256:408fb9a2b254c302f49db83c59f9aa0b4b0fd0ec25be3a5c51181327922ff63d"}, ] diff --git a/nix/pyproject.toml b/util/nix/pyproject.toml index a813361893..1ec8aacd4a 100644 --- a/nix/pyproject.toml +++ b/util/nix/pyproject.toml @@ -9,23 +9,27 @@ authors = [] [tool.poetry.dependencies] python = "^3.8" -appdirs = "^1.4.4" -argcomplete = "^1.12.2" -colorama = "^0.4.4" -dotty-dict = "^1.3.0" -hjson = "^3.0.2" -jsonschema = "^3.2.0" -milc = "^1.3.0" -Pygments = "^2.8.0" +appdirs = "*" +argcomplete = "*" +colorama = "*" +hid = "*" +hjson = "*" +jsonschema = ">=3" +milc = ">=1.4.2" +Pygments = "*" +pyusb = "*" +qmk-dotty-dict = "*" + +# This dependency is not mentioned in requirements.txt (QMK CLI is not a +# library package that is required by the Python code in qmk_firmware), but is +# required to build a proper nix-shell environment. qmk = "*" [tool.poetry.dev-dependencies] -nose2 = "^0.10.0" -flake8 = "^3.8.4" -hid = "^1.0.4" -pep8-naming = "^0.11.1" -pyusb = "^1.1.1" -yapf = "^0.30.0" +nose2 = "*" +flake8 = "*" +pep8-naming = "*" +yapf = "*" [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/nix/sources.json b/util/nix/sources.json index caf5cb7d29..caf5cb7d29 100644 --- a/nix/sources.json +++ b/util/nix/sources.json diff --git a/nix/sources.nix b/util/nix/sources.nix index 1938409ddd..1938409ddd 100644 --- a/nix/sources.nix +++ b/util/nix/sources.nix diff --git a/util/qmk_install.sh b/util/qmk_install.sh index 943069453a..5f22ba0ad5 100755 --- a/util/qmk_install.sh +++ b/util/qmk_install.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash -QMK_FIRMWARE_DIR=$(cd -P -- "$(dirname -- "$0")/.." && pwd -P) +QMK_FIRMWARE_DIR=$(cd -P -- "$(dirname -- "$0")/.." >/dev/null && pwd -P) QMK_FIRMWARE_UTIL_DIR=$QMK_FIRMWARE_DIR/util if [ "$1" = "-y" ]; then SKIP_PROMPT='-y' diff --git a/quantum/tools/eeprom_reset.hex b/util/reset.eep index a8a75389fe..a8a75389fe 100644 --- a/quantum/tools/eeprom_reset.hex +++ b/util/reset.eep diff --git a/util/rules_cleaner.sh b/util/rules_cleaner.sh index ac27c2b09b..0367ae849f 100755 --- a/util/rules_cleaner.sh +++ b/util/rules_cleaner.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This script finds all rules.mk files in keyboards/ subdirectories, # and deletes the build option filesize impacts from them. diff --git a/util/stm32eeprom_parser.py b/util/stm32eeprom_parser.py new file mode 100755 index 0000000000..e08b67064b --- /dev/null +++ b/util/stm32eeprom_parser.py @@ -0,0 +1,316 @@ +#!/usr/bin/env python +# +# Copyright 2021 Don Kjer +# +# 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/>. +# + +from __future__ import print_function + +import argparse +from struct import pack, unpack +import os, sys + +MAGIC_FEEA = '\xea\xff\xfe\xff' + +MAGIC_FEE9 = '\x16\x01' +EMPTY_WORD = '\xff\xff' +WORD_ENCODING = 0x8000 +VALUE_NEXT = 0x6000 +VALUE_RESERVED = 0x4000 +VALUE_ENCODED = 0x2000 +BYTE_RANGE = 0x80 + +CHUNK_SIZE = 1024 + +STRUCT_FMTS = { + 1: 'B', + 2: 'H', + 4: 'I' +} +PRINTABLE='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ ' + +EECONFIG_V1 = [ + ("MAGIC", 0, 2), + ("DEBUG", 2, 1), + ("DEFAULT_LAYER", 3, 1), + ("KEYMAP", 4, 1), + ("MOUSEKEY_ACCEL", 5, 1), + ("BACKLIGHT", 6, 1), + ("AUDIO", 7, 1), + ("RGBLIGHT", 8, 4), + ("UNICODEMODE", 12, 1), + ("STENOMODE", 13, 1), + ("HANDEDNESS", 14, 1), + ("KEYBOARD", 15, 4), + ("USER", 19, 4), + ("VELOCIKEY", 23, 1), + ("HAPTIC", 24, 4), + ("MATRIX", 28, 4), + ("MATRIX_EXTENDED", 32, 2), + ("KEYMAP_UPPER_BYTE", 34, 1), +] +VIABASE_V1 = 35 + +VERBOSE = False + +def parseArgs(): + parser = argparse.ArgumentParser(description='Decode an STM32 emulated eeprom dump') + parser.add_argument('-s', '--size', type=int, + help='Size of the emulated eeprom (default: input_size / 2)') + parser.add_argument('-o', '--output', help='File to write decoded eeprom to') + parser.add_argument('-y', '--layout-options-size', type=int, + help='VIA layout options size (default: 1)', default=1) + parser.add_argument('-t', '--custom-config-size', type=int, + help='VIA custom config size (default: 0)', default=0) + parser.add_argument('-l', '--layers', type=int, + help='VIA keyboard layers (default: 4)', default=4) + parser.add_argument('-r', '--rows', type=int, help='VIA matrix rows') + parser.add_argument('-c', '--cols', type=int, help='VIA matrix columns') + parser.add_argument('-m', '--macros', type=int, + help='VIA macro count (default: 16)', default=16) + parser.add_argument('-C', '--canonical', action='store_true', + help='Canonical hex+ASCII display.') + parser.add_argument('-v', '--verbose', action='store_true', help='Verbose output') + parser.add_argument('input', help='Raw contents of the STM32 flash area used to emulate eeprom') + return parser.parse_args() + + +def decodeEepromFEEA(in_file, size): + decoded=size*[None] + pos = 0 + while True: + chunk = in_file.read(CHUNK_SIZE) + for i in range(0, len(chunk), 2): + decoded[pos] = unpack('B', chunk[i])[0] + pos += 1 + if pos >= size: + break + + if len(chunk) < CHUNK_SIZE or pos >= size: + break + return decoded + +def decodeEepromFEE9(in_file, size): + decoded=size*[None] + pos = 0 + # Read compacted flash + while True: + read_size = min(size - pos, CHUNK_SIZE) + chunk = in_file.read(read_size) + for i in range(len(chunk)): + decoded[pos] = unpack('B', chunk[i])[0] ^ 0xFF + pos += 1 + if pos >= size: + break + + if len(chunk) < read_size or pos >= size: + break + if VERBOSE: + print("COMPACTED EEPROM:") + dumpBinary(decoded, True) + print("WRITE LOG:") + # Read write log + while True: + entry = in_file.read(2) + if len(entry) < 2: + print("Partial log address at position 0x%04x" % pos, file=sys.stderr) + break + pos += 2 + + if entry == EMPTY_WORD: + break + + be_entry = unpack('>H', entry)[0] + entry = unpack('H', entry)[0] + if not (entry & WORD_ENCODING): + address = entry >> 8 + decoded[address] = entry & 0xFF + if VERBOSE: + print("[0x%04x]: BYTE 0x%02x = 0x%02x" % (be_entry, address, decoded[address])) + else: + if (entry & VALUE_NEXT) == VALUE_NEXT: + # Read next word as value + value = in_file.read(2) + if len(value) < 2: + print("Partial log value at position 0x%04x" % pos, file=sys.stderr) + break + pos += 2 + address = entry & 0x1FFF + address <<= 1 + address += BYTE_RANGE + decoded[address] = unpack('B', value[0])[0] ^ 0xFF + decoded[address+1] = unpack('B', value[1])[0] ^ 0xFF + be_value = unpack('>H', value)[0] + if VERBOSE: + print("[0x%04x 0x%04x]: WORD 0x%04x = 0x%02x%02x" % (be_entry, be_value, address, decoded[address+1], decoded[address])) + else: + # Reserved for future use + if entry & VALUE_RESERVED: + if VERBOSE: + print("[0x%04x]: RESERVED 0x%04x" % (be_entry, address)) + continue + address = entry & 0x1FFF + address <<= 1 + decoded[address] = (entry & VALUE_ENCODED) >> 13 + decoded[address+1] = 0 + if VERBOSE: + print("[0x%04x]: ENCODED 0x%04x = 0x%02x%02x" % (be_entry, address, decoded[address+1], decoded[address])) + + return decoded + +def dumpBinary(data, canonical): + def display(pos, row): + print("%04x" % pos, end='') + for i in range(len(row)): + if i % 8 == 0: + print(" ", end='') + char = row[i] + if char is None: + print(" ", end='') + else: + print(" %02x" % row[i], end='') + if canonical: + print(" |", end='') + for i in range(len(row)): + char = row[i] + if char is None: + char = " " + else: + char = chr(char) + if char not in PRINTABLE: + char = "." + print(char, end='') + print("|", end='') + + print("") + + size = len(data) + prev_row = '' + first_repeat = True + for pos in range(0, size, 16): + row=data[pos:pos+16] + row[len(row):16] = (16-len(row))*[None] + if row == prev_row: + if first_repeat: + print("*") + first_repeat = False + else: + first_repeat = True + display(pos, row) + prev_row = row + print("%04x" % (pos+16)) + +def dumpEeconfig(data, eeconfig): + print("EECONFIG:") + for (name, pos, length) in eeconfig: + fmt = STRUCT_FMTS[length] + value = unpack(fmt, ''.join([chr(x) for x in data[pos:pos+length]]))[0] + print(("%%04x %%s = 0x%%0%dx" % (length * 2)) % (pos, name, value)) + +def dumpVia(data, base, layers, cols, rows, macros, + layout_options_size, custom_config_size): + magicYear = data[base + 0] + magicMonth = data[base + 1] + magicDay = data[base + 2] + # Sanity check + if not 10 <= magicYear <= 0x99 or \ + not 0 <= magicMonth <= 0x12 or \ + not 0 <= magicDay <= 0x31: + print("ERROR: VIA Signature is not valid; Year:%x, Month:%x, Day:%x" % (magicYear, magicMonth, magicDay)) + return + if cols is None or rows is None: + print("ERROR: VIA dump requires specifying --rows and --cols", file=sys.stderr) + return 2 + print("VIA:") + # Decode magic + print("%04x MAGIC = 20%02x-%02x-%02x" % (base, magicYear, magicMonth, magicDay)) + # Decode layout options + options = 0 + pos = base + 3 + for i in range(base+3, base+3+layout_options_size): + options = options << 8 + options |= data[i] + print(("%%04x LAYOUT_OPTIONS = 0x%%0%dx" % (layout_options_size * 2)) % (pos, options)) + pos += layout_options_size + custom_config_size + # Decode keycodes + keymap_size = layers * rows * cols * 2 + if (pos + keymap_size) >= (len(data) - 1): + print("ERROR: VIA keymap requires %d bytes, but only %d available" % (keymap_size, len(data) - pos)) + return 3 + for layer in range(layers): + print("%s LAYER %d %s" % ('-'*int(cols*2.5), layer, '-'*int(cols*2.5))) + for row in range(rows): + print("%04x | " % pos, end='') + for col in range(cols): + keycode = (data[pos] << 8) | (data[pos+1]) + print(" %04x" % keycode, end='') + pos += 2 + print("") + # Decode macros + for macro_num in range(macros): + macro = "" + macro_pos = pos + while pos < len(data): + char = chr(data[pos]) + pos += 1 + if char == '\x00': + print("%04x MACRO[%d] = '%s'" % (macro_pos, macro_num, macro)) + break + else: + macro += char + return 0 + + +def decodeSTM32Eeprom(input, canonical, size=None, output=None, **kwargs): + input_size = os.path.getsize(input) + if size is None: + size = input_size >> 1 + + # Read the first few bytes to check magic signature + with open(input, 'rb') as in_file: + magic=in_file.read(4) + in_file.seek(0) + + if magic == MAGIC_FEEA: + decoded = decodeEepromFEEA(in_file, size) + eeconfig = EECONFIG_V1 + via_base = VIABASE_V1 + elif magic[:2] == MAGIC_FEE9: + decoded = decodeEepromFEE9(in_file, size) + eeconfig = EECONFIG_V1 + via_base = VIABASE_V1 + else: + print("Unknown magic signature: %s" % " ".join(["0x%02x" % ord(x) for x in magic]), file=sys.stderr) + return 1 + + if output is not None: + with open(output, 'wb') as out_file: + out_file.write(pack('%dB' % len(decoded), *decoded)) + print("DECODED EEPROM:") + dumpBinary(decoded, canonical) + dumpEeconfig(decoded, eeconfig) + if kwargs['rows'] is not None and kwargs['cols'] is not None: + return dumpVia(decoded, via_base, **kwargs) + + return 0 + +def main(): + global VERBOSE + kwargs = vars(parseArgs()) + VERBOSE = kwargs.pop('verbose') + return decodeSTM32Eeprom(**kwargs) + +if __name__ == '__main__': + sys.exit(main()) diff --git a/util/travis_utils.sh b/util/travis_utils.sh deleted file mode 100755 index e949946e22..0000000000 --- a/util/travis_utils.sh +++ /dev/null @@ -1,25 +0,0 @@ -# Use this by sourcing it in your script. - -# Provide sane defaults for travis environment -TRAVIS_BRANCH="${TRAVIS_BRANCH:master}" -TRAVIS_PULL_REQUEST="${TRAVIS_PULL_REQUEST:false}" -TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}" -TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}" - -# test force push -#TRAVIS_COMMIT_RANGE="c287f1bfc5c8...81f62atc4c1d" - -# Extra variables -LOCAL_BRANCH=$(git rev-parse --abbrev-ref HEAD) -QMK_CHANGES=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE}) -NUM_CORE_CHANGES=$(echo "$QMK_CHANGES" | grep -Ec -e '^Makefile' -e '^[^/]*.mk' -e '^drivers/' -e '^lib/atsam' -e '^lib/lib8tion/' -e '^platforms' -e '^quantum' -e '^tests' -e '^tmk_core') - -# if docker is installed - patch calls to within the qmk docker image -if command -v docker >/dev/null; then - function make() { - docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" - } - function qmk() { - docker run --rm -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container bin/qmk "$@" - } -fi diff --git a/util/udev/50-qmk.rules b/util/udev/50-qmk.rules index 679fe4ced3..db27d4dc81 100644 --- a/util/udev/50-qmk.rules +++ b/util/udev/50-qmk.rules @@ -63,3 +63,9 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="2a03", ATTRS{idProduct}=="0037", TAG+="uacc # hid_listen KERNEL=="hidraw*", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" + +# hid bootloaders +## QMK HID +SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2067", TAG+="uaccess" +## PJRC's HalfKay +SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="0478", TAG+="uaccess" diff --git a/util/uf2conv.py b/util/uf2conv.py index 044a7f2318..8677a828c9 100755 --- a/util/uf2conv.py +++ b/util/uf2conv.py @@ -78,7 +78,7 @@ def convert_from_uf2(buf): if datalen > 476: assert False, "Invalid UF2 data size at " + ptr newaddr = hd[3] - if curraddr == None: + if curraddr is None: appstartaddr = newaddr curraddr = newaddr padding = newaddr - curraddr @@ -171,7 +171,7 @@ def convert_from_hex_to_uf2(buf): break elif tp == 0: addr = upper | (rec[1] << 8) | rec[2] - if appstartaddr == None: + if appstartaddr is None: appstartaddr = addr i = 4 while i < len(rec) - 1: @@ -215,7 +215,7 @@ def get_drives(): def has_info(d): try: return os.path.isfile(d + INFO_FILE) - except: + except Exception: return False return list(filter(has_info, drives)) @@ -300,7 +300,7 @@ def main(): (ext, len(outbuf), appstartaddr)) if args.convert or ext != "uf2": drives = [] - if args.output == None: + if args.output is None: args.output = "flash." + ext else: drives = get_drives() diff --git a/util/update_chibios_mirror.sh b/util/update_chibios_mirror.sh new file mode 100755 index 0000000000..83aee22817 --- /dev/null +++ b/util/update_chibios_mirror.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +################################ +# Configuration + +# The ChibiOS branches to mirror +chibios_branches="trunk stable_20.3.x stable_21.6.x" + +# The ChibiOS tags to mirror +chibios_tags="ver20.3.1 ver20.3.2 ver20.3.3 ver21.6.0" + +# The ChibiOS-Contrib branches to mirror +contrib_branches="chibios-20.3.x" + +################################ +# Actions + +set -eEuo pipefail +umask 022 + +this_script="$(realpath "${BASH_SOURCE[0]}")" +script_dir="$(realpath "$(dirname "$this_script")")" +qmk_firmware_dir="$(realpath "$script_dir/../")" +chibios_dir="$qmk_firmware_dir/lib/chibios" +contrib_dir="$qmk_firmware_dir/lib/chibios-contrib" + +chibios_git_location=$(realpath "$chibios_dir/$(cat "$chibios_dir/.git" | awk '/gitdir:/ {print $2}')") +chibios_git_config=$(realpath "$chibios_git_location/config") +contrib_git_location=$(realpath "$contrib_dir/$(cat "$contrib_dir/.git" | awk '/gitdir:/ {print $2}')") +contrib_git_config=$(realpath "$contrib_git_location/config") + +cd "$chibios_dir" + +if [[ -z "$(cat "$chibios_git_config" | grep '\[svn-remote "svn"\]')" ]] ; then + git svn init --stdlayout --prefix='svn/' http://svn.osdn.net/svnroot/chibios/ +fi + +if [[ -z "$(cat "$chibios_git_config" | grep '\[remote "qmk"\]')" ]] ; then + git remote add qmk git@github.com:qmk/ChibiOS.git + git remote set-url qmk git@github.com:qmk/ChibiOS.git --push +else + git remote set-url qmk git@github.com:qmk/ChibiOS.git + git remote set-url qmk git@github.com:qmk/ChibiOS.git --push +fi + +echo "Updating remotes..." +git fetch --all --tags --prune + +echo "Fetching latest from subversion..." +git svn fetch + +echo "Updating ChibiOS branches..." +for branch in $chibios_branches ; do + echo "Creating branch 'svn-mirror/$branch' from 'svn/$branch'..." + git branch -f svn-mirror/$branch svn/$branch \ + && git push qmk svn-mirror/$branch +done + +echo "Updating ChibiOS tags..." +for tagname in $chibios_tags ; do + echo "Creating tag 'svn-mirror/$tagname' from 'svn/tags/$tagname'..." + GIT_COMMITTER_DATE="$(git log -n1 --pretty=format:'%ad' svn/tags/$tagname)" git tag -f -a -m "Tagging $tagname" svn-mirror/$tagname svn/tags/$tagname + git push qmk svn-mirror/$tagname +done + +cd "$contrib_dir" + +if [[ -z "$(cat "$contrib_git_config" | grep '\[remote "qmk"\]')" ]] ; then + git remote add qmk git@github.com:qmk/ChibiOS-Contrib.git + git remote set-url qmk git@github.com:qmk/ChibiOS-Contrib.git --push +else + git remote set-url qmk git@github.com:qmk/ChibiOS-Contrib.git + git remote set-url qmk git@github.com:qmk/ChibiOS-Contrib.git --push +fi + +if [[ -z "$(cat "$contrib_git_config" | grep '\[remote "upstream"\]')" ]] ; then + git remote add upstream git@github.com:ChibiOS/ChibiOS-Contrib.git + git remote set-url upstream git@github.com:ChibiOS/ChibiOS-Contrib.git --push +else + git remote set-url upstream git@github.com:ChibiOS/ChibiOS-Contrib.git + git remote set-url upstream git@github.com:ChibiOS/ChibiOS-Contrib.git --push +fi + +echo "Updating remotes..." +git fetch --all --tags --prune + +echo "Updating ChibiOS-Contrib branches..." +for branch in $contrib_branches ; do + echo "Creating branch 'mirror/$branch' from 'upstream/$branch'..." + git branch -f mirror/$branch upstream/$branch \ + && git push qmk mirror/$branch +done diff --git a/util/vagrant/Dockerfile b/util/vagrant/Dockerfile index 1936ee023a..951d4fc40d 100644 --- a/util/vagrant/Dockerfile +++ b/util/vagrant/Dockerfile @@ -1,4 +1,4 @@ -FROM qmkfm/base_container +FROM qmkfm/qmk_cli # Basic upgrades; install sudo and SSH. RUN apt-get update && apt-get install --no-install-recommends -y \ diff --git a/util/vagrant/readme.md b/util/vagrant/readme.md index e4b870a642..a8396007ee 100644 --- a/util/vagrant/readme.md +++ b/util/vagrant/readme.md @@ -1,7 +1,7 @@ # QMK Vagrant Utilities ## Dockerfile -Vagrant-friendly `qmkfm/base_container`. +Vagrant-friendly `qmkfm/qmk_cli`. In order for the Docker provider and `vagrant ssh` to function the container has a few extra requirements. |