From 11551406317578085bcac124d6857c0aca4133e0 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 18 Sep 2022 20:30:27 +0100 Subject: [PATCH] Add Elite-C to converters (#18309) --- data/schemas/keyboard.jsonschema | 2 +- docs/feature_converters.md | 47 +++++++++++++++- keyboards/cozykeys/speedo/v3/rules.mk | 2 + .../elite_c_to_elite_pi/_pin_defs.h | 39 ++++++++++++++ .../elite_c_to_elite_pi/converter.mk | 9 ++++ .../elite_c_to_stemcell/_pin_defs.h | 54 +++++++++++++++++++ .../elite_c_to_stemcell/converter.mk | 18 +++++++ 7 files changed, 168 insertions(+), 3 deletions(-) create mode 100644 platforms/chibios/converters/elite_c_to_elite_pi/_pin_defs.h create mode 100644 platforms/chibios/converters/elite_c_to_elite_pi/converter.mk create mode 100644 platforms/chibios/converters/elite_c_to_stemcell/_pin_defs.h create mode 100644 platforms/chibios/converters/elite_c_to_stemcell/converter.mk diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index 7e0400d7f7..1b62f30eba 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -38,7 +38,7 @@ }, "pin_compatible": { "type": "string", - "enum": ["promicro"] + "enum": ["promicro", "elite_c"] }, "processor": { "type": "string", diff --git a/docs/feature_converters.md b/docs/feature_converters.md index 1323bdb372..3dabae915d 100644 --- a/docs/feature_converters.md +++ b/docs/feature_converters.md @@ -18,6 +18,8 @@ Currently the following converters are available: | `promicro` | `stemcell` | | `promicro` | `bonsai_c4` | | `promicro` | `elite_pi` | +| `elite_c` | `stemcell` | +| `elite_c` | `elite_pi` | See below for more in depth information on each converter. @@ -48,6 +50,23 @@ Once a converter is enabled, it exposes the `CONVERT_TO_` flag #endif ``` +### Pin Compatibility + +To ensure compatibility, provide validation, and power future workflows, a keyboard should declare its `pin compatibility`. For legacy reasons, this is currently assumed to be `promicro`. + +Currently the following pin compatibility interfaces are defined: + +| Pinout | Notes | +|------------|-----------------------------------| +| `promicro` | Includes RX/TX LEDs | +| `elite_c` | Includes bottom row pins, no LEDs | + +To declare the base for conversions, add this line to your keyboard's `rules.mk`: + +```makefile +PIN_COMPATIBLE = elite_c +``` + ## Pro Micro If a board currently supported in QMK uses a [Pro Micro](https://www.sparkfun.com/products/12640) (or compatible board), the supported alternative controllers are: @@ -107,7 +126,7 @@ The following defaults are based on what has been implemented for [RP2040](platf ### SparkFun Pro Micro - RP2040, Blok, Bit-C PRO, and Elite-Pi :id=promicro_rp2040 -Currently identical to [Adafruit KB2040](#kb2040). +Currently identical to [Adafruit KB2040](#kb2040). ### STeMCell :id=stemcell @@ -138,4 +157,28 @@ The Bonsai C4 only has one on-board LED (B2), and by default, both the Pro Micro #define B0 PAL_LINE(GPIOA, 9) ``` -No peripherals are enabled by default at this time, but example code to enable SPI, I2C, PWM, and Serial communications can be found [here](/keyboards/custommk/bonsai_c4_template) +No peripherals are enabled by default at this time, but example code to enable SPI, I2C, PWM, and Serial communications can be found [here](/keyboards/custommk/bonsai_c4_template). + +## Elite-C + +If a board currently supported in QMK uses an [Elite-C](https://keeb.io/products/elite-c-low-profile-version-usb-c-pro-micro-replacement-atmega32u4), the supported alternative controllers are: + +| Device | Target | +|----------------------------------------------------------------------------------|-------------------| +| [STeMCell](https://github.com/megamind4089/STeMCell) | `stemcell` | +| [Elite-Pi](https://keeb.io/products/elite-pi-usb-c-pro-micro-replacement-rp2040) | `elite_pi` | + +Converter summary: + +| Target | Argument | `rules.mk` | Condition | +|-------------------|---------------------------------|------------------------------|-------------------------------------| +| `stemcell` | `-e CONVERT_TO=stemcell` | `CONVERT_TO=stemcell` | `#ifdef CONVERT_TO_STEMCELL` | +| `elite_pi` | `-e CONVERT_TO=elite_pi` | `CONVERT_TO=elite_pi` | `#ifdef CONVERT_TO_ELITE_PI` | + +### STeMCell :id=stemcell_elite + +Currently identical to [STeMCell](#stemcell) with support for the additional bottom row of pins. + +### Elite-Pi :id=elite_pi + +Currently identical to [Adafruit KB2040](#kb2040), with support for the additional bottom row of pins. diff --git a/keyboards/cozykeys/speedo/v3/rules.mk b/keyboards/cozykeys/speedo/v3/rules.mk index 561e8f4ca1..8b77971b7e 100644 --- a/keyboards/cozykeys/speedo/v3/rules.mk +++ b/keyboards/cozykeys/speedo/v3/rules.mk @@ -4,6 +4,8 @@ MCU = atmega32u4 # Bootloader selection BOOTLOADER = atmel-dfu +PIN_COMPATIBLE = elite_c + # Build Options # change yes to no to disable # diff --git a/platforms/chibios/converters/elite_c_to_elite_pi/_pin_defs.h b/platforms/chibios/converters/elite_c_to_elite_pi/_pin_defs.h new file mode 100644 index 0000000000..98dd37e279 --- /dev/null +++ b/platforms/chibios/converters/elite_c_to_elite_pi/_pin_defs.h @@ -0,0 +1,39 @@ +// Copyright 2022 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +// Left side (front) +#define D3 0U +#define D2 1U +// GND +// GND +#define D1 2U +#define D0 3U +#define D4 4U +#define C6 5U +#define D7 6U +#define E6 7U +#define B4 8U +#define B5 9U + +// Right side (front) +// RAW +// GND +// RESET +// VCC +#define F4 29U +#define F5 28U +#define F6 27U +#define F7 26U +#define B1 22U +#define B3 20U +#define B2 23U +#define B6 21U + +// Bottom row +#define B7 12U +#define D5 13U +#define C7 14U +#define F1 15U +#define F0 16U diff --git a/platforms/chibios/converters/elite_c_to_elite_pi/converter.mk b/platforms/chibios/converters/elite_c_to_elite_pi/converter.mk new file mode 100644 index 0000000000..590a004189 --- /dev/null +++ b/platforms/chibios/converters/elite_c_to_elite_pi/converter.mk @@ -0,0 +1,9 @@ +# Elite-Pi MCU settings for converting AVR projects +MCU := RP2040 +BOARD := QMK_PM2040 +BOOTLOADER := rp2040 + +# These are defaults based on what has been implemented for RP2040 boards +SERIAL_DRIVER ?= vendor +WS2812_DRIVER ?= vendor +BACKLIGHT_DRIVER ?= software diff --git a/platforms/chibios/converters/elite_c_to_stemcell/_pin_defs.h b/platforms/chibios/converters/elite_c_to_stemcell/_pin_defs.h new file mode 100644 index 0000000000..4458abfa1c --- /dev/null +++ b/platforms/chibios/converters/elite_c_to_stemcell/_pin_defs.h @@ -0,0 +1,54 @@ +// Copyright 2022 Mega Mind (@megamind4089) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +// Pindefs for v2.0.0 +// https://megamind4089.github.io/STeMCell/pinout/ + +// Left side (front) +#ifdef STEMCELL_UART_SWAP +# define D3 PAL_LINE(GPIOA, 3) +# define D2 PAL_LINE(GPIOA, 2) +#else +# define D3 PAL_LINE(GPIOA, 2) +# define D2 PAL_LINE(GPIOA, 3) +#endif +// GND +// GND +#ifdef STEMCELL_I2C_SWAP +# define D1 PAL_LINE(GPIOB, 6) +# define D0 PAL_LINE(GPIOB, 7) +#else +# define D1 PAL_LINE(GPIOB, 7) +# define D0 PAL_LINE(GPIOB, 6) +#endif + +#define D4 PAL_LINE(GPIOA, 15) +#define C6 PAL_LINE(GPIOB, 3) +#define D7 PAL_LINE(GPIOB, 4) +#define E6 PAL_LINE(GPIOB, 5) +#define B4 PAL_LINE(GPIOB, 8) +#define B5 PAL_LINE(GPIOB, 9) + +// Right side (front) +// RAW +// GND +// RESET +// VCC +#define F4 PAL_LINE(GPIOB, 10) +#define F5 PAL_LINE(GPIOB, 2) +#define F6 PAL_LINE(GPIOB, 1) +#define F7 PAL_LINE(GPIOB, 0) + +#define B1 PAL_LINE(GPIOA, 5) +#define B3 PAL_LINE(GPIOA, 6) +#define B2 PAL_LINE(GPIOA, 7) +#define B6 PAL_LINE(GPIOA, 4) + +// Bottom row +#define B7 PAL_LINE(GPIOC, 13) +#define D5 PAL_LINE(GPIOC, 14) +#define C7 PAL_LINE(GPIOC, 15) +#define F1 PAL_LINE(GPIOA, 0) +#define F0 PAL_LINE(GPIOA, 1) diff --git a/platforms/chibios/converters/elite_c_to_stemcell/converter.mk b/platforms/chibios/converters/elite_c_to_stemcell/converter.mk new file mode 100644 index 0000000000..1bbe9bf09e --- /dev/null +++ b/platforms/chibios/converters/elite_c_to_stemcell/converter.mk @@ -0,0 +1,18 @@ +# Copyright 2022 Mega Mind (@megamind4089) +# SPDX-License-Identifier: GPL-2.0-or-later + +MCU := STM32F411 +BOARD := STEMCELL +BOOTLOADER := tinyuf2 + +SERIAL_DRIVER ?= usart +WS2812_DRIVER ?= bitbang + +ifeq ($(strip $(STMC_US)), yes) + OPT_DEFS += -DSTEMCELL_UART_SWAP +endif + +ifeq ($(strip $(STMC_IS)), yes) + OPT_DEFS += -DSTEMCELL_I2C_SWAP +endif +