summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build_keyboard.mk87
-rw-r--r--docs/_sidebar.md100
-rw-r--r--docs/_summary.md2
-rw-r--r--docs/index.html2
-rw-r--r--docs/proton_c_conversion.md21
-rw-r--r--docs/zh/_summary.md (renamed from docs/zh/_sidebar.md)0
-rw-r--r--drivers/boards/GENERIC_STM32_F303XC/board.c (renamed from keyboards/planck/rev6/boards/GENERIC_STM32_F303XC/board.c)0
-rw-r--r--drivers/boards/GENERIC_STM32_F303XC/board.h (renamed from keyboards/proton_c/boards/GENERIC_STM32_F303XC/board.h)4
-rw-r--r--drivers/boards/GENERIC_STM32_F303XC/board.mk (renamed from keyboards/planck/rev6/boards/GENERIC_STM32_F303XC/board.mk)0
-rw-r--r--drivers/boards/GENERIC_STM32_F303XC/bootloader_defs.h (renamed from keyboards/planck/rev6/bootloader_defs.h)0
-rw-r--r--keyboards/1upkeyboards/sweet16/keymaps/default/keymap.c8
-rw-r--r--keyboards/planck/rev6/boards/GENERIC_STM32_F303XC/board.h1187
-rw-r--r--keyboards/planck/rev6/rules.mk35
-rw-r--r--keyboards/planck/rules.mk33
-rw-r--r--keyboards/proton_c/boards/GENERIC_STM32_F303XC/board.c126
-rw-r--r--keyboards/proton_c/boards/GENERIC_STM32_F303XC/board.mk5
-rw-r--r--keyboards/proton_c/bootloader_defs.h7
-rw-r--r--keyboards/proton_c/chconf.h520
-rw-r--r--keyboards/proton_c/config.h1
-rw-r--r--keyboards/proton_c/halconf.h388
-rw-r--r--keyboards/proton_c/mcuconf.h257
-rw-r--r--keyboards/proton_c/rules.mk36
-rw-r--r--quantum/config_common.h40
-rw-r--r--quantum/mcu_selection.mk70
-rw-r--r--quantum/stm32/chconf.h (renamed from keyboards/planck/rev6/chconf.h)0
-rw-r--r--quantum/stm32/halconf.h (renamed from keyboards/planck/rev6/halconf.h)0
-rw-r--r--quantum/stm32/mcuconf.h (renamed from keyboards/planck/rev6/mcuconf.h)0
-rw-r--r--quantum/stm32/proton_c.mk44
28 files changed, 241 insertions, 2732 deletions
diff --git a/build_keyboard.mk b/build_keyboard.mk
index b639b92d3e..1d60f3ad79 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -16,6 +16,7 @@ include common.mk
KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD))
TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP)
KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD_FILESAFE)
+STM32_PATH := quantum/stm32
# Force expansion
TARGET := $(TARGET)
@@ -72,6 +73,7 @@ ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
KEYBOARD_PATHS += $(KEYBOARD_PATH_1)
endif
+
# Pull in rules.mk files from all our subfolders
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/rules.mk)","")
include $(KEYBOARD_PATH_5)/rules.mk
@@ -89,6 +91,58 @@ ifneq ("$(wildcard $(KEYBOARD_PATH_1)/rules.mk)","")
include $(KEYBOARD_PATH_1)/rules.mk
endif
+
+MAIN_KEYMAP_PATH_1 := $(KEYBOARD_PATH_1)/keymaps/$(KEYMAP)
+MAIN_KEYMAP_PATH_2 := $(KEYBOARD_PATH_2)/keymaps/$(KEYMAP)
+MAIN_KEYMAP_PATH_3 := $(KEYBOARD_PATH_3)/keymaps/$(KEYMAP)
+MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
+MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
+
+ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.c)","")
+ -include $(MAIN_KEYMAP_PATH_5)/rules.mk
+ KEYMAP_C := $(MAIN_KEYMAP_PATH_5)/keymap.c
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
+else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.c)","")
+ -include $(MAIN_KEYMAP_PATH_4)/rules.mk
+ KEYMAP_C := $(MAIN_KEYMAP_PATH_4)/keymap.c
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
+else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.c)","")
+ -include $(MAIN_KEYMAP_PATH_3)/rules.mk
+ KEYMAP_C := $(MAIN_KEYMAP_PATH_3)/keymap.c
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
+else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.c)","")
+ -include $(MAIN_KEYMAP_PATH_2)/rules.mk
+ KEYMAP_C := $(MAIN_KEYMAP_PATH_2)/keymap.c
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
+else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","")
+ -include $(MAIN_KEYMAP_PATH_1)/rules.mk
+ KEYMAP_C := $(MAIN_KEYMAP_PATH_1)/keymap.c
+ KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
+else ifneq ($(LAYOUTS),)
+ include build_layout.mk
+else
+ $(error Could not find keymap)
+ # this state should never be reached
+endif
+
+ifeq ($(strip $(CTPC)), yes)
+ CONVERT_TO_PROTON_C=yes
+endif
+
+ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
+ TARGET := $(TARGET)_proton_c
+ include $(STM32_PATH)/proton_c.mk
+ OPT_DEFS += -DCONVERT_TO_PROTON_C
+endif
+
+include quantum/mcu_selection.mk
+
+ifdef MCU_FAMILY
+ OPT_DEFS += -DQMK_STM32
+ KEYBOARD_PATHS += $(STM32_PATH)
+endif
+
+
# Find all the C source files to be compiled in subfolders.
KEYBOARD_SRC :=
@@ -227,39 +281,6 @@ PROJECT_DEFS := $(OPT_DEFS)
PROJECT_INC := $(VPATH) $(EXTRAINCDIRS) $(KEYBOARD_PATHS)
PROJECT_CONFIG := $(CONFIG_H)
-MAIN_KEYMAP_PATH_1 := $(KEYBOARD_PATH_1)/keymaps/$(KEYMAP)
-MAIN_KEYMAP_PATH_2 := $(KEYBOARD_PATH_2)/keymaps/$(KEYMAP)
-MAIN_KEYMAP_PATH_3 := $(KEYBOARD_PATH_3)/keymaps/$(KEYMAP)
-MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
-MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
-
-ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.c)","")
- -include $(MAIN_KEYMAP_PATH_5)/rules.mk
- KEYMAP_C := $(MAIN_KEYMAP_PATH_5)/keymap.c
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
-else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.c)","")
- -include $(MAIN_KEYMAP_PATH_4)/rules.mk
- KEYMAP_C := $(MAIN_KEYMAP_PATH_4)/keymap.c
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
-else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.c)","")
- -include $(MAIN_KEYMAP_PATH_3)/rules.mk
- KEYMAP_C := $(MAIN_KEYMAP_PATH_3)/keymap.c
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
-else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.c)","")
- -include $(MAIN_KEYMAP_PATH_2)/rules.mk
- KEYMAP_C := $(MAIN_KEYMAP_PATH_2)/keymap.c
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
-else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","")
- -include $(MAIN_KEYMAP_PATH_1)/rules.mk
- KEYMAP_C := $(MAIN_KEYMAP_PATH_1)/keymap.c
- KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
-else ifneq ($(LAYOUTS),)
- include build_layout.mk
-else
- $(error Could not find keymap)
- # this state should never be reached
-endif
-
# Userspace setup and definitions
ifeq ("$(USER_NAME)","")
USER_NAME := $(KEYMAP)
diff --git a/docs/_sidebar.md b/docs/_sidebar.md
deleted file mode 100644
index b209c5e0b8..0000000000
--- a/docs/_sidebar.md
+++ /dev/null
@@ -1,100 +0,0 @@
-* [Complete Newbs Guide](newbs.md)
- * [Getting Started](newbs_getting_started.md)
- * [Building Your First Firmware](newbs_building_firmware.md)
- * [Flashing Firmware](newbs_flashing.md)
- * [Testing and Debugging](newbs_testing_debugging.md)
- * [Best Practices](newbs_best_practices.md)
- * [Learning Resources](newbs_learn_more_resources.md)
-
-* [QMK Basics](README.md)
- * [QMK Introduction](getting_started_introduction.md)
- * [Contributing to QMK](contributing.md)
- * [How to Use Github](getting_started_github.md)
- * [Getting Help](getting_started_getting_help.md)
-
-* [FAQ](faq.md)
- * [General FAQ](faq_general.md)
- * [Build/Compile QMK](faq_build.md)
- * [Debugging/Troubleshooting QMK](faq_debug.md)
- * [Keymap](faq_keymap.md)
-
-* Detailed Guides
- * [Install Build Tools](getting_started_build_tools.md)
- * [Vagrant Guide](getting_started_vagrant.md)
- * [Build/Compile Instructions](getting_started_make_guide.md)
- * [Flashing Firmware](flashing.md)
- * [Customizing Functionality](custom_quantum_functions.md)
- * [Keymap Overview](keymap.md)
-
-* [Hardware](hardware.md)
- * [AVR Processors](hardware_avr.md)
- * [Drivers](hardware_drivers.md)
-
-* Reference
- * [Keyboard Guidelines](hardware_keyboard_guidelines.md)
- * [Config Options](config_options.md)
- * [Keycodes](keycodes.md)
- * [Documentation Best Practices](documentation_best_practices.md)
- * [Documentation Templates](documentation_templates.md)
- * [Glossary](reference_glossary.md)
- * [Unit Testing](unit_testing.md)
- * [Useful Functions](ref_functions.md)
- * [Configurator Support](reference_configurator_support.md)
-
-* [Features](features.md)
- * [Basic Keycodes](keycodes_basic.md)
- * [US ANSI Shifted Keys](keycodes_us_ansi_shifted.md)
- * [Quantum Keycodes](quantum_keycodes.md)
- * [Advanced Keycodes](feature_advanced_keycodes.md)
- * [Audio](feature_audio.md)
- * [Auto Shift](feature_auto_shift.md)
- * [Backlight](feature_backlight.md)
- * [Bluetooth](feature_bluetooth.md)
- * [Bootmagic](feature_bootmagic.md)
- * [Combos](feature_combo)
- * [Command](feature_command.md)
- * [Dynamic Macros](feature_dynamic_macros.md)
- * [Encoders](feature_encoders.md)
- * [Grave Escape](feature_grave_esc.md)
- * [Key Lock](feature_key_lock.md)
- * [Layouts](feature_layouts.md)
- * [Leader Key](feature_leader_key.md)
- * [Macros](feature_macros.md)
- * [Mouse Keys](feature_mouse_keys.md)
- * [One Shot Keys](feature_advanced_keycodes.md#one-shot-keys)
- * [Pointing Device](feature_pointing_device.md)
- * [PS/2 Mouse](feature_ps2_mouse.md)
- * [RGB Lighting](feature_rgblight.md)
- * [RGB Matrix](feature_rgb_matrix.md)
- * [Space Cadet Shift](feature_space_cadet_shift.md)
- * [Space Cadet Shift Enter](feature_space_cadet_shift_enter.md)
- * [Stenography](feature_stenography.md)
- * [Swap Hands](feature_swap_hands.md)
- * [Tap Dance](feature_tap_dance.md)
- * [Terminal](feature_terminal.md)
- * [Thermal Printer](feature_thermal_printer.md)
- * [Unicode](feature_unicode.md)
- * [Userspace](feature_userspace.md)
-
-* For Makers and Modders
- * [Hand Wiring Guide](hand_wire.md)
- * [ISP Flashing Guide](isp_flashing_guide.md)
- * [ARM Debugging Guide](arm_debugging.md)
- * [I2C Driver](i2c_driver.md)
-
-* For a Deeper Understanding
- * [How Keyboards Work](how_keyboards_work.md)
- * [Understanding QMK](understanding_qmk.md)
-
-* Other Topics
- * [Using Eclipse with QMK](eclipse.md)
- * [Support](support.md)
-
-* QMK Internals (In Progress)
- * [Defines](internals_defines.md)
- * [Input Callback Reg](internals_input_callback_reg.md)
- * [Midi Device](internals_midi_device.md)
- * [Midi Device Setup Process](internals_midi_device_setup_process.md)
- * [Midi Util](internals_midi_util.md)
- * [Send Functions](internals_send_functions.md)
- * [Sysex Tools](internals_sysex_tools.md)
diff --git a/docs/_summary.md b/docs/_summary.md
index b209c5e0b8..c467a7231a 100644
--- a/docs/_summary.md
+++ b/docs/_summary.md
@@ -81,6 +81,8 @@
* [ISP Flashing Guide](isp_flashing_guide.md)
* [ARM Debugging Guide](arm_debugging.md)
* [I2C Driver](i2c_driver.md)
+ * [GPIO Controls](internals_gpio_control.md)
+ * [Proton C Conversion](proton_c_conversion.md)
* For a Deeper Understanding
* [How Keyboards Work](how_keyboards_work.md)
diff --git a/docs/index.html b/docs/index.html
index f5aa92b531..d6fdbdbcc1 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -17,7 +17,7 @@
name: 'QMK Firmware',
nameLink: 'https://qmk.fm/',
repo: 'qmk/qmk_firmware',
- loadSidebar: true,
+ loadSidebar: '_summary.md',
auto2top: true,
formatUpdated: '{YYYY}/{MM}/{DD} {HH}:{mm}',
search: {
diff --git a/docs/proton_c_conversion.md b/docs/proton_c_conversion.md
new file mode 100644
index 0000000000..be7d50a9f4
--- /dev/null
+++ b/docs/proton_c_conversion.md
@@ -0,0 +1,21 @@
+# Converting a board to use the Proton C
+
+If a board currently supported in QMK uses a Pro Micro (or compatible board) and you want to use the Proton C, you can generate the firmware by appending `CONVERT_TO_PROTON_C=yes` (or `CTPC=yes`) to your make argument, like this:
+
+ make 40percentclub/mf68:default CTPC=yes
+
+You can add the same argument to your keymap's `rules.mk`, which will accomplish the same thing.
+
+This exposes the `CONVERT_TO_PROTON_C` flag that you can use in your code with `#ifdef`s, like this:
+
+ #ifdef CONVERT_TO_PROTON_C
+ // Proton C code
+ #else
+ // Pro Micro code
+ #endif
+
+Before being able to compile, you may get some errors about `PORTB/DDRB`, etc not being defined, so you'll need to convert the keyboard's code to use the [GPIO Controls](internals_gpio_control.md) that will work for both ARM and AVR. This shouldn't affect the AVR builds at all.
+
+The Proton C only has one on-board LED (C13), and by default, the TXLED (D5) is mapped to it. If you want the RXLED (B0) mapped to it instead, add this like to your `config.h`:
+
+ #define CONVERT_TO_PROTON_C_RXLED
diff --git a/docs/zh/_sidebar.md b/docs/zh/_summary.md
index c167612929..c167612929 100644
--- a/docs/zh/_sidebar.md
+++ b/docs/zh/_summary.md
diff --git a/keyboards/planck/rev6/boards/GENERIC_STM32_F303XC/board.c b/drivers/boards/GENERIC_STM32_F303XC/board.c
index 4331155df4..4331155df4 100644
--- a/keyboards/planck/rev6/boards/GENERIC_STM32_F303XC/board.c
+++ b/drivers/boards/GENERIC_STM32_F303XC/board.c
diff --git a/keyboards/proton_c/boards/GENERIC_STM32_F303XC/board.h b/drivers/boards/GENERIC_STM32_F303XC/board.h
index ec26557f3a..11120dfd74 100644
--- a/keyboards/proton_c/boards/GENERIC_STM32_F303XC/board.h
+++ b/drivers/boards/GENERIC_STM32_F303XC/board.h
@@ -18,14 +18,14 @@
#define _BOARD_H_
/*
- * Setup for Clueboard 60% Keyboard
+ * Setup for Generic STM32_F303 Board
*/
/*
* Board identifier.
*/
#define BOARD_GENERIC_STM32_F303XC
-#define BOARD_NAME "Planck PCB"
+#define BOARD_NAME "STM32_F303"
/*
* Board oscillators-related settings.
diff --git a/keyboards/planck/rev6/boards/GENERIC_STM32_F303XC/board.mk b/drivers/boards/GENERIC_STM32_F303XC/board.mk
index 43377629a3..43377629a3 100644
--- a/keyboards/planck/rev6/boards/GENERIC_STM32_F303XC/board.mk
+++ b/drivers/boards/GENERIC_STM32_F303XC/board.mk
diff --git a/keyboards/planck/rev6/bootloader_defs.h b/drivers/boards/GENERIC_STM32_F303XC/bootloader_defs.h
index 3b0e9d20a6..3b0e9d20a6 100644
--- a/keyboards/planck/rev6/bootloader_defs.h
+++ b/drivers/boards/GENERIC_STM32_F303XC/bootloader_defs.h
diff --git a/keyboards/1upkeyboards/sweet16/keymaps/default/keymap.c b/keyboards/1upkeyboards/sweet16/keymaps/default/keymap.c
index 2ddf8acb41..899afaba17 100644
--- a/keyboards/1upkeyboards/sweet16/keymaps/default/keymap.c
+++ b/keyboards/1upkeyboards/sweet16/keymaps/default/keymap.c
@@ -6,9 +6,9 @@ enum custom_keycodes {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT_ortho_4x4(
- KC_7, KC_8, KC_9, KC_ASTR,
- KC_4, KC_5, KC_6, KC_SLSH,
- KC_1, KC_2, KC_3, KC_MINS,
+ KC_7, KC_8, KC_9, KC_ASTR,
+ KC_4, KC_5, KC_6, KC_SLSH,
+ KC_1, KC_2, KC_3, KC_MINS,
KC_0, KC_ENT, KC_DOT, KC_EQL
)
};
@@ -27,6 +27,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
void led_set_user(uint8_t usb_led) {
+ #ifndef CONVERT_TO_PROTON_C
/* Map RXLED to USB_LED_NUM_LOCK */
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
DDRB |= (1 << 0); PORTB &= ~(1 << 0);
@@ -40,4 +41,5 @@ void led_set_user(uint8_t usb_led) {
} else {
DDRD &= ~(1 << 5); PORTD &= ~(1 << 5);
}
+ #endif
}
diff --git a/keyboards/planck/rev6/boards/GENERIC_STM32_F303XC/board.h b/keyboards/planck/rev6/boards/GENERIC_STM32_F303XC/board.h
deleted file mode 100644
index ec26557f3a..0000000000
--- a/keyboards/planck/rev6/boards/GENERIC_STM32_F303XC/board.h
+++ /dev/null
@@ -1,1187 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
-
- 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 _BOARD_H_
-#define _BOARD_H_
-
-/*
- * Setup for Clueboard 60% Keyboard
- */
-
-/*
- * Board identifier.
- */
-#define BOARD_GENERIC_STM32_F303XC
-#define BOARD_NAME "Planck PCB"
-
-/*
- * Board oscillators-related settings.
- * NOTE: LSE not fitted.
- */
-#if !defined(STM32_LSECLK)
-#define STM32_LSECLK 0U
-#endif
-
-#define STM32_LSEDRV (3U << 3U)
-
-#if !defined(STM32_HSECLK)
-#define STM32_HSECLK 8000000U
-#endif
-
-// #define STM32_HSE_BYPASS
-
-/*
- * MCU type as defined in the ST header.
- */
-#define STM32F303xC
-
-/*
- * IO pins assignments.
- */
-#define GPIOA_PIN0 0U
-#define GPIOA_PIN1 1U
-#define GPIOA_PIN2 2U
-#define GPIOA_PIN3 3U
-#define GPIOA_PIN4 4U
-#define GPIOA_PIN5 5U
-#define GPIOA_PIN6 6U
-#define GPIOA_PIN7 7U
-#define GPIOA_PIN8 8U
-#define GPIOA_PIN9 9U
-#define GPIOA_PIN10 10U
-#define GPIOA_USB_DM 11U
-#define GPIOA_USB_DP 12U
-#define GPIOA_SWDIO 13U
-#define GPIOA_SWCLK 14U
-#define GPIOA_PIN15 15U
-
-#define GPIOB_PIN0 0U
-#define GPIOB_PIN1 1U
-#define GPIOB_PIN2 2U
-#define GPIOB_PIN3 3U
-#define GPIOB_PIN4 4U
-#define GPIOB_PIN5 5U
-#define GPIOB_PIN6 6U
-#define GPIOB_PIN7 7U
-#define GPIOB_PIN8 8U
-#define GPIOB_PIN9 9U
-#define GPIOB_PIN10 10U
-#define GPIOB_PIN11 11U
-#define GPIOB_PIN12 12U
-#define GPIOB_PIN13 13U
-#define GPIOB_PIN14 14U
-#define GPIOB_PIN15 15U
-
-#define GPIOC_PIN0 0U
-#define GPIOC_PIN1 1U
-#define GPIOC_PIN2 2U
-#define GPIOC_PIN3 3U
-#define GPIOC_PIN4 4U
-#define GPIOC_PIN5 5U
-#define GPIOC_PIN6 6U
-#define GPIOC_PIN7 7U
-#define GPIOC_PIN8 8U
-#define GPIOC_PIN9 9U
-#define GPIOC_PIN10 10U
-#define GPIOC_PIN11 11U
-#define GPIOC_PIN12 12U
-#define GPIOC_PIN13 13U
-#define GPIOC_PIN14 14U
-#define GPIOC_PIN15 15U
-
-#define GPIOD_PIN0 0U
-#define GPIOD_PIN1 1U
-#define GPIOD_PIN2 2U
-#define GPIOD_PIN3 3U
-#define GPIOD_PIN4 4U
-#define GPIOD_PIN5 5U
-#define GPIOD_PIN6 6U
-#define GPIOD_PIN7 7U
-#define GPIOD_PIN8 8U
-#define GPIOD_PIN9 9U
-#define GPIOD_PIN10 10U
-#define GPIOD_PIN11 11U
-#define GPIOD_PIN12 12U
-#define GPIOD_PIN13 13U
-#define GPIOD_PIN14 14U
-#define GPIOD_PIN15 15U
-
-#define GPIOE_PIN0 0U
-#define GPIOE_PIN1 1U
-#define GPIOE_PIN2 2U
-#define GPIOE_PIN3 3U
-#define GPIOE_PIN4 4U
-#define GPIOE_PIN5 5U
-#define GPIOE_PIN6 6U
-#define GPIOE_PIN7 7U
-#define GPIOE_PIN8 8U
-#define GPIOE_PIN9 9U
-#define GPIOE_PIN10 10U
-#define GPIOE_PIN11 11U
-#define GPIOE_PIN12 12U
-#define GPIOE_PIN13 13U
-#define GPIOE_PIN14 14U
-#define GPIOE_PIN15 15U
-
-#define GPIOF_I2C2_SDA 0U
-#define GPIOF_I2C2_SCL 1U
-#define GPIOF_PIN2 2U
-#define GPIOF_PIN3 3U
-#define GPIOF_PIN4 4U
-#define GPIOF_PIN5 5U
-#define GPIOF_PIN6 6U
-#define GPIOF_PIN7 7U
-#define GPIOF_PIN8 8U
-#define GPIOF_PIN9 9U
-#define GPIOF_PIN10 10U
-#define GPIOF_PIN11 11U
-#define GPIOF_PIN12 12U
-#define GPIOF_PIN13 13U
-#define GPIOF_PIN14 14U
-#define GPIOF_PIN15 15U
-
-#define GPIOG_PIN0 0U
-#define GPIOG_PIN1 1U
-#define GPIOG_PIN2 2U
-#define GPIOG_PIN3 3U
-#define GPIOG_PIN4 4U
-#define GPIOG_PIN5 5U
-#define GPIOG_PIN6 6U
-#define GPIOG_PIN7 7U
-#define GPIOG_PIN8 8U
-#define GPIOG_PIN9 9U
-#define GPIOG_PIN10 10U
-#define GPIOG_PIN11 11U
-#define GPIOG_PIN12 12U
-#define GPIOG_PIN13 13U
-#define GPIOG_PIN14 14U
-#define GPIOG_PIN15 15U
-
-#define GPIOH_PIN0 0U
-#define GPIOH_PIN1 1U
-#define GPIOH_PIN2 2U
-#define GPIOH_PIN3 3U
-#define GPIOH_PIN4 4U
-#define GPIOH_PIN5 5U
-#define GPIOH_PIN6 6U
-#define GPIOH_PIN7 7U
-#define GPIOH_PIN8 8U
-#define GPIOH_PIN9 9U
-#define GPIOH_PIN10 10U
-#define GPIOH_PIN11 11U
-#define GPIOH_PIN12 12U
-#define GPIOH_PIN13 13U
-#define GPIOH_PIN14 14U
-#define GPIOH_PIN15 15U
-
-/*
- * IO lines assignments.
- */
-#define LINE_L3GD20_SDI PAL_LINE(GPIOA, 7U)
-#define LINE_USB_DM PAL_LINE(GPIOA, 11U)
-#define LINE_USB_DP PAL_LINE(GPIOA, 12U)
-#define LINE_SWDIO PAL_LINE(GPIOA, 13U)
-#define LINE_SWCLK PAL_LINE(GPIOA, 14U)
-
-#define LINE_PIN6 PAL_LINE(GPIOF, 0U)
-#define LINE_PIN7 PAL_LINE(GPIOF, 1U)
-
-#define LINE_CAPS_LOCK PAL_LINE(GPIOB, 7U)
-
-
-/*
- * I/O ports initial setup, this configuration is established soon after reset
- * in the initialization code.
- * Please refer to the STM32 Reference Manual for details.
- */
-#define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
-#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
-#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
-#define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
-#define PIN_ODR_LOW(n) (0U << (n))
-#define PIN_ODR_HIGH(n) (1U << (n))
-#define PIN_OTYPE_PUSHPULL(n) (0U << (n))
-#define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
-#define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
-#define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
-#define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
-#define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
-#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
-#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
-#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
-#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
-
-/*
- * GPIOA setup:
- *
- * PA0 - NC
- * PA1 - NC
- * PA2 - COL1
- * PA3 - COL2
- * PA4 - SPEAKER1
- * PA5 - SPEAKER2
- * PA6 - COL3
- * PA7 - COL8
- * PA8 - COL6
- * PA9 - COL7
- * PA10 - ROW5
- * PA11 - USB_DM (alternate 14).
- * PA12 - USB_DP (alternate 14).
- * PA13 - SWDIO (alternate 0).
- * PA14 - SWCLK (alternate 0).
- * PA15 - ROW4
- */
-#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | \
- PIN_MODE_ALTERNATE(GPIOA_PIN1) | \
- PIN_MODE_INPUT(GPIOA_PIN2) | \
- PIN_MODE_INPUT(GPIOA_PIN3) | \
- PIN_MODE_INPUT(GPIOA_PIN4) | \
- PIN_MODE_INPUT(GPIOA_PIN5) | \
- PIN_MODE_INPUT(GPIOA_PIN6) | \
- PIN_MODE_INPUT(GPIOA_PIN7) | \
- PIN_MODE_INPUT(GPIOA_PIN8) | \
- PIN_MODE_INPUT(GPIOA_PIN9) | \
- PIN_MODE_INPUT(GPIOA_PIN10) | \
- PIN_MODE_ALTERNATE(GPIOA_USB_DM) | \
- PIN_MODE_ALTERNATE(GPIOA_USB_DP) | \
- PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
- PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
- PIN_MODE_INPUT(GPIOA_PIN15))
-#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \
- PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \
- PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | \
- PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | \
- PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \
- PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \
- PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \
- PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \
- PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | \
- PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | \
- PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | \
- PIN_OTYPE_PUSHPULL(GPIOA_USB_DM) | \
- PIN_OTYPE_PUSHPULL(GPIOA_USB_DP) | \
- PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \
- PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
- PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
-#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_PIN0) | \
- PIN_OSPEED_HIGH(GPIOA_PIN1) | \
- PIN_OSPEED_VERYLOW(GPIOA_PIN2) | \
- PIN_OSPEED_VERYLOW(GPIOA_PIN3) | \
- PIN_OSPEED_VERYLOW(GPIOA_PIN4) | \
- PIN_OSPEED_VERYLOW(GPIOA_PIN5) | \
- PIN_OSPEED_VERYLOW(GPIOA_PIN6) | \
- PIN_OSPEED_VERYLOW(GPIOA_PIN7) | \
- PIN_OSPEED_VERYLOW(GPIOA_PIN8) | \
- PIN_OSPEED_VERYLOW(GPIOA_PIN9) | \
- PIN_OSPEED_VERYLOW(GPIOA_PIN10) | \
- PIN_OSPEED_HIGH(GPIOA_USB_DM) | \
- PIN_OSPEED_VERYLOW(GPIOA_USB_DP) | \
- PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
- PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
- PIN_OSPEED_VERYLOW(GPIOA_PIN15))
-#define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_PIN0) | \
- PIN_PUPDR_FLOATING(GPIOA_PIN1) | \
- PIN_PUPDR_PULLUP(GPIOA_PIN2) | \
- PIN_PUPDR_PULLUP(GPIOA_PIN3) | \
- PIN_PUPDR_PULLUP(GPIOA_PIN4) | \
- PIN_PUPDR_PULLUP(GPIOA_PIN5) | \
- PIN_PUPDR_PULLUP(GPIOA_PIN6) | \
- PIN_PUPDR_FLOATING(GPIOA_PIN7) | \
- PIN_PUPDR_PULLUP(GPIOA_PIN8) | \
- PIN_PUPDR_PULLUP(GPIOA_PIN9) | \
- PIN_PUPDR_PULLUP(GPIOA_PIN10) | \
- PIN_PUPDR_FLOATING(GPIOA_USB_DM) | \
- PIN_PUPDR_FLOATING(GPIOA_USB_DP) | \
- PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \
- PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \
- PIN_PUPDR_PULLUP(GPIOA_PIN15))
-#define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | \
- PIN_ODR_HIGH(GPIOA_PIN1) | \
- PIN_ODR_HIGH(GPIOA_PIN2) | \
- PIN_ODR_HIGH(GPIOA_PIN3) | \
- PIN_ODR_HIGH(GPIOA_PIN4) | \
- PIN_ODR_HIGH(GPIOA_PIN5) | \
- PIN_ODR_HIGH(GPIOA_PIN6) | \
- PIN_ODR_HIGH(GPIOA_PIN7) | \
- PIN_ODR_HIGH(GPIOA_PIN8) | \
- PIN_ODR_HIGH(GPIOA_PIN9) | \
- PIN_ODR_HIGH(GPIOA_PIN10) | \
- PIN_ODR_HIGH(GPIOA_USB_DM) | \
- PIN_ODR_HIGH(GPIOA_USB_DP) | \
- PIN_ODR_HIGH(GPIOA_SWDIO) | \
- PIN_ODR_HIGH(GPIOA_SWCLK) | \
- PIN_ODR_HIGH(GPIOA_PIN15))
-#define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0) | \
- PIN_AFIO_AF(GPIOA_PIN1, 1) | \
- PIN_AFIO_AF(GPIOA_PIN2, 0) | \
- PIN_AFIO_AF(GPIOA_PIN3, 0) | \
- PIN_AFIO_AF(GPIOA_PIN4, 0) | \
- PIN_AFIO_AF(GPIOA_PIN5, 5) | \
- PIN_AFIO_AF(GPIOA_PIN6, 5) | \
- PIN_AFIO_AF(GPIOA_PIN7, 5))
-#define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0) | \
- PIN_AFIO_AF(GPIOA_PIN9, 0) | \
- PIN_AFIO_AF(GPIOA_PIN10, 0) | \
- PIN_AFIO_AF(GPIOA_USB_DM, 14) | \
- PIN_AFIO_AF(GPIOA_USB_DP, 14) | \
- PIN_AFIO_AF(GPIOA_SWDIO, 0) | \
- PIN_AFIO_AF(GPIOA_SWCLK, 0) | \
- PIN_AFIO_AF(GPIOA_PIN15, 0))
-
-/*
- * GPIOB setup:
- *
- * PB0 - PIN0 (input pullup).
- * PB1 - PIN1 (input pullup).
- * PB2 - PIN2 (input pullup).
- * PB3 - PIN3 (alternate 0).
- * PB4 - PIN4 (input pullup).
- * PB5 - PIN5 (input pullup).
- * PB6 - PIN6 LSM303DLHC_SCL (alternate 4).
- * PB7 - PIN7 LSM303DLHC_SDA (alternate 4).
- * PB8 - PIN8 (input pullup).
- * PB9 - PIN9 (input pullup).
- * PB10 - PIN10 (input pullup).
- * PB11 - PIN11 (input pullup).
- * PB12 - PIN12 (input pullup).
- * PB13 - PIN13 (input pullup).
- * PB14 - PIN14 (input pullup).
- * PB15 - PIN15 (input pullup).
- */
-#define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \
- PIN_MODE_INPUT(GPIOB_PIN1) | \
- PIN_MODE_INPUT(GPIOB_PIN2) | \
- PIN_MODE_ALTERNATE(GPIOB_PIN3) | \
- PIN_MODE_INPUT(GPIOB_PIN4) | \
- PIN_MODE_INPUT(GPIOB_PIN5) | \
- PIN_MODE_ALTERNATE(GPIOB_PIN6) | \
- PIN_MODE_OUTPUT(GPIOB_PIN7) | \
- PIN_MODE_INPUT(GPIOB_PIN8) | \
- PIN_MODE_INPUT(GPIOB_PIN9) | \
- PIN_MODE_INPUT(GPIOB_PIN10) | \
- PIN_MODE_INPUT(GPIOB_PIN11) | \
- PIN_MODE_INPUT(GPIOB_PIN12) | \
- PIN_MODE_INPUT(GPIOB_PIN13) | \
- PIN_MODE_INPUT(GPIOB_PIN14) | \
- PIN_MODE_INPUT(GPIOB_PIN15))
-#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \
- PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \
- PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \
- PIN_OTYPE_PUSHPULL(GPIOB_PIN3) | \
- PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | \
- PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \
- PIN_OTYPE_OPENDRAIN(GPIOB_PIN6) | \
- PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \
- PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \
- PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \
- PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | \
- PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \