Skip to content

Commit

Permalink
Add board specific to Proton-C, with usual defaults turned on. (qmk#1…
Browse files Browse the repository at this point in the history
…0976)

- Set all other ChibiOS defaults to 'off', when not targeting Proton-C
- Modified all existing F303 boards to point at the QMK_PROTON_C to ensure repeatable binary output
- Modified version.h generation so that SKIP_VERSION=yes generates the same output
  • Loading branch information
tzarc authored Dec 3, 2020
1 parent b2cede6 commit 2931267
Show file tree
Hide file tree
Showing 14 changed files with 1,608 additions and 17 deletions.
4 changes: 1 addition & 3 deletions build_keyboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ ifeq ($(strip $(CTPC)), yes)
endif

ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
TARGET := $(TARGET)_proton_c
include platforms/chibios/GENERIC_STM32_F303XC/configs/proton_c.mk
OPT_DEFS += -DCONVERT_TO_PROTON_C
include platforms/chibios/QMK_PROTON_C/convert_to_proton_c.mk
endif

ifneq ($(FORCE_LAYOUT),)
Expand Down
1 change: 1 addition & 0 deletions docs/ja/proton_c_conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Proton C には1つのオンボード LED(C13)しかなく、デフォルトで

```
MCU = STM32F303
BOARD = QMK_PROTON_C
```

次の変数が存在する場合は削除します。
Expand Down
1 change: 1 addition & 0 deletions docs/proton_c_conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ To use the Proton C natively, without having to specify `CTPC=yes`, you need to

```
MCU = STM32F303
BOARD = QMK_PROTON_C
```

Remove these variables if they exist:
Expand Down
22 changes: 11 additions & 11 deletions platforms/chibios/GENERIC_STM32_F303XC/configs/mcuconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@
* DAC driver system settings.
*/
#define STM32_DAC_DUAL_MODE FALSE
#define STM32_DAC_USE_DAC1_CH1 TRUE
#define STM32_DAC_USE_DAC1_CH2 TRUE
#define STM32_DAC_USE_DAC1_CH1 FALSE
#define STM32_DAC_USE_DAC1_CH2 FALSE
#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10
#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10
#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2
Expand All @@ -141,10 +141,10 @@
#define STM32_GPT_USE_TIM2 FALSE
#define STM32_GPT_USE_TIM3 FALSE
#define STM32_GPT_USE_TIM4 FALSE
#define STM32_GPT_USE_TIM6 TRUE
#define STM32_GPT_USE_TIM7 TRUE
#define STM32_GPT_USE_TIM8 TRUE
#define STM32_GPT_USE_TIM15 TRUE
#define STM32_GPT_USE_TIM6 FALSE
#define STM32_GPT_USE_TIM7 FALSE
#define STM32_GPT_USE_TIM8 FALSE
#define STM32_GPT_USE_TIM15 FALSE
#define STM32_GPT_USE_TIM16 FALSE
#define STM32_GPT_USE_TIM17 FALSE
#define STM32_GPT_TIM1_IRQ_PRIORITY 7
Expand All @@ -158,7 +158,7 @@
/*
* I2C driver system settings.
*/
#define STM32_I2C_USE_I2C1 TRUE
#define STM32_I2C_USE_I2C1 FALSE
#define STM32_I2C_USE_I2C2 FALSE
#define STM32_I2C_BUSY_TIMEOUT 50
#define STM32_I2C_I2C1_IRQ_PRIORITY 10
Expand Down Expand Up @@ -189,8 +189,8 @@
#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 TRUE
#define STM32_PWM_USE_TIM4 TRUE
#define STM32_PWM_USE_TIM3 FALSE
#define STM32_PWM_USE_TIM4 FALSE
#define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_USE_TIM15 FALSE
#define STM32_PWM_USE_TIM16 FALSE
Expand All @@ -213,7 +213,7 @@
* SERIAL driver system settings.
*/
#define STM32_SERIAL_USE_USART1 FALSE
#define STM32_SERIAL_USE_USART2 TRUE
#define STM32_SERIAL_USE_USART2 FALSE
#define STM32_SERIAL_USE_USART3 FALSE
#define STM32_SERIAL_USE_UART4 FALSE
#define STM32_SERIAL_USE_UART5 FALSE
Expand All @@ -227,7 +227,7 @@
* SPI driver system settings.
*/
#define STM32_SPI_USE_SPI1 FALSE
#define STM32_SPI_USE_SPI2 TRUE
#define STM32_SPI_USE_SPI2 FALSE
#define STM32_SPI_USE_SPI3 FALSE
#define STM32_SPI_SPI1_DMA_PRIORITY 1
#define STM32_SPI_SPI2_DMA_PRIORITY 1
Expand Down
9 changes: 9 additions & 0 deletions platforms/chibios/QMK_PROTON_C/board/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# List of all the board related files.
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_STM32F3_DISCOVERY/board.c

# Required include directories
BOARDINC = $(CHIBIOS)/os/hal/boards/ST_STM32F3_DISCOVERY

# Shared variables
ALLCSRC += $(BOARDSRC)
ALLINC += $(BOARDINC)
37 changes: 37 additions & 0 deletions platforms/chibios/QMK_PROTON_C/configs/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* Copyright 2020 Nick Brassel (tzarc)
*
* 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

#include_next "board.h"

#undef STM32_HSE_BYPASS

/*
* USB bus activation macro, required by the USB driver.
*/
#define usb_lld_connect_bus(usbp) \
do { \
palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_ALTERNATE(14)); \
} while (0)

/*
* USB bus de-activation macro, required by the USB driver.
*/
#define usb_lld_disconnect_bus(usbp) \
do { \
palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_OUTPUT_PUSHPULL); \
palClearPad(GPIOA, GPIOA_USB_DP); \
} while (0)
7 changes: 7 additions & 0 deletions platforms/chibios/QMK_PROTON_C/configs/bootloader_defs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up here:
* http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
* This also requires a patch to chibios:
* <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFFD800
Loading

0 comments on commit 2931267

Please sign in to comment.