diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index 417a1a0960f3..33f732c494ae 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -72,7 +72,9 @@ "RP2040", "SN32F248F", "SN32F248BF", + "SN32F248CF", "SN32F268F", + "SN32F299F", "STM32F042", "STM32F072", "STM32F103", diff --git a/keyboards/handwired/onekey/sn32f240c/config.h b/keyboards/handwired/onekey/sn32f240c/config.h new file mode 100644 index 000000000000..22af1955aa2c --- /dev/null +++ b/keyboards/handwired/onekey/sn32f240c/config.h @@ -0,0 +1,24 @@ +/* Copyright 2024 Dimitris Mantzouranis + * + * 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 . + */ + +#pragma once +/* +#define I2C_DRIVER I2CD0 +#define I2C1_SCL_PIN A6 +#define I2C1_SDA_PIN A7 +#define I2C1_OPMODE OPMODE_I2C +#define I2C1_CLOCK_SPEED 400000 +*/ \ No newline at end of file diff --git a/keyboards/handwired/onekey/sn32f240c/info.json b/keyboards/handwired/onekey/sn32f240c/info.json new file mode 100644 index 000000000000..d0eaa0ce636f --- /dev/null +++ b/keyboards/handwired/onekey/sn32f240c/info.json @@ -0,0 +1,9 @@ +{ + "keyboard_name": "Onekey SN32F240C", + "processor": "SN32F248CF", + "bootloader": "sn32-dfu", + "matrix_pins": { + "cols": ["A8"], + "rows": ["D11"] + } +} diff --git a/keyboards/handwired/onekey/sn32f240c/mcuconf.h b/keyboards/handwired/onekey/sn32f240c/mcuconf.h new file mode 100644 index 000000000000..d8556da7b69c --- /dev/null +++ b/keyboards/handwired/onekey/sn32f240c/mcuconf.h @@ -0,0 +1,19 @@ +/* Copyright 2024 Dimitris Mantzouranis + * + * 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 . + */ +#pragma once + +//#define SN32_I2C_USE_I2C0 TRUE +#include_next diff --git a/keyboards/handwired/onekey/sn32f240c/readme.md b/keyboards/handwired/onekey/sn32f240c/readme.md new file mode 100644 index 000000000000..ec6ab40c2687 --- /dev/null +++ b/keyboards/handwired/onekey/sn32f240c/readme.md @@ -0,0 +1,5 @@ +# SN32F240C onekey + +Supported Hardware: *SN32F240C*. + +To trigger keypress, short together pins *A8* and *D11*. diff --git a/keyboards/handwired/onekey/sn32f290/config.h b/keyboards/handwired/onekey/sn32f290/config.h new file mode 100644 index 000000000000..22af1955aa2c --- /dev/null +++ b/keyboards/handwired/onekey/sn32f290/config.h @@ -0,0 +1,24 @@ +/* Copyright 2024 Dimitris Mantzouranis + * + * 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 . + */ + +#pragma once +/* +#define I2C_DRIVER I2CD0 +#define I2C1_SCL_PIN A6 +#define I2C1_SDA_PIN A7 +#define I2C1_OPMODE OPMODE_I2C +#define I2C1_CLOCK_SPEED 400000 +*/ \ No newline at end of file diff --git a/keyboards/handwired/onekey/sn32f290/info.json b/keyboards/handwired/onekey/sn32f290/info.json new file mode 100644 index 000000000000..b8fbe8b6bfea --- /dev/null +++ b/keyboards/handwired/onekey/sn32f290/info.json @@ -0,0 +1,9 @@ +{ + "keyboard_name": "Onekey SN32F290", + "processor": "SN32F299F", + "bootloader": "sn32-dfu", + "matrix_pins": { + "cols": ["A8"], + "rows": ["D11"] + } +} diff --git a/keyboards/handwired/onekey/sn32f290/mcuconf.h b/keyboards/handwired/onekey/sn32f290/mcuconf.h new file mode 100644 index 000000000000..d8556da7b69c --- /dev/null +++ b/keyboards/handwired/onekey/sn32f290/mcuconf.h @@ -0,0 +1,19 @@ +/* Copyright 2024 Dimitris Mantzouranis + * + * 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 . + */ +#pragma once + +//#define SN32_I2C_USE_I2C0 TRUE +#include_next diff --git a/keyboards/handwired/onekey/sn32f290/readme.md b/keyboards/handwired/onekey/sn32f290/readme.md new file mode 100644 index 000000000000..63d80fc4cdcc --- /dev/null +++ b/keyboards/handwired/onekey/sn32f290/readme.md @@ -0,0 +1,5 @@ +# SN32F290 onekey + +Supported Hardware: *SN32F290*. + +To trigger keypress, short together pins *A8* and *D11*. diff --git a/lib/python/qmk/constants.py b/lib/python/qmk/constants.py index 4a13942ef175..127f7d09fd22 100644 --- a/lib/python/qmk/constants.py +++ b/lib/python/qmk/constants.py @@ -22,7 +22,7 @@ MAX_KEYBOARD_SUBFOLDERS = 5 # Supported processor types -CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK64FX512', 'MK66FX1M0', 'RP2040', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32H723', 'STM32H733', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L442', 'STM32L443', 'GD32VF103', 'WB32F3G71', 'WB32FQ95', 'SN32F248F', 'SN32F248BF', 'SN32F268F' +CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK64FX512', 'MK66FX1M0', 'RP2040', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32H723', 'STM32H733', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L442', 'STM32L443', 'GD32VF103', 'WB32F3G71', 'WB32FQ95', 'SN32F248F', 'SN32F248BF', 'SN32F248CF', 'SN32F268F', 'SN32F299F' LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85' @@ -57,7 +57,9 @@ "WB32FQ95": "wb32-dfu", "SN32F248F": "sn32-dfu", "SN32F248BF": "sn32-dfu", + "SN32F248CF": "sn32-dfu", "SN32F268F": "sn32-dfu", + "SN32F299F": "sn32-dfu", "atmega16u2": "atmel-dfu", "atmega32u2": "atmel-dfu", "atmega16u4": "atmel-dfu", @@ -127,7 +129,9 @@ 'sn32-dfu': { ("0c45", "7010"), # SN32F260 ("0c45", "7040"), # SN32F240B - ("0c45", "7900") # SN32F240 + ("0c45", "7160"), # SN32F240C + ("0c45", "7900"), # SN32F240 + ("0c45", "7140") # SN32F290 } } diff --git a/platforms/chibios/boards/SN_SN32F240C/board/board.mk b/platforms/chibios/boards/SN_SN32F240C/board/board.mk new file mode 100644 index 000000000000..d71b2eb4e24c --- /dev/null +++ b/platforms/chibios/boards/SN_SN32F240C/board/board.mk @@ -0,0 +1,16 @@ +# List of all the board related files. +BOARDSRC = $(CHIBIOS_CONTRIB)/os/hal/boards/SN_SN32F240C/board.c + +# Required include directories +BOARDINC = $(CHIBIOS_CONTRIB)/os/hal/boards/SN_SN32F240C + +# Optimize for speed +OPT = 2 +# Enter lower-power sleep mode when on the ChibiOS idle thread +OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE +# Shave some extra bytes +OPT_DEFS += -DCRT1_AREAS_NUMBER=1 + +# Shared variables +ALLCSRC += $(BOARDSRC) +ALLINC += $(BOARDINC) diff --git a/platforms/chibios/boards/SN_SN32F240C/configs/chconf.h b/platforms/chibios/boards/SN_SN32F240C/configs/chconf.h new file mode 100644 index 000000000000..9ddf788a20c0 --- /dev/null +++ b/platforms/chibios/boards/SN_SN32F240C/configs/chconf.h @@ -0,0 +1,38 @@ +/* Copyright 2020 QMK + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i platforms/chibios/boards/SN_SN32F240C/configs/chconf.h -r platforms/chibios/boards/common/configs/chconf.h` + */ + +#pragma once + +#define CH_CFG_ST_RESOLUTION 16 + +#define CH_CFG_ST_FREQUENCY 187500 + +#include_next + +#undef CH_CFG_IDLE_ENTER_HOOK +#define CH_CFG_IDLE_ENTER_HOOK() { \ + SN_PMU->CTRL = 4; \ +} + +#undef CH_CFG_IDLE_LEAVE_HOOK +#define CH_CFG_IDLE_LEAVE_HOOK() { \ + SN_PMU->CTRL = 0; \ +} diff --git a/platforms/chibios/boards/SN_SN32F240C/configs/config.h b/platforms/chibios/boards/SN_SN32F240C/configs/config.h new file mode 100644 index 000000000000..efdfd59387d7 --- /dev/null +++ b/platforms/chibios/boards/SN_SN32F240C/configs/config.h @@ -0,0 +1,24 @@ +/* Copyright 2024 Dimitris Mantzouranis + * + * 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 . + */ +#pragma once + +#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP +# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE +#endif + +#ifndef WEAR_LEVELING_EFL_OMIT_LAST_SECTOR_COUNT +# define WEAR_LEVELING_EFL_OMIT_LAST_SECTOR_COUNT 1 +#endif \ No newline at end of file diff --git a/platforms/chibios/boards/SN_SN32F290/board/board.mk b/platforms/chibios/boards/SN_SN32F290/board/board.mk new file mode 100644 index 000000000000..2f122ccdf2d5 --- /dev/null +++ b/platforms/chibios/boards/SN_SN32F290/board/board.mk @@ -0,0 +1,16 @@ +# List of all the board related files. +BOARDSRC = $(CHIBIOS_CONTRIB)/os/hal/boards/SN_SN32F290/board.c + +# Required include directories +BOARDINC = $(CHIBIOS_CONTRIB)/os/hal/boards/SN_SN32F290 + +# Optimize for speed +OPT = 2 +# Enter lower-power sleep mode when on the ChibiOS idle thread +OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE +# Shave some extra bytes +OPT_DEFS += -DCRT1_AREAS_NUMBER=1 + +# Shared variables +ALLCSRC += $(BOARDSRC) +ALLINC += $(BOARDINC) diff --git a/platforms/chibios/boards/SN_SN32F290/configs/chconf.h b/platforms/chibios/boards/SN_SN32F290/configs/chconf.h new file mode 100644 index 000000000000..ea57a2ca2271 --- /dev/null +++ b/platforms/chibios/boards/SN_SN32F290/configs/chconf.h @@ -0,0 +1,38 @@ +/* Copyright 2024 Dimitris Mantzouranis + * + * 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 . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i platforms/chibios/boards/SN_SN32F240B/configs/chconf.h -r platforms/chibios/boards/common/configs/chconf.h` + */ + +#pragma once + +#define CH_CFG_ST_RESOLUTION 16 + +#define CH_CFG_ST_FREQUENCY 187500 + +#include_next + +#undef CH_CFG_IDLE_ENTER_HOOK +#define CH_CFG_IDLE_ENTER_HOOK() { \ + SN_PMU->CTRL = 4; \ +} + +#undef CH_CFG_IDLE_LEAVE_HOOK +#define CH_CFG_IDLE_LEAVE_HOOK() { \ + SN_PMU->CTRL = 0; \ +} diff --git a/platforms/chibios/boards/SN_SN32F290/configs/config.h b/platforms/chibios/boards/SN_SN32F290/configs/config.h new file mode 100644 index 000000000000..efdfd59387d7 --- /dev/null +++ b/platforms/chibios/boards/SN_SN32F290/configs/config.h @@ -0,0 +1,24 @@ +/* Copyright 2024 Dimitris Mantzouranis + * + * 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 . + */ +#pragma once + +#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP +# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE +#endif + +#ifndef WEAR_LEVELING_EFL_OMIT_LAST_SECTOR_COUNT +# define WEAR_LEVELING_EFL_OMIT_LAST_SECTOR_COUNT 1 +#endif \ No newline at end of file diff --git a/platforms/chibios/bootloader.mk b/platforms/chibios/bootloader.mk index e8b9ec94f4ef..b44cb7d66275 100644 --- a/platforms/chibios/bootloader.mk +++ b/platforms/chibios/bootloader.mk @@ -131,9 +131,15 @@ ifeq ($(strip $(BOOTLOADER)), sn32-dfu) ifeq ($(strip $(MCU_SERIES)), SN32F240B) DFU_ARGS ?= -v 0c45/7040 endif + ifeq ($(strip $(MCU_SERIES)), SN32F240C) + DFU_ARGS ?= -v 0c45/7160 + endif ifeq ($(strip $(MCU_SERIES)), SN32F260) DFU_ARGS ?= -v 0c45/7010 -o 0x200 endif + ifeq ($(strip $(MCU_SERIES)), SN32F290) + DFU_ARGS ?= -v 0c45/7140 + endif endif diff --git a/platforms/chibios/mcu_selection.mk b/platforms/chibios/mcu_selection.mk index 6ebc402bbf8a..5d78b77b8c53 100644 --- a/platforms/chibios/mcu_selection.mk +++ b/platforms/chibios/mcu_selection.mk @@ -917,6 +917,38 @@ ifneq ($(findstring SN32F248BF, $(MCU)),) SN32_BOOTLOADER_ADDRESS = 0x1FFF0301 endif +ifneq ($(findstring SN32F248CF, $(MCU)),) + # Cortex version + MCU = cortex-m0 + + # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 + ARMV = 6 + + ## chip/board settings + # - the next two should match the directories in + # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) + MCU_FAMILY = SN32 + MCU_SERIES = SN32F240C + + # Linker script to use + # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ + # or /ld/ + MCU_LDSCRIPT ?= SN32F240C + + # Startup code to use + # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/ + MCU_STARTUP ?= sn32f24xc + + # Board: it should exist either in /os/hal/boards/, + # /boards/, or drivers/boards/ + BOARD ?= SN_SN32F240C + + USE_FPU ?= no + + # Bootloader address for SN32 DFU + SN32_BOOTLOADER_ADDRESS = 0x1FFF0301 +endif + ifneq ($(findstring SN32F268F, $(MCU)),) # Cortex version MCU = cortex-m0 @@ -953,3 +985,35 @@ ifneq ($(findstring SN32F268F, $(MCU)),) # Bootloader address for SN32 DFU SN32_BOOTLOADER_ADDRESS = 0x1FFF0009 endif + +ifneq ($(findstring SN32F299F, $(MCU)),) + # Cortex version + MCU = cortex-m0 + + # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 + ARMV = 6 + + ## chip/board settings + # - the next two should match the directories in + # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) + MCU_FAMILY = SN32 + MCU_SERIES = SN32F290 + + # Linker script to use + # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ + # or /ld/ + MCU_LDSCRIPT ?= SN32F290 + + # Startup code to use + # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/ + MCU_STARTUP ?= sn32f29x + + # Board: it should exist either in /os/hal/boards/, + # /boards/, or drivers/boards/ + BOARD ?= SN_SN32F290 + + USE_FPU ?= no + + # Bootloader address for SN32 DFU + SN32_BOOTLOADER_ADDRESS = 0x1FFF0009 +endif diff --git a/util/udev/50-qmk.rules b/util/udev/50-qmk.rules index cc7bb7544398..23f03dad7ddf 100644 --- a/util/udev/50-qmk.rules +++ b/util/udev/50-qmk.rules @@ -89,3 +89,5 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="342d", ATTRS{idProduct}=="dfa0", TAG+="uacc SUBSYSTEMS=="usb", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7010", TAG+="uaccess" SUBSYSTEMS=="usb", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7040", TAG+="uaccess" SUBSYSTEMS=="usb", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7900", TAG+="uaccess" +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7140", TAG+="uaccess" +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7160", TAG+="uaccess"