summaryrefslogtreecommitdiffstats
path: root/keyboards/handwired/onekey/keymaps
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/handwired/onekey/keymaps')
-rw-r--r--keyboards/handwired/onekey/keymaps/adc/keymap.c34
-rw-r--r--keyboards/handwired/onekey/keymaps/adc/rules.mk3
-rw-r--r--keyboards/handwired/onekey/keymaps/apa102/rules.mk2
-rw-r--r--keyboards/handwired/onekey/keymaps/backlight/config.h3
-rw-r--r--keyboards/handwired/onekey/keymaps/backlight/keymap.c39
-rw-r--r--keyboards/handwired/onekey/keymaps/backlight/rules.mk2
-rw-r--r--keyboards/handwired/onekey/keymaps/chibios_waiting_test/config.h12
-rw-r--r--keyboards/handwired/onekey/keymaps/default/keymap.c5
-rw-r--r--keyboards/handwired/onekey/keymaps/digitizer/rules.mk1
-rw-r--r--keyboards/handwired/onekey/keymaps/haptic/keymap.c11
-rw-r--r--keyboards/handwired/onekey/keymaps/haptic/rules.mk2
-rw-r--r--keyboards/handwired/onekey/keymaps/hardware_id/keymap.c28
-rw-r--r--keyboards/handwired/onekey/keymaps/i2c_scanner/config.h6
-rw-r--r--keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c66
-rw-r--r--keyboards/handwired/onekey/keymaps/i2c_scanner/readme.md36
-rw-r--r--keyboards/handwired/onekey/keymaps/i2c_scanner/rules.mk3
-rw-r--r--keyboards/handwired/onekey/keymaps/joystick/rules.mk1
-rw-r--r--keyboards/handwired/onekey/keymaps/oled/keymap.c459
-rw-r--r--keyboards/handwired/onekey/keymaps/oled/readme.md23
-rw-r--r--keyboards/handwired/onekey/keymaps/reboot/keymap.c5
-rw-r--r--keyboards/handwired/onekey/keymaps/reset/keymap.c5
-rw-r--r--keyboards/handwired/onekey/keymaps/rgb/rules.mk1
22 files changed, 0 insertions, 747 deletions
diff --git a/keyboards/handwired/onekey/keymaps/adc/keymap.c b/keyboards/handwired/onekey/keymaps/adc/keymap.c
deleted file mode 100644
index f9302a42b2..0000000000
--- a/keyboards/handwired/onekey/keymaps/adc/keymap.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#include QMK_KEYBOARD_H
-#include "analog.h"
-#include <stdio.h>
-
-enum custom_keycodes {
- ADC_SAMPLE = SAFE_RANGE,
-};
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- LAYOUT_ortho_1x1(ADC_SAMPLE)
-};
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- switch (keycode) {
- case ADC_SAMPLE:
- if (record->event.pressed) {
- int16_t val = analogReadPin(ADC_PIN);
-
- char buffer[50];
- sprintf(buffer, "ADC:%u\n", val);
-#ifdef CONSOLE_ENABLE
- printf(buffer);
-#else
- send_string(buffer);
-#endif
- }
- break;
- }
- return false;
-};
-
-// adc_mux pinToMux(pin_t pin) {
-// return TO_MUX(ADC_CHANNEL_IN1, 0);
-// };
diff --git a/keyboards/handwired/onekey/keymaps/adc/rules.mk b/keyboards/handwired/onekey/keymaps/adc/rules.mk
deleted file mode 100644
index a691d5488f..0000000000
--- a/keyboards/handwired/onekey/keymaps/adc/rules.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-SRC += analog.c
-
-CONSOLE_ENABLE = yes
diff --git a/keyboards/handwired/onekey/keymaps/apa102/rules.mk b/keyboards/handwired/onekey/keymaps/apa102/rules.mk
deleted file mode 100644
index 70932cb751..0000000000
--- a/keyboards/handwired/onekey/keymaps/apa102/rules.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-RGBLIGHT_ENABLE = yes
-RGBLIGHT_DRIVER = APA102
diff --git a/keyboards/handwired/onekey/keymaps/backlight/config.h b/keyboards/handwired/onekey/keymaps/backlight/config.h
deleted file mode 100644
index af01528b43..0000000000
--- a/keyboards/handwired/onekey/keymaps/backlight/config.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#pragma once
-
-#define BACKLIGHT_BREATHING
diff --git a/keyboards/handwired/onekey/keymaps/backlight/keymap.c b/keyboards/handwired/onekey/keymaps/backlight/keymap.c
deleted file mode 100644
index 1fbbc632da..0000000000
--- a/keyboards/handwired/onekey/keymaps/backlight/keymap.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include QMK_KEYBOARD_H
-
-//Tap Dance Declarations
-enum {
- TD_BL = 0
-};
-
-void dance_cln_finished(qk_tap_dance_state_t *state, void *user_data) {
- // noop
-}
-
-void dance_cln_reset(qk_tap_dance_state_t *state, void *user_data) {
- switch (state->count) {
- case 1:
- // single tap - step through backlight
- backlight_step();
- break;
-#ifdef BACKLIGHT_BREATHING
- case 2:
- // double tap - toggle breathing
- breathing_toggle();
- break;
- case 3:
- // triple tap - do some pulse stuff
- breathing_pulse();
- break;
-#endif
- default:
- break;
- }
-}
-
-qk_tap_dance_action_t tap_dance_actions[] = {
- [TD_BL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_cln_finished, dance_cln_reset)
-};
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- LAYOUT_ortho_1x1(TD(TD_BL))
-};
diff --git a/keyboards/handwired/onekey/keymaps/backlight/rules.mk b/keyboards/handwired/onekey/keymaps/backlight/rules.mk
deleted file mode 100644
index 176e099770..0000000000
--- a/keyboards/handwired/onekey/keymaps/backlight/rules.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-BACKLIGHT_ENABLE = yes
-TAP_DANCE_ENABLE = yes
diff --git a/keyboards/handwired/onekey/keymaps/chibios_waiting_test/config.h b/keyboards/handwired/onekey/keymaps/chibios_waiting_test/config.h
deleted file mode 100644
index 0c75fa3044..0000000000
--- a/keyboards/handwired/onekey/keymaps/chibios_waiting_test/config.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// 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/default/keymap.c b/keyboards/handwired/onekey/keymaps/default/keymap.c
deleted file mode 100644
index a5782f7a13..0000000000
--- a/keyboards/handwired/onekey/keymaps/default/keymap.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include QMK_KEYBOARD_H
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- LAYOUT_ortho_1x1(KC_A)
-};
diff --git a/keyboards/handwired/onekey/keymaps/digitizer/rules.mk b/keyboards/handwired/onekey/keymaps/digitizer/rules.mk
deleted file mode 100644
index ea9f9bd9ac..0000000000
--- a/keyboards/handwired/onekey/keymaps/digitizer/rules.mk
+++ /dev/null
@@ -1 +0,0 @@
-DIGITIZER_ENABLE = yes \ No newline at end of file
diff --git a/keyboards/handwired/onekey/keymaps/haptic/keymap.c b/keyboards/handwired/onekey/keymaps/haptic/keymap.c
deleted file mode 100644
index e3b0093c18..0000000000
--- a/keyboards/handwired/onekey/keymaps/haptic/keymap.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include QMK_KEYBOARD_H
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- LAYOUT_ortho_1x1(KC_A)
-};
-
-void haptic_enable(void);
-
-void keyboard_post_init_user(void) {
- haptic_enable();
-}
diff --git a/keyboards/handwired/onekey/keymaps/haptic/rules.mk b/keyboards/handwired/onekey/keymaps/haptic/rules.mk
deleted file mode 100644
index 802f7e5dde..0000000000
--- a/keyboards/handwired/onekey/keymaps/haptic/rules.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-HAPTIC_ENABLE = yes
-HAPTIC_DRIVER = SOLENOID
diff --git a/keyboards/handwired/onekey/keymaps/hardware_id/keymap.c b/keyboards/handwired/onekey/keymaps/hardware_id/keymap.c
deleted file mode 100644
index bcec8b3ca1..0000000000
--- a/keyboards/handwired/onekey/keymaps/hardware_id/keymap.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include QMK_KEYBOARD_H
-#include "hardware_id.h"
-#include <stdio.h>
-enum custom_keycodes {
- DUMP_ID = SAFE_RANGE,
-};
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- LAYOUT_ortho_1x1(DUMP_ID)
-};
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- switch (keycode) {
- case DUMP_ID:
- if (record->event.pressed) {
- hardware_id_t id = get_hardware_id();
- char buffer[100];
- sprintf(buffer, "ID:%lu:%lu:%lu:%lu\n", id.data[0], id.data[1], id.data[2], id.data[3]);
-#ifdef CONSOLE_ENABLE
- printf(buffer);
-#else
- send_string(buffer);
-#endif
- }
- break;
- }
- return false;
-};
diff --git a/keyboards/handwired/onekey/keymaps/i2c_scanner/config.h b/keyboards/handwired/onekey/keymaps/i2c_scanner/config.h
deleted file mode 100644
index 42ab08e36e..0000000000
--- a/keyboards/handwired/onekey/keymaps/i2c_scanner/config.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#pragma once
-
-// AVR: can change to other supported values
-#define F_SCL 100000UL
-
-// TODO: add some default ARM configs for i2cv1 and i2cv2
diff --git a/keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c b/keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c
deleted file mode 100644
index ea8443709d..0000000000
--- a/keyboards/handwired/onekey/keymaps/i2c_scanner/keymap.c
+++ /dev/null
@@ -1,66 +0,0 @@
-#include QMK_KEYBOARD_H
-
-#include "i2c_master.h"
-#include "debug.h"
-
-#define TIMEOUT 50
-
-// TODO: remove patch
-#ifdef PROTOCOL_CHIBIOS
-# pragma message("ChibiOS is currently 'best effort' and might not report accurate results")
-
-i2c_status_t i2c_start_bodge(uint8_t address, uint16_t timeout) {
- i2c_start(address);
-
- // except on ChibiOS where the only way is do do "something"
- uint8_t data = 0;
- return i2c_readReg(address, 0, &data, sizeof(data), TIMEOUT);
-}
-
-# define i2c_start i2c_start_bodge
-#endif
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- LAYOUT_ortho_1x1(KC_A)
-};
-
-void do_scan(void) {
- uint8_t nDevices = 0;
-
- dprintf("Scanning...\n");
-
- for (uint8_t address = 1; address < 127; address++) {
- // The i2c_scanner uses the return value of
- // i2c_start to see if a device did acknowledge to the address.
- i2c_status_t error = i2c_start(address << 1, TIMEOUT);
- if (error == I2C_STATUS_SUCCESS) {
- i2c_stop();
- dprintf(" I2C device found at address 0x%02X\n", address);
- nDevices++;
- } else {
- // dprintf(" Unknown error (%u) at address 0x%02X\n", error, address);
- }
- }
-
- if (nDevices == 0)
- dprintf("No I2C devices found\n");
- else
- dprintf("done\n");
-}
-
-uint16_t scan_timer = 0;
-
-void matrix_scan_user(void) {
- if (timer_elapsed(scan_timer) > 5000) {
- do_scan();
- scan_timer = timer_read();
- }
-}
-
-void keyboard_post_init_user(void) {
- debug_enable = true;
- debug_matrix = true;
-
- i2c_init();
- scan_timer = timer_read();
-}
diff --git a/keyboards/handwired/onekey/keymaps/i2c_scanner/readme.md b/keyboards/handwired/onekey/keymaps/i2c_scanner/readme.md
deleted file mode 100644
index ce6357a9c2..0000000000
--- a/keyboards/handwired/onekey/keymaps/i2c_scanner/readme.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# i2c_scanner
-
-Aiming to provide a more qmk friendly version of <https://playground.arduino.cc/Main/I2cScanner/>
-
-> This very simple ~~sketch~~ keymap scans the I2C-bus for devices. If a device is found, it is reported to the ~~Arduino serial monitor~~ console.
-
-
-## Flashing
-
-Pick a target that is aligned to the MCU you want to test:
-
-```console
-make handwired/onekey/elite_c:i2c_scanner:flash # also 32u4 + dfu bootloader
-make handwired/onekey/promicro:i2c_scanner:flash
-make handwired/onekey/teensy_2:i2c_scanner:flash
-
-# ChibiOS is currently 'best effort' and might not report accurate results
-make handwired/onekey/proton_c:i2c_scanner:flash
-```
-
-others might work with additional configuration.
-
-## Usage
-
-Output is viewable through a compatible tool <https://docs.qmk.fm/#/newbs_testing_debugging?id=debugging-tools>.
-
-You can change the wires, and plug-in I2C devices while the i2c_scanner is running.
-
-The output of the console will look like this:
-
-```
-Listening:
-Scanning...
- I2C device found at address 0x20
-done
-```
diff --git a/keyboards/handwired/onekey/keymaps/i2c_scanner/rules.mk b/keyboards/handwired/onekey/keymaps/i2c_scanner/rules.mk
deleted file mode 100644
index 04498a8831..0000000000
--- a/keyboards/handwired/onekey/keymaps/i2c_scanner/rules.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-CONSOLE_ENABLE = yes
-
-QUANTUM_LIB_SRC += i2c_master.c
diff --git a/keyboards/handwired/onekey/keymaps/joystick/rules.mk b/keyboards/handwired/onekey/keymaps/joystick/rules.mk
deleted file mode 100644
index 9e44c470f2..0000000000
--- a/keyboards/handwired/onekey/keymaps/joystick/rules.mk
+++ /dev/null
@@ -1 +0,0 @@
-JOYSTICK_ENABLE = yes
diff --git a/keyboards/handwired/onekey/keymaps/oled/keymap.c b/keyboards/handwired/onekey/keymaps/oled/keymap.c
deleted file mode 100644
index 244dc4facb..0000000000
--- a/keyboards/handwired/onekey/keymaps/oled/keymap.c
+++ /dev/null
@@ -1,459 +0,0 @@
-/* Copyright 2020 Sergey Vlasov <sigprof@gmail.com>
- *
- * 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
-
-enum tap_dances {
- TD_OLED,
-};
-
-enum oled_test_modes {
- // Modes between TEST_FIRST and TEST_LAST (inclusive) can be switched with a keypress.
- TEST_FIRST,
- TEST_LOGO = TEST_FIRST,
- TEST_CHARACTERS,
- TEST_SLOW_UPDATE,
- TEST_ALL_ON,
- TEST_FRAME,
- TEST_ALL_OFF,
- TEST_FILL_HORZ_0,
- TEST_FILL_HORZ_1,
- TEST_FILL_VERT_0,
- TEST_FILL_VERT_1,
- TEST_FILL_CHECKERBOARD_1,
- TEST_FILL_CHECKERBOARD_2,
- TEST_FILL_CHECKERBOARD_4,
- TEST_LAST = TEST_FILL_CHECKERBOARD_4,
-
- // Special modes which are not reachable normally.
- TEST_DRAW_ALWAYS_ON,
- TEST_DRAW_ALWAYS_OFF,
-};
-
-static enum oled_test_modes test_mode = TEST_FIRST;
-
-static oled_rotation_t rotation = OLED_ROTATION_0;
-
-static bool scrolling;
-static uint8_t scrolling_speed;
-static bool need_update = true;
-static bool draw_always;
-static bool update_speed_test;
-static uint32_t update_speed_start_timer;
-static uint16_t update_speed_count;
-static bool restart_test;
-
-static void stop_scrolling(void) {
- if (scrolling) {
- oled_scroll_off();
- scrolling = false;
- }
-}
-
-static void dance_oled_finished(qk_tap_dance_state_t *state, void *user_data) {
- switch (state->count) {
- case 1:
- if (state->pressed) {
- // single hold - step through rotations
- switch (rotation) {
- case OLED_ROTATION_0:
- rotation = OLED_ROTATION_90;
- break;
- case OLED_ROTATION_90:
- rotation = OLED_ROTATION_180;
- break;
- case OLED_ROTATION_180:
- rotation = OLED_ROTATION_270;
- break;
- default:
- rotation = OLED_ROTATION_0;
- break;
- }
- stop_scrolling();
- oled_init(rotation);
- } else {
- // single tap - step through test modes
- if (test_mode < TEST_LAST) {
- ++test_mode;
- } else {
- test_mode = TEST_FIRST;
- }
- stop_scrolling();
- oled_clear();
- }
- restart_test = true;
- need_update = true;
- break;
-
- case 2:
- if (state->pressed) {
- // tap + hold - change scrolling speed
- scrolling_speed = (scrolling_speed + 1) % 8;
- stop_scrolling();
- oled_scroll_set_speed(scrolling_speed);
- // Cannot reactivate scrolling here, because oled_scroll_off()
- // marks the whole display as dirty, and oled_scroll_left()
- // silently does nothing if either the display is dirty or
- // scrolling is already active.
- } else {
- // double tap - toggle scrolling
- if (!scrolling) {
- scrolling = true;
- oled_scroll_left();
- } else {
- scrolling = false;
- oled_scroll_off();
- }
- }
- need_update = true;
- break;
-
- case 3:
- if (state->pressed) {
- // double tap + hold - toggle `draw_always`
- draw_always = !draw_always;
- if (draw_always) {
- test_mode = TEST_DRAW_ALWAYS_ON;
- } else {
- test_mode = TEST_DRAW_ALWAYS_OFF;
- }
- stop_scrolling();
- oled_clear();
- restart_test = true;
- need_update = true;
- } else {
- // triple tap - toggle update speed test
- update_speed_test = !update_speed_test;
- if (update_speed_test) {
- stop_scrolling();
- update_speed_start_timer = timer_read32();
- update_speed_count = 0;
- }
- }
- break;
- case 4:
- if (!state->pressed) {
- // quadruple tap - step through brightness levels
- oled_set_brightness(oled_get_brightness() + 0x10);
- }
- break;
- default:
- break;
- }
-}
-
-qk_tap_dance_action_t tap_dance_actions[] = {[TD_OLED] = ACTION_TAP_DANCE_FN(dance_oled_finished)};
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {LAYOUT_ortho_1x1(TD(TD_OLED))};
-
-// `bool oled_is_dirty(void)` does not exist at the moment
-extern OLED_BLOCK_TYPE oled_dirty;
-
-static inline uint8_t pixel_width(void) {
- if (!(rotation & OLED_ROTATION_90)) {
- return OLED_DISPLAY_WIDTH;
- }
- return OLED_DISPLAY_HEIGHT;
-}
-
-static inline uint8_t pixel_height(void) {
- if (!(rotation & OLED_ROTATION_90)) {
- return OLED_DISPLAY_HEIGHT;
- }
- return OLED_DISPLAY_WIDTH;
-}
-
-// Draw the QMK logo at the top left corner, clipping if it does not fit.
-static void test_logo(void) {
- uint8_t lines = oled_max_lines();
- if (lines > 3) {
- lines = 3;
- }
- uint8_t chars = oled_max_chars();
- if (chars > 21) {
- chars = 21;
- }
- for (uint8_t row = 0; row < lines; ++row) {
- oled_set_cursor(0, row);
- for (uint8_t col = 0; col < chars; ++col) {
- oled_write_char(0x80 + 0x20 * row + col, false);
- }
- }
-}
-
-static const PROGMEM char fill_ff[OLED_MATRIX_SIZE] = {[0 ... OLED_MATRIX_SIZE - 1] = 0xff};
-
-// Fill the whole screen with a pattern made from two bytes alternating after the specified number of repeats.
-static void test_fill(uint8_t byte0, uint8_t byte1, uint8_t repeats) {
- uint8_t width = pixel_width();
- uint8_t lines = oled_max_lines();
- uint16_t index = 0;
- for (uint8_t row = 0; row < lines; ++row) {
- for (uint8_t col = 0; col < width; ++col) {
- uint8_t byte = ((col / repeats) % 2) ? byte1 : byte0;
- oled_write_raw_byte(byte, index++);
- }
- }
-}
-
-// Draw a frame at the edges of the OLED screen.
-static void test_frame(void) {
- uint8_t width = pixel_width();
- uint8_t height = pixel_height();
- for (uint8_t x = 0; x < width; ++x) {
- oled_write_pixel(x, 0, true);
- oled_write_pixel(x, height - 1, true);
- }
- for (uint8_t y = 1; y < height - 1; ++y) {
- oled_write_pixel(0, y, true);
- oled_write_pixel(width - 1, y, true);
- }
-}
-
-// Use all 94 visible ASCII characters for testing.
-#define TEST_CHAR_COUNT ('~' - '!' + 1)
-
-static char get_test_char(uint8_t char_index) { return char_index + '!'; }
-
-// Fill the whole screen with distinct characters (if the display is large enough to show more than 94 characters
-// at once, the sequence is repeated the second time with inverted characters).
-static void test_characters(void) {
- uint8_t cols = oled_max_chars();
- uint8_t rows = oled_max_lines();
- bool invert = false;
- uint8_t char_index = 0;
- for (uint8_t row = 0; row < rows; ++row) {
- for (uint8_t col = 0; col < cols; ++col) {
- oled_write_char(get_test_char(char_index), invert);
- if (++char_index >= TEST_CHAR_COUNT) {
- char_index = 0;
- invert = !invert;
- }
- }
- }
-}
-
-// Test screen updating after drawing a single character or pixel.
-void test_slow_update(void) {
- static uint8_t phase, x, y, char_index, first_char;
- static uint16_t timer;
- static uint16_t delay = 500;
-
- if (restart_test) {
- // Initialize all state variables before starting the test.
- restart_test = false;
- phase = 0;
- x = 0;
- y = 0;
- char_index = 0;
- first_char = 0;
- delay = 500;
- } else {
- // Wait for the specified time between steps.
- if (timer_elapsed(timer) < delay) {
- return;
- }
- }
-
- timer = timer_read();
- switch (phase) {
- case 0:
- // Phase 0: fill the whole screen with mostly distinct characters, one character at a time. Here the
- // inversion trick is not used, so that the frame which is drawn in subsequent phases would not be
- // overlapped by the inverted character background.
- oled_set_cursor(x, y);
- oled_write_char(get_test_char(char_index), false);
- if (++char_index >= TEST_CHAR_COUNT) {
- char_index = 0;
- }
- if (++x >= oled_max_chars()) {
- x = 0;
- if (++y >= oled_max_lines()) {
- // The whole screen was filled - start the next phase.
- ++phase;
- x = y = 0;
- }
- }
- delay = 250;
- break;
-
- case 1:
- // Phase 1: draw a line along the left edge of the screen, one pixel at a time.
- oled_write_pixel(x, y, true);
- if (y < pixel_height() - 1) {
- ++y;
- } else {
- // The bottom left corner is reached - start the next phase.
- ++phase;
- ++x;
- }
- delay = 50;
- break;
-
- case 2:
- // Phase 2: draw a line along the bottom edge of the screen, one pixel at a time.
- oled_write_pixel(x, y, true);
- if (x < pixel_width() - 1) {
- ++x;
- } else {
- // The bottom right corner was reached - start the next phase.
- ++phase;
- --y;
- }
- delay = 50;
- break;
-
- case 3:
- // Phase 3: draw a line along the right edge of the screen, one pixel at a time.
- oled_write_pixel(x, y, true);
- if (y > 0) {
- --y;
- } else {
- // The top right corner was reached - start the next phase.
- ++phase;
- --x;
- }
- delay = 50;
- break;
-
- case 4:
- // Phase 4: draw a line along the top edge of the screen, one pixel at a time.
- oled_write_pixel(x, y, true);
- if (x > 0) {
- --x;
- } else {
- // The top left corner was reached - start the next phase.
- ++phase;
- }
- delay = 50;
- break;
-
- default:
- // Restart from phase 0, but change the first character of the sequence to make screen updates visible.
- if (++first_char >= TEST_CHAR_COUNT) {
- first_char = 0;
- }
- phase = 0;
- x = 0;
- y = 0;
- char_index = first_char;
- delay = 500;
- break;
- }
-}
-
-oled_rotation_t oled_init_user(oled_rotation_t rotation) {
- oled_scroll_set_area(0, 0);
- oled_scroll_set_speed(scrolling_speed);
- return rotation;
-}
-
-bool oled_task_user(void) {
- if (update_speed_test) {
- // Speed test mode - wait for screen update completion.
- if (!oled_dirty) {
- // Update statistics and send the measurement result to the console.
- update_speed_count++;
- if (update_speed_count % 256 == 0) {
- uprintf("OLED: %u updates, %lu ms\n", update_speed_count, timer_elapsed32(update_speed_start_timer));
- }
-
- // Toggle between the "all on" and "all off" states and trigger the screen update again.
- if (test_mode == TEST_ALL_ON) {
- test_mode = TEST_ALL_OFF;
- } else {
- test_mode = TEST_ALL_ON;
- }
- need_update = true;
- }
- }
-
- // The sample implementation of oled_task_user() in the documentation redraws the image after every call, relying on
- // the fact that drawing functions check whether the output actually changes anything in the image, and set dirty
- // bits only when something has actually changed. However, redrawing the image only when some of the underlying
- // data has changed is more efficient. Make it possible to test both modes here.
- if (!draw_always || update_speed_test) {
- // Draw the image only when the `need_update` flag is set, except for the "slow update" test.
- // This mode is also forced when the screen update speed test is performed.
- if (!need_update) {
- if (test_mode != TEST_SLOW_UPDATE) {
- return false;
- }
- }
- need_update = false;
- }
-
- switch (test_mode) {
- case TEST_LOGO:
- test_logo();
- break;
- case TEST_CHARACTERS:
- test_characters();
- break;
- case TEST_SLOW_UPDATE:
- test_slow_update();
- break;
- case TEST_ALL_ON:
- oled_write_raw_P(fill_ff, sizeof(fill_ff));
- break;
- case TEST_FRAME:
- test_frame();
- break;
- case TEST_ALL_OFF:
- // `oled_clear()` is faster, but cannot be used with `draw_always`, because it does not check the previous
- // content of the buffer and always marks the whole buffer as dirty.
- if (update_speed_test) {
- oled_clear();
- } else {
- test_fill(0x00, 0x00, 1);
- }
- break;
- case TEST_FILL_HORZ_0:
- test_fill(0x55, 0x55, 1);
- break;
- case TEST_FILL_HORZ_1:
- test_fill(0xaa, 0xaa, 1);
- break;
- case TEST_FILL_VERT_0:
- test_fill(0xff, 0x00, 1);
- break;
- case TEST_FILL_VERT_1:
- test_fill(0x00, 0xff, 1);
- break;
- case TEST_FILL_CHECKERBOARD_1:
- test_fill(0x55, 0xaa, 1);
- break;
- case TEST_FILL_CHECKERBOARD_2:
- test_fill(0x33, 0xcc, 2);
- break;
- case TEST_FILL_CHECKERBOARD_4:
- test_fill(0x0f, 0xf0, 4);
- break;
-
- case TEST_DRAW_ALWAYS_ON:
- oled_write_P(PSTR("Draw Always"), false);
- break;
- case TEST_DRAW_ALWAYS_OFF:
- oled_write_P(PSTR("Draw Once"), false);
- break;
- }
- return false;
-}
-
-void keyboard_post_init_user(void) {
- // Console messages are used for update speed test results
- debug_enable = true;
-}
diff --git a/keyboards/handwired/onekey/keymaps/oled/readme.md b/keyboards/handwired/onekey/keymaps/oled/readme.md
deleted file mode 100644
index 9854b95804..0000000000
--- a/keyboards/handwired/onekey/keymaps/oled/readme.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# OLED tester
-
-Available commands using a single key:
-- Single tap: Switch to the next test pattern.
-- Single hold: Switch to the next orientation (note that 90° and 270° orientations may not work correctly with some displays).
-- Double tap: Toggle horizontal scrolling of the top row. Note that this scrolling is implemented by the controller and has major limitations: it works only with SSD1306-based displays, blocks all display updates, may not work correctly if the display width is less than 128 pixels, and does not handle 90°/270° rotation properly.
-- Tap and hold: Change scrolling speed (because of controller limitations, scrolling needs to be started again manually using a double tap).
-- Triple tap: Start or stop the update speed test. This test repeatedly fills the display with all-on and all-off pixels, measures the time required for updating the display, and prints the measured values to the HID console every 256th refresh.
-- Double tap and hold: Switch between the “draw once” (default) and “draw always” modes. The “draw always” mode means that `oled_task_user()` redraws the whole picture completely every time it is called; the example code in the OLED feature documentation is written in