summaryrefslogtreecommitdiff
path: root/keyboards/crkbd/keymaps/like_jis
diff options
context:
space:
mode:
authormarksard <38324387+marksard@users.noreply.github.com>2018-08-23 01:51:37 +0900
committerDrashna Jaelre <drashna@live.com>2018-08-22 09:51:37 -0700
commit6076ed85be111f0e88c7049aa3d2e69eed5005a1 (patch)
treeda704f8828a63245ea2333c883462b2f96591212 /keyboards/crkbd/keymaps/like_jis
parent9d27d5544365b988575ca3face308d30feb40c86 (diff)
Keyboard: Partial refactor of the crkbd code (#3600)
* Add display to LED-parameters function * Improvement of update timing for OLED display (Need TWI_Init)
Diffstat (limited to 'keyboards/crkbd/keymaps/like_jis')
-rw-r--r--keyboards/crkbd/keymaps/like_jis/keymap.c59
-rw-r--r--keyboards/crkbd/keymaps/like_jis/rules.mk9
2 files changed, 48 insertions, 20 deletions
diff --git a/keyboards/crkbd/keymaps/like_jis/keymap.c b/keyboards/crkbd/keymaps/like_jis/keymap.c
index 0dd9c15500..31b5230b10 100644
--- a/keyboards/crkbd/keymaps/like_jis/keymap.c
+++ b/keyboards/crkbd/keymaps/like_jis/keymap.c
@@ -5,16 +5,10 @@
#include "split_util.h"
#endif
#ifdef SSD1306OLED
+ #include "LUFA/Drivers/Peripheral/TWI.h"
#include "ssd1306.h"
#endif
-#include "../lib/mode_icon_reader.c"
-#include "../lib/layer_state_reader.c"
-#include "../lib/host_led_state_reader.c"
-#include "../lib/logo_reader.c"
-#include "../lib/keylogger.c"
-#include "../lib/timelogger.c"
-
extern keymap_config_t keymap_config;
#ifdef RGBLIGHT_ENABLE
@@ -84,7 +78,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//|------+------+------+------+------+------| |------+------+------+------+------+------|
_____, F11, F12, XXXXX, KANJI, ENT, XXXXX, XXXXX, COMM, DOT, SLSH, RO,\
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
- _____, _____, DEL, XXXXX, _____, APP \
+ _____, _____, DEL, _____, _____, APP \
//`--------------------' `--------------------'
),
@@ -96,19 +90,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//|------+------+------+------+------+------| |------+------+------+------+------+------|
_____, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, 0, 1, 2, 3, DOT, XXXXX,\
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
- _____, _____, XXXXX, XXXXX, _____, LALT \
+ _____, _____, BSPC, _____, _____, LALT \
//`--------------------' `--------------------'
),
[_ADJUST] = LAYOUT_kc( \
//,-----------------------------------------. ,-----------------------------------------.
- RST, LRST, KNRM, KSWP, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX,\
- //|------+------+------+------+------+------| |------+------+------+------+------+------|
- LTOG, LHUI, LSAI, LVAI, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, PGUP, XXXXX,\
- //|------+------+------+------+------+------| |------+------+------+------+------+------|
- LSMOD, LHUD, LSAD, LVAD, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, HOME, PGDN, END,\
+ _____, RST, LRST, KNRM, KSWP,XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX,\
+ //|------+-------+------+------+------+-----| |------+------+------+------+------+------|
+ _____, LTOG, LHUI, LSAI, LVAI,XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, PGUP, XXXXX,\
+ //|------+-------+------+------+------+-----| |------+------+------+------+------+------|
+ _____, LSMOD, LHUD, LSAD, LVAD,XXXXX, XXXXX, XXXXX, XXXXX, HOME, PGDN, END,\
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
- _____, _____, XXXXX, XXXXX, _____, XXXXX \
+ _____, _____, XXXXX, _____, _____, XXXXX \
//`--------------------' `--------------------'
)
};
@@ -130,6 +124,7 @@ void matrix_init_user(void) {
#endif
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
#ifdef SSD1306OLED
+ TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
iota_gfx_init(!has_usb()); // turns on the display
#endif
}
@@ -137,18 +132,42 @@ void matrix_init_user(void) {
//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);
+
+#ifdef RGBLIGHT_ENABLE
+ const char *read_rgb_info(void);
+ #define RENDER_RGB_INFO(m) matrix_write_ln(m, (const char*)read_rgb_info())
+#else
+ #define RENDER_RGB_INFO(m)
+#endif
+
+
void matrix_scan_user(void) {
iota_gfx_task();
}
inline 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());
+ RENDER_RGB_INFO(matrix);
+ // matrix_write_ln(matrix, read_keylogs());
+ // matrix_write_ln(matrix, read_host_led_state());
+
+ // matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui));
+ // matrix_write_ln(matrix, read_timelog());
} else {
matrix_write(matrix, read_logo());
}
@@ -174,7 +193,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef SSD1306OLED
if (record->event.pressed) {
set_keylog(keycode, record);
- set_timelog();
+ // set_timelog();
}
#endif
diff --git a/keyboards/crkbd/keymaps/like_jis/rules.mk b/keyboards/crkbd/keymaps/like_jis/rules.mk
index 3f1bd9108d..6570e2f5cb 100644
--- a/keyboards/crkbd/keymaps/like_jis/rules.mk
+++ b/keyboards/crkbd/keymaps/like_jis/rules.mk
@@ -19,3 +19,12 @@ 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
+
+# If you want to change the display of OLED, you need to change here
+SRC += ../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 \