From 68c6c845fc662ceff9bb4456fd599476772573fb Mon Sep 17 00:00:00 2001 From: zhaqian <80608733+zhaqian12@users.noreply.github.com> Date: Tue, 24 May 2022 17:52:10 +0800 Subject: [PATCH] update f103 keyboard --- keyboards/zhaqian/readme.md | 2 +- keyboards/zhaqian/readme_cn.md | 2 +- keyboards/zhaqian/s80/board.h | 2 - keyboards/zhaqian/s80/config.h | 4 +- keyboards/zhaqian/s80/keymaps/via/rules.mk | 3 - keyboards/zhaqian/s80/s80.c | 6 +- keyboards/zhaqian/s80/s80_via.json | 67 ------------------- keyboards/zhaqian/sp67/board.h | 2 - keyboards/zhaqian/sp67/config.h | 1 + keyboards/zhaqian/tester/cm32m101a/rules.mk | 6 +- keyboards/zhaqian/tester/f103/config.h | 6 +- keyboards/zhaqian/tester/f103/halconf.h | 4 +- keyboards/zhaqian/tester/f103/mcuconf.h | 3 + keyboards/zhaqian/tester/f103/rules.mk | 20 +++--- keyboards/zhaqian/tester/f103/uf2_boot.c | 30 +++++++++ keyboards/zhaqian/tester/keymaps/via/rules.mk | 34 +++++----- keyboards/zhaqian/tester/rules.mk | 1 - keyboards/zhaqian/tester/tester.c | 12 +++- keyboards/zhaqian/zq68/config.h | 3 + keyboards/zhaqian/zq68/keymaps/via/rules.mk | 1 + keyboards/zhaqian/zq68/rules.mk | 7 +- keyboards/zhaqian/zq68/uf2_boot.c | 30 +++++++++ 22 files changed, 130 insertions(+), 116 deletions(-) create mode 100644 keyboards/zhaqian/tester/f103/uf2_boot.c create mode 100644 keyboards/zhaqian/zq68/uf2_boot.c diff --git a/keyboards/zhaqian/readme.md b/keyboards/zhaqian/readme.md index 11c320e5c3ac..67b63b4066da 100644 --- a/keyboards/zhaqian/readme.md +++ b/keyboards/zhaqian/readme.md @@ -31,7 +31,7 @@ | zq11800 | 0x00AA | 0xAA0A | Solder | Atmel atmega32u4 | ENCODER, RGB | | wave87 | 0x00AA | 0xAA0B | Hotswap | Atmel atmega32u4 | LOGORGB | | zq980mini | 0x00AA | 0xAA0C | Hotswap | Atmel atmega32u4 | RGB, UGRGB | -| zq67rev2 | 0x00AA | 0xAA0D | Hotswap | Atmel atmega32u4 | RGB | +| zq67rev2 | 0x00AA | 0xAA0D | Hotswap | ST stm32f103/f103 | RGB | | zq64 | 0x00AA | 0xAA0E | Hotswap | Atmel atmega32u4 | RGB, ENCODER | | zq68 | 0x00AA | 0xAA0F | Hotswap | Atmel atmega32u4 | RGB, ENCODER | | toxic67 | 0x00AA | 0xAA10 | Hotswap | Atmel atmega32u4 | RGB | diff --git a/keyboards/zhaqian/readme_cn.md b/keyboards/zhaqian/readme_cn.md index 3ec4051e786c..0d68f8332e68 100644 --- a/keyboards/zhaqian/readme_cn.md +++ b/keyboards/zhaqian/readme_cn.md @@ -30,7 +30,7 @@ | zq11800 | 0x00AA | 0xAA0A | Solder | Atmel atmega32u4 | ENCODER, RGB | | wave87 | 0x00AA | 0xAA0B | Hotswap | Atmel atmega32u4 | LOGORGB | | zq980mini | 0x00AA | 0xAA0C | Hotswap | Atmel atmega32u4 | RGB, UGRGB | -| zq67rev2 | 0x00AA | 0xAA0D | Hotswap | Atmel atmega32u4 | RGB | +| zq67rev2 | 0x00AA | 0xAA0D | Hotswap | ST stm32f103/f103 | RGB | | zq64 | 0x00AA | 0xAA0E | Hotswap | Atmel atmega32u4 | RGB, ENCODER | | zq68 | 0x00AA | 0xAA0F | Hotswap | Atmel atmega32u4 | RGB, ENCODER | | toxic67 | 0x00AA | 0xAA10 | Hotswap | Atmel atmega32u4 | RGB | diff --git a/keyboards/zhaqian/s80/board.h b/keyboards/zhaqian/s80/board.h index 08479e31ab83..466f23dfa148 100644 --- a/keyboards/zhaqian/s80/board.h +++ b/keyboards/zhaqian/s80/board.h @@ -21,5 +21,3 @@ #undef STM32_HSECLK #define STM32_HSECLK 8000000 -#undef STM32F103xB -#define STM32F103x8 \ No newline at end of file diff --git a/keyboards/zhaqian/s80/config.h b/keyboards/zhaqian/s80/config.h index 3d7cd3ab21b7..8570d1a1b824 100644 --- a/keyboards/zhaqian/s80/config.h +++ b/keyboards/zhaqian/s80/config.h @@ -44,7 +44,7 @@ #ifdef RGB_MATRIX_ENABLE #define RGB_DI_PIN A10 -#define RGBLED_NUM 25 +#define RGBLED_NUM 32 #define DRIVER_LED_TOTAL RGBLED_NUM #define WS2812_PWM_DRIVER PWMD1 #define WS2812_PWM_CHANNEL 3 @@ -78,3 +78,5 @@ #ifdef UNDERGLOW_RGB_MATRIX_ENABLE #define UG_RGB_MATRIX_ANIMATIONS #endif + +#define FEE_MCU_FLASH_SIZE 64 \ No newline at end of file diff --git a/keyboards/zhaqian/s80/keymaps/via/rules.mk b/keyboards/zhaqian/s80/keymaps/via/rules.mk index 83c5cf2e7951..0599d6f9d6a6 100644 --- a/keyboards/zhaqian/s80/keymaps/via/rules.mk +++ b/keyboards/zhaqian/s80/keymaps/via/rules.mk @@ -3,6 +3,3 @@ RGB_MATRIX_ENABLE = yes RGB_MATRIX_DRIVER = WS2812 RGB_MATRIX_CUSTOM_KB = yes WS2812_DRIVER = pwm -VIA_CUSTOM_KEYCODE_ENABLE = yes -RGB_MATRIX_CONTROL_ENABLE = yes -UNDERGLOW_RGB_MATRIX_ENABLE = yes diff --git a/keyboards/zhaqian/s80/s80.c b/keyboards/zhaqian/s80/s80.c index cac2061bebfc..e81fdd2087db 100644 --- a/keyboards/zhaqian/s80/s80.c +++ b/keyboards/zhaqian/s80/s80.c @@ -28,12 +28,14 @@ led_config_t g_led_config = { {NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED}, }, { {0, 42}, {0, 18}, {64, 0}, {96, 0}, {128, 0}, {160, 0}, {192, 0}, {224, 0}, {224, 18}, - {224, 64}, {224, 48}, {224, 32}, {224, 16}, {224, 0}, {192, 0}, {160, 0}, {128, 0}, - {96, 0}, {64, 0}, {32, 0}, {0, 0}, {0, 16}, {0, 32}, {0, 48}, {0, 64}, + {224, 64}, {224, 48}, {224, 32}, {224, 16}, {224, 0}, + {208, 0}, {192, 0}, {176, 0}, {160, 0}, {144, 0}, {128, 0}, {112, 0}, {96, 0}, {80, 0}, {64, 0}, {48, 0}, {32, 0}, {16, 0}, + {0, 0}, {0, 16}, {0, 32}, {0, 48}, {0, 64}, }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, }}; #ifdef RGB_DISABLE_WHEN_USB_SUSPENDED diff --git a/keyboards/zhaqian/s80/s80_via.json b/keyboards/zhaqian/s80/s80_via.json index 8ce863259ed2..d02b86e1c083 100644 --- a/keyboards/zhaqian/s80/s80_via.json +++ b/keyboards/zhaqian/s80/s80_via.json @@ -10,73 +10,6 @@ "rows": 6, "cols": 17 }, - "customKeycodes": [ - { - "name": "Underglow\nRGB\nToggle", - "title": "Underglow RGB Toggle", - "shortName": "UGRGB Tog" - }, - { - "name": "Key\nRGB\nToggle", - "title": "Key RGB Toggle", - "shortName": "KeyRGB\nTog" - }, - { - "name": "Underglow\nRGB\nMode\nSync", - "title": "Underglow RGB Mode Sync With Key RGB Mode", - "shortName": "UGRGB\nMODS" - }, - { - "name": "Underglow\nRGB\nMode+", - "title": "Underglow RGB Mode Step", - "shortName": "UGRGB\nMOD+" - }, - { - "name": "Underglow\nRGB\nMode-", - "title": "Underglow RGB Mode Step Reverse", - "shortName": "UGRGB\nMOD-" - }, - { - "name": "Underglow\nRGB\nHue+", - "title": "Underglow RGB Hue Increase", - "shortName": "UGRGB\nHue+" - }, - { - "name": "Underglow\nRGB\nHue-", - "title": "Underglow RGB Hue Decrease", - "shortName": "UGRGB\nHue-" - }, - { - "name": "Underglow\nRGB\nSat+", - "title": "Underglow RGB Sat Increase", - "shortName": "UGRGB\nSat+" - }, - { - "name": "Underglow\nRGB\nSat-", - "title": "Underglow RGB Sat Decrease", - "shortName": "UGRGB\nSat-" - }, - { - "name": "Underglow\nRGB\nVal+", - "title": "Underglow RGB Val Increase", - "shortName": "UGRGB\nVal+" - }, - { - "name": "Underglow\nRGB\nVal-", - "title": "Underglow RGB Val Decrease", - "shortName": "UGRGB\nVal-" - }, - { - "name": "Underglow\nRGB\nSPD+", - "title": "Underglow RGB Speed Increase", - "shortName": "UGRGB\nSPD+" - }, - { - "name": "Underglow\nRGB\nSPD-", - "title": "Underglow RGB Speed Decrease", - "shortName": "UGRGB\nSPD-" - } - ], "layouts": { "keymap": [ [ diff --git a/keyboards/zhaqian/sp67/board.h b/keyboards/zhaqian/sp67/board.h index ecc888a03c7c..466f23dfa148 100644 --- a/keyboards/zhaqian/sp67/board.h +++ b/keyboards/zhaqian/sp67/board.h @@ -21,5 +21,3 @@ #undef STM32_HSECLK #define STM32_HSECLK 8000000 -#undef STM32F103xB -#define STM32F103x8 diff --git a/keyboards/zhaqian/sp67/config.h b/keyboards/zhaqian/sp67/config.h index a493ad03e1d4..e4791ec3d0e9 100644 --- a/keyboards/zhaqian/sp67/config.h +++ b/keyboards/zhaqian/sp67/config.h @@ -52,3 +52,4 @@ #endif #endif +#define FEE_MCU_FLASH_SIZE 64 \ No newline at end of file diff --git a/keyboards/zhaqian/tester/cm32m101a/rules.mk b/keyboards/zhaqian/tester/cm32m101a/rules.mk index f5e9990e3bb4..b35132652539 100644 --- a/keyboards/zhaqian/tester/cm32m101a/rules.mk +++ b/keyboards/zhaqian/tester/cm32m101a/rules.mk @@ -5,10 +5,6 @@ BOOTLOADER = stm32-dfu OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE -KEYBOARD_SHARED_EP = no +KEYBOARD_SHARED_EP = yes # WS2812_DRIVER = pwm # LTO_ENABLE = yes -SRC += ../../../../lib/RTT/SEGGER_RTT_printf.c \ - ../../../../lib/RTT/SEGGER_RTT.c - -INC += ../../../../lib/RTT \ No newline at end of file diff --git a/keyboards/zhaqian/tester/f103/config.h b/keyboards/zhaqian/tester/f103/config.h index 3941de61bbc6..e63a899fa273 100644 --- a/keyboards/zhaqian/tester/f103/config.h +++ b/keyboards/zhaqian/tester/f103/config.h @@ -47,4 +47,8 @@ #undef UG_RGB_MATRIX_WPM_ANIMATIONS #endif // #define DEBUG_EEPROM_OUTPUT -#define DEBUG_MATRIX_SCAN_RATE +// #define DEBUG_MATRIX_SCAN_RATE + +#define SERIAL_DRIVER SD2 +#define SD1_TX_PIN A2 +#define SD1_RX_PIN A3 \ No newline at end of file diff --git a/keyboards/zhaqian/tester/f103/halconf.h b/keyboards/zhaqian/tester/f103/halconf.h index aeba543aafe5..7639e8909000 100644 --- a/keyboards/zhaqian/tester/f103/halconf.h +++ b/keyboards/zhaqian/tester/f103/halconf.h @@ -16,6 +16,6 @@ #pragma once -// #define HAL_USE_PWM TRUE - +#define HAL_USE_PWM TRUE +#define HAL_USE_SERIAL TRUE #include_next diff --git a/keyboards/zhaqian/tester/f103/mcuconf.h b/keyboards/zhaqian/tester/f103/mcuconf.h index 7a3e1ada9178..279a93f17714 100644 --- a/keyboards/zhaqian/tester/f103/mcuconf.h +++ b/keyboards/zhaqian/tester/f103/mcuconf.h @@ -23,3 +23,6 @@ #undef STM32_ST_USE_TIMER #define STM32_ST_USE_TIMER 3 + +#undef STM32_SERIAL_USE_USART2 +#define STM32_SERIAL_USE_USART2 TRUE \ No newline at end of file diff --git a/keyboards/zhaqian/tester/f103/rules.mk b/keyboards/zhaqian/tester/f103/rules.mk index c557c2504b2e..97bb17652686 100644 --- a/keyboards/zhaqian/tester/f103/rules.mk +++ b/keyboards/zhaqian/tester/f103/rules.mk @@ -1,14 +1,18 @@ MCU = STM32F103 +MCU_LDSCRIPT = STM32F103xB_uf2 +FIRMWARE_FORMAT = uf2 +BOARD = STM32_F103_STM32DUINO +# Bootloader selection +BOOTLOADER = custom # BOOTLOADER = stm32duino -BOOTLOADER = tinyuf2 -ifeq ($(strip $(BOOTLOADER)), tinyuf2) - MCU_LDSCRIPT = STM32F103x8_uf2 - FIRMWARE_FORMAT = uf2 - BOARD = STM32_F103_STM32DUINO -endif + OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE KEYBOARD_SHARED_EP = yes -# WS2812_DRIVER = pwm -CONSOLE_ENABLE = yes +WS2812_DRIVER = pwm + +QUANTUM_LIB_SRC += uart.c +SRC += uf2_boot.c + + diff --git a/keyboards/zhaqian/tester/f103/uf2_boot.c b/keyboards/zhaqian/tester/f103/uf2_boot.c new file mode 100644 index 000000000000..c09adb15d6f2 --- /dev/null +++ b/keyboards/zhaqian/tester/f103/uf2_boot.c @@ -0,0 +1,30 @@ +/* Copyright 2022 ZhaQian + * + * 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 . + */ + +#include "bootloader.h" + +#include + +#define MAGIC_BOOT 0x544F4F42UL +#define MAGIC_REG *(volatile uint32_t*)0x20004000 + +void bootloader_jump(void) { + MAGIC_REG = MAGIC_BOOT; + NVIC_SystemReset(); +} + +void enter_bootloader_mode_if_requested(void) {} + diff --git a/keyboards/zhaqian/tester/keymaps/via/rules.mk b/keyboards/zhaqian/tester/keymaps/via/rules.mk index aeeb31bc29c3..c139fefc24cb 100644 --- a/keyboards/zhaqian/tester/keymaps/via/rules.mk +++ b/keyboards/zhaqian/tester/keymaps/via/rules.mk @@ -1,23 +1,23 @@ -# RGB_MATRIX_ENABLE = yes -# RGB_MATRIX_DRIVER = WS2812 -# VIA_ENABLE = yes -# RGB_MATRIX_CUSTOM_KB = yes -# RGB_MATRIX_CONTROL_ENABLE = yes -# UNDERGLOW_RGB_MATRIX_ENABLE = yes -# ENCODER_ENABLE = yes -# ENCODER_TRIGGER_ENABLE = yes -# WPM_ENABLE = yes -# ALT_TAB_MARCO_ENABLE = yes -# RADIAL_CONTROLLER_ENABLE = yes -# VIA_CUSTOM_KEYCODE_ENABLE = yes +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 +VIA_ENABLE = yes +RGB_MATRIX_CUSTOM_KB = yes +RGB_MATRIX_CONTROL_ENABLE = yes +UNDERGLOW_RGB_MATRIX_ENABLE = yes +ENCODER_ENABLE = yes +ENCODER_TRIGGER_ENABLE = yes +WPM_ENABLE = yes +ALT_TAB_MARCO_ENABLE = yes +RADIAL_CONTROLLER_ENABLE = yes +VIA_CUSTOM_KEYCODE_ENABLE = yes ifeq ($(PLATFORM), AVR) LTO_ENABLE = yes endif -# ifneq ($(findstring GD32VF103, $(MCU)),) -# OPENRGB_ENABLE = no -# else -# OPENRGB_ENABLE = yes -# endif +ifneq ($(findstring GD32VF103, $(MCU)),) + OPENRGB_ENABLE = no +else + OPENRGB_ENABLE = yes +endif diff --git a/keyboards/zhaqian/tester/rules.mk b/keyboards/zhaqian/tester/rules.mk index e8f9f01731cf..903cc79501c7 100644 --- a/keyboards/zhaqian/tester/rules.mk +++ b/keyboards/zhaqian/tester/rules.mk @@ -4,4 +4,3 @@ EXTRAKEY_ENABLE = yes CONSOLE_ENABLE = no COMMAND_ENABLE = no NKRO_ENABLE = yes - diff --git a/keyboards/zhaqian/tester/tester.c b/keyboards/zhaqian/tester/tester.c index 55f8591894b9..2399ca260318 100644 --- a/keyboards/zhaqian/tester/tester.c +++ b/keyboards/zhaqian/tester/tester.c @@ -15,7 +15,7 @@ */ #include "tester.h" - +#include "uart.h" #ifdef RGB_MATRIX_ENABLE led_config_t g_led_config = { // @@ -66,3 +66,13 @@ void keyboard_post_init_user(void) { //debug_keyboard=true; //debug_mouse=true; } + + +void matrix_init_kb(void) { + uart_init(115200); +} + +void matrix_scan_kb(void) { + uart_write(0x11); +} + diff --git a/keyboards/zhaqian/zq68/config.h b/keyboards/zhaqian/zq68/config.h index 973cedb1ed9c..34bca0dc3014 100755 --- a/keyboards/zhaqian/zq68/config.h +++ b/keyboards/zhaqian/zq68/config.h @@ -56,6 +56,9 @@ #define RGB_MATRIX_ANIMATION #define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_MATRIX_KEYPRESSES +#ifdef RGB_MATRIX_CUSTOM_KB +#define RGB_MATRIX_CUSTOM_ANIMATION +#endif #define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 50 #endif diff --git a/keyboards/zhaqian/zq68/keymaps/via/rules.mk b/keyboards/zhaqian/zq68/keymaps/via/rules.mk index d70966377cb0..deb660e5af22 100755 --- a/keyboards/zhaqian/zq68/keymaps/via/rules.mk +++ b/keyboards/zhaqian/zq68/keymaps/via/rules.mk @@ -8,3 +8,4 @@ WS2812_DRIVER = pwm RADIAL_CONTROLLER_ENABLE = yes VIA_CUSTOM_KEYCODE_ENABLE = yes LTO_ENABLE = yes + diff --git a/keyboards/zhaqian/zq68/rules.mk b/keyboards/zhaqian/zq68/rules.mk index 7fbbf86fece2..19babb81b0e9 100755 --- a/keyboards/zhaqian/zq68/rules.mk +++ b/keyboards/zhaqian/zq68/rules.mk @@ -1,8 +1,11 @@ # MCU name MCU = STM32F103 +MCU_LDSCRIPT = STM32F103xB_uf2 +FIRMWARE_FORMAT = uf2 +BOARD = STM32_F103_STM32DUINO # Bootloader selection -BOOTLOADER = tinyuf2 +BOOTLOADER = custom # Build Options # comment out to disable the options. @@ -17,4 +20,4 @@ NKRO_ENABLE = yes RGBLIGHT_ENABLE = no OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE - +SRC += uf2_boot.c diff --git a/keyboards/zhaqian/zq68/uf2_boot.c b/keyboards/zhaqian/zq68/uf2_boot.c new file mode 100644 index 000000000000..c09adb15d6f2 --- /dev/null +++ b/keyboards/zhaqian/zq68/uf2_boot.c @@ -0,0 +1,30 @@ +/* Copyright 2022 ZhaQian + * + * 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 . + */ + +#include "bootloader.h" + +#include + +#define MAGIC_BOOT 0x544F4F42UL +#define MAGIC_REG *(volatile uint32_t*)0x20004000 + +void bootloader_jump(void) { + MAGIC_REG = MAGIC_BOOT; + NVIC_SystemReset(); +} + +void enter_bootloader_mode_if_requested(void) {} +