diff --git a/keyboards/handwired/onekey/micromod/rp2040/config.h b/keyboards/handwired/onekey/micromod/rp2040/config.h new file mode 100644 index 0000000000..aff9c3b3de --- /dev/null +++ b/keyboards/handwired/onekey/micromod/rp2040/config.h @@ -0,0 +1,48 @@ +// 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 } + + +#define SPI_DRIVER SPID0 +#define SPI_SCK_PIN GP22 +#define SPI_MOSI_PIN GP23 +#define SPI_MISO_PIN GP20 + +/* OLED SPI Pins */ +#define OLED_DC_PIN GP7 // D1 +#define OLED_RST_PIN GP6 // D0 +#define OLED_CS_PIN GP21 // SPI_CS + +#define DISPLAY_DC_PIN GP6 // D0 +#define DISPLAY_RST_PIN GP7 // D1 +#define DISPLAY_CS_PIN GP21 +#define DISPLAY_SPI_DIVIDER 16 + +/* Divisor for OLED */ +#define OLED_SPI_DIVISOR 4 +#define OLED_UPDATE_INTERVAL 1 diff --git a/keyboards/handwired/onekey/micromod/rp2040/halconf.h b/keyboards/handwired/onekey/micromod/rp2040/halconf.h new file mode 100644 index 0000000000..0695d32ce3 --- /dev/null +++ b/keyboards/handwired/onekey/micromod/rp2040/halconf.h @@ -0,0 +1,11 @@ +// 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 +#define HAL_USE_SPI 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..c780e32cef --- /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": "GP13" + }, + "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..a6977fc804 --- /dev/null +++ b/keyboards/handwired/onekey/micromod/rp2040/mcuconf.h @@ -0,0 +1,20 @@ +// 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 + +#undef RP_SPI_USE_SPI0 +#define RP_SPI_USE_SPI0 TRUE 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..04854f0a6d --- /dev/null +++ b/keyboards/handwired/onekey/micromod/stm32f405/config.h @@ -0,0 +1,48 @@ +// 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 BACKLIGHT_PAL_MODE 3 + +#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 } + +#define SPI_DRIVER SPID1 +#define SPI_SCK_PIN A5 +#define SPI_MOSI_PIN A7 +#define SPI_MISO_PIN A6 + +/* OLED SPI Pins */ +#define OLED_DC_PIN C1 +#define OLED_RST_PIN C0 +#define OLED_CS_PIN C4 + +#define DISPLAY_CS_PIN C4 // SPI CS +#define DISPLAY_DC_PIN C0 // D0 +#define DISPLAY_RST_PIN C1 // D1 +#define DISPLAY_SPI_DIVIDER 16 + +/* Divisor for OLED */ +#define OLED_SPI_DIVISOR 4 +#define OLED_UPDATE_INTERVAL 1 diff --git a/keyboards/handwired/onekey/micromod/stm32f405/halconf.h b/keyboards/handwired/onekey/micromod/stm32f405/halconf.h new file mode 100644 index 0000000000..bc9f856185 --- /dev/null +++ b/keyboards/handwired/onekey/micromod/stm32f405/halconf.h @@ -0,0 +1,25 @@ +/* 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 + +#ifdef AUDIO_DRIVER_DAC +#define HAL_USE_GPT TRUE +#define HAL_USE_DAC TRUE +#endif +#define HAL_USE_PWM 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..84f62481d8 --- /dev/null +++ b/keyboards/handwired/onekey/micromod/stm32f405/mcuconf.h @@ -0,0 +1,54 @@ +/* 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 + +#if HAL_USE_ADC==TRUE +#undef STM32_ADC_USE_ADC1 +#define STM32_ADC_USE_ADC1 TRUE +#endif + +#if HAL_USE_I2C==TRUE +#undef STM32_I2C_USE_I2C2 +#define STM32_I2C_USE_I2C2 TRUE +#endif + +#if HAL_USE_SPI==TRUE +#undef STM32_SPI_USE_SPI1 +#define STM32_SPI_USE_SPI1 TRUE +#endif + +#ifdef WS2812_PWM +#undef STM32_PWM_USE_TIM3 +#define STM32_PWM_USE_TIM3 TRUE +#endif + +#ifdef BACKLIGHT_PWM +#undef STM32_PWM_USE_TIM8 +#define STM32_PWM_USE_TIM8 TRUE +#endif + +#ifdef AUDIO_DRIVER_DAC +#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 +#endif 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(); +}