summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaoki Katahira <kata0510.com@gmail.com>2019-01-06 02:30:48 +0900
committerDrashna Jaelre <drashna@live.com>2019-01-05 09:30:48 -0800
commitea47be936b41a31e2644ad3403d91010916683ce (patch)
treec8db4d32373542cd1236a4d537fa45a00ed7b6fb
parent5b5f452bf9feae121ec5c2f3e9d5d993fcb73f92 (diff)
Keyboard: Lily58 update serial.c and add OLED (#4715)
* update serial.c and add OLED * update readme * keymap fix * keymap fix2
-rw-r--r--keyboards/lily58/config.h15
-rwxr-xr-x[-rw-r--r--]keyboards/lily58/i2c.c2
-rwxr-xr-x[-rw-r--r--]keyboards/lily58/i2c.h7
-rw-r--r--keyboards/lily58/keymaps/default/config.h21
-rw-r--r--keyboards/lily58/keymaps/default/keymap.c123
-rw-r--r--keyboards/lily58/keymaps/default/rules.mk27
-rw-r--r--keyboards/lily58/keymaps/yuchi/config.h21
-rw-r--r--keyboards/lily58/keymaps/yuchi/keymap.c125
-rw-r--r--keyboards/lily58/keymaps/yuchi/rules.mk28
-rw-r--r--keyboards/lily58/lib/glcdfont.c243
-rw-r--r--keyboards/lily58/lib/host_led_state_reader.c15
-rw-r--r--keyboards/lily58/lib/keylogger.c45
-rw-r--r--keyboards/lily58/lib/layer_state_reader.c35
-rw-r--r--keyboards/lily58/lib/logo_reader.c11
-rw-r--r--keyboards/lily58/lib/mode_icon_reader.c15
-rw-r--r--keyboards/lily58/lib/rgb_state_reader.c15
-rw-r--r--keyboards/lily58/lib/timelogger.c16
-rw-r--r--keyboards/lily58/lily58.c11
-rw-r--r--keyboards/lily58/lily58.h25
-rw-r--r--keyboards/lily58/readme.md8
-rw-r--r--keyboards/lily58/rev1/config.h14
-rwxr-xr-xkeyboards/lily58/rev1/matrix.c357
-rw-r--r--keyboards/lily58/rev1/rev1.c18
-rw-r--r--keyboards/lily58/rev1/rev1.h4
-rw-r--r--keyboards/lily58/rev1/rules.mk4
-rwxr-xr-xkeyboards/lily58/rev1/serial_config.h4
-rwxr-xr-xkeyboards/lily58/rev1/split_scomm.c91
-rwxr-xr-xkeyboards/lily58/rev1/split_scomm.h24
-rwxr-xr-xkeyboards/lily58/rev1/split_util.c70
-rwxr-xr-xkeyboards/lily58/rev1/split_util.h19
-rw-r--r--keyboards/lily58/rules.mk20
-rwxr-xr-x[-rw-r--r--]keyboards/lily58/serial.c285
-rwxr-xr-x[-rw-r--r--]keyboards/lily58/serial.h22
-rw-r--r--keyboards/lily58/serial_config.h12
-rwxr-xr-xkeyboards/lily58/ssd1306.c344
-rwxr-xr-xkeyboards/lily58/ssd1306.h91
36 files changed, 1972 insertions, 215 deletions
diff --git a/keyboards/lily58/config.h b/keyboards/lily58/config.h
index db4844c910..b88ec06bf4 100644
--- a/keyboards/lily58/config.h
+++ b/keyboards/lily58/config.h
@@ -18,4 +18,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
-#include "serial_config.h" \ No newline at end of file
+#include "config_common.h"
+#include <serial_config.h>
+
+#define USE_I2C
+#define USE_SERIAL
+
+#ifdef USE_Link_Time_Optimization
+ // LTO has issues with macros (action_get_macro) and "functions" (fn_actions),
+ // so just disable them
+ #define NO_ACTION_MACRO
+ #define NO_ACTION_FUNCTION
+
+ #define DISABLE_LEADER
+#endif // USE_Link_Time_Optimization \ No newline at end of file
diff --git a/keyboards/lily58/i2c.c b/keyboards/lily58/i2c.c
index 084c890c40..4bee5c6398 100644..100755
--- a/keyboards/lily58/i2c.c
+++ b/keyboards/lily58/i2c.c
@@ -34,7 +34,7 @@ void i2c_delay(void) {
// _delay_us(100);
}
-// Setup twi to run at 100kHz
+// Setup twi to run at 100kHz or 400kHz (see ./i2c.h SCL_CLOCK)
void i2c_master_init(void) {
// no prescaler
TWSR = 0;
diff --git a/keyboards/lily58/i2c.h b/keyboards/lily58/i2c.h
index c15b6bc506..710662c7ab 100644..100755
--- a/keyboards/lily58/i2c.h
+++ b/keyboards/lily58/i2c.h
@@ -1,5 +1,4 @@
-#ifndef I2C_H
-#define I2C_H
+#pragma once
#include <stdint.h>
@@ -15,7 +14,7 @@
#define SLAVE_BUFFER_SIZE 0x10
-// i2c SCL clock frequency
+// i2c SCL clock frequency 400kHz
#define SCL_CLOCK 400000L
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
@@ -45,5 +44,3 @@ extern unsigned char i2c_readNak(void);
extern unsigned char i2c_read(unsigned char ack);
#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
-
-#endif
diff --git a/keyboards/lily58/keymaps/default/config.h b/keyboards/lily58/keymaps/default/config.h
index fd09785593..58bbdc5e9d 100644
--- a/keyboards/lily58/keymaps/default/config.h
+++ b/keyboards/lily58/keymaps/default/config.h
@@ -17,12 +17,10 @@ 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
-/* Use I2C or Serial, not both */
+#pragma once
-#define USE_SERIAL
-// #define USE_I2C
+//#define USE_MATRIX_I2C
/* Select hand configuration */
@@ -30,6 +28,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MASTER_RIGHT
// #define EE_HANDS
+#define SSD1306OLED
+
+#define USE_SERIAL_PD2
+
+#define TAPPING_FORCE_HOLD
+#define TAPPING_TERM 100
+
+#undef RGBLED_NUM
+#define RGBLIGHT_ANIMATIONS
+#define RGBLED_NUM 27
+#define RGBLIGHT_LIMIT_VAL 120
+#define RGBLIGHT_HUE_STEP 10
+#define RGBLIGHT_SAT_STEP 17
+#define RGBLIGHT_VAL_STEP 17
+
// Underglow
/*
#undef RGBLED_NUM
diff --git a/keyboards/lily58/keymaps/default/keymap.c b/keyboards/lily58/keymaps/default/keymap.c
index 8d77058129..5ff5dc3182 100644
--- a/keyboards/lily58/keymaps/default/keymap.c
+++ b/keyboards/lily58/keymaps/default/keymap.c
@@ -1,7 +1,23 @@
#include QMK_KEYBOARD_H
+#ifdef PROTOCOL_LUFA
+ #include "lufa.h"
+ #include "split_util.h"
+#endif
+#ifdef SSD1306OLED
+ #include "ssd1306.h"
+#endif
+
+
extern keymap_config_t keymap_config;
+#ifdef RGBLIGHT_ENABLE
+//Following line allows macro to read current RGB settings
+extern rgblight_config_t rgblight_config;
+#endif
+
+extern uint8_t is_master;
+
#define _QWERTY 0
#define _LOWER 1
#define _RAISE 2
@@ -88,9 +104,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | | | | | | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | | | | | |-------. ,-------| | | | | | |
+ * | | | | | | |-------. ,-------| | |RGB ON| HUE+ | SAT+ | VAL+ |
* |------+------+------+------+------+------| | | |------+------+------+------+------+------|
- * | | | | | | |-------| |-------| | | | | | |
+ * | | | | | | |-------| |-------| | | MODE | HUE- | SAT- | VAL- |
* `-----------------------------------------/ / \ \-----------------------------------------'
* | LAlt | LGUI |LOWER | /Space / \Enter \ |RAISE |BackSP| RGUI |
* | | | |/ / \ \ | | | |
@@ -99,17 +115,92 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_ADJUST] = LAYOUT( \
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
- XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
- XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,\
+ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \
+ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD,\
_______, _______, _______, _______, _______, _______, _______, _______ \
)
};
+int RGB_current_mode;
+
+// Setting ADJUST layer RGB back to default
+void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
+ if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
+ layer_on(layer3);
+ } else {
+ layer_off(layer3);
+ }
+}
+
+void matrix_init_user(void) {
+ #ifdef RGBLIGHT_ENABLE
+ RGB_current_mode = rgblight_config.mode;
+ #endif
+ //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
+ #ifdef SSD1306OLED
+ iota_gfx_init(!has_usb()); // turns on the display
+ #endif
+}
+
+//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
+#ifdef SSD1306OLED
+
+// When add source files to SRC in rules.mk, you can use functions.
+const char *read_layer_state(void);
+const char *read_logo(void);
+void set_keylog(uint16_t keycode, keyrecord_t *record);
+const char *read_keylog(void);
+const char *read_keylogs(void);
+
+// const char *read_mode_icon(bool swap);
+// const char *read_host_led_state(void);
+// void set_timelog(void);
+// const char *read_timelog(void);
+
+void matrix_scan_user(void) {
+ iota_gfx_task();
+}
+
+void matrix_render_user(struct CharacterMatrix *matrix) {
+ if (is_master) {
+ // If you want to change the display of OLED, you need to change here
+ matrix_write_ln(matrix, read_layer_state());
+ matrix_write_ln(matrix, read_keylog());
+ matrix_write_ln(matrix, read_keylogs());
+ //matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui));
+ //matrix_write_ln(matrix, read_host_led_state());
+ //matrix_write_ln(matrix, read_timelog());
+ } else {
+ matrix_write(matrix, read_logo());
+ }
+}
+
+void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
+ if (memcmp(dest->display, source->display, sizeof(dest->display))) {
+ memcpy(dest->display, source->display, sizeof(dest->display));
+ dest->dirty = true;
+ }
+}
+
+void iota_gfx_task_user(void) {
+ struct CharacterMatrix matrix;
+ matrix_clear(&matrix);
+ matrix_render_user(&matrix);
+ matrix_update(&display, &matrix);
+}
+#endif//SSD1306OLED
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed) {
+#ifdef SSD1306OLED
+ set_keylog(keycode, record);
+#endif
+ // set_timelog();
+ }
+
switch (keycode) {
case QWERTY:
- if (record->event.pressed) {
+ if (record->event.pressed) {
set_single_persistent_default_layer(_QWERTY);
}
return false;
@@ -117,31 +208,31 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case ADJUST:
- if (record->event.pressed) {
- layer_on(_ADJUST);
- } else {
- layer_off(_ADJUST);
- }
- return false;
- break;
+ if (record->event.pressed) {
+ layer_on(_ADJUST);
+ } else {
+ layer_off(_ADJUST);
+ }
+ return false;
+ break;
}
return true;
} \ No newline at end of file
diff --git a/keyboards/lily58/keymaps/default/rules.mk b/keyboards/lily58/keymaps/default/rules.mk
index 3d2d3c9e0f..922fac6b69 100644
--- a/keyboards/lily58/keymaps/default/rules.mk
+++ b/keyboards/lily58/keymaps/default/rules.mk
@@ -1,21 +1,30 @@
-
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
-
-RGBLIGHT_ENABLE = no
-
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
-MOUSEKEY_ENABLE = no # Mouse keys(+4700)
-EXTRAKEY_ENABLE = no # Audio control and System control(+450)
+MOUSEKEY_ENABLE = no # Mouse keys(+4700)
+EXTRAKEY_ENABLE = no # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
-COMMAND_ENABLE = no # Commands for debug and configuration
+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
-ONEHAND_ENABLE = no # Enable one-hand typing
+RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
+SWAP_HANDS_ENABLE = no # Enable one-hand typing
+
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
-SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend \ No newline at end of file
+SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
+
+# If you want to change the display of OLED, you need to change here
+SRC += ./lib/glcdfont.c \
+ ./lib/rgb_state_reader.c \
+ ./lib/layer_state_reader.c \
+ ./lib/logo_reader.c \
+ ./lib/keylogger.c \
+ # ./lib/mode_icon_reader.c \
+ # ./lib/host_led_state_reader.c \
+ # ./lib/timelogger.c \
diff --git a/keyboards/lily58/keymaps/yuchi/config.h b/keyboards/lily58/keymaps/yuchi/config.h
index fd09785593..58bbdc5e9d 100644
--- a/keyboards/lily58/keymaps/yuchi/config.h
+++ b/keyboards/lily58/keymaps/yuchi/config.h
@@ -17,12 +17,10 @@ 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
-/* Use I2C or Serial, not both */
+#pragma once
-#define USE_SERIAL
-// #define USE_I2C
+//#define USE_MATRIX_I2C
/* Select hand configuration */
@@ -30,6 +28,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MASTER_RIGHT
// #define EE_HANDS
+#define SSD1306OLED
+
+#define USE_SERIAL_PD2
+
+#define TAPPING_FORCE_HOLD
+#define TAPPING_TERM 100
+
+#undef RGBLED_NUM
+#define RGBLIGHT_ANIMATIONS
+#define RGBLED_NUM 27
+#define RGBLIGHT_LIMIT_VAL 120
+#define RGBLIGHT_HUE_STEP 10
+#define RGBLIGHT_SAT_STEP 17
+#define RGBLIGHT_VAL_STEP 17
+
// Underglow
/*
#undef RGBLED_NUM
diff --git a/keyboards/lily58/keymaps/yuchi/keymap.c b/keyboards/lily58/keymaps/yuchi/keymap.c
index d708dbec76..13b6cb1687 100644
--- a/keyboards/lily58/keymaps/yuchi/keymap.c
+++ b/keyboards/lily58/keymaps/yuchi/keymap.c
@@ -1,7 +1,23 @@
#include QMK_KEYBOARD_H
+#ifdef PROTOCOL_LUFA
+ #include "lufa.h"
+ #include "split_util.h"
+#endif
+#ifdef SSD1306OLED
+ #include "ssd1306.h"
+#endif
+
+
extern keymap_config_t keymap_config;
+#ifdef RGBLIGHT_ENABLE
+//Following line allows macro to read current RGB settings
+extern rgblight_config_t rgblight_config;
+#endif
+
+extern uint8_t is_master;
+
#define _QWERTY 0
#define _LOWER 1
#define _RAISE 2
@@ -89,28 +105,103 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | | | | | | | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | | | | | |-------. ,-------| | | | | | |
+ * | | | | | | |-------. ,-------| | |RGB ON| HUE+ | SAT+ | VAL+ |
* |------+------+------+------+------+------| | | |------+------+------+------+------+------|
- * | | | | | | |-------| |-------| | | | | | |
+ * | | | | | | |-------| |-------| | | MODE | HUE- | SAT- | VAL- |
* `-----------------------------------------/ / \ \-----------------------------------------'
* |LOWER | LGUI | Alt | /Space / \Enter \ |BackSP| RGUI |RAISE |
* | | | |/ / \ \ | | | |
- * `-------------------''-------' '------''--------------------'
+ * `----------------------------' '------''--------------------'
*/
[_ADJUST] = LAYOUT( \
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
- XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
- XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,\
+ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \
+ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD,\
_______, _______, _______, _______, _______, _______, _______, _______ \
)
};
+int RGB_current_mode;
+
+// Setting ADJUST layer RGB back to default
+void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
+ if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
+ layer_on(layer3);
+ } else {
+ layer_off(layer3);
+ }
+}
+
+void matrix_init_user(void) {
+ #ifdef RGBLIGHT_ENABLE
+ RGB_current_mode = rgblight_config.mode;
+ #endif
+ //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
+ #ifdef SSD1306OLED
+ iota_gfx_init(!has_usb()); // turns on the display
+ #endif
+}
+
+//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
+#ifdef SSD1306OLED
+
+// When add source files to SRC in rules.mk, you can use functions.
+const char *read_layer_state(void);
+const char *read_logo(void);
+void set_keylog(uint16_t keycode, keyrecord_t *record);
+const char *read_keylog(void);
+const char *read_keylogs(void);
+
+// const char *read_mode_icon(bool swap);
+// const char *read_host_led_state(void);
+// void set_timelog(void);
+// const char *read_timelog(void);
+
+void matrix_scan_user(void) {
+ iota_gfx_task();
+}
+
+void matrix_render_user(struct CharacterMatrix *matrix) {
+ if (is_master) {
+ // If you want to change the display of OLED, you need to change here
+ matrix_write_ln(matrix, read_layer_state());
+ matrix_write_ln(matrix, read_keylog());
+ matrix_write_ln(matrix, read_keylogs());
+ //matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui));
+ //matrix_write_ln(matrix, read_host_led_state());
+ //matrix_write_ln(matrix, read_timelog());
+ } else {
+ matrix_write(matrix, read_logo());
+ }
+}
+
+void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
+ if (memcmp(dest->display, source->display, sizeof(dest->display))) {
+ memcpy(dest->display, source->display, sizeof(dest->display));
+ dest->dirty = true;
+ }
+}
+
+void iota_gfx_task_user(void) {
+ struct CharacterMatrix matrix;
+ matrix_clear(&matrix);
+ matrix_render_user(&matrix);
+ matrix_update(&display, &matrix);
+}
+#endif//SSD1306OLED
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed) {
+#ifdef SSD1306OLED
+ set_keylog(keycode, record);
+#endif
+ // set_timelog();
+ }
+
switch (keycode) {
case QWERTY:
- if (record->event.pressed) {
+ if (record->event.pressed) {
set_single_persistent_default_layer(_QWERTY);
}
return false;
@@ -118,31 +209,31 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
- update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case ADJUST:
- if (record->event.pressed) {
- layer_on(_ADJUST);
- } else {
- layer_off(_ADJUST);
- }
- return false;
- break;
+ if (record->event.pressed) {
+ layer_on(_ADJUST);
+ } else {
+ layer_off(_ADJUST);
+ }
+ return false;
+ break;
}
return true;
} \ No newline at end of file
diff --git a/keyboards/lily58/keymaps/yuchi/rules.mk b/keyboards/lily58/keymaps/yuchi/rules.mk
index 73777a1b78..922fac6b69 100644
--- a/keyboards/lily58/keymaps/yuchi/rules.mk
+++ b/keyboards/lily58/keymaps/yuchi/rules.mk
@@ -1,22 +1,30 @@
-
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
-
-OLED_ENABLE = no
-RGBLIGHT_ENABLE = no
-
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
-MOUSEKEY_ENABLE = no # Mouse keys(+4700)
-EXTRAKEY_ENABLE = no # Audio control and System control(+450)
+MOUSEKEY_ENABLE = no # Mouse keys(+4700)
+EXTRAKEY_ENABLE = no # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
-COMMAND_ENABLE = no # Commands for debug and configuration
+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
-ONEHAND_ENABLE = no # Enable one-hand typing
+RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
+SWAP_HANDS_ENABLE = no # Enable one-hand typing
+
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
-SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend \ No newline at end of file
+SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
+
+# If you want to change the display of OLED, you need to change here
+SRC += ./lib/glcdfont.c \
+ ./lib/rgb_state_reader.c \
+ ./lib/layer_state_reader.c \
+ ./lib/logo_reader.c \
+ ./lib/keylogger.c \
+ # ./lib/mode_icon_reader.c \
+ # ./lib/host_led_state_reader.c \
+ # ./lib/timelogger.c \
diff --git a/keyboards/lily58/lib/glcdfont.c b/keyboards/lily58/lib/glcdfont.c
new file mode 100644
index 0000000000..c691ea9d0b
--- /dev/null
+++ b/keyboards/lily58/lib/glcdfont.c
@@ -0,0 +1,243 @@
+// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0.
+// See gfxfont.h for newer custom bitmap font info.
+
+#ifndef FONT5X7_H
+#define FONT5X7_H
+
+#ifdef __AVR__
+ #include <avr/io.h>
+ #include <avr/pgmspace.h>
+#elif defined(ESP8266)
+ #include <pgmspace.h>
+#else
+ #define PROGMEM
+#endif
+
+// Standard ASCII 5x7 font
+const unsigned char font[] PROGMEM = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00,
+ 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00,
+ 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00,
+ 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00,
+ 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00,
+ 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00,
+ 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00,
+ 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00,
+ 0x00, 0x18, 0x24, 0x18, 0x00, 0x00,
+ 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00,
+ 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00,
+ 0x26, 0x29, 0x79, 0x29, 0x26, 0x00,
+ 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00,
+ 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00,
+ 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00,
+ 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00,
+ 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00,
+ 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00,
+ 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00,
+ 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00,
+ 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00,
+ 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
+ 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00,
+ 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00,
+ 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00,
+ 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00,
+ 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00,
+ 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00,
+ 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00,
+ 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00,
+ 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00,
+ 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,
+ 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,
+ 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,
+ 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,
+ 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,
+ 0x7C, 0x18, 0x24, 0x24, 0x18, 0x00,
+ 0x18, 0x24, 0x24, 0x18, 0x7C, 0x00,
+ 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
+ 0x48