Skip to content

Commit

Permalink
Initial pass of F405 support (qmk#14584)
Browse files Browse the repository at this point in the history
* Initial pass of F405 support

* remove some conf files

* docs

* clang
  • Loading branch information
zvecr authored and ptrxyz committed Nov 6, 2021
1 parent 5ff9003 commit 98c632d
Show file tree
Hide file tree
Showing 14 changed files with 581 additions and 4 deletions.
2 changes: 1 addition & 1 deletion common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ else
SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c
SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
OPT_DEFS += -DEEPROM_EMU_STM32F072xB
else ifneq ($(filter $(MCU_SERIES)_$(MCU_LDSCRIPT),STM32F4xx_STM32F401xC STM32F4xx_STM32F411xE),)
else ifneq ($(filter $(MCU_SERIES)_$(MCU_LDSCRIPT),STM32F4xx_STM32F401xC STM32F4xx_STM32F411xE STM32F4xx_STM32F405xG),)
OPT_DEFS += -DEEPROM_DRIVER
COMMON_VPATH += $(DRIVER_PATH)/eeprom
SRC += eeprom_driver.c
Expand Down
2 changes: 1 addition & 1 deletion data/schemas/keyboard.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"processor": {
"type": "string",
"enum": ["cortex-m0", "cortex-m0plus", "cortex-m3", "cortex-m4", "MKL26Z64", "MK20DX128", "MK20DX256", "MK66F18", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F407", "STM32F411", "STM32F446", "STM32G431", "STM32G474", "STM32L412", "STM32L422", "STM32L433", "STM32L443", "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", "MK66F18", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F405", "STM32F407", "STM32F411", "STM32F446", "STM32G431", "STM32G474", "STM32L412", "STM32L422", "STM32L433", "STM32L443", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"]
},
"audio": {
"type": "object",
Expand Down
1 change: 1 addition & 0 deletions docs/compatible_microcontrollers.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ You can also use any ARM chip with USB that [ChibiOS](https://www.chibios.org) s
* [STM32F103](https://www.st.com/en/microcontrollers-microprocessors/stm32f103.html)
* [STM32F303](https://www.st.com/en/microcontrollers-microprocessors/stm32f303.html)
* [STM32F401](https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html)
* [STM32F405](https://www.st.com/en/microcontrollers-microprocessors/stm32f405-415.html)
* [STM32F407](https://www.st.com/en/microcontrollers-microprocessors/stm32f407-417.html)
* [STM32F411](https://www.st.com/en/microcontrollers-microprocessors/stm32f411.html)
* [STM32F446](https://www.st.com/en/microcontrollers-microprocessors/stm32f446.html)
Expand Down
1 change: 1 addition & 0 deletions docs/ja/compatible_microcontrollers.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ QMK は十分な容量のフラッシュメモリを備えた USB 対応 AVR ま
* [STM32F103](https://www.st.com/en/microcontrollers-microprocessors/stm32f103.html)
* [STM32F303](https://www.st.com/en/microcontrollers-microprocessors/stm32f303.html)
* [STM32F401](https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html)
* [STM32F405](https://www.st.com/en/microcontrollers-microprocessors/stm32f405-415.html)
* [STM32F407](https://www.st.com/en/microcontrollers-microprocessors/stm32f407-417.html)
* [STM32F411](https://www.st.com/en/microcontrollers-microprocessors/stm32f411.html)
* [STM32F446](https://www.st.com/en/microcontrollers-microprocessors/stm32f446.html)
Expand Down
25 changes: 25 additions & 0 deletions keyboards/handwired/onekey/stm32f405_feather/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* Copyright 2019
*
* 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/>.
*/

#pragma once

#include "config_common.h"

#define PRODUCT Onekey Adafruit Feather STM32F405

#define MATRIX_COL_PINS { C2 }
#define MATRIX_ROW_PINS { C3 }
#define UNUSED_PINS
7 changes: 7 additions & 0 deletions keyboards/handwired/onekey/stm32f405_feather/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Adafruit Feather STM32F405 Express onekey

* Supported Hardware: [Adafruit Feather STM32F405 Express](https://www.adafruit.com/product/4382)

To trigger keypress, short together pins *GPIO 12 / PC2* and *GPIO 11 / PC3*.

https://learn.adafruit.com/adafruit-stm32f405-feather-express/dfu-bootloader-details#enabling-dfu-bootloader-mode-3045622-2
8 changes: 8 additions & 0 deletions keyboards/handwired/onekey/stm32f405_feather/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# MCU name
MCU = STM32F405

# Bootloader selection
BOOTLOADER = stm32-dfu

# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
9 changes: 9 additions & 0 deletions platforms/chibios/boards/GENERIC_STM32_F405XG/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_STM32F4_DISCOVERY/board.c

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

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

#define STM32_HSECLK 12000000
// The following is required to disable the pull-down on PA9, when PA9 is used for the keyboard matrix:
#define BOARD_OTG_NOVBUSSENS

#include_next "board.h"

#undef STM32_HSE_BYPASS

#undef STM32F407xx
#define STM32F405xG
#define STM32F405xx
23 changes: 23 additions & 0 deletions platforms/chibios/boards/GENERIC_STM32_F405XG/configs/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* Copyright 2021 Andrei Purdea
*
* 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/>.
*/

/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up by checking against ST's application note AN2606.
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFF0000
#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif
Loading

0 comments on commit 98c632d

Please sign in to comment.