Browse Source

Update on local files

pull/23539/head
Sina Karimi 2 weeks ago
parent
commit
8456782f66
18 changed files with 1143 additions and 106 deletions
  1. +0
    -0
      keyboards/lily58/.noci
  2. +9
    -0
      keyboards/lily58/config.h
  3. +87
    -0
      keyboards/lily58/keymaps/lily58l_vii33/config.h
  4. +62
    -0
      keyboards/lily58/keymaps/lily58l_vii33/enums.h
  5. +248
    -0
      keyboards/lily58/keymaps/lily58l_vii33/keymap.c
  6. +334
    -0
      keyboards/lily58/keymaps/lily58l_vii33/oled.c
  7. +30
    -0
      keyboards/lily58/keymaps/lily58l_vii33/oled.h
  8. +171
    -0
      keyboards/lily58/keymaps/lily58l_vii33/process_record_user.c
  9. +36
    -0
      keyboards/lily58/keymaps/lily58l_vii33/process_record_user.h
  10. +11
    -0
      keyboards/lily58/keymaps/lily58l_vii33/rules.mk
  11. +47
    -0
      keyboards/lily58/light/config.h
  12. +6
    -105
      keyboards/lily58/light/info.json
  13. +15
    -0
      keyboards/lily58/light/light.c
  14. +50
    -0
      keyboards/lily58/light/light.h
  15. +5
    -1
      keyboards/lily58/light/rules.mk
  16. +1
    -0
      keyboards/lily58/lily58.c
  17. +9
    -0
      keyboards/lily58/lily58.h
  18. +22
    -0
      keyboards/lily58/rules.mk

+ 0
- 0
keyboards/lily58/.noci View File


+ 9
- 0
keyboards/lily58/config.h View File

@ -18,5 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "config_common.h"
#ifndef SOFT_SERIAL_PIN
#define SOFT_SERIAL_PIN D2
#define SERIAL_USE_MULTI_TRANSACTION
#endif
#define DIODE_DIRECTION COL2ROW
// Use the lily version to get the Lily58 logo instead of the qmk logo
#define OLED_FONT_H "lib/glcdfont_lily.c"

+ 87
- 0
keyboards/lily58/keymaps/lily58l_vii33/config.h View File

@ -0,0 +1,87 @@
/*
This is the c configuration file for the keymap
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2015 Jack Humbert
Copyright 2020 Ben Roesner (keycapsss.com)
Copyright 2022 Vii33 (https://github.com/vii33/mecha-keyboard-lily58l)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
/* Hand configuration needs to be set at flashing time:
qmk flash -kb lily58/light -km lily58l_vii33 -bl dfu-split-left
*/
#define EE_HANDS
/* Home row modifiers https://precondition.github.io/home-row-mods */
#define TAPPING_TERM 200 // mod tap hold time in ms, any tap that’s shorter will be a tap, anything longer will be held. Default is 200
#define TAPPING_TERM_PER_KEY
#define TAPPING_FORCE_HOLD_PER_KEY
#define TAPPING_TOGGLE 2
#define ENCODER_DIRECTION_FLIP // Change analog encoder rotation direction -> cw: down / volume louder
#define ENCODER_RESOLUTION 1
#define NO_MUSIC_MODE
/* Defined in other files. See ./keyboards/lily58/light/config.h:
RGBLIGHT_ENABLE
RGBLIGHT_SPLIT
RGBLIGHT_LIMIT_VAL
*/
#ifdef RGBLIGHT_ENABLE
# define RGBLIGHT_SLEEP // the RGB lighting will be switched off when the host goes to sleep
# define RGBLIGHT_HUE_STEP 1 // number of steps to cycle through the hue by
# define RGBLIGHT_SAT_STEP 2 // number of steps to increment the saturation by
# define RGBLIGHT_VAL_STEP 2 // number of steps to increment the brightness by
# define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT
# define RGBLIGHT_EFFECT_ALTERNATING
# define RGBLIGHT_EFFECT_BREATHING
# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
// # define RGBLIGHT_EFFECT_SNAKE
# define RGBLIGHT_EFFECT_STATIC_GRADIENT
# undef RGBLIGHT_EFFECT_TWINKLE
# undef RGBLIGHT_EFFECT_KNIGHT
# undef RGBLIGHT_LIMIT_VAL
# define RGBLIGHT_LIMIT_VAL 100
/* Custom Lightning Layers */
# define RGBLIGHT_LAYERS
# define RGBLIGHT_MAX_LAYERS 1 // Default is 8. Performance impact -> reduced
#endif
/* OLED */
#define OLED_TIMEOUT 240000
#define OLED_FADE_OUT
#define OLED_UPDATE_INTERVAL 100 // set oled update interval in ms (default: 0). improves matrix scan rate
#define OLED_BRIGHTNESS 130
/* Sync WPM to slave side */
#define SPLIT_WPM_ENABLE
//#define SPLIT_OLED_ENABLE
/* ACTIVATE for Elite C rev3 controller on the slave side */
// #define SPLIT_USB_DETECT
// #define NO_USB_STARTUP_CHECK

+ 62
- 0
keyboards/lily58/keymaps/lily58l_vii33/enums.h View File

@ -0,0 +1,62 @@
/*
Global enum and define file for all c files
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2015 Jack Humbert
Copyright 2020 Ben Roesner (keycapsss.com)
Copyright 2022 Vii33 (https://github.com/vii33/mecha-keyboard-lily58l)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
enum layers {
_QWERTY, //0
_LOWER, //1
_UPPER, //2
_MOD, //3
_GAME //4
};
enum custom_keycodes {
CC_AE = SAFE_RANGE,
CC_OE,
CC_UE,
CC_BckDel,
CC_SLH,
CC_QUOT,
CC_APHO,
CC_SCOLN,
CC_COLN,
CC_EXLM,
CC_SAVRGB,
CC_ALRM,
};
/* HOME Row Modifiers */
/* Left-hand home row mods */
#define GUI_S LGUI_T(KC_S)
#define ALT_D LALT_T(KC_D)
#define CTL_F LCTL_T(KC_F)
/* Right-hand home row mods */
#define CTL_J RCTL_T(KC_J)
#define ALT_K LALT_T(KC_K)
#define GUI_L RGUI_T(KC_L)
#define SHFT_QT LSFT_T(CC_QUOT)
#define SHFT_AE RSFT_T(CC_AE)

