This commit is contained in:
minhtrannhat 2022-09-27 00:30:36 -04:00
parent 268658d9ce
commit fe296158c9
No known key found for this signature in database
GPG Key ID: 894C6A5801E01CA9
6 changed files with 301 additions and 247 deletions

View File

@ -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`

View File

@ -6,14 +6,14 @@
#pragma once #pragma once
#define MASTER_LEFT #define MASTER_LEFT
#define OLED_DRIVER_ENABLE // #define OLED_DRIVER_ENABLE
// tapping toggle for my layers // tapping toggle for my layers
#define TAPPING_TOGGLE 2 #define TAPPING_TOGGLE 2
// choose IS_LEFT or IS_RIGHT for compilation and flash firmware // choose IS_LEFT or IS_RIGHT for compilation and flash firmware
#define IS_LEFT 1 #define IS_LEFT 1
//#define IS_RIGHT 1 // #define IS_RIGHT 1
// logo glitch // logo glitch
#define WITH_GLITCH #define WITH_GLITCH
@ -25,7 +25,7 @@
// custom font // custom font
#ifdef OLED_FONT_H #ifdef OLED_FONT_H
#undef OLED_FONT_H # undef OLED_FONT_H
#endif #endif
#define OLED_FONT_H "navi_font.c" #define OLED_FONT_H "navi_font.c"
#undef OLED_FONT_END #undef OLED_FONT_END
@ -46,8 +46,8 @@
// no debug or trace // no debug or trace
#ifndef NO_DEBUG #ifndef NO_DEBUG
#define NO_DEBUG # define NO_DEBUG
#endif #endif
#if !defined(NO_PRINT) && !defined(CONSOLE_ENABLE) #if !defined(NO_PRINT) && !defined(CONSOLE_ENABLE)
#define NO_PRINT # define NO_PRINT
#endif #endif

179
keymap.c
View File

@ -20,14 +20,16 @@
#include "ring.h" #include "ring.h"
// clang-format off // 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), const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[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), [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),
[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)}; [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 // clang-format on
// sync transport // sync transport
typedef struct _sync_keycode_t { typedef struct _sync_keycode_t {
uint16_t keycode; uint16_t keycode;
} sync_keycode_t; } sync_keycode_t;
// force rigth side to update // force rigth side to update
@ -37,157 +39,154 @@ bool b_sync_need_send = false;
sync_keycode_t last_keycode; sync_keycode_t last_keycode;
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
// vertical orientation // vertical orientation
return OLED_ROTATION_270; return OLED_ROTATION_270;
} }
void render(gui_state_t t) { void render(gui_state_t t) {
// logo // logo
render_logo(t); render_logo(t);
#if IS_LEFT #if IS_LEFT
// left side // left side
render_layer_frame(t); render_layer_frame(t);
render_gears(); render_gears();
decay_scope(); decay_scope();
render_scope(t); render_scope(t);
#endif #endif
#if IS_RIGHT #if IS_RIGHT
// right side // right side
render_circle(t); render_circle(t);
#endif #endif
} }
void update(uint16_t keycode) { void update(uint16_t keycode) {
#if IS_LEFT #if IS_LEFT
update_scope(); update_scope();
#endif #endif
#if IS_RIGHT #if IS_RIGHT
update_circle(keycode); update_circle(keycode);
#endif #endif
} }
void reset(void) { void reset(void) {
#if IS_LEFT #if IS_LEFT
reset_scope(); reset_scope();
#endif #endif
#if IS_RIGHT #if IS_RIGHT
reset_ring(); reset_ring();
#endif #endif
} }
void set_wackingup_mode_clean(void) { void set_wackingup_mode_clean(void) {
oled_clear(); oled_clear();
reset(); reset();
} }
bool oled_task_user(void) { 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 // in sleep mode => turn display off
if (t == _SLEEP) { if (t == _SLEEP) {
oled_off(); oled_off();
return false; return false;
} }
// not in sleep mode => screen is on // not in sleep mode => screen is on
oled_on(); oled_on();
#ifdef WITH_BOOT #ifdef WITH_BOOT
// in booting mode => display booting animation // in booting mode => display booting animation
if (t == _BOOTING) { if (t == _BOOTING) {
bool boot_finished = render_boot(); bool boot_finished = render_boot();
if (boot_finished) { if (boot_finished) {
// end of the boot : wacking up // end of the boot : wacking up
set_wackingup_mode_clean(); set_wackingup_mode_clean();
update_gui_state(); update_gui_state();
}
return false;
} }
return false;
}
#endif #endif
// in halting mode => display booting animation // in halting mode => display booting animation
if (t == _HALTING) { if (t == _HALTING) {
render_halt(); render_halt();
return false; return false;
} }
render(t); render(t);
return false; return false;
} }
void process_key(uint16_t keycode) { void process_key(uint16_t keycode) {
// update screen with the new key // update screen with the new key
update(keycode); update(keycode);
gui_state_t t = get_gui_state(); gui_state_t t = get_gui_state();
if (t == _IDLE) { if (t == _IDLE) {
// wake up animation // wake up animation
reset(); reset();
} }
if (t == _BOOTING || t == _HALTING) { if (t == _BOOTING || t == _HALTING) {
// cancel booting or halting : waking_up // cancel booting or halting : waking_up
set_wackingup_mode_clean(); set_wackingup_mode_clean();
} }
if (t == _SLEEP) { if (t == _SLEEP) {
// boot sequence // boot sequence
set_wackingup_mode_clean(); set_wackingup_mode_clean();
reset_boot(); reset_boot();
} }
update_gui_state(); update_gui_state();
} }
void user_sync_a_slave_handler(uint8_t in_buflen, const void *in_data, void user_sync_a_slave_handler(uint8_t in_buflen, const void *in_data, uint8_t out_buflen, void *out_data) {
uint8_t out_buflen, void *out_data) { const sync_keycode_t *m2s = (const sync_keycode_t *)in_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
// get the last char typed on left side and update the right side process_key(m2s->keycode);
process_key(m2s->keycode);
} }
void keyboard_post_init_user(void) { void keyboard_post_init_user(void) {
// callback for tranport sync data // callback for tranport sync data
transaction_register_rpc(USER_SYNC_A, user_sync_a_slave_handler); transaction_register_rpc(USER_SYNC_A, user_sync_a_slave_handler);
} }
void housekeeping_task_user(void) { void housekeeping_task_user(void) {
// only for master side // only for master side
if (!is_keyboard_master()) if (!is_keyboard_master()) return;
return;
// only if a new char was typed // only if a new char was typed
if (!b_sync_need_send) if (!b_sync_need_send) return;
return;
// send the char to the slave side : sync is done // send the char to the slave side : sync is done
if (transaction_rpc_send(USER_SYNC_A, sizeof(last_keycode), &last_keycode)) { if (transaction_rpc_send(USER_SYNC_A, sizeof(last_keycode), &last_keycode)) {
b_sync_need_send = false; b_sync_need_send = false;
} }
} }
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { if (record->event.pressed) {
// master : store keycode to sent to the other side to be process_key // master : store keycode to sent to the other side to be process_key
last_keycode.keycode = keycode; last_keycode.keycode = keycode;
b_sync_need_send = true; b_sync_need_send = true;
// gui process the input // gui process the input
process_key(keycode); process_key(keycode);
} }
return true; return true;
} }
#if IS_LEFT #if IS_LEFT
layer_state_t layer_state_set_user(layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) {
// update the frame with the layer name // update the frame with the layer name
update_layer_frame(state); update_layer_frame(state);
return state; return state;
} }
#endif #endif

191
nm.json Normal file
View File

@ -0,0 +1,191 @@
{
"version": 1,
"notes": "My awesome keymap",
"documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\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"
}

133
readme.md
View File

@ -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.
<img src="https://imgur.com/Yf7D6UN.gif" height="400" >
## Startup animation
Your Navi boots when it leaves the sleep mode. The animation can be canceled by typing.
<img src="https://imgur.com/EXU92Ev.gif" height="400" >
## 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.
<img src="https://imgur.com/9GWa7rR.gif" height="400" >
## Idle animation
The Copland OS is still in beta test. After a while, some visual glitches will occur.
<img src="https://imgur.com/eKZ7qgC.gif" height="400" >
## 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

View File

@ -13,10 +13,24 @@ LTO_ENABLE = yes
SPACE_CADET_ENABLE = no SPACE_CADET_ENABLE = no
GRAVE_ESC_ENABLE = no GRAVE_ESC_ENABLE = no
MAGIC_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 # If you want to change the display of OLED, you need to change here
SRC += ./lib/rgb_state_reader.c \ SRC += ./burst.c \
./burst.c \
./navi_logo.c \ ./navi_logo.c \
./gui_state.c \ ./gui_state.c \
./fast_random.c \ ./fast_random.c \