diff options
Diffstat (limited to 'keyboards/cannonkeys')
37 files changed, 334 insertions, 1027 deletions
diff --git a/keyboards/cannonkeys/an_c/config.h b/keyboards/cannonkeys/an_c/config.h index ef480521bc..55414ba509 100644 --- a/keyboards/cannonkeys/an_c/config.h +++ b/keyboards/cannonkeys/an_c/config.h @@ -58,26 +58,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define PIN_WS2812 15 #define WS2812_SPI SPID2 - -// EEPROM usage -// TODO: refactor with new user EEPROM code (coming soon) -#define EEPROM_MAGIC 0x451F -#define EEPROM_MAGIC_ADDR 40 -// Bump this every time we change what we store -// This will automatically reset the EEPROM with defaults -// and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x03 -#define EEPROM_VERSION_ADDR 42 - - -#define DYNAMIC_KEYMAP_LAYER_COUNT 4 -// Dynamic macro starts after dynamic keymaps (35+(4*5*15*2)) = (35+600) = 635 -// start + layer * rows * col * 2 -#define DYNAMIC_KEYMAP_EEPROM_ADDR 43 -#define EEPROM_CUSTOM_BACKLIGHT 644 -#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 645 -#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 192 -#define DYNAMIC_KEYMAP_MACRO_COUNT 16 +// Backlight config starts after VIA's EEPROM usage, +// dynamic keymaps start after this. +#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1 /* * Feature disable options diff --git a/keyboards/cannonkeys/an_c/keymaps/via/rules.mk b/keyboards/cannonkeys/an_c/keymaps/via/rules.mk index d12497792d..1e5b99807c 100644 --- a/keyboards/cannonkeys/an_c/keymaps/via/rules.mk +++ b/keyboards/cannonkeys/an_c/keymaps/via/rules.mk @@ -1,5 +1 @@ -# rules.mk overrides to enable VIA - -RAW_ENABLE = yes -DYNAMIC_KEYMAP_ENABLE = yes - +VIA_ENABLE = yes diff --git a/keyboards/cannonkeys/an_c/rules.mk b/keyboards/cannonkeys/an_c/rules.mk index 2f30956e7d..151f72fd0f 100644 --- a/keyboards/cannonkeys/an_c/rules.mk +++ b/keyboards/cannonkeys/an_c/rules.mk @@ -1,35 +1,5 @@ -# project specific files -# SRC = ssd1306.c -## chip/board settings -# the next two should match the directories in -# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) -MCU_FAMILY = STM32 -MCU_SERIES = STM32F0xx -# linker script to use -# it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ -# or <this_dir>/ld/ -MCU_LDSCRIPT = STM32F072xB -# startup code to use -# is should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ -MCU_STARTUP = stm32f0xx -# it should exist either in <chibios>/os/hal/boards/ -# or <this_dir>/boards -BOARD = ST_STM32F072B_DISCOVERY -# Cortex version -# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m0 -# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 -ARMV = 6 -# If you want to be able to jump to bootloader from firmware on STM32 MCUs, -# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in -# ./bootloader_defs.h or in ./boards/<FOO>/bootloader_defs.h (if you have -# a custom board definition that you plan to reuse). -# If you're not setting it here, leave it commented out. -# It is chip dependent, the correct number can be looked up here (page 175): -# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -# This also requires a patch to chibios: -# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch -#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 +# MCU name +MCU = STM32F072 # Build Options # comment out to disable the options. @@ -40,8 +10,6 @@ VPATH += keyboards/cannonkeys/stm32f072 SRC = keyboard.c \ led.c -DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave - #BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control @@ -53,7 +21,4 @@ CUSTOM_MATRIX = no # Custom matrix file # BACKLIGHT_ENABLE = yes # This is broken on 072 for some reason RGBLIGHT_ENABLE = yes -# RAW_ENABLE = yes -# DYNAMIC_KEYMAP_ENABLE = yes - LAYOUTS = 60_ansi 60_tsangan_hhkb diff --git a/keyboards/cannonkeys/chimera65/config.h b/keyboards/cannonkeys/chimera65/config.h index ace3565bea..c76fd6c1c5 100644 --- a/keyboards/cannonkeys/chimera65/config.h +++ b/keyboards/cannonkeys/chimera65/config.h @@ -50,26 +50,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE -// EEPROM usage -// TODO: refactor with new user EEPROM code (coming soon) -#define EEPROM_MAGIC 0x451F -#define EEPROM_MAGIC_ADDR 34 -// Bump this every time we change what we store -// This will automatically reset the EEPROM with defaults -// and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x02 -#define EEPROM_VERSION_ADDR 36 - - -#define DYNAMIC_KEYMAP_LAYER_COUNT 4 -// Dynamic macro starts after dynamic keymaps (35+(4*5*15*2)) = (35+600) = 635 -// start + layer * rows * col * 2 -#define DYNAMIC_KEYMAP_EEPROM_ADDR 37 -#define EEPROM_CUSTOM_BACKLIGHT 678 -#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 679 -#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 202 -#define DYNAMIC_KEYMAP_MACRO_COUNT 16 - /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/keyboards/cannonkeys/chimera65/keymaps/via/rules.mk b/keyboards/cannonkeys/chimera65/keymaps/via/rules.mk index d12497792d..1e5b99807c 100644 --- a/keyboards/cannonkeys/chimera65/keymaps/via/rules.mk +++ b/keyboards/cannonkeys/chimera65/keymaps/via/rules.mk @@ -1,5 +1 @@ -# rules.mk overrides to enable VIA - -RAW_ENABLE = yes -DYNAMIC_KEYMAP_ENABLE = yes - +VIA_ENABLE = yes diff --git a/keyboards/cannonkeys/chimera65/rules.mk b/keyboards/cannonkeys/chimera65/rules.mk index 580a7712c6..1e300a99c7 100644 --- a/keyboards/cannonkeys/chimera65/rules.mk +++ b/keyboards/cannonkeys/chimera65/rules.mk @@ -1,35 +1,5 @@ -# project specific files -# SRC = ssd1306.c -## chip/board settings -# the next two should match the directories in -# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) -MCU_FAMILY = STM32 -MCU_SERIES = STM32F0xx -# linker script to use -# it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ -# or <this_dir>/ld/ -MCU_LDSCRIPT = STM32F072xB -# startup code to use -# is should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ -MCU_STARTUP = stm32f0xx -# it should exist either in <chibios>/os/hal/boards/ -# or <this_dir>/boards -BOARD = ST_STM32F072B_DISCOVERY -# Cortex version -# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m0 -# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 -ARMV = 6 -# If you want to be able to jump to bootloader from firmware on STM32 MCUs, -# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in -# ./bootloader_defs.h or in ./boards/<FOO>/bootloader_defs.h (if you have -# a custom board definition that you plan to reuse). -# If you're not setting it here, leave it commented out. -# It is chip dependent, the correct number can be looked up here (page 175): -# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -# This also requires a patch to chibios: -# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch -#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 +# MCU name +MCU = STM32F072 # Build Options # comment out to disable the options. @@ -40,8 +10,6 @@ VPATH += keyboards/cannonkeys/stm32f072 SRC = keyboard.c \ led.c -DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave - #BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control @@ -52,6 +20,3 @@ NKRO_ENABLE = yes # USB Nkey Rollover CUSTOM_MATRIX = no # Custom matrix file # BACKLIGHT_ENABLE = yes # This is broken on 072 for some reason RGBLIGHT_ENABLE = no - -# RAW_ENABLE = yes -# DYNAMIC_KEYMAP_ENABLE = yes diff --git a/keyboards/cannonkeys/instant60/config.h b/keyboards/cannonkeys/instant60/config.h index 9da2043d2f..2d23d5f83c 100644 --- a/keyboards/cannonkeys/instant60/config.h +++ b/keyboards/cannonkeys/instant60/config.h @@ -58,26 +58,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define PIN_WS2812 15 #define WS2812_SPI SPID2 - -// EEPROM usage -// TODO: refactor with new user EEPROM code (coming soon) -#define EEPROM_MAGIC 0x451F -#define EEPROM_MAGIC_ADDR 40 -// Bump this every time we change what we store -// This will automatically reset the EEPROM with defaults -// and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x03 -#define EEPROM_VERSION_ADDR 42 - - -#define DYNAMIC_KEYMAP_LAYER_COUNT 4 -// Dynamic macro starts after dynamic keymaps (35+(4*5*15*2)) = (35+600) = 635 -// start + layer * rows * col * 2 -#define DYNAMIC_KEYMAP_EEPROM_ADDR 43 -#define EEPROM_CUSTOM_BACKLIGHT 644 -#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 645 -#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 192 -#define DYNAMIC_KEYMAP_MACRO_COUNT 16 +// Backlight config starts after VIA's EEPROM usage, +// dynamic keymaps start after this. +#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1 /* * Feature disable options diff --git a/keyboards/cannonkeys/instant60/keymaps/via/rules.mk b/keyboards/cannonkeys/instant60/keymaps/via/rules.mk index d12497792d..1e5b99807c 100644 --- a/keyboards/cannonkeys/instant60/keymaps/via/rules.mk +++ b/keyboards/cannonkeys/instant60/keymaps/via/rules.mk @@ -1,5 +1 @@ -# rules.mk overrides to enable VIA - -RAW_ENABLE = yes -DYNAMIC_KEYMAP_ENABLE = yes - +VIA_ENABLE = yes diff --git a/keyboards/cannonkeys/instant60/keymaps/via_standard/rules.mk b/keyboards/cannonkeys/instant60/keymaps/via_standard/rules.mk index d12497792d..1e5b99807c 100644 --- a/keyboards/cannonkeys/instant60/keymaps/via_standard/rules.mk +++ b/keyboards/cannonkeys/instant60/keymaps/via_standard/rules.mk @@ -1,5 +1 @@ -# rules.mk overrides to enable VIA - -RAW_ENABLE = yes -DYNAMIC_KEYMAP_ENABLE = yes - +VIA_ENABLE = yes diff --git a/keyboards/cannonkeys/instant60/rules.mk b/keyboards/cannonkeys/instant60/rules.mk index c0a62e9433..db753884da 100644 --- a/keyboards/cannonkeys/instant60/rules.mk +++ b/keyboards/cannonkeys/instant60/rules.mk @@ -1,39 +1,5 @@ -# project specific files -# SRC = ssd1306.c -## chip/board settings -# the next two should match the directories in -# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) -MCU_FAMILY = STM32 -MCU_SERIES = STM32F0xx -# linker script to use -# it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ -# or <this_dir>/ld/ -MCU_LDSCRIPT = STM32F072xB -# startup code to use -# is should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ -MCU_STARTUP = stm32f0xx -# it should exist either in <chibios>/os/hal/boards/ -# or <this_dir>/boards -BOARD = ST_STM32F072B_DISCOVERY -# Cortex version -# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m0 -# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 -ARMV = 6 -# If you want to be able to jump to bootloader from firmware on STM32 MCUs, -# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in -# ./bootloader_defs.h or in ./boards/<FOO>/bootloader_defs.h (if you have -# a custom board definition that you plan to reuse). -# If you're not setting it here, leave it commented out. -# It is chip dependent, the correct number can be looked up here (page 175): -# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -# This also requires a patch to chibios: -# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch -#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 - -# Options to pass to dfu-util when flashing -DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave -DFU_SUFFIX_ARGS = -p DF11 -v 0483 +# MCU name +MCU = STM32F072 # Build Options # comment out to disable the options. @@ -44,7 +10,7 @@ VPATH += keyboards/cannonkeys/stm32f072 SRC = keyboard.c \ led.c -#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = yes # Console for debug @@ -55,7 +21,4 @@ CUSTOM_MATRIX = no # Custom matrix file # BACKLIGHT_ENABLE = yes # This is broken on 072 for some reason RGBLIGHT_ENABLE = yes -# RAW_ENABLE = yes -# DYNAMIC_KEYMAP_ENABLE = yes - LAYOUTS = 60_ansi 60_tsangan_hhkb diff --git a/keyboards/cannonkeys/iron165/config.h b/keyboards/cannonkeys/iron165/config.h index c5fcd4518a..640f6fb659 100644 --- a/keyboards/cannonkeys/iron165/config.h +++ b/keyboards/cannonkeys/iron165/config.h @@ -50,25 +50,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE -// EEPROM usage -// TODO: refactor with new user EEPROM code (coming soon) -#define EEPROM_MAGIC 0x451F -#define EEPROM_MAGIC_ADDR 40 -// Bump this every time we change what we store -// This will automatically reset the EEPROM with defaults -// and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x02 -#define EEPROM_VERSION_ADDR 42 - - -#define DYNAMIC_KEYMAP_LAYER_COUNT 4 -// Dynamic macro starts after dynamic keymaps (35+(4*5*15*2)) = (35+600) = 635 -// start + layer * rows * col * 2 -#define DYNAMIC_KEYMAP_EEPROM_ADDR 43 -#define EEPROM_CUSTOM_BACKLIGHT 684 -#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 685 -#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 192 -#define DYNAMIC_KEYMAP_MACRO_COUNT 16 +// Backlight config starts after VIA's EEPROM usage, +// dynamic keymaps start after this. +#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1 /* * Feature disable options diff --git a/keyboards/cannonkeys/iron165/rules.mk b/keyboards/cannonkeys/iron165/rules.mk index 5480987a33..edc84edd51 100644 --- a/keyboards/cannonkeys/iron165/rules.mk +++ b/keyboards/cannonkeys/iron165/rules.mk @@ -1,35 +1,5 @@ -# project specific files -# SRC = ssd1306.c -## chip/board settings -# the next two should match the directories in -# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) -MCU_FAMILY = STM32 -MCU_SERIES = STM32F0xx -# linker script to use -# it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ -# or <this_dir>/ld/ -MCU_LDSCRIPT = STM32F072xB -# startup code to use -# is should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ -MCU_STARTUP = stm32f0xx -# it should exist either in <chibios>/os/hal/boards/ -# or <this_dir>/boards -BOARD = ST_STM32F072B_DISCOVERY -# Cortex version -# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m0 -# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 -ARMV = 6 -# If you want to be able to jump to bootloader from firmware on STM32 MCUs, -# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in -# ./bootloader_defs.h or in ./boards/<FOO>/bootloader_defs.h (if you have -# a custom board definition that you plan to reuse). -# If you're not setting it here, leave it commented out. -# It is chip dependent, the correct number can be looked up here (page 175): -# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -# This also requires a patch to chibios: -# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch -#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 +# MCU name +MCU = STM32F072 # Build Options # comment out to disable the options. @@ -40,9 +10,6 @@ VPATH += keyboards/cannonkeys/stm32f072 SRC = keyboard.c \ led.c -DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave -DFU_SUFFIX_ARGS = -v 0483 -p DF11 - BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control diff --git a/keyboards/cannonkeys/ortho48/rules.mk b/keyboards/cannonkeys/ortho48/rules.mk index 2e483a8c2c..4bca8fde05 100644 --- a/keyboards/cannonkeys/ortho48/rules.mk +++ b/keyboards/cannonkeys/ortho48/rules.mk @@ -1,46 +1,18 @@ -# project specific files -VPATH += keyboards/cannonkeys/bluepill -SRC = led.c \ - keyboard.c +# MCU name +MCU = STM32F103 # GENERIC STM32F103C8T6 board - stm32duino bootloader OPT_DEFS = -DCORTEX_VTOR_INIT=0x2000 MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader BOARD = GENERIC_STM32_F103 -# OPT_DEFS = -# MCU_LDSCRIPT = STM32F103x8 -# BOARD = GENERIC_STM32_F103 - -## chip/board settings -# the next two should match the directories in -# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) -MCU_FAMILY = STM32 -MCU_SERIES = STM32F1xx -# linker script to use -# it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ -# or <this_dir>/ld/ -# startup code to use -# is should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ -MCU_STARTUP = stm32f1xx -# it should exist either in <chibios>/os/hal/boards/ -# or <this_dir>/boards -# Cortex version -# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m3 -# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 -ARMV = 7 -# If you want to be able to jump to bootloader from firmware on STM32 MCUs, -# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in -# ./bootloader_defs.h or in ./boards/<FOO>/bootloader_defs.h (if you have -# a custom board definition that you plan to reuse). -# If you're not setting it here, leave it commented out. -# It is chip dependent, the correct number can be looked up here (page 175): -# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -# This also requires a patch to chibios: -# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch -#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 +DFU_ARGS = -d 1eaf:0003 -a2 -R +DFU_SUFFIX_ARGS = -v 1eaf -p 0003 +# project specific files +VPATH += keyboards/cannonkeys/bluepill +SRC = led.c \ + keyboard.c #BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys diff --git a/keyboards/cannonkeys/ortho60/rules.mk b/keyboards/cannonkeys/ortho60/rules.mk index 359f447a9c..d2fa535f41 100644 --- a/keyboards/cannonkeys/ortho60/rules.mk +++ b/keyboards/cannonkeys/ortho60/rules.mk @@ -1,46 +1,18 @@ -# project specific files -VPATH += keyboards/cannonkeys/bluepill -SRC = led.c \ - keyboard.c +# MCU name +MCU = STM32F103 # GENERIC STM32F103C8T6 board - stm32duino bootloader OPT_DEFS = -DCORTEX_VTOR_INIT=0x2000 MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader BOARD = GENERIC_STM32_F103 -# OPT_DEFS = -# MCU_LDSCRIPT = STM32F103x8 -# BOARD = GENERIC_STM32_F103 - -## chip/board settings -# the next two should match the directories in -# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) -MCU_FAMILY = STM32 -MCU_SERIES = STM32F1xx -# linker script to use -# it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ -# or <this_dir>/ld/ -# startup code to use -# is should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ -MCU_STARTUP = stm32f1xx -# it should exist either in <chibios>/os/hal/boards/ -# or <this_dir>/boards -# Cortex version -# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m3 -# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 -ARMV = 7 -# If you want to be able to jump to bootloader from firmware on STM32 MCUs, -# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in -# ./bootloader_defs.h or in ./boards/<FOO>/bootloader_defs.h (if you have -# a custom board definition that you plan to reuse). -# If you're not setting it here, leave it commented out. -# It is chip dependent, the correct number can be looked up here (page 175): -# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -# This also requires a patch to chibios: -# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch -#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 +DFU_ARGS = -d 1eaf:0003 -a2 -R +DFU_SUFFIX_ARGS = -v 1eaf -p 0003 +# project specific files +VPATH += keyboards/cannonkeys/bluepill +SRC = led.c \ + keyboard.c #BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys diff --git a/keyboards/cannonkeys/ortho75/rules.mk b/keyboards/cannonkeys/ortho75/rules.mk index 113fff5554..5b90e87fd7 100644 --- a/keyboards/cannonkeys/ortho75/rules.mk +++ b/keyboards/cannonkeys/ortho75/rules.mk @@ -1,47 +1,18 @@ -# project specific files -VPATH += keyboards/cannonkeys/bluepill -SRC = led.c \ - keyboard.c +# MCU name +MCU = STM32F103 # GENERIC STM32F103C8T6 board - stm32duino bootloader OPT_DEFS = -DCORTEX_VTOR_INIT=0x2000 MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader BOARD = GENERIC_STM32_F103 -# OPT_DEFS = -# MCU_LDSCRIPT = STM32F103x8 -# BOARD = GENERIC_STM32_F103 - -## chip/board settings -# the next two should match the directories in -# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) -MCU_FAMILY = STM32 -MCU_SERIES = STM32F1xx -# linker script to use -# it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ -# or <this_dir>/ld/ -# startup code to use -# is should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ -MCU_STARTUP = stm32f1xx -# it should exist either in <chibios>/os/hal/boards/ -# or <this_dir>/boards -# Cortex version -# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m3 -# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 -ARMV = 7 -# If you want to be able to jump to bootloader from firmware on STM32 MCUs, -# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in -# ./bootloader_defs.h or in ./boards/<FOO>/bootloader_defs.h (if you have -# a custom board definition that you plan to reuse). -# If you're not setting it here, leave it commented out. -# It is chip dependent, the correct number can be looked up here (page 175): -# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -# This also requires a patch to chibios: -# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch -#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 +DFU_ARGS = -d 1eaf:0003 -a2 -R +DFU_SUFFIX_ARGS = -v 1eaf -p 0003 -DFU_ARGS = -d 1eaf:0003 -a 2 -R +# project specific files +VPATH += keyboards/cannonkeys/bluepill +SRC = led.c \ + keyboard.c #BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys diff --git a/keyboards/cannonkeys/practice60/rules.mk b/keyboards/cannonkeys/practice60/rules.mk index cf8554c0c6..7c3fec31e6 100644 --- a/keyboards/cannonkeys/practice60/rules.mk +++ b/keyboards/cannonkeys/practice60/rules.mk @@ -1,46 +1,18 @@ -# project specific files -VPATH += keyboards/cannonkeys/bluepill -SRC = led.c \ - keyboard.c +# MCU name +MCU = STM32F103 # GENERIC STM32F103C8T6 board - stm32duino bootloader OPT_DEFS = -DCORTEX_VTOR_INIT=0x2000 MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader BOARD = GENERIC_STM32_F103 -# OPT_DEFS = -# MCU_LDSCRIPT = STM32F103x8 -# BOARD = GENERIC_STM32_F103 - -## chip/board settings -# the next two should match the directories in -# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) -MCU_FAMILY = STM32 -MCU_SERIES = STM32F1xx -# linker script to use -# it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ -# or <this_dir>/ld/ -# startup code to use -# is should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ -MCU_STARTUP = stm32f1xx -# it should exist either in <chibios>/os/hal/boards/ -# or <this_dir>/boards -# Cortex version -# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m3 -# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 -ARMV = 7 -# If you want to be able to jump to bootloader from firmware on STM32 MCUs, -# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in -# ./bootloader_defs.h or in ./boards/<FOO>/bootloader_defs.h (if you have -# a custom board definition that you plan to reuse). -# If you're not setting it here, leave it commented out. -# It is chip dependent, the correct number can be looked up here (page 175): -# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -# This also requires a patch to chibios: -# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch -#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 +DFU_ARGS = -d 1eaf:0003 -a2 -R +DFU_SUFFIX_ARGS = -v 1eaf -p 0003 +# project specific files +VPATH += keyboards/cannonkeys/bluepill +SRC = led.c \ + keyboard.c #BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys diff --git a/keyboards/cannonkeys/practice65/rules.mk b/keyboards/cannonkeys/practice65/rules.mk index 8bbc910aad..b43e591aeb 100644 --- a/keyboards/cannonkeys/practice65/rules.mk +++ b/keyboards/cannonkeys/practice65/rules.mk @@ -1,46 +1,18 @@ -# project specific files -VPATH += keyboards/cannonkeys/bluepill -SRC = led.c \ - keyboard.c +# MCU name +MCU = STM32F103 # GENERIC STM32F103C8T6 board - stm32duino bootloader OPT_DEFS = -DCORTEX_VTOR_INIT=0x2000 MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader BOARD = GENERIC_STM32_F103 -# OPT_DEFS = -# MCU_LDSCRIPT = STM32F103x8 -# BOARD = GENERIC_STM32_F103 - -## chip/board settings -# the next two should match the directories in -# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) -MCU_FAMILY = STM32 -MCU_SERIES = STM32F1xx -# linker script to use -# it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ -# or <this_dir>/ld/ -# startup code to use -# is should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ -MCU_STARTUP = stm32f1xx -# it should exist either in <chibios>/os/hal/boards/ -# or <this_dir>/boards -# Cortex version -# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m3 -# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 -ARMV = 7 -# If you want to be able to jump to bootloader from firmware on STM32 MCUs, -# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in -# ./bootloader_defs.h or in ./boards/<FOO>/bootloader_defs.h (if you have -# a custom board definition that you plan to reuse). -# If you're not setting it here, leave it commented out. -# It is chip dependent, the correct number can be looked up here (page 175): -# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -# This also requires a patch to chibios: -# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch -#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 +DFU_ARGS = -d 1eaf:0003 -a2 -R +DFU_SUFFIX_ARGS = -v 1eaf -p 0003 +# project specific files +VPATH += keyboards/cannonkeys/bluepill +SRC = led.c \ + keyboard.c #BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys diff --git a/keyboards/cannonkeys/satisfaction75/config.h b/keyboards/cannonkeys/satisfaction75/config.h index 8387289d87..7a4354c8a7 100644 --- a/keyboards/cannonkeys/satisfaction75/config.h +++ b/keyboards/cannonkeys/satisfaction75/config.h @@ -64,41 +64,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #endif - -#define DYNAMIC_KEYMAP_LAYER_COUNT 4 - -// EEPROM usage - -// TODO: refactor with new user EEPROM code (coming soon) -#define EEPROM_MAGIC 0x451F -#define EEPROM_MAGIC_ADDR 40 -// Bump this every time we change what we store -// This will automatically reset the EEPROM with defaults -// and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x01 -#define EEPROM_VERSION_ADDR 42 - -// Dynamic keymap starts after EEPROM version -#define DYNAMIC_KEYMAP_EEPROM_ADDR 43 - -// Dynamic macro starts after dynamic keymaps (35+(4*6*16*2)) = (35+768) = 803 - -// I'm also putting my custom stuff after that -// 1 for enabled encoder modes -// 1 for custom backlighting controls -// 1 for OLED default mode -// 6 for 3x custom encoder settings, left, right, and press (18 total) - -#define DYNAMIC_KEYMAP_ENABLED_ENCODER_MODES 811 -#define DYNAMIC_KEYMAP_CUSTOM_BACKLIGHT 812 -#define DYNAMIC_KEYMAP_DEFAULT_OLED 813 -#define DYNAMIC_KEYMAP_CUSTOM_ENCODER 814 - -#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 832 -#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 192 -#define DYNAMIC_KEYMAP_MACRO_COUNT 16 - - +// Custom config starts after VIA's EEPROM usage, +// dynamic keymaps start after this. +// Custom config Usage: +// 1 for enabled encoder modes (1 byte) +// 1 for custom backlighting controls (1 byte) +// 1 for OLED default mode (1 byte) +// 6 for 3x custom encoder settings, left, right, and press (18 bytes) +#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 21 /* * Feature disable options diff --git a/keyboards/cannonkeys/satisfaction75/keymaps/boy_314/config.h b/keyboards/cannonkeys/satisfaction75/keymaps/boy_314/config.h new file mode 100644 index 0000000000..4af97ded2b --- /dev/null +++ b/keyboards/cannonkeys/satisfaction75/keymaps/boy_314/config.h @@ -0,0 +1,3 @@ +#pragma once + +#define ENCODER_RESOLUTION 2 diff --git a/keyboards/cannonkeys/satisfaction75/keymaps/boy_314/keymap.c b/keyboards/cannonkeys/satisfaction75/keymaps/boy_314/keymap.c new file mode 100644 index 0000000000..1680f90dc9 --- /dev/null +++ b/keyboards/cannonkeys/satisfaction75/keymaps/boy_314/keymap.c @@ -0,0 +1,37 @@ +/* +Copyright 2019 Boy_314 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include QMK_KEYBOARD_H + +const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_2x2( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NO, ENC_PRESS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENTER, KC_END, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_DEL, + KC_LCTL, KC_LALT, KC_SPC, KC_LGUI, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + ), + [1] = LAYOUT_2x2( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + NK_TOGG, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______, _______, _______, _______, OLED_TOGG, + _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_HOME, KC_PGUP, _______, _______, RESET, CLOCK_SET, + KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, _______, + _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT + ) +}; diff --git a/keyboards/cannonkeys/satisfaction75/keymaps/boy_314/readme.md b/keyboards/cannonkeys/satisfaction75/keymaps/boy_314/readme.md new file mode 100644 index 0000000000..65984873c4 --- /dev/null +++ b/keyboards/cannonkeys/satisfaction75/keymaps/boy_314/readme.md @@ -0,0 +1,3 @@ +# Boy_314's Satisfaction75 Layout + +This is Boy_314's Satisfaction75 Layout. It can be used on VIA. It features a QWERTY layout on the base, along with missing TKL keys on layer 1. Right side 3 keys from top down are: Home, End, Delete. The encoder resolution has been reduced from the default of 4 down to 2 so that it no longer needs to click twice, but now only once, before triggering an action. diff --git a/keyboards/cannonkeys/satisfaction75/keymaps/boy_314/rules.mk b/keyboards/cannonkeys/satisfaction75/keymaps/boy_314/rules.mk new file mode 100644 index 0000000000..6f45dc73ed --- /dev/null +++ b/keyboards/cannonkeys/satisfaction75/keymaps/boy_314/rules.mk @@ -0,0 +1,3 @@ +# rules.mk overrides to enable VIA + +VIA_ENABLE = yes
\ No newline at end of file diff --git a/keyboards/cannonkeys/satisfaction75/keymaps/default/keymap.c b/keyboards/cannonkeys/satisfaction75/keymaps/default/keymap.c index 5e87c73dcc..61a9d097a3 100644 --- a/keyboards/cannonkeys/satisfaction75/keymaps/default/keymap.c +++ b/keyboards/cannonkeys/satisfaction75/keymaps/default/keymap.c @@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include QMK_KEYBOARD_H -const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_default( KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, ENC_PRESS, diff --git a/keyboards/cannonkeys/satisfaction75/keymaps/tester/keymap.c b/keyboards/cannonkeys/satisfaction75/keymaps/tester/keymap.c index 3595c107b9..c648333c3d 100644 --- a/keyboards/cannonkeys/satisfaction75/keymaps/tester/keymap.c +++ b/keyboards/cannonkeys/satisfaction75/keymaps/tester/keymap.c @@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include QMK_KEYBOARD_H -const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_all( KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, ENC_PRESS, diff --git a/keyboards/cannonkeys/satisfaction75/keymaps/via/keymap.c b/keyboards/cannonkeys/satisfaction75/keymaps/via/keymap.c index 296fd7da6a..ce97d7554f 100644 --- a/keyboards/cannonkeys/satisfaction75/keymaps/via/keymap.c +++ b/keyboards/cannonkeys/satisfaction75/keymaps/via/keymap.c @@ -17,8 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include QMK_KEYBOARD_H - -const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_all( KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, ENC_PRESS, @@ -36,16 +35,3 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) }; - - -void matrix_init_user(void) { - //user initialization -} - -void matrix_scan_user(void) { - //user matrix -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; -} diff --git a/keyboards/cannonkeys/satisfaction75/keymaps/via/rules.mk b/keyboards/cannonkeys/satisfaction75/keymaps/via/rules.mk index d12497792d..1e5b99807c 100644 --- a/keyboards/cannonkeys/satisfaction75/keymaps/via/rules.mk +++ b/keyboards/cannonkeys/satisfaction75/keymaps/via/rules.mk @@ -1,5 +1 @@ -# rules.mk overrides to enable VIA - -RAW_ENABLE = yes -DYNAMIC_KEYMAP_ENABLE = yes - +VIA_ENABLE = yes diff --git a/keyboards/cannonkeys/satisfaction75/prototype/prototype.h b/keyboards/cannonkeys/satisfaction75/prototype/prototype.h index 42e574f3ea..ed4c7d793d 100644 --- a/keyboards/cannonkeys/satisfaction75/prototype/prototype.h +++ b/keyboards/cannonkeys/satisfaction75/prototype/prototype.h @@ -17,3 +17,20 @@ { K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, KC_NO, K413, KC_NO, K415 }, \ { K500, K501, K502, KC_NO, KC_NO, K505, KC_NO, KC_NO, KC_NO, K509, K510, K511, K512, K513, KC_NO, K515 } \ } + +// Expose All Keys - Split backspace - ISO Extra keys - Split space bottom row +#define LAYOUT_all( \ + K000, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, \ + K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, K115, \ + K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K215, \ + K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, K315, \ + K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K415, \ + K500, K501, K502, K503, K505, K507, K509, K510, K511, K512, K513, K515 \ +) { \ + { K000, KC_NO, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, KC_NO, KC_NO }, \ + { K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, K115 }, \ + { K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, KC_NO, K215 }, \ + { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, KC_NO, K315 }, \ + { K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, KC_NO, K415 }, \ + { K500, K501, K502, K503, KC_NO, K505, KC_NO, K507, KC_NO, K509, K510, K511, K512, K513, KC_NO, K515 } \ +} diff --git a/keyboards/cannonkeys/satisfaction75/rules.mk b/keyboards/cannonkeys/satisfaction75/rules.mk index 3e2877200e..7e0b15b92b 100644 --- a/keyboards/cannonkeys/satisfaction75/rules.mk +++ b/keyboards/cannonkeys/satisfaction75/rules.mk @@ -1,35 +1,5 @@ -# project specific files -# SRC = ssd1306.c -## chip/board settings -# the next two should match the directories in -# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) -MCU_FAMILY = STM32 -MCU_SERIES = STM32F0xx -# linker script to use -# it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ -# or <this_dir>/ld/ -MCU_LDSCRIPT = STM32F072xB -# startup code to use -# is should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ -MCU_STARTUP = stm32f0xx -# it should exist either in <chibios>/os/hal/boards/ -# or <this_dir>/boards -BOARD = ST_STM32F072B_DISCOVERY -# Cortex version -# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m0 -# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 -ARMV = 6 -# If you want to be able to jump to bootloader from firmware on STM32 MCUs, -# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in -# ./bootloader_defs.h or in ./boards/<FOO>/bootloader_defs.h (if you have -# a custom board definition that you plan to reuse). -# If you're not setting it here, leave it commented out. -# It is chip dependent, the correct number can be looked up here (page 175): -# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -# This also requires a patch to chibios: -# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch -#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 +# MCU name +MCU = STM32F072 # Build Options # comment out to disable the options. @@ -51,7 +21,4 @@ ENCODER_ENABLE = yes QWIIC_ENABLE += MICRO_OLED #BACKLIGHT_ENABLE = yes -# RAW_ENABLE = yes -# DYNAMIC_KEYMAP_ENABLE = yes - DEFAULT_FOLDER = cannonkeys/satisfaction75/rev1 diff --git a/keyboards/cannonkeys/satisfaction75/satisfaction75.c b/keyboards/cannonkeys/satisfaction75/satisfaction75.c index 12d3660dae..0fe09c384f 100644 --- a/keyboards/cannonkeys/satisfaction75/satisfaction75.c +++ b/keyboards/cannonkeys/satisfaction75/satisfaction75.c @@ -15,11 +15,7 @@ #include "raw_hid.h" #include "dynamic_keymap.h" #include "tmk_core/common/eeprom.h" - -// HACK -#include "keyboards/wilba_tech/via_api.h" // Temporary hack -#include "keyboards/wilba_tech/via_keycodes.h" // Temporary hack - +#include "version.h" // for QMK_BUILDDATE used in EEPROM magic /* Artificial delay added to get media keys to work in the encoder*/ #define MEDIA_KEY_DELAY 10 @@ -58,56 +54,20 @@ backlight_config_t kb_backlight_config = { .level = BACKLIGHT_LEVELS }; -bool eeprom_is_valid(void) -{ - return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && - eeprom_read_byte(((void*)EEPROM_VERSION_ADDR)) == EEPROM_VERSION); -} - -void eeprom_set_valid(bool valid) +#ifdef VIA_ENABLE +void raw_hid_receive_kb( uint8_t *data, uint8_t length ) { - eeprom_update_word(((void*)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); - eeprom_update_byte(((void*)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); -} - -void eeprom_reset(void) -{ - // Set the VIA specific EEPROM state as invalid. - eeprom_set_valid(false); - // Set the TMK/QMK EEPROM state as invalid. - eeconfig_disable(); -} - -#ifdef RAW_ENABLE - -void raw_hid_receive( uint8_t *data, uint8_t length ) -{ - uint8_t *command_id = &(data[0]); - uint8_t *command_data = &(data[1]); - switch ( *command_id ) - { - case id_get_protocol_version: - { - command_data[0] = PROTOCOL_VERSION >> 8; - command_data[1] = PROTOCOL_VERSION & 0xFF; - break; - } - case id_get_keyboard_value: - { + uint8_t *command_id = &(data[0]); + uint8_t *command_data = &(data[1]); + switch ( *command_id ) + { + case id_get_keyboard_value: + { switch( command_data[0]) { - case id_uptime: - { - uint32_t value = timer_read32(); - command_data[1] = (value >> 24 ) & 0xFF; - command_data[2] = (value >> 16 ) & 0xFF; - command_data[3] = (value >> 8 ) & 0xFF; - command_data[4] = value & 0xFF; - break; - } case id_oled_default_mode: { - uint8_t default_oled = eeprom_read_byte((uint8_t*)DYNAMIC_KEYMAP_DEFAULT_OLED); + uint8_t default_oled = eeprom_read_byte((uint8_t*)EEPROM_DEFAULT_OLED); command_data[1] = default_oled; break; } @@ -141,15 +101,14 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) break; } } - break; + break; } -#ifdef DYNAMIC_KEYMAP_ENABLE case id_set_keyboard_value: { switch(command_data[0]){ case id_oled_default_mode: { - eeprom_update_byte((uint8_t*)DYNAMIC_KEYMAP_DEFAULT_OLED, command_data[1]); + eeprom_update_byte((uint8_t*)EEPROM_DEFAULT_OLED, command_data[1]); break; } case id_oled_mode: @@ -161,7 +120,7 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) case id_encoder_modes: { enabled_encoder_modes = command_data[1]; - eeprom_update_byte((uint8_t*)DYNAMIC_KEYMAP_ENABLED_ENCODER_MODES, enabled_encoder_modes); + eeprom_update_byte((uint8_t*)EEPROM_ENABLED_ENCODER_MODES, enabled_encoder_modes); break; } case id_encoder_custom: @@ -180,95 +139,15 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) } break; } - case id_dynamic_keymap_get_keycode: - { - uint16_t keycode = dynamic_keymap_get_keycode( command_data[0], command_data[1], command_data[2] ); - command_data[3] = keycode >> 8; - command_data[4] = keycode & 0xFF; - break; - } - case id_dynamic_keymap_set_keycode: - { - dynamic_keymap_set_keycode( command_data[0], command_data[1], command_data[2], ( command_data[3] << 8 ) | command_data[4] ); - break; - } - case id_dynamic_keymap_reset: - { - dynamic_keymap_reset(); - break; - } - case id_dynamic_keymap_macro_get_count: - { - command_data[0] = dynamic_keymap_macro_get_count(); - break; - } - case id_dynamic_keymap_macro_get_buffer_size: - { - uint16_t size = dynamic_keymap_macro_get_buffer_size(); - command_data[0] = size >> 8; - command_data[1] = size & 0xFF; - break; - } - case id_dynamic_keymap_macro_get_buffer: - { - uint16_t offset = ( command_data[0] << 8 ) | command_data[1]; - uint16_t size = command_data[2]; // size <= 28 - dynamic_keymap_macro_set_buffer( offset, size, &command_data[3] ); - break; - } - case id_dynamic_keymap_macro_reset: - { - dynamic_keymap_macro_reset(); - break; - } - case id_dynamic_keymap_get_layer_count: - { - command_data[0] = dynamic_keymap_get_layer_count(); - break; - } - case id_dynamic_keymap_get_buffer: - { - uint16_t offset = ( command_data[0] << 8 ) | command_data[1]; - uint16_t size = command_data[2]; // size <= 28 - dynamic_keymap_get_buffer( offset, size, &command_data[3] ); - break; - } - case id_dynamic_keymap_set_buffer: - { - uint16_t offset = ( command_data[0] << 8 ) | command_data[1]; - uint16_t size = command_data[2]; // size <= 28 - dynamic_keymap_set_buffer( offset, size, &command_data[3] ); - break; - } -#endif // DYNAMIC_KEYMAP_ENABLE - case id_eeprom_reset: - { - eeprom_reset(); - break; - } - case id_bootloader_jump: - { - // Need to send data back before the jump - // Informs host that the command is handled - raw_hid_send( data, length ); - // Give host time to read it - wait_ms(100); - bootloader_jump(); - break; - } - default: - { - // Unhandled message. - *command_id = id_unhandled; - break; - } - } - - // Return same buffer with values changed - raw_hid_send( data, length ); - + default: + { + // Unhandled message. + *command_id = id_unhandled; + break; + } + } + // DO NOT call raw_hid_send(data,length) here, let caller do this } - #endif @@ -349,18 +228,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { break; } -#ifdef DYNAMIC_KEYMAP_ENABLE - // Handle macros - if (record->event.pressed) { - if ( keycode >= MACRO00 && keycode <= MACRO15 ) - { - uint8_t id = keycode - MACRO00; - dynamic_keymap_macro_send(id); - return false; - } - } -#endif //DYNAMIC_KEYMAP_ENABLE - return process_record_user(keycode, record); } @@ -392,59 +259,56 @@ void encoder_update_kb(uint8_t index, bool clockwise) { } } -void dynamic_keymap_custom_reset(void){ - void *p = (void*)(DYNAMIC_KEYMAP_CUSTOM_BACKLIGHT); - void *end = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR); - while ( p != end ) { - eeprom_update_byte(p, 0); - ++p; - } - eeprom_update_byte((uint8_t*)DYNAMIC_KEYMAP_ENABLED_ENCODER_MODES, 0x1F); +void custom_config_reset(void){ + void *p = (void*)(VIA_EEPROM_CUSTOM_CONFIG_ADDR); + void *end = (void*)(VIA_EEPROM_CUSTOM_CONFIG_ADDR+VIA_EEPROM_CUSTOM_CONFIG_SIZE); + while ( p != end ) { + eeprom_update_byte(p, 0); + ++p; + } + eeprom_update_byte((uint8_t*)EEPROM_ENABLED_ENCODER_MODES, 0x1F); } -void save_backlight_config_to_eeprom(){ - eeprom_update_byte((uint8_t*)DYNAMIC_KEYMAP_CUSTOM_BACKLIGHT, kb_backlight_config.raw); +void backlight_config_save(){ + eeprom_update_byte((uint8_t*)EEPROM_CUSTOM_BACKLIGHT, kb_backlight_config.raw); } -void load_custom_config(){ - kb_backlight_config.raw = eeprom_read_byte((uint8_t*)DYNAMIC_KEYMAP_CUSTOM_BACKLIGHT); +void custom_config_load(){ + kb_backlight_config.raw = eeprom_read_byte((uint8_t*)EEPROM_CUSTOM_BACKLIGHT); #ifdef DYNAMIC_KEYMAP_ENABLE - oled_mode = eeprom_read_byte((uint8_t*)DYNAMIC_KEYMAP_DEFAULT_OLED); - enabled_encoder_modes = eeprom_read_byte((uint8_t*)DYNAMIC_KEYMAP_ENABLED_ENCODER_MODES); + oled_mode = eeprom_read_byte((uint8_t*)EEPROM_DEFAULT_OLED); + enabled_encoder_modes = eeprom_read_byte((uint8_t*)EEPROM_ENABLED_ENCODER_MODES); #endif } -void eeprom_init_kb(void) +// Called from via_init() if VIA_ENABLE +// Called from matrix_init_kb() if not VIA_ENABLE +void via_init_kb(void) { - // If the EEPROM has the magic, the data is good. - // OK to load from EEPROM. - if (eeprom_is_valid()) { - load_custom_config(); - } else { - // If the EEPROM has not been saved before, or is out of date, - // save the default values to the EEPROM. Default values - // come from construction of the zeal_backlight_config instance. - //backlight_config_save(); + // If the EEPROM has the magic, the data is good. + // OK to load from EEPROM. + if (via_eeprom_is_valid()) { + custom_config_load(); + } else { #ifdef DYNAMIC_KEYMAP_ENABLE - // 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(); // Reset the custom stuff - dynamic_keymap_custom_reset(); + custom_config_reset(); #endif - // Save the magic number last, in case saving was interrupted - eeprom_set_valid(true); - } + // DO NOT set EEPROM valid here, let caller do this + } } void matrix_init_kb(void) { - eeprom_init_kb(); +#ifndef VIA_ENABLE + via_init_kb(); + via_eeprom_set_valid(true); +#endif // VIA_ENABLE + rtcGetTime(&RTCD1, &last_timespec); queue_for_send = true; backlight_init_ports(); - matrix_init_user(); + matrix_init_user(); } @@ -472,3 +336,51 @@ void matrix_scan_kb(void) { #endif } +// +// In the case of VIA being disabled, we still need to check if +// keyboard level EEPROM memory is valid before loading. +// Thus these are copies of the same functions in VIA, since +// the backlight settings reuse VIA's EEPROM magic/version, +// and the ones in via.c won't be compiled in. +// +// Yes, this is sub-optimal, and is only here for completeness +// (i.e. catering to the 1% of people that want wilba.tech LED bling +// AND want persistent settings BUT DON'T want to use dynamic keymaps/VIA). +// +#ifndef VIA_ENABLE + +bool via_eeprom_is_valid(void) +{ + char *p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54" + uint8_t magic0 = ( ( p[2] & 0x0F ) << 4 ) | ( p[3] & 0x0F ); + uint8_t magic1 = ( ( p[5] & 0x0F ) << 4 ) | ( p[6] & 0x0F ); + uint8_t magic2 = ( ( p[8] & 0x0F ) << 4 ) | ( p[9] & 0x0F ); + + return (eeprom_read_byte( (void*)VIA_EEPROM_MAGIC_ADDR+0 ) == magic0 && + eeprom_read_byte( (void*)VIA_EEPROM_MAGIC_ADDR+1 ) == magic1 && + eeprom_read_byte( (void*)VIA_EEPROM_MAGIC_ADDR+2 ) == magic2 ); +} + +// Sets VIA/keyboard level usage of EEPROM to valid/invalid +// Keyboard level code (eg. via_init_kb()) should not call this +void via_eeprom_set_valid(bool valid) +{ + char *p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54" + uint8_t magic0 = ( ( p[2] & 0x0F ) << 4 ) | ( p[3] & 0x0F ); + uint8_t magic1 = ( ( p[5] & 0x0F ) << 4 ) | ( p[6] & 0x0F ); + uint8_t magic2 = ( ( p[8] & 0x0F ) << 4 ) | ( p[9] & 0x0F ); + + eeprom_update_byte( (void*)VIA_EEPROM_MAGIC_ADDR+0, valid ? magic0 : 0xFF); + eeprom_update_byte( (void*)VIA_EEPROM_MAGIC_ADDR+1, valid ? magic1 : 0xFF); + eeprom_update_byte( (void*)VIA_EEPROM_MAGIC_ADDR+2, valid ? magic2 : 0xFF); +} + +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(); +} + +#endif // VIA_ENABLE
\ No newline at end of file diff --git a/keyboards/cannonkeys/satisfaction75/satisfaction75.h b/keyboards/cannonkeys/satisfaction75/satisfaction75.h index 188a1d4970..13aaf68882 100644 --- a/keyboards/cannonkeys/satisfaction75/satisfaction75.h +++ b/keyboards/cannonkeys/satisfaction75/satisfaction75.h @@ -8,6 +8,12 @@ #include "rev1.h" #endif +#include "via.h" // only for EEPROM address +#define EEPROM_ENABLED_ENCODER_MODES (VIA_EEPROM_CUSTOM_CONFIG_ADDR) +#define EEPROM_CUSTOM_BACKLIGHT (VIA_EEPROM_CUSTOM_CONFIG_ADDR+1) +#define EEPROM_DEFAULT_OLED (VIA_EEPROM_CUSTOM_CONFIG_ADDR+2) +#define EEPROM_CUSTOM_ENCODER (VIA_EEPROM_CUSTOM_CONFIG_ADDR+3) + /* screen off after this many milliseconds */ #define ScreenOffInterval 60000 /* milliseconds */ @@ -117,5 +123,5 @@ void backlight_set(uint8_t level); bool is_breathing(void); void breathing_enable(void); void breathing_disable(void); -void load_custom_config(void); -void save_backlight_config_to_eeprom(void); +void custom_config_load(void); +void backlight_config_save(void); diff --git a/keyboards/cannonkeys/satisfaction75/satisfaction_encoder.c b/keyboards/cannonkeys/satisfaction75/satisfaction_encoder.c index e866d897c7..8fcd720e2f 100644 --- a/keyboards/cannonkeys/satisfaction75/satisfaction_encoder.c +++ b/keyboards/cannonkeys/satisfaction75/satisfaction_encoder.c @@ -12,7 +12,7 @@ void pre_encoder_mode_change(){ timespec.millisecond = (hour_config * 60 + minute_config) * 60 * 1000; rtcSetTime(&RTCD1, ×pec); } else if (encoder_mode == ENC_MODE_BACKLIGHT){ - save_backlight_config_to_eeprom(); + backlight_config_save(); } } @@ -221,7 +221,7 @@ uint16_t handle_encoder_press(){ uint16_t retrieve_custom_encoder_config(uint8_t encoder_idx, uint8_t behavior){ #ifdef DYNAMIC_KEYMAP_ENABLE - void* addr = (void*)(DYNAMIC_KEYMAP_CUSTOM_ENCODER + (encoder_idx * 6) + (behavior * 2)); + void* addr = (void*)(EEPROM_CUSTOM_ENCODER + (encoder_idx * 6) + (behavior * 2)); //big endian uint16_t keycode = eeprom_read_byte(addr) << 8; keycode |= eeprom_read_byte(addr + 1); @@ -233,7 +233,7 @@ uint16_t retrieve_custom_encoder_config(uint8_t encoder_idx, uint8_t behavior){ void set_custom_encoder_config(uint8_t encoder_idx, uint8_t behavior, uint16_t new_code){ #ifdef DYNAMIC_KEYMAP_ENABLE - void* addr = (void*)(DYNAMIC_KEYMAP_CUSTOM_ENCODER + (encoder_idx * 6) + (behavior * 2)); + void* addr = (void*)(EEPROM_CUSTOM_ENCODER + (encoder_idx * 6) + (behavior * 2)); eeprom_update_byte(addr, (uint8_t)(new_code >> 8)); eeprom_update_byte(addr + 1, (uint8_t)(new_code & 0xFF)); #endif diff --git a/keyboards/cannonkeys/savage65/config.h b/keyboards/cannonkeys/savage65/config.h index 996b939515..b69aba39eb 100644 --- a/keyboards/cannonkeys/savage65/config.h +++ b/keyboards/cannonkeys/savage65/config.h @@ -58,25 +58,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define PIN_WS2812 15 #define WS2812_SPI SPID2 -// EEPROM usage -// TODO: refactor with new user EEPROM code (coming soon) -#define EEPROM_MAGIC 0x451F -#define EEPROM_MAGIC_ADDR 40 -// Bump this every time we change what we store -// This will automatically reset the EEPROM with defaults -// and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x02 -#define EEPROM_VERSION_ADDR 42 - - -#define DYNAMIC_KEYMAP_LAYER_COUNT 4 -// Dynamic macro starts after dynamic keymaps (35+(4*5*15*2)) = (35+600) = 635 -// start + layer * rows * col * 2 -#define DYNAMIC_KEYMAP_EEPROM_ADDR 43 -#define EEPROM_CUSTOM_BACKLIGHT 684 -#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 685 -#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 192 -#define DYNAMIC_KEYMAP_MACRO_COUNT 16 +// Backlight config starts after VIA's EEPROM usage, +// dynamic keymaps start after this. +#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1 /* * Feature disable options diff --git a/keyboards/cannonkeys/savage65/rules.mk b/keyboards/cannonkeys/savage65/rules.mk index c6789d6c3a..199dd10780 100644 --- a/keyboards/cannonkeys/savage65/rules.mk +++ b/keyboards/cannonkeys/savage65/rules.mk @@ -1,35 +1,5 @@ -# project specific files -# SRC = ssd1306.c -## chip/board settings -# the next two should match the directories in -# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) -MCU_FAMILY = STM32 -MCU_SERIES = STM32F0xx -# linker script to use -# it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ -# or <this_dir>/ld/ -MCU_LDSCRIPT = STM32F072xB -# startup code to use -# is should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ -MCU_STARTUP = stm32f0xx -# it should exist either in <chibios>/os/hal/boards/ -# or <this_dir>/boards -BOARD = ST_STM32F072B_DISCOVERY -# Cortex version -# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m0 -# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 -ARMV = 6 -# If you want to be able to jump to bootloader from firmware on STM32 MCUs, -# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in -# ./bootloader_defs.h or in ./boards/<FOO>/bootloader_defs.h (if you have -# a custom board definition that you plan to reuse). -# If you're not setting it here, leave it commented out. -# It is chip dependent, the correct number can be looked up here (page 175): -# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -# This also requires a patch to chibios: -# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch -#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 +# MCU name +MCU = STM32F072 # Build Options # comment out to disable the options. @@ -40,9 +10,6 @@ VPATH += keyboards/cannonkeys/stm32f072 SRC = keyboard.c \ led.c -DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave -DFU_SUFFIX_ARGS = -v 0483 -p DF11 - BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control diff --git a/keyboards/cannonkeys/stm32f072/keyboard.c b/keyboards/cannonkeys/stm32f072/keyboard.c index 5a9ccafff7..bf35a76c18 100644 --- a/keyboards/cannonkeys/stm32f072/keyboard.c +++ b/keyboards/cannonkeys/stm32f072/keyboard.c @@ -10,11 +10,10 @@ #include "raw_hid.h" #include "dynamic_keymap.h" #include "tmk_core/common/eeprom.h" +#include "version.h" // for QMK_BUILDDATE used in EEPROM magic -// HACK -#include "keyboards/wilba_tech/via_api.h" // Temporary hack -#include "keyboards/wilba_tech/via_keycodes.h" // Temporary hack - +#include "via.h" +#define EEPROM_CUSTOM_BACKLIGHT (VIA_EEPROM_CUSTOM_CONFIG_ADDR) backlight_config_t kb_backlight_config = { .enable = true, @@ -22,61 +21,29 @@ backlight_config_t kb_backlight_config = { .level = BACKLIGHT_LEVELS }; -bool eeprom_is_valid(void) -{ - return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && - eeprom_read_byte(((void*)EEPROM_VERSION_ADDR)) == EEPROM_VERSION); -} - -void eeprom_set_valid(bool valid) -{ - eeprom_update_word(((void*)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); - eeprom_update_byte(((void*)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); -} - -void eeprom_reset(void) -{ - eeprom_set_valid(false); - eeconfig_disable(); -} - -void save_backlight_config_to_eeprom(){ +void backlight_config_save(){ eeprom_update_byte((uint8_t*)EEPROM_CUSTOM_BACKLIGHT, kb_backlight_config.raw); } -void load_custom_config(){ +void backlight_config_load(){ kb_backlight_config.raw = eeprom_read_byte((uint8_t*)EEPROM_CUSTOM_BACKLIGHT); } -#ifdef DYNAMIC_KEYMAP_ENABLE -void dynamic_keymap_custom_reset(void){ - void *p = (void*)(EEPROM_CUSTOM_BACKLIGHT); - void *end = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR); - while ( p != end ) { - eeprom_update_byte(p, 0); - ++p; - } -} -#endif - -void eeprom_init_kb(void) +// Called from via_init() if VIA_ENABLE +// Called from matrix_init_kb() if not VIA_ENABLE +void via_init_kb(void) { // If the EEPROM has the magic, the data is good. // OK to load from EEPROM. - if (eeprom_is_valid()) { - load_custom_config(); + if (via_eeprom_is_valid()) { + backlight_config_load(); } else { -#ifdef DYNAMIC_KEYMAP_ENABLE - // 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(); - // Reset the custom stuff - dynamic_keymap_custom_reset(); -#endif - // Save the magic number last, in case saving was interrupted - save_backlight_config_to_eeprom(); - eeprom_set_valid(true); + // If the EEPROM has not been saved before, or is out of date, + // save the default values to the EEPROM. Default values + // come from construction of the backlight_config instance. + backlight_config_save(); + + // DO NOT set EEPROM valid here, let caller do this } } @@ -84,7 +51,13 @@ __attribute__ ((weak)) void matrix_init_board(void); void matrix_init_kb(void){ - eeprom_init_kb(); + // If VIA is disabled, we still need to load backlight settings. + // Call via_init_kb() the same way as via_init(), with setting + // EEPROM valid afterwards. +#ifndef VIA_ENABLE + via_init_kb(); + via_eeprom_set_valid(true); +#endif // VIA_ENABLE /* MOSI pin*/ #ifdef RGBLIGHT_ENABLE palSetPadMode(PORT_WS2812, PIN_WS2812, PAL_MODE_ALTERNATE(0)); @@ -101,6 +74,7 @@ void matrix_scan_kb(void) #ifdef RGBLIGHT_ENABLE rgblight_task(); #endif + matrix_scan_user(); } bool process_record_kb(uint16_t keycode, keyrecord_t *record) { @@ -112,7 +86,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { kb_backlight_config.level = BACKLIGHT_LEVELS; } backlight_set(kb_backlight_config.level); - save_backlight_config_to_eeprom(); + backlight_config_save(); } return false; case BL_TOGG: @@ -123,7 +97,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { } else { backlight_set(0); } - save_backlight_config_to_eeprom(); + backlight_config_save(); } return false; @@ -135,168 +109,71 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { kb_backlight_config.level = kb_backlight_config.level - 1; } backlight_set(kb_backlight_config.level); - save_backlight_config_to_eeprom(); + backlight_config_save(); } return false; case BL_BRTG: if (record->event.pressed) { kb_backlight_config.breathing = !kb_backlight_config.breathing; breathing_toggle(); - save_backlight_config_to_eeprom(); + backlight_config_save(); } return false; default: break; } - #ifdef DYNAMIC_KEYMAP_ENABLE - // Handle macros - if (record->event.pressed) { - if ( keycode >= MACRO00 && keycode <= MACRO15 ) - { - uint8_t id = keycode - MACRO00; - dynamic_keymap_macro_send(id); - return false; - } - } - #endif //DYNAMIC_KEYMAP_ENABLE - return process_record_user(keycode, record);; } -// Start Dynamic Keymap code -#ifdef RAW_ENABLE -void raw_hid_receive( uint8_t *data, uint8_t length ) -{ - uint8_t *command_id = &(data[0]); - uint8_t *command_data = &(data[1]); - switch ( *command_id ) - { - case id_get_protocol_version: - { - command_data[0] = PROTOCOL_VERSION >> 8; - command_data[1] = PROTOCOL_VERSION & 0xFF; - break; - } - case id_get_keyboard_value: - { - switch( command_data[0]) - { - case id_uptime: - { - uint32_t value = timer_read32(); - command_data[1] = (value >> 24 ) & 0xFF; - command_data[2] = (value >> 16 ) & 0xFF; - command_data[3] = (value >> 8 ) & 0xFF; - command_data[4] = value & 0xFF; - break; - } - default: - { - *command_id = id_unhandled; - break; - } - } - break; - } -#ifdef DYNAMIC_KEYMAP_ENABLE - case id_dynamic_keymap_get_keycode: - { - uint16_t keycode = dynamic_keymap_get_keycode( command_data[0], command_data[1], command_data[2] ); - command_data[3] = keycode >> 8; - command_data[4] = keycode & 0xFF; - break; - } - case id_dynamic_keymap_set_keycode: - { - dynamic_keymap_set_keycode( command_data[0], command_data[1], command_data[2], ( command_data[3] << 8 ) | command_data[4] ); - break; - } - case id_dynamic_keymap_reset: - { - dynamic_keymap_reset(); - break; - } - case id_dynamic_keymap_macro_get_count: - { - command_data[0] = dynamic_keymap_macro_get_count(); - break; - } - case id_dynamic_keymap_macro_get_buffer_size: - { - uint16_t size = dynamic_keymap_macro_get_buffer_size(); - command_data[0] = size >> 8; - command_data[1] = size & 0xFF; - break; - } - case id_dynamic_keymap_macro_get_buffer: - { - uint16_t offset = ( command_data[0] << 8 ) | command_data[1]; - uint16_t size = command_data[2]; // size <= 28 - dynamic_keymap_macro_get_buffer( offset, size, &command_data[3] ); - break; - } - case id_dynamic_keymap_macro_set_buffer: - { - uint16_t offset = ( command_data[0] << 8 ) | command_data[1]; - uint16_t size = command_data[2]; // size <= 28 - dynamic_keymap_macro_set_buffer( offset, size, &command_data[3] ); - break; - } - case id_dynamic_keymap_macro_reset: - { - dynamic_keymap_macro_reset(); - break; - } - case id_dynamic_keymap_get_layer_count: - { - command_data[0] = dynamic_keymap_get_layer_count(); - break; - } - case id_dynamic_keymap_get_buffer: - { - uint16_t offset = ( command_data[0] << 8 ) | command_data[1]; - uint16_t size = command_data[2]; // size <= 28 - dynamic_keymap_get_buffer( offset, size, &command_data[3] ); - break; - } - case id_dynamic_keymap_set_buffer: - { - uint16_t offset = ( command_data[0] << 8 ) | command_data[1]; - uint16_t size = command_data[2]; // size <= 28 - dynamic_keymap_set_buffer( offset, size, &command_data[3] ); - break; - } -#endif // DYNAMIC_KEYMAP_ENABLE - case id_eeprom_reset: - { - eeprom_reset(); - break; - } - case id_bootloader_jump: - { - // Need to send data back before the jump - // Informs host that the command is handled - raw_hid_send( data, length ); - // Give host time to read it - wait_ms(100); - bootloader_jump(); - break; - } - default: - { - // Unhandled message. - *command_id = id_unhandled; - break; - } - } +// +// In the case of VIA being disabled, we still need to check if +// keyboard level EEPROM memory is valid before loading. +// Thus these are copies of the same functions in VIA, since +// the backlight settings reuse VIA's EEPROM magic/version, +// and the ones in via.c won't be compiled in. +// +// Yes, this is sub-optimal, and is only here for completeness +// (i.e. catering to the 1% of people that want wilba.tech LED bling +// AND want persistent settings BUT DON'T want to use dynamic keymaps/VIA). +// +#ifndef VIA_ENABLE - // Return same buffer with values changed - raw_hid_send( data, length ); +bool via_eeprom_is_valid(void) +{ + char *p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54" + uint8_t magic0 = ( ( p[2] & 0x0F ) << 4 ) | ( p[3] & 0x0F ); + uint8_t magic1 = ( ( p[5] & 0x0F ) << 4 ) | ( p[6] & 0x0F ); + uint8_t magic2 = ( ( p[8] & 0x0F ) << 4 ) | ( p[9] & 0x0F ); + + return (eeprom_read_byte( (void*)VIA_EEPROM_MAGIC_ADDR+0 ) == magic0 && + eeprom_read_byte( (void*)VIA_EEPROM_MAGIC_ADDR+1 ) == magic1 && + eeprom_read_byte( (void*)VIA_EEPROM_MAGIC_ADDR+2 ) == magic2 ); +} +// Sets VIA/keyboard level usage of EEPROM to valid/invalid +// Keyboard level code (eg. via_init_kb()) should not call this +void via_eeprom_set_valid(bool valid) +{ + char *p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54" + uint8_t magic0 = ( ( p[2] & 0x0F ) << 4 ) | ( p[3] & 0x0F ); + uint8_t magic1 = ( ( p[5] & 0x0F ) << 4 ) | ( p[6] & 0x0F ); + uint8_t magic2 = ( ( p[8] & 0x0F ) << 4 ) | ( p[9] & 0x0F ); + + eeprom_update_byte( (void*)VIA_EEPROM_MAGIC_ADDR+0, valid ? magic0 : 0xFF); + eeprom_update_byte( (void*)VIA_EEPROM_MAGIC_ADDR+1, valid ? magic1 : 0xFF); + eeprom_update_byte( (void*)VIA_EEPROM_MAGIC_ADDR+2, valid ? magic2 : 0xFF); } -#endif +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(); +} + +#endif // VIA_ENABLE diff --git a/keyboards/cannonkeys/stm32f072/keyboard.h b/keyboards/cannonkeys/stm32f072/keyboard.h index 94c973d615..81dd1b704e 100644 --- a/keyboards/cannonkeys/stm32f072/keyboard.h +++ b/keyboards/cannonkeys/stm32f072/keyboard.h @@ -19,5 +19,5 @@ void backlight_set(uint8_t level); bool is_breathing(void); void breathing_enable(void); void breathing_disable(void); -void load_custom_config(void); -void save_backlight_config_to_eeprom(void); +void backlight_config_load(void); +void backlight_config_save(void); diff --git a/keyboards/cannonkeys/tmov2/config.h b/keyboards/cannonkeys/tmov2/config.h index 0c586de9e5..d5f1d07884 100644 --- a/keyboards/cannonkeys/tmov2/config.h +++ b/keyboards/cannonkeys/tmov2/config.h @@ -58,25 +58,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define PIN_WS2812 15 #define WS2812_SPI SPID2 -// EEPROM usage -// TODO: refactor with new user EEPROM code (coming soon) -#define EEPROM_MAGIC 0x451F -#define EEPROM_MAGIC_ADDR 40 -// Bump this every time we change what we store -// This will automatically reset the EEPROM with defaults -// and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x02 -#define EEPROM_VERSION_ADDR 42 - - -#define DYNAMIC_KEYMAP_LAYER_COUNT 4 -// Dynamic macro starts after dynamic keymaps (43+(4*4*15*2)) = (43+480) = 523 -// start + layer * rows * col * 2c -#define DYNAMIC_KEYMAP_EEPROM_ADDR 43 -#define EEPROM_CUSTOM_BACKLIGHT 523 -#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 524 -#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 200 -#define DYNAMIC_KEYMAP_MACRO_COUNT 16 +// Backlight config starts after VIA's EEPROM usage, +// dynamic keymaps start after this. +#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1 /* * Feature disable options diff --git a/keyboards/cannonkeys/tmov2/rules.mk b/keyboards/cannonkeys/tmov2/rules.mk index 828fa8ff80..e6f0ce30a1 100644 --- a/keyboards/cannonkeys/tmov2/rules.mk +++ b/keyboards/cannonkeys/tmov2/rules.mk @@ -1,43 +1,5 @@ -# project specific files -# SRC = ssd1306.c -## chip/board settings -# the next two should match the directories in -# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) -MCU_FAMILY = STM32 -MCU_SERIES = STM32F0xx -# linker script to use -# it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ -# or <this_dir>/ld/ -MCU_LDSCRIPT = STM32F072xB -# startup code to use -# is should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ -MCU_STARTUP = stm32f0xx -# it should exist either in <chibios>/os/hal/boards/ -# or <this_dir>/boards -BOARD = ST_STM32F072B_DISCOVERY -# Cortex version -# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 -MCU = cortex-m0 -# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 -ARMV = 6 -# If you want to be able to jump to bootloader from firmware on STM32 MCUs, -# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in -# ./bootloader_defs.h or in ./boards/<FOO>/bootloader_defs.h (if you have -# a custom board definition that you plan to reuse). -# If you're not setting it here, leave it commented out. -# It is chip dependent, the correct number can be looked up here (page 175): -# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf -# This also requires a patch to chibios: -# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch -#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800 - -# Build Options -# comment out to disable the options. -# - -# Options to pass to dfu-util when flashing -DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave -DFU_SUFFIX_ARGS = -p DF11 -v 0483 +# MCU name +MCU = STM32F072 # Build Options # comment out to disable the options. @@ -48,9 +10,6 @@ VPATH += keyboards/cannonkeys/stm32f072 SRC = keyboard.c \ led.c -DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave -DFU_SUFFIX_ARGS = -v 0483 -p DF11 - BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control |