summaryrefslogtreecommitdiff
path: root/keyboards/handwired/splittest/bluepill
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/handwired/splittest/bluepill')
-rw-r--r--keyboards/handwired/splittest/bluepill/config.h16
-rw-r--r--keyboards/handwired/splittest/bluepill/halconf.h11
-rw-r--r--keyboards/handwired/splittest/bluepill/mcuconf.h14
-rw-r--r--keyboards/handwired/splittest/bluepill/post_config.h43
-rw-r--r--keyboards/handwired/splittest/bluepill/readme.md65
-rw-r--r--keyboards/handwired/splittest/bluepill/rules.mk8
6 files changed, 157 insertions, 0 deletions
diff --git a/keyboards/handwired/splittest/bluepill/config.h b/keyboards/handwired/splittest/bluepill/config.h
new file mode 100644
index 0000000000..b1315ee3c7
--- /dev/null
+++ b/keyboards/handwired/splittest/bluepill/config.h
@@ -0,0 +1,16 @@
+// Copyright 2022 dvermd (@dvermd)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "config_common.h"
+
+// wiring of each half
+#define MATRIX_ROW_PINS { B10 }
+#define MATRIX_COL_PINS { B1 }
+
+#define SPLIT_HAND_PIN A7
+
+#if !(defined(USE_SDI1_ON_STANDARD_ROLE_PINS) || defined(USE_SDI1_ON_ALTERNATE_ROLE_PINS) || defined(USE_SDI2))
+ #define USE_SDI1_ON_STANDARD_ROLE_PINS
+#endif
diff --git a/keyboards/handwired/splittest/bluepill/halconf.h b/keyboards/handwired/splittest/bluepill/halconf.h
new file mode 100644
index 0000000000..e11e5b637a
--- /dev/null
+++ b/keyboards/handwired/splittest/bluepill/halconf.h
@@ -0,0 +1,11 @@
+// Copyright 2022 dvermd (@dvermd)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+/* Needed for serial bitbang, half-duplex and full-duplex */
+#define HAL_USE_PAL TRUE
+#define PAL_USE_WAIT TRUE
+#define PAL_USE_CALLBACKS TRUE
+
+#include_next <halconf.h>
diff --git a/keyboards/handwired/splittest/bluepill/mcuconf.h b/keyboards/handwired/splittest/bluepill/mcuconf.h
new file mode 100644
index 0000000000..af2f14a9d3
--- /dev/null
+++ b/keyboards/handwired/splittest/bluepill/mcuconf.h
@@ -0,0 +1,14 @@
+// Copyright 2022 dvermd (@dvermd)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include_next <mcuconf.h>
+
+// These are needed if the communication is on the SD1 USART, either with standard or alternate pins
+#undef STM32_SERIAL_USE_USART1
+#define STM32_SERIAL_USE_USART1 TRUE
+
+// These are needed if the communication is on the SD2 USART, either with standard or alternate pins
+#undef STM32_SERIAL_USE_USART2
+#define STM32_SERIAL_USE_USART2 TRUE
diff --git a/keyboards/handwired/splittest/bluepill/post_config.h b/keyboards/handwired/splittest/bluepill/post_config.h
new file mode 100644
index 0000000000..be9dd398ff
--- /dev/null
+++ b/keyboards/handwired/splittest/bluepill/post_config.h
@@ -0,0 +1,43 @@
+// Copyright 2022 dvermd (@dvermd)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#if defined(SPLIT_SERIAL_HALFDUPLEX)
+
+ #if defined(USE_SDI1_ON_STANDARD_ROLE_PINS)
+ #define SOFT_SERIAL_PIN A9
+ #elif defined(USE_SDI1_ON_ALTERNATE_ROLE_PINS)
+ #define SOFT_SERIAL_PIN B6
+ #define USART1_REMAP // Remap USART TX and RX pins on STM32F103 MCUs
+ #elif defined(USE_SDI2)
+ #define SOFT_SERIAL_PIN A2
+ #define SERIAL_USART_DRIVER SD2 // USART driver of TX and RX pin. default: SD1
+ #else
+ #error "splittest serial_halfduplex keymap is missing a configuration (USE_SDI1_ON_STANDARD_ROLE_PINS, USE_SDI1_ON_ALTERNATE_ROLE_PINS, USE_SDI2)"
+ #endif
+
+#elif defined(SPLIT_SERIAL_FULLDUPLEX)
+
+ #define SERIAL_USART_FULL_DUPLEX // Enable full duplex operation mode.
+
+ #if defined(USE_SDI1_ON_STANDARD_ROLE_PINS)
+ #define SOFT_SERIAL_PIN A9
+ #define SERIAL_USART_RX_PIN A10 // USART RX pin
+ #elif defined(USE_SDI1_ON_ALTERNATE_ROLE_PINS)
+ #define SOFT_SERIAL_PIN B6
+ #define SERIAL_USART_RX_PIN B7 // USART RX pin
+ #define USART1_REMAP // Remap USART TX and RX pins on STM32F103 MCUs
+ #elif defined(USE_SDI2)
+ #define SOFT_SERIAL_PIN A2
+ #define SERIAL_USART_RX_PIN A3 // USART RX pin
+ #define SERIAL_USART_DRIVER SD2 // USART driver of TX and RX pin. default: SD1
+ #else
+ #error "splittest serial_fullduplex keymap is missing a configuration (USE_SDI1_ON_STANDARD_ROLE_PINS, USE_SDI1_ON_ALTERNATE_ROLE_PINS, USE_SDI2)"
+ #endif
+
+#else // defined(SPLIT_BITBANG)
+
+ #define SOFT_SERIAL_PIN B8
+
+#endif
diff --git a/keyboards/handwired/splittest/bluepill/readme.md b/keyboards/handwired/splittest/bluepill/readme.md
new file mode 100644
index 0000000000..381aa6ba3a
--- /dev/null
+++ b/keyboards/handwired/splittest/bluepill/readme.md
@@ -0,0 +1,65 @@
+# bluepill splittest
+
+This is the splittest example for the bluepill MCU.
+To trigger keypress, short together pins _B10_ and _B1_.
+
+## Keyboard Configuration
+
+The type of communication (bitbang, serial (half/full duplex)) is set by the keymap `config.h` file with variables with `SPLIT_` prefix.
+So this example uses:
+
+- `config.h` to set which SDI to use for serial. Either define `USE_SDI1_ON_STANDARD_ROLE_PINS`, `USE_SDI1_ON_ALTERNATE_ROLE_PINS` or `USE_SDI2` before the `#ifdef` that configures the default case when none of these variable is defined.
+- `post_config.h` for defining the communication pins between the halves once the keymap is configured.
+
+On your keyboard, you most likely will only use `config.h` because you'd have already chosen your communication scheme: serial type, SDI, pins.
+
+## Wiring
+
+### Switches
+
+- Add switches to both Bluepills across B10 and B1 pins
+
+### Handedness
+
+Have a look at the [handedness documentation](https://docs.qmk.fm/#/feature_split_keyboard?id=setting-handedness)
+
+- Add pull-up resistor to left side between VCC and A7
+- Add pull-down resistors to right side between GND and A7
+
+### Send power to the other half
+
+- Connect the following pins on both sides together: GND, VCC
+
+### Halves data connection
+
+Choose one of the connection type
+
+#### serial - bitbang
+
+- Connect the B8 pins on both sides together
+
+#### serial - usart half duplex
+
+Check the [documentation](https://docs.qmk.fm/#/serial_driver?id=usart-half-duplex) to determine the pull-up resistor.
+
+- To use the default usart (USART1) with the standard role pins,
+ - Connect the A9 pins on both sides together and to add a pull-up resistor on one of these pins
+ - Define USE_SDI1_ON_STANDARD_ROLE_PINS in config.h
+- To use the default usart (USART1) with the alternate role pins,
+ - Connect the B6 pins on both sides together and to add a pull-up resistor on one of these pins
+ - Define USE_SDI1_ON_ALTERNATE_ROLE_PINS in config.h
+- To use the usart2 (USART2) pins,
+ - Connect the A2 pins on both sides together and to add a pull-up resistor on one of these pins
+ - Define USE_SDI2 in config.h
+
+#### serial - usart full duplex
+
+- To use the default usart (USART1) with the standard role pins,
+ - Connect the mpins on A9, A10 one to the other on each side
+ - Define USE_SDI1_ON_STANDARD_ROLE_PINS in config.h
+- To use the default usart (USART1) with the alternate role pins,
+ - Connect the pins B6, B7 one to the other on each side
+ - Define USE_SDI1_ON_ALTERNATE_ROLE_PINS in config.h
+- To use the usart2 (USART2) pins,
+ - Connect the pins A2, A3 one to the other on each side
+ - Define USE_SDI2 in config.h
diff --git a/keyboards/handwired/splittest/bluepill/rules.mk b/keyboards/handwired/splittest/bluepill/rules.mk
new file mode 100644
index 0000000000..019b1130d9
--- /dev/null
+++ b/keyboards/handwired/splittest/bluepill/rules.mk
@@ -0,0 +1,8 @@
+# MCU name
+MCU = STM32F103
+
+# Bootloader selection
+BOOTLOADER = stm32duino
+
+# Enter lower-power sleep mode when on the ChibiOS idle thread
+OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE