From 4d9d834a98f65e7305c980645ba25431e67eb871 Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Thu, 15 Jun 2023 22:39:00 -0700 Subject: [PATCH] [Keyboard] Add micromod stuff [Keyboard] Fix warning at compile time for Onekey Micromod --- .../handwired/onekey/micromod/rp2040/config.h | 28 +++++++++++++ .../onekey/micromod/rp2040/halconf.h | 10 +++++ .../onekey/micromod/rp2040/info.json | 15 +++++++ .../onekey/micromod/rp2040/mcuconf.h | 17 ++++++++ .../onekey/micromod/rp2040/readme.md | 12 ++++++ .../handwired/onekey/micromod/rp2040/rp2040.c | 8 ++++ .../handwired/onekey/micromod/rp2040/rules.mk | 2 + .../onekey/micromod/stm32f405/config.h | 28 +++++++++++++ .../onekey/micromod/stm32f405/halconf.h | 30 +++++++++++++ .../onekey/micromod/stm32f405/info.json | 15 +++++++ .../onekey/micromod/stm32f405/mcuconf.h | 42 +++++++++++++++++++ .../onekey/micromod/stm32f405/readme.md | 7 ++++ .../onekey/micromod/stm32f405/rules.mk | 1 + .../onekey/micromod/stm32f405/stm32f405.c | 8 ++++ 14 files changed, 223 insertions(+) create mode 100644 keyboards/handwired/onekey/micromod/rp2040/config.h create mode 100644 keyboards/handwired/onekey/micromod/rp2040/halconf.h create mode 100644 keyboards/handwired/onekey/micromod/rp2040/info.json create mode 100644 keyboards/handwired/onekey/micromod/rp2040/mcuconf.h create mode 100644 keyboards/handwired/onekey/micromod/rp2040/readme.md create mode 100644 keyboards/handwired/onekey/micromod/rp2040/rp2040.c create mode 100644 keyboards/handwired/onekey/micromod/rp2040/rules.mk create mode 100644 keyboards/handwired/onekey/micromod/stm32f405/config.h create mode 100644 keyboards/handwired/onekey/micromod/stm32f405/halconf.h create mode 100644 keyboards/handwired/onekey/micromod/stm32f405/info.json create mode 100644 keyboards/handwired/onekey/micromod/stm32f405/mcuconf.h create mode 100644 keyboards/handwired/onekey/micromod/stm32f405/readme.md create mode 100644 keyboards/handwired/onekey/micromod/stm32f405/rules.mk create mode 100644 keyboards/handwired/onekey/micromod/stm32f405/stm32f405.c diff --git a/keyboards/handwired/onekey/micromod/rp2040/config.h b/keyboards/handwired/onekey/micromod/rp2040/config.h new file mode 100644 index 0000000000..f8c2734b0f --- /dev/null +++ b/keyboards/handwired/onekey/micromod/rp2040/config.h @@ -0,0 +1,28 @@ +// Copyright 2022 Stefan Kerkmann +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define QMK_WAITING_TEST_BUSY_PIN GP25 +// #define QMK_WAITING_TEST_YIELD_PIN GP9 + +#define I2C_DRIVER I2CD0 +#define I2C1_SDA_PIN GP4 +#define I2C1_SCL_PIN GP5 +#define I2C1_CLOCK_SPEED 400000 + +#define BACKLIGHT_PWM_DRIVER PWMD4 +#define BACKLIGHT_PWM_CHANNEL RP2040_PWM_CHANNEL_A + +#define AUDIO_PIN GP13 +#define AUDIO_PWM_DRIVER PWMD6 +#define AUDIO_PWM_CHANNEL RP2040_PWM_CHANNEL_B +#define AUDIO_SHUTDOWN_PIN GP26 +#define AUDIO_INIT_DELAY + +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP25 +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 750U + +#define ENCODERS_PAD_A { GP6 } +#define ENCODERS_PAD_B { GP7 } diff --git a/keyboards/handwired/onekey/micromod/rp2040/halconf.h b/keyboards/handwired/onekey/micromod/rp2040/halconf.h new file mode 100644 index 0000000000..ec56be2263 --- /dev/null +++ b/keyboards/handwired/onekey/micromod/rp2040/halconf.h @@ -0,0 +1,10 @@ +// Copyright 2022 Stefan Kerkmann +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define HAL_USE_I2C TRUE +#define HAL_USE_PWM TRUE +#define HAL_USE_ADC TRUE + +#include_next diff --git a/keyboards/handwired/onekey/micromod/rp2040/info.json b/keyboards/handwired/onekey/micromod/rp2040/info.json new file mode 100644 index 0000000000..64a07384f4 --- /dev/null +++ b/keyboards/handwired/onekey/micromod/rp2040/info.json @@ -0,0 +1,15 @@ +{ + "keyboard_name": "ATP MicroMod RP2040", + "processor": "RP2040", + "bootloader": "rp2040", + "matrix_pins": { + "cols": ["GP18"], + "rows": ["GP20"] + }, + "backlight": { + "pin": "GP24" + }, + "ws2812": { + "pin": "GP24" + } +} diff --git a/keyboards/handwired/onekey/micromod/rp2040/mcuconf.h b/keyboards/handwired/onekey/micromod/rp2040/mcuconf.h new file mode 100644 index 0000000000..5fd8c718f7 --- /dev/null +++ b/keyboards/handwired/onekey/micromod/rp2040/mcuconf.h @@ -0,0 +1,17 @@ +// Copyright 2022 Stefan Kerkmann +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include_next + +#undef RP_PWM_USE_PWM4 +#define RP_PWM_USE_PWM4 TRUE + +#undef RP_PWM_USE_PWM6 +#define RP_PWM_USE_PWM6 TRUE + +#undef RP_I2C_USE_I2C0 +#define RP_I2C_USE_I2C0 TRUE + +#define RP_IRQ_RTC_PRIORITY 3 diff --git a/keyboards/handwired/onekey/micromod/rp2040/readme.md b/keyboards/handwired/onekey/micromod/rp2040/readme.md new file mode 100644 index 0000000000..9014479f8d --- /dev/null +++ b/keyboards/handwired/onekey/micromod/rp2040/readme.md @@ -0,0 +1,12 @@ +# Raspberry Pi 2040 onekey + +To trigger keypress, short together pins *GP4* and *GP5*. + +Double-tap reset to enter bootloader mode. Copy the built uf2 file to the device by dragging the file to the new USB disk. + +## Supported Hardware + +* Raspberry Pi Pico +* SparkFun Pro Micro - RP2040 +* Adafruit KB2040 - RP2040 Kee Boar +* ...and many more RP2040 based development boards diff --git a/keyboards/handwired/onekey/micromod/rp2040/rp2040.c b/keyboards/handwired/onekey/micromod/rp2040/rp2040.c new file mode 100644 index 0000000000..9fbca4776d --- /dev/null +++ b/keyboards/handwired/onekey/micromod/rp2040/rp2040.c @@ -0,0 +1,8 @@ +#include "quantum.h" + +void keyboard_pre_init_kb(void) { + setPinOutput(GP25); + writePinLow(GP25); + + keyboard_pre_init_user(); +} diff --git a/keyboards/handwired/onekey/micromod/rp2040/rules.mk b/keyboards/handwired/onekey/micromod/rp2040/rules.mk new file mode 100644 index 0000000000..115aaa20af --- /dev/null +++ b/keyboards/handwired/onekey/micromod/rp2040/rules.mk @@ -0,0 +1,2 @@ +AUDIO_ENABLE = yes +AUDIO_DRIVER = pwm_hardware diff --git a/keyboards/handwired/onekey/micromod/stm32f405/config.h b/keyboards/handwired/onekey/micromod/stm32f405/config.h new file mode 100644 index 0000000000..1450839a2b --- /dev/null +++ b/keyboards/handwired/onekey/micromod/stm32f405/config.h @@ -0,0 +1,28 @@ +// Copyright 2022 Stefan Kerkmann +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define QMK_WAITING_TEST_BUSY_PIN A15 +// #define QMK_WAITING_TEST_YIELD_PIN GP9 + +#define I2C_DRIVER I2CD2 +#define I2C1_SDA_PIN B11 +#define I2C1_SCL_PIN B10 + +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_16_9 + +#define BACKLIGHT_PWM_DRIVER PWMD8 +#define BACKLIGHT_PWM_CHANNEL 2 + +#define AUDIO_PIN C6 + +#define AUDIO_PWM_DRIVER PWMD8 +#define AUDIO_PWM_CHANNEL 1 +#define AUDIO_PWM_PAL_MODE 3 +#define AUDIO_SHUTDOWN_PIN C5 +#define AUDIO_INIT_DELAY + +#define ENCODERS_PAD_A { C0 } +#define ENCODERS_PAD_B { C1 } diff --git a/keyboards/handwired/onekey/micromod/stm32f405/halconf.h b/keyboards/handwired/onekey/micromod/stm32f405/halconf.h new file mode 100644 index 0000000000..5d0ef0fd76 --- /dev/null +++ b/keyboards/handwired/onekey/micromod/stm32f405/halconf.h @@ -0,0 +1,30 @@ +/* Copyright 2021 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 . + */ + +#pragma once + +#define HAL_USE_ADC TRUE + +#define HAL_USE_I2C TRUE + +#define HAL_USE_PWM TRUE + +#define HAL_USE_SPI TRUE + +#define HAL_USE_GPT TRUE +#define HAL_USE_DAC TRUE + +#include_next diff --git a/keyboards/handwired/onekey/micromod/stm32f405/info.json b/keyboards/handwired/onekey/micromod/stm32f405/info.json new file mode 100644 index 0000000000..315114bd91 --- /dev/null +++ b/keyboards/handwired/onekey/micromod/stm32f405/info.json @@ -0,0 +1,15 @@ +{ + "keyboard_name": "ATP MicroMod STM32F405", + "processor": "STM32F405", + "bootloader": "stm32-dfu", + "matrix_pins": { + "cols": ["A0"], + "rows": ["C9"] + }, + "backlight": { + "pin": "C7" + }, + "ws2812": { + "pin": "C7" + } +} diff --git a/keyboards/handwired/onekey/micromod/stm32f405/mcuconf.h b/keyboards/handwired/onekey/micromod/stm32f405/mcuconf.h new file mode 100644 index 0000000000..504dd8f9c1 --- /dev/null +++ b/keyboards/handwired/onekey/micromod/stm32f405/mcuconf.h @@ -0,0 +1,42 @@ +/* Copyright 2021 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 3 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 . + */ + +#pragma once + +#include_next + +#undef STM32_ADC_USE_ADC1 +#define STM32_ADC_USE_ADC1 TRUE + +#undef STM32_I2C_USE_I2C2 +#define STM32_I2C_USE_I2C2 TRUE + +#undef STM32_SPI_USE_SPI1 +#define STM32_SPI_USE_SPI1 TRUE + +#undef STM32_PWM_USE_TIM3 +#define STM32_PWM_USE_TIM3 TRUE + +#undef STM32_PWM_USE_TIM8 +#define STM32_PWM_USE_TIM8 TRUE + +#undef STM32_DAC_USE_DAC1_CH1 +#define STM32_DAC_USE_DAC1_CH1 TRUE +#undef STM32_DAC_USE_DAC1_CH2 +#define STM32_DAC_USE_DAC1_CH2 TRUE + +#undef STM32_GPT_USE_TIM6 +#define STM32_GPT_USE_TIM6 TRUE diff --git a/keyboards/handwired/onekey/micromod/stm32f405/readme.md b/keyboards/handwired/onekey/micromod/stm32f405/readme.md new file mode 100644 index 0000000000..49a05725d5 --- /dev/null +++ b/keyboards/handwired/onekey/micromod/stm32f405/readme.md @@ -0,0 +1,7 @@ +# Adafruit Feather STM32F405 Express onekey + +* Supported Hardware: [Adafruit Feather STM32F405 Express](https://www.adafruit.com/product/4382) + +To trigger keypress, short together pins *GPIO 12 / PC2* and *GPIO 11 / PC3*. + +https://learn.adafruit.com/adafruit-stm32f405-feather-express/dfu-bootloader-details#enabling-dfu-bootloader-mode-3045622-2 \ No newline at end of file diff --git a/keyboards/handwired/onekey/micromod/stm32f405/rules.mk b/keyboards/handwired/onekey/micromod/stm32f405/rules.mk new file mode 100644 index 0000000000..72f75f4367 --- /dev/null +++ b/keyboards/handwired/onekey/micromod/stm32f405/rules.mk @@ -0,0 +1 @@ +AUDIO_DRIVER = pwm_hardware diff --git a/keyboards/handwired/onekey/micromod/stm32f405/stm32f405.c b/keyboards/handwired/onekey/micromod/stm32f405/stm32f405.c new file mode 100644 index 0000000000..649c01c463 --- /dev/null +++ b/keyboards/handwired/onekey/micromod/stm32f405/stm32f405.c @@ -0,0 +1,8 @@ +#include "quantum.h" + +void keyboard_pre_init_kb(void) { + setPinOutput(A15); + writePinLow(A15); + + keyboard_pre_init_user(); +}