From 0bfb874d41dbc60ca88d69794b79ab8effa332f9 Mon Sep 17 00:00:00 2001 From: Tokuhiro Matsuno Date: Sat, 16 Dec 2023 00:36:31 +0900 Subject: [PATCH 01/13] Implemented automatic mouse layer --- .../keyball39/keymaps/default/config.h | 2 + .../keyball/keyball39/keymaps/via/config.h | 2 + .../keyball44/keymaps/default/config.h | 2 + .../keyball/keyball44/keymaps/via/config.h | 2 + .../keyball46/keymaps/default/config.h | 2 + .../keyball/keyball46/keymaps/via/config.h | 2 + .../keyball61/keymaps/default/config.h | 2 + .../keyball/keyball61/keymaps/via/config.h | 4 +- .../keyboards/keyball/lib/keyball/keyball.c | 98 ++++++++++++++++++- .../keyboards/keyball/lib/keyball/keyball.h | 40 +++++++- .../keyboards/keyball/lib/keyball/keycodes.md | 7 ++ 11 files changed, 159 insertions(+), 4 deletions(-) diff --git a/qmk_firmware/keyboards/keyball/keyball39/keymaps/default/config.h b/qmk_firmware/keyboards/keyball/keyball39/keymaps/default/config.h index a05a1cc5b..35c90651b 100644 --- a/qmk_firmware/keyboards/keyball/keyball39/keymaps/default/config.h +++ b/qmk_firmware/keyboards/keyball/keyball39/keymaps/default/config.h @@ -34,3 +34,5 @@ along with this program. If not, see . #endif #define TAP_CODE_DELAY 5 + +#define POINTING_DEVICE_AUTO_MOUSE_ENABLE diff --git a/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/config.h b/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/config.h index cb9ccf9eb..a44f9fee2 100644 --- a/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/config.h +++ b/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/config.h @@ -34,3 +34,5 @@ along with this program. If not, see . #endif #define TAP_CODE_DELAY 5 + +#define POINTING_DEVICE_AUTO_MOUSE_ENABLE diff --git a/qmk_firmware/keyboards/keyball/keyball44/keymaps/default/config.h b/qmk_firmware/keyboards/keyball/keyball44/keymaps/default/config.h index a05a1cc5b..35c90651b 100644 --- a/qmk_firmware/keyboards/keyball/keyball44/keymaps/default/config.h +++ b/qmk_firmware/keyboards/keyball/keyball44/keymaps/default/config.h @@ -34,3 +34,5 @@ along with this program. If not, see . #endif #define TAP_CODE_DELAY 5 + +#define POINTING_DEVICE_AUTO_MOUSE_ENABLE diff --git a/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/config.h b/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/config.h index cb9ccf9eb..a44f9fee2 100644 --- a/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/config.h +++ b/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/config.h @@ -34,3 +34,5 @@ along with this program. If not, see . #endif #define TAP_CODE_DELAY 5 + +#define POINTING_DEVICE_AUTO_MOUSE_ENABLE diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/default/config.h b/qmk_firmware/keyboards/keyball/keyball46/keymaps/default/config.h index 3c83e8bad..e3e77177e 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/default/config.h +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/default/config.h @@ -37,3 +37,5 @@ along with this program. If not, see . #define PRODUCT_ID 0x0005 #define TAP_CODE_DELAY 5 + +#define POINTING_DEVICE_AUTO_MOUSE_ENABLE diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/config.h b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/config.h index 1d9f7ff79..640a31db8 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/config.h +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/config.h @@ -34,3 +34,5 @@ along with this program. If not, see . #endif #define TAP_CODE_DELAY 5 + +#define POINTING_DEVICE_AUTO_MOUSE_ENABLE diff --git a/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/config.h b/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/config.h index a05a1cc5b..35c90651b 100644 --- a/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/config.h +++ b/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/config.h @@ -34,3 +34,5 @@ along with this program. If not, see . #endif #define TAP_CODE_DELAY 5 + +#define POINTING_DEVICE_AUTO_MOUSE_ENABLE diff --git a/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h b/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h index cb9ccf9eb..20e09572b 100644 --- a/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h +++ b/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h @@ -25,7 +25,7 @@ along with this program. If not, see . # define RGBLIGHT_EFFECT_RAINBOW_MOOD # define RGBLIGHT_EFFECT_RAINBOW_SWIRL //# define RGBLIGHT_EFFECT_SNAKE -# define RGBLIGHT_EFFECT_KNIGHT +//# define RGBLIGHT_EFFECT_KNIGHT //# define RGBLIGHT_EFFECT_CHRISTMAS # define RGBLIGHT_EFFECT_STATIC_GRADIENT //# define RGBLIGHT_EFFECT_RGB_TEST @@ -34,3 +34,5 @@ along with this program. If not, see . #endif #define TAP_CODE_DELAY 5 + +#define POINTING_DEVICE_AUTO_MOUSE_ENABLE diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c index 051be1841..0ae016917 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c @@ -26,6 +26,10 @@ along with this program. If not, see . const uint8_t CPI_DEFAULT = KEYBALL_CPI_DEFAULT / 100; const uint8_t CPI_MAX = pmw3360_MAXCPI + 1; const uint8_t SCROLL_DIV_MAX = 7; +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE +const uint16_t AML_TIMEOUT_DEFAULT = 9; +const uint16_t AML_TIMEOUT_MAX = 15; +#endif keyball_t keyball = { .this_have_ball = false, @@ -40,6 +44,11 @@ keyball_t keyball = { .scroll_mode = false, .scroll_div = 0, + +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE + .aml_enabled = 0, + .aml_timeout = 0, +#endif }; ////////////////////////////////////////////////////////////////////////////// @@ -110,6 +119,15 @@ static void add_scroll_div(int8_t delta) { keyball_set_scroll_div(v < 1 ? 1 : v); } + +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE +static void add_aml_timeout(int8_t delta) { + int8_t v = keyball_get_aml_timeout() + delta; + keyball_set_aml_timeout(v < 1 ? 1 : v); +} +#endif + + ////////////////////////////////////////////////////////////////////////////// // Pointing device driver @@ -127,6 +145,10 @@ void pointing_device_driver_init(void) { if (keyball.this_have_ball) { pmw3360_cpi_set(CPI_DEFAULT - 1); pmw3360_reg_write(pmw3360_Motion_Burst, 0); + +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE + set_auto_mouse_layer(1); +#endif } } @@ -424,6 +446,23 @@ void keyball_oled_render_layerinfo(void) { #endif } +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE +void keyball_oled_render_amlinfo(void) { +#ifdef OLED_ENABLE + // Format: `AML:{AML state} {AML timeout}` + // + // Output example: + // + // AML:o 5 + // + oled_write_P(PSTR("AML:"), false); + oled_write_char((keyball.aml_enabled ? 'o' : 'x'), false); + oled_write_char(' ', false); + oled_write(format_4d(keyball.aml_timeout), false); +#endif +} +#endif + ////////////////////////////////////////////////////////////////////////////// // Public API functions @@ -462,6 +501,41 @@ void keyball_set_cpi(uint8_t cpi) { } } +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE +void keyball_set_aml_enabled(bool enabled) { + keyball.aml_enabled = enabled; + set_auto_mouse_enable(enabled); +} + +// This method returns current timeout value. +// It will return 1 to 15. +// +// 1=( 1-1)*50+250=250ms +// 2=( 2-1)*50+250=300ms +// ... +// 9=( 9-1)*50+250=650ms +// 10=(10-1)*50+250=700ms +// 11=(11-1)*50+250=750ms +// 12=(12-1)*50+250=800ms +// 13=(13-1)*50+250=850ms +// 14=(14-1)*50+250=900ms +// 15=(15-1)*50+250=950ms +uint8_t keyball_get_aml_timeout(void) { + return keyball.aml_timeout == 0 ? AML_TIMEOUT_DEFAULT : keyball.aml_timeout; +} + +void keyball_set_aml_timeout(uint8_t timeout) { + if (timeout > AML_TIMEOUT_MAX) { + timeout = AML_TIMEOUT_MAX; + } + keyball.aml_timeout = timeout; + if (timeout == 0) { + timeout = AML_TIMEOUT_DEFAULT; + } + set_auto_mouse_timeout((timeout-1)*50+250); +} +#endif + ////////////////////////////////////////////////////////////////////////////// // Keyboard hooks @@ -480,6 +554,10 @@ void keyboard_post_init_kb(void) { keyball_config_t c = {.raw = eeconfig_read_kb()}; keyball_set_cpi(c.cpi); keyball_set_scroll_div(c.sdiv); +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE + keyball_set_aml_enabled(c.amle); + keyball_set_aml_timeout(c.amlto); +#endif } keyball_on_adjust_layout(KEYBALL_ADJUST_PENDING); @@ -538,8 +616,12 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { break; case KBC_SAVE: { keyball_config_t c = { - .cpi = keyball.cpi_value, - .sdiv = keyball.scroll_div, + .cpi = keyball.cpi_value, + .sdiv = keyball.scroll_div, +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE + .amle = keyball.aml_enabled, + .amlto = keyball.aml_timeout, +#endif }; eeconfig_update_kb(c.raw); } break; @@ -567,6 +649,18 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { add_scroll_div(-1); break; +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE + case AML_TO: + keyball_set_aml_enabled(!keyball.aml_enabled); + break; + case AML_I50: + add_aml_timeout(1); + break; + case AML_D50: + add_aml_timeout(-1); + break; +#endif + default: return true; } diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h index aeb55fe5f..489623962 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h @@ -86,6 +86,12 @@ enum keyball_keycodes { SCRL_DVI = QK_KB_8, // Increment scroll divider SCRL_DVD = QK_KB_9, // Decrement scroll divider +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE + AML_TO = QK_KB_10, // Toggle automatic mouse layer + AML_I50 = QK_KB_11, // Increment automatic mouse layer timeout + AML_D50 = QK_KB_12, // Decrement automatic mouse layer timeout +#endif + // User customizable 32 keycodes. KEYBALL_SAFE_RANGE = QK_USER_0, }; @@ -94,7 +100,11 @@ typedef union { uint32_t raw; struct { uint8_t cpi : 7; - uint8_t sdiv : 3; // scroll divider + uint8_t sdiv : 3; // scroll divider +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE + uint8_t amle : 1; // automatic mouse layer enabled + uint8_t amlto : 4; // automatic mouse layer timeout +#endif }; } keyball_config_t; @@ -127,6 +137,11 @@ typedef struct { uint32_t scroll_snap_last; int8_t scroll_snap_tension_h; +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE + bool aml_enabled; + uint8_t aml_timeout; +#endif + uint16_t last_kc; keypos_t last_pos; report_mouse_t last_mouse; @@ -159,6 +174,12 @@ void keyball_oled_render_keyinfo(void); /// inactive layers. void keyball_oled_render_layerinfo(void); +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE +/// keyball_oled_render_amlinfo renders automatic mouse layer information to +/// OLED. +void keyball_oled_render_amlinfo(void); +#endif + /// keyball_get_scroll_mode gets current scroll mode. bool keyball_get_scroll_mode(void); @@ -176,3 +197,20 @@ uint8_t keyball_get_cpi(void); // TODO: document void keyball_set_cpi(uint8_t cpi); + +#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE +// This function is used to enable or disable the automatic mouse layer (AML). +// When it is enabled (true), the mouse layer will be activated automatically based on a set timeout. +// When it is disabled (false), the user will need to manually activate the mouse layer. +void keyball_set_aml_enabled(bool enabled); + +// This function is used to get the current timeout value for the automatic mouse layer (AML). +// The returned value is the number of milliseconds the system will wait before automatically activating the mouse layer. +// The return value is a number between 0 and 15, which corresponds to a range between 250ms and 950ms in intervals of 50ms. +uint8_t keyball_get_aml_timeout(void); + +// This function is used to set the automatic mouse layer (AML) timeout value. +// The argument is a number between 0 and 15, which corresponds to a range between 250ms and 950ms in intervals of 50ms. +// This value sets how long (in milliseconds) the system should wait before automatically activating the mouse layer when a key is pressed. +void keyball_set_aml_timeout(uint8_t timeout); +#endif diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keycodes.md b/qmk_firmware/keyboards/keyball/lib/keyball/keycodes.md index ab32f1584..24d7932f7 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keycodes.md +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keycodes.md @@ -18,6 +18,9 @@ | `SCRL_MO` | `Kb 7` | `0x7e07` | Enable scroll mode when pressing | | `SCRL_DVI` | `Kb 8` | `0x7e08` | Increase scroll divider (max D7 = 1/128) <- Most Scroll slow | | `SCRL_DVD` | `Kb 9` | `0x7e09` | Decrease scroll divider (min 0 = 1/1) <- Most Scroll fast | +| `AML_TO` | `Kb 10` | `0x7e0a` | Toggle automatic mouse layer | +| `AML_I50` | `Kb 11` | `0x7e0b` | Increase 50ms automatic mouse layer timeout(max 15=950ms) | +| `AML_D50` | `Kb 12` | `0x7e0c` | Decrease 50ms automatic mouse layer timeout(min 1=250ms) | ## 特殊キーコード @@ -34,3 +37,7 @@ | `SCRL_MO` | `Kb 7` | `0x7e07` | キーを押している間、スクロールモードになります | | `SCRL_DVI` | `Kb 8` | `0x7e08` | スクロール除数を1つ上げます(max D7 = 1/128)←最もスクロール遅い | | `SCRL_DVD` | `Kb 9` | `0x7e09` | スクロール除数を1つ下げます(min D0 = 1/1)←最もスクロール速い | +| `AML_TO` | `Kb 10` | `0x7e0a` | 自動マウスレイヤーをトグルします。 | +| `AML_I50` | `Kb 11` | `0x7e0b` | 自動マウスレイヤーのタイムアウトを50msec増やします(max 15=950ms) | +| `AML_D50` | `Kb 12` | `0x7e0c` | 自動マウスレイヤーのタイムアウトを50msec減らします(min 1=250ms) | + From 7358944124c716f0306cf77ddf3e94c36618c0a7 Mon Sep 17 00:00:00 2001 From: Tokuhiro Matsuno Date: Sun, 24 Dec 2023 03:59:34 +0900 Subject: [PATCH 02/13] add AML related custom keys to keymap --- .../keyboards/keyball/keyball39/keymaps/default/keymap.c | 2 +- qmk_firmware/keyboards/keyball/keyball39/keymaps/via/keymap.c | 2 +- .../keyboards/keyball/keyball44/keymaps/default/keymap.c | 2 +- qmk_firmware/keyboards/keyball/keyball44/keymaps/via/keymap.c | 2 +- .../keyboards/keyball/keyball46/keymaps/default/keymap.c | 2 +- qmk_firmware/keyboards/keyball/keyball46/keymaps/via/keymap.c | 2 +- .../keyboards/keyball/keyball46/keymaps/via_Both/config.h | 2 ++ .../keyboards/keyball/keyball46/keymaps/via_Both/keymap.c | 2 +- .../keyboards/keyball/keyball46/keymaps/via_Left/config.h | 2 ++ .../keyboards/keyball/keyball46/keymaps/via_Left/keymap.c | 2 +- .../keyboards/keyball/keyball61/keymaps/default/keymap.c | 2 +- qmk_firmware/keyboards/keyball/keyball61/keymaps/via/keymap.c | 2 +- 12 files changed, 14 insertions(+), 10 deletions(-) diff --git a/qmk_firmware/keyboards/keyball/keyball39/keymaps/default/keymap.c b/qmk_firmware/keyboards/keyball/keyball39/keymaps/default/keymap.c index 176cfd43d..57cc35cc5 100644 --- a/qmk_firmware/keyboards/keyball/keyball39/keymaps/default/keymap.c +++ b/qmk_firmware/keyboards/keyball/keyball39/keymaps/default/keymap.c @@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [3] = LAYOUT_universal( - RGB_TOG , _______ , _______ , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , + RGB_TOG , AML_TO , AML_I50 , AML_D50 , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_MOD , RGB_HUI , RGB_SAI , RGB_VAI , SCRL_DVI , RGB_M_K , RGB_M_X , RGB_M_G , RGB_M_T , RGB_M_TW , RGB_RMOD , RGB_HUD , RGB_SAD , RGB_VAD , SCRL_DVD , CPI_D1K , CPI_D100 , CPI_I100 , CPI_I1K , KBC_SAVE , QK_BOOT , KBC_RST , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , KBC_RST , QK_BOOT diff --git a/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/keymap.c b/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/keymap.c index 6ec255b3a..cb44bc605 100644 --- a/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/keymap.c +++ b/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/keymap.c @@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [3] = LAYOUT_universal( - RGB_TOG , _______ , _______ , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , + RGB_TOG , AML_TO , AML_I50 , AML_D50 , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_MOD , RGB_HUI , RGB_SAI , RGB_VAI , SCRL_DVI , RGB_M_K , RGB_M_X , RGB_M_G , RGB_M_T , RGB_M_TW , RGB_RMOD , RGB_HUD , RGB_SAD , RGB_VAD , SCRL_DVD , CPI_D1K , CPI_D100 , CPI_I100 , CPI_I1K , KBC_SAVE , QK_BOOT , KBC_RST , _______ , _______ , _______ , _______ , _______ , _______ , _______ , _______ , KBC_RST , QK_BOOT diff --git a/qmk_firmware/keyboards/keyball/keyball44/keymaps/default/keymap.c b/qmk_firmware/keyboards/keyball/keyball44/keymaps/default/keymap.c index 3aca79bb7..c6314542d 100644 --- a/qmk_firmware/keyboards/keyball/keyball44/keymaps/default/keymap.c +++ b/qmk_firmware/keyboards/keyball/keyball44/keymaps/default/keymap.c @@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [3] = LAYOUT_universal( - RGB_TOG , _______ , _______ , _______ , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K , + RGB_TOG , AML_TO , AML_I50 , AML_D50 , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K , RGB_MOD , RGB_HUI , RGB_SAI , RGB_VAI , _______ , SCRL_DVI , RGB_M_X , RGB_M_G , RGB_M_T , RGB_M_TW , _______ , _______ , RGB_RMOD , RGB_HUD , RGB_SAD , RGB_VAD , _______ , SCRL_DVD , CPI_D1K , CPI_D100 , CPI_I100 , CPI_I1K , _______ , KBC_SAVE , QK_BOOT , KBC_RST , _______ , _______ , _______ , _______ , _______ , _______ , KBC_RST , QK_BOOT diff --git a/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/keymap.c b/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/keymap.c index d13b48449..28bb0bf07 100644 --- a/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/keymap.c +++ b/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/keymap.c @@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [3] = LAYOUT_universal( - RGB_TOG , _______ , _______ , _______ , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K , + RGB_TOG , AML_TO , AML_I50 , AML_D50 , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K , RGB_MOD , RGB_HUI , RGB_SAI , RGB_VAI , _______ , SCRL_DVI , RGB_M_X , RGB_M_G , RGB_M_T , RGB_M_TW , _______ , _______ , RGB_RMOD , RGB_HUD , RGB_SAD , RGB_VAD , _______ , SCRL_DVD , CPI_D1K , CPI_D100 , CPI_I100 , CPI_I1K , _______ , KBC_SAVE , QK_BOOT , KBC_RST , _______ , _______ , _______ , _______ , _______ , _______ , KBC_RST , QK_BOOT diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/default/keymap.c b/qmk_firmware/keyboards/keyball/keyball46/keymaps/default/keymap.c index ce187ed5f..bf9aa851d 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/default/keymap.c +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/default/keymap.c @@ -86,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_BALL] = LAYOUT_right_ball( //,-----------------------------------------------------. ,-----------------------------------------------------. - RGB_TOG, _______, _______, _______, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K, + RGB_TOG, AML_TO , AML_I50, AML_D50, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, RGB_M_X, RGB_M_G, RGB_M_T,RGB_M_TW, _______, _______, //|--------+--------+--------+--------+--------+--------' |--------+--------+--------+--------+--------+--------| diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/keymap.c b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/keymap.c index ce187ed5f..bf9aa851d 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/keymap.c +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/keymap.c @@ -86,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_BALL] = LAYOUT_right_ball( //,-----------------------------------------------------. ,-----------------------------------------------------. - RGB_TOG, _______, _______, _______, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K, + RGB_TOG, AML_TO , AML_I50, AML_D50, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, RGB_M_X, RGB_M_G, RGB_M_T,RGB_M_TW, _______, _______, //|--------+--------+--------+--------+--------+--------' |--------+--------+--------+--------+--------+--------| diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/config.h b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/config.h index be702e5bc..00b8b7e38 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/config.h +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/config.h @@ -37,3 +37,5 @@ along with this program. If not, see . #define PRODUCT_ID 0x0003 #define TAP_CODE_DELAY 5 + +#define POINTING_DEVICE_AUTO_MOUSE_ENABLE diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/keymap.c b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/keymap.c index ed7692254..6191773a0 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/keymap.c +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/keymap.c @@ -86,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_BALL] = LAYOUT_double_balls( //,-----------------------------------------------------. ,-----------------------------------------------------. - RGB_TOG, _______, _______, _______, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K, + RGB_TOG, AML_TO , AML_I50, AML_D50, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, RGB_M_X, RGB_M_G, RGB_M_T,RGB_M_TW, _______, _______, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/config.h b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/config.h index 4332f3ff8..a9b798e69 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/config.h +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/config.h @@ -37,3 +37,5 @@ along with this program. If not, see . #define PRODUCT_ID 0x0002 #define TAP_CODE_DELAY 5 + +#define POINTING_DEVICE_AUTO_MOUSE_ENABLE diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/keymap.c b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/keymap.c index f11561315..b94d7cc32 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/keymap.c +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/keymap.c @@ -86,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_BALL] = LAYOUT_left_ball( //,-----------------------------------------------------. ,-----------------------------------------------------. - RGB_TOG, _______, _______, _______, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K, + RGB_TOG, AML_TO , AML_I50, AML_D50, _______, _______, RGB_M_P, RGB_M_B, RGB_M_R,RGB_M_SW,RGB_M_SN, RGB_M_K, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, RGB_M_X, RGB_M_G, RGB_M_T,RGB_M_TW, _______, _______, //|--------+--------+--------+--------+--------+--------| `--------+--------+--------+--------+--------+--------| diff --git a/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/keymap.c b/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/keymap.c index b89085dc5..bf5663ad9 100644 --- a/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/keymap.c +++ b/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/keymap.c @@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [3] = LAYOUT_universal( - RGB_TOG , _______ , _______ , _______ , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K , + RGB_TOG , AML_TO , AML_I50 , AML_D50 , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K , RGB_MOD , RGB_HUI , RGB_SAI , RGB_VAI , _______ , _______ , RGB_M_X , RGB_M_G , RGB_M_T , RGB_M_TW , _______ , _______ , RGB_RMOD , RGB_HUD , RGB_SAD , RGB_VAD , _______ , _______ , CPI_D1K , CPI_D100 , CPI_I100 , CPI_I1K , KBC_SAVE , KBC_RST , _______ , _______ , SCRL_DVD , SCRL_DVI , SCRL_MO , SCRL_TO , EE_CLR , EE_CLR , KC_HOME , KC_PGDN , KC_PGUP , KC_END , _______ , _______ , diff --git a/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/keymap.c b/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/keymap.c index b89085dc5..bf5663ad9 100644 --- a/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/keymap.c +++ b/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/keymap.c @@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [3] = LAYOUT_universal( - RGB_TOG , _______ , _______ , _______ , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K , + RGB_TOG , AML_TO , AML_I50 , AML_D50 , _______ , _______ , RGB_M_P , RGB_M_B , RGB_M_R , RGB_M_SW , RGB_M_SN , RGB_M_K , RGB_MOD , RGB_HUI , RGB_SAI , RGB_VAI , _______ , _______ , RGB_M_X , RGB_M_G , RGB_M_T , RGB_M_TW , _______ , _______ , RGB_RMOD , RGB_HUD , RGB_SAD , RGB_VAD , _______ , _______ , CPI_D1K , CPI_D100 , CPI_I100 , CPI_I1K , KBC_SAVE , KBC_RST , _______ , _______ , SCRL_DVD , SCRL_DVI , SCRL_MO , SCRL_TO , EE_CLR , EE_CLR , KC_HOME , KC_PGDN , KC_PGUP , KC_END , _______ , _______ , From be5dfea3255016dd509f8062360194d8bd3b2522 Mon Sep 17 00:00:00 2001 From: Tokuhiro Matsuno Date: Sun, 24 Dec 2023 04:42:33 +0900 Subject: [PATCH 03/13] automatic mouse layer OLED: fill line --- qmk_firmware/keyboards/keyball/lib/keyball/keyball.c | 1 + 1 file changed, 1 insertion(+) diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c index 0ae016917..817b7653b 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c @@ -459,6 +459,7 @@ void keyball_oled_render_amlinfo(void) { oled_write_char((keyball.aml_enabled ? 'o' : 'x'), false); oled_write_char(' ', false); oled_write(format_4d(keyball.aml_timeout), false); + oled_write_P(PSTR(" "), false); #endif } #endif From 6e72498a85c382424591f54313ccd5ad22f74e14 Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Fri, 22 Mar 2024 00:31:17 +0900 Subject: [PATCH 04/13] update QMK to last of 0.22.x --- .github/actions/checkout-qmk_firmware/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/checkout-qmk_firmware/action.yml b/.github/actions/checkout-qmk_firmware/action.yml index 4eb816b1a..19fce257f 100644 --- a/.github/actions/checkout-qmk_firmware/action.yml +++ b/.github/actions/checkout-qmk_firmware/action.yml @@ -2,7 +2,7 @@ name: 'Checkout QMK firmware' inputs: version: - default: '0.22.3' + default: '0.22.14' type: string required: false path: From 96668782cbedc34413ee055ab50e62650e0c7973 Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Fri, 22 Mar 2024 22:11:13 +0900 Subject: [PATCH 05/13] remove redundant function call which is inserted on conflict resolution. --- qmk_firmware/keyboards/keyball/lib/keyball/keyball.c | 1 - 1 file changed, 1 deletion(-) diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c index fd0ba6425..ad2c66258 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c @@ -165,7 +165,6 @@ void pointing_device_driver_init(void) { # endif #endif pmw3360_cpi_set(CPI_DEFAULT - 1); - pmw3360_reg_write(pmw3360_Motion_Burst, 0); #ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE set_auto_mouse_layer(1); From e46113dae6cdb0525fc93246e2a134186dd156dc Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Fri, 22 Mar 2024 22:12:28 +0900 Subject: [PATCH 06/13] tools to measure and compare firmware sizes --- bin/build-keyball-all.sh | 36 ++++++++++++++++++++++++++++++++++++ bin/compare-size.sh | 17 +++++++++++++++++ bin/hexsize.sh | 14 ++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 bin/build-keyball-all.sh create mode 100644 bin/compare-size.sh create mode 100644 bin/hexsize.sh diff --git a/bin/build-keyball-all.sh b/bin/build-keyball-all.sh new file mode 100644 index 000000000..e36032324 --- /dev/null +++ b/bin/build-keyball-all.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +set -u + +id=$(date "+%Y%m%d_%H%M%S") +logdir=tmp/build_log/${id} + +keyboards=() +keyboards+=(keyball39) +keyboards+=(keyball44) +keyboards+=(keyball46) +keyboards+=(keyball61) +keyboards+=(one47) + +keymaps=() +keymaps+=(test) +keymaps+=(default) +keymaps+=(via) + +mkdir -p ${logdir} + +for kb in "${keyboards[@]}" ; do + tmpmaps=(${keymaps[@]}) + # Add special keymaps for keyball46 + if [ $kb = keyball46 ] ; then + tmpmaps+=(test_Left test_Both) + tmpmaps+=(via_Left via_Both) + fi + for km in "${tmpmaps[@]}" ; do + ( make SKIP_GIT=yes KEEP_BIN=true COLOR=false "keyball/${kb}:${km}" 2>&1 | tee "${logdir}/${kb}-${km}.log" | LANG=C.utf-8 ts "[${kb}:${km}]" ) & + done +done + +wait + +$(dirname "$0")/hexsize.sh keyball_*.hex | tee "${logdir}/size.tsv" diff --git a/bin/compare-size.sh b/bin/compare-size.sh new file mode 100644 index 000000000..75aade1c4 --- /dev/null +++ b/bin/compare-size.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -u + +before=$1 ; shift +after=$1 ; shift +format=markdown + +sqlite3 ':memory:' \ + ".mode tabs" \ + ".import ${before} b" \ + ".import ${after} a" \ + ".mode ${format}" \ + "select b.name as name, format('%,d', b.size) as before, format('%,d', a.size) as after, format('%+,d', a.size - b.size) as diff, case when a.size > 28672 then 'X' else '' end as oversized from b join a on a.name = b.name;" \ + ".print ''" \ + "select format('%+g', avg(a.size - b.size)) as 'avg(diff)' from b join a on a.name = b.name;" + diff --git a/bin/hexsize.sh b/bin/hexsize.sh new file mode 100644 index 000000000..f55babfc3 --- /dev/null +++ b/bin/hexsize.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -eu + +max=28672 + +echo "name size diff check" +for f in "$@" ; do + size=$(cut -c 2,3 "$f" | awk '{s+=strtonum("0x"$1)}END{print s}') + check=$(if [ $size -gt $max ] ; then echo "X" ; else echo "O" ; fi) + sign=$(if [ $size -gt $max ] ; then echo "+" ; else echo "" ; fi) + diff=$(expr $size - $max) + echo "$f $size $sign$diff $check" +done From b60f23c7028c3ed786c327c364986e4e8ea452c1 Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Fri, 22 Mar 2024 23:01:08 +0900 Subject: [PATCH 07/13] drop all RGBLIGHT effects excpet STATIC GRADIENT from via firmwares. --- .../keyboards/keyball/keyball39/keymaps/via/config.h | 8 ++++---- .../keyboards/keyball/keyball44/keymaps/via/config.h | 8 ++++---- .../keyboards/keyball/keyball46/keymaps/via/config.h | 8 ++++---- .../keyboards/keyball/keyball46/keymaps/via_Both/config.h | 8 ++++---- .../keyboards/keyball/keyball46/keymaps/via_Left/config.h | 8 ++++---- .../keyboards/keyball/keyball61/keymaps/via/config.h | 6 +++--- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/config.h b/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/config.h index a44f9fee2..c5a6eb498 100644 --- a/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/config.h +++ b/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/config.h @@ -21,11 +21,11 @@ along with this program. If not, see . #pragma once #ifdef RGBLIGHT_ENABLE -# define RGBLIGHT_EFFECT_BREATHING -# define RGBLIGHT_EFFECT_RAINBOW_MOOD -# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# 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_KNIGHT //# define RGBLIGHT_EFFECT_CHRISTMAS # define RGBLIGHT_EFFECT_STATIC_GRADIENT //# define RGBLIGHT_EFFECT_RGB_TEST diff --git a/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/config.h b/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/config.h index a44f9fee2..c5a6eb498 100644 --- a/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/config.h +++ b/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/config.h @@ -21,11 +21,11 @@ along with this program. If not, see . #pragma once #ifdef RGBLIGHT_ENABLE -# define RGBLIGHT_EFFECT_BREATHING -# define RGBLIGHT_EFFECT_RAINBOW_MOOD -# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# 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_KNIGHT //# define RGBLIGHT_EFFECT_CHRISTMAS # define RGBLIGHT_EFFECT_STATIC_GRADIENT //# define RGBLIGHT_EFFECT_RGB_TEST diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/config.h b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/config.h index 640a31db8..aad14599c 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/config.h +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/config.h @@ -21,11 +21,11 @@ along with this program. If not, see . #pragma once #ifdef RGBLIGHT_ENABLE -# define RGBLIGHT_EFFECT_BREATHING -# define RGBLIGHT_EFFECT_RAINBOW_MOOD -# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# 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_KNIGHT //# define RGBLIGHT_EFFECT_CHRISTMAS # define RGBLIGHT_EFFECT_STATIC_GRADIENT //# define RGBLIGHT_EFFECT_RGB_TEST diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/config.h b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/config.h index 00b8b7e38..667712b58 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/config.h +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/config.h @@ -21,11 +21,11 @@ along with this program. If not, see . #pragma once #ifdef RGBLIGHT_ENABLE -# define RGBLIGHT_EFFECT_BREATHING -# define RGBLIGHT_EFFECT_RAINBOW_MOOD -# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# 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_KNIGHT //# define RGBLIGHT_EFFECT_CHRISTMAS # define RGBLIGHT_EFFECT_STATIC_GRADIENT //# define RGBLIGHT_EFFECT_RGB_TEST diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/config.h b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/config.h index a9b798e69..b9268e6c2 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/config.h +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/config.h @@ -21,11 +21,11 @@ along with this program. If not, see . #pragma once #ifdef RGBLIGHT_ENABLE -# define RGBLIGHT_EFFECT_BREATHING -# define RGBLIGHT_EFFECT_RAINBOW_MOOD -# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# 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_KNIGHT //# define RGBLIGHT_EFFECT_CHRISTMAS # define RGBLIGHT_EFFECT_STATIC_GRADIENT //# define RGBLIGHT_EFFECT_RGB_TEST diff --git a/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h b/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h index 20e09572b..c5a6eb498 100644 --- a/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h +++ b/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h @@ -21,9 +21,9 @@ along with this program. If not, see . #pragma once #ifdef RGBLIGHT_ENABLE -# define RGBLIGHT_EFFECT_BREATHING -# define RGBLIGHT_EFFECT_RAINBOW_MOOD -# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# 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 From f28ece43ac203c7c137512cdcc595b05338ab33a Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Fri, 22 Mar 2024 23:30:28 +0900 Subject: [PATCH 08/13] use AUTO_MOUSE_DEFAULT_LAYER instead of set_auto_mouse_layer(). --- .../keyboards/keyball/keyball39/keymaps/default/config.h | 1 + qmk_firmware/keyboards/keyball/keyball39/keymaps/via/config.h | 1 + .../keyboards/keyball/keyball44/keymaps/default/config.h | 1 + qmk_firmware/keyboards/keyball/keyball44/keymaps/via/config.h | 1 + .../keyboards/keyball/keyball46/keymaps/default/config.h | 1 + qmk_firmware/keyboards/keyball/keyball46/keymaps/via/config.h | 1 + .../keyboards/keyball/keyball46/keymaps/via_Both/config.h | 1 + .../keyboards/keyball/keyball46/keymaps/via_Left/config.h | 1 + .../keyboards/keyball/keyball61/keymaps/default/config.h | 1 + qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h | 1 + qmk_firmware/keyboards/keyball/lib/keyball/keyball.c | 4 ---- 11 files changed, 10 insertions(+), 4 deletions(-) diff --git a/qmk_firmware/keyboards/keyball/keyball39/keymaps/default/config.h b/qmk_firmware/keyboards/keyball/keyball39/keymaps/default/config.h index 35c90651b..ec062cf45 100644 --- a/qmk_firmware/keyboards/keyball/keyball39/keymaps/default/config.h +++ b/qmk_firmware/keyboards/keyball/keyball39/keymaps/default/config.h @@ -36,3 +36,4 @@ along with this program. If not, see . #define TAP_CODE_DELAY 5 #define POINTING_DEVICE_AUTO_MOUSE_ENABLE +#define AUTO_MOUSE_DEFAULT_LAYER 1 diff --git a/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/config.h b/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/config.h index c5a6eb498..9736eae89 100644 --- a/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/config.h +++ b/qmk_firmware/keyboards/keyball/keyball39/keymaps/via/config.h @@ -36,3 +36,4 @@ along with this program. If not, see . #define TAP_CODE_DELAY 5 #define POINTING_DEVICE_AUTO_MOUSE_ENABLE +#define AUTO_MOUSE_DEFAULT_LAYER 1 diff --git a/qmk_firmware/keyboards/keyball/keyball44/keymaps/default/config.h b/qmk_firmware/keyboards/keyball/keyball44/keymaps/default/config.h index 35c90651b..ec062cf45 100644 --- a/qmk_firmware/keyboards/keyball/keyball44/keymaps/default/config.h +++ b/qmk_firmware/keyboards/keyball/keyball44/keymaps/default/config.h @@ -36,3 +36,4 @@ along with this program. If not, see . #define TAP_CODE_DELAY 5 #define POINTING_DEVICE_AUTO_MOUSE_ENABLE +#define AUTO_MOUSE_DEFAULT_LAYER 1 diff --git a/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/config.h b/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/config.h index c5a6eb498..9736eae89 100644 --- a/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/config.h +++ b/qmk_firmware/keyboards/keyball/keyball44/keymaps/via/config.h @@ -36,3 +36,4 @@ along with this program. If not, see . #define TAP_CODE_DELAY 5 #define POINTING_DEVICE_AUTO_MOUSE_ENABLE +#define AUTO_MOUSE_DEFAULT_LAYER 1 diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/default/config.h b/qmk_firmware/keyboards/keyball/keyball46/keymaps/default/config.h index e3e77177e..e44b0be85 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/default/config.h +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/default/config.h @@ -39,3 +39,4 @@ along with this program. If not, see . #define TAP_CODE_DELAY 5 #define POINTING_DEVICE_AUTO_MOUSE_ENABLE +#define AUTO_MOUSE_DEFAULT_LAYER 1 diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/config.h b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/config.h index aad14599c..8ed16be59 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/config.h +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via/config.h @@ -36,3 +36,4 @@ along with this program. If not, see . #define TAP_CODE_DELAY 5 #define POINTING_DEVICE_AUTO_MOUSE_ENABLE +#define AUTO_MOUSE_DEFAULT_LAYER 1 diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/config.h b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/config.h index 667712b58..eedf25f42 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/config.h +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Both/config.h @@ -39,3 +39,4 @@ along with this program. If not, see . #define TAP_CODE_DELAY 5 #define POINTING_DEVICE_AUTO_MOUSE_ENABLE +#define AUTO_MOUSE_DEFAULT_LAYER 1 diff --git a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/config.h b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/config.h index b9268e6c2..30a67de66 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/config.h +++ b/qmk_firmware/keyboards/keyball/keyball46/keymaps/via_Left/config.h @@ -39,3 +39,4 @@ along with this program. If not, see . #define TAP_CODE_DELAY 5 #define POINTING_DEVICE_AUTO_MOUSE_ENABLE +#define AUTO_MOUSE_DEFAULT_LAYER 1 diff --git a/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/config.h b/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/config.h index 35c90651b..ec062cf45 100644 --- a/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/config.h +++ b/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/config.h @@ -36,3 +36,4 @@ along with this program. If not, see . #define TAP_CODE_DELAY 5 #define POINTING_DEVICE_AUTO_MOUSE_ENABLE +#define AUTO_MOUSE_DEFAULT_LAYER 1 diff --git a/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h b/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h index c5a6eb498..9736eae89 100644 --- a/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h +++ b/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h @@ -36,3 +36,4 @@ along with this program. If not, see . #define TAP_CODE_DELAY 5 #define POINTING_DEVICE_AUTO_MOUSE_ENABLE +#define AUTO_MOUSE_DEFAULT_LAYER 1 diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c index ad2c66258..312056c51 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c @@ -165,10 +165,6 @@ void pointing_device_driver_init(void) { # endif #endif pmw3360_cpi_set(CPI_DEFAULT - 1); - -#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE - set_auto_mouse_layer(1); -#endif } } From d99dca4a45616a6ae34830a8c4299eee8dafc23d Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Sat, 23 Mar 2024 12:30:26 +0900 Subject: [PATCH 09/13] define constants always remove some `ifdef` switches. --- qmk_firmware/keyboards/keyball/lib/keyball/keyball.c | 3 +-- qmk_firmware/keyboards/keyball/lib/keyball/keyball.h | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c index 312056c51..fabf62ea2 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c @@ -28,10 +28,9 @@ along with this program. If not, see . const uint8_t CPI_DEFAULT = KEYBALL_CPI_DEFAULT / 100; const uint8_t CPI_MAX = pmw3360_MAXCPI + 1; const uint8_t SCROLL_DIV_MAX = 7; -#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE + const uint16_t AML_TIMEOUT_DEFAULT = 9; const uint16_t AML_TIMEOUT_MAX = 15; -#endif keyball_t keyball = { .this_have_ball = false, diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h index 20ef4dcda..a5f484d9f 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h @@ -95,11 +95,11 @@ enum keyball_keycodes { SCRL_DVI = QK_KB_8, // Increment scroll divider SCRL_DVD = QK_KB_9, // Decrement scroll divider -#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE + // Auto mouse layer control keycodes. + // Only works when POINTING_DEVICE_AUTO_MOUSE_ENABLE is defined. AML_TO = QK_KB_10, // Toggle automatic mouse layer AML_I50 = QK_KB_11, // Increment automatic mouse layer timeout AML_D50 = QK_KB_12, // Decrement automatic mouse layer timeout -#endif // User customizable 32 keycodes. KEYBALL_SAFE_RANGE = QK_USER_0, From 68b1dfbc8d13bf3fcf97da4355d04c833f9a0fbd Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Sat, 23 Mar 2024 16:56:30 +0900 Subject: [PATCH 10/13] keball61 uses layer#2 as mouse layer --- .../keyboards/keyball/keyball61/keymaps/default/config.h | 2 +- qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/config.h b/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/config.h index ec062cf45..71e241118 100644 --- a/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/config.h +++ b/qmk_firmware/keyboards/keyball/keyball61/keymaps/default/config.h @@ -36,4 +36,4 @@ along with this program. If not, see . #define TAP_CODE_DELAY 5 #define POINTING_DEVICE_AUTO_MOUSE_ENABLE -#define AUTO_MOUSE_DEFAULT_LAYER 1 +#define AUTO_MOUSE_DEFAULT_LAYER 2 diff --git a/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h b/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h index 9736eae89..d556beb39 100644 --- a/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h +++ b/qmk_firmware/keyboards/keyball/keyball61/keymaps/via/config.h @@ -36,4 +36,4 @@ along with this program. If not, see . #define TAP_CODE_DELAY 5 #define POINTING_DEVICE_AUTO_MOUSE_ENABLE -#define AUTO_MOUSE_DEFAULT_LAYER 1 +#define AUTO_MOUSE_DEFAULT_LAYER 2 From 724e199898bb495e6799ce84b04f5b14dcc62c2e Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Sat, 23 Mar 2024 18:02:15 +0900 Subject: [PATCH 11/13] use set/get_auto_mouse_enable directly --- .../keyboards/keyball/lib/keyball/keyball.c | 13 ++++--------- .../keyboards/keyball/lib/keyball/keyball.h | 5 ----- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c index fabf62ea2..55e064c45 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c @@ -49,7 +49,6 @@ keyball_t keyball = { .pressing_keys = {' ', ' ', ' ', 0}, #ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE - .aml_enabled = 0, .aml_timeout = 0, #endif }; @@ -468,7 +467,7 @@ void keyball_oled_render_amlinfo(void) { // AML:o 5 // oled_write_P(PSTR("AML:"), false); - oled_write_char((keyball.aml_enabled ? 'o' : 'x'), false); + oled_write_char((get_auto_mouse_enable() ? 'o' : 'x'), false); oled_write_char(' ', false); oled_write(format_4d(keyball.aml_timeout), false); oled_write_P(PSTR(" "), false); @@ -514,10 +513,6 @@ void keyball_set_cpi(uint8_t cpi) { } #ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE -void keyball_set_aml_enabled(bool enabled) { - keyball.aml_enabled = enabled; - set_auto_mouse_enable(enabled); -} // This method returns current timeout value. // It will return 1 to 15. @@ -567,7 +562,7 @@ void keyboard_post_init_kb(void) { keyball_set_cpi(c.cpi); keyball_set_scroll_div(c.sdiv); #ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE - keyball_set_aml_enabled(c.amle); + set_auto_mouse_enable(c.amle); keyball_set_aml_timeout(c.amlto); #endif } @@ -653,7 +648,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { .cpi = keyball.cpi_value, .sdiv = keyball.scroll_div, #ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE - .amle = keyball.aml_enabled, + .amle = get_auto_mouse_enable(), .amlto = keyball.aml_timeout, #endif }; @@ -685,7 +680,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { #ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE case AML_TO: - keyball_set_aml_enabled(!keyball.aml_enabled); + set_auto_mouse_enable(!get_auto_mouse_enable()); break; case AML_I50: add_aml_timeout(1); diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h index a5f484d9f..2c2f95eab 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h @@ -147,7 +147,6 @@ typedef struct { int8_t scroll_snap_tension_h; #ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE - bool aml_enabled; uint8_t aml_timeout; #endif @@ -211,10 +210,6 @@ uint8_t keyball_get_cpi(void); void keyball_set_cpi(uint8_t cpi); #ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE -// This function is used to enable or disable the automatic mouse layer (AML). -// When it is enabled (true), the mouse layer will be activated automatically based on a set timeout. -// When it is disabled (false), the user will need to manually activate the mouse layer. -void keyball_set_aml_enabled(bool enabled); // This function is used to get the current timeout value for the automatic mouse layer (AML). // The returned value is the number of milliseconds the system will wait before automatically activating the mouse layer. From 9f7c5c4a7a5b8c55e9b1ac5f5311386d43b0b55e Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Sat, 23 Mar 2024 19:32:14 +0900 Subject: [PATCH 12/13] change timeout management Clarified the demarcation point about Auto Mouse Layer * don't provide wrappers for functions which QMK auto mouse layer provides * store/restore timeout to EEPROM in very simple way --- .../keyboards/keyball/lib/keyball/keyball.c | 65 ++++--------------- .../keyboards/keyball/lib/keyball/keyball.h | 19 +----- 2 files changed, 15 insertions(+), 69 deletions(-) diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c index 55e064c45..f39ec87dd 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c @@ -29,8 +29,9 @@ const uint8_t CPI_DEFAULT = KEYBALL_CPI_DEFAULT / 100; const uint8_t CPI_MAX = pmw3360_MAXCPI + 1; const uint8_t SCROLL_DIV_MAX = 7; -const uint16_t AML_TIMEOUT_DEFAULT = 9; -const uint16_t AML_TIMEOUT_MAX = 15; +const uint16_t AML_TIMEOUT_MIN = 100; +const uint16_t AML_TIMEOUT_MAX = 1000; +const uint16_t AML_TIMEOUT_QU = 50; // Quantization Unit keyball_t keyball = { .this_have_ball = false, @@ -47,10 +48,6 @@ keyball_t keyball = { .scroll_div = 0, .pressing_keys = {' ', ' ', ' ', 0}, - -#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE - .aml_timeout = 0, -#endif }; ////////////////////////////////////////////////////////////////////////////// @@ -129,15 +126,6 @@ static void add_scroll_div(int8_t delta) { keyball_set_scroll_div(v < 1 ? 1 : v); } - -#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE -static void add_aml_timeout(int8_t delta) { - int8_t v = keyball_get_aml_timeout() + delta; - keyball_set_aml_timeout(v < 1 ? 1 : v); -} -#endif - - ////////////////////////////////////////////////////////////////////////////// // Pointing device driver @@ -469,7 +457,7 @@ void keyball_oled_render_amlinfo(void) { oled_write_P(PSTR("AML:"), false); oled_write_char((get_auto_mouse_enable() ? 'o' : 'x'), false); oled_write_char(' ', false); - oled_write(format_4d(keyball.aml_timeout), false); + oled_write(format_4d(get_auto_mouse_timeout()), false); oled_write_P(PSTR(" "), false); #endif } @@ -512,37 +500,6 @@ void keyball_set_cpi(uint8_t cpi) { } } -#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE - -// This method returns current timeout value. -// It will return 1 to 15. -// -// 1=( 1-1)*50+250=250ms -// 2=( 2-1)*50+250=300ms -// ... -// 9=( 9-1)*50+250=650ms -// 10=(10-1)*50+250=700ms -// 11=(11-1)*50+250=750ms -// 12=(12-1)*50+250=800ms -// 13=(13-1)*50+250=850ms -// 14=(14-1)*50+250=900ms -// 15=(15-1)*50+250=950ms -uint8_t keyball_get_aml_timeout(void) { - return keyball.aml_timeout == 0 ? AML_TIMEOUT_DEFAULT : keyball.aml_timeout; -} - -void keyball_set_aml_timeout(uint8_t timeout) { - if (timeout > AML_TIMEOUT_MAX) { - timeout = AML_TIMEOUT_MAX; - } - keyball.aml_timeout = timeout; - if (timeout == 0) { - timeout = AML_TIMEOUT_DEFAULT; - } - set_auto_mouse_timeout((timeout-1)*50+250); -} -#endif - ////////////////////////////////////////////////////////////////////////////// // Keyboard hooks @@ -563,7 +520,7 @@ void keyboard_post_init_kb(void) { keyball_set_scroll_div(c.sdiv); #ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE set_auto_mouse_enable(c.amle); - keyball_set_aml_timeout(c.amlto); + set_auto_mouse_timeout(c.amlto == 0 ? AUTO_MOUSE_TIME : (c.amlto + 1) * AML_TIMEOUT_QU); #endif } @@ -649,7 +606,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { .sdiv = keyball.scroll_div, #ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE .amle = get_auto_mouse_enable(), - .amlto = keyball.aml_timeout, + .amlto = (get_auto_mouse_timeout() / AML_TIMEOUT_QU) - 1, #endif }; eeconfig_update_kb(c.raw); @@ -683,10 +640,16 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { set_auto_mouse_enable(!get_auto_mouse_enable()); break; case AML_I50: - add_aml_timeout(1); + { + uint16_t v = get_auto_mouse_timeout() + 50; + set_auto_mouse_timeout(MIN(v, AML_TIMEOUT_MAX)); + } break; case AML_D50: - add_aml_timeout(-1); + { + uint16_t v = get_auto_mouse_timeout() - 50; + set_auto_mouse_timeout(MAX(v, AML_TIMEOUT_MIN)); + } break; #endif diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h index 2c2f95eab..d6b640c03 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h @@ -112,7 +112,7 @@ typedef union { uint8_t sdiv : 3; // scroll divider #ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE uint8_t amle : 1; // automatic mouse layer enabled - uint8_t amlto : 4; // automatic mouse layer timeout + uint16_t amlto : 5; // automatic mouse layer timeout #endif }; } keyball_config_t; @@ -146,10 +146,6 @@ typedef struct { uint32_t scroll_snap_last; int8_t scroll_snap_tension_h; -#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE - uint8_t aml_timeout; -#endif - uint16_t last_kc; keypos_t last_pos; report_mouse_t last_mouse; @@ -208,16 +204,3 @@ uint8_t keyball_get_cpi(void); // TODO: document void keyball_set_cpi(uint8_t cpi); - -#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE - -// This function is used to get the current timeout value for the automatic mouse layer (AML). -// The returned value is the number of milliseconds the system will wait before automatically activating the mouse layer. -// The return value is a number between 0 and 15, which corresponds to a range between 250ms and 950ms in intervals of 50ms. -uint8_t keyball_get_aml_timeout(void); - -// This function is used to set the automatic mouse layer (AML) timeout value. -// The argument is a number between 0 and 15, which corresponds to a range between 250ms and 950ms in intervals of 50ms. -// This value sets how long (in milliseconds) the system should wait before automatically activating the mouse layer when a key is pressed. -void keyball_set_aml_timeout(uint8_t timeout); -#endif From 71032b7f49a5f3ef7d93b4e85cae66ab00c50c16 Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Sun, 24 Mar 2024 20:41:47 +0900 Subject: [PATCH 13/13] optimize OLED contents and font use new lib/logofont --- .../keyboards/keyball/keyball39/config.h | 4 +- .../keyboards/keyball/keyball44/config.h | 4 +- .../keyboards/keyball/keyball46/config.h | 4 +- .../keyboards/keyball/keyball61/config.h | 4 +- .../keyboards/keyball/lib/keyball/keyball.c | 103 ++++---- .../keyboards/keyball/lib/keyball/keyball.h | 8 +- .../keyboards/keyball/lib/logofont/font.md | 213 ++++++++++++++++ .../keyboards/keyball/lib/logofont/logofont.c | 234 ++++++++++++++++++ .../keyboards/keyball/lib/oledkit/oledkit.c | 20 +- qmk_firmware/keyboards/keyball/one47/config.h | 4 +- 10 files changed, 534 insertions(+), 64 deletions(-) create mode 100644 qmk_firmware/keyboards/keyball/lib/logofont/font.md create mode 100644 qmk_firmware/keyboards/keyball/lib/logofont/logofont.c diff --git a/qmk_firmware/keyboards/keyball/keyball39/config.h b/qmk_firmware/keyboards/keyball/keyball39/config.h index 0d3eb28bd..692c3aefd 100644 --- a/qmk_firmware/keyboards/keyball/keyball39/config.h +++ b/qmk_firmware/keyboards/keyball/keyball39/config.h @@ -58,7 +58,9 @@ along with this program. If not, see . #endif #ifndef OLED_FONT_H -# define OLED_FONT_H "keyboards/keyball/lib/glcdfont.c" +# define OLED_FONT_H "keyboards/keyball/lib/logofont/logofont.c" +# define OLED_FONT_START 32 +# define OLED_FONT_END 195 #endif #if !defined(LAYER_STATE_8BIT) && !defined(LAYER_STATE_16BIT) && !defined(LAYER_STATE_32BIT) diff --git a/qmk_firmware/keyboards/keyball/keyball44/config.h b/qmk_firmware/keyboards/keyball/keyball44/config.h index cd28e9341..edf569139 100644 --- a/qmk_firmware/keyboards/keyball/keyball44/config.h +++ b/qmk_firmware/keyboards/keyball/keyball44/config.h @@ -58,7 +58,9 @@ along with this program. If not, see . #endif #ifndef OLED_FONT_H -# define OLED_FONT_H "keyboards/keyball/lib/glcdfont.c" +# define OLED_FONT_H "keyboards/keyball/lib/logofont/logofont.c" +# define OLED_FONT_START 32 +# define OLED_FONT_END 195 #endif #if !defined(LAYER_STATE_8BIT) && !defined(LAYER_STATE_16BIT) && !defined(LAYER_STATE_32BIT) diff --git a/qmk_firmware/keyboards/keyball/keyball46/config.h b/qmk_firmware/keyboards/keyball/keyball46/config.h index fda41a4f4..8a1c210fb 100644 --- a/qmk_firmware/keyboards/keyball/keyball46/config.h +++ b/qmk_firmware/keyboards/keyball/keyball46/config.h @@ -59,7 +59,9 @@ along with this program. If not, see . #endif #ifndef OLED_FONT_H -# define OLED_FONT_H "keyboards/keyball/lib/glcdfont.c" +# define OLED_FONT_H "keyboards/keyball/lib/logofont/logofont.c" +# define OLED_FONT_START 32 +# define OLED_FONT_END 195 #endif #if !defined(LAYER_STATE_8BIT) && !defined(LAYER_STATE_16BIT) && !defined(LAYER_STATE_32BIT) diff --git a/qmk_firmware/keyboards/keyball/keyball61/config.h b/qmk_firmware/keyboards/keyball/keyball61/config.h index 1b148d5c6..7837197c7 100644 --- a/qmk_firmware/keyboards/keyball/keyball61/config.h +++ b/qmk_firmware/keyboards/keyball/keyball61/config.h @@ -57,7 +57,9 @@ along with this program. If not, see . #endif #ifndef OLED_FONT_H -# define OLED_FONT_H "keyboards/keyball/lib/glcdfont.c" +# define OLED_FONT_H "keyboards/keyball/lib/logofont/logofont.c" +# define OLED_FONT_START 32 +# define OLED_FONT_END 195 #endif #if !defined(LAYER_STATE_8BIT) && !defined(LAYER_STATE_16BIT) && !defined(LAYER_STATE_32BIT) diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c index f39ec87dd..5204efdbf 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.c @@ -33,6 +33,10 @@ const uint16_t AML_TIMEOUT_MIN = 100; const uint16_t AML_TIMEOUT_MAX = 1000; const uint16_t AML_TIMEOUT_QU = 50; // Quantization Unit +static const char BL = '\xB0'; // Blank indicator character +static const char LFSTR_ON[] PROGMEM = "\xB2\xB3"; +static const char LFSTR_OFF[] PROGMEM = "\xB4\xB5"; + keyball_t keyball = { .this_have_ball = false, .that_enable = false, @@ -47,7 +51,7 @@ keyball_t keyball = { .scroll_mode = false, .scroll_div = 0, - .pressing_keys = {' ', ' ', ' ', 0}, + .pressing_keys = { BL, BL, BL, BL, BL, BL, 0 }, }; ////////////////////////////////////////////////////////////////////////////// @@ -376,27 +380,42 @@ const char PROGMEM code_to_name[] = { void keyball_oled_render_ballinfo(void) { #ifdef OLED_ENABLE // Format: `Ball:{mouse x}{mouse y}{mouse h}{mouse v}` - // ` CPI{CPI} S{SCROLL_MODE} D{SCROLL_DIV}` // // Output example: // // Ball: -12 34 0 0 - // - oled_write_P(PSTR("Ball:"), false); + + // 1st line, "Ball" label, mouse x, y, h, and v. + oled_write_P(PSTR("Ball\xB1"), false); oled_write(format_4d(keyball.last_mouse.x), false); oled_write(format_4d(keyball.last_mouse.y), false); oled_write(format_4d(keyball.last_mouse.h), false); oled_write(format_4d(keyball.last_mouse.v), false); - // CPI - oled_write_P(PSTR(" CPI"), false); + + // 2nd line, empty label and CPI + oled_write_P(PSTR(" \xB1\xBC\xBD"), false); oled_write(format_4d(keyball_get_cpi()) + 1, false); - oled_write_P(PSTR("00 S"), false); - oled_write_char(keyball.scroll_mode ? '1' : '0', false); - oled_write_P(PSTR(" D"), false); + oled_write_P(PSTR("00 "), false); + + // indicate scroll mode: on/off + oled_write_P(PSTR("\xBE\xBF"), false); + if (keyball.scroll_mode) { + oled_write_P(LFSTR_ON, false); + } else { + oled_write_P(LFSTR_OFF, false); + } + + // indicate scroll divider: + oled_write_P(PSTR(" \xC0\xC1"), false); oled_write_char('0' + keyball_get_scroll_div(), false); #endif } +void keyball_oled_render_ballsubinfo(void) { +#ifdef OLED_ENABLE +#endif +} + void keyball_oled_render_keyinfo(void) { #ifdef OLED_ENABLE // Format: `Key : R{row} C{col} K{kc} {name}{name}{name}` @@ -412,20 +431,23 @@ void keyball_oled_render_keyinfo(void) { // // Key : R2 C3 K06 abc // Ball: 0 0 0 0 - // - uint8_t keycode = keyball.last_kc; - oled_write_P(PSTR("Key : R"), false); + // "Key" Label + oled_write_P(PSTR("Key \xB1"), false); + + // Row and column + oled_write_char('\xB8', false); oled_write_char(to_1x(keyball.last_pos.row), false); - oled_write_P(PSTR(" C"), false); + oled_write_char('\xB9', false); oled_write_char(to_1x(keyball.last_pos.col), false); - oled_write_P(PSTR(" K"), false); - oled_write_char(to_1x(keycode >> 4), false); - oled_write_char(to_1x(keycode), false); - oled_write_char(' ', false); + // Keycode + oled_write_P(PSTR("\xBA\xBB"), false); + oled_write_char(to_1x(keyball.last_kc >> 4), false); + oled_write_char(to_1x(keyball.last_kc), false); - // Draw pressing keys. + // Pressing keys + oled_write_P(PSTR(" "), false); oled_write(keyball.pressing_keys, false); #endif } @@ -438,30 +460,27 @@ void keyball_oled_render_layerinfo(void) { // // Layer:-23------------ // - oled_write_P(PSTR("Layer:"), false); - for (uint8_t i = 1; i < 16; i++) { - oled_write_char((layer_state_is(i) ? to_1x(i) : '_'), false); + oled_write_P(PSTR("L\xB6\xB7r\xB1"), false); + for (uint8_t i = 1; i < 8; i++) { + oled_write_char((layer_state_is(i) ? to_1x(i) : BL), false); } -#endif -} - -#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE -void keyball_oled_render_amlinfo(void) { -#ifdef OLED_ENABLE - // Format: `AML:{AML state} {AML timeout}` - // - // Output example: - // - // AML:o 5 - // - oled_write_P(PSTR("AML:"), false); - oled_write_char((get_auto_mouse_enable() ? 'o' : 'x'), false); oled_write_char(' ', false); - oled_write(format_4d(get_auto_mouse_timeout()), false); - oled_write_P(PSTR(" "), false); + +# ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE + oled_write_P(PSTR("\xC2\xC3"), false); + if (get_auto_mouse_enable()) { + oled_write_P(LFSTR_ON, false); + } else { + oled_write_P(LFSTR_OFF, false); + } + + oled_write(format_4d(get_auto_mouse_timeout() / 10) + 1, false); + oled_write_char('0', false); +# else + oled_write_P(PSTR("\xC2\xC3\xB4\xB5 ---"), false); +# endif #endif } -#endif ////////////////////////////////////////////////////////////////////////////// // Public API functions @@ -542,16 +561,16 @@ void housekeeping_task_kb(void) { static void pressing_keys_update(uint16_t keycode, keyrecord_t *record) { // Process only valid keycodes. - if (keycode >= 4 || keycode < 57) { + if (keycode >= 4 && keycode < 57) { char value = pgm_read_byte(code_to_name + keycode - 4); - char where = ' '; + char where = BL; if (!record->event.pressed) { // Swap `value` and `where` when releasing. where = value; - value = ' '; + value = BL; } // Rewrite the last `where` of pressing_keys to `value` . - for (int i = KEYBALL_OLED_MAX_PRESSING_KEYCODES - 1; i >= 0; i--) { + for (int i = 0; i < KEYBALL_OLED_MAX_PRESSING_KEYCODES; i++) { if (keyball.pressing_keys[i] == where) { keyball.pressing_keys[i] = value; break; diff --git a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h index d6b640c03..1b9be3abb 100644 --- a/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h +++ b/qmk_firmware/keyboards/keyball/lib/keyball/keyball.h @@ -74,7 +74,7 @@ along with this program. If not, see . # define KEYBALL_MODEL 44 #endif -#define KEYBALL_OLED_MAX_PRESSING_KEYCODES 3 +#define KEYBALL_OLED_MAX_PRESSING_KEYCODES 6 ////////////////////////////////////////////////////////////////////////////// // Types @@ -181,12 +181,6 @@ void keyball_oled_render_keyinfo(void); /// inactive layers. void keyball_oled_render_layerinfo(void); -#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE -/// keyball_oled_render_amlinfo renders automatic mouse layer information to -/// OLED. -void keyball_oled_render_amlinfo(void); -#endif - /// keyball_get_scroll_mode gets current scroll mode. bool keyball_get_scroll_mode(void); diff --git a/qmk_firmware/keyboards/keyball/lib/logofont/font.md b/qmk_firmware/keyboards/keyball/lib/logofont/font.md new file mode 100644 index 000000000..6ab5464bf --- /dev/null +++ b/qmk_firmware/keyboards/keyball/lib/logofont/font.md @@ -0,0 +1,213 @@ + +## blank + +``` +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +``` + +## vertical label separator + +``` +00000000 +00000000 +10101010 +00000000 +00000000 +00000000 +``` + +## right half 'R' + +``` +00000000 +00000000 +01111111 +00001001 +01110110 +00000000 +``` + +## right half 'C' + +``` +00000000 +00000000 +00111110 +01000001 +01000001 +00000000 +``` + +### dot for blank indicator + +``` +00000000 +00010000 +00010000 +00010000 +00000000 +00000000 +``` + +## "KC" in 2 chars, indicate "keycode" + +``` +00000000 +00000000 +00000000 +00000000 +01111111 +00001000 +01110111 +00000000 +00111110 +01000001 +01000001 +00000000 +``` + +## "CPI" in 2 chars + +``` +00111110 +01000001 +01000001 +00000000 +01111111 +00001001 +00000110 +00000000 +01000001 +01111111 +01000001 +00000000 +``` + +## "SCR" in 2 chars + +``` +01000110 +01001001 +00110001 +00000000 +00111110 +01000001 +01000001 +00000000 +01111111 +00001001 +01110110 +00000000 +``` + +## "DIV" in 2 chars + +``` +01111111 +01000001 +00111110 +00000000 +01000001 +01111111 +01000001 +00000000 +00011111 +01100000 +00011111 +00000000 +``` + +## "ON" in 2 chars with light background + +``` +00111110 +01100011 +01011101 +01011101 +01100011 +01111111 +01000001 +01111011 +01110111 +01000001 +00111110 +00000000 +``` + +## "OFF" in 2 chars + +``` +00000000 +00011100 +00100010 +00100010 +00011100 +00000000 +00111110 +00001010 +00000000 +00111110 +00001010 +00000000 +``` + +## "AML" in 2 chars + +``` +01111110 +00001001 +01111110 +00000000 +01111111 +00000110 +01111111 +00000000 +01111111 +01000000 +01000000 +00000000 +``` + +## inactive "ON" in 2 chars + +(not use) + +``` +00000000 +00011100 +00100010 +00100010 +00011100 +00000000 +00111110 +00000100 +00001000 +00111110 +00000000 +00000000 +``` + +## "aye" in 2 chars for "Layer" + +(not use) + +``` +01100100 +01010100 +01111000 +00000000 +01001100 +01010000 +00111100 +00000000 +00111000 +01010100 +01011000 +00000000 +``` + diff --git a/qmk_firmware/keyboards/keyball/lib/logofont/logofont.c b/qmk_firmware/keyboards/keyball/lib/logofont/logofont.c new file mode 100644 index 000000000..52fd960c3 --- /dev/null +++ b/qmk_firmware/keyboards/keyball/lib/logofont/logofont.c @@ -0,0 +1,234 @@ +// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. +// See gfxfont.h for newer custom bitmap font info. +// +// Modifictations: +// +// - KeyBall logo (0x80 ~ 0xBE) +// - Special characters (0xC0 ~ 0xDF) + +#include "progmem.h" + +// Standard ASCII 5x7 font +// clang-format off +const unsigned char font[] PROGMEM = { + + // 0x20 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, + 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, + 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, + 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, + 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, + 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, + 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, + 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, + 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, + 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, + 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, + 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, + 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, + + // 0x30 + 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, + 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, + 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, + 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, + 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, + 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, + 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, + 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, + 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, + 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, + 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, + + // 0x40 + 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, + 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, + 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, + 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, + 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, + 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, + 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, + 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, + 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, + + // 0x50 + 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, + 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, + 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, + 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, + 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, + 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, + 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, + 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, + 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, + 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, + 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, + 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, + 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, + 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, + + // 0x60 + 0x00, 0x03, 0x07, 0x08, 0x00, 0x00, + 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, + 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, + 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, + 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, + 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, + 0x18, 0x24, 0x24, 0x1C, 0x78, 0x00, + 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, + 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, + 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, + 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, + 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, + + // 0x70 + 0x7C, 0x18, 0x24, 0x24, 0x18, 0x00, + 0x18, 0x24, 0x24, 0x18, 0x7C, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, + 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, + 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, + 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, + 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, + 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, + 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, + 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, + 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, + 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, + 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, + 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, + + // Logo 1/3 (0x80 ~ 0x8F) + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xC0, 0xF0, 0xF8, 0x8C, 0x86, 0xC6, + 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFE, 0xFC, 0xFC, 0xF8, 0xE0, + 0x80, 0x00, 0x00, 0x00, 0xF0, 0xF0, + 0xF0, 0x00, 0x00, 0xC0, 0xE0, 0xF0, + 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xF8, 0xF8, 0xF8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xF8, 0xF8, + 0xF8, 0x00, 0x00, 0xF8, 0xF8, 0xF8, + + // Logo 2/3 (0x90 ~ 0x9F) + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0xE0, 0x70, 0x78, 0x68, 0x6C, 0x64, + 0xC7, 0xC7, 0xC7, 0xC7, 0xC7, 0xC7, + 0xE7, 0x3F, 0x1F, 0x0F, 0x3F, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, + 0x0F, 0x00, 0x00, 0x00, 0xFF, 0xFF, + 0xFF, 0x1E, 0x3F, 0xFF, 0xF3, 0xE1, + 0x80, 0x00, 0x00, 0xF8, 0xFC, 0xFE, + 0x36, 0x36, 0x36, 0x3E, 0xBC, 0xB8, + 0x00, 0x0E, 0x3E, 0xFE, 0xF0, 0x80, + 0xF0, 0xFE, 0x3E, 0x0E, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0x06, 0x06, 0x06, + 0xFE, 0xFE, 0xFC, 0x70, 0x00, 0xE6, + 0xF6, 0xF6, 0x36, 0x36, 0xFE, 0xFE, + 0xFC, 0x00, 0x00, 0x00, 0xFF, 0xFF, + 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, + + // Logo 3/3 (0xA0 ~ 0xAF) + 0x00, 0x00, 0x00, 0x00, 0x3C, 0x7F, + 0x63, 0x60, 0xE0, 0xC0, 0xC0, 0xC0, + 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xFF, + 0xFF, 0xC0, 0x60, 0x30, 0x18, 0x0F, + 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, + 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, + 0x03, 0x03, 0x00, 0x01, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, + 0x00, 0x70, 0x70, 0x39, 0x3F, 0x1F, + 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x01, 0x00, 0x00, 0x01, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, + 0x03, 0x00, 0x00, 0x03, 0x03, 0x03, + + // 0xB0 + 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, // B0: dot blank indicator (BL) + 0x00, 0x00, 0xAA, 0x00, 0x00, 0x00, // B1: vertical label separator + 0x3E, 0x63, 0x5D, 0x5D, 0x63, 0x7F, // B2, B3: + 0x41, 0x7B, 0x77, 0x41, 0x3E, 0x00, // "ON" in 2 chars with light bg. + 0x00, 0x1C, 0x22, 0x22, 0x1C, 0x00, // B4, B5: + 0x3E, 0x0A, 0x00, 0x3E, 0x0A, 0x00, // "OFF" in 2 chars + 0x64, 0x54, 0x78, 0x00, 0x4C, 0x50, // B6, B7: + 0x3C, 0x00, 0x38, 0x54, 0x58, 0x00, // "aye" in 2 chars + 0x00, 0x00, 0x7F, 0x09, 0x76, 0x00, // B8: right half "R" indicate "row" + 0x00, 0x00, 0x3E, 0x41, 0x41, 0x00, // B9: right halc "C" indicate "column" + 0x00, 0x00, 0x00, 0x00, 0x7F, 0x08, // BA, BB: + 0x77, 0x00, 0x3E, 0x41, 0x41, 0x00, // "KC" in 2 chars right aligned + 0x3E, 0x41, 0x41, 0x00, 0x7F, 0x09, // BC, BD: + 0x06, 0x00, 0x41, 0x7F, 0x41, 0x00, // "CPI" in 2 chars + 0x46, 0x49, 0x31, 0x00, 0x3E, 0x41, // BE, BF: + 0x41, 0x00, 0x7F, 0x09, 0x76, 0x00, // "SCR" in 2 chars indicate "scroll" + + // 0xC0 + 0x7F, 0x41, 0x3E, 0x00, 0x41, 0x7F, // C0, C1: + 0x41, 0x00, 0x1F, 0x60, 0x1F, 0x00, // "DIV" in 2 chars indicate "divider" + 0x7E, 0x09, 0x7E, 0x00, 0x7F, 0x06, // C2, D3: + 0x7F, 0x00, 0x7F, 0x40, 0x40, 0x00, // "AML" in 2 chars + +#if 0 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + // 0xD0 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +#endif +}; +// clang-format on diff --git a/qmk_firmware/keyboards/keyball/lib/oledkit/oledkit.c b/qmk_firmware/keyboards/keyball/lib/oledkit/oledkit.c index 4aec1cfc8..e8af6dbb2 100644 --- a/qmk_firmware/keyboards/keyball/lib/oledkit/oledkit.c +++ b/qmk_firmware/keyboards/keyball/lib/oledkit/oledkit.c @@ -20,20 +20,20 @@ along with this program. If not, see . #if defined(OLED_ENABLE) && !defined(OLEDKIT_DISABLE) -// clang-format off -static const char PROGMEM logo[] = { - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, - 0}; -// clang-format on - __attribute__((weak)) void oledkit_render_logo_user(void) { - oled_write_P(logo, false); + // Require `OLED_FONT_H "keyboards/keyball/lib/logofont/logofont.c"` + char ch = 0x80; + for (int y = 0; y < 3; y++) { + oled_write_P(PSTR(" "), false); + for (int x = 0; x < 16; x++) { + oled_write_char(ch++, false); + } + oled_advance_page(false); + } } __attribute__((weak)) void oledkit_render_info_user(void) { - oled_write_P(logo, false); + oledkit_render_logo_user(); } __attribute__((weak)) bool oled_task_user(void) { diff --git a/qmk_firmware/keyboards/keyball/one47/config.h b/qmk_firmware/keyboards/keyball/one47/config.h index 07f7aa39b..696ed8caf 100644 --- a/qmk_firmware/keyboards/keyball/one47/config.h +++ b/qmk_firmware/keyboards/keyball/one47/config.h @@ -45,7 +45,9 @@ along with this program. If not, see . #endif #ifndef OLED_FONT_H -# define OLED_FONT_H "keyboards/keyball/lib/glcdfont.c" +# define OLED_FONT_H "keyboards/keyball/lib/logofont/logofont.c" +# define OLED_FONT_START 32 +# define OLED_FONT_END 195 #endif #if !defined(LAYER_STATE_8BIT) && !defined(LAYER_STATE_16BIT) && !defined(LAYER_STATE_32BIT)