aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build_keyboard.mk4
-rw-r--r--docs/ja/proton_c_conversion.md1
-rw-r--r--docs/proton_c_conversion.md1
-rw-r--r--docs/serial_driver.md1
-rw-r--r--drivers/chibios/serial_usart.c13
-rw-r--r--keyboards/1upkeyboards/sweet16/v2/proton_c/rules.mk1
-rw-r--r--keyboards/acheron/shark/rules.mk1
-rw-r--r--keyboards/atreus/keymaps/ridingqwerty/rules.mk1
-rw-r--r--keyboards/boston_meetup/2019/rules.mk1
-rw-r--r--keyboards/c39/keymaps/drashna/rules.mk1
-rwxr-xr-xkeyboards/ckeys/thedora/rules.mk1
-rw-r--r--keyboards/clueboard/60/rules.mk1
-rw-r--r--keyboards/clueboard/66/rev4/rules.mk1
-rw-r--r--keyboards/clueboard/66_hotswap/gen1/rules.mk1
-rw-r--r--keyboards/clueboard/california/rules.mk1
-rw-r--r--keyboards/dztech/dz60rgb/v1/rules.mk1
-rw-r--r--keyboards/dztech/dz60rgb_ansi/v1/rules.mk1
-rw-r--r--keyboards/dztech/dz60rgb_wkl/v1/rules.mk1
-rw-r--r--keyboards/dztech/dz65rgb/v1/rules.mk1
-rw-r--r--keyboards/hadron/ver3/rules.mk1
-rw-r--r--keyboards/handwired/co60/rev6/rules.mk1
-rw-r--r--keyboards/handwired/co60/rev7/rules.mk1
-rw-r--r--keyboards/handwired/d48/rules.mk1
-rw-r--r--keyboards/handwired/ddg_56/rules.mk1
-rw-r--r--keyboards/handwired/floorboard/rules.mk1
-rw-r--r--keyboards/handwired/onekey/proton_c/rules.mk1
-rw-r--r--keyboards/handwired/onekey/pytest/rules.mk1
-rw-r--r--keyboards/handwired/selene/rules.mk1
-rw-r--r--keyboards/handwired/sick_pad/rules.mk1
-rw-r--r--keyboards/handwired/steamvan/rev1/rules.mk1
-rw-r--r--keyboards/handwired/wulkan/rules.mk1
-rw-r--r--keyboards/hs60/v2/ansi/rules.mk1
-rw-r--r--keyboards/hs60/v2/hhkb/rules.mk1
-rw-r--r--keyboards/hs60/v2/iso/rules.mk1
-rw-r--r--keyboards/kbdfans/kbd67/mkiirgb/v1/rules.mk1
-rw-r--r--keyboards/kv/revt/rules.mk1
-rw-r--r--keyboards/mechlovin/adelais/rules.mk1
-rw-r--r--keyboards/mechlovin/hannah60rgb/rules.mk1
-rw-r--r--keyboards/mechlovin/hannah65/rules.mk1
-rw-r--r--keyboards/mechlovin/infinity87/rules.mk1
-rw-r--r--keyboards/mechlovin/infinity88/rules.mk1
-rw-r--r--keyboards/melgeek/mj61/rev1/rules.mk1
-rw-r--r--keyboards/melgeek/mj63/rev1/rules.mk1
-rw-r--r--keyboards/melgeek/mj64/rev1/rules.mk1
-rw-r--r--keyboards/melgeek/mj64/rev2/rules.mk1
-rw-r--r--keyboards/melgeek/mojo75/rev1/rules.mk1
-rw-r--r--keyboards/melgeek/z70ultra/rev1/rules.mk1
-rw-r--r--keyboards/moonlander/rules.mk1
-rwxr-xr-xkeyboards/nebula68/rules.mk1
-rwxr-xr-xkeyboards/nk65/rules.mk1
-rwxr-xr-xkeyboards/nk87/rules.mk1
-rw-r--r--keyboards/planck/ez/rules.mk1
-rw-r--r--keyboards/planck/rev6/rules.mk1
-rw-r--r--keyboards/preonic/rev3/rules.mk1
-rw-r--r--keyboards/rgbkb/pan/rev1/proton_c/rules.mk1
-rw-r--r--keyboards/yugo_m/model_m_101/rules.mk1
-rw-r--r--platforms/chibios/GENERIC_STM32_F303XC/configs/mcuconf.h22
-rw-r--r--platforms/chibios/QMK_PROTON_C/board/board.mk9
-rw-r--r--platforms/chibios/QMK_PROTON_C/configs/board.h37
-rw-r--r--platforms/chibios/QMK_PROTON_C/configs/bootloader_defs.h7
-rw-r--r--platforms/chibios/QMK_PROTON_C/configs/chconf.h714
-rw-r--r--platforms/chibios/QMK_PROTON_C/configs/config.h20
-rw-r--r--platforms/chibios/QMK_PROTON_C/configs/halconf.h525
-rw-r--r--platforms/chibios/QMK_PROTON_C/configs/mcuconf.h273
-rw-r--r--platforms/chibios/QMK_PROTON_C/convert_to_proton_c.mk (renamed from platforms/chibios/GENERIC_STM32_F303XC/configs/proton_c.mk)7
-rw-r--r--platforms/chibios/common/configs/halconf.h2
-rw-r--r--quantum/quantum.h1
-rw-r--r--quantum/rgb_matrix.c6
-rw-r--r--quantum/rgblight.c21
-rw-r--r--quantum/split_common/transport.c26
-rw-r--r--readme.md6
-rw-r--r--tmk_core/chibios.mk3
-rw-r--r--tmk_core/common.mk1
-rw-r--r--tmk_core/common/keyboard.c2
-rw-r--r--tmk_core/common/sync_timer.c58
-rw-r--r--tmk_core/common/sync_timer.h54
76 files changed, 1828 insertions, 37 deletions
diff --git a/build_keyboard.mk b/build_keyboard.mk
index e87dcb8f2..8d018f2e3 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -136,9 +136,7 @@ ifeq ($(strip $(CTPC)), yes)
136endif 136endif
137 137
138ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes) 138ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
139 TARGET := $(TARGET)_proton_c 139 include platforms/chibios/QMK_PROTON_C/convert_to_proton_c.mk
140 include platforms/chibios/GENERIC_STM32_F303XC/configs/proton_c.mk
141 OPT_DEFS += -DCONVERT_TO_PROTON_C
142endif 140endif
143 141
144ifneq ($(FORCE_LAYOUT),) 142ifneq ($(FORCE_LAYOUT),)
diff --git a/docs/ja/proton_c_conversion.md b/docs/ja/proton_c_conversion.md
index 6e4f7dcb6..e7c07413c 100644
--- a/docs/ja/proton_c_conversion.md
+++ b/docs/ja/proton_c_conversion.md
@@ -51,6 +51,7 @@ Proton C には1つのオンボード LED(C13)しかなく、デフォルトで
51 51
52``` 52```
53MCU = STM32F303 53MCU = STM32F303
54BOARD = QMK_PROTON_C
54``` 55```
55 56
56次の変数が存在する場合は削除します。 57次の変数が存在する場合は削除します。
diff --git a/docs/proton_c_conversion.md b/docs/proton_c_conversion.md
index 1b5e496e7..47511e1b1 100644
--- a/docs/proton_c_conversion.md
+++ b/docs/proton_c_conversion.md
@@ -44,6 +44,7 @@ To use the Proton C natively, without having to specify `CTPC=yes`, you need to
44 44
45``` 45```
46MCU = STM32F303 46MCU = STM32F303
47BOARD = QMK_PROTON_C
47``` 48```
48 49
49Remove these variables if they exist: 50Remove these variables if they exist:
diff --git a/docs/serial_driver.md b/docs/serial_driver.md
index bc376b6dd..c98f4c117 100644
--- a/docs/serial_driver.md
+++ b/docs/serial_driver.md
@@ -60,6 +60,7 @@ Configure the hardware via your config.h:
60 // 5: about 19200 baud 60 // 5: about 19200 baud
61#define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1 61#define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1
62#define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 62#define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
63#define SERIAL_USART_TIMEOUT 100 // USART driver timeout. default 100
63``` 64```
64 65
65You must also enable the ChibiOS `SERIAL` feature: 66You must also enable the ChibiOS `SERIAL` feature:
diff --git a/drivers/chibios/serial_usart.c b/drivers/chibios/serial_usart.c
index 62b4913cb..72fcaed0c 100644
--- a/drivers/chibios/serial_usart.c
+++ b/drivers/chibios/serial_usart.c
@@ -58,7 +58,10 @@
58# error invalid SELECT_SOFT_SERIAL_SPEED value 58# error invalid SELECT_SOFT_SERIAL_SPEED value
59#endif 59#endif
60 60
61#define TIMEOUT 100 61#ifndef SERIAL_USART_TIMEOUT
62# define SERIAL_USART_TIMEOUT 100
63#endif
64
62#define HANDSHAKE_MAGIC 7 65#define HANDSHAKE_MAGIC 7
63 66
64static inline msg_t sdWriteHalfDuplex(SerialDriver* driver, uint8_t* data, uint8_t size) { 67static inline msg_t sdWriteHalfDuplex(SerialDriver* driver, uint8_t* data, uint8_t size) {
@@ -201,21 +204,21 @@ int soft_serial_transaction(int index) {
201 sdClear(&SERIAL_USART_DRIVER); 204 sdClear(&SERIAL_USART_DRIVER);
202 205
203 // First chunk is always transaction id 206 // First chunk is always transaction id
204 sdWriteTimeout(&SERIAL_USART_DRIVER, &sstd_index, sizeof(sstd_index), TIME_MS2I(TIMEOUT)); 207 sdWriteTimeout(&SERIAL_USART_DRIVER, &sstd_index, sizeof(sstd_index), TIME_MS2I(SERIAL_USART_TIMEOUT));
205 208
206 uint8_t sstd_index_shake = 0xFF; 209 uint8_t sstd_index_shake = 0xFF;
207 210
208 // Which we always read back first so that we can error out correctly 211 // Which we always read back first so that we can error out correctly
209 // - due to the half duplex limitations on return codes, we always have to read *something* 212 // - due to the half duplex limitations on return codes, we always have to read *something*
210 // - without the read, write only transactions *always* succeed, even during the boot process where the slave is not ready 213 // - without the read, write only transactions *always* succeed, even during the boot process where the slave is not ready
211 res = sdReadTimeout(&SERIAL_USART_DRIVER, &sstd_index_shake, sizeof(sstd_index_shake), TIME_MS2I(TIMEOUT)); 214 res = sdReadTimeout(&SERIAL_USART_DRIVER, &sstd_index_shake, sizeof(sstd_index_shake), TIME_MS2I(SERIAL_USART_TIMEOUT));
212 if (res < 0 || (sstd_index_shake != (sstd_index ^ HANDSHAKE_MAGIC))) { 215 if (res < 0 || (sstd_index_shake != (sstd_index ^ HANDSHAKE_MAGIC))) {
213 dprintf("serial::usart_shake NO_RESPONSE\n"); 216 dprintf("serial::usart_shake NO_RESPONSE\n");
214 return TRANSACTION_NO_RESPONSE; 217 return TRANSACTION_NO_RESPONSE;
215 } 218 }
216 219
217 if (trans->initiator2target_buffer_size) { 220 if (trans->initiator2target_buffer_size) {
218 res = sdWriteTimeout(&SERIAL_USART_DRIVER, trans->initiator2target_buffer, trans->initiator2target_buffer_size, TIME_MS2I(TIMEOUT)); 221 res = sdWriteTimeout(&SERIAL_USART_DRIVER, trans->initiator2target_buffer, trans->initiator2target_buffer_size, TIME_MS2I(SERIAL_USART_TIMEOUT));
219 if (res < 0) { 222 if (res < 0) {
220 dprintf("serial::usart_transmit NO_RESPONSE\n"); 223 dprintf("serial::usart_transmit NO_RESPONSE\n");
221 return TRANSACTION_NO_RESPONSE; 224 return TRANSACTION_NO_RESPONSE;
@@ -223,7 +226,7 @@ int soft_serial_transaction(int index) {
223 } 226 }
224 227
225 if (trans->target2initiator_buffer_size) { 228 if (trans->target2initiator_buffer_size) {
226 res = sdReadTimeout(&SERIAL_USART_DRIVER, trans->target2initiator_buffer, trans->target2initiator_buffer_size, TIME_MS2I(TIMEOUT)); 229 res = sdReadTimeout(&SERIAL_USART_DRIVER, trans->target2initiator_buffer, trans->target2initiator_buffer_size, TIME_MS2I(SERIAL_USART_TIMEOUT));
227 if (res < 0) { 230 if (res < 0) {
228 dprintf("serial::usart_receive NO_RESPONSE\n"); 231 dprintf("serial::usart_receive NO_RESPONSE\n");
229 return TRANSACTION_NO_RESPONSE; 232 return TRANSACTION_NO_RESPONSE;
diff --git a/keyboards/1upkeyboards/sweet16/v2/proton_c/rules.mk b/keyboards/1upkeyboards/sweet16/v2/proton_c/rules.mk
index dedcf043a..6fb15f5a8 100644
--- a/keyboards/1upkeyboards/sweet16/v2/proton_c/rules.mk
+++ b/keyboards/1upkeyboards/sweet16/v2/proton_c/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4## Features 5## Features
5CONSOLE_ENABLE = yes 6CONSOLE_ENABLE = yes
diff --git a/keyboards/acheron/shark/rules.mk b/keyboards/acheron/shark/rules.mk
index 1bd963c81..214c995ae 100644
--- a/keyboards/acheron/shark/rules.mk
+++ b/keyboards/acheron/shark/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/atreus/keymaps/ridingqwerty/rules.mk b/keyboards/atreus/keymaps/ridingqwerty/rules.mk
index 5c89d5481..ebf83f02e 100644
--- a/keyboards/atreus/keymaps/ridingqwerty/rules.mk
+++ b/keyboards/atreus/keymaps/ridingqwerty/rules.mk
@@ -1,4 +1,5 @@
1MCU = STM32F303 1MCU = STM32F303
2BOARD = QMK_PROTON_C
2 3
3# Build Options 4# Build Options
4# comment out to disable the options. 5# comment out to disable the options.
diff --git a/keyboards/boston_meetup/2019/rules.mk b/keyboards/boston_meetup/2019/rules.mk
index aa35ba753..9076d9ab4 100644
--- a/keyboards/boston_meetup/2019/rules.mk
+++ b/keyboards/boston_meetup/2019/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# comment out to disable the options. 6# comment out to disable the options.
diff --git a/keyboards/c39/keymaps/drashna/rules.mk b/keyboards/c39/keymaps/drashna/rules.mk
index 6ebd15a18..09c29f0e8 100644
--- a/keyboards/c39/keymaps/drashna/rules.mk
+++ b/keyboards/c39/keymaps/drashna/rules.mk
@@ -1,4 +1,5 @@
1MCU = STM32F303 1MCU = STM32F303
2BOARD = QMK_PROTON_C
2BOOTLOADER = 3BOOTLOADER =
3 4
4BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000) 5BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000)
diff --git a/keyboards/ckeys/thedora/rules.mk b/keyboards/ckeys/thedora/rules.mk
index 92665ffb6..8394b1a6c 100755
--- a/keyboards/ckeys/thedora/rules.mk
+++ b/keyboards/ckeys/thedora/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# comment out to disable the options. 6# comment out to disable the options.
diff --git a/keyboards/clueboard/60/rules.mk b/keyboards/clueboard/60/rules.mk
index a9151b87d..87f56692f 100644
--- a/keyboards/clueboard/60/rules.mk
+++ b/keyboards/clueboard/60/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# comment out to disable the options. 6# comment out to disable the options.
diff --git a/keyboards/clueboard/66/rev4/rules.mk b/keyboards/clueboard/66/rev4/rules.mk
index f8e4c07a4..f6120c929 100644
--- a/keyboards/clueboard/66/rev4/rules.mk
+++ b/keyboards/clueboard/66/rev4/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# comment out to disable the options. 6# comment out to disable the options.
diff --git a/keyboards/clueboard/66_hotswap/gen1/rules.mk b/keyboards/clueboard/66_hotswap/gen1/rules.mk
index 3667d63b7..c508ecbb5 100644
--- a/keyboards/clueboard/66_hotswap/gen1/rules.mk
+++ b/keyboards/clueboard/66_hotswap/gen1/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# LED Configuration 5# LED Configuration
5LED_MATRIX_ENABLE = yes 6LED_MATRIX_ENABLE = yes
diff --git a/keyboards/clueboard/california/rules.mk b/keyboards/clueboard/california/rules.mk
index e96afd813..11719015e 100644
--- a/keyboards/clueboard/california/rules.mk
+++ b/keyboards/clueboard/california/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4## Features 5## Features
5MOUSEKEY_ENABLE = yes # Mouse keys 6MOUSEKEY_ENABLE = yes # Mouse keys
diff --git a/keyboards/dztech/dz60rgb/v1/rules.mk b/keyboards/dztech/dz60rgb/v1/rules.mk
index d71fb4c53..88207bc3f 100644
--- a/keyboards/dztech/dz60rgb/v1/rules.mk
+++ b/keyboards/dztech/dz60rgb/v1/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/dztech/dz60rgb_ansi/v1/rules.mk b/keyboards/dztech/dz60rgb_ansi/v1/rules.mk
index d71fb4c53..88207bc3f 100644
--- a/keyboards/dztech/dz60rgb_ansi/v1/rules.mk
+++ b/keyboards/dztech/dz60rgb_ansi/v1/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/dztech/dz60rgb_wkl/v1/rules.mk b/keyboards/dztech/dz60rgb_wkl/v1/rules.mk
index 9dfe17003..426769e24 100644
--- a/keyboards/dztech/dz60rgb_wkl/v1/rules.mk
+++ b/keyboards/dztech/dz60rgb_wkl/v1/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/dztech/dz65rgb/v1/rules.mk b/keyboards/dztech/dz65rgb/v1/rules.mk
index 4570dc3bd..da88300da 100644
--- a/keyboards/dztech/dz65rgb/v1/rules.mk
+++ b/keyboards/dztech/dz65rgb/v1/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/hadron/ver3/rules.mk b/keyboards/hadron/ver3/rules.mk
index 6c13bd2bc..e75b0c721 100644
--- a/keyboards/hadron/ver3/rules.mk
+++ b/keyboards/hadron/ver3/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# comment out to disable the options. 6# comment out to disable the options.
diff --git a/keyboards/handwired/co60/rev6/rules.mk b/keyboards/handwired/co60/rev6/rules.mk
index b20c2efed..f4e7ae924 100644
--- a/keyboards/handwired/co60/rev6/rules.mk
+++ b/keyboards/handwired/co60/rev6/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# comment out to disable the options. 6# comment out to disable the options.
diff --git a/keyboards/handwired/co60/rev7/rules.mk b/keyboards/handwired/co60/rev7/rules.mk
index 50e4bb891..3e15f073f 100644
--- a/keyboards/handwired/co60/rev7/rules.mk
+++ b/keyboards/handwired/co60/rev7/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Use SPI for RGB underglow: 5# Use SPI for RGB underglow:
5WS2812_DRIVER = spi 6WS2812_DRIVER = spi
diff --git a/keyboards/handwired/d48/rules.mk b/keyboards/handwired/d48/rules.mk
index 57c83694e..41a6cc522 100644
--- a/keyboards/handwired/d48/rules.mk
+++ b/keyboards/handwired/d48/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/handwired/ddg_56/rules.mk b/keyboards/handwired/ddg_56/rules.mk
index 0604f1176..dfbb0959f 100644
--- a/keyboards/handwired/ddg_56/rules.mk
+++ b/keyboards/handwired/ddg_56/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change to "no" to disable the options, or define them in the Makefile in 6# change to "no" to disable the options, or define them in the Makefile in
diff --git a/keyboards/handwired/floorboard/rules.mk b/keyboards/handwired/floorboard/rules.mk
index 5a83cfcf9..88bc406a2 100644
--- a/keyboards/handwired/floorboard/rules.mk
+++ b/keyboards/handwired/floorboard/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/handwired/onekey/proton_c/rules.mk b/keyboards/handwired/onekey/proton_c/rules.mk
index b17a3d031..4e157baed 100644
--- a/keyboards/handwired/onekey/proton_c/rules.mk
+++ b/keyboards/handwired/onekey/proton_c/rules.mk
@@ -1,2 +1,3 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
diff --git a/keyboards/handwired/onekey/pytest/rules.mk b/keyboards/handwired/onekey/pytest/rules.mk
index b17a3d031..4e157baed 100644
--- a/keyboards/handwired/onekey/pytest/rules.mk
+++ b/keyboards/handwired/onekey/pytest/rules.mk
@@ -1,2 +1,3 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
diff --git a/keyboards/handwired/selene/rules.mk b/keyboards/handwired/selene/rules.mk
index 9416bc5fd..bfb967f9a 100644
--- a/keyboards/handwired/selene/rules.mk
+++ b/keyboards/handwired/selene/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/handwired/sick_pad/rules.mk b/keyboards/handwired/sick_pad/rules.mk
index bfe731ecc..28578f082 100644
--- a/keyboards/handwired/sick_pad/rules.mk
+++ b/keyboards/handwired/sick_pad/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/handwired/steamvan/rev1/rules.mk b/keyboards/handwired/steamvan/rev1/rules.mk
index 797d7b35d..30c74d2ec 100644
--- a/keyboards/handwired/steamvan/rev1/rules.mk
+++ b/keyboards/handwired/steamvan/rev1/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Use SPI for RGB underglow: 5# Use SPI for RGB underglow:
5WS2812_DRIVER = spi 6WS2812_DRIVER = spi
diff --git a/keyboards/handwired/wulkan/rules.mk b/keyboards/handwired/wulkan/rules.mk
index 25bb40269..b23f2a5fe 100644
--- a/keyboards/handwired/wulkan/rules.mk
+++ b/keyboards/handwired/wulkan/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# comment out to disable the options. 6# comment out to disable the options.
diff --git a/keyboards/hs60/v2/ansi/rules.mk b/keyboards/hs60/v2/ansi/rules.mk
index 8efabcccb..74889decf 100644
--- a/keyboards/hs60/v2/ansi/rules.mk
+++ b/keyboards/hs60/v2/ansi/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Do not put the microcontroller into power saving mode 5# Do not put the microcontroller into power saving mode
5# when we get USB suspend event. We want it to keep updating 6# when we get USB suspend event. We want it to keep updating
diff --git a/keyboards/hs60/v2/hhkb/rules.mk b/keyboards/hs60/v2/hhkb/rules.mk
index 14951cca7..561a8cd06 100644
--- a/keyboards/hs60/v2/hhkb/rules.mk
+++ b/keyboards/hs60/v2/hhkb/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Do not put the microcontroller into power saving mode 5# Do not put the microcontroller into power saving mode
5# when we get USB suspend event. We want it to keep updating 6# when we get USB suspend event. We want it to keep updating
diff --git a/keyboards/hs60/v2/iso/rules.mk b/keyboards/hs60/v2/iso/rules.mk
index 96bfbce05..62af70cc0 100644
--- a/keyboards/hs60/v2/iso/rules.mk
+++ b/keyboards/hs60/v2/iso/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Do not put the microcontroller into power saving mode 5# Do not put the microcontroller into power saving mode
5# when we get USB suspend event. We want it to keep updating 6# when we get USB suspend event. We want it to keep updating
diff --git a/keyboards/kbdfans/kbd67/mkiirgb/v1/rules.mk b/keyboards/kbdfans/kbd67/mkiirgb/v1/rules.mk
index 4e9bcf21a..4e79819ff 100644
--- a/keyboards/kbdfans/kbd67/mkiirgb/v1/rules.mk
+++ b/keyboards/kbdfans/kbd67/mkiirgb/v1/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4BACKLIGHT_ENABLE = no 5BACKLIGHT_ENABLE = no
5BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration 6BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
diff --git a/keyboards/kv/revt/rules.mk b/keyboards/kv/revt/rules.mk
index d97369b15..94db62954 100644
--- a/keyboards/kv/revt/rules.mk
+++ b/keyboards/kv/revt/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/mechlovin/adelais/rules.mk b/keyboards/mechlovin/adelais/rules.mk
index e1d36928f..5ea0bd12c 100644
--- a/keyboards/mechlovin/adelais/rules.mk
+++ b/keyboards/mechlovin/adelais/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4 5
5# Build Options 6# Build Options
diff --git a/keyboards/mechlovin/hannah60rgb/rules.mk b/keyboards/mechlovin/hannah60rgb/rules.mk
index eb9b15283..2fe4bb7aa 100644
--- a/keyboards/mechlovin/hannah60rgb/rules.mk
+++ b/keyboards/mechlovin/hannah60rgb/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/mechlovin/hannah65/rules.mk b/keyboards/mechlovin/hannah65/rules.mk
index 74157ae71..57ead17fa 100644
--- a/keyboards/mechlovin/hannah65/rules.mk
+++ b/keyboards/mechlovin/hannah65/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/mechlovin/infinity87/rules.mk b/keyboards/mechlovin/infinity87/rules.mk
index 00676c2ec..a405eda03 100644
--- a/keyboards/mechlovin/infinity87/rules.mk
+++ b/keyboards/mechlovin/infinity87/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/mechlovin/infinity88/rules.mk b/keyboards/mechlovin/infinity88/rules.mk
index 7897007c0..40e4543e8 100644
--- a/keyboards/mechlovin/infinity88/rules.mk
+++ b/keyboards/mechlovin/infinity88/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/melgeek/mj61/rev1/rules.mk b/keyboards/melgeek/mj61/rev1/rules.mk
index 12c66f05a..6f196e884 100644
--- a/keyboards/melgeek/mj61/rev1/rules.mk
+++ b/keyboards/melgeek/mj61/rev1/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/melgeek/mj63/rev1/rules.mk b/keyboards/melgeek/mj63/rev1/rules.mk
index d5fc76b8e..c55beb7d1 100644
--- a/keyboards/melgeek/mj63/rev1/rules.mk
+++ b/keyboards/melgeek/mj63/rev1/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/melgeek/mj64/rev1/rules.mk b/keyboards/melgeek/mj64/rev1/rules.mk
index 01b8aca41..f50aefd04 100644
--- a/keyboards/melgeek/mj64/rev1/rules.mk
+++ b/keyboards/melgeek/mj64/rev1/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/melgeek/mj64/rev2/rules.mk b/keyboards/melgeek/mj64/rev2/rules.mk
index 01b8aca41..f50aefd04 100644
--- a/keyboards/melgeek/mj64/rev2/rules.mk
+++ b/keyboards/melgeek/mj64/rev2/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/melgeek/mojo75/rev1/rules.mk b/keyboards/melgeek/mojo75/rev1/rules.mk
index 12c66f05a..6f196e884 100644
--- a/keyboards/melgeek/mojo75/rev1/rules.mk
+++ b/keyboards/melgeek/mojo75/rev1/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/melgeek/z70ultra/rev1/rules.mk b/keyboards/melgeek/z70ultra/rev1/rules.mk
index dce0366f7..48087186d 100644
--- a/keyboards/melgeek/z70ultra/rev1/rules.mk
+++ b/keyboards/melgeek/z70ultra/rev1/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/moonlander/rules.mk b/keyboards/moonlander/rules.mk
index 124061072..561db849e 100644
--- a/keyboards/moonlander/rules.mk
+++ b/keyboards/moonlander/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/keyboards/nebula68/rules.mk b/keyboards/nebula68/rules.mk
index 399385b3e..40e17f1b4 100755
--- a/keyboards/nebula68/rules.mk
+++ b/keyboards/nebula68/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Do not put the microcontroller into power saving mode 5# Do not put the microcontroller into power saving mode
5# when we get USB suspend event. We want it to keep updating 6# when we get USB suspend event. We want it to keep updating
diff --git a/keyboards/nk65/rules.mk b/keyboards/nk65/rules.mk
index f7db412a2..af41e71cb 100755
--- a/keyboards/nk65/rules.mk
+++ b/keyboards/nk65/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Do not put the microcontroller into power saving mode 5# Do not put the microcontroller into power saving mode
5# when we get USB suspend event. We want it to keep updating 6# when we get USB suspend event. We want it to keep updating
diff --git a/keyboards/nk87/rules.mk b/keyboards/nk87/rules.mk
index cdf4668ec..e10ec5bc0 100755
--- a/keyboards/nk87/rules.mk
+++ b/keyboards/nk87/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Do not put the microcontroller into power saving mode 5# Do not put the microcontroller into power saving mode
5# when we get USB suspend event. We want it to keep updating 6# when we get USB suspend event. We want it to keep updating
diff --git a/keyboards/planck/ez/rules.mk b/keyboards/planck/ez/rules.mk
index 18eada389..716e5feda 100644
--- a/keyboards/planck/ez/rules.mk
+++ b/keyboards/planck/ez/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change to "no" to disable the options, or define them in the Makefile in 6# change to "no" to disable the options, or define them in the Makefile in
diff --git a/keyboards/planck/rev6/rules.mk b/keyboards/planck/rev6/rules.mk
index 02d6b8953..fc43bef57 100644
--- a/keyboards/planck/rev6/rules.mk
+++ b/keyboards/planck/rev6/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change to "no" to disable the options, or define them in the Makefile in 6# change to "no" to disable the options, or define them in the Makefile in
diff --git a/keyboards/preonic/rev3/rules.mk b/keyboards/preonic/rev3/rules.mk
index a5fc16a2e..e4d48e5b5 100644
--- a/keyboards/preonic/rev3/rules.mk
+++ b/keyboards/preonic/rev3/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change to "no" to disable the options, or define them in the Makefile in 6# change to "no" to disable the options, or define them in the Makefile in
diff --git a/keyboards/rgbkb/pan/rev1/proton_c/rules.mk b/keyboards/rgbkb/pan/rev1/proton_c/rules.mk
index b17a3d031..e7e9d992d 100644
--- a/keyboards/rgbkb/pan/rev1/proton_c/rules.mk
+++ b/keyboards/rgbkb/pan/rev1/proton_c/rules.mk
@@ -1,2 +1,3 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C \ No newline at end of file
diff --git a/keyboards/yugo_m/model_m_101/rules.mk b/keyboards/yugo_m/model_m_101/rules.mk
index 6d1c53123..12a2e3dea 100644
--- a/keyboards/yugo_m/model_m_101/rules.mk
+++ b/keyboards/yugo_m/model_m_101/rules.mk
@@ -1,5 +1,6 @@
1# MCU name 1# MCU name
2MCU = STM32F303 2MCU = STM32F303
3BOARD = QMK_PROTON_C
3 4
4# Build Options 5# Build Options
5# change yes to no to disable 6# change yes to no to disable
diff --git a/platforms/chibios/GENERIC_STM32_F303XC/configs/mcuconf.h b/platforms/chibios/GENERIC_STM32_F303XC/configs/mcuconf.h
index ac2d9a1ee..c6f5a8ac5 100644
--- a/platforms/chibios/GENERIC_STM32_F303XC/configs/mcuconf.h
+++ b/platforms/chibios/GENERIC_STM32_F303XC/configs/mcuconf.h
@@ -127,8 +127,8 @@
127 * DAC driver system settings. 127 * DAC driver system settings.
128 */ 128 */
129#define STM32_DAC_DUAL_MODE FALSE 129#define STM32_DAC_DUAL_MODE FALSE
130#define STM32_DAC_USE_DAC1_CH1 TRUE 130#define STM32_DAC_USE_DAC1_CH1 FALSE
131#define STM32_DAC_USE_DAC1_CH2 TRUE 131#define STM32_DAC_USE_DAC1_CH2 FALSE
132#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10 132#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10
133#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10 133#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10
134#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2 134#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2
@@ -141,10 +141,10 @@
141#define STM32_GPT_USE_TIM2 FALSE 141#define STM32_GPT_USE_TIM2 FALSE
142#define STM32_GPT_USE_TIM3 FALSE 142#define STM32_GPT_USE_TIM3 FALSE
143#define STM32_GPT_USE_TIM4 FALSE 143#define STM32_GPT_USE_TIM4 FALSE
144#define STM32_GPT_USE_TIM6 TRUE 144#define STM32_GPT_USE_TIM6 FALSE
145#define STM32_GPT_USE_TIM7 TRUE 145#define STM32_GPT_USE_TIM7 FALSE
146#define STM32_GPT_USE_TIM8 TRUE 146#define STM32_GPT_USE_TIM8 FALSE
147#define STM32_GPT_USE_TIM15 TRUE 147#define STM32_GPT_USE_TIM15 FALSE
148#define STM32_GPT_USE_TIM16 FALSE 148#define STM32_GPT_USE_TIM16 FALSE
149#define STM32_GPT_USE_TIM17 FALSE 149#define STM32_GPT_USE_TIM17 FALSE
150#define STM32_GPT_TIM1_IRQ_PRIORITY 7 150#define STM32_GPT_TIM1_IRQ_PRIORITY 7
@@ -158,7 +158,7 @@
158/* 158/*
159 * I2C driver system settings. 159 * I2C driver system settings.
160 */ 160 */
161#define STM32_I2C_USE_I2C1 TRUE 161#define STM32_I2C_USE_I2C1 FALSE
162#define STM32_I2C_USE_I2C2 FALSE 162#define STM32_I2C_USE_I2C2 FALSE
163#define STM32_I2C_BUSY_TIMEOUT 50 163#define STM32_I2C_BUSY_TIMEOUT 50
164#define STM32_I2C_I2C1_IRQ_PRIORITY 10 164#define STM32_I2C_I2C1_IRQ_PRIORITY 10
@@ -189,8 +189,8 @@
189#define STM32_PWM_USE_ADVANCED FALSE 189#define STM32_PWM_USE_ADVANCED FALSE
190#define STM32_PWM_USE_TIM1 FALSE 190#define STM32_PWM_USE_TIM1 FALSE
191#define STM32_PWM_USE_TIM2 FALSE 191#define STM32_PWM_USE_TIM2 FALSE
192#define STM32_PWM_USE_TIM3 TRUE 192#define STM32_PWM_USE_TIM3 FALSE
193#define STM32_PWM_USE_TIM4 TRUE 193#define STM32_PWM_USE_TIM4 FALSE
194#define STM32_PWM_USE_TIM8 FALSE 194#define STM32_PWM_USE_TIM8 FALSE
195#define STM32_PWM_USE_TIM15 FALSE 195#define STM32_PWM_USE_TIM15 FALSE
196#define STM32_PWM_USE_TIM16 FALSE 196#define STM32_PWM_USE_TIM16 FALSE
@@ -213,7 +213,7 @@
213 * SERIAL driver system settings. 213 * SERIAL driver system settings.
214 */ 214 */
215#define STM32_SERIAL_USE_USART1 FALSE 215#define STM32_SERIAL_USE_USART1 FALSE
216#define STM32_SERIAL_USE_USART2 TRUE 216#define STM32_SERIAL_USE_USART2 FALSE
217#define STM32_SERIAL_USE_USART3 FALSE 217#define STM32_SERIAL_USE_USART3 FALSE
218#define STM32_SERIAL_USE_UART4 FALSE 218#define STM32_SERIAL_USE_UART4 FALSE
219#define STM32_SERIAL_USE_UART5 FALSE 219#define STM32_SERIAL_USE_UART5 FALSE
@@ -227,7 +227,7 @@
227 * SPI driver system settings. 227 * SPI driver system settings.
228 */ 228 */
229#define STM32_SPI_USE_SPI1 FALSE 229#define STM32_SPI_USE_SPI1 FALSE
230#define STM32_SPI_USE_SPI2 TRUE 230#define STM32_SPI_USE_SPI2 FALSE
231#define STM32_SPI_USE_SPI3 FALSE 231#define STM32_SPI_USE_SPI3 FALSE
232#define STM32_SPI_SPI1_DMA_PRIORITY 1 232#define STM32_SPI_SPI1_DMA_PRIORITY 1
233#define STM32_SPI_SPI2_DMA_PRIORITY 1 233#define STM32_SPI_SPI2_DMA_PRIORITY 1
diff --git a/platforms/chibios/QMK_PROTON_C/board/board.mk b/platforms/chibios/QMK_PROTON_C/board/board.mk
new file mode 100644
index 000000000..f891e6524
--- /dev/null
+++ b/platforms/chibios/QMK_PROTON_C/board/board.mk
@@ -0,0 +1,9 @@
1# List of all the board related files.
2BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_STM32F3_DISCOVERY/board.c
3
4# Required include directories
5BOARDINC = $(CHIBIOS)/os/hal/boards/ST_STM32F3_DISCOVERY
6
7# Shared variables
8ALLCSRC += $(BOARDSRC)
9ALLINC += $(BOARDINC)
diff --git a/platforms/chibios/QMK_PROTON_C/configs/board.h b/platforms/chibios/QMK_PROTON_C/configs/board.h
new file mode 100644
index 000000000..97159964d
--- /dev/null
+++ b/platforms/chibios/QMK_PROTON_C/configs/board.h
@@ -0,0 +1,37 @@
1/* Copyright 2020 Nick Brassel (tzarc)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include_next "board.h"
19
20#undef STM32_HSE_BYPASS
21
22/*
23 * USB bus activation macro, required by the USB driver.
24 */
25#define usb_lld_connect_bus(usbp) \
26 do { \
27 palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_ALTERNATE(14)); \
28 } while (0)
29
30/*
31 * USB bus de-activation macro, required by the USB driver.
32 */
33#define usb_lld_disconnect_bus(usbp) \
34 do { \
35 palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_OUTPUT_PUSHPULL); \
36 palClearPad(GPIOA, GPIOA_USB_DP); \
37 } while (0)
diff --git a/platforms/chibios/QMK_PROTON_C/configs/bootloader_defs.h b/platforms/chibios/QMK_PROTON_C/configs/bootloader_defs.h
new file mode 100644
index 000000000..3b0e9d20a
--- /dev/null
+++ b/platforms/chibios/QMK_PROTON_C/configs/bootloader_defs.h
@@ -0,0 +1,7 @@
1/* Address for jumping to bootloader on STM32 chips. */
2/* It is chip dependent, the correct number can be looked up here:
3 * http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
4 * This also requires a patch to chibios:
5 * <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch
6 */
7#define STM32_BOOTLOADER_ADDRESS 0x1FFFD800
diff --git a/platforms/chibios/QMK_PROTON_C/configs/chconf.h b/platforms/chibios/QMK_PROTON_C/configs/chconf.h
new file mode 100644
index 000000000..aac330370
--- /dev/null
+++ b/platforms/chibios/QMK_PROTON_C/configs/chconf.h
@@ -0,0 +1,714 @@
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file rt/templates/chconf.h
19 * @brief Configuration file template.
20 * @details A copy of this file must be placed in each project directory, it
21 * contains the application specific kernel settings.
22 *
23 * @addtogroup config
24 * @details Kernel related settings and hooks.
25 * @{
26 */
27
28#ifndef CHCONF_H
29#define CHCONF_H
30
31#define _CHIBIOS_RT_CONF_
32#define _CHIBIOS_RT_CONF_VER_6_0_
33
34/*===========================================================================*/
35/**
36 * @name System timers settings
37 * @{
38 */
39/*===========================================================================*/
40
41/**
42 * @brief System time counter resolution.
43 * @note Allowed values are 16 or 32 bits.
44 */
45#if !defined(CH_CFG_ST_RESOLUTION)
46#define CH_CFG_ST_RESOLUTION 32
47#endif
48
49/**
50 * @brief System tick frequency.
51 * @details Frequency of the system timer that drives the system ticks. This
52 * setting also defines the system tick time unit.
53 */
54#if !defined(CH_CFG_ST_FREQUENCY)
55#define CH_CFG_ST_FREQUENCY 100000
56#endif
57
58/**
59 * @brief Time intervals data size.
60 * @note Allowed values are 16, 32 or 64 bits.
61 */
62#if !defined(CH_CFG_INTERVALS_SIZE)
63#define CH_CFG_INTERVALS_SIZE 32
64#endif
65
66/**
67 * @brief Time types data size.
68 * @note Allowed values are 16 or 32 bits.
69 */
70#if !defined(CH_CFG_TIME_TYPES_SIZE)
71#define CH_CFG_TIME_TYPES_SIZE 32
72#endif
73
74/**
75 * @brief Time delta constant for the tick-less mode.
76 * @note If this value is zero then the system uses the classic
77 * periodic tick. This value represents the minimum number
78 * of ticks that is safe to specify in a timeout directive.
79 * The value one is not valid, timeouts are rounded up to
80 * this value.
81 */
82#if !defined(CH_CFG_ST_TIMEDELTA)
83#define CH_CFG_ST_TIMEDELTA 2
84#endif
85
86/** @} */
87
88/*===========================================================================*/
89/**
90 * @name Kernel parameters and options
91 * @{
92 */
93/*===========================================================================*/
94
95/**
96 * @brief Round robin interval.
97 * @details This constant is the number of system ticks allowed for the
98 * threads before preemption occurs. Setting this value to zero
99 * disables the preemption for threads with equal priority and the
100 * round robin becomes cooperative. Note that higher priority
101 * threads can still preempt, the kernel is always preemptive.
102 * @note Disabling the round robin preemption makes the kernel more compact
103 * and generally faster.
104 * @note The round robin preemption is not supported in tickless mode and
105 * must be set to zero in that case.
106 */
107#if !defined(CH_CFG_TIME_QUANTUM)
108#define CH_CFG_TIME_QUANTUM 0
109#endif
110
111/**
112 * @brief Managed RAM size.
113 * @details Size of the RAM area to be managed by the OS. If set to zero
114 * then the whole available RAM is used. The core memory is made
115 * available to the heap allocator and/or can be used directly through
116 * the simplified core memory allocator.
117 *
118 * @note In order to let the OS manage the whole RAM the linker script must
119 * provide the @p __heap_base__ and @p __heap_end__ symbols.
120 * @note Requires @p CH_CFG_USE_MEMCORE.
121 */
122#if !defined(CH_CFG_MEMCORE_SIZE)
123#define CH_CFG_MEMCORE_SIZE 0
124#endif
125
126/**
127 * @brief Idle thread automatic spawn suppression.
128 * @details When this option is activated the function @p chSysInit()
129 * does not spawn the idle thread. The application @p main()
130 * function becomes the idle thread and must implement an
131 * infinite loop.
132 */
133#if !defined(CH_CFG_NO_IDLE_THREAD)
134#define CH_CFG_NO_IDLE_THREAD FALSE
135#endif
136
137/** @} */
138
139/*===========================================================================*/
140/**
141 * @name Performance options
142 * @{
143 */
144/*===========================================================================*/
145
146/**
147 * @brief OS optimization.
148 * @details If enabled then time efficient rather than space efficient code
149 * is used when two possible implementations exist.
150 *
151 * @note This is not related to the compiler optimization options.
152 * @note The default is @p TRUE.
153 */
154#if !defined(CH_CFG_OPTIMIZE_SPEED)
155#define CH_CFG_OPTIMIZE_SPEED TRUE
156#endif
157
158/** @} */
159
160/*===========================================================================*/
161/**
162 * @name Subsystem options
163 * @{
164 */
165/*===========================================================================*/
166
167/**
168 * @brief Time Measurement APIs.
169 * @details If enabled then the time measurement APIs are included in
170 * the kernel.
171 *
172 * @note The default is @p TRUE.
173 */
174#if !defined(CH_CFG_USE_TM)
175#define CH_CFG_USE_TM TRUE
176#endif
177
178/**
179 * @brief Threads registry APIs.
180 * @details If enabled then the registry APIs are included in the kernel.
181 *
182 * @note The default is @p TRUE.
183 */
184#if !defined(CH_CFG_USE_REGISTRY)
185#define CH_CFG_USE_REGISTRY TRUE
186#endif
187
188/**
189 * @brief Threads synchronization APIs.
190 * @details If enabled then the @p chThdWait() function is included in
191 * the kernel.
192 *
193 * @note The default is @p TRUE.
194 */
195#if !defined(CH_CFG_USE_WAITEXIT)
196#define CH_CFG_USE_WAITEXIT TRUE
197#endif
198
199/**
200 * @brief Semaphores APIs.
201 * @details If enabled then the Semaphores APIs are included in the kernel.
202 *
203 * @note The default is @p TRUE.
204 */
205#if !defined(CH_CFG_USE_SEMAPHORES)
206#define CH_CFG_USE_SEMAPHORES TRUE
207#endif
208
209/**
210 * @brief Semaphores queuing mode.
211 * @details If enabled then the threads are enqueued on semaphores by
212 * priority rather than in FIFO order.
213 *
214 * @note The default is @p FALSE. Enable this if you have special
215 * requirements.
216 * @note Requires @p CH_CFG_USE_SEMAPHORES.
217 */
218#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
219#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
220#endif
221
222/**
223 * @brief Mutexes APIs.
224 * @details If enabled then the mutexes APIs are included in the kernel.
225 *
226 * @note The default is @p TRUE.
227 */
228#if !defined(CH_CFG_USE_MUTEXES)
229#define CH_CFG_USE_MUTEXES TRUE
230#endif
231
232/**
233 * @brief Enables recursive behavior on mutexes.
234 * @note Recursive mutexes are heavier and have an increased
235 * memory footprint.
236 *
237 * @note The default is @p FALSE.
238 * @note Requires @p CH_CFG_USE_MUTEXES.
239 */
240#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
241#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
242#endif
243
244/**
245 * @brief Conditional Variables APIs.
246 * @details If enabled then the conditional variables APIs are included
247 * in the kernel.
248 *
249 * @note The default is @p TRUE.
250 * @note Requires @p CH_CFG_USE_MUTEXES.
251 */
252#if !defined(CH_CFG_USE_CONDVARS)
253#define CH_CFG_USE_CONDVARS TRUE
254#endif
255
256/**
257 * @brief Conditional Variables APIs with timeout.
258 * @details If enabled then the conditional variables APIs with timeout
259 * specification are included in the kernel.
260 *
261 * @note The default is @p TRUE.
262 * @note Requires @p CH_CFG_USE_CONDVARS.
263 */
264#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
265#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
266#endif
267
268/**
269 * @brief Events Flags APIs.
270 * @details If enabled then the event flags APIs are included in the kernel.
271 *
272 * @note The default is @p TRUE.
273 */
274#if !defined(CH_CFG_USE_EVENTS)
275#define CH_CFG_USE_EVENTS TRUE
276#endif
277
278/**
279 * @brief Events Flags APIs with timeout.
280 * @details If enabled then the events APIs with timeout specification
281 * are included in the kernel.
282 *
283 * @note The default is @p TRUE.
284 * @note Requires @p CH_CFG_USE_EVENTS.
285 */
286#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
287#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
288#endif
289
290/**
291 * @brief Synchronous Messages APIs.
292 * @details If enabled then the synchronous messages APIs are included
293 * in the kernel.
294 *
295 * @note The default is @p TRUE.
296 */
297#if !defined(CH_CFG_USE_MESSAGES)
298#define CH_CFG_USE_MESSAGES TRUE
299#endif
300
301/**
302 * @brief Synchronous Messages queuing mode.
303 * @details If enabled then messages are served by priority rather than in
304 * FIFO order.
305 *
306 * @note The default is @p FALSE. Enable this if you have special
307 * requirements.
308 * @note Requires @p CH_CFG_USE_MESSAGES.
309 */
310#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
311#define CH_CFG_USE_MESSAGES_PRIORITY TRUE
312#endif
313
314/**
315 * @brief Mailboxes APIs.
316 * @details If enabled then the asynchronous messages (mailboxes) APIs are
317 * included in the kernel.
318 *
319 * @note The default is @p TRUE.
320 * @note Requires @p CH_CFG_USE_SEMAPHORES.
321 */
322#if !defined(CH_CFG_USE_MAILBOXES)
323#define CH_CFG_USE_MAILBOXES TRUE
324#endif
325
326/**
327 * @brief Core Memory Manager APIs.
328 * @details If enabled then the core memory manager APIs are included
329 * in the kernel.
330 *
331 * @note The default is @p TRUE.
332 */
333#if !defined(CH_CFG_USE_MEMCORE)
334#define CH_CFG_USE_MEMCORE TRUE
335#endif
336
337/**
338 * @brief Heap Allocator APIs.
339 * @details If enabled then the memory heap allocator APIs are included
340 * in the kernel.
341 *
342 * @note The default is @p TRUE.
343 * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
344 * @p CH_CFG_USE_SEMAPHORES.
345 * @note Mutexes are recommended.
346 */
347#if !defined(CH_CFG_USE_HEAP)
348#define CH_CFG_USE_HEAP TRUE
349#endif
350
351/**
352 * @brief Memory Pools Allocator APIs.
353 * @details If enabled then the memory pools allocator APIs are included
354 * in the kernel.
355 *
356 * @note The default is @p TRUE.
357 */
358#if !defined(CH_CFG_USE_MEMPOOLS)
359#define CH_CFG_USE_MEMPOOLS TRUE
360#endif
361
362/**
363 * @brief Objects FIFOs APIs.
364 * @details If enabled then the objects FIFOs APIs are included
365 * in the kernel.
366 *
367 * @note The default is @p TRUE.
368 */
369#if !defined(CH_CFG_USE_OBJ_FIFOS)
370#define CH_CFG_USE_OBJ_FIFOS TRUE
371#endif
372
373/**
374 * @brief Pipes APIs.
375 * @details If enabled then the pipes APIs are included
376 * in the kernel.
377 *
378 * @note The default is @p TRUE.
379 */
380#if !defined(CH_CFG_USE_PIPES)
381#define CH_CFG_USE_PIPES TRUE
382#endif
383
384/**
385 * @brief Dynamic Threads APIs.
386 * @details If enabled then the dynamic threads creation APIs are included
387 * in the kernel.
388 *
389 * @note The default is @p TRUE.
390 * @note Requires @p CH_CFG_USE_WAITEXIT.
391 * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
392 */
393#if !defined(CH_CFG_USE_DYNAMIC)
394#define CH_CFG_USE_DYNAMIC TRUE
395#endif
396
397/** @} */
398
399/*===========================================================================*/
400/**
401 * @name Objects factory options
402 * @{
403 */
404/*===========================================================================*/
405
406/**
407 * @brief Objects Factory APIs.
408 * @details If enabled then the objects factory APIs are included in the
409 * kernel.
410 *
411 * @note The default is @p FALSE.
412 */
413#if !defined(CH_CFG_USE_FACTORY)
414#define CH_CFG_USE_FACTORY TRUE
415#endif
416
417/**
418 * @brief Maximum length for object names.
419 * @details If the specified length is zero then the name is stored by
420 * pointer but this could have unintended side effects.
421 */
422#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
423#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
424#endif
425
426/**
427 * @brief Enables the registry of generic objects.
428 */
429#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
430#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
431#endif
432
433/**
434 * @brief Enables factory for generic buffers.
435 */
436#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
437#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
438#endif
439
440/**
441 * @brief Enables factory for semaphores.
442 */
443#if !defined(CH_CFG_FACTORY_SEMAPHORES)
444#define CH_CFG_FACTORY_SEMAPHORES TRUE
445#endif
446
447/**
448 * @brief Enables factory for mailboxes.
449 */
450#if !defined(CH_CFG_FACTORY_MAILBOXES)
451#define CH_CFG_FACTORY_MAILBOXES TRUE
452#endif
453
454/**
455 * @brief Enables factory for objects FIFOs.
456 */
457#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
458#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
459#endif
460
461/**
462 * @brief Enables factory for Pipes.
463 */
464#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
465#define CH_CFG_FACTORY_PIPES TRUE
466#endif
467
468/** @} */
469
470/*===========================================================================*/
471/**
472 * @name Debug options
473 * @{
474 */
475/*===========================================================================*/
476
477/**
478 * @brief Debug option, kernel statistics.
479 *
480 * @note The default is @p FALSE.
481 */
482#if !defined(CH_DBG_STATISTICS)
483#define CH_DBG_STATISTICS FALSE
484#endif
485
486/**
487 * @brief Debug option, system state check.
488 * @details If enabled the correct call protocol for system APIs is checked
489 * at runtime.
490 *
491 * @note The default is @p FALSE.
492 */
493#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
494#define CH_DBG_SYSTEM_STATE_CHECK FALSE
495#endif
496
497/**
498 * @brief Debug option, parameters checks.
499 * @details If enabled then the checks on the API functions input
500 * parameters are activated.
501 *
502 * @note The default is @p FALSE.
503 */
504#if !defined(CH_DBG_ENABLE_CHECKS)
505#define CH_DBG_ENABLE_CHECKS FALSE
506#endif
507
508/**
509 * @brief Debug option, consistency checks.
510 * @details If enabled then all the assertions in the kernel code are
511 * activated. This includes consistency checks inside the kernel,
512 * runtime anomalies and port-defined checks.
513 *
514 * @note The default is @p FALSE.
515 */
516#if !defined(CH_DBG_ENABLE_ASSERTS)
517#define CH_DBG_ENABLE_ASSERTS FALSE
518#endif
519
520/**
521 * @brief Debug option, trace buffer.
522 * @details If enabled then the trace buffer is activated.
523 *
524 * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
525 */
526#if !defined(CH_DBG_TRACE_MASK)
527#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
528#endif
529
530/**
531 * @brief Trace buffer entries.
532 * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
533 * different from @p CH_DBG_TRACE_MASK_DISABLED.
534 */
535#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
536#define CH_DBG_TRACE_BUFFER_SIZE 128
537#endif
538
539/**
540 * @brief Debug option, stack checks.
541 * @details If enabled then a runtime stack check is performed.
542 *
543 * @note The default is @p FALSE.
544 * @note The stack check is performed in a architecture/port dependent way.
545 * It may not be implemented or some ports.
546 * @note The default failure mode is to halt the system with the global
547 * @p panic_msg variable set to @p NULL.
548 */
549#if !defined(CH_DBG_ENABLE_STACK_CHECK)
550#define CH_DBG_ENABLE_STACK_CHECK TRUE
551#endif
552
553/**
554 * @brief Debug option, stacks initialization.
555 * @details If enabled then the threads working area is filled with a byte
556 * value when a thread is created. This can be useful for the
557 * runtime measurement of the used stack.
558 *
559 * @note The default is @p FALSE.
560 */
561#if !defined(CH_DBG_FILL_THREADS)
562#define CH_DBG_FILL_THREADS FALSE
563#endif
564
565/**
566 * @brief Debug option, threads profiling.
567 * @details If enabled then a field is added to the @p thread_t structure that
568 * counts the system ticks occurred while executing the thread.
569 *
570 * @note The default is @p FALSE.
571 * @note This debug option is not currently compatible with the
572 * tickless mode.
573 */
574#if !defined(CH_DBG_THREADS_PROFILING)
575#define CH_DBG_THREADS_PROFILING FALSE
576#endif
577
578/** @} */
579
580/*===========================================================================*/
581/**
582 * @name Kernel hooks
583 * @{
584 */
585/*===========================================================================*/
586
587/**
588 * @brief System structure extension.
589 * @details User fields added to the end of the @p ch_system_t structure.
590 */
591#define CH_CFG_SYSTEM_EXTRA_FIELDS \
592 /* Add threads custom fields here.*/
593
594/**
595 * @brief System initialization hook.
596 * @details User initialization code added to the @p chSysInit() function
597 * just before interrupts are enabled globally.
598 */
599#define CH_CFG_SYSTEM_INIT_HOOK() { \
600 /* Add threads initialization code here.*/ \
601}
602
603/**
604 * @brief Threads descriptor structure extension.
605 * @details User fields added to the end of the @p thread_t structure.
606 */
607#define CH_CFG_THREAD_EXTRA_FIELDS \
608 /* Add threads custom fields here.*/
609
610/**
611 * @brief Threads initialization hook.
612 * @details User initialization code added to the @p _thread_init() function.
613 *
614 * @note It is invoked from within @p _thread_init() and implicitly from all
615 * the threads creation APIs.
616 */
617#define CH_CFG_THREAD_INIT_HOOK(tp) { \
618 /* Add threads initialization code here.*/ \
619}
620
621/**
622 * @brief Threads finalization hook.
623 * @details User finalization code added to the @p chThdExit() API.
624 */
625#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
626 /* Add threads finalization code here.*/ \
627}
628
629/**
630 * @brief Context switch hook.
631 * @details This hook is invoked just before switching between threads.
632 */
633#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
634 /* Context switch code here.*/ \
635}
636
637/**
638 * @brief ISR enter hook.
639 */
640#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
641 /* IRQ prologue code here.*/ \
642}
643
644/**
645 * @brief ISR exit hook.
646 */
647#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
648 /* IRQ epilogue code here.*/ \
649}
650
651/**
652 * @brief Idle thread enter hook.
653 * @note This hook is invoked within a critical zone, no OS functions
654 * should be invoked from here.
655 * @note This macro can be used to activate a power saving mode.
656 */
657#define CH_CFG_IDLE_ENTER_HOOK() { \
658 /* Idle-enter code here.*/ \
659}
660
661/**
662 * @brief Idle thread leave hook.
663 * @note This hook is invoked within a critical zone, no OS functions
664 * should be invoked from here.
665 * @note This macro can be used to deactivate a power saving mode.
666 */
667#define CH_CFG_IDLE_LEAVE_HOOK() { \
668 /* Idle-leave code here.*/ \
669}
670
671/**
672 * @brief Idle Loop hook.
673 * @details This hook is continuously invoked by the idle thread loop.
674 */
675#define CH_CFG_IDLE_LOOP_HOOK() { \
676 /* Idle loop code here.*/ \
677}
678
679/**
680 * @brief System tick event hook.
681 * @details This hook is invoked in the system tick handler immediately
682 * after processing the virtual timers queue.
683 */
684#define CH_CFG_SYSTEM_TICK_HOOK() { \
685 /* System tick event code here.*/ \
686}
687
688/**
689 * @brief System halt hook.
690 * @details This hook is invoked in case to a system halting error before
691 * the system is halted.
692 */
693#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
694 /* System halt code here.*/ \
695}
696
697/**
698 * @brief Trace hook.
699 * @details This hook is invoked each time a new record is written in the
700 * trace buffer.
701 */
702#define CH_CFG_TRACE_HOOK(tep) { \
703 /* Trace code here.*/ \
704}
705
706/** @} */
707
708/*===========================================================================*/
709/* Port-specific settings (override port settings defaulted in chcore.h). */
710/*===========================================================================*/
711
712#endif /* CHCONF_H */
713
714/** @} */
diff --git a/platforms/chibios/QMK_PROTON_C/configs/config.h b/platforms/chibios/QMK_PROTON_C/configs/config.h
new file mode 100644
index 000000000..a73f0c0b4
--- /dev/null
+++ b/platforms/chibios/QMK_PROTON_C/configs/config.h
@@ -0,0 +1,20 @@
1/* Copyright 2020 Nick Brassel (tzarc)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
19# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
20#endif
diff --git a/platforms/chibios/QMK_PROTON_C/configs/halconf.h b/platforms/chibios/QMK_PROTON_C/configs/halconf.h
new file mode 100644
index 000000000..a9f2cf77b
--- /dev/null
+++ b/platforms/chibios/QMK_PROTON_C/configs/halconf.h
@@ -0,0 +1,525 @@
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file templates/halconf.h
19 * @brief HAL configuration header.
20 * @details HAL configuration file, this file allows to enable or disable the
21 * various device drivers from your application. You may also use
22 * this file in order to override the device drivers default settings.
23 *
24 * @addtogroup HAL_CONF
25 * @{
26 */
27
28#ifndef HALCONF_H
29#define HALCONF_H
30
31#define _CHIBIOS_HAL_CONF_
32#define _CHIBIOS_HAL_CONF_VER_7_0_
33
34#include <mcuconf.h>
35
36/**
37 * @brief Enables the PAL subsystem.
38 */
39#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
40#define HAL_USE_PAL TRUE
41#endif
42
43/**
44 * @brief Enables the ADC subsystem.
45 */
46#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
47#define HAL_USE_ADC FALSE
48#endif
49
50/**
51 * @brief Enables the CAN subsystem.
52 */
53#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
54#define HAL_USE_CAN FALSE
55#endif
56
57/**
58 * @brief Enables the cryptographic subsystem.
59 */
60#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
61#define HAL_USE_CRY FALSE
62#endif
63
64/**
65 * @brief Enables the DAC subsystem.
66 */
67#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
68#define HAL_USE_DAC TRUE
69#endif
70
71/**
72 * @brief Enables the GPT subsystem.
73 */
74#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
75#define HAL_USE_GPT TRUE
76#endif
77
78/**
79 * @brief Enables the I2C subsystem.
80 */
81#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
82#define HAL_USE_I2C TRUE
83#endif
84
85/**
86 * @brief Enables the I2S subsystem.
87 */
88#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
89#define HAL_USE_I2S FALSE
90#endif
91
92/**
93 * @brief Enables the ICU subsystem.
94 */
95#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
96#define HAL_USE_ICU FALSE
97#endif
98
99/**
100 * @brief Enables the MAC subsystem.
101 */
102#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
103#define HAL_USE_MAC FALSE
104#endif
105
106/**
107 * @brief Enables the MMC_SPI subsystem.
108 */
109#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
110#define HAL_USE_MMC_SPI FALSE
111#endif
112
113/**
114 * @brief Enables the PWM subsystem.
115 */
116#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
117#define HAL_USE_PWM TRUE
118#endif
119
120/**
121 * @brief Enables the RTC subsystem.
122 */
123#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
124#define HAL_USE_RTC FALSE
125#endif
126
127/**
128 * @brief Enables the SDC subsystem.
129 */
130#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
131#define HAL_USE_SDC FALSE
132#endif
133
134/**
135 * @brief Enables the SERIAL subsystem.
136 */
137#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
138#define HAL_USE_SERIAL FALSE
139#endif
140
141/**
142 * @brief Enables the SERIAL over USB subsystem.
143 */
144#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
145#define HAL_USE_SERIAL_USB TRUE
146#endif
147
148/**
149 * @brief Enables the SIO subsystem.
150 */
151#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
152#define HAL_USE_SIO FALSE
153#endif
154
155/**
156 * @brief Enables the SPI subsystem.
157 */
158#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
159#define HAL_USE_SPI TRUE
160#endif
161
162/**
163 * @brief Enables the TRNG subsystem.
164 */
165#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
166#define HAL_USE_TRNG FALSE
167#endif
168
169/**
170 * @brief Enables the UART subsystem.
171 */
172#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
173#define HAL_USE_UART FALSE
174#endif
175
176/**
177 * @brief Enables the USB subsystem.
178 */
179#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
180#define HAL_USE_USB TRUE
181#endif
182
183/**
184 * @brief Enables the WDG subsystem.
185 */
186#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
187#define HAL_USE_WDG FALSE
188#endif
189
190/**
191 * @brief Enables the WSPI subsystem.
192 */
193#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
194#define HAL_USE_WSPI FALSE
195#endif
196
197/*===========================================================================*/
198/* PAL driver related settings. */
199/*===========================================================================*/
200
201/**
202 * @brief Enables synchronous APIs.
203 * @note Disabling this option saves both code and data space.
204 */
205#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
206#define PAL_USE_CALLBACKS TRUE
207#endif
208
209/**
210 * @brief Enables synchronous APIs.
211 * @note Disabling this option saves both code and data space.
212 */
213#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
214#define PAL_USE_WAIT TRUE
215#endif
216
217/*===========================================================================*/
218/* ADC driver related settings. */
219/*===========================================================================*/
220
221/**
222 * @brief Enables synchronous APIs.
223 * @note Disabling this option saves both code and data space.
224 */
225#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
226#define ADC_USE_WAIT TRUE
227#endif
228
229/**
230 * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
231 * @note Disabling this option saves both code and data space.
232 */
233#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
234#define ADC_USE_MUTUAL_EXCLUSION TRUE
235#endif
236
237/*===========================================================================*/
238/* CAN driver related settings. */
239/*===========================================================================*/
240
241/**
242 * @brief Sleep mode related APIs inclusion switch.
243 */
244#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
245#define CAN_USE_SLEEP_MODE TRUE
246#endif
247
248/**
249 * @brief Enforces the driver to use direct callbacks rather than OSAL events.
250 */
251#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
252#define CAN_ENFORCE_USE_CALLBACKS FALSE
253#endif
254
255/*===========================================================================*/
256/* CRY driver related settings. */
257/*===========================================================================*/
258
259/**
260 * @brief Enables the SW fall-back of the cryptographic driver.
261 * @details When enabled, this option, activates a fall-back software
262 * implementation for algorithms not supported by the underlying
263 * hardware.
264 * @note Fall-back implementations may not be present for all algorithms.
265 */
266#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
267#define HAL_CRY_USE_FALLBACK FALSE
268#endif
269
270/**
271 * @brief Makes the driver forcibly use the fall-back implementations.
272 */
273#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
274#define HAL_CRY_ENFORCE_FALLBACK FALSE
275#endif
276
277/*===========================================================================*/
278/* DAC driver related settings. */
279/*===========================================================================*/
280
281/**
282 * @brief Enables synchronous APIs.
283 * @note Disabling this option saves both code and data space.
284 */
285#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
286#define DAC_USE_WAIT TRUE
287#endif
288
289/**
290 * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
291 * @note Disabling this option saves both code and data space.
292 */
293#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
294#define DAC_USE_MUTUAL_EXCLUSION TRUE
295#endif
296
297/*===========================================================================*/
298/* I2C driver related settings. */
299/*===========================================================================*/
300
301/**
302 * @brief Enables the mutual exclusion APIs on the I2C bus.
303 */
304#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
305#define I2C_USE_MUTUAL_EXCLUSION TRUE
306#endif
307
308/*===========================================================================*/
309/* MAC driver related settings. */
310/*===========================================================================*/
311
312/**
313 * @brief Enables the zero-copy API.
314 */
315#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
316#define MAC_USE_ZERO_COPY FALSE
317#endif
318
319/**
320 * @brief Enables an event sources for incoming packets.
321 */
322#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
323#define MAC_USE_EVENTS TRUE
324#endif
325
326/*===========================================================================*/
327/* MMC_SPI driver related settings. */
328/*===========================================================================*/
329
330/**
331 * @brief Delays insertions.
332 * @details If enabled this options inserts delays into the MMC waiting
333 * routines releasing some extra CPU time for the threads with
334 * lower priority, this may slow down the driver a bit however.
335 * This option is recommended also if the SPI driver does not
336 * use a DMA channel and heavily loads the CPU.
337 */
338#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
339#define MMC_NICE_WAITING TRUE
340#endif
341
342/*===========================================================================*/
343/* SDC driver related settings. */
344/*===========================================================================*/
345
346/**
347 * @brief Number of initialization attempts before rejecting the card.
348 * @note Attempts are performed at 10mS intervals.
349 */
350#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
351#define SDC_INIT_RETRY 100
352#endif
353
354/**
355 * @brief Include support for MMC cards.
356 * @note MMC support is not yet implemented so this option must be kept
357 * at @p FALSE.
358 */
359#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
360#define SDC_MMC_SUPPORT FALSE
361#endif
362
363/**
364 * @brief Delays insertions.
365 * @details If enabled this options inserts delays into the MMC waiting
366 * routines releasing some extra CPU time for the threads with
367 * lower priority, this may slow down the driver a bit however.
368 */
369#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
370#define SDC_NICE_WAITING TRUE
371#endif
372
373/**
374 * @brief OCR initialization constant for V20 cards.
375 */
376#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
377#define SDC_INIT_OCR_V20 0x50FF8000U
378#endif
379
380/**
381 * @brief OCR initialization constant for non-V20 cards.
382 */
383#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
384#define SDC_INIT_OCR 0x80100000U
385#endif
386
387/*===========================================================================*/
388/* SERIAL driver related settings. */
389/*===========================================================================*/
390
391/**
392 * @brief Default bit rate.
393 * @details Configuration parameter, this is the baud rate selected for the
394 * default configuration.
395 */
396#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
397#define SERIAL_DEFAULT_BITRATE 38400
398#endif
399
400/**
401 * @brief Serial buffers size.
402 * @details Configuration parameter, you can change the depth of the queue
403 * buffers depending on the requirements of your application.
404 * @note The default is 16 bytes for both the transmission and receive
405 * buffers.
406 */
407#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
408#define SERIAL_BUFFERS_SIZE 16
409#endif
410
411/*===========================================================================*/
412/* SERIAL_USB driver related setting. */
413/*===========================================================================*/
414
415/**
416 * @brief Serial over USB buffers size.
417 * @details Configuration parameter, the buffer size must be a multiple of
418 * the USB data endpoint maximum packet size.
419 * @note The default is 256 bytes for both the transmission and receive
420 * buffers.
421 */
422#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
423#define SERIAL_USB_BUFFERS_SIZE 1
424#endif
425
426/**
427 * @brief Serial over USB number of buffers.
428 * @note The default is 2 buffers.
429 */
430#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
431#define SERIAL_USB_BUFFERS_NUMBER 2
432#endif
433
434/*===========================================================================*/
435/* SPI driver related settings. */
436/*===========================================================================*/
437
438/**
439 * @brief Enables synchronous APIs.
440 * @note Disabling this option saves both code and data space.
441 */
442#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
443#define SPI_USE_WAIT TRUE
444#endif
445
446/**
447 * @brief Enables circular transfers APIs.
448 * @note Disabling this option saves both code and data space.
449 */
450#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
451#define SPI_USE_CIRCULAR FALSE
452#endif
453
454
455/**
456 * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
457 * @note Disabling this option saves both code and data space.
458 */
459#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
460#define SPI_USE_MUTUAL_EXCLUSION TRUE
461#endif
462
463/**
464 * @brief Handling method for SPI CS line.
465 * @note Disabling this option saves both code and data space.
466 */
467#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
468#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
469#endif
470
471/*===========================================================================*/
472/* UART driver related settings. */
473/*===========================================================================*/
474
475/**
476 * @brief Enables synchronous APIs.
477 * @note Disabling this option saves both code and data space.
478 */
479#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
480#define UART_USE_WAIT FALSE
481#endif
482
483/**
484 * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
485 * @note Disabling this option saves both code and data space.
486 */
487#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
488#define UART_USE_MUTUAL_EXCLUSION FALSE
489#endif
490
491/*===========================================================================*/
492/* USB driver related settings. */
493/*===========================================================================*/
494
495/**
496 * @brief Enables synchronous APIs.
497 * @note Disabling this option saves both code and data space.
498 */
499#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
500#define USB_USE_WAIT TRUE
501#endif
502
503/*===========================================================================*/
504/* WSPI driver related settings. */
505/*===========================================================================*/
506
507/**
508 * @brief Enables synchronous APIs.
509 * @note Disabling this option saves both code and data space.
510 */
511#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
512#define WSPI_USE_WAIT TRUE
513#endif
514
515/**
516 * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
517 * @note Disabling this option saves both code and data space.
518 */
519#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
520#define WSPI_USE_MUTUAL_EXCLUSION TRUE
521#endif
522
523#endif /* HALCONF_H */
524
525/** @} */
diff --git a/platforms/chibios/QMK_PROTON_C/configs/mcuconf.h b/platforms/chibios/QMK_PROTON_C/configs/mcuconf.h
new file mode 100644
index 000000000..ac2d9a1ee
--- /dev/null
+++ b/platforms/chibios/QMK_PROTON_C/configs/mcuconf.h
@@ -0,0 +1,273 @@
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#ifndef MCUCONF_H
18#define MCUCONF_H
19
20/*
21 * STM32F3xx drivers configuration.
22 * The following settings override the default settings present in
23 * the various device driver implementation headers.
24 * Note that the settings for each driver only have effect if the whole
25 * driver is enabled in halconf.h.
26 *
27 * IRQ priorities:
28 * 15...0 Lowest...Highest.
29 *
30 * DMA priorities:
31 * 0...3 Lowest...Highest.
32 */
33
34#define STM32F3xx_MCUCONF
35#define STM32F303_MCUCONF
36
37/*
38 * HAL driver system settings.
39 */
40#define STM32_NO_INIT FALSE
41#define STM32_PVD_ENABLE FALSE
42#define STM32_PLS STM32_PLS_LEV0
43#define STM32_HSI_ENABLED TRUE
44#define STM32_LSI_ENABLED TRUE
45#define STM32_HSE_ENABLED TRUE
46#define STM32_LSE_ENABLED FALSE
47#define STM32_SW STM32_SW_PLL
48#define STM32_PLLSRC STM32_PLLSRC_HSE
49#define STM32_PREDIV_VALUE 1
50#define STM32_PLLMUL_VALUE 9
51#define STM32_HPRE STM32_HPRE_DIV1
52#define STM32_PPRE1 STM32_PPRE1_DIV2
53#define STM32_PPRE2 STM32_PPRE2_DIV2
54#define STM32_MCOSEL STM32_MCOSEL_NOCLOCK
55#define STM32_ADC12PRES STM32_ADC12PRES_DIV1
56#define STM32_ADC34PRES STM32_ADC34PRES_DIV1
57#define STM32_USART1SW STM32_USART1SW_PCLK
58#define STM32_USART2SW STM32_USART2SW_PCLK
59#define STM32_USART3SW STM32_USART3SW_PCLK
60#define STM32_UART4SW STM32_UART4SW_PCLK
61#define STM32_UART5SW STM32_UART5SW_PCLK
62#define STM32_I2C1SW STM32_I2C1SW_SYSCLK
63#define STM32_I2C2SW STM32_I2C2SW_SYSCLK
64#define STM32_TIM1SW STM32_TIM1SW_PCLK2
65#define STM32_TIM8SW STM32_TIM8SW_PCLK2
66#define STM32_RTCSEL STM32_RTCSEL_LSI
67#define STM32_USB_CLOCK_REQUIRED TRUE
68#define STM32_USBPRE STM32_USBPRE_DIV1P5
69
70/*
71 * IRQ system settings.
72 */
73#define STM32_IRQ_EXTI0_PRIORITY 6
74#define STM32_IRQ_EXTI1_PRIORITY 6
75#define STM32_IRQ_EXTI2_PRIORITY 6
76#define STM32_IRQ_EXTI3_PRIORITY 6
77#define STM32_IRQ_EXTI4_PRIORITY 6
78#define STM32_IRQ_EXTI5_9_PRIORITY 6
79#define STM32_IRQ_EXTI10_15_PRIORITY 6
80#define STM32_IRQ_EXTI16_PRIORITY 6
81#define STM32_IRQ_EXTI17_PRIORITY 15
82#define STM32_IRQ_EXTI18_PRIORITY 6
83#define STM32_IRQ_EXTI19_PRIORITY 15
84#define STM32_IRQ_EXTI20_PRIORITY 15
85#define STM32_IRQ_EXTI21_22_29_PRIORITY 6
86#define STM32_IRQ_EXTI30_32_PRIORITY 6
87#define STM32_IRQ_EXTI33_PRIORITY 6
88#define STM32_IRQ_TIM1_BRK_TIM15_PRIORITY 7
89#define STM32_IRQ_TIM1_UP_TIM16_PRIORITY 7
90#define STM32_IRQ_TIM1_TRGCO_TIM17_PRIORITY 7
91#define STM32_IRQ_TIM1_CC_PRIORITY 7
92
93/*
94 * ADC driver system settings.
95 */
96#define STM32_ADC_DUAL_MODE FALSE
97#define STM32_ADC_COMPACT_SAMPLES FALSE
98#define STM32_ADC_USE_ADC1 FALSE
99#define STM32_ADC_USE_ADC2 FALSE
100#define STM32_ADC_USE_ADC3 FALSE
101#define STM32_ADC_USE_ADC4 FALSE
102#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(1, 1)
103#define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
104#define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
105#define STM32_ADC_ADC4_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
106#define STM32_ADC_ADC1_DMA_PRIORITY 2
107#define STM32_ADC_ADC2_DMA_PRIORITY 2
108#define STM32_ADC_ADC3_DMA_PRIORITY 2
109#define STM32_ADC_ADC4_DMA_PRIORITY 2
110#define STM32_ADC_ADC12_IRQ_PRIORITY 5
111#define STM32_ADC_ADC3_IRQ_PRIORITY 5
112#define STM32_ADC_ADC4_IRQ_PRIORITY 5
113#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 5
114#define STM32_ADC_ADC2_DMA_IRQ_PRIORITY 5
115#define STM32_ADC_ADC3_DMA_IRQ_PRIORITY 5
116#define STM32_ADC_ADC4_DMA_IRQ_PRIORITY 5
117#define STM32_ADC_ADC12_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV1
118#define STM32_ADC_ADC34_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV1
119
120/*
121 * CAN driver system settings.
122 */
123#define STM32_CAN_USE_CAN1 FALSE
124#define STM32_CAN_CAN1_IRQ_PRIORITY 11
125
126/*
127 * DAC driver system settings.
128 */
129#define STM32_DAC_DUAL_MODE FALSE
130#define STM32_DAC_USE_DAC1_CH1 TRUE
131#define STM32_DAC_USE_DAC1_CH2 TRUE
132#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10
133#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10
134#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2
135#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2
136
137/*
138 * GPT driver system settings.
139 */
140#define STM32_GPT_USE_TIM1 FALSE
141#define STM32_GPT_USE_TIM2 FALSE
142#define STM32_GPT_USE_TIM3 FALSE
143#define STM32_GPT_USE_TIM4 FALSE
144#define STM32_GPT_USE_TIM6 TRUE
145#define STM32_GPT_USE_TIM7 TRUE
146#define STM32_GPT_USE_TIM8 TRUE
147#define STM32_GPT_USE_TIM15 TRUE
148#define STM32_GPT_USE_TIM16 FALSE
149#define STM32_GPT_USE_TIM17 FALSE
150#define STM32_GPT_TIM1_IRQ_PRIORITY 7
151#define STM32_GPT_TIM2_IRQ_PRIORITY 7
152#define STM32_GPT_TIM3_IRQ_PRIORITY 7
153#define STM32_GPT_TIM4_IRQ_PRIORITY 7
154#define STM32_GPT_TIM6_IRQ_PRIORITY 7
155#define STM32_GPT_TIM7_IRQ_PRIORITY 7
156#define STM32_GPT_TIM8_IRQ_PRIORITY 7
157
158/*
159 * I2C driver system settings.
160 */
161#define STM32_I2C_USE_I2C1 TRUE
162#define STM32_I2C_USE_I2C2 FALSE
163#define STM32_I2C_BUSY_TIMEOUT 50
164#define STM32_I2C_I2C1_IRQ_PRIORITY 10
165#define STM32_I2C_I2C2_IRQ_PRIORITY 10
166#define STM32_I2C_USE_DMA TRUE
167#define STM32_I2C_I2C1_DMA_PRIORITY 1
168#define STM32_I2C_I2C2_DMA_PRIORITY 1
169#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
170
171/*
172 * ICU driver system settings.
173 */
174#define STM32_ICU_USE_TIM1 FALSE
175#define STM32_ICU_USE_TIM2 FALSE
176#define STM32_ICU_USE_TIM3 FALSE
177#define STM32_ICU_USE_TIM4 FALSE
178#define STM32_ICU_USE_TIM8 FALSE
179#define STM32_ICU_USE_TIM15 FALSE
180#define STM32_ICU_TIM1_IRQ_PRIORITY 7
181#define STM32_ICU_TIM2_IRQ_PRIORITY 7
182#define STM32_ICU_TIM3_IRQ_PRIORITY 7
183#define STM32_ICU_TIM4_IRQ_PRIORITY 7
184#define STM32_ICU_TIM8_IRQ_PRIORITY 7
185
186/*
187 * PWM driver system settings.
188 */
189#define STM32_PWM_USE_ADVANCED FALSE
190#define STM32_PWM_USE_TIM1 FALSE
191#define STM32_PWM_USE_TIM2 FALSE
192#define STM32_PWM_USE_TIM3 TRUE
193#define STM32_PWM_USE_TIM4 TRUE
194#define STM32_PWM_USE_TIM8 FALSE
195#define STM32_PWM_USE_TIM15 FALSE
196#define STM32_PWM_USE_TIM16 FALSE
197#define STM32_PWM_USE_TIM17 FALSE
198#define STM32_PWM_TIM1_IRQ_PRIORITY 7
199#define STM32_PWM_TIM2_IRQ_PRIORITY 7
200#define STM32_PWM_TIM3_IRQ_PRIORITY 7
201#define STM32_PWM_TIM4_IRQ_PRIORITY 7
202#define STM32_PWM_TIM8_IRQ_PRIORITY 7
203
204/*
205 * RTC driver system settings.
206 */
207#define STM32_RTC_PRESA_VALUE 32
208#define STM32_RTC_PRESS_VALUE 1024
209#define STM32_RTC_CR_INIT 0
210#define STM32_RTC_TAMPCR_INIT 0
211
212/*
213 * SERIAL driver system settings.
214 */
215#define STM32_SERIAL_USE_USART1 FALSE
216#define STM32_SERIAL_USE_USART2 TRUE
217#define STM32_SERIAL_USE_USART3 FALSE
218#define STM32_SERIAL_USE_UART4 FALSE
219#define STM32_SERIAL_USE_UART5 FALSE
220#define STM32_SERIAL_USART1_PRIORITY 12
221#define STM32_SERIAL_USART2_PRIORITY 12
222#define STM32_SERIAL_USART3_PRIORITY 12
223#define STM32_SERIAL_UART4_PRIORITY 12
224#define STM32_SERIAL_UART5_PRIORITY 12
225
226/*
227 * SPI driver system settings.
228 */
229#define STM32_SPI_USE_SPI1 FALSE
230#define STM32_SPI_USE_SPI2 TRUE
231#define STM32_SPI_USE_SPI3 FALSE
232#define STM32_SPI_SPI1_DMA_PRIORITY 1
233#define STM32_SPI_SPI2_DMA_PRIORITY 1
234#define STM32_SPI_SPI3_DMA_PRIORITY 1
235#define STM32_SPI_SPI1_IRQ_PRIORITY 10
236#define STM32_SPI_SPI2_IRQ_PRIORITY 10
237#define STM32_SPI_SPI3_IRQ_PRIORITY 10
238#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
239
240/*
241 * ST driver system settings.
242 */
243#define STM32_ST_IRQ_PRIORITY 8
244#define STM32_ST_USE_TIMER 2
245
246/*
247 * UART driver system settings.
248 */
249#define STM32_UART_USE_USART1 FALSE
250#define STM32_UART_USE_USART2 FALSE
251#define STM32_UART_USE_USART3 FALSE
252#define STM32_UART_USART1_IRQ_PRIORITY 12
253#define STM32_UART_USART2_IRQ_PRIORITY 12
254#define STM32_UART_USART3_IRQ_PRIORITY 12
255#define STM32_UART_USART1_DMA_PRIORITY 0
256#define STM32_UART_USART2_DMA_PRIORITY 0
257#define STM32_UART_USART3_DMA_PRIORITY 0
258#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
259
260/*
261 * USB driver system settings.
262 */
263#define STM32_USB_USE_USB1 TRUE
264#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE
265#define STM32_USB_USB1_HP_IRQ_PRIORITY 13
266#define STM32_USB_USB1_LP_IRQ_PRIORITY 14
267
268/*
269 * WDG driver system settings.
270 */
271#define STM32_WDG_USE_IWDG FALSE
272
273#endif /* MCUCONF_H */
diff --git a/platforms/chibios/GENERIC_STM32_F303XC/configs/proton_c.mk b/platforms/chibios/QMK_PROTON_C/convert_to_proton_c.mk
index 23907c810..3fa73a96e 100644
--- a/platforms/chibios/GENERIC_STM32_F303XC/configs/proton_c.mk
+++ b/platforms/chibios/QMK_PROTON_C/convert_to_proton_c.mk
@@ -1,9 +1,12 @@
1# Proton C MCU settings for converting AVR projects 1# Proton C MCU settings for converting AVR projects
2MCU = STM32F303 2TARGET := $(TARGET)_proton_c
3MCU := STM32F303
4BOARD := QMK_PROTON_C
5OPT_DEFS += -DCONVERT_TO_PROTON_C
3 6
4# These are defaults based on what has been implemented for ARM boards 7# These are defaults based on what has been implemented for ARM boards
5AUDIO_ENABLE = yes 8AUDIO_ENABLE = yes
6WS2812_DRIVER = bitbang 9WS2812_DRIVER = bitbang
7 10
8# Force task driven PWM until ARM can provide automatic configuration 11# Force task driven PWM until ARM can provide automatic configuration
9BACKLIGHT_DRIVER = software 12BACKLIGHT_DRIVER = software \ No newline at end of file
diff --git a/platforms/chibios/common/configs/halconf.h b/platforms/chibios/common/configs/halconf.h
index 6b48e289f..a9f2cf77b 100644
--- a/platforms/chibios/common/configs/halconf.h
+++ b/platforms/chibios/common/configs/halconf.h
@@ -31,7 +31,7 @@
31#define _CHIBIOS_HAL_CONF_ 31#define _CHIBIOS_HAL_CONF_
32#define _CHIBIOS_HAL_CONF_VER_7_0_ 32#define _CHIBIOS_HAL_CONF_VER_7_0_
33 33
34#include "mcuconf.h" 34#include <mcuconf.h>
35 35
36/** 36/**
37 * @brief Enables the PAL subsystem. 37 * @brief Enables the PAL subsystem.
diff --git a/quantum/quantum.h b/quantum/quantum.h
index cb0af306a..59c3dd490 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -53,6 +53,7 @@
53#include "eeconfig.h" 53#include "eeconfig.h"
54#include "bootloader.h" 54#include "bootloader.h"
55#include "timer.h" 55#include "timer.h"
56#include "sync_timer.h"
56#include "config_common.h" 57#include "config_common.h"
57#include "led.h" 58#include "led.h"
58#include "action_util.h" 59#include "action_util.h"
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c
index f239bd582..a3dd51f7b 100644
--- a/quantum/rgb_matrix.c
+++ b/quantum/rgb_matrix.c
@@ -266,9 +266,9 @@ static bool rgb_matrix_none(effect_params_t *params) {
266 266
267static void rgb_task_timers(void) { 267static void rgb_task_timers(void) {
268#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0 268#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0
269 uint32_t deltaTime = timer_elapsed32(rgb_timer_buffer); 269 uint32_t deltaTime = sync_timer_elapsed32(rgb_timer_buffer);
270#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0 270#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0
271 rgb_timer_buffer = timer_read32(); 271 rgb_timer_buffer = sync_timer_read32();
272 272
273 // Update double buffer timers 273 // Update double buffer timers
274#if RGB_DISABLE_TIMEOUT > 0 274#if RGB_DISABLE_TIMEOUT > 0
@@ -296,7 +296,7 @@ static void rgb_task_timers(void) {
296 296
297static void rgb_task_sync(void) { 297static void rgb_task_sync(void) {
298 // next task 298 // next task
299 if (timer_elapsed32(g_rgb_timer) >= RGB_MATRIX_LED_FLUSH_LIMIT) rgb_task_state = STARTING; 299 if (sync_timer_elapsed32(g_rgb_timer) >= RGB_MATRIX_LED_FLUSH_LIMIT) rgb_task_state = STARTING;
300} 300}
301 301
302static void rgb_task_start(void) { 302static void rgb_task_start(void) {
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index 7f9e330d3..65308572d 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -29,7 +29,7 @@
29#endif 29#endif
30#include "wait.h" 30#include "wait.h"
31#include "progmem.h" 31#include "progmem.h"
32#include "timer.h" 32#include "sync_timer.h"
33#include "rgblight.h" 33#include "rgblight.h"
34#include "color.h" 34#include "color.h"
35#include "debug.h" 35#include "debug.h"
@@ -684,18 +684,16 @@ static void rgblight_layers_write(void) {
684 684
685# ifdef RGBLIGHT_LAYER_BLINK 685# ifdef RGBLIGHT_LAYER_BLINK
686rgblight_layer_mask_t _blinked_layer_mask = 0; 686rgblight_layer_mask_t _blinked_layer_mask = 0;
687uint16_t _blink_duration = 0;
688static uint16_t _blink_timer; 687static uint16_t _blink_timer;
689 688
690void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms) { 689void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms) {
691 rgblight_set_layer_state(layer, true); 690 rgblight_set_layer_state(layer, true);
692 _blinked_layer_mask |= 1 << layer; 691 _blinked_layer_mask |= 1 << layer;
693 _blink_timer = timer_read(); 692 _blink_timer = sync_timer_read() + duration_ms;
694 _blink_duration = duration_ms;
695} 693}
696 694
697void rgblight_unblink_layers(void) { 695void rgblight_unblink_layers(void) {
698 if (_blinked_layer_mask != 0 && timer_elapsed(_blink_timer) > _blink_duration) { 696 if (_blinked_layer_mask != 0 && timer_expired(sync_timer_read(), _blink_timer)) {
699 for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) { 697 for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) {
700 if ((_blinked_layer_mask & 1 << layer) != 0) { 698 if ((_blinked_layer_mask & 1 << layer) != 0) {
701 rgblight_set_layer_state(layer, false); 699 rgblight_set_layer_state(layer, false);
@@ -799,7 +797,7 @@ void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom) {
799 animation_status.restart = true; 797 animation_status.restart = true;
800 } 798 }
801# endif /* RGBLIGHT_SPLIT_NO_ANIMATION_SYNC */ 799# endif /* RGBLIGHT_SPLIT_NO_ANIMATION_SYNC */
802# endif /* RGBLIGHT_USE_TIMER */ 800# endif /* RGBLIGHT_USE_TIMER */
803} 801}
804#endif /* RGBLIGHT_SPLIT */ 802#endif /* RGBLIGHT_SPLIT */
805 803
@@ -832,7 +830,7 @@ void rgblight_timer_enable(void) {
832 if (!is_static_effect(rgblight_config.mode)) { 830 if (!is_static_effect(rgblight_config.mode)) {
833 rgblight_status.timer_enabled = true; 831 rgblight_status.timer_enabled = true;
834 } 832 }
835 animation_status.last_timer = timer_read(); 833 animation_status.last_timer = sync_timer_read();
836 RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE; 834 RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE;
837 dprintf("rgblight timer enabled.\n"); 835 dprintf("rgblight timer enabled.\n");
838} 836}
@@ -941,18 +939,19 @@ void rgblight_task(void) {
941# endif 939# endif
942 if (animation_status.restart) { 940 if (animation_status.restart) {
943 animation_status.restart = false; 941 animation_status.restart = false;
944 animation_status.last_timer = timer_read() - interval_time - 1; 942 animation_status.last_timer = sync_timer_read();
945 animation_status.pos16 = 0; // restart signal to local each effect 943 animation_status.pos16 = 0; // restart signal to local each effect
946 } 944 }
947 if (timer_elapsed(animation_status.last_timer) >= interval_time) { 945 uint16_t now = sync_timer_read();
946 if (timer_expired(now, animation_status.last_timer)) {
948# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) 947# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
949 static uint16_t report_last_timer = 0; 948 static uint16_t report_last_timer = 0;
950 static bool tick_flag = false; 949 static bool tick_flag = false;
951 uint16_t oldpos16; 950 uint16_t oldpos16;
952 if (tick_flag) { 951 if (tick_flag) {
953 tick_flag = false; 952 tick_flag = false;
954 if (timer_elapsed(report_last_timer) >= 30000) { 953 if (timer_expired(now, report_last_timer)) {
955 report_last_timer = timer_read(); 954 report_last_timer += 30000;
956 dprintf("rgblight animation tick report to slave\n"); 955 dprintf("rgblight animation tick report to slave\n");
957 RGBLIGHT_SPLIT_ANIMATION_TICK; 956 RGBLIGHT_SPLIT_ANIMATION_TICK;
958 } 957 }
diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c
index 467ff81a9..6856b6055 100644
--- a/quantum/split_common/transport.c
+++ b/quantum/split_common/transport.c
@@ -6,6 +6,7 @@
6#include "quantum.h" 6#include "quantum.h"
7 7
8#define ROWS_PER_HAND (MATRIX_ROWS / 2) 8#define ROWS_PER_HAND (MATRIX_ROWS / 2)
9#define SYNC_TIMER_OFFSET 2
9 10
10#ifdef RGBLIGHT_ENABLE 11#ifdef RGBLIGHT_ENABLE
11# include "rgblight.h" 12# include "rgblight.h"
@@ -27,6 +28,9 @@ static pin_t encoders_pad[] = ENCODERS_PAD_A;
27# include "i2c_slave.h" 28# include "i2c_slave.h"
28 29
29typedef struct _I2C_slave_buffer_t { 30typedef struct _I2C_slave_buffer_t {
31# ifndef DISABLE_SYNC_TIMER
32 uint32_t sync_timer;
33# endif
30 matrix_row_t smatrix[ROWS_PER_HAND]; 34 matrix_row_t smatrix[ROWS_PER_HAND];
31 uint8_t backlight_level; 35 uint8_t backlight_level;
32# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) 36# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
@@ -44,6 +48,7 @@ static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_re
44 48
45# define I2C_BACKLIGHT_START offsetof(I2C_slave_buffer_t, backlight_level) 49# define I2C_BACKLIGHT_START offsetof(I2C_slave_buffer_t, backlight_level)
46# define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync) 50# define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync)
51# define I2C_SYNC_TIME_START offsetof(I2C_slave_buffer_t, sync_timer)
47# define I2C_KEYMAP_START offsetof(I2C_slave_buffer_t, smatrix) 52# define I2C_KEYMAP_START offsetof(I2C_slave_buffer_t, smatrix)
48# define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state) 53# define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state)
49# define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm) 54# define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm)
@@ -91,10 +96,18 @@ bool transport_master(matrix_row_t matrix[]) {
91 } 96 }
92 } 97 }
93# endif 98# endif
99
100# ifndef DISABLE_SYNC_TIMER
101 i2c_buffer->sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET;
102 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_SYNC_TIME_START, (void *)&i2c_buffer->sync_timer, sizeof(i2c_buffer->sync_timer), TIMEOUT);
103# endif
94 return true; 104 return true;
95} 105}
96 106
97void transport_slave(matrix_row_t matrix[]) { 107void transport_slave(matrix_row_t matrix[]) {
108# ifndef DISABLE_SYNC_TIMER
109 sync_timer_update(i2c_buffer->sync_timer);
110# endif
98 // Copy matrix to I2C buffer 111 // Copy matrix to I2C buffer
99 memcpy((void *)i2c_buffer->smatrix, (void *)matrix, sizeof(i2c_buffer->smatrix)); 112 memcpy((void *)i2c_buffer->smatrix, (void *)matrix, sizeof(i2c_buffer->smatrix));
100 113
@@ -133,12 +146,15 @@ typedef struct _Serial_s2m_buffer_t {
133 matrix_row_t smatrix[ROWS_PER_HAND]; 146 matrix_row_t smatrix[ROWS_PER_HAND];
134 147
135# ifdef ENCODER_ENABLE 148# ifdef ENCODER_ENABLE
136 uint8_t encoder_state[NUMBER_OF_ENCODERS]; 149 uint8_t encoder_state[NUMBER_OF_ENCODERS];
137# endif 150# endif
138 151
139} Serial_s2m_buffer_t; 152} Serial_s2m_buffer_t;
140 153
141typedef struct _Serial_m2s_buffer_t { 154typedef struct _Serial_m2s_buffer_t {
155# ifndef DISABLE_SYNC_TIMER
156 uint32_t sync_timer;
157# endif
142# ifdef BACKLIGHT_ENABLE 158# ifdef BACKLIGHT_ENABLE
143 uint8_t backlight_level; 159 uint8_t backlight_level;
144# endif 160# endif
@@ -251,11 +267,19 @@ bool transport_master(matrix_row_t matrix[]) {
251 // Write wpm to slave 267 // Write wpm to slave
252 serial_m2s_buffer.current_wpm = get_current_wpm(); 268 serial_m2s_buffer.current_wpm = get_current_wpm();
253# endif 269# endif
270
271# ifndef DISABLE_SYNC_TIMER
272 serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET;
273# endif
254 return true; 274 return true;
255} 275}
256 276
257void transport_slave(matrix_row_t matrix[]) { 277void transport_slave(matrix_row_t matrix[]) {
258 transport_rgblight_slave(); 278 transport_rgblight_slave();
279# ifndef DISABLE_SYNC_TIMER
280 sync_timer_update(serial_m2s_buffer.sync_timer);
281# endif
282
259 // TODO: if MATRIX_COLS > 8 change to pack() 283 // TODO: if MATRIX_COLS > 8 change to pack()
260 for (int i = 0; i < ROWS_PER_HAND; ++i) { 284 for (int i = 0; i < ROWS_PER_HAND; ++i) {
261 serial_s2m_buffer.smatrix[i] = matrix[i]; 285 serial_s2m_buffer.smatrix[i] = matrix[i];
diff --git a/readme.md b/readme.md
index 6092f209b..6321681a9 100644
--- a/readme.md
+++ b/readme.md
@@ -7,6 +7,12 @@
7[![GitHub contributors](https://img.shields.io/github/contributors/qmk/qmk_firmware.svg)](https://github.com/qmk/qmk_firmware/pulse/monthly) 7[![GitHub contributors](https://img.shields.io/github/contributors/qmk/qmk_firmware.svg)](https://github.com/qmk/qmk_firmware/pulse/monthly)
8[![GitHub forks](https://img.shields.io/github/forks/qmk/qmk_firmware.svg?style=social&label=Fork)](https://github.com/qmk/qmk_firmware/) 8[![GitHub forks](https://img.shields.io/github/forks/qmk/qmk_firmware.svg?style=social&label=Fork)](https://github.com/qmk/qmk_firmware/)
9 9
10# THIS IS THE DEVELOP BRANCH
11
12Warning- This is the `develop` branch of QMK Firmware. You may encounter broken code here. Please see [Breaking Changes](https://docs.qmk.fm/#/breaking_changes) for more information.
13
14# Original readme continues
15
10This is a keyboard firmware based on the [tmk\_keyboard firmware](https://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR and ARM controllers, and more specifically, the [OLKB product line](https://olkb.com), the [ErgoDox EZ](https://ergodox-ez.com) keyboard, and the [Clueboard product line](https://clueboard.co). 16This is a keyboard firmware based on the [tmk\_keyboard firmware](https://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR and ARM controllers, and more specifically, the [OLKB product line](https://olkb.com), the [ErgoDox EZ](https://ergodox-ez.com) keyboard, and the [Clueboard product line](https://clueboard.co).
11 17
12## Documentation 18## Documentation
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk
index e53edccee..ceed2a7b4 100644
--- a/tmk_core/chibios.mk
+++ b/tmk_core/chibios.mk
@@ -71,6 +71,9 @@ else ifneq ("$(wildcard $(TOP_DIR)/platforms/chibios/$(BOARD)/board/board.mk)","
71 BOARD_PATH = $(TOP_DIR)/platforms/chibios/$(BOARD) 71 BOARD_PATH = $(TOP_DIR)/platforms/chibios/$(BOARD)
72 BOARD_MK += $(TOP_DIR)/platforms/chibios/$(BOARD)/board/board.mk 72 BOARD_MK += $(TOP_DIR)/platforms/chibios/$(BOARD)/board/board.mk
73 KEYBOARD_PATHS += $(BOARD_PATH)/configs 73 KEYBOARD_PATHS += $(BOARD_PATH)/configs
74 ifneq ("$(wildcard $(BOARD_PATH)/rules.mk)","")
75 include $(BOARD_PATH)/rules.mk
76 endif
74endif 77endif
75 78
76ifeq ("$(wildcard $(BOARD_MK))","") 79ifeq ("$(wildcard $(BOARD_MK))","")
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index fdf2aa097..05839824c 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -18,6 +18,7 @@ TMK_COMMON_SRC += $(COMMON_DIR)/host.c \
18 $(COMMON_DIR)/report.c \ 18 $(COMMON_DIR)/report.c \
19 $(PLATFORM_COMMON_DIR)/suspend.c \ 19 $(PLATFORM_COMMON_DIR)/suspend.c \
20 $(PLATFORM_COMMON_DIR)/timer.c \ 20 $(PLATFORM_COMMON_DIR)/timer.c \
21 $(COMMON_DIR)/sync_timer.c \
21 $(PLATFORM_COMMON_DIR)/bootloader.c \ 22 $(PLATFORM_COMMON_DIR)/bootloader.c \
22 23
23ifeq ($(PLATFORM),AVR) 24ifeq ($(PLATFORM),AVR)
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c
index 8c7bdc8b5..a1fbc01da 100644
--- a/tmk_core/common/keyboard.c
+++ b/tmk_core/common/keyboard.c
@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
23#include "led.h" 23#include "led.h"
24#include "keycode.h" 24#include "keycode.h"
25#include "timer.h" 25#include "timer.h"
26#include "sync_timer.h"
26#include "print.h" 27#include "print.h"
27#include "debug.h" 28#include "debug.h"
28#include "command.h" 29#include "command.h"
@@ -255,6 +256,7 @@ __attribute__((weak)) void housekeeping_task_user(void) {}
255 */ 256 */
256void keyboard_init(void) { 257void keyboard_init(void) {
257 timer_init(); 258 timer_init();
259 sync_timer_init();
258 matrix_init(); 260 matrix_init();
259#ifdef VIA_ENABLE 261#ifdef VIA_ENABLE
260 via_init(); 262 via_init();
diff --git a/tmk_core/common/sync_timer.c b/tmk_core/common/sync_timer.c
new file mode 100644
index 000000000..de24b463b
--- /dev/null
+++ b/tmk_core/common/sync_timer.c
@@ -0,0 +1,58 @@
1/*
2Copyright (C) 2020 Ryan Caltabiano <https://github.com/XScorpion2>
3
4Permission is hereby granted, free of charge, to any person obtaining a copy of
5this software and associated documentation files (the "Software"), to deal in
6the Software without restriction, including without limitation the rights to
7use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8of the Software, and to permit persons to whom the Software is furnished to do
9so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all
12copies or substantial portions of the Software.
13
14If you happen to meet one of the copyright holders in a bar you are obligated
15to buy them one pint of beer.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24*/
25
26#include "sync_timer.h"
27#include "keyboard.h"
28
29#if defined(SPLIT_KEYBOARD) && !defined(DISABLE_SYNC_TIMER)
30volatile int32_t sync_timer_ms;
31
32void sync_timer_init(void) { sync_timer_ms = 0; }
33
34void sync_timer_update(uint32_t time) {
35 if (is_keyboard_master()) return;
36 sync_timer_ms = time - timer_read32();
37}
38
39uint16_t sync_timer_read(void) {
40 if (is_keyboard_master()) return timer_read();
41 return sync_timer_read32();
42}
43
44uint32_t sync_timer_read32(void) {
45 if (is_keyboard_master()) return timer_read32();
46 return sync_timer_ms + timer_read32();
47}
48
49uint16_t sync_timer_elapsed(uint16_t last) {
50 if (is_keyboard_master()) return timer_elapsed(last);
51 return TIMER_DIFF_16(sync_timer_read(), last);
52}
53
54uint32_t sync_timer_elapsed32(uint32_t last) {
55 if (is_keyboard_master()) return timer_elapsed32(last);
56 return TIMER_DIFF_32(sync_timer_read32(), last);
57}
58#endif
diff --git a/tmk_core/common/sync_timer.h b/tmk_core/common/sync_timer.h
new file mode 100644
index 000000000..9ddef45bb
--- /dev/null
+++ b/tmk_core/common/sync_timer.h
@@ -0,0 +1,54 @@
1/*
2Copyright (C) 2020 Ryan Caltabiano <https://github.com/XScorpion2>
3
4Permission is hereby granted, free of charge, to any person obtaining a copy of
5this software and associated documentation files (the "Software"), to deal in
6the Software without restriction, including without limitation the rights to
7use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8of the Software, and to permit persons to whom the Software is furnished to do
9so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all
12copies or substantial portions of the Software.
13
14If you happen to meet one of the copyright holders in a bar you are obligated
15to buy them one pint of beer.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24*/
25
26#pragma once
27
28#include <stdint.h>
29#include "timer.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35#if defined(SPLIT_KEYBOARD) && !defined(DISABLE_SYNC_TIMER)
36void sync_timer_init(void);
37void sync_timer_update(uint32_t time);
38uint16_t sync_timer_read(void);
39uint32_t sync_timer_read32(void);
40uint16_t sync_timer_elapsed(uint16_t last);
41uint32_t sync_timer_elapsed32(uint32_t last);
42#else
43# define sync_timer_init()
44# define sync_timer_clear()
45# define sync_timer_update(t)
46# define sync_timer_read() timer_read()
47# define sync_timer_read32() timer_read32()
48# define sync_timer_elapsed(t) timer_elapsed(t)
49# define sync_timer_elapsed32(t) timer_elapsed32(t)
50#endif
51
52#ifdef __cplusplus
53}
54#endif