diff options
Diffstat (limited to 'keyboards/handwired/onekey/keymaps')
17 files changed, 352 insertions, 0 deletions
diff --git a/keyboards/handwired/onekey/keymaps/apa102/config.h b/keyboards/handwired/onekey/keymaps/apa102/config.h new file mode 100644 index 0000000000..756ebb3593 --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/apa102/config.h @@ -0,0 +1,14 @@ +#pragma once + +#define RGBLED_NUM 40 +#define APA102_DEFAULT_BRIGHTNESS 5 +#define RGBLIGHT_EFFECT_BREATHING +#define RGBLIGHT_EFFECT_RAINBOW_MOOD +#define RGBLIGHT_EFFECT_RAINBOW_SWIRL +#define RGBLIGHT_EFFECT_SNAKE +#define RGBLIGHT_EFFECT_KNIGHT +#define RGBLIGHT_EFFECT_CHRISTMAS +#define RGBLIGHT_EFFECT_STATIC_GRADIENT +#define RGBLIGHT_EFFECT_RGB_TEST +#define RGBLIGHT_EFFECT_ALTERNATING +#define RGBLIGHT_EFFECT_TWINKLE diff --git a/keyboards/handwired/onekey/keymaps/apa102/keymap.c b/keyboards/handwired/onekey/keymaps/apa102/keymap.c new file mode 100644 index 0000000000..8b4191fb28 --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/apa102/keymap.c @@ -0,0 +1,14 @@ +#include QMK_KEYBOARD_H +#include "apa102.h" // Only needed if you want to use the global brightness function + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + LAYOUT_ortho_1x1(RGB_MOD) +}; + +void keyboard_post_init_user(void) { + apa102_set_brightness(5); + + rgblight_enable_noeeprom(); + rgblight_sethsv_noeeprom(HSV_CYAN); + rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_SWIRL); +} 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..65983c8dd8 --- /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 < ARRAY_SIZE(waiting_values); i++) { + wait_us_polling_with_strobe(waiting_values[i]); + wait_us(10); + } + for (int i = 0; i < ARRAY_SIZE(waiting_values); i++) { + wait_us_yield_with_strobe(waiting_values[i]); + wait_us(10); + } + last_bench = timer_read32(); + } +} diff --git a/keyboards/handwired/onekey/keymaps/console/keymap.c b/keyboards/handwired/onekey/keymaps/console/keymap.c new file mode 100644 index 0000000000..3f5d0664f5 --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/console/keymap.c @@ -0,0 +1,28 @@ +#include QMK_KEYBOARD_H + +enum custom_keycodes { + KC_HELLO = SAFE_RANGE, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + LAYOUT_ortho_1x1(KC_HELLO) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_HELLO: + if (record->event.pressed) { + println("Hello world!"); + } + return false; + } + return true; +} + +void keyboard_post_init_user(void) { + // Customise these values to desired behaviour + debug_enable=true; + debug_matrix=true; + //debug_keyboard=true; + //debug_mouse=true; +} diff --git a/keyboards/handwired/onekey/keymaps/console/rules.mk b/keyboards/handwired/onekey/keymaps/console/rules.mk new file mode 100644 index 0000000000..7c83606d2d --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/console/rules.mk @@ -0,0 +1,2 @@ +CONSOLE_ENABLE = yes +DEBUG_MATRIX_SCAN_RATE_ENABLE = yes diff --git a/keyboards/handwired/onekey/keymaps/digitizer/keymap.c b/keyboards/handwired/onekey/keymaps/digitizer/keymap.c new file mode 100644 index 0000000000..dcc0adc59b --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/digitizer/keymap.c @@ -0,0 +1,58 @@ +/* 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 <http://www.gnu.org/licenses/>. + */ + +#include QMK_KEYBOARD_H + +#include <math.h> + +enum custom_keycodes { + DG_TIP = SAFE_RANGE, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + LAYOUT_ortho_1x1(DG_TIP) +}; + +uint32_t timer = 0; + +void keyboard_post_init_user(void) { + digitizer_in_range_on(); +} + +void matrix_scan_user() { + if (timer_elapsed32(timer) < 200) { + return; + } + + timer = timer_read32(); + + float x = 0.5 - 0.2 * cos(timer / 250. / 6.28); + float y = 0.5 - 0.2 * sin(timer / 250. / 6.28); + digitizer_set_position(x, y); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case DG_TIP: + if (record->event.pressed) { + digitizer_tip_switch_on(); + } else { + digitizer_tip_switch_off(); + } + return false; + } + return true; +} diff --git a/keyboards/handwired/onekey/keymaps/eep_rst/keymap.c b/keyboards/handwired/onekey/keymaps/eep_rst/keymap.c new file mode 100644 index 0000000000..e206b6b39f --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/eep_rst/keymap.c @@ -0,0 +1,5 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + LAYOUT_ortho_1x1(EE_CLR) +}; diff --git a/keyboards/handwired/onekey/keymaps/hardware_id/rules.mk b/keyboards/handwired/onekey/keymaps/hardware_id/rules.mk new file mode 100644 index 0000000000..15b7f725b2 --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/hardware_id/rules.mk @@ -0,0 +1 @@ +CONSOLE_ENABLE = yes diff --git a/keyboards/handwired/onekey/keymaps/joystick/config.h b/keyboards/handwired/onekey/keymaps/joystick/config.h new file mode 100644 index 0000000000..8a4e461b27 --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/joystick/config.h @@ -0,0 +1,4 @@ +#pragma once + +#define JOYSTICK_AXIS_COUNT 2 +#define JOYSTICK_BUTTON_COUNT 1 diff --git a/keyboards/handwired/onekey/keymaps/joystick/keymap.c b/keyboards/handwired/onekey/keymaps/joystick/keymap.c new file mode 100644 index 0000000000..6463900b7b --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/joystick/keymap.c @@ -0,0 +1,20 @@ +#include QMK_KEYBOARD_H + +#ifndef ADC_PIN +# define ADC_PIN F6 +#endif + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + LAYOUT_ortho_1x1(JS_0) +}; + +void matrix_scan_user() { + int16_t val = (((uint32_t)timer_read() % 5000 - 2500) * 255) / 5000; + joystick_set_axis(1, val); +} + +// Joystick config +joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT] = { + [0] = JOYSTICK_AXIS_IN(ADC_PIN, 0, 512, 1023), + [1] = JOYSTICK_AXIS_VIRTUAL +}; diff --git a/keyboards/handwired/onekey/keymaps/oled/rules.mk b/keyboards/handwired/onekey/keymaps/oled/rules.mk new file mode 100644 index 0000000000..83757b1909 --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/oled/rules.mk @@ -0,0 +1,4 @@ +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 +TAP_DANCE_ENABLE = yes +CONSOLE_ENABLE = yes diff --git a/keyboards/handwired/onekey/keymaps/quine/keymap.c b/keyboards/handwired/onekey/keymaps/quine/keymap.c new file mode 100644 index 0000000000..5f1416c77e --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/quine/keymap.c @@ -0,0 +1,59 @@ +#include QMK_KEYBOARD_H +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LAYOUT_ortho_1x1(KC_A) }; +const char *buf[30] = { +"#include QMK_KEYBOARD_H", +"const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LAYOUT_ortho_1x1(KC_A) };", +"const char *buf[30] = {", +"", +"};", +"bool process_record_user(uint16_t keycode, keyrecord_t *record) {", +" switch(keycode) {", +" case KC_A:", +" if (record->event.pressed) {", +" for (int i = 0; i < 3; i++) {", +" send_string(buf[i]);", +" tap_code(KC_ENT);", +" }", +" for (int i = 0; i < 30; i++) {", +" send_string(buf[3]);", +" tap_code16(S(KC_QUOT));", +" send_string(buf[i]);", +" tap_code16(S(KC_QUOT));", +" tap_code(KC_COMM);", +" tap_code(KC_ENT);", +" }", +" for (int i = 4; i < 30; i++) {", +" send_string(buf[i]);", +" tap_code(KC_ENT);", +" }", +" }", +" return false;", +" }", +" return true;", +"};", +}; +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch(keycode) { + case KC_A: + if (record->event.pressed) { + for (int i = 0; i < 3; i++) { + send_string(buf[i]); + tap_code(KC_ENT); + } + for (int i = 0; i < 30; i++) { + send_string(buf[3]); + tap_code16(S(KC_QUOT)); + send_string(buf[i]); + tap_code16(S(KC_QUOT)); + tap_code(KC_COMM); + tap_code(KC_ENT); + } + for (int i = 4; i < 30; i++) { + send_string(buf[i]); + tap_code(KC_ENT); + } + } + return false; + } + return true; +}; diff --git a/keyboards/handwired/onekey/keymaps/rgb/config.h b/keyboards/handwired/onekey/keymaps/rgb/config.h new file mode 100644 index 0000000000..1e54383769 --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/rgb/config.h @@ -0,0 +1,13 @@ +#pragma once + +#define RGBLED_NUM 9 +#define RGBLIGHT_EFFECT_BREATHING +#define RGBLIGHT_EFFECT_RAINBOW_MOOD +#define RGBLIGHT_EFFECT_RAINBOW_SWIRL +#define RGBLIGHT_EFFECT_SNAKE +#define RGBLIGHT_EFFECT_KNIGHT +#define RGBLIGHT_EFFECT_CHRISTMAS +#define RGBLIGHT_EFFECT_STATIC_GRADIENT +#define RGBLIGHT_EFFECT_RGB_TEST +#define RGBLIGHT_EFFECT_ALTERNATING +#define RGBLIGHT_EFFECT_TWINKLE diff --git a/keyboards/handwired/onekey/keymaps/rgb/keymap.c b/keyboards/handwired/onekey/keymaps/rgb/keymap.c new file mode 100644 index 0000000000..c99eb86339 --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/rgb/keymap.c @@ -0,0 +1,11 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + LAYOUT_ortho_1x1(RGB_MOD) +}; + +void keyboard_post_init_user(void) { + rgblight_enable_noeeprom(); + rgblight_sethsv_noeeprom(HSV_CYAN); + rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_SWIRL); +} diff --git a/keyboards/handwired/onekey/keymaps/wear_leveling/config.h b/keyboards/handwired/onekey/keymaps/wear_leveling/config.h new file mode 100644 index 0000000000..642b442da3 --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/wear_leveling/config.h @@ -0,0 +1,6 @@ +// Copyright 2018-2022 Nick Brassel (@tzarc) +// SPDX-License-Identifier: GPL-3.0-or-later +#pragma once + +#define DEBUG_EEPROM_OUTPUT +#define WEAR_LEVELING_DEBUG_OUTPUT diff --git a/keyboards/handwired/onekey/keymaps/wear_leveling/keymap.c b/keyboards/handwired/onekey/keymaps/wear_leveling/keymap.c new file mode 100644 index 0000000000..dc40ca1580 --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/wear_leveling/keymap.c @@ -0,0 +1,65 @@ +// Copyright 2018-2022 Nick Brassel (@tzarc) +// SPDX-License-Identifier: GPL-3.0-or-later +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + LAYOUT_ortho_1x1(QK_BOOT) +}; + +#ifdef DEBUG_EEPROM_OUTPUT + +# ifdef WEAR_LEVELING_ENABLE +# include "wear_leveling.h" +# endif // WEAR_LEVELING_ENABLE + +uint8_t prng(void) { + static uint8_t s = 0xAA, a = 0; + s ^= s << 3; + s ^= s >> 5; + s ^= a++ >> 2; + return s; +} + +void keyboard_post_init_user(void) { + debug_enable = true; + debug_matrix = true; + debug_keyboard = true; +} + +void matrix_scan_user(void) { + static uint32_t last_eeprom_access = 0; + uint32_t now = timer_read32(); + if (now - last_eeprom_access > 5000) { + dprint("reading eeprom\n"); + last_eeprom_access = now; + + union { + uint8_t bytes[4]; + uint32_t raw; + } tmp; + extern uint8_t prng(void); + tmp.bytes[0] = prng(); + tmp.bytes[1] = prng(); + tmp.bytes[2] = prng(); + tmp.bytes[3] = prng(); + + eeconfig_update_user(tmp.raw); + uint32_t value = eeconfig_read_user(); + if (value != tmp.raw) { + dprint("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); + dprint("!! EEPROM readback mismatch!\n"); + dprint("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); + } + } + +# ifdef WEAR_LEVELING_ENABLE + static uint32_t last_wear_leveling_init = 0; + if (now - last_wear_leveling_init > 30000) { + dprint("init'ing wear-leveling\n"); + last_wear_leveling_init = now; + wear_leveling_init(); + } +# endif // WEAR_LEVELING_ENABLE +} + +#endif // DEBUG_EEPROM_OUTPUT diff --git a/keyboards/handwired/onekey/keymaps/wear_leveling/rules.mk b/keyboards/handwired/onekey/keymaps/wear_leveling/rules.mk new file mode 100644 index 0000000000..15b7f725b2 --- /dev/null +++ b/keyboards/handwired/onekey/keymaps/wear_leveling/rules.mk @@ -0,0 +1 @@ +CONSOLE_ENABLE = yes |