mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-09-23 09:35:12 +08:00
Westberrytech pr (#14422)
* Added support for WB32 MCU * Modified eeprom_wb32.c * Remove the eeprom_wb32-related code
This commit is contained in:
@@ -540,10 +540,39 @@ ifneq (,$(filter $(MCU),STM32L412 STM32L422))
|
||||
UF2_FAMILY ?= STM32L4
|
||||
endif
|
||||
|
||||
ifneq ($(findstring WB32F3G71, $(MCU)),)
|
||||
# Cortex version
|
||||
MCU = cortex-m3
|
||||
|
||||
# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
|
||||
ARMV = 7
|
||||
|
||||
## chip/board settings
|
||||
# - the next two should match the directories in
|
||||
# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
|
||||
MCU_FAMILY = WB32
|
||||
MCU_SERIES = WB32F3G71xx
|
||||
|
||||
# Linker script to use
|
||||
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
|
||||
# or <keyboard_dir>/ld/
|
||||
MCU_LDSCRIPT ?= WB32F3G71x9
|
||||
|
||||
# Startup code to use
|
||||
# - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
|
||||
MCU_STARTUP ?= wb32f3g71xx
|
||||
|
||||
# Board: it should exist either in <chibios>/os/hal/boards/,
|
||||
# <keyboard_dir>/boards/, or drivers/boards/
|
||||
BOARD ?= GENERIC_WB32_F3G71XX
|
||||
|
||||
USE_FPU ?= no
|
||||
endif
|
||||
|
||||
ifneq ($(findstring GD32VF103, $(MCU)),)
|
||||
# RISC-V
|
||||
MCU = risc-v
|
||||
|
||||
|
||||
# RISC-V extensions and abi configuration
|
||||
MCU_ARCH = rv32imac
|
||||
MCU_ABI = ilp32
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
},
|
||||
"processor": {
|
||||
"type": "string",
|
||||
"enum": ["cortex-m0", "cortex-m0plus", "cortex-m3", "cortex-m4", "MKL26Z64", "MK20DX128", "MK20DX256", "MK66FX1M0", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F405", "STM32F407", "STM32F411", "STM32F446", "STM32G431", "STM32G474", "STM32L412", "STM32L422", "STM32L433", "STM32L443", "GD32VF103", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"]
|
||||
"enum": ["cortex-m0", "cortex-m0plus", "cortex-m3", "cortex-m4", "MKL26Z64", "MK20DX128", "MK20DX256", "MK66FX1M0", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F405", "STM32F407", "STM32F411", "STM32F446", "STM32G431", "STM32G474", "STM32L412", "STM32L422", "STM32L433", "STM32L443", "GD32VF103", "WB32F3G71", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"]
|
||||
},
|
||||
"audio": {
|
||||
"type": "object",
|
||||
@@ -57,7 +57,7 @@
|
||||
},
|
||||
"bootloader": {
|
||||
"type": "string",
|
||||
"enum": ["atmel-dfu", "bootloadhid", "bootloadHID", "caterina", "halfkay", "kiibohd", "lufa-dfu", "lufa-ms", "micronucleus", "qmk-dfu", "qmk-hid", "stm32-dfu", "stm32duino", "gd32v-dfu", "unknown", "usbasploader", "USBasp", "tinyuf2"],
|
||||
"enum": ["atmel-dfu", "bootloadhid", "bootloadHID", "caterina", "halfkay", "kiibohd", "lufa-dfu", "lufa-ms", "micronucleus", "qmk-dfu", "qmk-hid", "stm32-dfu", "stm32duino", "gd32v-dfu", "wb32-dfu", "unknown", "usbasploader", "USBasp", "tinyuf2"],
|
||||
},
|
||||
"bootloader_instructions": {
|
||||
"type": "string",
|
||||
|
||||
@@ -37,6 +37,10 @@ You can also use any ARM chip with USB that [ChibiOS](https://www.chibios.org) s
|
||||
* [STM32L422](https://www.st.com/en/microcontrollers-microprocessors/stm32l4x2.html)
|
||||
* [STM32L433](https://www.st.com/en/microcontrollers-microprocessors/stm32l4x3.html)
|
||||
* [STM32L443](https://www.st.com/en/microcontrollers-microprocessors/stm32l4x3.html)
|
||||
|
||||
### WestBerryTech (WB32)
|
||||
|
||||
* [WB32F3G71xx](http://www.westberrytech.com)
|
||||
|
||||
### NXP (Kinetis)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ QMK_FIRMWARE_UPSTREAM = 'qmk/qmk_firmware'
|
||||
MAX_KEYBOARD_SUBFOLDERS = 5
|
||||
|
||||
# Supported processor types
|
||||
CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK66FX1M0', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32L412', 'STM32L422', 'STM32L433', 'STM32L443', 'GD32VF103'
|
||||
CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK66FX1M0', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32L412', 'STM32L422', 'STM32L433', 'STM32L443', 'GD32VF103', 'WB32F3G71'
|
||||
LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None
|
||||
VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85'
|
||||
|
||||
|
||||
@@ -624,6 +624,8 @@ def arm_processor_rules(info_data, rules):
|
||||
if 'bootloader' not in info_data:
|
||||
if 'STM32' in info_data['processor']:
|
||||
info_data['bootloader'] = 'stm32-dfu'
|
||||
elif 'WB32' in info_data['processor']:
|
||||
info_data['bootloader'] = 'wb32-dfu'
|
||||
else:
|
||||
info_data['bootloader'] = 'unknown'
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
Copyright (C) 2021 Westberry Technology (ChangZhou) Corp., Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file has been automatically generated using ChibiStudio board
|
||||
* generator plugin. Do not edit manually.
|
||||
*/
|
||||
|
||||
#include "hal.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local variables and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
static void wb32_gpio_init(void) {
|
||||
|
||||
#if WB32_HAS_GPIOA
|
||||
rccEnableAPB1(RCC_APB1ENR_GPIOAEN);
|
||||
#endif
|
||||
|
||||
#if WB32_HAS_GPIOB
|
||||
rccEnableAPB1(RCC_APB1ENR_GPIOBEN);
|
||||
#endif
|
||||
|
||||
#if WB32_HAS_GPIOC
|
||||
rccEnableAPB1(RCC_APB1ENR_GPIOCEN);
|
||||
#endif
|
||||
|
||||
#if WB32_HAS_GPIOD
|
||||
rccEnableAPB1(RCC_APB1ENR_GPIODEN);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver interrupt handlers. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
/*
|
||||
* Early initialization code.
|
||||
* This initialization must be performed just after stack setup and before
|
||||
* any other initialization.
|
||||
*/
|
||||
void __early_init(void) {
|
||||
|
||||
wb32_clock_init();
|
||||
wb32_gpio_init();
|
||||
}
|
||||
/**
|
||||
* @brief Board-specific initialization code.
|
||||
* @note You can add your board-specific code here.
|
||||
*/
|
||||
void boardInit(void) {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
/*
|
||||
Copyright (C) 2021 Westberry Technology (ChangZhou) Corp., Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file has been automatically generated using ChibiStudio board
|
||||
* generator plugin. Do not edit manually.
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*
|
||||
* Setup board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define WB32F3G71x9
|
||||
#if !defined(WB32F3G71xx)
|
||||
#define WB32F3G71xx
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if !defined(_FROM_ASM_)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void boardInit(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _FROM_ASM_ */
|
||||
|
||||
#endif /* BOARD_H */
|
||||
@@ -0,0 +1,9 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = $(BOARD_PATH)/board/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = $(BOARD_PATH)/board
|
||||
|
||||
# Shared variables
|
||||
ALLCSRC += $(BOARDSRC)
|
||||
ALLINC += $(BOARDINC)
|
||||
@@ -0,0 +1,12 @@
|
||||
/* Address for jumping to bootloader on WB32 chips. */
|
||||
/* It is chip dependent, the correct number can be looked up here:
|
||||
* http://www.westberrytech.com/down/mcu/data/WB32F3G71xx_rm.pdf
|
||||
*/
|
||||
#ifndef WB32_BOOTLOADER_ADDRESS
|
||||
# undef STM32_BOOTLOADER_ADDRESS
|
||||
# define WB32_BOOTLOADER_ADDRESS 0x1FFFE000
|
||||
# define STM32_BOOTLOADER_ADDRESS WB32_BOOTLOADER_ADDRESS
|
||||
#else
|
||||
# undef STM32_BOOTLOADER_ADDRESS
|
||||
# define STM32_BOOTLOADER_ADDRESS WB32_BOOTLOADER_ADDRESS
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
/* Copyright (C) 2021 Westberry Technology (ChangZhou) Corp., Ltd
|
||||
*
|
||||
* 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 3 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
|
||||
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP FALSE
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
Copyright (C) 2021 Westberry Technology (ChangZhou) Corp., Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef MCUCONF_H
|
||||
#define MCUCONF_H
|
||||
|
||||
#define WB32F3G71xx_MCUCONF TRUE
|
||||
|
||||
/*
|
||||
* WB32F3G71 drivers configuration.
|
||||
* The following settings override the default settings present in
|
||||
* the various device driver implementation headers.
|
||||
* Note that the settings for each driver only have effect if the whole
|
||||
* driver is enabled in halconf.h.
|
||||
*
|
||||
* IRQ priorities:
|
||||
* 15...0 Lowest...Highest.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name Internal clock sources
|
||||
* @{
|
||||
*/
|
||||
#define WB32_HSECLK 12000000
|
||||
#define WB32_LSECLK 32768
|
||||
|
||||
/*
|
||||
* HAL driver system settings.
|
||||
*/
|
||||
#define WB32_NO_INIT FALSE
|
||||
#define WB32_MHSI_ENABLED TRUE
|
||||
#define WB32_FHSI_ENABLED FALSE
|
||||
#define WB32_LSI_ENABLED FALSE
|
||||
#define WB32_HSE_ENABLED TRUE
|
||||
#define WB32_LSE_ENABLED FALSE
|
||||
#define WB32_PLL_ENABLED TRUE
|
||||
#define WB32_MAINCLKSRC WB32_MAINCLKSRC_PLL
|
||||
#define WB32_PLLSRC WB32_PLLSRC_HSE
|
||||
#define WB32_PLLDIV_VALUE 2
|
||||
#define WB32_PLLMUL_VALUE 12 //The allowed range is 12,16,20,24.
|
||||
#define WB32_HPRE 1
|
||||
#define WB32_PPRE1 1
|
||||
#define WB32_PPRE2 1
|
||||
#define WB32_USBPRE WB32_USBPRE_DIV1P5
|
||||
|
||||
/*
|
||||
* EXTI driver system settings.
|
||||
*/
|
||||
#define WB32_IRQ_EXTI0_PRIORITY 6
|
||||
#define WB32_IRQ_EXTI1_PRIORITY 6
|
||||
#define WB32_IRQ_EXTI2_PRIORITY 6
|
||||
#define WB32_IRQ_EXTI3_PRIORITY 6
|
||||
#define WB32_IRQ_EXTI4_PRIORITY 6
|
||||
#define WB32_IRQ_EXTI5_9_PRIORITY 6
|
||||
#define WB32_IRQ_EXTI10_15_PRIORITY 6
|
||||
#define WB32_IRQ_EXTI16_PRIORITY 6
|
||||
#define WB32_IRQ_EXTI17_PRIORITY 6
|
||||
#define WB32_IRQ_EXTI18_PRIORITY 6
|
||||
#define WB32_IRQ_EXTI19_PRIORITY 6
|
||||
|
||||
/*
|
||||
* GPT driver system settings.
|
||||
*/
|
||||
#define WB32_TIM_MAX_CHANNELS 4
|
||||
#define WB32_GPT_USE_TIM1 FALSE
|
||||
#define WB32_GPT_USE_TIM2 FALSE
|
||||
#define WB32_GPT_USE_TIM3 FALSE
|
||||
#define WB32_GPT_USE_TIM4 FALSE
|
||||
#define WB32_GPT_TIM1_IRQ_PRIORITY 7
|
||||
#define WB32_GPT_TIM2_IRQ_PRIORITY 7
|
||||
#define WB32_GPT_TIM3_IRQ_PRIORITY 7
|
||||
#define WB32_GPT_TIM4_IRQ_PRIORITY 7
|
||||
|
||||
/*
|
||||
* ICU driver system settings.
|
||||
*/
|
||||
#define WB32_ICU_USE_TIM1 FALSE
|
||||
#define WB32_ICU_USE_TIM2 FALSE
|
||||
#define WB32_ICU_USE_TIM3 FALSE
|
||||
#define WB32_ICU_USE_TIM4 FALSE
|
||||
#define WB32_ICU_TIM1_IRQ_PRIORITY 7
|
||||
#define WB32_ICU_TIM2_IRQ_PRIORITY 7
|
||||
#define WB32_ICU_TIM3_IRQ_PRIORITY 7
|
||||
#define WB32_ICU_TIM4_IRQ_PRIORITY 7
|
||||
|
||||
/*
|
||||
* PWM driver system settings.
|
||||
*/
|
||||
#define WB32_PWM_USE_ADVANCED FALSE
|
||||
#define WB32_PWM_USE_TIM1 FALSE
|
||||
#define WB32_PWM_USE_TIM2 FALSE
|
||||
#define WB32_PWM_USE_TIM3 FALSE
|
||||
#define WB32_PWM_USE_TIM4 FALSE
|
||||
#define WB32_PWM_TIM1_IRQ_PRIORITY 7
|
||||
#define WB32_PWM_TIM2_IRQ_PRIORITY 7
|
||||
#define WB32_PWM_TIM3_IRQ_PRIORITY 7
|
||||
#define WB32_PWM_TIM4_IRQ_PRIORITY 7
|
||||
|
||||
/*
|
||||
* I2C driver system settings.
|
||||
*/
|
||||
#define WB32_I2C_USE_I2C1 FALSE
|
||||
#define WB32_I2C_USE_I2C2 FALSE
|
||||
#define WB32_I2C_BUSY_TIMEOUT 50
|
||||
#define WB32_I2C_I2C1_IRQ_PRIORITY 5
|
||||
#define WB32_I2C_I2C2_IRQ_PRIORITY 5
|
||||
|
||||
/*
|
||||
* SERIAL driver system settings.
|
||||
*/
|
||||
#define WB32_SERIAL_USE_UART1 FALSE
|
||||
#define WB32_SERIAL_USE_UART2 FALSE
|
||||
#define WB32_SERIAL_USE_UART3 FALSE
|
||||
#define WB32_SERIAL_USART1_PRIORITY 12
|
||||
#define WB32_SERIAL_USART2_PRIORITY 12
|
||||
#define WB32_SERIAL_USART3_PRIORITY 12
|
||||
|
||||
/*
|
||||
* SPI driver system settings.
|
||||
*/
|
||||
#define WB32_SPI_USE_QSPI FALSE
|
||||
#define WB32_SPI_USE_SPIM2 FALSE
|
||||
#define WB32_SPI_USE_SPIS1 FALSE
|
||||
#define WB32_SPI_USE_SPIS2 FALSE
|
||||
#define WB32_SPI_QSPI_IRQ_PRIORITY 10
|
||||
#define WB32_SPI_SPIM2_IRQ_PRIORITY 10
|
||||
#define WB32_SPI_SPIS1_IRQ_PRIORITY 10
|
||||
#define WB32_SPI_SPIS2_IRQ_PRIORITY 10
|
||||
|
||||
/*
|
||||
* ST driver system settings.
|
||||
*/
|
||||
#define WB32_ST_IRQ_PRIORITY 8
|
||||
#define WB32_ST_USE_TIMER 2
|
||||
|
||||
/*
|
||||
* UART driver system settings.
|
||||
*/
|
||||
#define WB32_UART_USE_UART1 FALSE
|
||||
#define WB32_UART_USE_UART2 FALSE
|
||||
#define WB32_UART_USE_UART3 FALSE
|
||||
#define WB32_UART_UART1_IRQ_PRIORITY 12
|
||||
#define WB32_UART_UART2_IRQ_PRIORITY 12
|
||||
#define WB32_UART_UART3_IRQ_PRIORITY 12
|
||||
|
||||
/*
|
||||
* USB driver system settings.
|
||||
*/
|
||||
#define WB32_USB_USE_USB1 TRUE
|
||||
#define WB32_USB_USB1_IRQ_PRIORITY 13
|
||||
#define WB32_USB_HOST_WAKEUP_DURATION 10
|
||||
|
||||
|
||||
#endif /* MCUCONF_H */
|
||||
@@ -51,6 +51,18 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// WB32 compatibility
|
||||
#if defined(MCU_WB32)
|
||||
# define CPU_CLOCK WB32_MAINCLK
|
||||
|
||||
# if defined(WB32F3G71xx)
|
||||
# define PAL_OUTPUT_TYPE_OPENDRAIN PAL_WB32_OTYPE_OPENDRAIN
|
||||
# define PAL_OUTPUT_TYPE_PUSHPULL PAL_WB32_OTYPE_PUSHPULL
|
||||
# define PAL_OUTPUT_SPEED_HIGHEST PAL_WB32_OSPEED_HIGH
|
||||
# define PAL_PUPDR_FLOATING PAL_WB32_PUPDR_FLOATING
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(GD32VF103)
|
||||
/* This chip has the same API as STM32F103, but uses different names for literally the same thing.
|
||||
* As of 4.7.2021 QMK is tailored to use STM32 defines/names, for compatibility sake
|
||||
|
||||
@@ -38,6 +38,9 @@ static const I2CConfig i2cconfig = {
|
||||
I2C1_OPMODE,
|
||||
I2C1_CLOCK_SPEED,
|
||||
I2C1_DUTY_CYCLE,
|
||||
#elif defined(WB32F3G71xx)
|
||||
I2C1_OPMODE,
|
||||
I2C1_CLOCK_SPEED,
|
||||
#else
|
||||
// This configures the I2C clock to 400khz assuming a 72Mhz clock
|
||||
// For more info : https://www.st.com/en/embedded-software/stsw-stm32126.html
|
||||
|
||||
@@ -54,6 +54,7 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef WB32F3G71xx
|
||||
uint16_t roundedDivisor = 2;
|
||||
while (roundedDivisor < divisor) {
|
||||
roundedDivisor <<= 1;
|
||||
@@ -62,6 +63,7 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
|
||||
if (roundedDivisor < 2 || roundedDivisor > 256) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(K20x) || defined(KL2x)
|
||||
spiConfig.tar0 = SPIx_CTARn_FMSZ(7) | SPIx_CTARn_ASC(1);
|
||||
@@ -135,6 +137,37 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
|
||||
}
|
||||
|
||||
spiConfig.cpr = (roundedDivisor - 1) >> 1;
|
||||
|
||||
#elif defined(WB32F3G71xx)
|
||||
if (!lsbFirst) {
|
||||
osalDbgAssert(lsbFirst != FALSE, "unsupported lsbFirst");
|
||||
}
|
||||
|
||||
if (divisor < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
spiConfig.SPI_BaudRatePrescaler = (divisor << 2);
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
spiConfig.SPI_CPHA = SPI_CPHA_1Edge;
|
||||
spiConfig.SPI_CPOL = SPI_CPOL_Low;
|
||||
break;
|
||||
case 1:
|
||||
spiConfig.SPI_CPHA = SPI_CPHA_2Edge;
|
||||
spiConfig.SPI_CPOL = SPI_CPOL_Low;
|
||||
break;
|
||||
case 2:
|
||||
spiConfig.SPI_CPHA = SPI_CPHA_1Edge;
|
||||
spiConfig.SPI_CPOL = SPI_CPOL_High;
|
||||
break;
|
||||
case 3:
|
||||
spiConfig.SPI_CPHA = SPI_CPHA_2Edge;
|
||||
spiConfig.SPI_CPOL = SPI_CPOL_High;
|
||||
break;
|
||||
}
|
||||
|
||||
#else
|
||||
spiConfig.cr1 = 0;
|
||||
|
||||
|
||||
@@ -18,7 +18,11 @@
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#if defined(WB32F3G71xx)
|
||||
static SerialConfig serialConfig = {SERIAL_DEFAULT_BITRATE, SD1_WRDLEN, SD1_STPBIT, SD1_PARITY, SD1_ATFLCT};
|
||||
#else
|
||||
static SerialConfig serialConfig = {SERIAL_DEFAULT_BITRATE, SD1_CR1, SD1_CR2, SD1_CR3};
|
||||
#endif
|
||||
|
||||
void uart_init(uint32_t baud) {
|
||||
static bool is_initialised = false;
|
||||
|
||||
@@ -68,6 +68,22 @@
|
||||
# define SD1_CR3 0
|
||||
#endif
|
||||
|
||||
#ifndef SD1_WRDLEN
|
||||
# define SD1_WRDLEN 3
|
||||
#endif
|
||||
|
||||
#ifndef SD1_STPBIT
|
||||
# define SD1_STPBIT 0
|
||||
#endif
|
||||
|
||||
#ifndef SD1_PARITY
|
||||
# define SD1_PARITY 0
|
||||
#endif
|
||||
|
||||
#ifndef SD1_ATFLCT
|
||||
# define SD1_ATFLCT 0
|
||||
#endif
|
||||
|
||||
void uart_init(uint32_t baud);
|
||||
|
||||
void uart_write(uint8_t data);
|
||||
|
||||
@@ -23,6 +23,20 @@ define EXEC_DFU_UTIL
|
||||
$(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin
|
||||
endef
|
||||
|
||||
|
||||
define EXEC_WB32_DFU_UPDATER
|
||||
if ! wb32-dfu-updater_cli -l | grep -q "Found DFU"; then \
|
||||
printf "$(MSG_BOOTLOADER_NOT_FOUND_QUICK_RETRY)" ;\
|
||||
sleep $(BOOTLOADER_RETRY_TIME) ;\
|
||||
while ! wb32-dfu-updater_cli -l | grep -q "Found DFU"; do \
|
||||
printf "." ;\
|
||||
sleep $(BOOTLOADER_RETRY_TIME) ;\
|
||||
done ;\
|
||||
printf "\n" ;\
|
||||
fi
|
||||
wb32-dfu-updater_cli -D $(BUILD_DIR)/$(TARGET).bin
|
||||
endef
|
||||
|
||||
dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter
|
||||
$(call EXEC_DFU_UTIL)
|
||||
|
||||
@@ -82,6 +96,8 @@ else ifeq ($(strip $(MCU_FAMILY)),MIMXRT1062)
|
||||
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_TEENSY)
|
||||
else ifeq ($(strip $(MCU_FAMILY)),STM32)
|
||||
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_DFU_UTIL)
|
||||
else ifeq ($(strip $(MCU_FAMILY)),WB32)
|
||||
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_WB32_DFU_UPDATER)
|
||||
else ifeq ($(strip $(MCU_FAMILY)),GD32V)
|
||||
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_DFU_UTIL)
|
||||
else
|
||||
|
||||
@@ -141,6 +141,10 @@ ifdef STM32_BOOTLOADER_ADDRESS
|
||||
OPT_DEFS += -DSTM32_BOOTLOADER_ADDRESS=$(STM32_BOOTLOADER_ADDRESS)
|
||||
endif
|
||||
|
||||
ifdef WB32_BOOTLOADER_ADDRESS
|
||||
OPT_DEFS += -DWB32_BOOTLOADER_ADDRESS=$(WB32_BOOTLOADER_ADDRESS)
|
||||
endif
|
||||
|
||||
# Work out if we need to set up the include for the bootloader definitions
|
||||
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/bootloader_defs.h)","")
|
||||
OPT_DEFS += -include $(KEYBOARD_PATH_5)/bootloader_defs.h
|
||||
|
||||
Reference in New Issue
Block a user