Skip to content

Commit

Permalink
update f103 keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaqian12 committed May 24, 2022
1 parent 9d33290 commit 68c6c84
Show file tree
Hide file tree
Showing 22 changed files with 130 additions and 116 deletions.
2 changes: 1 addition & 1 deletion keyboards/zhaqian/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion keyboards/zhaqian/readme_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 0 additions & 2 deletions keyboards/zhaqian/s80/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@
#undef STM32_HSECLK
#define STM32_HSECLK 8000000

#undef STM32F103xB
#define STM32F103x8
4 changes: 3 additions & 1 deletion keyboards/zhaqian/s80/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -78,3 +78,5 @@
#ifdef UNDERGLOW_RGB_MATRIX_ENABLE
#define UG_RGB_MATRIX_ANIMATIONS
#endif

#define FEE_MCU_FLASH_SIZE 64
3 changes: 0 additions & 3 deletions keyboards/zhaqian/s80/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions keyboards/zhaqian/s80/s80.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
67 changes: 0 additions & 67 deletions keyboards/zhaqian/s80/s80_via.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
[
Expand Down
2 changes: 0 additions & 2 deletions keyboards/zhaqian/sp67/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@
#undef STM32_HSECLK
#define STM32_HSECLK 8000000

#undef STM32F103xB
#define STM32F103x8
1 change: 1 addition & 0 deletions keyboards/zhaqian/sp67/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@
#endif
#endif

#define FEE_MCU_FLASH_SIZE 64
6 changes: 1 addition & 5 deletions keyboards/zhaqian/tester/cm32m101a/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion keyboards/zhaqian/tester/f103/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions keyboards/zhaqian/tester/f103/halconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

#pragma once

// #define HAL_USE_PWM TRUE

#define HAL_USE_PWM TRUE
#define HAL_USE_SERIAL TRUE
#include_next <halconf.h>
3 changes: 3 additions & 0 deletions keyboards/zhaqian/tester/f103/mcuconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 12 additions & 8 deletions keyboards/zhaqian/tester/f103/rules.mk
Original file line number Diff line number Diff line change
@@ -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


30 changes: 30 additions & 0 deletions keyboards/zhaqian/tester/f103/uf2_boot.c
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

#include "bootloader.h"

#include <ch.h>

#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) {}

34 changes: 17 additions & 17 deletions keyboards/zhaqian/tester/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion keyboards/zhaqian/tester/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ EXTRAKEY_ENABLE = yes
CONSOLE_ENABLE = no
COMMAND_ENABLE = no
NKRO_ENABLE = yes

12 changes: 11 additions & 1 deletion keyboards/zhaqian/tester/tester.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#include "tester.h"

#include "uart.h"
#ifdef RGB_MATRIX_ENABLE

led_config_t g_led_config = { //
Expand Down Expand Up @@ -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);
}

3 changes: 3 additions & 0 deletions keyboards/zhaqian/zq68/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions keyboards/zhaqian/zq68/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ WS2812_DRIVER = pwm
RADIAL_CONTROLLER_ENABLE = yes
VIA_CUSTOM_KEYCODE_ENABLE = yes
LTO_ENABLE = yes

7 changes: 5 additions & 2 deletions keyboards/zhaqian/zq68/rules.mk
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -17,4 +20,4 @@ NKRO_ENABLE = yes
RGBLIGHT_ENABLE = no

OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE

SRC += uf2_boot.c
30 changes: 30 additions & 0 deletions keyboards/zhaqian/zq68/uf2_boot.c
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

#include "bootloader.h"

#include <ch.h>

#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) {}

0 comments on commit 68c6c84

Please sign in to comment.