From fe296158c93f36cdcbcce5c5f1d0b72c5e520aea Mon Sep 17 00:00:00 2001 From: minhtrannhat Date: Tue, 27 Sep 2022 00:30:36 -0400 Subject: [PATCH] blank --- README.md | 17 ----- config.h | 10 +-- keymap.c | 179 +++++++++++++++++++++++++------------------------- nm.json | 191 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ readme.md | 133 ------------------------------------- rules.mk | 18 ++++- 6 files changed, 301 insertions(+), 247 deletions(-) delete mode 100644 README.md create mode 100644 nm.json delete mode 100644 readme.md diff --git a/README.md b/README.md deleted file mode 100644 index cf3d57f..0000000 --- a/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Lily58minh - -## Compiling and flashing - -### Compiling - -1. Install `qmk`. -2. Go into the github repo of `qmk-firmware`. -3. Clone this repo into `keyboards/lily58/keymaps/lily58minh/`. -4. Go back to `qmk-firmware` root. -5. Run `make git-submodules && git pull` to get latest changes. -6. Run `make lily58:lily58minh` to compile the firmware. - -### Flashing - -1. Plug the USB-C cable into your right half, run `make lily58:lily58minh:dfu-split-right` and press the reset button your Elite C controller. -2. Vice versa for the left half with `make lily58:lily58minh:dfu-split-left` diff --git a/config.h b/config.h index c198df9..7639721 100644 --- a/config.h +++ b/config.h @@ -6,14 +6,14 @@ #pragma once #define MASTER_LEFT -#define OLED_DRIVER_ENABLE +// #define OLED_DRIVER_ENABLE // tapping toggle for my layers #define TAPPING_TOGGLE 2 // choose IS_LEFT or IS_RIGHT for compilation and flash firmware #define IS_LEFT 1 -//#define IS_RIGHT 1 +// #define IS_RIGHT 1 // logo glitch #define WITH_GLITCH @@ -25,7 +25,7 @@ // custom font #ifdef OLED_FONT_H -#undef OLED_FONT_H +# undef OLED_FONT_H #endif #define OLED_FONT_H "navi_font.c" #undef OLED_FONT_END @@ -46,8 +46,8 @@ // no debug or trace #ifndef NO_DEBUG -#define NO_DEBUG +# define NO_DEBUG #endif #if !defined(NO_PRINT) && !defined(CONSOLE_ENABLE) -#define NO_PRINT +# define NO_PRINT #endif diff --git a/keymap.c b/keymap.c index 31b5b53..3ade09f 100644 --- a/keymap.c +++ b/keymap.c @@ -20,14 +20,16 @@ #include "ring.h" // clang-format off -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {[0] = LAYOUT(KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT, KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, KC_RBRC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_BSLS, KC_LGUI, KC_LAPO, MO(1), KC_SPC, KC_SPC, MO(2), KC_RAPC, KC_RCTL), - [1] = LAYOUT(KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_GRV, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_BRID, KC_BRIU, KC_MPRV, KC_MNXT, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO, KC_NO, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_MSTP, KC_LPRN, KC_NO, KC_NO, KC_RPRN, KC_EQL, KC_MINS, KC_NO, KC_DEL, KC_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS), - [2] = LAYOUT(KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_F11, KC_F12, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)}; +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT(KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT, KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, KC_RBRC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_BSLS, KC_LGUI, KC_LALT, MO(1), KC_SPC, KC_SPC, MO(2), KC_RALT, KC_RCTL), + [1] = LAYOUT(KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_GRV, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_BRID, KC_BRIU, KC_MPRV, KC_MNXT, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO, KC_NO, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_MSTP, KC_LPRN, KC_NO, KC_NO, KC_RPRN, KC_EQL, KC_MINS, KC_NO, KC_DEL, KC_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS), + [2] = LAYOUT(KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_7, KC_8, KC_9, KC_NO, KC_F11, KC_F12, KC_TRNS, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_4, KC_5, KC_6, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_1, KC_2, KC_3, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_0, KC_TRNS) +}; // clang-format on // sync transport typedef struct _sync_keycode_t { - uint16_t keycode; + uint16_t keycode; } sync_keycode_t; // force rigth side to update @@ -37,157 +39,154 @@ bool b_sync_need_send = false; sync_keycode_t last_keycode; oled_rotation_t oled_init_user(oled_rotation_t rotation) { - // vertical orientation - return OLED_ROTATION_270; + // vertical orientation + return OLED_ROTATION_270; } void render(gui_state_t t) { - // logo - render_logo(t); + // logo + render_logo(t); #if IS_LEFT - // left side - render_layer_frame(t); - render_gears(); + // left side + render_layer_frame(t); + render_gears(); - decay_scope(); - render_scope(t); + decay_scope(); + render_scope(t); #endif #if IS_RIGHT - // right side - render_circle(t); + // right side + render_circle(t); #endif } void update(uint16_t keycode) { #if IS_LEFT - update_scope(); + update_scope(); #endif #if IS_RIGHT - update_circle(keycode); + update_circle(keycode); #endif } void reset(void) { #if IS_LEFT - reset_scope(); + reset_scope(); #endif #if IS_RIGHT - reset_ring(); + reset_ring(); #endif } void set_wackingup_mode_clean(void) { - oled_clear(); - reset(); + oled_clear(); + reset(); } bool oled_task_user(void) { - gui_state_t t = get_gui_state(); + gui_state_t t = get_gui_state(); - // in sleep mode => turn display off - if (t == _SLEEP) { - oled_off(); - return false; - } + // in sleep mode => turn display off + if (t == _SLEEP) { + oled_off(); + return false; + } - // not in sleep mode => screen is on - oled_on(); + // not in sleep mode => screen is on + oled_on(); #ifdef WITH_BOOT - // in booting mode => display booting animation - if (t == _BOOTING) { - bool boot_finished = render_boot(); - if (boot_finished) { - // end of the boot : wacking up - set_wackingup_mode_clean(); - update_gui_state(); + // in booting mode => display booting animation + if (t == _BOOTING) { + bool boot_finished = render_boot(); + if (boot_finished) { + // end of the boot : wacking up + set_wackingup_mode_clean(); + update_gui_state(); + } + return false; } - return false; - } #endif - // in halting mode => display booting animation - if (t == _HALTING) { - render_halt(); - return false; - } + // in halting mode => display booting animation + if (t == _HALTING) { + render_halt(); + return false; + } - render(t); - return false; + render(t); + return false; } void process_key(uint16_t keycode) { - // update screen with the new key - update(keycode); + // update screen with the new key + update(keycode); - gui_state_t t = get_gui_state(); + gui_state_t t = get_gui_state(); - if (t == _IDLE) { - // wake up animation - reset(); - } + if (t == _IDLE) { + // wake up animation + reset(); + } - if (t == _BOOTING || t == _HALTING) { - // cancel booting or halting : waking_up - set_wackingup_mode_clean(); - } + if (t == _BOOTING || t == _HALTING) { + // cancel booting or halting : waking_up + set_wackingup_mode_clean(); + } - if (t == _SLEEP) { - // boot sequence - set_wackingup_mode_clean(); - reset_boot(); - } + if (t == _SLEEP) { + // boot sequence + set_wackingup_mode_clean(); + reset_boot(); + } - update_gui_state(); + update_gui_state(); } -void user_sync_a_slave_handler(uint8_t in_buflen, const void *in_data, - uint8_t out_buflen, void *out_data) { - const sync_keycode_t *m2s = (const sync_keycode_t *)in_data; - // get the last char typed on left side and update the right side - process_key(m2s->keycode); +void user_sync_a_slave_handler(uint8_t in_buflen, const void *in_data, uint8_t out_buflen, void *out_data) { + const sync_keycode_t *m2s = (const sync_keycode_t *)in_data; + // get the last char typed on left side and update the right side + process_key(m2s->keycode); } void keyboard_post_init_user(void) { - // callback for tranport sync data - transaction_register_rpc(USER_SYNC_A, user_sync_a_slave_handler); + // callback for tranport sync data + transaction_register_rpc(USER_SYNC_A, user_sync_a_slave_handler); } void housekeeping_task_user(void) { - // only for master side - if (!is_keyboard_master()) - return; + // only for master side + if (!is_keyboard_master()) return; - // only if a new char was typed - if (!b_sync_need_send) - return; + // only if a new char was typed + if (!b_sync_need_send) return; - // send the char to the slave side : sync is done - if (transaction_rpc_send(USER_SYNC_A, sizeof(last_keycode), &last_keycode)) { - b_sync_need_send = false; - } + // send the char to the slave side : sync is done + if (transaction_rpc_send(USER_SYNC_A, sizeof(last_keycode), &last_keycode)) { + b_sync_need_send = false; + } } bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if (record->event.pressed) { - // master : store keycode to sent to the other side to be process_key - last_keycode.keycode = keycode; - b_sync_need_send = true; + if (record->event.pressed) { + // master : store keycode to sent to the other side to be process_key + last_keycode.keycode = keycode; + b_sync_need_send = true; - // gui process the input - process_key(keycode); - } - return true; + // gui process the input + process_key(keycode); + } + return true; } #if IS_LEFT layer_state_t layer_state_set_user(layer_state_t state) { - // update the frame with the layer name - update_layer_frame(state); - return state; + // update the frame with the layer name + update_layer_frame(state); + return state; } #endif diff --git a/nm.json b/nm.json new file mode 100644 index 0000000..b4a701e --- /dev/null +++ b/nm.json @@ -0,0 +1,191 @@ +{ + "version": 1, + "notes": "My awesome keymap", + "documentation": "\"This file is a QMK Configurator export. You can import this at . It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: \n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n", + "keyboard": "lily58/rev1", + "keymap": "lily58_rev1_layout_mine", + "layout": "LAYOUT", + "layers": [ + [ + "KC_ESC", + "KC_1", + "KC_2", + "KC_3", + "KC_4", + "KC_5", + "KC_6", + "KC_7", + "KC_8", + "KC_9", + "KC_0", + "KC_BSPC", + "KC_TAB", + "KC_Q", + "KC_W", + "KC_E", + "KC_R", + "KC_T", + "KC_Y", + "KC_U", + "KC_I", + "KC_O", + "KC_P", + "KC_QUOT", + "KC_LSFT", + "KC_A", + "KC_S", + "KC_D", + "KC_F", + "KC_G", + "KC_H", + "KC_J", + "KC_K", + "KC_L", + "KC_SCLN", + "KC_ENT", + "KC_LCTL", + "KC_Z", + "KC_X", + "KC_C", + "KC_V", + "KC_B", + "KC_LBRC", + "KC_RBRC", + "KC_N", + "KC_M", + "KC_COMM", + "KC_DOT", + "KC_SLSH", + "KC_BSLS", + "KC_LGUI", + "KC_LALT", + "MO(1)", + "KC_SPC", + "KC_SPC", + "MO(2)", + "KC_RALT", + "KC_RCTL" + ], + [ + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_GRV", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_TRNS", + "KC_BRID", + "KC_BRIU", + "KC_MPRV", + "KC_MNXT", + "KC_NO", + "KC_LEFT", + "KC_DOWN", + "KC_UP", + "KC_RGHT", + "KC_NO", + "KC_NO", + "KC_TRNS", + "KC_VOLD", + "KC_VOLU", + "KC_MUTE", + "KC_MSTP", + "KC_LPRN", + "KC_NO", + "KC_NO", + "KC_RPRN", + "KC_EQL", + "KC_MINS", + "KC_NO", + "KC_DEL", + "KC_BSLS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_NO", + "KC_TRNS", + "KC_TRNS" + ], + [ + "KC_TRNS", + "KC_F1", + "KC_F2", + "KC_F3", + "KC_F4", + "KC_F5", + "KC_F6", + "KC_F7", + "KC_F8", + "KC_F9", + "KC_F10", + "KC_TRNS", + "KC_TRNS", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_7", + "KC_8", + "KC_9", + "KC_NO", + "KC_F11", + "KC_F12", + "KC_TRNS", + "KC_NO", + "KC_LEFT", + "KC_DOWN", + "KC_UP", + "KC_RGHT", + "KC_4", + "KC_5", + "KC_6", + "KC_NO", + "KC_NO", + "KC_TRNS", + "KC_TRNS", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_1", + "KC_2", + "KC_3", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_0", + "KC_TRNS" + ] + ], + "author": "lily58minh" +} \ No newline at end of file diff --git a/readme.md b/readme.md deleted file mode 100644 index c6d47da..0000000 --- a/readme.md +++ /dev/null @@ -1,133 +0,0 @@ -# HELL0 NAVI. Interface - -HELL0 NAVI. Interface is a GUI based en [Serial Experiments Lain](https://en.wikipedia.org/wiki/Serial_Experiments_Lain). Turn your [Lily58](https://github.com/kata0510/Lily58) keyboard into a Navi computer with its own Copland OS. - - -Ready to dive into the Wired ? - - -HELL0 NAVI provides interactive animations for both sides : -- a scope on left side for burst, WPM and active layer -- a ring on right side for the last key stroke - - - - - - - -## Typing animation - -The scope displays your burst time on a chart. The WPM is represented by an horizontal line. - -The ring display the last letter in the upper frame. Each time you enter a key, the Navi searches into the circular database and locks the position. A special animation is displayed when Enter, Backspce or Escape are struck. - - - -## Startup animation - -Your Navi boots when it leaves the sleep mode. The animation can be canceled by typing. - - - - - - - -## Waking up animation - -After a period of inactivity, the scope and the ring turn off and the Navi runs in Idle mode. A new key stroke wakes them up. - - - - - -## Idle animation - -The Copland OS is still in beta test. After a while, some visual glitches will occur. - - - - - - -## Shutdown animation -The Navi runs in sleep mode after 10 seconds in Idle mode. A nice (and difficul to render in a gif) animation is run. The OLED display turns off. - -# How to build & flash - -You need to flash each side with a specific version based on config.h configuration. - - ## Left side (master) - -IS_RIGHT needs to be commented in config.h -``` -#define IS_LEFT 1 -//#define IS_RIGHT 1 -``` -Connect the left side and flash - - ## Right side (slave) - -Comment IS_LEFT and uncomment IS_RIGHT in config.h -``` -//#define IS_LEFT 1 -#define IS_RIGHT 1 -``` -Connect the right side and flash - -# Customization - -## Logo -Logo can be change in navi_logo.c. -The new logo must be 32x32 pixels. -``` -static void render_logo_clean(void) { - // your logo here - static const char PROGMEM logo_raw[] = { - 0, 0, 0, 0, 0, 0, 128, 128, 0, 0, 128, 128, 192, 192, 204, 222, 222, 204, 192, 192, 128, 0, 0, 0, 128, 128, 0, 0, - 0, 0, 0, 0, 192, 240, 248, 28, 14, 7, 3, 249, 252, 255, 15, 7, 3, 225, 241, 241, 241, 241, 225, 3, 7, 15, 255, 252, - 249, 3, 7, 14, 28, 248, 240, 192, 192, 227, 231, 206, 28, 56, 112, 99, 15, 31, 60, 120, 240, 225, 227, 3, 3, 227, - 225, 240, 120, 60, 31, 15, 103, 112, 56, 28, 206, 231, 227, 192, 0, 1, 1, 0, 0, 0, 56, 120, 96, 192, 192, 192, - 96, 127, 63, 0, 0, 63, 127, 96, 192, 192, 192, 96, 120, 56, 0, 0, 0, 1, 1, 0, - }; - oled_write_raw_P(logo_raw, sizeof(logo_raw)); -} -``` -## Layer names - -The current version handle 3 differents layers. Names can be changed in layer_frame.h. -``` -// layer name : must be 3 chars -#define LAYER_NAME_0 "ABC" -#define LAYER_NAME_1 "NAV" -#define LAYER_NAME_2 "SPE" -``` - -## Timing - -You can tweak states timing in gui_state.h. -``` -// states timing -#define BOOTING_TIME_TRESHOLD 7000 -#define WAKING_UP_TIME_TRESHOLD 300 -#define IDLE_TIME_TRESHOLD 4000 -#define HALTING_TIME_TRESHOLD IDLE_TIME_TRESHOLD + 6000 -#define SLEEP_TIME_TRESHOLD HALTING_TIME_TRESHOLD + 8000 -``` - -## Need space ? -Boot and gliches can be commented in config.h -``` -// states timing -// logo glitch -//#define WITH_GLITCH -// boot sequence -//#define WITH_BOOT -``` - -![My Navi](https://imgur.com/eYkgoZJ.png) -> Keyboard : https://github.com/kata0510/Lily58 -> -> Case : https://github.com/BoardSodie/Lily58-Acrylic-Case - diff --git a/rules.mk b/rules.mk index a3d6bcb..0468d3a 100644 --- a/rules.mk +++ b/rules.mk @@ -13,10 +13,24 @@ LTO_ENABLE = yes SPACE_CADET_ENABLE = no GRAVE_ESC_ENABLE = no MAGIC_ENABLE = no +EXTRAKEY_ENABLE = yes +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +MOUSEKEY_ENABLE = no # Mouse keys +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. +SWAP_HANDS_ENABLE = no # Enable one-hand typing + +DEBOUNCE_TYPE = sym_eager_pk # If you want to change the display of OLED, you need to change here -SRC += ./lib/rgb_state_reader.c \ - ./burst.c \ +SRC += ./burst.c \ ./navi_logo.c \ ./gui_state.c \ ./fast_random.c \