From 1111ff604d1b006ffd29a0c52d7f717b7879cd00 Mon Sep 17 00:00:00 2001 From: xerootg Date: Mon, 31 Jan 2022 12:40:13 -0700 Subject: [PATCH] [Keyboard] Add the proton c as a controller for the redox (#16106) Co-authored-by: Sergey Vlasov Co-authored-by: xerootg --- keyboards/redox/readme.md | 33 +++++++++--- keyboards/redox/rev1/proton_c/config.h | 66 ++++++++++++++++++++++++ keyboards/redox/rev1/proton_c/halconf.h | 8 +++ keyboards/redox/rev1/proton_c/mcuconf.h | 9 ++++ keyboards/redox/rev1/proton_c/proton_c.c | 4 ++ keyboards/redox/rev1/proton_c/proton_c.h | 6 +++ keyboards/redox/rev1/proton_c/rules.mk | 7 +++ keyboards/redox/rev1/rev1.h | 7 ++- 8 files changed, 131 insertions(+), 9 deletions(-) create mode 100644 keyboards/redox/rev1/proton_c/config.h create mode 100644 keyboards/redox/rev1/proton_c/halconf.h create mode 100644 keyboards/redox/rev1/proton_c/mcuconf.h create mode 100644 keyboards/redox/rev1/proton_c/proton_c.c create mode 100644 keyboards/redox/rev1/proton_c/proton_c.h create mode 100644 keyboards/redox/rev1/proton_c/rules.mk diff --git a/keyboards/redox/readme.md b/keyboards/redox/readme.md index d237caf013..27333b518c 100644 --- a/keyboards/redox/readme.md +++ b/keyboards/redox/readme.md @@ -11,19 +11,38 @@ **Redox**: the **R**educed **E**rgo**dox** project. More information and building instruction [here](https://github.com/mattdibi/redox-keyboard). - Keyboard Maintainer: [Mattia Dal Ben](https://github.com/mattdibi) -- Hardware Supported: Redox PCB rev1.0 w/ Pro Micro +- Hardware Supported: Redox PCB rev1.0 w/ Pro Micro or Proton C - Hardware Availability: [Falbatech](https://falba.tech/product-category/keyboard-parts/redox-parts/) -Make example for this keyboard (after setting up your build environment): +Make example for this keyboard (after setting up [qmk](https://docs.qmk.fm/#/getting_started_build_tools)): +To build the Pro Micro firmware, first set your config: ```sh -make redox/rev1:default +qmk config user.keyboard=redox/rev1 +``` +or if your using the Proton C: +```sh +qmk config user.keyboard=redox/rev1/proton_c ``` -Example of flashing this keyboard: - +Don't forget to set a layout. There's many to choose from in the keymaps folder. ```sh -make redox/rev1:default:avrdude +qmk config user.keymap=default ``` -See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). +Now you can build your firmware! +```sh +qmk compile +``` + +Flashing is also straightforward. Run: +```sh +qmk flash +``` +Enter the bootloader when prompted by doing one of the following: +* **Physical reset button**: Briefly press the button on the back of the PCB +* **Keycode in layout**: Press the key mapped to `RESET` if you have a layout that has one. + +The WS2812 driver is *untested* on the Proton C, but if you choose to use this feature, you will need to source 5v from the Proton's VUSB pin and not use the PCB's dedicated pin which will be 3v3 *and* follow the [documentation](https://docs.qmk.fm/#/ws2812_driver) to enable the correct driver settings. + +Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/redox/rev1/proton_c/config.h b/keyboards/redox/rev1/proton_c/config.h new file mode 100644 index 0000000000..4ec4a975a4 --- /dev/null +++ b/keyboards/redox/rev1/proton_c/config.h @@ -0,0 +1,66 @@ +// Copyright 2022 xerootg +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#undef DEVICE_VER +#define DEVICE_VER 0x0101 // added 1 for the rev1 + proton c + +// wiring of each half +#undef MATRIX_ROW_PINS +#define MATRIX_ROW_PINS { B5, B3, B2, B1, B0 } +#undef MATRIX_COL_PINS +#define MATRIX_COL_PINS { A1, A0, B8, B13, B14, B15, B9 } + +// //we are using hardware serial, so lets undef the softserial used otherwise + +/* serial.c configuration for split keyboard */ +#define SERIAL_USART_FULL_DUPLEX // Enable full duplex operation mode. +/* + Because the rev1 config defines SOFT_SERIAL_PIN, we need to undef it, redefine it, and also assign + it to avoid a redefine error. + */ +#undef SOFT_SERIAL_PIN +#define SOFT_SERIAL_PIN B6 // USART TX pin + +#define SERIAL_USART_RX_PIN B7 // USART RX pin +#define SERIAL_USART_TX_PIN SOFT_SERIAL_PIN // USART TX pin + +#define SERIAL_USART_PIN_SWAP // Swap TX and RX pins if keyboard is master halve. + // Check if this feature is necessary with your keyboard design and available on the mcu. +#define SELECT_SOFT_SERIAL_SPEED 1 // or 0, 2, 3, 4, 5 + // 0: 460800 baud + // 1: 230400 baud (default) + // 2: 115200 baud + // 3: 57600 baud + // 4: 38400 baud + // 5: 19200 baud +#define SERIAL_USART_DRIVER SD1 // USART driver of TX and RX pin. default: SD1 +#define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 +#define SERIAL_USART_RX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 +#define SERIAL_USART_TIMEOUT 20 // USART driver timeout. default 20 + +/* ws2812 RGB LED */ +#undef RGB_DI_PIN +#define RGB_DI_PIN A9 + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +// #define NO_DEBUG + +/* disable print */ +// #define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION diff --git a/keyboards/redox/rev1/proton_c/halconf.h b/keyboards/redox/rev1/proton_c/halconf.h new file mode 100644 index 0000000000..0a2498a62f --- /dev/null +++ b/keyboards/redox/rev1/proton_c/halconf.h @@ -0,0 +1,8 @@ +// Copyright 2022 xerootg +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define HAL_USE_SERIAL TRUE + +#include_next \ No newline at end of file diff --git a/keyboards/redox/rev1/proton_c/mcuconf.h b/keyboards/redox/rev1/proton_c/mcuconf.h new file mode 100644 index 0000000000..ba87dec13d --- /dev/null +++ b/keyboards/redox/rev1/proton_c/mcuconf.h @@ -0,0 +1,9 @@ +// Copyright 2022 xerootg +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include_next + +#undef STM32_SERIAL_USE_USART1 +#define STM32_SERIAL_USE_USART1 TRUE diff --git a/keyboards/redox/rev1/proton_c/proton_c.c b/keyboards/redox/rev1/proton_c/proton_c.c new file mode 100644 index 0000000000..796e2c8c3d --- /dev/null +++ b/keyboards/redox/rev1/proton_c/proton_c.c @@ -0,0 +1,4 @@ +// Copyright 2022 xerootg +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "proton_c.h" diff --git a/keyboards/redox/rev1/proton_c/proton_c.h b/keyboards/redox/rev1/proton_c/proton_c.h new file mode 100644 index 0000000000..d8813d9c4d --- /dev/null +++ b/keyboards/redox/rev1/proton_c/proton_c.h @@ -0,0 +1,6 @@ +// Copyright 2022 xerootg +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "rev1.h" diff --git a/keyboards/redox/rev1/proton_c/rules.mk b/keyboards/redox/rev1/proton_c/rules.mk new file mode 100644 index 0000000000..829c8365ef --- /dev/null +++ b/keyboards/redox/rev1/proton_c/rules.mk @@ -0,0 +1,7 @@ +# Proton C +MCU = STM32F303 +BOARD = QMK_PROTON_C +BOOTLOADER = stm32-dfu + +# specific to using the serial serial driver +SERIAL_DRIVER = usart diff --git a/keyboards/redox/rev1/rev1.h b/keyboards/redox/rev1/rev1.h index 1bc1531eed..5a24122048 100644 --- a/keyboards/redox/rev1/rev1.h +++ b/keyboards/redox/rev1/rev1.h @@ -1,10 +1,13 @@ #pragma once -#include "../redox.h" +#include "redox.h" + +#if defined(KEYBOARD_redox_rev1_proton_c) +# include "proton_c.h" +#endif #include "quantum.h" - #ifdef USE_I2C #include #ifdef __AVR__