add bluepill mcu to splittest (#16959)
* add bluepill mcu to splittest * fix typo * refactoring * mcu config goes to mcuconf.h of keyboard * keymap specific config goes to keymap config.h * keyboard specific depending of keymap goes to post_config.h * Apply suggested change Co-authored-by: Ryan <fauxpark@gmail.com> * Apply suggested change Co-authored-by: Ryan <fauxpark@gmail.com> * Apply suggested change Co-authored-by: Ryan <fauxpark@gmail.com> * Apply suggested change Co-authored-by: Ryan <fauxpark@gmail.com> * Apply suggested change Co-authored-by: Ryan <fauxpark@gmail.com> * splittest/bluepill: improve documentation Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
		
							parent
							
								
									b6757d2380
								
							
						
					
					
						commit
						0206bd9df3
					
				
					 21 changed files with 248 additions and 1 deletions
				
			
		
							
								
								
									
										23
									
								
								keyboards/handwired/splittest/bluepill/chconf.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								keyboards/handwired/splittest/bluepill/chconf.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
/* Copyright 2020 QMK
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#define CH_CFG_ST_TIMEDELTA 0
 | 
			
		||||
 | 
			
		||||
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
 | 
			
		||||
 | 
			
		||||
#include_next <chconf.h>
 | 
			
		||||
							
								
								
									
										16
									
								
								keyboards/handwired/splittest/bluepill/config.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								keyboards/handwired/splittest/bluepill/config.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -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
 | 
			
		||||
							
								
								
									
										6
									
								
								keyboards/handwired/splittest/bluepill/halconf.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								keyboards/handwired/splittest/bluepill/halconf.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
/* 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>
 | 
			
		||||
							
								
								
									
										11
									
								
								keyboards/handwired/splittest/bluepill/mcuconf.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								keyboards/handwired/splittest/bluepill/mcuconf.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
#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
 | 
			
		||||
							
								
								
									
										38
									
								
								keyboards/handwired/splittest/bluepill/post_config.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								keyboards/handwired/splittest/bluepill/post_config.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
 | 
			
		||||
#if defined(SPLIT_BITBANG)
 | 
			
		||||
 | 
			
		||||
    #define SOFT_SERIAL_PIN B8
 | 
			
		||||
 | 
			
		||||
#elif 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
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										65
									
								
								keyboards/handwired/splittest/bluepill/readme.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								keyboards/handwired/splittest/bluepill/readme.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -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
 | 
			
		||||
							
								
								
									
										10
									
								
								keyboards/handwired/splittest/bluepill/rules.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								keyboards/handwired/splittest/bluepill/rules.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
# MCU name
 | 
			
		||||
MCU = STM32F103
 | 
			
		||||
 | 
			
		||||
# Bootloader selection
 | 
			
		||||
BOOTLOADER = stm32duino
 | 
			
		||||
 | 
			
		||||
CONSOLE_ENABLE = yes
 | 
			
		||||
 | 
			
		||||
# Enter lower-power sleep mode when on the ChibiOS idle thread
 | 
			
		||||
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
 | 
			
		||||
							
								
								
									
										18
									
								
								keyboards/handwired/splittest/keymaps/bitbang/config.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								keyboards/handwired/splittest/keymaps/bitbang/config.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
// Copyright 2022 dvermd (@dvermd)
 | 
			
		||||
// SPDX-License-Identifier: GPL-2.0-or-later
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "config_common.h"
 | 
			
		||||
 | 
			
		||||
#define SPLIT_BITBANG
 | 
			
		||||
 | 
			
		||||
#define FORCED_SYNC_THROTTLE_MS 100
 | 
			
		||||
 | 
			
		||||
#define SELECT_SOFT_SERIAL_SPEED 3 // or 0, 1, 2, 4, 5
 | 
			
		||||
                                   //  0: about 189kbps (Experimental only)
 | 
			
		||||
                                   //  1: about 137kbps (default)
 | 
			
		||||
                                   //  2: about 75kbps
 | 
			
		||||
                                   //  3: about 39kbps
 | 
			
		||||
                                   //  4: about 26kbps
 | 
			
		||||
                                   //  5: about 20kbps
 | 
			
		||||
							
								
								
									
										11
									
								
								keyboards/handwired/splittest/keymaps/bitbang/keymap.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								keyboards/handwired/splittest/keymaps/bitbang/keymap.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
#include QMK_KEYBOARD_H
 | 
			
		||||
 | 
			
		||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {[0] = LAYOUT(KC_L, KC_R)};
 | 
			
		||||
 | 
			
		||||
void keyboard_post_init_user(void) {
 | 
			
		||||
    // Customise these values to desired behaviour
 | 
			
		||||
    debug_enable   = true;
 | 
			
		||||
    debug_matrix   = true;
 | 
			
		||||
    debug_keyboard = true;
 | 
			
		||||
    // debug_mouse=true;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1
									
								
								keyboards/handwired/splittest/keymaps/bitbang/rules.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								keyboards/handwired/splittest/keymaps/bitbang/rules.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
SERIAL_DRIVER = bitbang
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
// Copyright 2022 dvermd (@dvermd)
 | 
			
		||||
// SPDX-License-Identifier: GPL-2.0-or-later
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "config_common.h"
 | 
			
		||||
 | 
			
		||||
#define SPLIT_SERIAL_FULLDUPLEX
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
#define HAL_USE_SERIAL TRUE
 | 
			
		||||
#include_next <halconf.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
#include QMK_KEYBOARD_H
 | 
			
		||||
 | 
			
		||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {[0] = LAYOUT(KC_L, KC_R)};
 | 
			
		||||
 | 
			
		||||
void keyboard_post_init_user(void) {
 | 
			
		||||
    // Customise these values to desired behaviour
 | 
			
		||||
    debug_enable   = true;
 | 
			
		||||
    debug_matrix   = true;
 | 
			
		||||
    debug_keyboard = true;
 | 
			
		||||
    // debug_mouse=true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
SERIAL_DRIVER = usart
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
// Copyright 2022 dvermd (@dvermd)
 | 
			
		||||
// SPDX-License-Identifier: GPL-2.0-or-later
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "config_common.h"
 | 
			
		||||
 | 
			
		||||
#define SPLIT_SERIAL_HALFDUPLEX
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
#define HAL_USE_SERIAL TRUE
 | 
			
		||||
#include_next <halconf.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
#include QMK_KEYBOARD_H
 | 
			
		||||
 | 
			
		||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {[0] = LAYOUT(KC_L, KC_R)};
 | 
			
		||||
 | 
			
		||||
void keyboard_post_init_user(void) {
 | 
			
		||||
    // Customise these values to desired behaviour
 | 
			
		||||
    debug_enable   = true;
 | 
			
		||||
    debug_matrix   = true;
 | 
			
		||||
    debug_keyboard = true;
 | 
			
		||||
    // debug_mouse=true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
SERIAL_DRIVER = usart
 | 
			
		||||
| 
						 | 
				
			
			@ -3,3 +3,5 @@ MCU = atmega32u4
 | 
			
		|||
 | 
			
		||||
# Bootloader selection
 | 
			
		||||
BOOTLOADER = caterina
 | 
			
		||||
 | 
			
		||||
RGBLIGHT_ENABLE = yes
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ COMMAND_ENABLE = yes        # Commands for debug and configuration
 | 
			
		|||
NKRO_ENABLE = no            # Enable N-Key Rollover
 | 
			
		||||
BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
 | 
			
		||||
AUDIO_ENABLE = no           # Audio output
 | 
			
		||||
RGBLIGHT_ENABLE = yes        # Enable WS2812 RGB underlight.
 | 
			
		||||
RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
 | 
			
		||||
 | 
			
		||||
SPLIT_KEYBOARD = yes
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,3 +3,5 @@ MCU = atmega32u4
 | 
			
		|||
 | 
			
		||||
# Bootloader selection
 | 
			
		||||
BOOTLOADER = halfkay
 | 
			
		||||
 | 
			
		||||
RGBLIGHT_ENABLE = yes
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue