diff options
Diffstat (limited to 'keyboards/handwired/onekey')
20 files changed, 338 insertions, 0 deletions
diff --git a/keyboards/handwired/onekey/config.h b/keyboards/handwired/onekey/config.h index f491d4d393..88c15806ce 100644 --- a/keyboards/handwired/onekey/config.h +++ b/keyboards/handwired/onekey/config.h @@ -42,6 +42,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define LOCKING_RESYNC_ENABLE #define TAPPING_TERM 500 +#define PERMISSIVE_HOLD /* * Feature disable options diff --git a/keyboards/handwired/onekey/elite_c/config.h b/keyboards/handwired/onekey/elite_c/config.h index f495a1c38b..a3f63983fe 100644 --- a/keyboards/handwired/onekey/elite_c/config.h +++ b/keyboards/handwired/onekey/elite_c/config.h @@ -30,3 +30,6 @@ #define RGB_CI_PIN B1 #define ADC_PIN F6 + +#define QMK_WAITING_TEST_BUSY_PIN F6 +#define QMK_WAITING_TEST_YIELD_PIN F7 diff --git a/keyboards/handwired/onekey/kb2040/config.h b/keyboards/handwired/onekey/kb2040/config.h new file mode 100644 index 0000000000..24a7d3a3eb --- /dev/null +++ b/keyboards/handwired/onekey/kb2040/config.h @@ -0,0 +1,29 @@ +// Copyright 2022 Stefan Kerkmann +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "config_common.h" + +#define PRODUCT Onekey Raspberry Pi RP2040 +#define MATRIX_COL_PINS \ + { GP4 } +#define MATRIX_ROW_PINS \ + { GP5 } +#define DEBUG_MATRIX_SCAN_RATE + +#define QMK_WAITING_TEST_BUSY_PIN GP8 +#define QMK_WAITING_TEST_YIELD_PIN GP9 + +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP25 +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U + +#define RGB_DI_PIN A1 + +// settings for the oled keyboard demo with Adafruit 0.91" OLED display on the Stemma QT port +#define OLED_DISPLAY_128X32 +#define I2C_DRIVER I2CD1 +#define I2C1_SDA_PIN GP12 +#define I2C1_SCL_PIN GP13 + diff --git a/keyboards/handwired/onekey/kb2040/mcuconf.h b/keyboards/handwired/onekey/kb2040/mcuconf.h new file mode 100644 index 0000000000..57e58e14d7 --- /dev/null +++ b/keyboards/handwired/onekey/kb2040/mcuconf.h @@ -0,0 +1,24 @@ +/* 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 + +#include_next <mcuconf.h> + +#undef RP_I2C_USE_I2C0 +#define RP_I2C_USE_I2C0 TRUE + +#undef RP_I2C_USE_I2C1 +#define RP_I2C_USE_I2C1 TRUE diff --git a/keyboards/handwired/onekey/kb2040/readme.md b/keyboards/handwired/onekey/kb2040/readme.md new file mode 100644 index 0000000000..54ea25a6a5 --- /dev/null +++ b/keyboards/handwired/onekey/kb2040/readme.md @@ -0,0 +1,10 @@ +# Adafruit KB2040 onekey with OLED + +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 + +* [Adafruit KB2040 - RP2040 Kee Boar](https://www.adafruit.com/product/5302) +* Optional [128x32 OLED display on the Stemma QT port](https://www.adafruit.com/product/4440) diff --git a/keyboards/handwired/onekey/kb2040/rules.mk b/keyboards/handwired/onekey/kb2040/rules.mk new file mode 100644 index 0000000000..624b331bf8 --- /dev/null +++ b/keyboards/handwired/onekey/kb2040/rules.mk @@ -0,0 +1,9 @@ +# MCU name +MCU = RP2040 +BOOTLOADER = rp2040 + +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 + +OPT_DEFS += -DHAL_USE_I2C=TRUE + diff --git a/keyboards/handwired/onekey/keymaps/chibios_waiting_test/config.h b/keyboards/handwired/onekey/keymaps/chibios_waiting_test/config.h new file mode 100644 index 0000000000..0c75fa3044 --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/chibios_waiting_test/config.h @@ -0,0 +1,12 @@ +// Copyright 2022 Stefan Kerkmann +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#if !defined(QMK_WAITING_TEST_BUSY_PIN) +# define QMK_WAITING_TEST_BUSY_PIN A8 +#endif + +#if !defined(QMK_WAITING_TEST_YIELD_PIN) +# define QMK_WAITING_TEST_YIELD_PIN A9 +#endif diff --git a/keyboards/handwired/onekey/keymaps/chibios_waiting_test/keymap.c b/keyboards/handwired/onekey/keymaps/chibios_waiting_test/keymap.c new file mode 100644 index 0000000000..ecf67d3b3c --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/chibios_waiting_test/keymap.c @@ -0,0 +1,47 @@ +// Copyright 2022 Stefan Kerkmann +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {LAYOUT_ortho_1x1(KC_A)}; + +#if defined(__AVR__) +# pragma message "AVR uses polled waiting by default, running theses tests will not show any difference" +static inline void chThdSleepMicroseconds(uint32_t us) { + wait_us(us); +} +#endif + +void keyboard_post_init_user(void) { + setPinOutput(QMK_WAITING_TEST_BUSY_PIN); + setPinOutput(QMK_WAITING_TEST_YIELD_PIN); +} + +static inline void wait_us_polling_with_strobe(uint32_t us) { + writePinHigh(QMK_WAITING_TEST_BUSY_PIN); + wait_us(us); + writePinLow(QMK_WAITING_TEST_BUSY_PIN); +} + +static inline void wait_us_yield_with_strobe(uint32_t us) { + writePinHigh(QMK_WAITING_TEST_YIELD_PIN); + chThdSleepMicroseconds(us); + writePinLow(QMK_WAITING_TEST_YIELD_PIN); +} + +static const uint32_t waiting_values[] = {0, 1, 5, 10, 25, 50, 100, 150, 200, 500, 1000}; + +void housekeeping_task_user(void) { + static uint32_t last_bench = 0; + if (timer_elapsed32(last_bench) > 500) { + for (int i = 0; i < (sizeof(waiting_values) / sizeof(waiting_values[0])); i++) { + wait_us_polling_with_strobe(waiting_values[i]); + wait_us(10); + } + for (int i = 0; i < (sizeof(waiting_values) / sizeof(waiting_values[0])); i++) { + wait_us_yield_with_strobe(waiting_values[i]); + wait_us(10); + } + last_bench = timer_read32(); + } +} diff --git a/keyboards/handwired/onekey/onekey.c b/keyboards/handwired/onekey/onekey.c index cbd67012ce..a29f9ea6d0 100644 --- a/keyboards/handwired/onekey/onekey.c +++ b/keyboards/handwired/onekey/onekey.c @@ -1 +1,12 @@ +// Copyright 2022 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + #include "onekey.h" + +void keyboard_post_init_kb(void) { + debug_enable = true; + debug_matrix = true; + debug_keyboard = true; + debug_mouse = true; + keyboard_post_init_user(); +} diff --git a/keyboards/handwired/onekey/promicro/config.h b/keyboards/handwired/onekey/promicro/config.h index 9c8961d5ca..b9ab046eae 100644 --- a/keyboards/handwired/onekey/promicro/config.h +++ b/keyboards/handwired/onekey/promicro/config.h @@ -30,3 +30,6 @@ #define RGB_CI_PIN B1 #define ADC_PIN F6 + +#define QMK_WAITING_TEST_BUSY_PIN F6 +#define QMK_WAITING_TEST_YIELD_PIN F7 diff --git a/keyboards/handwired/onekey/rp2040/config.h b/keyboards/handwired/onekey/rp2040/config.h new file mode 100644 index 0000000000..f4e45a8981 --- /dev/null +++ b/keyboards/handwired/onekey/rp2040/config.h @@ -0,0 +1,22 @@ +// Copyright 2022 Stefan Kerkmann +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "config_common.h" + +#define PRODUCT Onekey Raspberry Pi RP2040 +#define MATRIX_COL_PINS \ + { GP4 } +#define MATRIX_ROW_PINS \ + { GP5 } +#define DEBUG_MATRIX_SCAN_RATE + +#define QMK_WAITING_TEST_BUSY_PIN GP8 +#define QMK_WAITING_TEST_YIELD_PIN GP9 + +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP25 +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U + +#define RGB_DI_PIN A1 diff --git a/keyboards/handwired/onekey/rp2040/readme.md b/keyboards/handwired/onekey/rp2040/readme.md new file mode 100644 index 0000000000..9014479f8d --- /dev/null +++ b/keyboards/handwired/onekey/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/rp2040/rules.mk b/keyboards/handwired/onekey/rp2040/rules.mk new file mode 100644 index 0000000000..646402d0bb --- /dev/null +++ b/keyboards/handwired/onekey/rp2040/rules.mk @@ -0,0 +1,3 @@ +# MCU name +MCU = RP2040 +BOOTLOADER = rp2040 diff --git a/keyboards/handwired/onekey/teensy_2/config.h b/keyboards/handwired/onekey/teensy_2/config.h index b83262ef05..437c597f29 100644 --- a/keyboards/handwired/onekey/teensy_2/config.h +++ b/keyboards/handwired/onekey/teensy_2/config.h @@ -29,3 +29,6 @@ #define RGB_DI_PIN F6 #define ADC_PIN F6 + +#define QMK_WAITING_TEST_BUSY_PIN F6 +#define QMK_WAITING_TEST_YIELD_PIN F7 diff --git a/keyboards/handwired/onekey/teensy_2pp/config.h b/keyboards/handwired/onekey/teensy_2pp/config.h index 886ad70cbf..691dddfd1a 100644 --- a/keyboards/handwired/onekey/teensy_2pp/config.h +++ b/keyboards/handwired/onekey/teensy_2pp/config.h @@ -29,3 +29,6 @@ #define RGB_DI_PIN F6 #define ADC_PIN F6 + +#define QMK_WAITING_TEST_BUSY_PIN F6 +#define QMK_WAITING_TEST_YIELD_PIN F7 diff --git a/keyboards/handwired/onekey/teensy_35/chconf.h b/keyboards/handwired/onekey/teensy_35/chconf.h new file mode 100644 index 0000000000..ee8312c526 --- /dev/null +++ b/keyboards/handwired/onekey/teensy_35/chconf.h @@ -0,0 +1,28 @@ +/* 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/>. + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/handwired/onekey/teensy_35/chconf.h -r platforms/chibios/common/configs/chconf.h` + */ + +#pragma once + +#define CH_CFG_ST_TIMEDELTA 0 + +#define CH_CFG_TIME_QUANTUM 20 + +#include_next <chconf.h> diff --git a/keyboards/handwired/onekey/teensy_35/config.h b/keyboards/handwired/onekey/teensy_35/config.h new file mode 100644 index 0000000000..a5f2c945c4 --- /dev/null +++ b/keyboards/handwired/onekey/teensy_35/config.h @@ -0,0 +1,32 @@ +/* Copyright 2019 + * + * 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 + +// TODO: including this causes "error: expected identifier before '(' token" errors +//#include "config_common.h" + +#define PRODUCT Onekey Teensy 3.5 + +#define MATRIX_COL_PINS { D5 } // 20/A6 +#define MATRIX_ROW_PINS { B2 } // 19/A5 +#define UNUSED_PINS + +// i2c_master defines +#define I2C1_SCL_PIN B0 // 16/A2 on pinout +#define I2C1_SDA_PIN B1 // 17/A3 on pinout +#define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2 +#define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2 diff --git a/keyboards/handwired/onekey/teensy_35/halconf.h b/keyboards/handwired/onekey/teensy_35/halconf.h new file mode 100644 index 0000000000..6ac756d0f2 --- /dev/null +++ b/keyboards/handwired/onekey/teensy_35/halconf.h @@ -0,0 +1,28 @@ +/* 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/>. + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/handwired/onekey/teensy_35/halconf.h -r platforms/chibios/common/configs/halconf.h` + */ + +#pragma once + +#define HAL_USE_SERIAL TRUE + +#define SERIAL_USB_BUFFERS_SIZE 256 + +#include_next <halconf.h> diff --git a/keyboards/handwired/onekey/teensy_35/mcuconf.h b/keyboards/handwired/onekey/teensy_35/mcuconf.h new file mode 100644 index 0000000000..dc508eee7d --- /dev/null +++ b/keyboards/handwired/onekey/teensy_35/mcuconf.h @@ -0,0 +1,50 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef _MCUCONF_H_ +#define _MCUCONF_H_ + +#define K60x_MCUCONF + +/* + * HAL driver system settings. + */ + +/* Select the MCU clocking mode below by enabling the appropriate block. */ + +/* PEE mode - 120MHz system clock driven by external crystal. */ +#define KINETIS_MCG_MODE KINETIS_MCG_MODE_PEE +#define KINETIS_PLLCLK_FREQUENCY 120000000UL // 120 MHz (RUN) +#define KINETIS_SYSCLK_FREQUENCY KINETIS_PLLCLK_FREQUENCY +#define KINETIS_BUSCLK_FREQUENCY 60000000UL +#define KINETIS_FLASHCLK_FREQUENCY 24000000UL // 24 MHz (RUN) + +#define KINETIS_CLKDIV1_OUTDIV1 1 // -> 0 +#define KINETIS_CLKDIV1_OUTDIV2 2 // -> 1 +#define KINETIS_CLKDIV1_OUTDIV4 5 // -> 4 + +/* + * SERIAL driver system settings. + */ +#define KINETIS_SERIAL_USE_UART0 TRUE + +/* + * USB driver settings + */ +#define KINETIS_USB_USE_USB0 TRUE +#define KINETIS_USB_USB0_IRQ_PRIORITY 5 + +#endif /* _MCUCONF_H_ */ diff --git a/keyboards/handwired/onekey/teensy_35/rules.mk b/keyboards/handwired/onekey/teensy_35/rules.mk new file mode 100644 index 0000000000..8ebefd03f5 --- /dev/null +++ b/keyboards/handwired/onekey/teensy_35/rules.mk @@ -0,0 +1,8 @@ +# MCU name +MCU = MK64FX512 + +# Bootloader selection +BOOTLOADER = halfkay + +# Enter lower-power sleep mode when on the ChibiOS idle thread +OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE |