diff options
Diffstat (limited to 'platforms')
31 files changed, 725 insertions, 389 deletions
diff --git a/platforms/arm_atsam/bootloader.mk b/platforms/arm_atsam/bootloader.mk new file mode 100644 index 0000000000..1ec42edeb6 --- /dev/null +++ b/platforms/arm_atsam/bootloader.mk @@ -0,0 +1,46 @@ +# Copyright 2017 Jack Humbert +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# If it's possible that multiple bootloaders can be used for one project, +# you can leave this unset, and the correct size will be selected +# automatically. +# +# Sets the bootloader defined in the keyboard's/keymap's rules.mk +# +# Current options for ARM (ATSAM): +# md-boot Atmel SAM-BA (only used by Drop boards) +# +# If you need to provide your own implementation, you can set inside `rules.mk` +# `BOOTLOADER = custom` -- you'll need to provide your own implementations. See +# the respective file under `platforms/<PLATFORM>/bootloaders/custom.c` to see +# which functions may be overridden. + +ifeq ($(strip $(BOOTLOADER)), custom) + OPT_DEFS += -DBOOTLOADER_CUSTOM + BOOTLOADER_TYPE = custom +endif + +ifeq ($(strip $(BOOTLOADER)), md-boot) + OPT_DEFS += -DBOOTLOADER_MD_BOOT + BOOTLOADER_TYPE = md_boot +endif + +ifeq ($(strip $(BOOTLOADER_TYPE)),) + ifneq ($(strip $(BOOTLOADER)),) + $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,Invalid bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.) + else + $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,No bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.) + endif +endif diff --git a/platforms/avr/bootloader.mk b/platforms/avr/bootloader.mk new file mode 100644 index 0000000000..63fe635d96 --- /dev/null +++ b/platforms/avr/bootloader.mk @@ -0,0 +1,144 @@ +# Copyright 2017 Jack Humbert +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# If it's possible that multiple bootloaders can be used for one project, +# you can leave this unset, and the correct size will be selected +# automatically. +# +# Sets the bootloader defined in the keyboard's/keymap's rules.mk +# +# Current options for AVR: +# halfkay PJRC Teensy +# caterina Pro Micro (Sparkfun/generic) +# atmel-dfu Atmel factory DFU +# lufa-dfu LUFA DFU +# qmk-dfu QMK DFU (LUFA + blinkenlight) +# qmk-hid QMK HID (LUFA + blinkenlight) +# bootloadhid HIDBootFlash compatible (ATmega32A) +# usbasploader USBaspLoader (ATmega328P) +# +# If you need to provide your own implementation, you can set inside `rules.mk` +# `BOOTLOADER = custom` -- you'll need to provide your own implementations. See +# the respective file under `platforms/<PLATFORM>/bootloaders/custom.c` to see +# which functions may be overridden. +# +# BOOTLOADER_SIZE can still be defined manually, but it's recommended +# you add any possible configuration to this list + +ifeq ($(strip $(BOOTLOADER)), custom) + OPT_DEFS += -DBOOTLOADER_CUSTOM + BOOTLOADER_TYPE = custom +endif + +ifeq ($(strip $(BOOTLOADER)), atmel-dfu) + OPT_DEFS += -DBOOTLOADER_ATMEL_DFU + OPT_DEFS += -DBOOTLOADER_DFU + BOOTLOADER_TYPE = dfu + + ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647)) + BOOTLOADER_SIZE = 4096 + endif + ifneq (,$(filter $(MCU), at90usb1286 at90usb1287)) + BOOTLOADER_SIZE = 8192 + endif +endif +ifeq ($(strip $(BOOTLOADER)), lufa-dfu) + OPT_DEFS += -DBOOTLOADER_LUFA_DFU + OPT_DEFS += -DBOOTLOADER_DFU + BOOTLOADER_TYPE = dfu + + ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647)) + BOOTLOADER_SIZE ?= 4096 + endif + ifneq (,$(filter $(MCU), at90usb1286 at90usb1287)) + BOOTLOADER_SIZE ?= 8192 + endif +endif +ifeq ($(strip $(BOOTLOADER)), qmk-dfu) + OPT_DEFS += -DBOOTLOADER_QMK_DFU + OPT_DEFS += -DBOOTLOADER_DFU + BOOTLOADER_TYPE = dfu + + ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647)) + BOOTLOADER_SIZE ?= 4096 + endif + ifneq (,$(filter $(MCU), at90usb1286 at90usb1287)) + BOOTLOADER_SIZE ?= 8192 + endif +endif +ifeq ($(strip $(BOOTLOADER)), qmk-hid) + OPT_DEFS += -DBOOTLOADER_QMK_HID + OPT_DEFS += -DBOOTLOADER_HID + BOOTLOADER_TYPE = dfu + + BOOTLOADER_SIZE ?= 4096 +endif +ifeq ($(strip $(BOOTLOADER)), halfkay) + OPT_DEFS += -DBOOTLOADER_HALFKAY + BOOTLOADER_TYPE = halfkay + + # Teensy 2.0 + ifeq ($(strip $(MCU)), atmega32u4) + BOOTLOADER_SIZE = 512 + endif + # Teensy 2.0++ + ifeq ($(strip $(MCU)), at90usb1286) + BOOTLOADER_SIZE = 1024 + endif +endif +ifeq ($(strip $(BOOTLOADER)), caterina) + OPT_DEFS += -DBOOTLOADER_CATERINA + BOOTLOADER_TYPE = caterina + + BOOTLOADER_SIZE = 4096 +endif +ifeq ($(strip $(BOOTLOADER)), bootloadhid) + OPT_DEFS += -DBOOTLOADER_BOOTLOADHID + BOOTLOADER_TYPE = bootloadhid + + BOOTLOADER_SIZE = 4096 +endif +ifeq ($(strip $(BOOTLOADER)), usbasploader) + OPT_DEFS += -DBOOTLOADER_USBASP + BOOTLOADER_TYPE = usbasploader + + BOOTLOADER_SIZE = 4096 +endif +ifeq ($(strip $(BOOTLOADER)), lufa-ms) + OPT_DEFS += -DBOOTLOADER_MS + BOOTLOADER_TYPE = dfu + + BOOTLOADER_SIZE ?= 8192 + FIRMWARE_FORMAT = bin +cpfirmware: lufa_warning +.INTERMEDIATE: lufa_warning +lufa_warning: $(FIRMWARE_FORMAT) + $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@) + $(info LUFA MASS STORAGE Bootloader selected) + $(info DO NOT USE THIS BOOTLOADER IN NEW PROJECTS!) + $(info It is extremely prone to bricking, and is only included to support existing boards.) + $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@) +endif +ifdef BOOTLOADER_SIZE + OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE)) +endif + +ifeq ($(strip $(BOOTLOADER_TYPE)),) + ifneq ($(strip $(BOOTLOADER)),) + $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,Invalid bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.) + else + $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,No bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.) + endif +endif diff --git a/platforms/avr/flash.mk b/platforms/avr/flash.mk index e058e8d296..9c2ab72410 100644 --- a/platforms/avr/flash.mk +++ b/platforms/avr/flash.mk @@ -178,9 +178,9 @@ else ifeq ($(strip $(BOOTLOADER)), halfkay) $(UNSYNC_OUTPUT_CMD) && $(call EXEC_TEENSY) else ifeq (dfu,$(findstring dfu,$(BOOTLOADER))) $(UNSYNC_OUTPUT_CMD) && $(call EXEC_DFU) -else ifneq (,$(filter $(BOOTLOADER), usbasploader USBasp)) +else ifeq ($(strip $(BOOTLOADER)), usbasploader) $(UNSYNC_OUTPUT_CMD) && $(call EXEC_USBASP) -else ifneq (,$(filter $(BOOTLOADER), bootloadhid bootloadHID)) +else ifeq ($(strip $(BOOTLOADER)), bootloadhid) $(UNSYNC_OUTPUT_CMD) && $(call EXEC_BOOTLOADHID) else ifeq ($(strip $(BOOTLOADER)), qmk-hid) $(UNSYNC_OUTPUT_CMD) && $(call EXEC_HID_LUFA) diff --git a/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/mcuconf.h index 8348e5312f..5c0859901e 100644 --- a/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/mcuconf.h +++ b/platforms/chibios/boards/GENERIC_PROMICRO_RP2040/configs/mcuconf.h @@ -79,6 +79,19 @@ #define RP_SPI_DMA_ERROR_HOOK(spip) /* + * PWM driver system settings. + */ +#define RP_PWM_USE_PWM0 FALSE +#define RP_PWM_USE_PWM1 FALSE +#define RP_PWM_USE_PWM2 FALSE +#define RP_PWM_USE_PWM3 FALSE +#define RP_PWM_USE_PWM4 FALSE +#define RP_PWM_USE_PWM5 FALSE +#define RP_PWM_USE_PWM6 FALSE +#define RP_PWM_USE_PWM7 FALSE +#define RP_PWM_IRQ_WRAP_NUMBER_PRIORITY 3 + +/* * I2C driver system settings. */ #define RP_I2C_USE_I2C0 FALSE diff --git a/platforms/chibios/boards/GENERIC_RP_RP2040/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_RP_RP2040/configs/mcuconf.h index 9d8dc61aac..f7a66c6ab9 100644 --- a/platforms/chibios/boards/GENERIC_RP_RP2040/configs/mcuconf.h +++ b/platforms/chibios/boards/GENERIC_RP_RP2040/configs/mcuconf.h @@ -79,6 +79,19 @@ #define RP_SPI_DMA_ERROR_HOOK(spip) /* + * PWM driver system settings. + */ +#define RP_PWM_USE_PWM0 FALSE +#define RP_PWM_USE_PWM1 FALSE +#define RP_PWM_USE_PWM2 FALSE +#define RP_PWM_USE_PWM3 FALSE +#define RP_PWM_USE_PWM4 FALSE +#define RP_PWM_USE_PWM5 FALSE +#define RP_PWM_USE_PWM6 FALSE +#define RP_PWM_USE_PWM7 FALSE +#define RP_PWM_IRQ_WRAP_NUMBER_PRIORITY 3 + +/* * I2C driver system settings. */ #define RP_I2C_USE_I2C0 FALSE diff --git a/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/mcuconf.h index 32b2777a81..9d26849dff 100644 --- a/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/mcuconf.h +++ b/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/mcuconf.h @@ -80,6 +80,7 @@ #define STM32_ADC_ADC1_DMA_PRIORITY 2 #define STM32_ADC_IRQ_PRIORITY 2 #define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 2 +#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) /* * GPT driver system settings. diff --git a/platforms/chibios/boards/GENERIC_WB32_F3G71XX/board/board.c b/platforms/chibios/boards/GENERIC_WB32_F3G71XX/board/board.c index e38a7e0054..f74c9e8be7 100644 --- a/platforms/chibios/boards/GENERIC_WB32_F3G71XX/board/board.c +++ b/platforms/chibios/boards/GENERIC_WB32_F3G71XX/board/board.c @@ -80,3 +80,7 @@ void __early_init(void) { void boardInit(void) { } + +void restart_usb_driver(USBDriver *usbp) { + // Do nothing. Restarting the USB driver on these boards breaks it. +} diff --git a/platforms/chibios/boards/GENERIC_WB32_FQ95XX/board/board.c b/platforms/chibios/boards/GENERIC_WB32_FQ95XX/board/board.c index 22b4ff73b5..a99537fc27 100644 --- a/platforms/chibios/boards/GENERIC_WB32_FQ95XX/board/board.c +++ b/platforms/chibios/boards/GENERIC_WB32_FQ95XX/board/board.c @@ -80,3 +80,7 @@ void __early_init(void) { void boardInit(void) { } + +void restart_usb_driver(USBDriver *usbp) { + // Do nothing. Restarting the USB driver on these boards breaks it. +} diff --git a/platforms/chibios/boards/GENERIC_WB32_FQ95XX/configs/config.h b/platforms/chibios/boards/GENERIC_WB32_FQ95XX/configs/config.h index e02e526113..d4c7e54642 100644 --- a/platforms/chibios/boards/GENERIC_WB32_FQ95XX/configs/config.h +++ b/platforms/chibios/boards/GENERIC_WB32_FQ95XX/configs/config.h @@ -18,3 +18,5 @@ #ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP # define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE #endif + +#define USB_ENDPOINTS_ARE_REORDERABLE diff --git a/platforms/chibios/boards/QMK_PM2040/configs/mcuconf.h b/platforms/chibios/boards/QMK_PM2040/configs/mcuconf.h index a737b36c1c..e33d6d785f 100644 --- a/platforms/chibios/boards/QMK_PM2040/configs/mcuconf.h +++ b/platforms/chibios/boards/QMK_PM2040/configs/mcuconf.h @@ -79,6 +79,19 @@ #define RP_SPI_DMA_ERROR_HOOK(spip) /* + * PWM driver system settings. + */ +#define RP_PWM_USE_PWM0 FALSE +#define RP_PWM_USE_PWM1 FALSE +#define RP_PWM_USE_PWM2 FALSE +#define RP_PWM_USE_PWM3 FALSE +#define RP_PWM_USE_PWM4 FALSE +#define RP_PWM_USE_PWM5 FALSE +#define RP_PWM_USE_PWM6 FALSE +#define RP_PWM_USE_PWM7 FALSE +#define RP_PWM_IRQ_WRAP_NUMBER_PRIORITY 3 + +/* * I2C driver system settings. */ #define RP_I2C_USE_I2C0 FALSE diff --git a/platforms/chibios/bootloader.mk b/platforms/chibios/bootloader.mk new file mode 100644 index 0000000000..0568d35321 --- /dev/null +++ b/platforms/chibios/bootloader.mk @@ -0,0 +1,122 @@ +# Copyright 2017 Jack Humbert +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# If it's possible that multiple bootloaders can be used for one project, +# you can leave this unset, and the correct size will be selected +# automatically. +# +# Sets the bootloader defined in the keyboard's/keymap's rules.mk +# +# Current options for ARM: +# halfkay PJRC Teensy +# kiibohd Input:Club Kiibohd bootloader (only used on their boards) +# stm32duino STM32Duino (STM32F103x8) +# stm32-dfu STM32 USB DFU in ROM +# apm32-dfu APM32 USB DFU in ROM +# wb32-dfu WB32 USB DFU in ROM +# tinyuf2 TinyUF2 +# rp2040 Raspberry Pi RP2040 +# Current options for RISC-V: +# gd32v-dfu GD32V USB DFU in ROM +# +# If you need to provide your own implementation, you can set inside `rules.mk` +# `BOOTLOADER = custom` -- you'll need to provide your own implementations. See +# the respective file under `platforms/<PLATFORM>/bootloaders/custom.c` to see +# which functions may be overridden. + +ifeq ($(strip $(BOOTLOADER)), custom) + OPT_DEFS += -DBOOTLOADER_CUSTOM + BOOTLOADER_TYPE = custom +endif + +ifeq ($(strip $(BOOTLOADER)), halfkay) + OPT_DEFS += -DBOOTLOADER_HALFKAY + BOOTLOADER_TYPE = halfkay + + # Teensy LC, 3.0, 3.1/2, 3.5, 3.6 + ifneq (,$(filter $(MCU_ORIG), MKL26Z64 MK20DX128 MK20DX256 MK64FX512 MK66FX1M0)) + FIRMWARE_FORMAT = hex + endif +endif +ifeq ($(strip $(BOOTLOADER)), stm32-dfu) + OPT_DEFS += -DBOOTLOADER_STM32_DFU + BOOTLOADER_TYPE = stm32_dfu + + # Options to pass to dfu-util when flashing + DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave + DFU_SUFFIX_ARGS ?= -v 0483 -p DF11 +endif +ifeq ($(strip $(BOOTLOADER)), apm32-dfu) + OPT_DEFS += -DBOOTLOADER_APM32_DFU + BOOTLOADER_TYPE = stm32_dfu + + # Options to pass to dfu-util when flashing + DFU_ARGS ?= -d 314B:0106 -a 0 -s 0x08000000:leave + DFU_SUFFIX_ARGS ?= -v 314B -p 0106 +endif +ifeq ($(strip $(BOOTLOADER)), gd32v-dfu) + OPT_DEFS += -DBOOTLOADER_GD32V_DFU + BOOTLOADER_TYPE = gd32v_dfu + + # Options to pass to dfu-util when flashing + DFU_ARGS ?= -d 28E9:0189 -a 0 -s 0x08000000:leave + DFU_SUFFIX_ARGS ?= -v 28E9 -p 0189 +endif +ifeq ($(strip $(BOOTLOADER)), kiibohd) + OPT_DEFS += -DBOOTLOADER_KIIBOHD + BOOTLOADER_TYPE = kiibohd + + ifeq ($(strip $(MCU_ORIG)), MK20DX128) + MCU_LDSCRIPT = MK20DX128BLDR4 + endif + ifeq ($(strip $(MCU_ORIG)), MK20DX256) + MCU_LDSCRIPT = MK20DX256BLDR8 + endif + + # Options to pass to dfu-util when flashing + DFU_ARGS = -d 1C11:B007 + DFU_SUFFIX_ARGS = -v 1C11 -p B007 +endif +ifeq ($(strip $(BOOTLOADER)), stm32duino) + OPT_DEFS += -DBOOTLOADER_STM32DUINO + MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader + BOARD = STM32_F103_STM32DUINO + BOOTLOADER_TYPE = stm32duino + + # Options to pass to dfu-util when flashing + DFU_ARGS = -d 1EAF:0003 -a 2 -R + DFU_SUFFIX_ARGS = -v 1EAF -p 0003 +endif +ifeq ($(strip $(BOOTLOADER)), tinyuf2) + OPT_DEFS += -DBOOTLOADER_TINYUF2 + BOOTLOADER_TYPE = tinyuf2 + FIRMWARE_FORMAT = uf2 +endif +ifeq ($(strip $(BOOTLOADER)), rp2040) + OPT_DEFS += -DBOOTLOADER_RP2040 + BOOTLOADER_TYPE = rp2040 +endif +ifeq ($(strip $(BOOTLOADER)), wb32-dfu) + OPT_DEFS += -DBOOTLOADER_WB32_DFU + BOOTLOADER_TYPE = wb32_dfu +endif + +ifeq ($(strip $(BOOTLOADER_TYPE)),) + ifneq ($(strip $(BOOTLOADER)),) + $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,Invalid bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.) + else + $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,No bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.) + endif +endif diff --git a/platforms/chibios/chibios_config.h b/platforms/chibios/chibios_config.h index 8dcc23727f..4c8333f07b 100644 --- a/platforms/chibios/chibios_config.h +++ b/platforms/chibios/chibios_config.h @@ -28,6 +28,18 @@ # define USE_GPIOV1 # define PAL_OUTPUT_TYPE_OPENDRAIN _Static_assert(0, "RP2040 has no Open Drain GPIO configuration, setting this is not possible"); +/* Aliases for GPIO PWM channels - every pin has at least one PWM channel + * assigned */ +# define RP2040_PWM_CHANNEL_A 1U +# define RP2040_PWM_CHANNEL_B 2U + +# define BACKLIGHT_PAL_MODE (PAL_MODE_ALTERNATE_PWM | PAL_RP_PAD_DRIVE12 | PAL_RP_GPIO_OE) +# define BACKLIGHT_PWM_COUNTER_FREQUENCY 1000000 +# define BACKLIGHT_PWM_PERIOD BACKLIGHT_PWM_COUNTER_FREQUENCY / 2048 + +# define AUDIO_PWM_PAL_MODE (PAL_MODE_ALTERNATE_PWM | PAL_RP_PAD_DRIVE12 | PAL_RP_GPIO_OE) +# define AUDIO_PWM_COUNTER_FREQUENCY 500000 + # define usb_lld_endpoint_fields # define I2C1_SCL_PAL_MODE (PAL_MODE_ALTERNATE_I2C | PAL_RP_PAD_SLEWFAST | PAL_RP_PAD_PUE | PAL_RP_PAD_DRIVE4) @@ -51,6 +63,7 @@ # define USE_GPIOV1 # define PAL_MODE_ALTERNATE_OPENDRAIN PAL_MODE_STM32_ALTERNATE_OPENDRAIN # define PAL_MODE_ALTERNATE_PUSHPULL PAL_MODE_STM32_ALTERNATE_PUSHPULL +# define AUDIO_PWM_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL # else # define PAL_OUTPUT_TYPE_OPENDRAIN PAL_STM32_OTYPE_OPENDRAIN # define PAL_OUTPUT_TYPE_PUSHPULL PAL_STM32_OTYPE_PUSHPULL @@ -72,6 +85,7 @@ # define USE_I2CV1 # define PAL_MODE_ALTERNATE_OPENDRAIN PAL_MODE_GD32_ALTERNATE_OPENDRAIN # define PAL_MODE_ALTERNATE_PUSHPULL PAL_MODE_GD32_ALTERNATE_PUSHPULL +# define AUDIO_PWM_PAL_MODE PAL_MODE_GD32_ALTERNATE_PUSHPULL # endif #endif diff --git a/platforms/chibios/converters/elite_c_to_elite_pi/_pin_defs.h b/platforms/chibios/converters/elite_c_to_elite_pi/_pin_defs.h new file mode 100644 index 0000000000..98dd37e279 --- /dev/null +++ b/platforms/chibios/converters/elite_c_to_elite_pi/_pin_defs.h @@ -0,0 +1,39 @@ +// Copyright 2022 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +// Left side (front) +#define D3 0U +#define D2 1U +// GND +// GND +#define D1 2U +#define D0 3U +#define D4 4U +#define C6 5U +#define D7 6U +#define E6 7U +#define B4 8U +#define B5 9U + +// Right side (front) +// RAW +// GND +// RESET +// VCC +#define F4 29U +#define F5 28U +#define F6 27U +#define F7 26U +#define B1 22U +#define B3 20U +#define B2 23U +#define B6 21U + +// Bottom row +#define B7 12U +#define D5 13U +#define C7 14U +#define F1 15U +#define F0 16U diff --git a/platforms/chibios/converters/elite_c_to_elite_pi/converter.mk b/platforms/chibios/converters/elite_c_to_elite_pi/converter.mk new file mode 100644 index 0000000000..590a004189 --- /dev/null +++ b/platforms/chibios/converters/elite_c_to_elite_pi/converter.mk @@ -0,0 +1,9 @@ +# Elite-Pi MCU settings for converting AVR projects +MCU := RP2040 +BOARD := QMK_PM2040 +BOOTLOADER := rp2040 + +# These are defaults based on what has been implemented for RP2040 boards +SERIAL_DRIVER ?= vendor +WS2812_DRIVER ?= vendor +BACKLIGHT_DRIVER ?= software diff --git a/platforms/chibios/converters/elite_c_to_stemcell/_pin_defs.h b/platforms/chibios/converters/elite_c_to_stemcell/_pin_defs.h new file mode 100644 index 0000000000..4458abfa1c --- /dev/null +++ b/platforms/chibios/converters/elite_c_to_stemcell/_pin_defs.h @@ -0,0 +1,54 @@ +// Copyright 2022 Mega Mind (@megamind4089) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +// Pindefs for v2.0.0 +// https://megamind4089.github.io/STeMCell/pinout/ + +// Left side (front) +#ifdef STEMCELL_UART_SWAP +# define D3 PAL_LINE(GPIOA, 3) +# define D2 PAL_LINE(GPIOA, 2) +#else +# define D3 PAL_LINE(GPIOA, 2) +# define D2 PAL_LINE(GPIOA, 3) +#endif +// GND +// GND +#ifdef STEMCELL_I2C_SWAP +# define D1 PAL_LINE(GPIOB, 6) +# define D0 PAL_LINE(GPIOB, 7) +#else +# define D1 PAL_LINE(GPIOB, 7) +# define D0 PAL_LINE(GPIOB, 6) +#endif + +#define D4 PAL_LINE(GPIOA, 15) +#define C6 PAL_LINE(GPIOB, 3) +#define D7 PAL_LINE(GPIOB, 4) +#define E6 PAL_LINE(GPIOB, 5) +#define B4 PAL_LINE(GPIOB, 8) +#define B5 PAL_LINE(GPIOB, 9) + +// Right side (front) +// RAW +// GND +// RESET +// VCC +#define F4 PAL_LINE(GPIOB, 10) +#define F5 PAL_LINE(GPIOB, 2) +#define F6 PAL_LINE(GPIOB, 1) +#define F7 PAL_LINE(GPIOB, 0) + +#define B1 PAL_LINE(GPIOA, 5) +#define B3 PAL_LINE(GPIOA, 6) +#define B2 PAL_LINE(GPIOA, 7) +#define B6 PAL_LINE(GPIOA, 4) + +// Bottom row +#define B7 PAL_LINE(GPIOC, 13) +#define D5 PAL_LINE(GPIOC, 14) +#define C7 PAL_LINE(GPIOC, 15) +#define F1 PAL_LINE(GPIOA, 0) +#define F0 PAL_LINE(GPIOA, 1) diff --git a/platforms/chibios/converters/elite_c_to_stemcell/converter.mk b/platforms/chibios/converters/elite_c_to_stemcell/converter.mk new file mode 100644 index 0000000000..1bbe9bf09e --- /dev/null +++ b/platforms/chibios/converters/elite_c_to_stemcell/converter.mk @@ -0,0 +1,18 @@ +# Copyright 2022 Mega Mind (@megamind4089) +# SPDX-License-Identifier: GPL-2.0-or-later + +MCU := STM32F411 +BOARD := STEMCELL +BOOTLOADER := tinyuf2 + +SERIAL_DRIVER ?= usart +WS2812_DRIVER ?= bitbang + +ifeq ($(strip $(STMC_US)), yes) + OPT_DEFS += -DSTEMCELL_UART_SWAP +endif + +ifeq ($(strip $(STMC_IS)), yes) + OPT_DEFS += -DSTEMCELL_I2C_SWAP +endif + diff --git a/platforms/chibios/converters/promicro_to_elite_pi/_pin_defs.h b/platforms/chibios/converters/promicro_to_elite_pi/_pin_defs.h new file mode 100644 index 0000000000..1372bef79e --- /dev/null +++ b/platforms/chibios/converters/promicro_to_elite_pi/_pin_defs.h @@ -0,0 +1,36 @@ +// Copyright 2022 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +// Left side (front) +#define D3 0U +#define D2 1U +// GND +// GND +#define D1 2U +#define D0 3U +#define D4 4U +#define C6 5U +#define D7 6U +#define E6 7U +#define B4 8U +#define B5 9U + +// Right side (front) +// RAW +// GND +// RESET +// VCC +#define F4 29U +#define F5 28U +#define F6 27U +#define F7 26U +#define B1 22U +#define B3 20U +#define B2 23U +#define B6 21U + +// LEDs +#define D5 12U +#define B0 13U diff --git a/platforms/chibios/converters/promicro_to_elite_pi/converter.mk b/platforms/chibios/converters/promicro_to_elite_pi/converter.mk new file mode 100644 index 0000000000..590a004189 --- /dev/null +++ b/platforms/chibios/converters/promicro_to_elite_pi/converter.mk @@ -0,0 +1,9 @@ +# Elite-Pi MCU settings for converting AVR projects +MCU := RP2040 +BOARD := QMK_PM2040 +BOOTLOADER := rp2040 + +# These are defaults based on what has been implemented for RP2040 boards +SERIAL_DRIVER ?= vendor +WS2812_DRIVER ?= vendor +BACKLIGHT_DRIVER ?= software diff --git a/platforms/chibios/converters/promicro_to_proton_c/post_converter.mk b/platforms/chibios/converters/promicro_to_proton_c/post_converter.mk new file mode 100644 index 0000000000..12651bd87c --- /dev/null +++ b/platforms/chibios/converters/promicro_to_proton_c/post_converter.mk @@ -0,0 +1 @@ +BACKLIGHT_DRIVER ?= software diff --git a/platforms/chibios/drivers/analog.c b/platforms/chibios/drivers/analog.c index a7b7ec76d7..8b03e73849 100644 --- a/platforms/chibios/drivers/analog.c +++ b/platforms/chibios/drivers/analog.c @@ -22,7 +22,7 @@ # error "You need to set HAL_USE_ADC to TRUE in your halconf.h to use the ADC." #endif -#if !STM32_ADC_USE_ADC1 && !STM32_ADC_USE_ADC2 && !STM32_ADC_USE_ADC3 && !STM32_ADC_USE_ADC4 +#if !STM32_ADC_USE_ADC1 && !STM32_ADC_USE_ADC2 && !STM32_ADC_USE_ADC3 && !STM32_ADC_USE_ADC4 && !WB32_ADC_USE_ADC1 # error "You need to set one of the 'STM32_ADC_USE_ADCx' settings to TRUE in your mcuconf.h to use the ADC." #endif @@ -37,7 +37,7 @@ // Otherwise assume V3 #if defined(STM32F0XX) || defined(STM32L0XX) # define USE_ADCV1 -#elif defined(STM32F1XX) || defined(STM32F2XX) || defined(STM32F4XX) || defined(GD32VF103) +#elif defined(STM32F1XX) || defined(STM32F2XX) || defined(STM32F4XX) || defined(GD32VF103) || defined(WB32F3G71xx) || defined(WB32FQ95xx) # define USE_ADCV2 #endif @@ -74,7 +74,7 @@ /* User configurable ADC options */ #ifndef ADC_COUNT -# if defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F4XX) || defined(GD32VF103) +# if defined(STM32F0XX) || |