summaryrefslogtreecommitdiffstats
path: root/keyboards/handwired/onekey
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/handwired/onekey')
-rw-r--r--keyboards/handwired/onekey/elite_c/config.h3
-rw-r--r--keyboards/handwired/onekey/keymaps/chibios_waiting_test/config.h12
-rw-r--r--keyboards/handwired/onekey/keymaps/chibios_waiting_test/keymap.c47
-rw-r--r--keyboards/handwired/onekey/promicro/config.h3
-rw-r--r--keyboards/handwired/onekey/rp2040/config.h9
-rw-r--r--keyboards/handwired/onekey/teensy_2/config.h3
-rw-r--r--keyboards/handwired/onekey/teensy_2pp/config.h3
7 files changed, 78 insertions, 2 deletions
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/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/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
index f5a122e91b..f4e45a8981 100644
--- a/keyboards/handwired/onekey/rp2040/config.h
+++ b/keyboards/handwired/onekey/rp2040/config.h
@@ -6,10 +6,15 @@
#include "config_common.h"
#define PRODUCT Onekey Raspberry Pi RP2040
-#define MATRIX_COL_PINS { GP4 }
-#define MATRIX_ROW_PINS { GP5 }
+#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
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