+ 248
- 0
keyboards/lily58/keymaps/lily58l_vii33/keymap.c View File

@ -0,0 +1,248 @@
/* Copyright 2017 F_YUUCHI
* Copyright 2020 Drashna Jaelre <@drashna>
* Copyright 2020 Ben Roesner (keycapsss.com)
* Copyright 2022 Vii33 (https://github.com/vii33/mecha-keyboard-lily58l)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#include "enums.h"
#include "oled.h"
#include "process_record_user.h"
/* Layer quick names */
#define LOWER MO(_LOWER)
#define UPPER MO(_UPPER)
#define MOD TT(_MOD)
#define GAME TG(_GAME)
/* Key quick names */
#define QC_AT S(KC_2) // @
#define QC_EUR ALGR(KC_5) //
#define QC_SS ALGR(KC_S) // ß
#define QC_SECT S(ALGR(KC_S)) // §
#define QC_DEG S(ALGR(KC_SCLN)) // °
#define QC_HAT S(KC_6) // ^
#define QC_AND S(KC_7) // &
#define QC_DQUT S(KC_QUOT) // "
#define QC_UNDO LCTL(KC_Z)
#define QC_REDO LCTL(KC_Y)
#define QC_CTLX LCTL(KC_X)
#define QC_CTLC LCTL(KC_C)
#define QC_CTLV LCTL(KC_V)
#define GMESCN LSFT(KC_F11)
#define CTALDEL LCTL(LALT(KC_DEL)) // CTRL+ALT+DEL
#define WINSCNS SGUI(KC_S) // WIN+SHIFT+S >> Screenshot
#define MUTE_MI RCS(KC_M) // CTRL+SHIFT+M or Windows 11: WIN + Alt + K
#define SHWI_T SGUI(KC_T) // WIN+SHIFT+T >> OCR
#define WRDLFT C(KC_LEFT) // CTRL+LEFT (Word left)
#define WRDRGT C(KC_RIGHT) // CTRL+RIGHT (Word right)
/* Animation Speeds */
//const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5};
const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {200, 150, 100};
#ifdef RGBLIGHT_LAYERS
/* Lightning Layers as status indicators. -> Array of segments */
const rgblight_segment_t PROGMEM mod_indicator[] = RGBLIGHT_LAYER_SEGMENTS(
{6, 4, HSV_GREEN} // First segment: Turn on 5 LEDs starting with #4
);
const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
mod_indicator // 0
);
void keyboard_post_init_user(void) {
rgblight_layers = my_rgb_layers; // Enable the LED layers
}
/* Callback when layer changes */
layer_state_t layer_state_set_user(layer_state_t state) {
/* Set my_rgb_layer 0 when comparison is true (here: _MOD Layer active) */
rgblight_set_layer_state(0, layer_state_cmp(state, _MOD));
return state;
}
#endif
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* QWERTY Example
* ,-----------------------------------------. ,-----------------------------------------.
* | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | Tab | Q | W | E | R | T | | Y | U | I | O | P | Ü |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | ' | A | S | D | F | G |-------. .-------| H | J | K | L | Ö | Ä |
* |------+------+------+------+------+------| Volume| | Scroll|------+------+------+------+------+------|
* | ` | Z | X | C | V | B |-------| |-------| N | M | , | . | ? |Enter |
* `-----------------------------------------/ / \ \-----------------------------------------'
* | / | MOD |LOWER | /Space / \Space \ |BackSP|UPPER |Delete|
* | | | |/ / \ \ | | | |
* `----------------------------' '------''--------------------'
*/
[_QWERTY] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, CC_UE,
SHFT_QT, KC_A, GUI_S, ALT_D, CTL_F, KC_G, KC_H, CTL_J, ALT_K, GUI_L, CC_OE, SHFT_AE,
CC_APHO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_MUTE, MUTE_MI, KC_N, KC_M, CC_SCOLN, CC_COLN, CC_EXLM, KC_ENTER,
CC_SLH, MOD, LOWER, KC_SPC, KC_SPC, KC_BSPC, UPPER, KC_DEL
),
[_LOWER] = LAYOUT(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
_______, SHWI_T, WINSCNS, QC_UNDO, QC_REDO, KC_ENTER, XXXXXXX, WRDLFT, KC_UP, WRDRGT, KC_PGUP, KC_F12,
_______, KC_BSPC, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______,
XXXXXXX, KC_DEL, QC_CTLX, QC_CTLC, QC_CTLV, XXXXXXX, _______, _______, XXXXXXX, KC_HOME, KC_BSPC, KC_END, XXXXXXX, KC_ENT,
_______, _______, _______, _______, _______, _______, _______, _______
),
[_UPPER] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, QC_AT, KC_TILD, QC_EUR, KC_PSCR, _______, KC_PAST, KC_LT, KC_LCBR, KC_RCBR, KC_PMNS, _______,
KC_PIPE, XXXXXXX, QC_SS, XXXXXXX, XXXXXXX, CTALDEL, KC_PSLS, KC_EQL, KC_LPRN, KC_RPRN, KC_PPLS, QC_DQUT,
QC_DEG, XXXXXXX, QC_CTLX, QC_CTLC, QC_CTLV, XXXXXXX, _______, _______, QC_HAT, KC_GT, KC_LBRC, KC_RBRC, QC_AND, KC_PENT,
_______, _______, _______, KC_LSFT, _______, _______, _______, _______
),
[_MOD] = LAYOUT(
RGB_TOG, KC_1, KC_2, KC_3, KC_4, KC_5, RGB_M_P, RGB_M_B, RGB_M_SW, RGB_M_G, KC_COMMA, GAME,
RGB_MOD, XXXXXXX, KC_BSPC, KC_UP, KC_DEL, XXXXXXX, KC_PAST, KC_P7, KC_P8, KC_P9, KC_PPLS, KC_PERC,
RGB_M_SN, XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT, XXXXXXX, KC_PSLS, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_EQL,
CC_ALRM, XXXXXXX, KC_HOME, XXXXXXX, KC_END, KC_NUM, CC_SAVRGB, _______, KC_P0, KC_P1, KC_P2, KC_P3, KC_DOT, KC_PENT,
XXXXXXX, _______, _______, KC_SPC, _______, _______, _______, _______
),
[_GAME] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, GAME,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_PGUP,
KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_F6, KC_PGDN,
KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, GMESCN, KC_F12, KC_N, KC_M, KC_LEFT, KC_UP, KC_RIGHT, KC_DOWN,
KC_CAPS, KC_LALT, KC_SPC, KC_SPC, KC_ENT, KC_BSPC, KC_F7, KC_DEL
)
};
/* -------------------------------------------------------------------------------- */
/* Different tapping timings */
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case CTL_F:
case CTL_J:
return TAPPING_TERM - 20;
case GUI_S:
case GUI_L:
return TAPPING_TERM + 150;
case SHFT_QT:
case SHFT_AE:
return TAPPING_TERM - 80;
case MOD:
return TAPPING_TERM - 70;
default:
return TAPPING_TERM;
}
}
/* Tapping Force Hold done per key. Better than general setting. See also https://github.com/qmk/qmk_firmware/blob/master/docs/tap_hold.md */
bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case GUI_S:
case ALT_D:
case CTL_F:
case CTL_J:
case ALT_K:
case GUI_L:
case SHFT_QT:
case SHFT_AE:
return true;
default:
return false;
}
}
/* Rotary encoder */
#ifdef ENCODER_ENABLE
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { // Encoder on master side
if (IS_LAYER_ON(_MOD)) // _MOD LAYER
{
if ( get_mods() & MOD_MASK_SHIFT ) {
if (clockwise) {
rgblight_increase_sat_noeeprom();
} else {
rgblight_decrease_sat_noeeprom();
}
} else {
if (clockwise) {
rgblight_increase_hue_noeeprom();
} else {
rgblight_decrease_hue_noeeprom();
}
}
} else { // _QWERTY LAYER and others
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
} else if (index == 1) { // Encoder on slave side
if(IS_LAYER_ON(_LOWER)) { // _LOWER LAYER
if (clockwise) {
tap_code(KC_PGDN);
} else {
tap_code(KC_PGUP);
}
} else if (IS_LAYER_ON(_MOD)) // _MOD LAYER
{
if ( get_mods() & MOD_MASK_SHIFT ) {
if (clockwise) {
rgblight_increase_speed_noeeprom();
} else {
rgblight_decrease_speed_noeeprom();
}
} else {
if (clockwise) {
rgblight_increase_val_noeeprom();
} else {
rgblight_decrease_val_noeeprom();
}
}
} else { // _QWERTY LAYER and others
if (clockwise) {
tap_code(KC_DOWN);
} else {
tap_code(KC_UP);
}
}
}
return true;
}
#endif // ENCODER_ENABLE

+ 334
- 0
keyboards/lily58/keymaps/lily58l_vii33/oled.c View File

@ -0,0 +1,334 @@
/*
SSD1306 OLED update loop, make sure to enable OLED_ENABLE=yes in rules.mk
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2015 Jack Humbert
Copyright 2020 Ben Roesner (keycapsss.com)
Copyright 2022 Vii33 (https://github.com/vii33/mecha-keyboard-lily58l)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef OLED_ENABLE
# include "oled.h"
# include "enums.h"
# include "process_record_user.h"
uint8_t current_wpm = 0;
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (is_keyboard_master()) {
return OLED_ROTATION_270;
} else {
return OLED_ROTATION_270;
}
}
/* OLED keylogging was disabled */
// #define KEYLOG_LEN 6
// char keylog_str[KEYLOG_LEN] = {};
// uint8_t keylogs_str_idx = 0;
// uint16_t log_timer = 0;
// const char code_to_name[60] = {
// ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
// 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
// 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
// '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
// 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\',
// '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '
// };
// void add_keylog(uint16_t keycode) {
// if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) {
// keycode = keycode & 0xFF;
// }
// for (uint8_t i = KEYLOG_LEN - 1; i > 0; i--) {
// keylog_str[i] = keylog_str[i - 1];
// }
// if (keycode < 60) {
// keylog_str[0] = code_to_name[keycode];
// }
// keylog_str[KEYLOG_LEN - 1] = 0;
// log_timer = timer_read();
// }
// void update_log(void) {
// if (timer_elapsed(log_timer) > 750) {
// add_keylog(0); // -> Gradually moves put in characters out of the image - needed for privacy reasons!
// }
// }
// void render_keylogger_status(void) {
// oled_write(keylog_str, false);
// }
void render_default_layer_state(void) {
switch (get_highest_layer(layer_state)) {
case _QWERTY:
oled_write_P(PSTR("QWRTY"), false);
break;
case _LOWER:
oled_write_P(PSTR("LOWER"), false);
break;
case _UPPER:
oled_write_P(PSTR("UPPER"), false);
break;
case _MOD:
oled_write_ln_P(PSTR("MOD"), true);
break;
case _GAME:
oled_write_ln_P(PSTR("GAME"), true);
break;
default:
oled_write_ln_P(PSTR("ndef"), true);
}
}
void render_keylock_status(led_t led_state) {
// oled_write_ln_P(PSTR("Lock"), false);
oled_write_P(PSTR(" "), false);
oled_write_P(PSTR("N"), led_state.num_lock);
oled_write_P(PSTR("C"), led_state.caps_lock);
oled_write_P(PSTR("S"), led_state.scroll_lock);
}
void render_mod_status(uint8_t modifiers) {
// oled_write_ln_P(PSTR("Mods"), false);
oled_write_P(PSTR(" "), false);
oled_write_P(PSTR("S"), (modifiers & MOD_MASK_SHIFT));
oled_write_P(PSTR("C"), (modifiers & MOD_MASK_CTRL));
oled_write_P(PSTR("A"), (modifiers & MOD_MASK_ALT));
oled_write_P(PSTR("G"), (modifiers & MOD_MASK_GUI));
}
void render_kb_status(void) {
render_logo();
oled_set_cursor(0, 3);
oled_write_P(PSTR("-----"), false); // Add a empty line
render_default_layer_state();
oled_write_P(PSTR("-----"), false); // Add a empty line
render_keylock_status(host_keyboard_led_state());
oled_write_P(PSTR("-----"), false);
render_mod_status(get_mods());
oled_write_P(PSTR("-----"), false);
// render_keylogger_status();
/* Write words per minute counter */
// oled_write_P(PSTR("WPM: "), false);
// oled_write(get_u8_str(get_current_wpm(), '0'), false);
}
/* Callback for OLED update cycle */
/* ------------------------------ */
uint8_t current_frame = 0;
uint32_t anim_sleep_timer = 0;
bool oled_task_user(void) {
current_wpm = get_current_wpm();
/* fixes screen on and off bug -> Turn on in process_record_user */
if (current_wpm > 0) {
oled_on();
anim_sleep_timer = timer_read32();
}
else if ( timer_elapsed32(anim_sleep_timer) > OLED_TIMEOUT && is_oled_on() ) {
oled_off();
return false;
}
if (is_oled_on() == true) { // Render enables screen, so only call it when screen is already on
// update_log();
if (is_keyboard_master()) {
render_kb_status();
render_luna(0, 13);
}
else {
render_right_oled();
}
}
return false;
}
/* ------------------------------ */
/* ------ LUNA PET START ------ */
/* settings */
# define MIN_WALK_SPEED 1
# define MIN_RUN_SPEED 40
# define ANIM_FRAME_DURATION 250 // how long each frame lasts in ms
# define ANIM_SIZE 96 // number of bytes in array. If you change sprites, minimize for adequate firmware size. max is 1024
/* timers */
uint32_t anim_timer = 0;
bool lunaIsSneaking = false;
bool lunaIsJumping = false;
bool lunaIsBarking = false;
bool lunaShowedJump = true;
/* logic */
void render_luna(int LUNA_X, int LUNA_Y) { // params: chunk position on LED font
/* Sit */
static const char PROGMEM sit[2][ANIM_SIZE] = {/* 'sit1', 32x22px */
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1c, 0x02, 0x05, 0x02, 0x24, 0x04, 0x04, 0x02, 0xa9, 0x1e, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x08, 0x68, 0x10, 0x08, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x82, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0c, 0x10, 0x10, 0x20, 0x20, 0x20, 0x28, 0x3e, 0x1c, 0x20, 0x20, 0x3e, 0x0f, 0x11, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
/* 'sit2', 32x22px */
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1c, 0x02, 0x05, 0x02, 0x24, 0x04, 0x04, 0x02, 0xa9, 0x1e, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x90, 0x08, 0x18, 0x60, 0x10, 0x08, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0e, 0x82, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0c, 0x10, 0x10, 0x20, 0x20, 0x20, 0x28, 0x3e, 0x1c, 0x20, 0x20, 0x3e, 0x0f, 0x11, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
/* Walk */
static const char PROGMEM walk[2][ANIM_SIZE] = {/* 'walk1', 32x22px */
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x90, 0x90, 0x90, 0xa0, 0xc0, 0x80, 0x80, 0x80, 0x70, 0x08, 0x14, 0x08, 0x90, 0x10, 0x10, 0x08, 0xa4, 0x78, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x18, 0xea, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x20, 0x20, 0x3c, 0x0f, 0x11, 0x1f, 0x03, 0x06, 0x18, 0x20, 0x20, 0x3c, 0x0c, 0x12, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
/* 'walk2', 32x22px */
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x20, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x28, 0x10, 0x20, 0x20, 0x20, 0x10, 0x48, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x20, 0xf8, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x30, 0xd5, 0x20, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x30, 0x0c, 0x02, 0x05, 0x09, 0x12, 0x1e, 0x02, 0x1c, 0x14, 0x08, 0x10, 0x20, 0x2c, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}};
/* Run */
static const char PROGMEM run[2][ANIM_SIZE] = {/* 'run1', 32x22px */
{
0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x08, 0x08, 0xc8, 0xb0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x3c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0xc4, 0xa4, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc8, 0x58, 0x28, 0x2a, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x09, 0x04, 0x04, 0x04, 0x04, 0x02, 0x03, 0x02, 0x01, 0x01, 0x02, 0x02, 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
},
/* 'run2', 32x22px */
{
0x00, 0x00, 0x00, 0xe0, 0x10, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x78, 0x28, 0x08, 0x10, 0x20, 0x30, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0xb0, 0x50, 0x55, 0x20, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, 0x02, 0x1e, 0x20, 0x20, 0x18, 0x0c, 0x14, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}};
/* Bark */
static const char PROGMEM bark[2][ANIM_SIZE] = {/* 'bark1', 32x22px */
{
0x00, 0xc0, 0x20, 0x10, 0xd0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, 0x3c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc8, 0x48, 0x28, 0x2a, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, 0x02, 0x02, 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
/* 'bark2', 32x22px */
{
0x00, 0xe0, 0x10, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, 0x40, 0x2c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x48, 0x28, 0x2a, 0x10, 0x0f, 0x20, 0x4a, 0x09, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, 0x02, 0x02, 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}};
/* Sneak */
static const char PROGMEM sneak[2][ANIM_SIZE] = {/* 'sneak1', 32x22px */
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x21, 0xf0, 0x04, 0x02, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x04, 0x04, 0x04, 0x03, 0x01, 0x00, 0x00, 0x09, 0x01, 0x80, 0x80, 0xab, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x20, 0x20, 0x3c, 0x0f, 0x11, 0x1f, 0x02, 0x06, 0x18, 0x20, 0x20, 0x38, 0x08, 0x10, 0x18, 0x04, 0x04, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00,
},
/* 'sneak2', 32x22px */
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xa0, 0x20, 0x40, 0x80, 0xc0, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x41, 0xf0, 0x04, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x02, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x40, 0x40, 0x55, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x30, 0x0c, 0x02, 0x05, 0x09, 0x12, 0x1e, 0x04, 0x18, 0x10, 0x08, 0x10, 0x20, 0x28, 0x34, 0x06, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
}};
// current_wpm = get_current_wpm();
/* animation timer */
if (timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
anim_timer = timer_read32();
/* jump */
if (lunaIsJumping || !lunaShowedJump) {
/* clear */
oled_set_cursor(LUNA_X, LUNA_Y + 2);
oled_write(" ", false);
oled_set_cursor(LUNA_X, LUNA_Y - 1);
lunaShowedJump = true;
} else {
/* clear */
oled_set_cursor(LUNA_X, LUNA_Y - 1);
oled_write(" ", false);
oled_set_cursor(LUNA_X, LUNA_Y);
}
/* switch frame */
current_frame = (current_frame + 1) % 2;
/* current status */
if (lunaIsBarking) {
oled_write_raw_P(bark[abs(1 - current_frame)], ANIM_SIZE);
} else if (lunaIsSneaking) {
oled_write_raw_P(sneak[abs(1 - current_frame)], ANIM_SIZE);
} else if (current_wpm <= MIN_WALK_SPEED) {
oled_write_raw_P(sit[abs(1 - current_frame)], ANIM_SIZE);
} else if (current_wpm <= MIN_RUN_SPEED) {
oled_write_raw_P(walk[abs(1 - current_frame)], ANIM_SIZE);
} else {
oled_write_raw_P(run[abs(1 - current_frame)], ANIM_SIZE);
}
}
}
/* ------ LUNA PET END ------ */
/* Remders Lily58 logo. For different animations see https://github.com/vii33/mecha-keyboard-lily58l */
void render_right_oled(void) {
if (timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
anim_timer = timer_read32();
/* switch frame */
current_frame = (current_frame + 1) % 2;
static const char PROGMEM lily58_logo[2][512] = {
/* frame 1, 32x128px */
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,192,192,192,192,192,192,224,224,192,224,192,192,192,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48,248, 94,175,255,255,255,255, 7, 7,255,255,255, 7, 7,255,255,255,255, 94,184,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 15,125,254,255,255,231,231,207,207,207,207,207,207,199,231,255,255,255,125, 30, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 3, 3, 1, 0, 0, 0, 1, 3, 3, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240,208,240,112, 48,176,176,176,176,176, 48,112,240,208,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,240,247,247, 0,176,184, 15,239,224,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 11, 15, 15, 15, 15, 12, 13, 13, 12, 15, 15, 15, 11, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,192,192,128, 96, 16,136, 8, 16, 8,136, 16, 96,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 28, 62,129, 1, 0,112,249,248,121, 32, 1, 0, 1, 8, 3, 10, 2, 2,140,112, 0, 0, 0, 0, 0, 0, 0,192, 64, 32, 16, 24, 8,136,144, 18, 76,224,248,255,255, 2, 4, 4, 4, 4, 4, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7,196,200,232,232,209, 17,216,236,239,207,195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,254,254, 2, 2,254,254,254,254,254, 2,254, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 38, 74,254, 0, 0, 0, 0, 0, 0, 0, 0, 31,251,248, 24, 27, 27,251,251,251,248, 27,248, 24, 24, 24, 24, 24, 24, 24, 56,152,249,250, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255, 0, 0, 0,255,255,255,255, 0,255, 0, 0, 0, 0, 0, 0, 0, 73, 36,255,255, 0, 0, 0, 0, 0,
},
/* frame 2, 32x128px */
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,192,192,192,192,192,192,224,224,192,224,192,192,192,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48,248,254, 95,175,255,255,255, 7, 7,255,255,255, 7, 7,255,255,255, 95,190,248,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 15,127,253,254,255,231,231,207,207,207,207,207,207,199,231,255,255,253,126, 31, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 3, 3, 1, 0, 0, 0, 1, 3, 3, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240,208,240,112, 48,176,176,176,176,176, 48,112,240,208,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,240,247,247, 0,176,184, 15,239,224,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 11, 15, 15, 15, 15, 12, 13, 13, 12, 15, 15, 15, 11, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64,224,224, 64, 48,136, 68,132, 8,132, 68,136, 48,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 14, 31, 64, 0, 0, 56,124,252,188, 16, 0, 0, 0, 4, 1, 5, 1,129, 70, 56, 0, 0, 0, 0, 0, 0, 0,224,160, 16, 8, 12, 4,196,200, 9, 38,240,252,255,127, 1, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 98,100,116,116,104, 8,108,118,119,103, 97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,254,254, 2, 2,254,254,254,254,254, 2,254, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 38, 74,254, 0, 0, 0, 0, 0, 0, 0, 0, 31,251,248, 24, 27, 27,251,251,251,248, 27,248, 24, 24, 24, 24, 24, 24, 24, 56,152,249,250, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255, 0, 0, 0,255,255,255,255, 0,255, 0, 0, 0, 0, 0, 0, 0, 73, 36,255,255, 0, 0, 0, 0, 0,
}
};
oled_write_raw_P(lily58_logo[abs(1 - current_frame)], 512);
}
}
/* vii33 logo. 32x8px */
void render_logo(void) {
static const char PROGMEM vii33_logo[] = {
0, 15, 48, 64, 48, 15, 0, 65,127, 65, 0, 65,127, 65, 0, 34, 65, 73, 73, 54, 0, 34, 65, 73, 73, 54, 0, 96, 24, 6, 1, 0,
};
oled_write_raw_P(vii33_logo, sizeof(vii33_logo));
}
#endif // OLED_ENABLE

+ 30
- 0
keyboards/lily58/keymaps/lily58l_vii33/oled.h View File

@ -0,0 +1,30 @@
/*
Header file for OLED code
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2015 Jack Humbert
Copyright 2020 Ben Roesner (keycapsss.com)
Copyright 2022 Vii33 (https://github.com/vii33/mecha-keyboard-lily58l)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include QMK_KEYBOARD_H
void render_luna(int LUNA_X, int LUNA_Y);
void render_logo(void);
void render_right_oled(void);

+ 171
- 0
keyboards/lily58/keymaps/lily58l_vii33/process_record_user.c View File

@ -0,0 +1,171 @@
/*
Process record user file (key pressed callback)
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2015 Jack Humbert
Copyright 2020 Ben Roesner (keycapsss.com)
Copyright 2022 Vii33 (https://github.com/vii33/mecha-keyboard-lily58l)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "process_record_user.h"
#include "enums.h"
#include QMK_KEYBOARD_H
uint8_t mods_state;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
/* on key release */
if (record->event.pressed == false) {
/* Luna pet */
lunaIsJumping = false;
lunaIsSneaking = false;
lunaIsBarking = false;
return true; // Don't process keys further on key release (currently we don't need it)
}
mods_state = get_mods(); // Store the current modifier state in the variable for later reference
/* For OLED Key logger */
// if (record->event.pressed) {
// // add_keylog(keycode);
// }
switch (keycode)
{
case KC_SPC:
lunaIsJumping = true;
lunaShowedJump = false;
break;
case CTL_J:
case CTL_F:
lunaIsSneaking = true;
break;
case ALT_K:
case ALT_D:
lunaIsBarking = true;
break;
case SHFT_AE:
if (record->tap.count > 0) { // The key is being tapped.
tap_code16(ALGR(KC_Q)); // tapcode16() allows you to use modifiers!
return false;
}
break;
case CC_OE:
tap_code16(ALGR(KC_P));
break;
case CC_UE:
tap_code16(ALGR(KC_Y));
break;
case CC_BckDel:
if ( mods_state & MOD_MASK_SHIFT ) { // Shift pressed
del_mods(MOD_MASK_SHIFT); // cancel the shifts so they are not applied to the keycodes
tap_code(KC_DEL);
set_mods(mods_state);
}else { // No shift is pressed
tap_code(KC_BSPC);
}
break;
case CC_SLH:
if ( mods_state & MOD_MASK_SHIFT ) {
del_mods(MOD_MASK_SHIFT);
tap_code(KC_BSLS); // backslash
set_mods(mods_state);
}else {
tap_code(KC_SLSH); // /
}
break;
case CC_APHO:
if ( mods_state & MOD_MASK_SHIFT ) {
del_mods(MOD_MASK_SHIFT);
tap_code16(ALGR(KC_QUOT)); // ´ aigu
set_mods(mods_state);
}else {
tap_code(KC_GRV); // ` grave
tap_code(KC_SPC); // needed bc. of dead key
}
break;
case SHFT_QT:
if (record->tap.count > 0) { // The key is being tapped.
if ( mods_state & MOD_MASK_SHIFT ) {
tap_code(KC_QUOT); // "
tap_code(KC_SPC); // needed bc. of dead key
}else {
tap_code(KC_QUOT); // '
tap_code(KC_SPC); // needed bc. of dead key
}
return false; // important here to avoid ghost key strokes
}
break;
case CC_COLN:
if ( mods_state & MOD_MASK_SHIFT ) {
//del_mods(MOD_MASK_SHIFT);
tap_code(KC_SCLN); // :
}else {
tap_code(KC_DOT); // . (dot)
}
break;
case CC_SCOLN:
if ( mods_state & MOD_MASK_SHIFT ) {
del_mods(MOD_MASK_SHIFT);
tap_code(KC_SCLN); // ;
set_mods(mods_state);
}else {
tap_code(KC_COMM); // , (comma)
}
break;
case CC_EXLM:
if ( mods_state & MOD_MASK_SHIFT ) {
del_mods(MOD_MASK_SHIFT);
tap_code16(KC_EXLM); // !
set_mods(mods_state);
}else {
tap_code16(KC_QUES); // ?
}
break;
#ifdef RGBLIGHT_ENABLE
case CC_SAVRGB: // Saves color config to eeprom. Used to save eeprom write cycles
rgblight_sethsv(rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val());
rgblight_set_speed( rgblight_get_speed() );
break;
case CC_ALRM: // RGB alternate blinking
rgblight_mode(RGBLIGHT_MODE_ALTERNATING);
break;
#endif
}
return true;
}

+ 36
- 0
keyboards/lily58/keymaps/lily58l_vii33/process_record_user.h View File

@ -0,0 +1,36 @@
/*
Header file for process_record_user
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2015 Jack Humbert
Copyright 2020 Ben Roesner (keycapsss.com)
Copyright 2022 Vii33 (https://github.com/vii33/mecha-keyboard-lily58l)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include QMK_KEYBOARD_H
bool process_record_user(uint16_t keycode, keyrecord_t *record);
extern bool lunaIsSneaking;
extern bool lunaIsJumping;
extern bool lunaIsBarking;
extern bool lunaShowedJump;
/* Logging of key taps is not used for now */
// extern void add_keylog(uint16_t keycode);

+ 11
- 0
keyboards/lily58/keymaps/lily58l_vii33/rules.mk View File

@ -0,0 +1,11 @@
EXTRAKEY_ENABLE = yes
OLED_ENABLE = yes
LTO_ENABLE = yes # Smaller binary
WPM_ENABLE = yes
SRC += oled.c
SRC += process_record_user.c
# CONSOLE_ENABLE = yes # To debug via the qmk toolkit

+ 47
- 0
keyboards/lily58/light/config.h View File

@ -0,0 +1,47 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2015 Jack Humbert
Copyright 2017 F_YUUCHI
Copyright 2020 Ben Roesner (keycapsss.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
/* key matrix size */
// Rows are doubled-up
#define MATRIX_ROWS 10
#define MATRIX_COLS 6
// wiring of each half
#define MATRIX_ROW_PINS { C6, D7, E6, B4, B5 }
#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6 }
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
#define SOFT_SERIAL_PIN D2
#define RGB_DI_PIN D3
#define RGBLED_SPLIT { 35, 35 }
#define RGBLED_NUM 70
#define RGBLIGHT_SPLIT
#define RGBLIGHT_LIMIT_VAL 120
#define ENCODERS_PAD_A { F4 }
#define ENCODERS_PAD_B { F5 }
#define ENCODERS_PAD_A_RIGHT { F5 }
#define ENCODERS_PAD_B_RIGHT { F4 }

+ 6
- 105
keyboards/lily58/light/info.json View File

@ -8,114 +8,15 @@
"pid": "0x4C4C",
"device_version": "1.0.0"
},
"features": {
"bootmagic": true,
"encoder": true,
"oled": true,
"rgblight": true
},
"matrix_pins": {
"cols": ["F6", "F7", "B1", "B3", "B2", "B6"],
"rows": ["C6", "D7", "E6", "B4", "B5"]
},
"diode_direction": "COL2ROW",
"encoder": {
"rotary": [
{"pin_a": "F4", "pin_b": "F5"}
]
},
"split": {
"enabled": true,
"soft_serial_pin": "D2",
"encoder": {
"right": {
"rotary": [
{"pin_a": "F5", "pin_b": "F4"}
]
}
}
},
"ws2812": {
"pin": "D3"
},
"rgblight": {
"led_count": 70,
"max_brightness": 120,
"split_count": [35, 35]
},
"processor": "atmega32u4",
"bootloader": "caterina",
"layouts": {
"LAYOUT": {
"layout": [
{"matrix": [0, 0], "x": 0, "y": 0.5},
{"matrix": [0, 1], "x": 1, "y": 0.375},
{"matrix": [0, 2], "x": 2, "y": 0.125},
{"matrix": [0, 3], "x": 3, "y": 0},
{"matrix": [0, 4], "x": 4, "y": 0.125},
{"matrix": [0, 5], "x": 5, "y": 0.25},
{"matrix": [5, 5], "x": 10.5, "y": 0.25},
{"matrix": [5, 4], "x": 11.5, "y": 0.125},
{"matrix": [5, 3], "x": 12.5, "y": 0},
{"matrix": [5, 2], "x": 13.5, "y": 0.125},
{"matrix": [5, 1], "x": 14.5, "y": 0.375},
{"matrix": [5, 0], "x": 15.5, "y": 0.5},
{"matrix": [1, 0], "x": 0, "y": 1.5},
{"matrix": [1, 1], "x": 1, "y": 1.375},
{"matrix": [1, 2], "x": 2, "y": 1.125},
{"matrix": [1, 3], "x": 3, "y": 1},
{"matrix": [1, 4], "x": 4, "y": 1.125},
{"matrix": [1, 5], "x": 5, "y": 1.25},
{"matrix": [6, 5], "x": 10.5, "y": 1.25},
{"matrix": [6, 4], "x": 11.5, "y": 1.125},
{"matrix": [6, 3], "x": 12.5, "y": 1},
{"matrix": [6, 2], "x": 13.5, "y": 1.125},
{"matrix": [6, 1], "x": 14.5, "y": 1.375},
{"matrix": [6, 0], "x": 15.5, "y": 1.5},
{"matrix": [2, 0], "x": 0, "y": 2.5},
{"matrix": [2, 1], "x": 1, "y": 2.375},
{"matrix": [2, 2], "x": 2, "y": 2.125},
{"matrix": [2, 3], "x": 3, "y": 2},
{"matrix": [2, 4], "x": 4, "y": 2.125},
{"matrix": [2, 5], "x": 5, "y": 2.25},
{"matrix": [7, 5], "x": 10.5, "y": 2.25},
{"matrix": [7, 4], "x": 11.5, "y": 2.125},
{"matrix": [7, 3], "x": 12.5, "y": 2},
{"matrix": [7, 2], "x": 13.5, "y": 2.125},
{"matrix": [7, 1], "x": 14.5, "y": 2.375},
{"matrix": [7, 0], "x": 15.5, "y": 2.5},
{"matrix": [3, 0], "x": 0, "y": 3.5},
{"matrix": [3, 1], "x": 1, "y": 3.375},
{"matrix": [3, 2], "x": 2, "y": 3.125},
{"matrix": [3, 3], "x": 3, "y": 3},
{"matrix": [3, 4], "x": 4, "y": 3.125},
{"matrix": [3, 5], "x": 5, "y": 3.25},
{"matrix": [4, 5], "x": 6, "y": 2.75},
{"matrix": [9, 5], "x": 9.5, "y": 2.75},
{"matrix": [8, 5], "x": 10.5, "y": 3.25},
{"matrix": [8, 4], "x": 11.5, "y": 3.125},
{"matrix": [8, 3], "x": 12.5, "y": 3},
{"matrix": [8, 2], "x": 13.5, "y": 3.125},
{"matrix": [8, 1], "x": 14.5, "y": 3.375},
{"matrix": [8, 0], "x": 15.5, "y": 3.5},
{"matrix": [4, 1], "x": 2.5, "y": 4.125},
{"matrix": [4, 2], "x": 3.5, "y": 4.15},
{"matrix": [4, 3], "x": 4.5, "y": 4.25},
{"matrix": [4, 4], "x": 6, "y": 4.25, "h": 1.5},
{"matrix": [9, 4], "x": 9.5, "y": 4.25, "h": 1.5},
{"matrix": [9, 3], "x": 11, "y": 4.25},
{"matrix": [9, 2], "x": 12, "y": 4.15},
{"matrix": [9, 1], "x": 13, "y": 4.15}
{"x":0, "y":0.5}, {"x":1, "y":0.375}, {"x":2, "y":0.125}, {"x":3, "y":0}, {"x":4, "y":0.125}, {"x":5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.5},
{"x":0, "y":1.5}, {"x":1, "y":1.375}, {"x":2, "y":1.125}, {"x":3, "y":1}, {"x":4, "y":1.125}, {"x":5, "y":1.25}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.5},
{"x":0, "y":2.5}, {"x":1, "y":2.375}, {"x":2, "y":2.125}, {"x":3, "y":2}, {"x":4, "y":2.125}, {"x":5, "y":2.25}, {"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.5},
{"x":0, "y":3.5}, {"x":1, "y":3.375}, {"x":2, "y":3.125}, {"x":3, "y":3}, {"x":4, "y":3.125}, {"x":5, "y":3.25}, {"x":6, "y":2.75}, {"x":9.5, "y":2.75}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.5},
{"x":2.5, "y":4.125}, {"x":3.5, "y":4.15}, {"x":4.5, "y":4.25}, {"x":6, "y":4.25, "h":1.5}, {"x":9.5, "y":4.25, "h":1.5}, {"x":11, "y":4.25}, {"x":12, "y":4.15}, {"x":13, "y":4.15}
]
}
}
}
}

+ 15
- 0
keyboards/lily58/light/light.c View File

@ -0,0 +1,15 @@
/*
Copyright 2020 Ben Roesner (keycapsss.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "lily58.h"

+ 50
- 0
keyboards/lily58/light/light.h View File

@ -0,0 +1,50 @@
#pragma once
#include "lily58.h"
#include "quantum.h"
#ifndef FLIP_HALF
#define LAYOUT( \
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
L30, L31, L32, L33, L34, L35, L45, R40, R30, R31, R32, R33, R34, R35, \
L41, L42, L43, L44, R41, R42, R43, R44 \
) \
{ \
{ L00, L01, L02, L03, L04, L05 }, \
{ L10, L11, L12, L13, L14, L15 }, \
{ L20, L21, L22, L23, L24, L25 }, \
{ L30, L31, L32, L33, L34, L35 }, \
{ KC_NO, L41, L42, L43, L44, L45 }, \
{ R05, R04, R03, R02, R01, R00 }, \
{ R15, R14, R13, R12, R11, R10 }, \
{ R25, R24, R23, R22, R21, R20 }, \
{ R35, R34, R33, R32, R31, R30 }, \
{ KC_NO, R44, R43, R42, R41, R40 } \
}
#else
// Keymap with right side flipped
// (TRRS jack on both halves are to the right)
#define LAYOUT( \
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
L30, L31, L32, L33, L34, L35, L45, R30, R31, R32, R33, R34, R35, R45, \
L41, L42, L43, L44, R41, R42, R43, R44 \
) \
{ \
{ L00, L01, L02, L03, L04, L05 }, \
{ L10, L11, L12, L13, L14, L15 }, \
{ L20, L21, L22, L23, L24, L25 }, \
{ L30, L31, L32, L33, L34, L35 }, \
{ KC_NO, L41, L42, L43, L44, L45 }, \
{ R00, R01, R02, R03, R04, R05 }, \
{ R10, R11, R12, R13, R14, R15 }, \
{ R20, R21, R22, R23, R24, R25 }, \
{ R30, R31, R32, R33, R34, R35 }, \
{ KC_NO, R41, R42, R43, R44, R45 } \
}
#endif

+ 5
- 1
keyboards/lily58/light/rules.mk View File

@ -1 +1,5 @@
LTO_ENABLE = yes
ENCODER_ENABLE = yes # ENables the use of one or more encoders
RGBLIGHT_ENABLE = yes # Enable keyboard RGB light
LTO_ENABLE = yes # significantly reduce the compiled size, but disable the legacy TMK Macros and Functions features
# Bootloader selection
BOOTLOADER = atmel-dfu

+ 1
- 0
keyboards/lily58/lily58.c View File

@ -0,0 +1 @@
#include "lily58.h"

+ 9
- 0
keyboards/lily58/lily58.h View File

@ -0,0 +1,9 @@
#pragma once
#ifdef KEYBOARD_lily58_rev1
#include "rev1.h"
#elif KEYBOARD_lily58_light
#include "light.h"
#elif KEYBOARD_lily58_glow_enc
#include "glow_enc.h"
#endif

+ 22
- 0
keyboards/lily58/rules.mk View File

@ -1 +1,23 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = caterina
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = no # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = no # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
AUDIO_ENABLE = no # Audio output
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
OLED_ENABLE = yes
OLED_DRIVER = SSD1306 # OLED display
SPLIT_KEYBOARD = yes
DEFAULT_FOLDER = lily58/rev1

Loading…
Cancel
Save