From 6076ed85be111f0e88c7049aa3d2e69eed5005a1 Mon Sep 17 00:00:00 2001
From: marksard <38324387+marksard@users.noreply.github.com>
Date: Thu, 23 Aug 2018 01:51:37 +0900
Subject: Keyboard: Partial refactor of the crkbd code (#3600)
* Add display to LED-parameters function
* Improvement of update timing for OLED display (Need TWI_Init)
---
keyboards/crkbd/keymaps/default/config.h | 6 +--
keyboards/crkbd/keymaps/default/keymap.c | 33 ++++++------
keyboards/crkbd/keymaps/default/rules.mk | 13 +++--
.../crkbd/keymaps/lib/host_led_state_reader.c | 16 +++---
keyboards/crkbd/keymaps/lib/keylogger.c | 46 ++++++++---------
keyboards/crkbd/keymaps/lib/layer_state_reader.c | 38 +++++++-------
keyboards/crkbd/keymaps/lib/logo_reader.c | 13 +++--
keyboards/crkbd/keymaps/lib/mode_icon_reader.c | 12 ++---
keyboards/crkbd/keymaps/lib/rgb_state_reader.c | 15 ++++++
keyboards/crkbd/keymaps/lib/timelogger.c | 13 +++--
keyboards/crkbd/keymaps/like_jis/keymap.c | 59 ++++++++++++++--------
keyboards/crkbd/keymaps/like_jis/rules.mk | 9 ++++
12 files changed, 159 insertions(+), 114 deletions(-)
create mode 100644 keyboards/crkbd/keymaps/lib/rgb_state_reader.c
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/default/config.h b/keyboards/crkbd/keymaps/default/config.h
index 15aeb098bc..8d25f7cbc6 100644
--- a/keyboards/crkbd/keymaps/default/config.h
+++ b/keyboards/crkbd/keymaps/default/config.h
@@ -18,10 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#ifndef CONFIG_USER_H
-#define CONFIG_USER_H
-
-#include "../../config.h"
+#pragma once
/* Use I2C or Serial */
@@ -50,4 +47,3 @@ along with this program. If not, see .
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
-#endif
diff --git a/keyboards/crkbd/keymaps/default/keymap.c b/keyboards/crkbd/keymaps/default/keymap.c
index ac3b7215cd..87661d3451 100644
--- a/keyboards/crkbd/keymaps/default/keymap.c
+++ b/keyboards/crkbd/keymaps/default/keymap.c
@@ -1,24 +1,14 @@
-#include "crkbd.h"
+#include QMK_KEYBOARD_H
#include "bootloader.h"
-#include "action_layer.h"
-#include "action_util.h"
-#include "eeconfig.h"
#ifdef PROTOCOL_LUFA
-#include "lufa.h"
-#include "split_util.h"
+ #include "lufa.h"
+ #include "split_util.h"
#endif
-#include "LUFA/Drivers/Peripheral/TWI.h"
#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
@@ -148,12 +138,25 @@ 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);
+
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());
@@ -182,7 +185,7 @@ void iota_gfx_task_user(void) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
set_keylog(keycode, record);
- set_timelog();
+ // set_timelog();
}
switch (keycode) {
diff --git a/keyboards/crkbd/keymaps/default/rules.mk b/keyboards/crkbd/keymaps/default/rules.mk
index 33ddd82a43..6570e2f5cb 100644
--- a/keyboards/crkbd/keymaps/default/rules.mk
+++ b/keyboards/crkbd/keymaps/default/rules.mk
@@ -15,11 +15,16 @@ 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 = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
-ONEHAND_ENABLE = no # Enable one-hand typing
+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
-ifndef QUANTUM_DIR
- include ../../../../Makefile
-endif
+# 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 \
diff --git a/keyboards/crkbd/keymaps/lib/host_led_state_reader.c b/keyboards/crkbd/keymaps/lib/host_led_state_reader.c
index c19af11f8a..41ac55dc2b 100644
--- a/keyboards/crkbd/keymaps/lib/host_led_state_reader.c
+++ b/keyboards/crkbd/keymaps/lib/host_led_state_reader.c
@@ -1,13 +1,15 @@
+#include
#include "crkbd.h"
-char host_led_state[40];
+char host_led_state_str[24];
-char *read_host_led_state(void)
+const char *read_host_led_state(void)
{
- snprintf(host_led_state, sizeof(host_led_state), "\n%s %s %s",
- (host_keyboard_leds() & (1 << USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
- (host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
- (host_keyboard_leds() & (1 << USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
+ uint8_t leds = host_keyboard_leds();
+ snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s",
+ (leds & (1 << USB_LED_NUM_LOCK)) ? "on" : "- ",
+ (leds & (1 << USB_LED_CAPS_LOCK)) ? "on" : "- ",
+ (leds & (1 << USB_LED_SCROLL_LOCK)) ? "on" : "- ");
- return host_led_state;
+ return host_led_state_str;
}
diff --git a/keyboards/crkbd/keymaps/lib/keylogger.c b/keyboards/crkbd/keymaps/lib/keylogger.c
index ee14ff0335..8f2a8ce3cc 100644
--- a/keyboards/crkbd/keymaps/lib/keylogger.c
+++ b/keyboards/crkbd/keymaps/lib/keylogger.c
@@ -1,10 +1,11 @@
+#include
#include "crkbd.h"
-char keylog[40] = {};
-char keylogs[21] = {};
-int keylogs_idx = 0;
+char keylog_str[24] = {};
+char keylogs_str[21] = {};
+int keylogs_str_idx = 0;
-char code_to_name[60] = {
+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',
@@ -12,38 +13,33 @@ char code_to_name[60] = {
'R', 'E', 'B', 'T', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ';', '\'', ' ', ',', '.', '/', ' ', ' ', ' '};
-void set_keylog(uint16_t keycode, keyrecord_t *record)
-{
+void set_keylog(uint16_t keycode, keyrecord_t *record) {
char name = ' ';
- if (keycode < 60)
- {
+ if (keycode < 60) {
name = code_to_name[keycode];
}
// update keylog
- snprintf(keylog, sizeof(keylog), "%dx%d, k%2d : %c",
- record->event.key.row,
- record->event.key.col,
- keycode,
- name);
+ snprintf(keylog_str, sizeof(keylog_str), "%dx%d, k%2d : %c",
+ record->event.key.row, record->event.key.col,
+ keycode, name);
// update keylogs
- if (keylogs_idx == sizeof(keylogs) - 1)
- {
- keylogs_idx = 0;
- for (int i = 0; i < sizeof(keylogs) - 1; i++)
- {
- keylogs[i] = ' ';
+ if (keylogs_str_idx == sizeof(keylogs_str) - 1) {
+ keylogs_str_idx = 0;
+ for (int i = 0; i < sizeof(keylogs_str) - 1; i++) {
+ keylogs_str[i] = ' ';
}
}
- keylogs[keylogs_idx] = name;
- keylogs_idx++;
+
+ keylogs_str[keylogs_str_idx] = name;
+ keylogs_str_idx++;
}
-char *read_keylog(void) {
- return keylog;
+const char *read_keylog(void) {
+ return keylog_str;
}
-char *read_keylogs(void) {
- return keylogs;
+const char *read_keylogs(void) {
+ return keylogs_str;
}
diff --git a/keyboards/crkbd/keymaps/lib/layer_state_reader.c b/keyboards/crkbd/keymaps/lib/layer_state_reader.c
index f79720d6f9..eddb71337e 100644
--- a/keyboards/crkbd/keymaps/lib/layer_state_reader.c
+++ b/keyboards/crkbd/keymaps/lib/layer_state_reader.c
@@ -1,3 +1,6 @@
+
+#include QMK_KEYBOARD_H
+#include
#include "crkbd.h"
#define L_BASE 0
@@ -6,27 +9,26 @@
#define L_ADJUST 65536
#define L_ADJUST_TRI 65560
-char layer_state_str[40];
+char layer_state_str[24];
-char *read_layer_state(void)
-{
+const char *read_layer_state(void) {
switch (layer_state)
{
- case L_BASE:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Default");
- break;
- case L_RAISE:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Raise");
- break;
- case L_LOWER:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Lower");
- break;
- case L_ADJUST:
- case L_ADJUST_TRI:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Adjust");
- break;
- default:
- snprintf(layer_state_str,sizeof(layer_state_str), "Layer: Undef-%ld", layer_state);
+ case L_BASE:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Default");
+ break;
+ case L_RAISE:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Raise");
+ break;
+ case L_LOWER:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Lower");
+ break;
+ case L_ADJUST:
+ case L_ADJUST_TRI:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Adjust");
+ break;
+ default:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Undef-%ld", layer_state);
}
return layer_state_str;
diff --git a/keyboards/crkbd/keymaps/lib/logo_reader.c b/keyboards/crkbd/keymaps/lib/logo_reader.c
index 46de17bfe0..1bc1503a60 100644
--- a/keyboards/crkbd/keymaps/lib/logo_reader.c
+++ b/keyboards/crkbd/keymaps/lib/logo_reader.c
@@ -1,12 +1,11 @@
#include "crkbd.h"
-char *read_logo(void)
-{
- static char logo[]={
- 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
- 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
- 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
- 0};
+const char *read_logo(void) {
+ static char logo[] = {
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
+ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
+ 0};
return logo;
}
diff --git a/keyboards/crkbd/keymaps/lib/mode_icon_reader.c b/keyboards/crkbd/keymaps/lib/mode_icon_reader.c
index cb3d8adb12..04c226506a 100644
--- a/keyboards/crkbd/keymaps/lib/mode_icon_reader.c
+++ b/keyboards/crkbd/keymaps/lib/mode_icon_reader.c
@@ -1,13 +1,13 @@
+#include
#include "crkbd.h"
-char mode_icon[40];
+char mode_icon[24];
-char *read_mode_icon(bool swap)
-{
- static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
- if(swap == false){
+const char *read_mode_icon(bool swap) {
+ static char logo[][2][3] = {{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}};
+ if (swap == false) {
snprintf(mode_icon, sizeof(mode_icon), "%s\n%s", logo[0][0], logo[0][1]);
- }else{
+ } else {
snprintf(mode_icon, sizeof(mode_icon), "%s\n%s", logo[1][0], logo[1][1]);
}
diff --git a/keyboards/crkbd/keymaps/lib/rgb_state_reader.c b/keyboards/crkbd/keymaps/lib/rgb_state_reader.c
new file mode 100644
index 0000000000..e0efe2e528
--- /dev/null
+++ b/keyboards/crkbd/keymaps/lib/rgb_state_reader.c
@@ -0,0 +1,15 @@
+#ifdef RGBLIGHT_ENABLE
+
+#include QMK_KEYBOARD_H
+#include
+
+extern rgblight_config_t rgblight_config;
+char rbf_info_str[24];
+const char *read_rgb_info(void) {
+
+ snprintf(rbf_info_str, sizeof(rbf_info_str), "%s %2d h%3d s%3d v%3d",
+ rgblight_config.enable ? "on" : "- ", rgblight_config.mode,
+ rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
+ return rbf_info_str;
+}
+#endif
diff --git a/keyboards/crkbd/keymaps/lib/timelogger.c b/keyboards/crkbd/keymaps/lib/timelogger.c
index 0e22bafe7f..69828a3a08 100644
--- a/keyboards/crkbd/keymaps/lib/timelogger.c
+++ b/keyboards/crkbd/keymaps/lib/timelogger.c
@@ -1,17 +1,16 @@
+#include
#include "crkbd.h"
-char timelog[40] = {};
+char timelog_str[24] = {};
int last_time = 0;
int elapsed_time = 0;
-void set_timelog(void)
-{
+void set_timelog(void) {
elapsed_time = timer_elapsed(last_time);
last_time = timer_read();
- snprintf(timelog, sizeof(timelog), "lt:%5d, et:%5d", last_time, elapsed_time);
+ snprintf(timelog_str, sizeof(timelog_str), "lt:%5d, et:%5d", last_time, elapsed_time);
}
-char *read_timelog(void)
-{
- return timelog;
+const char *read_timelog(void) {
+ return timelog_str;
}
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 \
--
cgit v1.2.3
From 35efcc9f398a1a2493b482dd1bd7c859f93ef450 Mon Sep 17 00:00:00 2001
From: marksard <38324387+marksard@users.noreply.github.com>
Date: Tue, 4 Sep 2018 08:34:16 +0900
Subject: Keyboard: Improvement of crkbd communication functions (based on
helix-keyboard) (#3798)
* improvement of crkbd communication functions (based on helix-keyboard)
* Removed unnecessary code.
* Changed read restriction from #define to #pragma once.
* Changed from sizeof to defined size.
* moved lib folder to crkbdroot.
removed warning of ws2812.d
---
keyboards/crkbd/config.h | 13 +-
keyboards/crkbd/crkbd.h | 5 +-
keyboards/crkbd/i2c.c | 2 +-
keyboards/crkbd/i2c.h | 7 +-
keyboards/crkbd/keymaps/default/keymap.c | 2 -
keyboards/crkbd/keymaps/default/rules.mk | 14 +-
.../crkbd/keymaps/lib/host_led_state_reader.c | 15 -
keyboards/crkbd/keymaps/lib/keylogger.c | 45 --
keyboards/crkbd/keymaps/lib/layer_state_reader.c | 35 --
keyboards/crkbd/keymaps/lib/logo_reader.c | 11 -
keyboards/crkbd/keymaps/lib/mode_icon_reader.c | 15 -
keyboards/crkbd/keymaps/lib/rgb_state_reader.c | 15 -
keyboards/crkbd/keymaps/lib/timelogger.c | 16 -
keyboards/crkbd/keymaps/like_jis/keymap.c | 2 -
keyboards/crkbd/keymaps/like_jis/rules.mk | 14 +-
keyboards/crkbd/lib/host_led_state_reader.c | 15 +
keyboards/crkbd/lib/keylogger.c | 45 ++
keyboards/crkbd/lib/layer_state_reader.c | 35 ++
keyboards/crkbd/lib/logo_reader.c | 11 +
keyboards/crkbd/lib/mode_icon_reader.c | 15 +
keyboards/crkbd/lib/rgb_state_reader.c | 15 +
keyboards/crkbd/lib/timelogger.c | 16 +
keyboards/crkbd/pro_micro.h | 6 +-
keyboards/crkbd/rev1/config.h | 8 +-
keyboards/crkbd/rev1/matrix.c | 59 +--
keyboards/crkbd/rev1/rev1.h | 5 +-
keyboards/crkbd/rev1/rules.mk | 5 +-
keyboards/crkbd/rev1/serial_config.h | 10 +
keyboards/crkbd/rev1/serial_config_simpleapi.h | 5 +
keyboards/crkbd/rev1/split_scomm.c | 73 ++++
keyboards/crkbd/rev1/split_scomm.h | 21 +
keyboards/crkbd/rev1/split_util.c | 70 ++++
keyboards/crkbd/rev1/split_util.h | 16 +
keyboards/crkbd/rules.mk | 10 +-
keyboards/crkbd/serial.c | 452 +++++++++++++++------
keyboards/crkbd/serial.h | 83 +++-
keyboards/crkbd/split_util.c | 71 ----
keyboards/crkbd/split_util.h | 19 -
keyboards/crkbd/ssd1306.c | 1 +
keyboards/crkbd/ssd1306.h | 8 +-
40 files changed, 816 insertions(+), 469 deletions(-)
delete mode 100644 keyboards/crkbd/keymaps/lib/host_led_state_reader.c
delete mode 100644 keyboards/crkbd/keymaps/lib/keylogger.c
delete mode 100644 keyboards/crkbd/keymaps/lib/layer_state_reader.c
delete mode 100644 keyboards/crkbd/keymaps/lib/logo_reader.c
delete mode 100644 keyboards/crkbd/keymaps/lib/mode_icon_reader.c
delete mode 100644 keyboards/crkbd/keymaps/lib/rgb_state_reader.c
delete mode 100644 keyboards/crkbd/keymaps/lib/timelogger.c
create mode 100644 keyboards/crkbd/lib/host_led_state_reader.c
create mode 100644 keyboards/crkbd/lib/keylogger.c
create mode 100644 keyboards/crkbd/lib/layer_state_reader.c
create mode 100644 keyboards/crkbd/lib/logo_reader.c
create mode 100644 keyboards/crkbd/lib/mode_icon_reader.c
create mode 100644 keyboards/crkbd/lib/rgb_state_reader.c
create mode 100644 keyboards/crkbd/lib/timelogger.c
create mode 100644 keyboards/crkbd/rev1/serial_config.h
create mode 100644 keyboards/crkbd/rev1/serial_config_simpleapi.h
create mode 100644 keyboards/crkbd/rev1/split_scomm.c
create mode 100644 keyboards/crkbd/rev1/split_scomm.h
create mode 100644 keyboards/crkbd/rev1/split_util.c
create mode 100644 keyboards/crkbd/rev1/split_util.h
delete mode 100644 keyboards/crkbd/split_util.c
delete mode 100644 keyboards/crkbd/split_util.h
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/config.h b/keyboards/crkbd/config.h
index c910d8f24f..64fee75457 100644
--- a/keyboards/crkbd/config.h
+++ b/keyboards/crkbd/config.h
@@ -16,9 +16,16 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#ifndef CONFIG_H
-#define CONFIG_H
+#pragma once
#include "config_common.h"
+#include
-#endif
+#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
diff --git a/keyboards/crkbd/crkbd.h b/keyboards/crkbd/crkbd.h
index 889bcb9ae3..73f2a3f074 100644
--- a/keyboards/crkbd/crkbd.h
+++ b/keyboards/crkbd/crkbd.h
@@ -1,8 +1,5 @@
-#ifndef CRKBD_H
-#define CRKBD_H
+#pragma once
#ifdef KEYBOARD_crkbd_rev1
#include "rev1.h"
#endif
-
-#endif
diff --git a/keyboards/crkbd/i2c.c b/keyboards/crkbd/i2c.c
index 084c890c40..4bee5c6398 100644
--- a/keyboards/crkbd/i2c.c
+++ b/keyboards/crkbd/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/crkbd/i2c.h b/keyboards/crkbd/i2c.h
index c15b6bc506..710662c7ab 100644
--- a/keyboards/crkbd/i2c.h
+++ b/keyboards/crkbd/i2c.h
@@ -1,5 +1,4 @@
-#ifndef I2C_H
-#define I2C_H
+#pragma once
#include
@@ -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/crkbd/keymaps/default/keymap.c b/keyboards/crkbd/keymaps/default/keymap.c
index 87661d3451..e92fbdebfa 100644
--- a/keyboards/crkbd/keymaps/default/keymap.c
+++ b/keyboards/crkbd/keymaps/default/keymap.c
@@ -5,7 +5,6 @@
#include "split_util.h"
#endif
#ifdef SSD1306OLED
- #include "LUFA/Drivers/Peripheral/TWI.h"
#include "ssd1306.h"
#endif
@@ -130,7 +129,6 @@ 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
}
diff --git a/keyboards/crkbd/keymaps/default/rules.mk b/keyboards/crkbd/keymaps/default/rules.mk
index 6570e2f5cb..0edf1181f0 100644
--- a/keyboards/crkbd/keymaps/default/rules.mk
+++ b/keyboards/crkbd/keymaps/default/rules.mk
@@ -21,10 +21,10 @@ SWAP_HANDS_ENABLE = no # Enable one-hand typing
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 \
+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 \
diff --git a/keyboards/crkbd/keymaps/lib/host_led_state_reader.c b/keyboards/crkbd/keymaps/lib/host_led_state_reader.c
deleted file mode 100644
index 41ac55dc2b..0000000000
--- a/keyboards/crkbd/keymaps/lib/host_led_state_reader.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include
-#include "crkbd.h"
-
-char host_led_state_str[24];
-
-const char *read_host_led_state(void)
-{
- uint8_t leds = host_keyboard_leds();
- snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s",
- (leds & (1 << USB_LED_NUM_LOCK)) ? "on" : "- ",
- (leds & (1 << USB_LED_CAPS_LOCK)) ? "on" : "- ",
- (leds & (1 << USB_LED_SCROLL_LOCK)) ? "on" : "- ");
-
- return host_led_state_str;
-}
diff --git a/keyboards/crkbd/keymaps/lib/keylogger.c b/keyboards/crkbd/keymaps/lib/keylogger.c
deleted file mode 100644
index 8f2a8ce3cc..0000000000
--- a/keyboards/crkbd/keymaps/lib/keylogger.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#include
-#include "crkbd.h"
-
-char keylog_str[24] = {};
-char keylogs_str[21] = {};
-int keylogs_str_idx = 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 set_keylog(uint16_t keycode, keyrecord_t *record) {
- char name = ' ';
- if (keycode < 60) {
- name = code_to_name[keycode];
- }
-
- // update keylog
- snprintf(keylog_str, sizeof(keylog_str), "%dx%d, k%2d : %c",
- record->event.key.row, record->event.key.col,
- keycode, name);
-
- // update keylogs
- if (keylogs_str_idx == sizeof(keylogs_str) - 1) {
- keylogs_str_idx = 0;
- for (int i = 0; i < sizeof(keylogs_str) - 1; i++) {
- keylogs_str[i] = ' ';
- }
- }
-
- keylogs_str[keylogs_str_idx] = name;
- keylogs_str_idx++;
-}
-
-const char *read_keylog(void) {
- return keylog_str;
-}
-
-const char *read_keylogs(void) {
- return keylogs_str;
-}
diff --git a/keyboards/crkbd/keymaps/lib/layer_state_reader.c b/keyboards/crkbd/keymaps/lib/layer_state_reader.c
deleted file mode 100644
index eddb71337e..0000000000
--- a/keyboards/crkbd/keymaps/lib/layer_state_reader.c
+++ /dev/null
@@ -1,35 +0,0 @@
-
-#include QMK_KEYBOARD_H
-#include
-#include "crkbd.h"
-
-#define L_BASE 0
-#define L_LOWER 8
-#define L_RAISE 16
-#define L_ADJUST 65536
-#define L_ADJUST_TRI 65560
-
-char layer_state_str[24];
-
-const char *read_layer_state(void) {
- switch (layer_state)
- {
- case L_BASE:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Default");
- break;
- case L_RAISE:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Raise");
- break;
- case L_LOWER:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Lower");
- break;
- case L_ADJUST:
- case L_ADJUST_TRI:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Adjust");
- break;
- default:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Undef-%ld", layer_state);
- }
-
- return layer_state_str;
-}
diff --git a/keyboards/crkbd/keymaps/lib/logo_reader.c b/keyboards/crkbd/keymaps/lib/logo_reader.c
deleted file mode 100644
index 1bc1503a60..0000000000
--- a/keyboards/crkbd/keymaps/lib/logo_reader.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "crkbd.h"
-
-const char *read_logo(void) {
- static char logo[] = {
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
- 0};
-
- return logo;
-}
diff --git a/keyboards/crkbd/keymaps/lib/mode_icon_reader.c b/keyboards/crkbd/keymaps/lib/mode_icon_reader.c
deleted file mode 100644
index 04c226506a..0000000000
--- a/keyboards/crkbd/keymaps/lib/mode_icon_reader.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include
-#include "crkbd.h"
-
-char mode_icon[24];
-
-const char *read_mode_icon(bool swap) {
- static char logo[][2][3] = {{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}};
- if (swap == false) {
- snprintf(mode_icon, sizeof(mode_icon), "%s\n%s", logo[0][0], logo[0][1]);
- } else {
- snprintf(mode_icon, sizeof(mode_icon), "%s\n%s", logo[1][0], logo[1][1]);
- }
-
- return mode_icon;
-}
diff --git a/keyboards/crkbd/keymaps/lib/rgb_state_reader.c b/keyboards/crkbd/keymaps/lib/rgb_state_reader.c
deleted file mode 100644
index e0efe2e528..0000000000
--- a/keyboards/crkbd/keymaps/lib/rgb_state_reader.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifdef RGBLIGHT_ENABLE
-
-#include QMK_KEYBOARD_H
-#include
-
-extern rgblight_config_t rgblight_config;
-char rbf_info_str[24];
-const char *read_rgb_info(void) {
-
- snprintf(rbf_info_str, sizeof(rbf_info_str), "%s %2d h%3d s%3d v%3d",
- rgblight_config.enable ? "on" : "- ", rgblight_config.mode,
- rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
- return rbf_info_str;
-}
-#endif
diff --git a/keyboards/crkbd/keymaps/lib/timelogger.c b/keyboards/crkbd/keymaps/lib/timelogger.c
deleted file mode 100644
index 69828a3a08..0000000000
--- a/keyboards/crkbd/keymaps/lib/timelogger.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include
-#include "crkbd.h"
-
-char timelog_str[24] = {};
-int last_time = 0;
-int elapsed_time = 0;
-
-void set_timelog(void) {
- elapsed_time = timer_elapsed(last_time);
- last_time = timer_read();
- snprintf(timelog_str, sizeof(timelog_str), "lt:%5d, et:%5d", last_time, elapsed_time);
-}
-
-const char *read_timelog(void) {
- return timelog_str;
-}
diff --git a/keyboards/crkbd/keymaps/like_jis/keymap.c b/keyboards/crkbd/keymaps/like_jis/keymap.c
index 31b5230b10..90e5b7ec17 100644
--- a/keyboards/crkbd/keymaps/like_jis/keymap.c
+++ b/keyboards/crkbd/keymaps/like_jis/keymap.c
@@ -5,7 +5,6 @@
#include "split_util.h"
#endif
#ifdef SSD1306OLED
- #include "LUFA/Drivers/Peripheral/TWI.h"
#include "ssd1306.h"
#endif
@@ -124,7 +123,6 @@ 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
}
diff --git a/keyboards/crkbd/keymaps/like_jis/rules.mk b/keyboards/crkbd/keymaps/like_jis/rules.mk
index 6570e2f5cb..0edf1181f0 100644
--- a/keyboards/crkbd/keymaps/like_jis/rules.mk
+++ b/keyboards/crkbd/keymaps/like_jis/rules.mk
@@ -21,10 +21,10 @@ SWAP_HANDS_ENABLE = no # Enable one-hand typing
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 \
+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 \
diff --git a/keyboards/crkbd/lib/host_led_state_reader.c b/keyboards/crkbd/lib/host_led_state_reader.c
new file mode 100644
index 0000000000..41ac55dc2b
--- /dev/null
+++ b/keyboards/crkbd/lib/host_led_state_reader.c
@@ -0,0 +1,15 @@
+#include
+#include "crkbd.h"
+
+char host_led_state_str[24];
+
+const char *read_host_led_state(void)
+{
+ uint8_t leds = host_keyboard_leds();
+ snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s",
+ (leds & (1 << USB_LED_NUM_LOCK)) ? "on" : "- ",
+ (leds & (1 << USB_LED_CAPS_LOCK)) ? "on" : "- ",
+ (leds & (1 << USB_LED_SCROLL_LOCK)) ? "on" : "- ");
+
+ return host_led_state_str;
+}
diff --git a/keyboards/crkbd/lib/keylogger.c b/keyboards/crkbd/lib/keylogger.c
new file mode 100644
index 0000000000..8f2a8ce3cc
--- /dev/null
+++ b/keyboards/crkbd/lib/keylogger.c
@@ -0,0 +1,45 @@
+#include
+#include "crkbd.h"
+
+char keylog_str[24] = {};
+char keylogs_str[21] = {};
+int keylogs_str_idx = 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 set_keylog(uint16_t keycode, keyrecord_t *record) {
+ char name = ' ';
+ if (keycode < 60) {
+ name = code_to_name[keycode];
+ }
+
+ // update keylog
+ snprintf(keylog_str, sizeof(keylog_str), "%dx%d, k%2d : %c",
+ record->event.key.row, record->event.key.col,
+ keycode, name);
+
+ // update keylogs
+ if (keylogs_str_idx == sizeof(keylogs_str) - 1) {
+ keylogs_str_idx = 0;
+ for (int i = 0; i < sizeof(keylogs_str) - 1; i++) {
+ keylogs_str[i] = ' ';
+ }
+ }
+
+ keylogs_str[keylogs_str_idx] = name;
+ keylogs_str_idx++;
+}
+
+const char *read_keylog(void) {
+ return keylog_str;
+}
+
+const char *read_keylogs(void) {
+ return keylogs_str;
+}
diff --git a/keyboards/crkbd/lib/layer_state_reader.c b/keyboards/crkbd/lib/layer_state_reader.c
new file mode 100644
index 0000000000..eddb71337e
--- /dev/null
+++ b/keyboards/crkbd/lib/layer_state_reader.c
@@ -0,0 +1,35 @@
+
+#include QMK_KEYBOARD_H
+#include
+#include "crkbd.h"
+
+#define L_BASE 0
+#define L_LOWER 8
+#define L_RAISE 16
+#define L_ADJUST 65536
+#define L_ADJUST_TRI 65560
+
+char layer_state_str[24];
+
+const char *read_layer_state(void) {
+ switch (layer_state)
+ {
+ case L_BASE:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Default");
+ break;
+ case L_RAISE:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Raise");
+ break;
+ case L_LOWER:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Lower");
+ break;
+ case L_ADJUST:
+ case L_ADJUST_TRI:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Adjust");
+ break;
+ default:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Undef-%ld", layer_state);
+ }
+
+ return layer_state_str;
+}
diff --git a/keyboards/crkbd/lib/logo_reader.c b/keyboards/crkbd/lib/logo_reader.c
new file mode 100644
index 0000000000..1bc1503a60
--- /dev/null
+++ b/keyboards/crkbd/lib/logo_reader.c
@@ -0,0 +1,11 @@
+#include "crkbd.h"
+
+const char *read_logo(void) {
+ static char logo[] = {
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
+ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
+ 0};
+
+ return logo;
+}
diff --git a/keyboards/crkbd/lib/mode_icon_reader.c b/keyboards/crkbd/lib/mode_icon_reader.c
new file mode 100644
index 0000000000..04c226506a
--- /dev/null
+++ b/keyboards/crkbd/lib/mode_icon_reader.c
@@ -0,0 +1,15 @@
+#include
+#include "crkbd.h"
+
+char mode_icon[24];
+
+const char *read_mode_icon(bool swap) {
+ static char logo[][2][3] = {{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}};
+ if (swap == false) {
+ snprintf(mode_icon, sizeof(mode_icon), "%s\n%s", logo[0][0], logo[0][1]);
+ } else {
+ snprintf(mode_icon, sizeof(mode_icon), "%s\n%s", logo[1][0], logo[1][1]);
+ }
+
+ return mode_icon;
+}
diff --git a/keyboards/crkbd/lib/rgb_state_reader.c b/keyboards/crkbd/lib/rgb_state_reader.c
new file mode 100644
index 0000000000..e0efe2e528
--- /dev/null
+++ b/keyboards/crkbd/lib/rgb_state_reader.c
@@ -0,0 +1,15 @@
+#ifdef RGBLIGHT_ENABLE
+
+#include QMK_KEYBOARD_H
+#include
+
+extern rgblight_config_t rgblight_config;
+char rbf_info_str[24];
+const char *read_rgb_info(void) {
+
+ snprintf(rbf_info_str, sizeof(rbf_info_str), "%s %2d h%3d s%3d v%3d",
+ rgblight_config.enable ? "on" : "- ", rgblight_config.mode,
+ rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
+ return rbf_info_str;
+}
+#endif
diff --git a/keyboards/crkbd/lib/timelogger.c b/keyboards/crkbd/lib/timelogger.c
new file mode 100644
index 0000000000..69828a3a08
--- /dev/null
+++ b/keyboards/crkbd/lib/timelogger.c
@@ -0,0 +1,16 @@
+#include
+#include "crkbd.h"
+
+char timelog_str[24] = {};
+int last_time = 0;
+int elapsed_time = 0;
+
+void set_timelog(void) {
+ elapsed_time = timer_elapsed(last_time);
+ last_time = timer_read();
+ snprintf(timelog_str, sizeof(timelog_str), "lt:%5d, et:%5d", last_time, elapsed_time);
+}
+
+const char *read_timelog(void) {
+ return timelog_str;
+}
diff --git a/keyboards/crkbd/pro_micro.h b/keyboards/crkbd/pro_micro.h
index f9e7ed75d9..3666333727 100644
--- a/keyboards/crkbd/pro_micro.h
+++ b/keyboards/crkbd/pro_micro.h
@@ -21,9 +21,7 @@
$Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
*/
-
-#ifndef Pins_Arduino_h
-#define Pins_Arduino_h
+#pragma once
#include
@@ -358,5 +356,3 @@ const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
#define SERIAL_PORT_USBVIRTUAL Serial
#define SERIAL_PORT_HARDWARE Serial1
#define SERIAL_PORT_HARDWARE_OPEN Serial1
-
-#endif /* Pins_Arduino_h */
diff --git a/keyboards/crkbd/rev1/config.h b/keyboards/crkbd/rev1/config.h
index 6321136a73..efce13a490 100644
--- a/keyboards/crkbd/rev1/config.h
+++ b/keyboards/crkbd/rev1/config.h
@@ -16,10 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#ifndef REV1_CONFIG_H
-#define REV1_CONFIG_H
-
-#include "../config.h"
+#pragma once
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
@@ -82,6 +79,3 @@ along with this program. If not, see .
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
-
-
-#endif
diff --git a/keyboards/crkbd/rev1/matrix.c b/keyboards/crkbd/rev1/matrix.c
index 117ff8d37f..718cc57448 100644
--- a/keyboards/crkbd/rev1/matrix.c
+++ b/keyboards/crkbd/rev1/matrix.c
@@ -20,6 +20,7 @@ along with this program. If not, see .
*/
#include
#include
+#include
#include
#include
#include
@@ -30,12 +31,11 @@ along with this program. If not, see .
#include "matrix.h"
#include "split_util.h"
#include "pro_micro.h"
-#include "config.h"
#ifdef USE_MATRIX_I2C
# include "i2c.h"
#else // USE_SERIAL
-# include "serial.h"
+# include "split_scomm.h"
#endif
#ifndef DEBOUNCE
@@ -103,6 +103,8 @@ void matrix_init(void)
init_cols();
TX_RX_LED_INIT;
+ TXLED0;
+ RXLED0;
// initialize matrix state: all keys off
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
@@ -179,17 +181,20 @@ i2c_error: // the cable is disconnceted, or something else went wrong
#else // USE_SERIAL
-int serial_transaction(void) {
+int serial_transaction(int master_changed) {
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
+#ifdef SERIAL_USE_MULTI_TRANSACTION
+ int ret=serial_update_buffers(master_changed);
+#else
int ret=serial_update_buffers();
+#endif
if (ret ) {
- if(ret==2)RXLED1;
+ if(ret==2) RXLED1;
return 1;
}
-RXLED0;
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- matrix[slaveOffset+i] = serial_slave_buffer[i];
- }
+ RXLED0;
+ memcpy(&matrix[slaveOffset],
+ (void *)serial_slave_buffer, SERIAL_SLAVE_BUFFER_LENGTH);
return 0;
}
#endif
@@ -200,19 +205,9 @@ uint8_t matrix_scan(void)
matrix_master_scan();
}else{
matrix_slave_scan();
-
-// if(serial_slave_DATA_CORRUPT()){
-// TXLED0;
- int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
-
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- matrix[offset+i] = serial_master_buffer[i];
- }
-
-// }else{
-// TXLED1;
-// }
-
+ int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
+ memcpy(&matrix[offset],
+ (void *)serial_master_buffer, SERIAL_MASTER_BUFFER_LENGTH);
matrix_scan_quantum();
}
return 1;
@@ -222,6 +217,7 @@ uint8_t matrix_scan(void)
uint8_t matrix_master_scan(void) {
int ret = _matrix_scan();
+ int mchanged = 1;
int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
@@ -231,15 +227,18 @@ uint8_t matrix_master_scan(void) {
// i2c_slave_buffer[i] = matrix[offset+i];
// }
#else // USE_SERIAL
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- serial_master_buffer[i] = matrix[offset+i];
- }
+ #ifdef SERIAL_USE_MULTI_TRANSACTION
+ mchanged = memcmp((void *)serial_master_buffer,
+ &matrix[offset], SERIAL_MASTER_BUFFER_LENGTH);
+ #endif
+ memcpy((void *)serial_master_buffer,
+ &matrix[offset], SERIAL_MASTER_BUFFER_LENGTH);
#endif
#ifdef USE_MATRIX_I2C
if( i2c_transaction() ) {
#else // USE_SERIAL
- if( serial_transaction() ) {
+ if( serial_transaction(mchanged) ) {
#endif
// turn on the indicator led when halves are disconnected
TXLED1;
@@ -273,9 +272,19 @@ void matrix_slave_scan(void) {
i2c_slave_buffer[i] = matrix[offset+i];
}
#else // USE_SERIAL
+ #ifdef SERIAL_USE_MULTI_TRANSACTION
+ int change = 0;
+ #endif
for (int i = 0; i < ROWS_PER_HAND; ++i) {
+ #ifdef SERIAL_USE_MULTI_TRANSACTION
+ if( serial_slave_buffer[i] != matrix[offset+i] )
+ change = 1;
+ #endif
serial_slave_buffer[i] = matrix[offset+i];
}
+ #ifdef SERIAL_USE_MULTI_TRANSACTION
+ slave_buffer_change_count += change;
+ #endif
#endif
}
diff --git a/keyboards/crkbd/rev1/rev1.h b/keyboards/crkbd/rev1/rev1.h
index d02c51f30e..cdd61d2bf9 100644
--- a/keyboards/crkbd/rev1/rev1.h
+++ b/keyboards/crkbd/rev1/rev1.h
@@ -1,5 +1,4 @@
-#ifndef REV1_H
-#define REV1_CONFIG_H
+#pragma once
#include "../crkbd.h"
@@ -49,5 +48,3 @@
KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \
KC_##L30, KC_##L31, KC_##L32, KC_##R30, KC_##R31, KC_##R32 \
)
-
-#endif
diff --git a/keyboards/crkbd/rev1/rules.mk b/keyboards/crkbd/rev1/rules.mk
index 7af7ffdb8a..6028b5a5b9 100644
--- a/keyboards/crkbd/rev1/rules.mk
+++ b/keyboards/crkbd/rev1/rules.mk
@@ -1,2 +1,3 @@
-SRC += rev1/matrix.c \
- ws2812.c
+SRC += rev1/matrix.c
+SRC += rev1/split_util.c
+SRC += rev1/split_scomm.c
diff --git a/keyboards/crkbd/rev1/serial_config.h b/keyboards/crkbd/rev1/serial_config.h
new file mode 100644
index 0000000000..671ed821d2
--- /dev/null
+++ b/keyboards/crkbd/rev1/serial_config.h
@@ -0,0 +1,10 @@
+#pragma once
+
+/* Soft Serial defines */
+#define SERIAL_PIN_DDR DDRD
+#define SERIAL_PIN_PORT PORTD
+#define SERIAL_PIN_INPUT PIND
+#define SERIAL_PIN_MASK _BV(PD2)
+#define SERIAL_PIN_INTERRUPT INT2_vect
+
+#define SERIAL_USE_MULTI_TRANSACTION
diff --git a/keyboards/crkbd/rev1/serial_config_simpleapi.h b/keyboards/crkbd/rev1/serial_config_simpleapi.h
new file mode 100644
index 0000000000..0e1dd9e4ac
--- /dev/null
+++ b/keyboards/crkbd/rev1/serial_config_simpleapi.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#undef SERIAL_USE_MULTI_TRANSACTION
+#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
+#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
diff --git a/keyboards/crkbd/rev1/split_scomm.c b/keyboards/crkbd/rev1/split_scomm.c
new file mode 100644
index 0000000000..9719eb22ea
--- /dev/null
+++ b/keyboards/crkbd/rev1/split_scomm.c
@@ -0,0 +1,73 @@
+#ifdef USE_SERIAL
+#ifdef SERIAL_USE_MULTI_TRANSACTION
+/* --- USE flexible API (using multi-type transaction function) --- */
+
+#include
+#include
+#include
+#include
+#include "serial.h"
+#ifdef SERIAL_DEBUG_MODE
+#include
+#endif
+
+uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
+uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
+uint8_t volatile status_com = 0;
+uint8_t volatile status1 = 0;
+uint8_t slave_buffer_change_count = 0;
+uint8_t s_change_old = 0xff;
+
+SSTD_t transactions[] = {
+#define GET_SLAVE_STATUS 0
+ /* master buffer not changed, only recive slave_buffer_change_count */
+ { (uint8_t *)&status_com,
+ 0, NULL,
+ sizeof(slave_buffer_change_count), &slave_buffer_change_count,
+ },
+#define PUT_MASTER_GET_SLAVE_STATUS 1
+ /* master buffer changed need send, and recive slave_buffer_change_count */
+ { (uint8_t *)&status_com,
+ sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
+ sizeof(slave_buffer_change_count), &slave_buffer_change_count,
+ },
+#define GET_SLAVE_BUFFER 2
+ /* recive serial_slave_buffer */
+ { (uint8_t *)&status1,
+ 0, NULL,
+ sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
+ }
+};
+
+void serial_master_init(void)
+{
+ soft_serial_initiator_init(transactions);
+}
+
+void serial_slave_init(void)
+{
+ soft_serial_target_init(transactions);
+}
+
+// 0 => no error
+// 1 => slave did not respond
+// 2 => checksum error
+int serial_update_buffers(int master_update)
+{
+ int status;
+ static int need_retry = 0;
+ if( s_change_old != slave_buffer_change_count ) {
+ status = soft_serial_transaction(GET_SLAVE_BUFFER);
+ if( status == TRANSACTION_END )
+ s_change_old = slave_buffer_change_count;
+ }
+ if( !master_update && !need_retry)
+ status = soft_serial_transaction(GET_SLAVE_STATUS);
+ else
+ status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS);
+ need_retry = ( status == TRANSACTION_END ) ? 0 : 1;
+ return status;
+}
+
+#endif // SERIAL_USE_MULTI_TRANSACTION
+#endif /* USE_SERIAL */
diff --git a/keyboards/crkbd/rev1/split_scomm.h b/keyboards/crkbd/rev1/split_scomm.h
new file mode 100644
index 0000000000..16887eb74f
--- /dev/null
+++ b/keyboards/crkbd/rev1/split_scomm.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#ifndef SERIAL_USE_MULTI_TRANSACTION
+/* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */
+#include "serial.h"
+
+#else
+/* --- USE flexible API (using multi-type transaction function) --- */
+// Buffers for master - slave communication
+#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
+#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
+
+extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
+extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
+extern uint8_t slave_buffer_change_count;
+
+void serial_master_init(void);
+void serial_slave_init(void);
+int serial_update_buffers(int master_changed);
+
+#endif
diff --git a/keyboards/crkbd/rev1/split_util.c b/keyboards/crkbd/rev1/split_util.c
new file mode 100644
index 0000000000..e1ff8b4379
--- /dev/null
+++ b/keyboards/crkbd/rev1/split_util.c
@@ -0,0 +1,70 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include "split_util.h"
+#include "matrix.h"
+#include "keyboard.h"
+
+#ifdef USE_MATRIX_I2C
+# include "i2c.h"
+#else
+# include "split_scomm.h"
+#endif
+
+volatile bool isLeftHand = true;
+
+static void setup_handedness(void) {
+ #ifdef EE_HANDS
+ isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
+ #else
+ // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
+ #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
+ isLeftHand = !has_usb();
+ #else
+ isLeftHand = has_usb();
+ #endif
+ #endif
+}
+
+static void keyboard_master_setup(void) {
+
+#ifdef USE_MATRIX_I2C
+ i2c_master_init();
+#else
+ serial_master_init();
+#endif
+}
+
+static void keyboard_slave_setup(void) {
+
+#ifdef USE_MATRIX_I2C
+ i2c_slave_init(SLAVE_I2C_ADDRESS);
+#else
+ serial_slave_init();
+#endif
+}
+
+bool has_usb(void) {
+ USBCON |= (1 << OTGPADE); //enables VBUS pad
+ _delay_us(5);
+ return (USBSTA & (1<
+#include "eeconfig.h"
+
+#define SLAVE_I2C_ADDRESS 0x32
+
+extern volatile bool isLeftHand;
+
+// slave version of matix scan, defined in matrix.c
+void matrix_slave_scan(void);
+
+void split_keyboard_setup(void);
+bool has_usb(void);
+
+void matrix_master_OLED_init (void);
diff --git a/keyboards/crkbd/rules.mk b/keyboards/crkbd/rules.mk
index d88daebf3a..6396b115de 100644
--- a/keyboards/crkbd/rules.mk
+++ b/keyboards/crkbd/rules.mk
@@ -1,7 +1,9 @@
-SRC += i2c.c \
- serial.c \
- split_util.c \
- ssd1306.c
+SRC += i2c.c
+SRC += serial.c
+SRC += ssd1306.c
+
+# if firmware size over limit, try this option
+# CFLAGS += -flto
# MCU name
#MCU = at90usb1287
diff --git a/keyboards/crkbd/serial.c b/keyboards/crkbd/serial.c
index e918ab6ee6..11ceff0b37 100644
--- a/keyboards/crkbd/serial.c
+++ b/keyboards/crkbd/serial.c
@@ -9,36 +9,128 @@
#include
#include
#include
+#include
#include
#include "serial.h"
+//#include
#ifdef USE_SERIAL
-// Serial pulse period in microseconds. Its probably a bad idea to lower this
-// value.
-#define SERIAL_DELAY 24
+#ifndef SERIAL_USE_MULTI_TRANSACTION
+/* --- USE Simple API (OLD API, compatible with let's split serial.c) */
+ #if SERIAL_SLAVE_BUFFER_LENGTH > 0
+ uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
+ #endif
+ #if SERIAL_MASTER_BUFFER_LENGTH > 0
+ uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
+ #endif
+ uint8_t volatile status0 = 0;
+
+SSTD_t transactions[] = {
+ { (uint8_t *)&status0,
+ #if SERIAL_MASTER_BUFFER_LENGTH > 0
+ sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
+ #else
+ 0, (uint8_t *)NULL,
+ #endif
+ #if SERIAL_SLAVE_BUFFER_LENGTH > 0
+ sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
+ #else
+ 0, (uint8_t *)NULL,
+ #endif
+ }
+};
+
+void serial_master_init(void)
+{ soft_serial_initiator_init(transactions); }
-uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
-uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
+void serial_slave_init(void)
+{ soft_serial_target_init(transactions); }
-#define SLAVE_DATA_CORRUPT (1<<0)
-volatile uint8_t status = 0;
+// 0 => no error
+// 1 => slave did not respond
+// 2 => checksum error
+int serial_update_buffers()
+{ return soft_serial_transaction(); }
+
+#endif // Simple API (OLD API, compatible with let's split serial.c)
+
+#define ALWAYS_INLINE __attribute__((always_inline))
+#define NO_INLINE __attribute__((noinline))
+#define _delay_sub_us(x) __builtin_avr_delay_cycles(x)
+
+// Serial pulse period in microseconds.
+#define TID_SEND_ADJUST 14
+
+#define SELECT_SERIAL_SPEED 1
+#if SELECT_SERIAL_SPEED == 0
+ // Very High speed
+ #define SERIAL_DELAY 4 // micro sec
+ #define READ_WRITE_START_ADJUST 33 // cycles
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+#elif SELECT_SERIAL_SPEED == 1
+ // High speed
+ #define SERIAL_DELAY 6 // micro sec
+ #define READ_WRITE_START_ADJUST 30 // cycles
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+#elif SELECT_SERIAL_SPEED == 2
+ // Middle speed
+ #define SERIAL_DELAY 12 // micro sec
+ #define READ_WRITE_START_ADJUST 30 // cycles
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+#elif SELECT_SERIAL_SPEED == 3
+ // Low speed
+ #define SERIAL_DELAY 24 // micro sec
+ #define READ_WRITE_START_ADJUST 30 // cycles
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+#elif SELECT_SERIAL_SPEED == 4
+ // Very Low speed
+ #define SERIAL_DELAY 50 // micro sec
+ #define READ_WRITE_START_ADJUST 30 // cycles
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+#else
+#error Illegal Serial Speed
+#endif
+
+
+#define SERIAL_DELAY_HALF1 (SERIAL_DELAY/2)
+#define SERIAL_DELAY_HALF2 (SERIAL_DELAY - SERIAL_DELAY/2)
+
+#define SLAVE_INT_WIDTH_US 1
+#ifndef SERIAL_USE_MULTI_TRANSACTION
+ #define SLAVE_INT_RESPONSE_TIME SERIAL_DELAY
+#else
+ #define SLAVE_INT_ACK_WIDTH_UNIT 2
+ #define SLAVE_INT_ACK_WIDTH 4
+#endif
+
+static SSTD_t *Transaction_table = NULL;
inline static
void serial_delay(void) {
_delay_us(SERIAL_DELAY);
}
-void serial_delay_short(void) {
- _delay_us(SERIAL_DELAY-1);
+
+inline static
+void serial_delay_half1(void) {
+ _delay_us(SERIAL_DELAY_HALF1);
+}
+
+inline static
+void serial_delay_half2(void) {
+ _delay_us(SERIAL_DELAY_HALF2);
}
+
+inline static void serial_output(void) ALWAYS_INLINE;
inline static
void serial_output(void) {
SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
}
// make the serial pin an input with pull-up resistor
+inline static void serial_input_with_pullup(void) ALWAYS_INLINE;
inline static
-void serial_input(void) {
+void serial_input_with_pullup(void) {
SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK;
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
}
@@ -48,191 +140,305 @@ uint8_t serial_read_pin(void) {
return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
}
+inline static void serial_low(void) ALWAYS_INLINE;
inline static
void serial_low(void) {
SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
}
+inline static void serial_high(void) ALWAYS_INLINE;
inline static
void serial_high(void) {
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
}
-void serial_master_init(void) {
- serial_output();
- serial_high();
+void soft_serial_initiator_init(SSTD_t *sstd_table)
+{
+ Transaction_table = sstd_table;
+ serial_output();
+ serial_high();
}
-void serial_slave_init(void) {
- serial_input();
-
-#ifndef USE_SERIAL_PD2
- // Enable INT0
- EIMSK |= _BV(INT0);
- // Trigger on falling edge of INT0
- EICRA &= ~(_BV(ISC00) | _BV(ISC01));
+void soft_serial_target_init(SSTD_t *sstd_table)
+{
+ Transaction_table = sstd_table;
+ serial_input_with_pullup();
+
+#if SERIAL_PIN_MASK == _BV(PD0)
+ // Enable INT0
+ EIMSK |= _BV(INT0);
+ // Trigger on falling edge of INT0
+ EICRA &= ~(_BV(ISC00) | _BV(ISC01));
+#elif SERIAL_PIN_MASK == _BV(PD2)
+ // Enable INT2
+ EIMSK |= _BV(INT2);
+ // Trigger on falling edge of INT2
+ EICRA &= ~(_BV(ISC20) | _BV(ISC21));
#else
- // Enable INT2
- EIMSK |= _BV(INT2);
- // Trigger on falling edge of INT2
- EICRA &= ~(_BV(ISC20) | _BV(ISC21));
+ #error unknown SERIAL_PIN_MASK value
#endif
}
-// Used by the master to synchronize timing with the slave.
+// Used by the sender to synchronize timing with the reciver.
+static void sync_recv(void) NO_INLINE;
static
void sync_recv(void) {
- serial_input();
- // This shouldn't hang if the slave disconnects because the
- // serial line will float to high if the slave does disconnect.
+ for (uint8_t i = 0; i < SERIAL_DELAY*5 && serial_read_pin(); i++ ) {
+ }
+ // This shouldn't hang if the target disconnects because the
+ // serial line will float to high if the target does disconnect.
while (!serial_read_pin());
- //serial_delay();
- _delay_us(SERIAL_DELAY-5);
}
-// Used by the slave to send a synchronization signal to the master.
+// Used by the reciver to send a synchronization signal to the sender.
+static void sync_send(void)NO_INLINE;
static
void sync_send(void) {
- serial_output();
-
serial_low();
serial_delay();
-
serial_high();
}
// Reads a byte from the serial line
-static
-uint8_t serial_read_byte(void) {
- uint8_t byte = 0;
- serial_input();
- for ( uint8_t i = 0; i < 8; ++i) {
- byte = (byte << 1) | serial_read_pin();
- serial_delay();
- _delay_us(1);
+static uint8_t serial_read_chunk(uint8_t *pterrcount, uint8_t bit) NO_INLINE;
+static uint8_t serial_read_chunk(uint8_t *pterrcount, uint8_t bit) {
+ uint8_t byte, i, p, pb;
+
+ _delay_sub_us(READ_WRITE_START_ADJUST);
+ for( i = 0, byte = 0, p = 0; i < bit; i++ ) {
+ serial_delay_half1(); // read the middle of pulses
+ if( serial_read_pin() ) {
+ byte = (byte << 1) | 1; p ^= 1;
+ } else {
+ byte = (byte << 1) | 0; p ^= 0;
+ }
+ _delay_sub_us(READ_WRITE_WIDTH_ADJUST);
+ serial_delay_half2();
}
+ /* recive parity bit */
+ serial_delay_half1(); // read the middle of pulses
+ pb = serial_read_pin();
+ _delay_sub_us(READ_WRITE_WIDTH_ADJUST);
+ serial_delay_half2();
+
+ *pterrcount += (p != pb)? 1 : 0;
return byte;
}
// Sends a byte with MSB ordering
-static
-void serial_write_byte(uint8_t data) {
- uint8_t b = 8;
- serial_output();
- while( b-- ) {
- if(data & (1 << b)) {
- serial_high();
- } else {
- serial_low();
+void serial_write_chunk(uint8_t data, uint8_t bit) NO_INLINE;
+void serial_write_chunk(uint8_t data, uint8_t bit) {
+ uint8_t b, p;
+ for( p = 0, b = 1<<(bit-1); b ; b >>= 1) {
+ if(data & b) {
+ serial_high(); p ^= 1;
+ } else {
+ serial_low(); p ^= 0;
+ }
+ serial_delay();
}
+ /* send parity bit */
+ if(p & 1) { serial_high(); }
+ else { serial_low(); }
serial_delay();
- }
-}
-// interrupt handle to be used by the slave device
-ISR(SERIAL_PIN_INTERRUPT) {
- sync_send();
+ serial_low(); // sync_send() / senc_recv() need raise edge
+}
- uint8_t checksum = 0;
- for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
- serial_write_byte(serial_slave_buffer[i]);
+static void serial_send_packet(uint8_t *buffer, uint8_t size) NO_INLINE;
+static
+void serial_send_packet(uint8_t *buffer, uint8_t size) {
+ for (uint8_t i = 0; i < size; ++i) {
+ uint8_t data;
+ data = buffer[i];
sync_send();
- checksum += serial_slave_buffer[i];
+ serial_write_chunk(data,8);
}
- serial_write_byte(checksum);
- sync_send();
+}
- // wait for the sync to finish sending
- serial_delay();
+static uint8_t serial_recive_packet(uint8_t *buffer, uint8_t size) NO_INLINE;
+static
+uint8_t serial_recive_packet(uint8_t *buffer, uint8_t size) {
+ uint8_t pecount = 0;
+ for (uint8_t i = 0; i < size; ++i) {
+ uint8_t data;
+ sync_recv();
+ data = serial_read_chunk(&pecount, 8);
+ buffer[i] = data;
+ }
+ return pecount == 0;
+}
- // read the middle of pulses
- _delay_us(SERIAL_DELAY/2);
+inline static
+void change_sender2reciver(void) {
+ sync_send(); //0
+ serial_delay_half1(); //1
+ serial_low(); //2
+ serial_input_with_pullup(); //2
+ serial_delay_half1(); //3
+}
- uint8_t checksum_computed = 0;
- for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
- serial_master_buffer[i] = serial_read_byte();
- sync_send();
- checksum_computed += serial_master_buffer[i];
- }
- uint8_t checksum_received = serial_read_byte();
- sync_send();
+inline static
+void change_reciver2sender(void) {
+ sync_recv(); //0
+ serial_delay(); //1
+ serial_low(); //3
+ serial_output(); //3
+ serial_delay_half1(); //4
+}
- serial_input(); // end transaction
+// interrupt handle to be used by the target device
+ISR(SERIAL_PIN_INTERRUPT) {
- if ( checksum_computed != checksum_received ) {
- status |= SLAVE_DATA_CORRUPT;
+#ifndef SERIAL_USE_MULTI_TRANSACTION
+ serial_low();
+ serial_output();
+ SSTD_t *trans = Transaction_table;
+#else
+ // recive transaction table index
+ uint8_t tid;
+ uint8_t pecount = 0;
+ sync_recv();
+ tid = serial_read_chunk(&pecount,4);
+ if(pecount> 0)
+ return;
+ serial_delay_half1();
+
+ serial_high(); // response step1 low->high
+ serial_output();
+ _delay_sub_us(SLAVE_INT_ACK_WIDTH_UNIT*SLAVE_INT_ACK_WIDTH);
+ SSTD_t *trans = &Transaction_table[tid];
+ serial_low(); // response step2 ack high->low
+#endif
+
+ // target send phase
+ if( trans->target2initiator_buffer_size > 0 )
+ serial_send_packet((uint8_t *)trans->target2initiator_buffer,
+ trans->target2initiator_buffer_size);
+ // target switch to input
+ change_sender2reciver();
+
+ // target recive phase
+ if( trans->initiator2target_buffer_size > 0 ) {
+ if (serial_recive_packet((uint8_t *)trans->initiator2target_buffer,
+ trans->initiator2target_buffer_size) ) {
+ *trans->status = TRANSACTION_ACCEPTED;
+ } else {
+ *trans->status = TRANSACTION_DATA_ERROR;
+ }
} else {
- status &= ~SLAVE_DATA_CORRUPT;
+ *trans->status = TRANSACTION_ACCEPTED;
}
-}
-inline
-bool serial_slave_DATA_CORRUPT(void) {
- return status & SLAVE_DATA_CORRUPT;
+ sync_recv(); //weit initiator output to high
}
-// Copies the serial_slave_buffer to the master and sends the
-// serial_master_buffer to the slave.
+/////////
+// start transaction by initiator
+//
+// int soft_serial_transaction(int sstd_index)
//
// Returns:
-// 0 => no error
-// 1 => slave did not respond
-int serial_update_buffers(void) {
- // this code is very time dependent, so we need to disable interrupts
+// TRANSACTION_END
+// TRANSACTION_NO_RESPONSE
+// TRANSACTION_DATA_ERROR
+// this code is very time dependent, so we need to disable interrupts
+#ifndef SERIAL_USE_MULTI_TRANSACTION
+int soft_serial_transaction(void) {
+ SSTD_t *trans = Transaction_table;
+#else
+int soft_serial_transaction(int sstd_index) {
+ SSTD_t *trans = &Transaction_table[sstd_index];
+#endif
cli();
- // signal to the slave that we want to start a transaction
+ // signal to the target that we want to start a transaction
serial_output();
serial_low();
- _delay_us(1);
+ _delay_us(SLAVE_INT_WIDTH_US);
- // wait for the slaves response
- serial_input();
- serial_high();
- _delay_us(SERIAL_DELAY);
+#ifndef SERIAL_USE_MULTI_TRANSACTION
+ // wait for the target response
+ serial_input_with_pullup();
+ _delay_us(SLAVE_INT_RESPONSE_TIME);
- // check if the slave is present
+ // check if the target is present
if (serial_read_pin()) {
- // slave failed to pull the line low, assume not present
+ // target failed to pull the line low, assume not present
+ serial_output();
+ serial_high();
+ *trans->status = TRANSACTION_NO_RESPONSE;
sei();
- return 1;
+ return TRANSACTION_NO_RESPONSE;
}
- // if the slave is present syncronize with it
- sync_recv();
-
- uint8_t checksum_computed = 0;
- // receive data from the slave
- for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
- serial_slave_buffer[i] = serial_read_byte();
- sync_recv();
- checksum_computed += serial_slave_buffer[i];
+#else
+ // send transaction table index
+ sync_send();
+ _delay_sub_us(TID_SEND_ADJUST);
+ serial_write_chunk(sstd_index, 4);
+ serial_delay_half1();
+
+ // wait for the target response (step1 low->high)
+ serial_input_with_pullup();
+ while( !serial_read_pin() ) {
+ _delay_sub_us(2);
}
- uint8_t checksum_received = serial_read_byte();
- sync_recv();
- if (checksum_computed != checksum_received) {
- sei();
- return 2;
+ // check if the target is present (step2 high->low)
+ for( int i = 0; serial_read_pin(); i++ ) {
+ if (i > SLAVE_INT_ACK_WIDTH + 1) {
+ // slave failed to pull the line low, assume not present
+ serial_output();
+ serial_high();
+ *trans->status = TRANSACTION_NO_RESPONSE;
+ sei();
+ return TRANSACTION_NO_RESPONSE;
+ }
+ _delay_sub_us(SLAVE_INT_ACK_WIDTH_UNIT);
}
+#endif
- uint8_t checksum = 0;
- // send data to the slave
- for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
- serial_write_byte(serial_master_buffer[i]);
- sync_recv();
- checksum += serial_master_buffer[i];
+ // initiator recive phase
+ // if the target is present syncronize with it
+ if( trans->target2initiator_buffer_size > 0 ) {
+ if (!serial_recive_packet((uint8_t *)trans->target2initiator_buffer,
+ trans->target2initiator_buffer_size) ) {
+ serial_output();
+ serial_high();
+ *trans->status = TRANSACTION_DATA_ERROR;
+ sei();
+ return TRANSACTION_DATA_ERROR;
+ }
+ }
+
+ // initiator switch to output
+ change_reciver2sender();
+
+ // initiator send phase
+ if( trans->initiator2target_buffer_size > 0 ) {
+ serial_send_packet((uint8_t *)trans->initiator2target_buffer,
+ trans->initiator2target_buffer_size);
}
- serial_write_byte(checksum);
- sync_recv();
// always, release the line when not in use
- serial_output();
- serial_high();
+ sync_send();
+ *trans->status = TRANSACTION_END;
sei();
- return 0;
+ return TRANSACTION_END;
}
+#ifdef SERIAL_USE_MULTI_TRANSACTION
+int soft_serial_get_and_clean_status(int sstd_index) {
+ SSTD_t *trans = &Transaction_table[sstd_index];
+ cli();
+ int retval = *trans->status;
+ *trans->status = 0;;
+ sei();
+ return retval;
+}
+#endif
+
#endif
diff --git a/keyboards/crkbd/serial.h b/keyboards/crkbd/serial.h
index 43e51f7fa4..76c6aaa043 100644
--- a/keyboards/crkbd/serial.h
+++ b/keyboards/crkbd/serial.h
@@ -1,32 +1,77 @@
-#ifndef MY_SERIAL_H
-#define MY_SERIAL_H
+#pragma once
-#include "config.h"
#include
-/* TODO: some defines for interrupt setup */
-#define SERIAL_PIN_DDR DDRD
-#define SERIAL_PIN_PORT PORTD
-#define SERIAL_PIN_INPUT PIND
+// /////////////////////////////////////////////////////////////////
+// Need Soft Serial defines in serial_config.h
+// /////////////////////////////////////////////////////////////////
+// ex.
+// #define SERIAL_PIN_DDR DDRD
+// #define SERIAL_PIN_PORT PORTD
+// #define SERIAL_PIN_INPUT PIND
+// #define SERIAL_PIN_MASK _BV(PD?) ?=0,2
+// #define SERIAL_PIN_INTERRUPT INT?_vect ?=0,2
+//
+// //// USE Simple API (OLD API, compatible with let's split serial.c)
+// ex.
+// #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
+// #define SERIAL_MASTER_BUFFER_LENGTH 1
+//
+// //// USE flexible API (using multi-type transaction function)
+// #define SERIAL_USE_MULTI_TRANSACTION
+//
+// /////////////////////////////////////////////////////////////////
-#ifndef USE_SERIAL_PD2
-#define SERIAL_PIN_MASK _BV(PD0)
-#define SERIAL_PIN_INTERRUPT INT0_vect
-#else
-#define SERIAL_PIN_MASK _BV(PD2)
-#define SERIAL_PIN_INTERRUPT INT2_vect
-#endif
-
-#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
-#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
-// Buffers for master - slave communication
+#ifndef SERIAL_USE_MULTI_TRANSACTION
+/* --- USE Simple API (OLD API, compatible with let's split serial.c) */
+#if SERIAL_SLAVE_BUFFER_LENGTH > 0
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
+#endif
+#if SERIAL_MASTER_BUFFER_LENGTH > 0
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
+#endif
void serial_master_init(void);
void serial_slave_init(void);
int serial_update_buffers(void);
-bool serial_slave_data_corrupt(void);
+#endif // USE Simple API
+
+// Soft Serial Transaction Descriptor
+typedef struct _SSTD_t {
+ uint8_t *status;
+ uint8_t initiator2target_buffer_size;
+ uint8_t *initiator2target_buffer;
+ uint8_t target2initiator_buffer_size;
+ uint8_t *target2initiator_buffer;
+} SSTD_t;
+
+// initiator is transaction start side
+void soft_serial_initiator_init(SSTD_t *sstd_table);
+// target is interrupt accept side
+void soft_serial_target_init(SSTD_t *sstd_table);
+
+// initiator resullt
+#define TRANSACTION_END 0
+#define TRANSACTION_NO_RESPONSE 0x1
+#define TRANSACTION_DATA_ERROR 0x2
+#ifndef SERIAL_USE_MULTI_TRANSACTION
+int soft_serial_transaction(void);
+#else
+int soft_serial_transaction(int sstd_index);
+#endif
+
+// target status
+// *SSTD_t.status has
+// initiator:
+// TRANSACTION_END
+// or TRANSACTION_NO_RESPONSE
+// or TRANSACTION_DATA_ERROR
+// target:
+// TRANSACTION_DATA_ERROR
+// or TRANSACTION_ACCEPTED
+#define TRANSACTION_ACCEPTED 0x4
+#ifdef SERIAL_USE_MULTI_TRANSACTION
+int soft_serial_get_and_clean_status(int sstd_index);
#endif
diff --git a/keyboards/crkbd/split_util.c b/keyboards/crkbd/split_util.c
deleted file mode 100644
index 8bc064174e..0000000000
--- a/keyboards/crkbd/split_util.c
+++ /dev/null
@@ -1,71 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include "split_util.h"
-#include "matrix.h"
-#include "keyboard.h"
-#include "config.h"
-
-#ifdef USE_MATRIX_I2C
-# include "i2c.h"
-#else
-# include "serial.h"
-#endif
-
-volatile bool isLeftHand = true;
-
-static void setup_handedness(void) {
- #ifdef EE_HANDS
- isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
- #else
- // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
- #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
- isLeftHand = !has_usb();
- #else
- isLeftHand = has_usb();
- #endif
- #endif
-}
-
-static void keyboard_master_setup(void) {
-
-#ifdef USE_MATRIX_I2C
- i2c_master_init();
-#else
- serial_master_init();
-#endif
-}
-
-static void keyboard_slave_setup(void) {
-
-#ifdef USE_MATRIX_I2C
- i2c_slave_init(SLAVE_I2C_ADDRESS);
-#else
- serial_slave_init();
-#endif
-}
-
-bool has_usb(void) {
- USBCON |= (1 << OTGPADE); //enables VBUS pad
- _delay_us(5);
- return (USBSTA & (1<
-#include "eeconfig.h"
-
-#define SLAVE_I2C_ADDRESS 0x32
-
-extern volatile bool isLeftHand;
-
-// slave version of matix scan, defined in matrix.c
-void matrix_slave_scan(void);
-
-void split_keyboard_setup(void);
-bool has_usb(void);
-
-void matrix_master_OLED_init (void);
-
-#endif
diff --git a/keyboards/crkbd/ssd1306.c b/keyboards/crkbd/ssd1306.c
index d079001199..b8f9512e3f 100644
--- a/keyboards/crkbd/ssd1306.c
+++ b/keyboards/crkbd/ssd1306.c
@@ -123,6 +123,7 @@ static int8_t capture_sendchar(uint8_t c) {
bool iota_gfx_init(bool rotate) {
bool success = false;
+ i2c_master_init();
send_cmd1(DisplayOff);
send_cmd2(SetDisplayClockDiv, 0x80);
send_cmd2(SetMultiPlex, DisplayHeight - 1);
diff --git a/keyboards/crkbd/ssd1306.h b/keyboards/crkbd/ssd1306.h
index 59d31c9f32..76dd6a2a72 100644
--- a/keyboards/crkbd/ssd1306.h
+++ b/keyboards/crkbd/ssd1306.h
@@ -1,10 +1,8 @@
-#ifndef SSD1306_H
-#define SSD1306_H
+#pragma once
#include
#include
#include "pincontrol.h"
-#include "config.h"
enum ssd1306_cmds {
DisplayOff = 0xAE,
@@ -88,7 +86,3 @@ void matrix_write(struct CharacterMatrix *matrix, const char *data);
void matrix_write_ln(struct CharacterMatrix *matrix, const char *data);
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
void matrix_render(struct CharacterMatrix *matrix);
-
-
-
-#endif
--
cgit v1.2.3
From 743449472e58651ec8111e6f70811103fb0a28bd Mon Sep 17 00:00:00 2001
From: Joe Wasson
Date: Mon, 17 Sep 2018 10:48:02 -0700
Subject: Make `PREVENT_STUCK_MODIFIERS` the default (#3107)
* Remove chording as it is not documented, not used, and needs work.
* Make Leader Key an optional feature.
* Switch from `PREVENT_STUCK_MODIFIERS` to `STRICT_LAYER_RELEASE`
* Remove `#define PREVENT_STUCK_MODIFIERS` from keymaps.
---
keyboards/crkbd/keymaps/default/config.h | 1 -
1 file changed, 1 deletion(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/default/config.h b/keyboards/crkbd/keymaps/default/config.h
index 8d25f7cbc6..c573530f74 100644
--- a/keyboards/crkbd/keymaps/default/config.h
+++ b/keyboards/crkbd/keymaps/default/config.h
@@ -36,7 +36,6 @@ along with this program. If not, see .
#define USE_SERIAL_PD2
-#define PREVENT_STUCK_MODIFIERS
#define TAPPING_FORCE_HOLD
#define TAPPING_TERM 100
--
cgit v1.2.3
From 07d317ab8877f935768e8798c1560242e3687847 Mon Sep 17 00:00:00 2001
From: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
Date: Sun, 23 Sep 2018 18:47:43 -0700
Subject: Keyboard: Crkbd: move I2C and Serial defines to keyboard's config.h
(#3970)
* Crkbd: move I2C and Serial defines to keyboard's config.h
per @drashna on Discord
* Crkbd: remove misleading comment re: I2C and Serial
USE_I2C and USE_SERIAL are usually a "one or the other"-type deal, but this keyboard uses both.
---
keyboards/crkbd/config.h | 3 +++
keyboards/crkbd/keymaps/default/config.h | 4 ----
keyboards/crkbd/keymaps/like_jis/config.h | 4 ----
3 files changed, 3 insertions(+), 8 deletions(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/config.h b/keyboards/crkbd/config.h
index 64fee75457..4357a218d4 100644
--- a/keyboards/crkbd/config.h
+++ b/keyboards/crkbd/config.h
@@ -21,6 +21,9 @@ along with this program. If not, see .
#include "config_common.h"
#include
+#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
diff --git a/keyboards/crkbd/keymaps/default/config.h b/keyboards/crkbd/keymaps/default/config.h
index c573530f74..644e813650 100644
--- a/keyboards/crkbd/keymaps/default/config.h
+++ b/keyboards/crkbd/keymaps/default/config.h
@@ -20,10 +20,6 @@ along with this program. If not, see .
#pragma once
-/* Use I2C or Serial */
-
-#define USE_I2C
-#define USE_SERIAL
//#define USE_MATRIX_I2C
/* Select hand configuration */
diff --git a/keyboards/crkbd/keymaps/like_jis/config.h b/keyboards/crkbd/keymaps/like_jis/config.h
index 4c31cc7794..0e2960a937 100644
--- a/keyboards/crkbd/keymaps/like_jis/config.h
+++ b/keyboards/crkbd/keymaps/like_jis/config.h
@@ -20,10 +20,6 @@ along with this program. If not, see .
#pragma once
-/* Use I2C or Serial */
-
-#define USE_I2C
-#define USE_SERIAL
//#define USE_MATRIX_I2C
/* Select hand configuration */
--
cgit v1.2.3
From 9012f4c2e005253574f2af2887c2317d51c70405 Mon Sep 17 00:00:00 2001
From: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
Date: Sun, 23 Sep 2018 20:50:08 -0700
Subject: Keyboard: Crkbd: Configurator support and readme formatting (#3971)
---
keyboards/crkbd/info.json | 62 +++++++++++++++++++++++++++++++++++++++++++++++
keyboards/crkbd/readme.md | 3 ++-
2 files changed, 64 insertions(+), 1 deletion(-)
create mode 100644 keyboards/crkbd/info.json
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/info.json b/keyboards/crkbd/info.json
new file mode 100644
index 0000000000..d74bb49430
--- /dev/null
+++ b/keyboards/crkbd/info.json
@@ -0,0 +1,62 @@
+{
+ "keyboard_name": "crkbd (helidox) rev. 1",
+ "url": "",
+ "maintainer": "qmk",
+ "width": 15,
+ "height": 4.5,
+ "layouts": {
+ "LAYOUT": {
+ "layout": [
+ {"label":"Esc", "x":0, "y":0.3},
+ {"label":"Q", "x":1, "y":0.3},
+ {"label":"W", "x":2, "y":0.1},
+ {"label":"E", "x":3, "y":0},
+ {"label":"R", "x":4, "y":0.1},
+ {"label":"T", "x":5, "y":0.2},
+
+ {"label":"Y", "x":9, "y":0.2},
+ {"label":"U", "x":10, "y":0.1},
+ {"label":"I", "x":11, "y":0},
+ {"label":"O", "x":12, "y":0.1},
+ {"label":"P", "x":13, "y":0.3},
+ {"label":"Back Space", "x":14, "y":0.3},
+
+ {"label":"Ctrl / Tab", "x":0, "y":1.3},
+ {"label":"A", "x":1, "y":1.3},
+ {"label":"S", "x":2, "y":1.1},
+ {"label":"D", "x":3, "y":1},
+ {"label":"F", "x":4, "y":1.1},
+ {"label":"G", "x":5, "y":1.2},
+
+ {"label":"H", "x":9, "y":1.2},
+ {"label":"J", "x":10, "y":1.1},
+ {"label":"K", "x":11, "y":1},
+ {"label":"L", "x":12, "y":1.1},
+ {"label":";", "x":13, "y":1.3},
+ {"label":"'", "x":14, "y":1.3},
+
+ {"label":"Shift", "x":0, "y":2.3},
+ {"label":"Z", "x":1, "y":2.3},
+ {"label":"X", "x":2, "y":2.1},
+ {"label":"C", "x":3, "y":2},
+ {"label":"V", "x":4, "y":2.1},
+ {"label":"B", "x":5, "y":2.2},
+
+ {"label":"N", "x":9, "y":2.2},
+ {"label":"M", "x":10, "y":2.1},
+ {"label":",", "x":11, "y":2},
+ {"label":".", "x":12, "y":2.1},
+ {"label":"/", "x":13, "y":2.3},
+ {"label":"Shift", "x":14, "y":2.3},
+
+ {"label":"GUI / KC_HANJ", "x":4, "y":3.7},
+ {"label":"Lower", "x":5, "y":3.7},
+ {"label":"Space", "x":6, "y":3.2, "h":1.5},
+
+ {"label":"Enter", "x":8, "y":3.2, "h":1.5},
+ {"label":"Raise", "x":9, "y":3.7},
+ {"label":"Alt / KC_HAEN", "x":10, "y":3.7}
+ ]
+ }
+ }
+}
diff --git a/keyboards/crkbd/readme.md b/keyboards/crkbd/readme.md
index 2f9f047a47..591fdfe0da 100644
--- a/keyboards/crkbd/readme.md
+++ b/keyboards/crkbd/readme.md
@@ -10,8 +10,9 @@ A split keyboard with 3x6 vertically staggered keys and 3 thumb keys.
Keyboard Maintainer: [foostan](https://github.com/foostan/) [@foostan](https://twitter.com/foostan)
Hardware Supported: Crkbd PCB, Pro Micro
Hardware Availability: [PCB & Case Data](https://github.com/foostan/crkbd)
+
Make example for this keyboard (after setting up your build environment):
make crkbd:default
-See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
+See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
--
cgit v1.2.3
From e2eee47e20481d0936a1893b561f3a95445b40fd Mon Sep 17 00:00:00 2001
From: Kosuke Adachi
Date: Thu, 27 Sep 2018 03:13:19 +0900
Subject: Keyboard: Crkbd stands for Corne Keyboard, not helidox (#3985)
---
keyboards/crkbd/info.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/info.json b/keyboards/crkbd/info.json
index d74bb49430..45a0255c1a 100644
--- a/keyboards/crkbd/info.json
+++ b/keyboards/crkbd/info.json
@@ -1,5 +1,5 @@
{
- "keyboard_name": "crkbd (helidox) rev. 1",
+ "keyboard_name": "crkbd rev. 1",
"url": "",
"maintainer": "qmk",
"width": 15,
--
cgit v1.2.3
From 1512a6bfd48fb75619a1f77394d41bdca7ea28b1 Mon Sep 17 00:00:00 2001
From: Drashna Jaelre
Date: Mon, 1 Oct 2018 18:00:14 -0700
Subject: Keymap: Update to drashna keymaps and userspace (#3992)
* Enabled unicode support and send_unicode function
* Unicode cleanup
* More unicode tweaking
* Update EEPROM stuff
* Account for keyboard macros
* Switch Equal to Plus on Ergodox
* more tweaks
* Minor Unicode tweaks
* Correct matrix printing for keylogger
* Fix unicode functions
* Fix unicode mode set since it actually uses EEPROM
* Re-add DISABLE_LEADER
* Ergodox is easier to hit the tapping term, fix that
* Fix stupid type on unicode mode check
* Preliminary CRKBD/HeliDox support
* Fixes to Helidox
* Cleanup userspace from old merge stuff
* Remove CCCV sounds
* Make Mode NOEEPROM Again
---
keyboards/crkbd/keymaps/drashna/config.h | 43 +++++
keyboards/crkbd/keymaps/drashna/glcdfont.c | 244 +++++++++++++++++++++++++++++
keyboards/crkbd/keymaps/drashna/keymap.c | 173 ++++++++++++++++++++
keyboards/crkbd/keymaps/drashna/rules.mk | 30 ++++
4 files changed, 490 insertions(+)
create mode 100644 keyboards/crkbd/keymaps/drashna/config.h
create mode 100644 keyboards/crkbd/keymaps/drashna/glcdfont.c
create mode 100644 keyboards/crkbd/keymaps/drashna/keymap.c
create mode 100644 keyboards/crkbd/keymaps/drashna/rules.mk
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/drashna/config.h b/keyboards/crkbd/keymaps/drashna/config.h
new file mode 100644
index 0000000000..366f013dca
--- /dev/null
+++ b/keyboards/crkbd/keymaps/drashna/config.h
@@ -0,0 +1,43 @@
+/*
+This is the c configuration file for the keymap
+
+Copyright 2012 Jun Wako
+Copyright 2015 Jack Humbert
+
+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 .
+*/
+
+#pragma once
+
+
+/* Select hand configuration */
+
+// #define MASTER_LEFT
+// #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
diff --git a/keyboards/crkbd/keymaps/drashna/glcdfont.c b/keyboards/crkbd/keymaps/drashna/glcdfont.c
new file mode 100644
index 0000000000..4e7b27bc0c
--- /dev/null
+++ b/keyboards/crkbd/keymaps/drashna/glcdfont.c
@@ -0,0 +1,244 @@
+// 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
+ #include
+#elif defined(ESP8266)
+ #include
+#else
+ #define PROGMEM
+#endif
+
+// Standard ASCII 5x7 font
+
+static 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, 0xA4, 0xA4, 0x9C, 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,
+0xFC, 0x18, 0x24, 0x24, 0x18, 0x00,
+0x18, 0x24, 0x24, 0x18, 0xFC, 0x00,
+0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
+0x48, 0x54, 0x54, 0x54, 0x24, 0x00,
+0x04, 0x04, 0x3F, 0x44, 0x24, 0x00,
+0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
+0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
+0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
+0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
+0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00,
+0x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
+0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
+0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
+0x00, 0x41, 0x36, 0x08, 0x00, 0x00,
+0x02, 0x01, 0x02, 0x04, 0x02, 0x00,
+0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x0E, 0x3F, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFE, 0xE0, 0x80, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x1E, 0xBE,
+0x7F, 0xFF, 0xFF, 0xFE, 0xFE, 0xF0,
+0xE0, 0xC0, 0x80, 0x00, 0x0E, 0xEF,
+0xDF, 0xDE, 0xBE, 0x3C, 0x38, 0x70,
+0xE0, 0xDD, 0xBB, 0x7B, 0x07, 0x0E,
+0x0E, 0x0C, 0x98, 0xF0, 0xE0, 0xF0,
+0xF0, 0xF8, 0x78, 0x3C, 0x1C, 0x1E,
+0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F,
+0x1F, 0xFE, 0xFE, 0xF8, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC,
+0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00,
+0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E,
+0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00,
+0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B,
+0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00,
+0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE,
+0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x01, 0x03,
+0x0F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFE,
+0xF8, 0xF0, 0xE0, 0xC0, 0x80, 0x7F,
+0xFF, 0xFE, 0xFD, 0xFB, 0x1B, 0x07,
+0x07, 0x0F, 0x1F, 0x1F, 0x1E, 0x1D,
+0x0B, 0x07, 0x01, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0xE0,
+0xF8, 0xFE, 0xFF, 0xFF, 0x1F, 0x07,
+0x01, 0x01, 0x01, 0x03, 0x06, 0x06,
+0x0C, 0x0C, 0x08, 0x0C, 0x0C, 0x0E,
+0x07, 0x83, 0xC1, 0xE0, 0x70, 0x30,
+0x18, 0x1C, 0x7C, 0xCC, 0x8C, 0xDC,
+0xF8, 0xC0, 0xE0, 0xE0, 0x70, 0xB8,
+0xF0, 0x60, 0x00, 0x00, 0x80, 0xC0,
+0xE0, 0xF0, 0x70, 0xF8, 0xFC, 0xFC,
+0x3C, 0x30, 0x38, 0xF8, 0xF8, 0xF8,
+0x78, 0x00, 0x80, 0x80, 0xC0, 0xE0,
+0x70, 0x38, 0x38, 0x9C, 0xDC, 0xFC,
+0x7C, 0x38, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F,
+0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00,
+0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F,
+0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00,
+0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20,
+0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00,
+0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F,
+0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x01, 0x03, 0x07,
+0x1F, 0x3F, 0x3F, 0x7F, 0x7F, 0x7F,
+0x7E, 0x7D, 0x3B, 0x17, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
+0x0F, 0x1F, 0x3F, 0x3F, 0x7E, 0x7C,
+0x78, 0x70, 0x70, 0x70, 0x70, 0x70,
+0x70, 0x78, 0x38, 0x18, 0x1C, 0x0E,
+0x07, 0x0F, 0x1F, 0x3F, 0x3C, 0x38,
+0x38, 0x18, 0x0C, 0x06, 0x03, 0x01,
+0x01, 0x01, 0x01, 0x0E, 0x1F, 0x1F,
+0x1C, 0x1C, 0x1E, 0x0F, 0x0F, 0x03,
+0x1D, 0x0E, 0x07, 0x03, 0x01, 0x00,
+0x00, 0x0E, 0x1F, 0x1F, 0x1D, 0x1E,
+0x0F, 0x07, 0x03, 0x03, 0x0F, 0x1F,
+0x1F, 0x19, 0x19, 0x19, 0x19, 0x0C,
+0x0C, 0x04, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+#endif // FONT5X7_H
diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/keyboards/crkbd/keymaps/drashna/keymap.c
new file mode 100644
index 0000000000..7bced8de33
--- /dev/null
+++ b/keyboards/crkbd/keymaps/drashna/keymap.c
@@ -0,0 +1,173 @@
+#include QMK_KEYBOARD_H
+#include "drashna.h"
+#ifdef PROTOCOL_LUFA
+ #include "lufa.h"
+ #include "split_util.h"
+#endif
+#ifdef SSD1306OLED
+ #include "ssd1306.h"
+#endif
+
+extern keymap_config_t keymap_config;
+extern uint8_t is_master;
+
+#ifdef RGBLIGHT_ENABLE
+//Following line allows macro to read current RGB settings
+extern rgblight_config_t rgblight_config;
+#endif
+
+enum crkbd_keycodes {
+ RGBRST = NEW_SAFE_RANGE
+};
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [_QWERTY] = LAYOUT_wrapper(
+ KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC,
+ KC_TAB, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT,
+ KC_MLSF, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_MRSF,
+ LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
+ ),
+ [_COLEMAK] = LAYOUT_wrapper(
+ KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC,
+ KC_TAB, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT,
+ KC_MLSF, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_MRSF,
+ LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
+ ),
+ [_DVORAK] = LAYOUT_wrapper(
+ KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC,
+ KC_TAB, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT,
+ KC_MLSF, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_MRSF,
+ LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
+ ),
+ [_WORKMAN] = LAYOUT_wrapper(
+ KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC,
+ KC_TAB, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT,
+ KC_MLSF, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_MRSF,
+ LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
+ ),
+
+ [_MODS] = LAYOUT_wrapper(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RSFT,
+ _______, _______, _______, _______, _______, _______
+ ),
+
+ [_LOWER] = LAYOUT_wrapper(
+ KC_TILD, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_BSPC,
+ KC_F11, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE,
+ KC_F12, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______,
+ _______, _______, _______, _______, _______, _______
+ ),
+
+ [_RAISE] = LAYOUT_wrapper( \
+ KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, KC_BSPC,
+ _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS,
+ _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______,
+ _______, _______, _______, _______, _______, _______ //`--------------------' `--------------------'
+ ),
+
+ [_ADJUST] = LAYOUT_wrapper( \
+ KC_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RESET,
+ VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EPRM,
+ TG_MODS, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY,
+ _______, _______, _______, _______, _______, _______
+ )
+};
+
+int RGB_current_mode;
+
+void matrix_init_keymap(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
+
+ DDRD &= ~(1<<5);
+ PORTD &= ~(1<<5);
+
+ DDRB &= ~(1<<0);
+ PORTB &= ~(1<<0);}
+
+//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_keymap(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);
+}
+
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed) {
+ set_keylog(keycode, record);
+ // set_timelog();
+ }
+
+ switch (keycode) {
+ case RGB_MOD:
+ #ifdef RGBLIGHT_ENABLE
+ if (record->event.pressed) {
+ rgblight_mode_noeeprom(RGB_current_mode);
+ rgblight_step();
+ RGB_current_mode = rgblight_config.mode;
+ }
+ #endif
+ return false;
+ break;
+ case RGBRST:
+ #ifdef RGBLIGHT_ENABLE
+ if (record->event.pressed) {
+ eeconfig_update_rgblight_default();
+ rgblight_enable();
+ RGB_current_mode = rgblight_config.mode;
+ }
+ #endif
+ break;
+ }
+ return true;
+}
+
+#endif
diff --git a/keyboards/crkbd/keymaps/drashna/rules.mk b/keyboards/crkbd/keymaps/drashna/rules.mk
new file mode 100644
index 0000000000..f490aa2ea8
--- /dev/null
+++ b/keyboards/crkbd/keymaps/drashna/rules.mk
@@ -0,0 +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
+#
+BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = no # Mouse keys(+4700)
+EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
+CONSOLE_ENABLE = no # Console for debug(+400)
+COMMAND_ENABLE = no # Commands for debug and configuration
+NKRO_ENABLE = yes # 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 = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
+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 \
--
cgit v1.2.3
From 31d12662bde435e6636347ee842108b1cb3d8d48 Mon Sep 17 00:00:00 2001
From: Drashna Jaelre
Date: Mon, 15 Oct 2018 12:34:49 -0700
Subject: Update to drashna keymaps and userspace - RGB edition (#4143)
* Fix up userspace after feature merges
* Add new macros for keyboard layouts
* Keep new layouts in keymap for easy reference
* Cleanup layouts
* Fix CRKBD wrappers
* Fix up comments
* Fix spacing in orthodox base layer
* ergodox related cleanup
* Make KC_MAKE only flash when holding shift
* Add option to fast compile boards
* Clean up rgb modes to save space
* Re-enable Swap Hands on my Iris
---
keyboards/crkbd/keymaps/drashna/config.h | 10 +++---
keyboards/crkbd/keymaps/drashna/keymap.c | 59 +++++++++++++++++++-------------
2 files changed, 41 insertions(+), 28 deletions(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/drashna/config.h b/keyboards/crkbd/keymaps/drashna/config.h
index 366f013dca..adfd79044d 100644
--- a/keyboards/crkbd/keymaps/drashna/config.h
+++ b/keyboards/crkbd/keymaps/drashna/config.h
@@ -34,10 +34,12 @@ along with this program. If not, see .
// #define TAPPING_FORCE_HOLD
// #define TAPPING_TERM 100
+#ifdef RGBLIGHT_ENABLE
#undef RGBLED_NUM
-#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 27
+
+#define RGBLIGHT_HUE_STEP 8
+#define RGBLIGHT_SAT_STEP 8
+#define RGBLIGHT_VAL_STEP 8
#define RGBLIGHT_LIMIT_VAL 120
-#define RGBLIGHT_HUE_STEP 10
-#define RGBLIGHT_SAT_STEP 17
-#define RGBLIGHT_VAL_STEP 17
+#endif
diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/keyboards/crkbd/keymaps/drashna/keymap.c
index 7bced8de33..a293d53374 100644
--- a/keyboards/crkbd/keymaps/drashna/keymap.c
+++ b/keyboards/crkbd/keymaps/drashna/keymap.c
@@ -20,37 +20,48 @@ enum crkbd_keycodes {
RGBRST = NEW_SAFE_RANGE
};
+#define LAYOUT_crkbd_base( \
+ K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
+ K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
+ K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
+ ) \
+ LAYOUT_wrapper( \
+ KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_BSPC, \
+ KC_TAB, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, KC_QUOT, \
+ KC_MLSF, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, CTL_T(K2A), KC_MRSF, \
+ LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE \
+ )
+#define LAYOUT_crkbd_base_wrapper(...) LAYOUT_crkbd_base(__VA_ARGS__)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [_QWERTY] = LAYOUT_wrapper(
- KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC,
- KC_TAB, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT,
- KC_MLSF, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_MRSF,
- LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
+ [_QWERTY] = LAYOUT_crkbd_base_wrapper(
+ _________________QWERTY_L1_________________, _________________QWERTY_R1_________________,
+ _________________QWERTY_L2_________________, _________________QWERTY_R2_________________,
+ _________________QWERTY_L3_________________, _________________QWERTY_R3_________________
),
- [_COLEMAK] = LAYOUT_wrapper(
- KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC,
- KC_TAB, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT,
- KC_MLSF, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_MRSF,
- LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
+
+ [_COLEMAK] = LAYOUT_crkbd_base_wrapper(
+ _________________COLEMAK_L1________________, _________________COLEMAK_R1________________,
+ _________________COLEMAK_L2________________, _________________COLEMAK_R2________________,
+ _________________COLEMAK_L3________________, _________________COLEMAK_R3________________
),
- [_DVORAK] = LAYOUT_wrapper(
- KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC,
- KC_TAB, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT,
- KC_MLSF, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_MRSF,
- LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
+
+ [_DVORAK] = LAYOUT_crkbd_base_wrapper(
+ _________________DVORAK_L1_________________, _________________DVORAK_R1_________________,
+ _________________DVORAK_L2_________________, _________________DVORAK_R2_________________,
+ _________________DVORAK_L3_________________, _________________DVORAK_R3_________________
),
- [_WORKMAN] = LAYOUT_wrapper(
- KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC,
- KC_TAB, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT,
- KC_MLSF, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_MRSF,
- LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
+
+ [_WORKMAN] = LAYOUT_crkbd_base_wrapper(
+ _________________WORKMAN_L1________________, _________________WORKMAN_R1________________,
+ _________________WORKMAN_L2________________, _________________WORKMAN_R2________________,
+ _________________WORKMAN_L3________________, _________________WORKMAN_R3________________
),
[_MODS] = LAYOUT_wrapper(
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RSFT,
+ _______, ___________________BLANK___________________, ___________________BLANK___________________, _______,
+ _______, ___________________BLANK___________________, ___________________BLANK___________________, _______,
+ KC_LSFT, ___________________BLANK___________________, ___________________BLANK___________________, KC_RSFT,
_______, _______, _______, _______, _______, _______
),
@@ -65,7 +76,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, KC_BSPC,
_______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS,
_______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______,
- _______, _______, _______, _______, _______, _______ //`--------------------' `--------------------'
+ _______, _______, _______, _______, _______, _______
),
[_ADJUST] = LAYOUT_wrapper( \
--
cgit v1.2.3
From 78b48371aac3bc4ba468c9f7efcb742bafb81965 Mon Sep 17 00:00:00 2001
From: Kosuke Adachi
Date: Sat, 20 Oct 2018 01:12:55 +0900
Subject: Keyboard: Update logo and commonize it (#4151)
* Update logo and commonize it
* Move the glcdfont.c to the lib and add it to the SRC values of the rules.mk in the keymap folders
* Add static
---
keyboards/crkbd/keymaps/default/glcdfont.c | 244 ----------------------------
keyboards/crkbd/keymaps/default/rules.mk | 15 +-
keyboards/crkbd/keymaps/drashna/glcdfont.c | 244 ----------------------------
keyboards/crkbd/keymaps/drashna/rules.mk | 15 +-
keyboards/crkbd/keymaps/like_jis/glcdfont.c | 244 ----------------------------
keyboards/crkbd/keymaps/like_jis/keymap.c | 6 +-
keyboards/crkbd/keymaps/like_jis/rules.mk | 15 +-
keyboards/crkbd/lib/glcdfont.c | 243 +++++++++++++++++++++++++++
keyboards/crkbd/ssd1306.c | 3 +-
9 files changed, 272 insertions(+), 757 deletions(-)
delete mode 100644 keyboards/crkbd/keymaps/default/glcdfont.c
delete mode 100644 keyboards/crkbd/keymaps/drashna/glcdfont.c
delete mode 100644 keyboards/crkbd/keymaps/like_jis/glcdfont.c
create mode 100644 keyboards/crkbd/lib/glcdfont.c
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/default/glcdfont.c b/keyboards/crkbd/keymaps/default/glcdfont.c
deleted file mode 100644
index 4e7b27bc0c..0000000000
--- a/keyboards/crkbd/keymaps/default/glcdfont.c
+++ /dev/null
@@ -1,244 +0,0 @@
-// 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
- #include
-#elif defined(ESP8266)
- #include
-#else
- #define PROGMEM
-#endif
-
-// Standard ASCII 5x7 font
-
-static 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, 0xA4, 0xA4, 0x9C, 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,
-0xFC, 0x18, 0x24, 0x24, 0x18, 0x00,
-0x18, 0x24, 0x24, 0x18, 0xFC, 0x00,
-0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
-0x48, 0x54, 0x54, 0x54, 0x24, 0x00,
-0x04, 0x04, 0x3F, 0x44, 0x24, 0x00,
-0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
-0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
-0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
-0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
-0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00,
-0x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
-0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
-0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
-0x00, 0x41, 0x36, 0x08, 0x00, 0x00,
-0x02, 0x01, 0x02, 0x04, 0x02, 0x00,
-0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x0E, 0x3F, 0xFF, 0xFF,
-0xFF, 0xFF, 0xFE, 0xE0, 0x80, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1E, 0xBE,
-0x7F, 0xFF, 0xFF, 0xFE, 0xFE, 0xF0,
-0xE0, 0xC0, 0x80, 0x00, 0x0E, 0xEF,
-0xDF, 0xDE, 0xBE, 0x3C, 0x38, 0x70,
-0xE0, 0xDD, 0xBB, 0x7B, 0x07, 0x0E,
-0x0E, 0x0C, 0x98, 0xF0, 0xE0, 0xF0,
-0xF0, 0xF8, 0x78, 0x3C, 0x1C, 0x1E,
-0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F,
-0x1F, 0xFE, 0xFE, 0xF8, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC,
-0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00,
-0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E,
-0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00,
-0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B,
-0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00,
-0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE,
-0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0x03,
-0x0F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFE,
-0xF8, 0xF0, 0xE0, 0xC0, 0x80, 0x7F,
-0xFF, 0xFE, 0xFD, 0xFB, 0x1B, 0x07,
-0x07, 0x0F, 0x1F, 0x1F, 0x1E, 0x1D,
-0x0B, 0x07, 0x01, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xE0,
-0xF8, 0xFE, 0xFF, 0xFF, 0x1F, 0x07,
-0x01, 0x01, 0x01, 0x03, 0x06, 0x06,
-0x0C, 0x0C, 0x08, 0x0C, 0x0C, 0x0E,
-0x07, 0x83, 0xC1, 0xE0, 0x70, 0x30,
-0x18, 0x1C, 0x7C, 0xCC, 0x8C, 0xDC,
-0xF8, 0xC0, 0xE0, 0xE0, 0x70, 0xB8,
-0xF0, 0x60, 0x00, 0x00, 0x80, 0xC0,
-0xE0, 0xF0, 0x70, 0xF8, 0xFC, 0xFC,
-0x3C, 0x30, 0x38, 0xF8, 0xF8, 0xF8,
-0x78, 0x00, 0x80, 0x80, 0xC0, 0xE0,
-0x70, 0x38, 0x38, 0x9C, 0xDC, 0xFC,
-0x7C, 0x38, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F,
-0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00,
-0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F,
-0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00,
-0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20,
-0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00,
-0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F,
-0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0x03, 0x07,
-0x1F, 0x3F, 0x3F, 0x7F, 0x7F, 0x7F,
-0x7E, 0x7D, 0x3B, 0x17, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
-0x0F, 0x1F, 0x3F, 0x3F, 0x7E, 0x7C,
-0x78, 0x70, 0x70, 0x70, 0x70, 0x70,
-0x70, 0x78, 0x38, 0x18, 0x1C, 0x0E,
-0x07, 0x0F, 0x1F, 0x3F, 0x3C, 0x38,
-0x38, 0x18, 0x0C, 0x06, 0x03, 0x01,
-0x01, 0x01, 0x01, 0x0E, 0x1F, 0x1F,
-0x1C, 0x1C, 0x1E, 0x0F, 0x0F, 0x03,
-0x1D, 0x0E, 0x07, 0x03, 0x01, 0x00,
-0x00, 0x0E, 0x1F, 0x1F, 0x1D, 0x1E,
-0x0F, 0x07, 0x03, 0x03, 0x0F, 0x1F,
-0x1F, 0x19, 0x19, 0x19, 0x19, 0x0C,
-0x0C, 0x04, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-#endif // FONT5X7_H
diff --git a/keyboards/crkbd/keymaps/default/rules.mk b/keyboards/crkbd/keymaps/default/rules.mk
index 0edf1181f0..5ee01e89e1 100644
--- a/keyboards/crkbd/keymaps/default/rules.mk
+++ b/keyboards/crkbd/keymaps/default/rules.mk
@@ -4,24 +4,25 @@
# the appropriate keymap folder that will get included automatically
#
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
+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 = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
-SWAP_HANDS_ENABLE = no # Enable one-hand typing
+RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
+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 \
+SRC += ./lib/glcdfont.c \
+ ./lib/rgb_state_reader.c \
./lib/layer_state_reader.c \
./lib/logo_reader.c \
./lib/keylogger.c \
diff --git a/keyboards/crkbd/keymaps/drashna/glcdfont.c b/keyboards/crkbd/keymaps/drashna/glcdfont.c
deleted file mode 100644
index 4e7b27bc0c..0000000000
--- a/keyboards/crkbd/keymaps/drashna/glcdfont.c
+++ /dev/null
@@ -1,244 +0,0 @@
-// 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
- #include
-#elif defined(ESP8266)
- #include
-#else
- #define PROGMEM
-#endif
-
-// Standard ASCII 5x7 font
-
-static 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, 0xA4, 0xA4, 0x9C, 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,
-0xFC, 0x18, 0x24, 0x24, 0x18, 0x00,
-0x18, 0x24, 0x24, 0x18, 0xFC, 0x00,
-0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
-0x48, 0x54, 0x54, 0x54, 0x24, 0x00,
-0x04, 0x04, 0x3F, 0x44, 0x24, 0x00,
-0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
-0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
-0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
-0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
-0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00,
-0x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
-0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
-0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
-0x00, 0x41, 0x36, 0x08, 0x00, 0x00,
-0x02, 0x01, 0x02, 0x04, 0x02, 0x00,
-0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x0E, 0x3F, 0xFF, 0xFF,
-0xFF, 0xFF, 0xFE, 0xE0, 0x80, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1E, 0xBE,
-0x7F, 0xFF, 0xFF, 0xFE, 0xFE, 0xF0,
-0xE0, 0xC0, 0x80, 0x00, 0x0E, 0xEF,
-0xDF, 0xDE, 0xBE, 0x3C, 0x38, 0x70,
-0xE0, 0xDD, 0xBB, 0x7B, 0x07, 0x0E,
-0x0E, 0x0C, 0x98, 0xF0, 0xE0, 0xF0,
-0xF0, 0xF8, 0x78, 0x3C, 0x1C, 0x1E,
-0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F,
-0x1F, 0xFE, 0xFE, 0xF8, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC,
-0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00,
-0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E,
-0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00,
-0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B,
-0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00,
-0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE,
-0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0x03,
-0x0F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFE,
-0xF8, 0xF0, 0xE0, 0xC0, 0x80, 0x7F,
-0xFF, 0xFE, 0xFD, 0xFB, 0x1B, 0x07,
-0x07, 0x0F, 0x1F, 0x1F, 0x1E, 0x1D,
-0x0B, 0x07, 0x01, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xE0,
-0xF8, 0xFE, 0xFF, 0xFF, 0x1F, 0x07,
-0x01, 0x01, 0x01, 0x03, 0x06, 0x06,
-0x0C, 0x0C, 0x08, 0x0C, 0x0C, 0x0E,
-0x07, 0x83, 0xC1, 0xE0, 0x70, 0x30,
-0x18, 0x1C, 0x7C, 0xCC, 0x8C, 0xDC,
-0xF8, 0xC0, 0xE0, 0xE0, 0x70, 0xB8,
-0xF0, 0x60, 0x00, 0x00, 0x80, 0xC0,
-0xE0, 0xF0, 0x70, 0xF8, 0xFC, 0xFC,
-0x3C, 0x30, 0x38, 0xF8, 0xF8, 0xF8,
-0x78, 0x00, 0x80, 0x80, 0xC0, 0xE0,
-0x70, 0x38, 0x38, 0x9C, 0xDC, 0xFC,
-0x7C, 0x38, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F,
-0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00,
-0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F,
-0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00,
-0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20,
-0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00,
-0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F,
-0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0x03, 0x07,
-0x1F, 0x3F, 0x3F, 0x7F, 0x7F, 0x7F,
-0x7E, 0x7D, 0x3B, 0x17, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
-0x0F, 0x1F, 0x3F, 0x3F, 0x7E, 0x7C,
-0x78, 0x70, 0x70, 0x70, 0x70, 0x70,
-0x70, 0x78, 0x38, 0x18, 0x1C, 0x0E,
-0x07, 0x0F, 0x1F, 0x3F, 0x3C, 0x38,
-0x38, 0x18, 0x0C, 0x06, 0x03, 0x01,
-0x01, 0x01, 0x01, 0x0E, 0x1F, 0x1F,
-0x1C, 0x1C, 0x1E, 0x0F, 0x0F, 0x03,
-0x1D, 0x0E, 0x07, 0x03, 0x01, 0x00,
-0x00, 0x0E, 0x1F, 0x1F, 0x1D, 0x1E,
-0x0F, 0x07, 0x03, 0x03, 0x0F, 0x1F,
-0x1F, 0x19, 0x19, 0x19, 0x19, 0x0C,
-0x0C, 0x04, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-#endif // FONT5X7_H
diff --git a/keyboards/crkbd/keymaps/drashna/rules.mk b/keyboards/crkbd/keymaps/drashna/rules.mk
index f490aa2ea8..8fca704489 100644
--- a/keyboards/crkbd/keymaps/drashna/rules.mk
+++ b/keyboards/crkbd/keymaps/drashna/rules.mk
@@ -4,24 +4,25 @@
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
-MOUSEKEY_ENABLE = no # Mouse keys(+4700)
+MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
-COMMAND_ENABLE = no # Commands for debug and configuration
-NKRO_ENABLE = yes # 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
+COMMAND_ENABLE = no # Commands for debug and configuration
+NKRO_ENABLE = yes # 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 = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
-SWAP_HANDS_ENABLE = no # Enable one-hand typing
+RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
+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 \
+SRC += ./lib/glcdfont.c \
+ ./lib/rgb_state_reader.c \
./lib/layer_state_reader.c \
./lib/logo_reader.c \
./lib/keylogger.c \
diff --git a/keyboards/crkbd/keymaps/like_jis/glcdfont.c b/keyboards/crkbd/keymaps/like_jis/glcdfont.c
deleted file mode 100644
index 4e7b27bc0c..0000000000
--- a/keyboards/crkbd/keymaps/like_jis/glcdfont.c
+++ /dev/null
@@ -1,244 +0,0 @@
-// 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
- #include
-#elif defined(ESP8266)
- #include
-#else
- #define PROGMEM
-#endif
-
-// Standard ASCII 5x7 font
-
-static 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, 0xA4, 0xA4, 0x9C, 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,
-0xFC, 0x18, 0x24, 0x24, 0x18, 0x00,
-0x18, 0x24, 0x24, 0x18, 0xFC, 0x00,
-0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
-0x48, 0x54, 0x54, 0x54, 0x24, 0x00,
-0x04, 0x04, 0x3F, 0x44, 0x24, 0x00,
-0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
-0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
-0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
-0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
-0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00,
-0x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
-0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
-0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
-0x00, 0x41, 0x36, 0x08, 0x00, 0x00,
-0x02, 0x01, 0x02, 0x04, 0x02, 0x00,
-0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x0E, 0x3F, 0xFF, 0xFF,
-0xFF, 0xFF, 0xFE, 0xE0, 0x80, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x1E, 0xBE,
-0x7F, 0xFF, 0xFF, 0xFE, 0xFE, 0xF0,
-0xE0, 0xC0, 0x80, 0x00, 0x0E, 0xEF,
-0xDF, 0xDE, 0xBE, 0x3C, 0x38, 0x70,
-0xE0, 0xDD, 0xBB, 0x7B, 0x07, 0x0E,
-0x0E, 0x0C, 0x98, 0xF0, 0xE0, 0xF0,
-0xF0, 0xF8, 0x78, 0x3C, 0x1C, 0x1E,
-0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F,
-0x1F, 0xFE, 0xFE, 0xF8, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC,
-0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00,
-0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E,
-0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00,
-0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B,
-0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00,
-0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE,
-0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0x03,
-0x0F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFE,
-0xF8, 0xF0, 0xE0, 0xC0, 0x80, 0x7F,
-0xFF, 0xFE, 0xFD, 0xFB, 0x1B, 0x07,
-0x07, 0x0F, 0x1F, 0x1F, 0x1E, 0x1D,
-0x0B, 0x07, 0x01, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xE0,
-0xF8, 0xFE, 0xFF, 0xFF, 0x1F, 0x07,
-0x01, 0x01, 0x01, 0x03, 0x06, 0x06,
-0x0C, 0x0C, 0x08, 0x0C, 0x0C, 0x0E,
-0x07, 0x83, 0xC1, 0xE0, 0x70, 0x30,
-0x18, 0x1C, 0x7C, 0xCC, 0x8C, 0xDC,
-0xF8, 0xC0, 0xE0, 0xE0, 0x70, 0xB8,
-0xF0, 0x60, 0x00, 0x00, 0x80, 0xC0,
-0xE0, 0xF0, 0x70, 0xF8, 0xFC, 0xFC,
-0x3C, 0x30, 0x38, 0xF8, 0xF8, 0xF8,
-0x78, 0x00, 0x80, 0x80, 0xC0, 0xE0,
-0x70, 0x38, 0x38, 0x9C, 0xDC, 0xFC,
-0x7C, 0x38, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F,
-0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00,
-0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F,
-0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00,
-0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20,
-0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00,
-0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F,
-0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x01, 0x03, 0x07,
-0x1F, 0x3F, 0x3F, 0x7F, 0x7F, 0x7F,
-0x7E, 0x7D, 0x3B, 0x17, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
-0x0F, 0x1F, 0x3F, 0x3F, 0x7E, 0x7C,
-0x78, 0x70, 0x70, 0x70, 0x70, 0x70,
-0x70, 0x78, 0x38, 0x18, 0x1C, 0x0E,
-0x07, 0x0F, 0x1F, 0x3F, 0x3C, 0x38,
-0x38, 0x18, 0x0C, 0x06, 0x03, 0x01,
-0x01, 0x01, 0x01, 0x0E, 0x1F, 0x1F,
-0x1C, 0x1C, 0x1E, 0x0F, 0x0F, 0x03,
-0x1D, 0x0E, 0x07, 0x03, 0x01, 0x00,
-0x00, 0x0E, 0x1F, 0x1F, 0x1D, 0x1E,
-0x0F, 0x07, 0x03, 0x03, 0x0F, 0x1F,
-0x1F, 0x19, 0x19, 0x19, 0x19, 0x0C,
-0x0C, 0x04, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-#endif // FONT5X7_H
diff --git a/keyboards/crkbd/keymaps/like_jis/keymap.c b/keyboards/crkbd/keymaps/like_jis/keymap.c
index 90e5b7ec17..05d31845c8 100644
--- a/keyboards/crkbd/keymaps/like_jis/keymap.c
+++ b/keyboards/crkbd/keymaps/like_jis/keymap.c
@@ -109,7 +109,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
int RGB_current_mode;
// Setting ADJUST layer RGB back to default
-inline void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
+static inline 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 {
@@ -155,7 +155,7 @@ void matrix_scan_user(void) {
iota_gfx_task();
}
-inline void matrix_render_user(struct CharacterMatrix *matrix) {
+static 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());
@@ -171,7 +171,7 @@ inline void matrix_render_user(struct CharacterMatrix *matrix) {
}
}
-inline void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
+static inline 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;
diff --git a/keyboards/crkbd/keymaps/like_jis/rules.mk b/keyboards/crkbd/keymaps/like_jis/rules.mk
index 0edf1181f0..5ee01e89e1 100644
--- a/keyboards/crkbd/keymaps/like_jis/rules.mk
+++ b/keyboards/crkbd/keymaps/like_jis/rules.mk
@@ -4,24 +4,25 @@
# the appropriate keymap folder that will get included automatically
#
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
+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 = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
-SWAP_HANDS_ENABLE = no # Enable one-hand typing
+RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
+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 \
+SRC += ./lib/glcdfont.c \
+ ./lib/rgb_state_reader.c \
./lib/layer_state_reader.c \
./lib/logo_reader.c \
./lib/keylogger.c \
diff --git a/keyboards/crkbd/lib/glcdfont.c b/keyboards/crkbd/lib/glcdfont.c
new file mode 100644
index 0000000000..f7567c57c6
--- /dev/null
+++ b/keyboards/crkbd/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
+ #include
+#elif defined(ESP8266)
+ #include
+#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, 0x54, 0x54, 0x54, 0x24, 0x00,
+0x04, 0x04, 0x3F, 0x44, 0x24, 0x00,
+0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
+0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
+0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
+0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
+0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00,
+0x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
+0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
+0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
+0x00, 0x41, 0x36, 0x08, 0x00, 0x00,
+0x02, 0x01, 0x02, 0x04, 0x02, 0x00,
+0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0,
+0xF0, 0xF8, 0xF8, 0x18, 0x00, 0xC0,
+0xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0,
+0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0,
+0xC0, 0x80, 0x00, 0x00, 0x00, 0x00,
+0x80, 0xC0, 0xE0, 0xE0, 0xE0, 0xE0,
+0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80,
+0x00, 0x00, 0x00, 0xE0, 0xE0, 0xC0,
+0xC0, 0xE0, 0xE0, 0xE0, 0xE0, 0x00,
+0x00, 0xE0, 0xE0, 0xC0, 0xC0, 0xE0,
+0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80,
+0x00, 0x00, 0x00, 0x00, 0x80, 0xC0,
+0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0,
+0xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC,
+0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00,
+0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E,
+0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00,
+0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B,
+0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00,
+0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE,
+0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0xF8, 0xFC, 0xFE,
+0xFF, 0xE0, 0x00, 0xFF, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0x80, 0xFF, 0xFF,
+0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+0xFF, 0x1F, 0x07, 0x01, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0xFF, 0xFF, 0xFF, 0x81, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x81,
+0xC3, 0xC3, 0xC3, 0x00, 0x00, 0xFF,
+0xFF, 0xFF, 0x81, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x81, 0xFF, 0xFF,
+0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
+0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0xFF, 0xFF, 0xFF, 0x01, 0x00,
+0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF,
+0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
+0x9D, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C,
+0x1C, 0x9D, 0xDF, 0xDF, 0xDF, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F,
+0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00,
+0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F,
+0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00,
+0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20,
+0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00,
+0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F,
+0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x03, 0x0F, 0x1F,
+0x3F, 0x3F, 0x3F, 0x3F, 0x1F, 0x1F,
+0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x3F,
+0x3F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F,
+0x7F, 0x7C, 0x78, 0x78, 0x38, 0x1C,
+0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x01, 0x03, 0x07, 0x07,
+0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+0x03, 0x01, 0x00, 0x00, 0x00, 0x00,
+0x01, 0x03, 0x07, 0x07, 0x07, 0x07,
+0x07, 0x07, 0x07, 0x07, 0x03, 0x01,
+0x00, 0x00, 0x00, 0x07, 0x07, 0x07,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x07, 0x07, 0x07, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x07, 0x07,
+0x07, 0x00, 0x00, 0x00, 0x01, 0x03,
+0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+0x07, 0x07, 0x03, 0x01, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+#endif // FONT5X7_H
diff --git a/keyboards/crkbd/ssd1306.c b/keyboards/crkbd/ssd1306.c
index b8f9512e3f..205ce67a9e 100644
--- a/keyboards/crkbd/ssd1306.c
+++ b/keyboards/crkbd/ssd1306.c
@@ -4,7 +4,6 @@
#include "i2c.h"
#include
#include "print.h"
-#include "glcdfont.c"
#ifdef ADAFRUIT_BLE_ENABLE
#include "adafruit_ble.h"
#endif
@@ -14,6 +13,8 @@
#include "sendchar.h"
#include "timer.h"
+static const unsigned char font[] PROGMEM;
+
// Set this to 1 to help diagnose early startup problems
// when testing power-on with ble. Turn it off otherwise,
// as the latency of printing most of the debug info messes
--
cgit v1.2.3
From 00b6f14821f44ead75504e28d7fed26791cb2875 Mon Sep 17 00:00:00 2001
From: Drashna Jaelre
Date: Mon, 22 Oct 2018 08:57:37 -0700
Subject: Replace outdated RGB/Audio information
---
keyboards/crkbd/keymaps/default/rules.mk | 2 +-
keyboards/crkbd/keymaps/drashna/rules.mk | 2 +-
keyboards/crkbd/keymaps/like_jis/rules.mk | 2 +-
keyboards/crkbd/rules.mk | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/default/rules.mk b/keyboards/crkbd/keymaps/default/rules.mk
index 5ee01e89e1..16deaf45d1 100644
--- a/keyboards/crkbd/keymaps/default/rules.mk
+++ b/keyboards/crkbd/keymaps/default/rules.mk
@@ -14,7 +14,7 @@ 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 = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
+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
diff --git a/keyboards/crkbd/keymaps/drashna/rules.mk b/keyboards/crkbd/keymaps/drashna/rules.mk
index 8fca704489..8f69cba72f 100644
--- a/keyboards/crkbd/keymaps/drashna/rules.mk
+++ b/keyboards/crkbd/keymaps/drashna/rules.mk
@@ -14,7 +14,7 @@ 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 = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
+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
diff --git a/keyboards/crkbd/keymaps/like_jis/rules.mk b/keyboards/crkbd/keymaps/like_jis/rules.mk
index 5ee01e89e1..16deaf45d1 100644
--- a/keyboards/crkbd/keymaps/like_jis/rules.mk
+++ b/keyboards/crkbd/keymaps/like_jis/rules.mk
@@ -14,7 +14,7 @@ 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 = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
+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
diff --git a/keyboards/crkbd/rules.mk b/keyboards/crkbd/rules.mk
index 6396b115de..426ed0c03f 100644
--- a/keyboards/crkbd/rules.mk
+++ b/keyboards/crkbd/rules.mk
@@ -65,7 +65,7 @@ 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. Do not enable this with audio at the same time.
+RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
SUBPROJECT_rev1 = no
USE_I2C = yes
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
--
cgit v1.2.3
From 7e99d869deb57251dc15620beff34d5fd53066e4 Mon Sep 17 00:00:00 2001
From: Drashna Jaelre
Date: Mon, 22 Oct 2018 10:26:19 -0700
Subject: Remove all of the deprecated RGB defines
Fixes #3641
---
keyboards/crkbd/rev1/config.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/rev1/config.h b/keyboards/crkbd/rev1/config.h
index efce13a490..915779060b 100644
--- a/keyboards/crkbd/rev1/config.h
+++ b/keyboards/crkbd/rev1/config.h
@@ -57,10 +57,8 @@ along with this program. If not, see .
/* ws2812 RGB LED */
#define RGB_DI_PIN D3
-#define RGBLIGHT_TIMER
+
#define RGBLED_NUM 12 // Number of LEDs
-#define ws2812_PORTREG PORTD
-#define ws2812_DDRREG DDRD
/*
* Feature disable options
--
cgit v1.2.3
From 76b5ac621d3f5f5e809de2bc9479d54b99a2f89f Mon Sep 17 00:00:00 2001
From: Drashna Jaelre
Date: Tue, 16 Oct 2018 20:33:55 -0700
Subject: Update to Corne Keyboard (crkbd) keymap
---
keyboards/crkbd/keymaps/drashna/keymap.c | 63 +++++++++++++++++++-------------
keyboards/crkbd/keymaps/drashna/rules.mk | 2 +-
2 files changed, 39 insertions(+), 26 deletions(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/keyboards/crkbd/keymaps/drashna/keymap.c
index a293d53374..49db492c4e 100644
--- a/keyboards/crkbd/keymaps/drashna/keymap.c
+++ b/keyboards/crkbd/keymaps/drashna/keymap.c
@@ -113,12 +113,47 @@ const char *read_logo(void);
void set_keylog(uint16_t keycode, keyrecord_t *record);
const char *read_keylog(void);
const char *read_keylogs(void);
-
+char layer_state_str[24];
// const char *read_mode_icon(bool swap);
-// const char *read_host_led_state(void);
+const char *read_host_led_state(void);
// void set_timelog(void);
// const char *read_timelog(void);
+
+const char* read_layer_state(void) {
+ switch (layer_state) {
+ case _QWERTY:
+ switch (default_layer_state) {
+ case _QWERTY:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: QWERTY");
+ break;
+ case _COLEMAK:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Colemak");
+ break;
+ case _DVORAK:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Dvorak");
+ break;
+ case _WORKMAN:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Workman");
+ break;
+ }
+ break;
+ case _RAISE:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Raise");
+ break;
+ case _LOWER:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Lower");
+ break;
+ case _ADJUST:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Adjust");
+ break;
+ default:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Undef-%ld", layer_state);
+ }
+
+ return layer_state_str;
+}
+
void matrix_scan_keymap(void) {
iota_gfx_task();
}
@@ -130,7 +165,7 @@ void matrix_render_user(struct CharacterMatrix *matrix) {
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_host_led_state());
//matrix_write_ln(matrix, read_timelog());
} else {
matrix_write(matrix, read_logo());
@@ -156,28 +191,6 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
set_keylog(keycode, record);
// set_timelog();
}
-
- switch (keycode) {
- case RGB_MOD:
- #ifdef RGBLIGHT_ENABLE
- if (record->event.pressed) {
- rgblight_mode_noeeprom(RGB_current_mode);
- rgblight_step();
- RGB_current_mode = rgblight_config.mode;
- }
- #endif
- return false;
- break;
- case RGBRST:
- #ifdef RGBLIGHT_ENABLE
- if (record->event.pressed) {
- eeconfig_update_rgblight_default();
- rgblight_enable();
- RGB_current_mode = rgblight_config.mode;
- }
- #endif
- break;
- }
return true;
}
diff --git a/keyboards/crkbd/keymaps/drashna/rules.mk b/keyboards/crkbd/keymaps/drashna/rules.mk
index 8f69cba72f..a4e1deba86 100644
--- a/keyboards/crkbd/keymaps/drashna/rules.mk
+++ b/keyboards/crkbd/keymaps/drashna/rules.mk
@@ -26,6 +26,6 @@ SRC += ./lib/glcdfont.c \
./lib/layer_state_reader.c \
./lib/logo_reader.c \
./lib/keylogger.c \
+ ./lib/host_led_state_reader.c \
# ./lib/mode_icon_reader.c \
- # ./lib/host_led_state_reader.c \
# ./lib/timelogger.c \
--
cgit v1.2.3
From 4df74f6058043cf37d997e8e93fc3526b29a13b3 Mon Sep 17 00:00:00 2001
From: Drashna Jaelre
Date: Wed, 24 Oct 2018 13:45:39 -0700
Subject: Minor updates to keymaps
---
keyboards/crkbd/keymaps/drashna/keymap.c | 4 ++--
keyboards/crkbd/keymaps/drashna/rules.mk | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/keyboards/crkbd/keymaps/drashna/keymap.c
index 49db492c4e..99dcdb4e17 100644
--- a/keyboards/crkbd/keymaps/drashna/keymap.c
+++ b/keyboards/crkbd/keymaps/drashna/keymap.c
@@ -28,8 +28,8 @@ enum crkbd_keycodes {
LAYOUT_wrapper( \
KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_BSPC, \
KC_TAB, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, KC_QUOT, \
- KC_MLSF, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, CTL_T(K2A), KC_MRSF, \
- LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE \
+ OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, CTL_T(K2A), OS_RSFT, \
+ LT(_LOWER,KC_GRV), KC_SPC, LALT_T(KC_BSPC), KC_DEL, KC_ENT, RAISE \
)
#define LAYOUT_crkbd_base_wrapper(...) LAYOUT_crkbd_base(__VA_ARGS__)
diff --git a/keyboards/crkbd/keymaps/drashna/rules.mk b/keyboards/crkbd/keymaps/drashna/rules.mk
index a4e1deba86..ccf8e2b7c8 100644
--- a/keyboards/crkbd/keymaps/drashna/rules.mk
+++ b/keyboards/crkbd/keymaps/drashna/rules.mk
@@ -14,7 +14,7 @@ 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 = yes # Enable WS2812 RGB underlight.
+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
@@ -23,9 +23,9 @@ 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/host_led_state_reader.c \
+ # ./lib/layer_state_reader.c \
# ./lib/mode_icon_reader.c \
# ./lib/timelogger.c \
--
cgit v1.2.3
From 756d92c1a071b6c481b67a44671308fc9d680afe Mon Sep 17 00:00:00 2001
From: Kosuke Adachi
Date: Mon, 5 Nov 2018 03:46:26 +0900
Subject: Keyboard: Update the serial.c of crkbd based on the helix-serial.c
(#4349)
---
keyboards/crkbd/rev1/serial_config.h | 12 +-
keyboards/crkbd/rev1/split_scomm.c | 49 ++++--
keyboards/crkbd/rev1/split_scomm.h | 5 +-
keyboards/crkbd/rev1/split_util.h | 5 +-
keyboards/crkbd/serial.c | 284 ++++++++++++++++++++++++++---------
keyboards/crkbd/serial.h | 27 ++--
6 files changed, 277 insertions(+), 105 deletions(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/rev1/serial_config.h b/keyboards/crkbd/rev1/serial_config.h
index 671ed821d2..4fab8e8ddf 100644
--- a/keyboards/crkbd/rev1/serial_config.h
+++ b/keyboards/crkbd/rev1/serial_config.h
@@ -1,10 +1,4 @@
-#pragma once
-
-/* Soft Serial defines */
-#define SERIAL_PIN_DDR DDRD
-#define SERIAL_PIN_PORT PORTD
-#define SERIAL_PIN_INPUT PIND
-#define SERIAL_PIN_MASK _BV(PD2)
-#define SERIAL_PIN_INTERRUPT INT2_vect
-
+#ifndef SOFT_SERIAL_PIN
+#define SOFT_SERIAL_PIN D2
#define SERIAL_USE_MULTI_TRANSACTION
+#endif
diff --git a/keyboards/crkbd/rev1/split_scomm.c b/keyboards/crkbd/rev1/split_scomm.c
index 9719eb22ea..ada7867960 100644
--- a/keyboards/crkbd/rev1/split_scomm.c
+++ b/keyboards/crkbd/rev1/split_scomm.c
@@ -7,8 +7,8 @@
#include
#include
#include "serial.h"
-#ifdef SERIAL_DEBUG_MODE
-#include
+#ifdef CONSOLE_ENABLE
+ #include
#endif
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
@@ -17,6 +17,7 @@ uint8_t volatile status_com = 0;
uint8_t volatile status1 = 0;
uint8_t slave_buffer_change_count = 0;
uint8_t s_change_old = 0xff;
+uint8_t s_change_new = 0xff;
SSTD_t transactions[] = {
#define GET_SLAVE_STATUS 0
@@ -41,12 +42,12 @@ SSTD_t transactions[] = {
void serial_master_init(void)
{
- soft_serial_initiator_init(transactions);
+ soft_serial_initiator_init(transactions, TID_LIMIT(transactions));
}
void serial_slave_init(void)
{
- soft_serial_target_init(transactions);
+ soft_serial_target_init(transactions, TID_LIMIT(transactions));
}
// 0 => no error
@@ -54,19 +55,37 @@ void serial_slave_init(void)
// 2 => checksum error
int serial_update_buffers(int master_update)
{
- int status;
+ int status, smatstatus;
static int need_retry = 0;
- if( s_change_old != slave_buffer_change_count ) {
- status = soft_serial_transaction(GET_SLAVE_BUFFER);
- if( status == TRANSACTION_END )
- s_change_old = slave_buffer_change_count;
+
+ if( s_change_old != s_change_new ) {
+ smatstatus = soft_serial_transaction(GET_SLAVE_BUFFER);
+ if( smatstatus == TRANSACTION_END ) {
+ s_change_old = s_change_new;
+#ifdef CONSOLE_ENABLE
+ uprintf("slave matrix = %b %b %b %b %b\n",
+ serial_slave_buffer[0], serial_slave_buffer[1],
+ serial_slave_buffer[2], serial_slave_buffer[3],
+ serial_slave_buffer[4] );
+#endif
+ }
+ } else {
+ // serial_slave_buffer dosen't change
+ smatstatus = TRANSACTION_END; // dummy status
+ }
+
+ if( !master_update && !need_retry) {
+ status = soft_serial_transaction(GET_SLAVE_STATUS);
+ } else {
+ status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS);
+ }
+ if( status == TRANSACTION_END ) {
+ s_change_new = slave_buffer_change_count;
+ need_retry = 0;
+ } else {
+ need_retry = 1;
}
- if( !master_update && !need_retry)
- status = soft_serial_transaction(GET_SLAVE_STATUS);
- else
- status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS);
- need_retry = ( status == TRANSACTION_END ) ? 0 : 1;
- return status;
+ return smatstatus;
}
#endif // SERIAL_USE_MULTI_TRANSACTION
diff --git a/keyboards/crkbd/rev1/split_scomm.h b/keyboards/crkbd/rev1/split_scomm.h
index 16887eb74f..873d8939d8 100644
--- a/keyboards/crkbd/rev1/split_scomm.h
+++ b/keyboards/crkbd/rev1/split_scomm.h
@@ -1,4 +1,5 @@
-#pragma once
+#ifndef SPLIT_COMM_H
+#define SPLIT_COMM_H
#ifndef SERIAL_USE_MULTI_TRANSACTION
/* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */
@@ -19,3 +20,5 @@ void serial_slave_init(void);
int serial_update_buffers(int master_changed);
#endif
+
+#endif /* SPLIT_COMM_H */
diff --git a/keyboards/crkbd/rev1/split_util.h b/keyboards/crkbd/rev1/split_util.h
index f593047560..687ca19bd3 100644
--- a/keyboards/crkbd/rev1/split_util.h
+++ b/keyboards/crkbd/rev1/split_util.h
@@ -1,4 +1,5 @@
-#pragma once
+#ifndef SPLIT_KEYBOARD_UTIL_H
+#define SPLIT_KEYBOARD_UTIL_H
#include
#include "eeconfig.h"
@@ -14,3 +15,5 @@ void split_keyboard_setup(void);
bool has_usb(void);
void matrix_master_OLED_init (void);
+
+#endif
diff --git a/keyboards/crkbd/serial.c b/keyboards/crkbd/serial.c
index 11ceff0b37..325c29a3f7 100644
--- a/keyboards/crkbd/serial.c
+++ b/keyboards/crkbd/serial.c
@@ -1,5 +1,10 @@
/*
* WARNING: be careful changing this code, it is very timing dependent
+ *
+ * 2018-10-28 checked
+ * avr-gcc 4.9.2
+ * avr-gcc 5.4.0
+ * avr-gcc 7.3.0
*/
#ifndef F_CPU
@@ -14,8 +19,58 @@
#include "serial.h"
//#include
-#ifdef USE_SERIAL
+#ifdef SOFT_SERIAL_PIN
+#ifdef __AVR_ATmega32U4__
+ // if using ATmega32U4 I2C, can not use PD0 and PD1 in soft serial.
+ #ifdef USE_I2C
+ #if SOFT_SERIAL_PIN == D0 || SOFT_SERIAL_PIN == D1
+ #error Using ATmega32U4 I2C, so can not use PD0, PD1
+ #endif
+ #endif
+
+ #if SOFT_SERIAL_PIN >= D0 && SOFT_SERIAL_PIN <= D3
+ #define SERIAL_PIN_DDR DDRD
+ #define SERIAL_PIN_PORT PORTD
+ #define SERIAL_PIN_INPUT PIND
+ #if SOFT_SERIAL_PIN == D0
+ #define SERIAL_PIN_MASK _BV(PD0)
+ #define EIMSK_BIT _BV(INT0)
+ #define EICRx_BIT (~(_BV(ISC00) | _BV(ISC01)))
+ #define SERIAL_PIN_INTERRUPT INT0_vect
+ #elif SOFT_SERIAL_PIN == D1
+ #define SERIAL_PIN_MASK _BV(PD1)
+ #define EIMSK_BIT _BV(INT1)
+ #define EICRx_BIT (~(_BV(ISC10) | _BV(ISC11)))
+ #define SERIAL_PIN_INTERRUPT INT1_vect
+ #elif SOFT_SERIAL_PIN == D2
+ #define SERIAL_PIN_MASK _BV(PD2)
+ #define EIMSK_BIT _BV(INT2)
+ #define EICRx_BIT (~(_BV(ISC20) | _BV(ISC21)))
+ #define SERIAL_PIN_INTERRUPT INT2_vect
+ #elif SOFT_SERIAL_PIN == D3
+ #define SERIAL_PIN_MASK _BV(PD3)
+ #define EIMSK_BIT _BV(INT3)
+ #define EICRx_BIT (~(_BV(ISC30) | _BV(ISC31)))
+ #define SERIAL_PIN_INTERRUPT INT3_vect
+ #endif
+ #elif SOFT_SERIAL_PIN == E6
+ #define SERIAL_PIN_DDR DDRE
+ #define SERIAL_PIN_PORT PORTE
+ #define SERIAL_PIN_INPUT PINE
+ #define SERIAL_PIN_MASK _BV(PE6)
+ #define EIMSK_BIT _BV(INT6)
+ #define EICRx_BIT (~(_BV(ISC60) | _BV(ISC61)))
+ #define SERIAL_PIN_INTERRUPT INT6_vect
+ #else
+ #error invalid SOFT_SERIAL_PIN value
+ #endif
+
+#else
+ #error serial.c now support ATmega32U4 only
+#endif
+
+//////////////// for backward compatibility ////////////////////////////////
#ifndef SERIAL_USE_MULTI_TRANSACTION
/* --- USE Simple API (OLD API, compatible with let's split serial.c) */
#if SERIAL_SLAVE_BUFFER_LENGTH > 0
@@ -42,56 +97,118 @@ SSTD_t transactions[] = {
};
void serial_master_init(void)
-{ soft_serial_initiator_init(transactions); }
+{ soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); }
void serial_slave_init(void)
-{ soft_serial_target_init(transactions); }
+{ soft_serial_target_init(transactions, TID_LIMIT(transactions)); }
// 0 => no error
// 1 => slave did not respond
// 2 => checksum error
int serial_update_buffers()
-{ return soft_serial_transaction(); }
+{
+ int result;
+ result = soft_serial_transaction();
+ return result;
+}
-#endif // Simple API (OLD API, compatible with let's split serial.c)
+#endif // end of Simple API (OLD API, compatible with let's split serial.c)
+////////////////////////////////////////////////////////////////////////////
#define ALWAYS_INLINE __attribute__((always_inline))
#define NO_INLINE __attribute__((noinline))
#define _delay_sub_us(x) __builtin_avr_delay_cycles(x)
-// Serial pulse period in microseconds.
-#define TID_SEND_ADJUST 14
+// parity check
+#define ODD_PARITY 1
+#define EVEN_PARITY 0
+#define PARITY EVEN_PARITY
+
+#ifdef SERIAL_DELAY
+ // custom setup in config.h
+ // #define TID_SEND_ADJUST 2
+ // #define SERIAL_DELAY 6 // micro sec
+ // #define READ_WRITE_START_ADJUST 30 // cycles
+ // #define READ_WRITE_WIDTH_ADJUST 8 // cycles
+#else
+// ============ Standard setups ============
+
+#ifndef SELECT_SOFT_SERIAL_SPEED
+#define SELECT_SOFT_SERIAL_SPEED 1
+// 0: about 189kbps
+// 1: about 137kbps (default)
+// 2: about 75kbps
+// 3: about 39kbps
+// 4: about 26kbps
+// 5: about 20kbps
+#endif
-#define SELECT_SERIAL_SPEED 1
-#if SELECT_SERIAL_SPEED == 0
+#if __GNUC__ < 6
+ #define TID_SEND_ADJUST 14
+#else
+ #define TID_SEND_ADJUST 2
+#endif
+
+#if SELECT_SOFT_SERIAL_SPEED == 0
// Very High speed
#define SERIAL_DELAY 4 // micro sec
- #define READ_WRITE_START_ADJUST 33 // cycles
- #define READ_WRITE_WIDTH_ADJUST 3 // cycles
-#elif SELECT_SERIAL_SPEED == 1
+ #if __GNUC__ < 6
+ #define READ_WRITE_START_ADJUST 33 // cycles
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+ #else
+ #define READ_WRITE_START_ADJUST 34 // cycles
+ #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #endif
+#elif SELECT_SOFT_SERIAL_SPEED == 1
// High speed
#define SERIAL_DELAY 6 // micro sec
- #define READ_WRITE_START_ADJUST 30 // cycles
- #define READ_WRITE_WIDTH_ADJUST 3 // cycles
-#elif SELECT_SERIAL_SPEED == 2
+ #if __GNUC__ < 6
+ #define READ_WRITE_START_ADJUST 30 // cycles
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+ #else
+ #define READ_WRITE_START_ADJUST 33 // cycles
+ #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #endif
+#elif SELECT_SOFT_SERIAL_SPEED == 2
// Middle speed
#define SERIAL_DELAY 12 // micro sec
#define READ_WRITE_START_ADJUST 30 // cycles
- #define READ_WRITE_WIDTH_ADJUST 3 // cycles
-#elif SELECT_SERIAL_SPEED == 3
+ #if __GNUC__ < 6
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+ #else
+ #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #endif
+#elif SELECT_SOFT_SERIAL_SPEED == 3
// Low speed
#define SERIAL_DELAY 24 // micro sec
#define READ_WRITE_START_ADJUST 30 // cycles
- #define READ_WRITE_WIDTH_ADJUST 3 // cycles
-#elif SELECT_SERIAL_SPEED == 4
+ #if __GNUC__ < 6
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+ #else
+ #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #endif
+#elif SELECT_SOFT_SERIAL_SPEED == 4
// Very Low speed
- #define SERIAL_DELAY 50 // micro sec
+ #define SERIAL_DELAY 36 // micro sec
+ #define READ_WRITE_START_ADJUST 30 // cycles
+ #if __GNUC__ < 6
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+ #else
+ #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #endif
+#elif SELECT_SOFT_SERIAL_SPEED == 5
+ // Ultra Low speed
+ #define SERIAL_DELAY 48 // micro sec
#define READ_WRITE_START_ADJUST 30 // cycles
- #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+ #if __GNUC__ < 6
+ #define READ_WRITE_WIDTH_ADJUST 3 // cycles
+ #else
+ #define READ_WRITE_WIDTH_ADJUST 7 // cycles
+ #endif
#else
-#error Illegal Serial Speed
-#endif
-
+#error invalid SELECT_SOFT_SERIAL_SPEED value
+#endif /* SELECT_SOFT_SERIAL_SPEED */
+#endif /* SERIAL_DELAY */
#define SERIAL_DELAY_HALF1 (SERIAL_DELAY/2)
#define SERIAL_DELAY_HALF2 (SERIAL_DELAY - SERIAL_DELAY/2)
@@ -105,17 +222,21 @@ int serial_update_buffers()
#endif
static SSTD_t *Transaction_table = NULL;
+static uint8_t Transaction_table_size = 0;
+inline static void serial_delay(void) ALWAYS_INLINE;
inline static
void serial_delay(void) {
_delay_us(SERIAL_DELAY);
}
+inline static void serial_delay_half1(void) ALWAYS_INLINE;
inline static
void serial_delay_half1(void) {
_delay_us(SERIAL_DELAY_HALF1);
}
+inline static void serial_delay_half2(void) ALWAYS_INLINE;
inline static
void serial_delay_half2(void) {
_delay_us(SERIAL_DELAY_HALF2);
@@ -135,6 +256,7 @@ void serial_input_with_pullup(void) {
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
}
+inline static uint8_t serial_read_pin(void) ALWAYS_INLINE;
inline static
uint8_t serial_read_pin(void) {
return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
@@ -152,30 +274,28 @@ void serial_high(void) {
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
}
-void soft_serial_initiator_init(SSTD_t *sstd_table)
+void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size)
{
Transaction_table = sstd_table;
+ Transaction_table_size = (uint8_t)sstd_table_size;
serial_output();
serial_high();
}
-void soft_serial_target_init(SSTD_t *sstd_table)
+void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size)
{
Transaction_table = sstd_table;
+ Transaction_table_size = (uint8_t)sstd_table_size;
serial_input_with_pullup();
-#if SERIAL_PIN_MASK == _BV(PD0)
- // Enable INT0
- EIMSK |= _BV(INT0);
- // Trigger on falling edge of INT0
- EICRA &= ~(_BV(ISC00) | _BV(ISC01));
-#elif SERIAL_PIN_MASK == _BV(PD2)
- // Enable INT2
- EIMSK |= _BV(INT2);
- // Trigger on falling edge of INT2
- EICRA &= ~(_BV(ISC20) | _BV(ISC21));
+ // Enable INT0-INT3,INT6
+ EIMSK |= EIMSK_BIT;
+#if SERIAL_PIN_MASK == _BV(PE6)
+ // Trigger on falling edge of INT6
+ EICRB &= EICRx_BIT;
#else
- #error unknown SERIAL_PIN_MASK value
+ // Trigger on falling edge of INT0-INT3
+ EICRA &= EICRx_BIT;
#endif
}
@@ -191,7 +311,7 @@ void sync_recv(void) {
}
// Used by the reciver to send a synchronization signal to the sender.
-static void sync_send(void)NO_INLINE;
+static void sync_send(void) NO_INLINE;
static
void sync_send(void) {
serial_low();
@@ -205,12 +325,12 @@ static uint8_t serial_read_chunk(uint8_t *pterrcount, uint8_t bit) {
uint8_t byte, i, p, pb;
_delay_sub_us(READ_WRITE_START_ADJUST);
- for( i = 0, byte = 0, p = 0; i < bit; i++ ) {
+ for( i = 0, byte = 0, p = PARITY; i < bit; i++ ) {
serial_delay_half1(); // read the middle of pulses
if( serial_read_pin() ) {
- byte = (byte << 1) | 1; p ^= 1;
+ byte = (byte << 1) | 1; p ^= 1;
} else {
- byte = (byte << 1) | 0; p ^= 0;
+ byte = (byte << 1) | 0; p ^= 0;
}
_delay_sub_us(READ_WRITE_WIDTH_ADJUST);
serial_delay_half2();
@@ -230,13 +350,13 @@ static uint8_t serial_read_chunk(uint8_t *pterrcount, uint8_t bit) {
void serial_write_chunk(uint8_t data, uint8_t bit) NO_INLINE;
void serial_write_chunk(uint8_t data, uint8_t bit) {
uint8_t b, p;
- for( p = 0, b = 1<<(bit-1); b ; b >>= 1) {
- if(data & b) {
- serial_high(); p ^= 1;
- } else {
- serial_low(); p ^= 0;
- }
- serial_delay();
+ for( p = PARITY, b = 1<<(bit-1); b ; b >>= 1) {
+ if(data & b) {
+ serial_high(); p ^= 1;
+ } else {
+ serial_low(); p ^= 0;
+ }
+ serial_delay();
}
/* send parity bit */
if(p & 1) { serial_high(); }
@@ -288,6 +408,13 @@ void change_reciver2sender(void) {
serial_delay_half1(); //4
}
+static inline uint8_t nibble_bits_count(uint8_t bits)
+{
+ bits = (bits & 0x5) + (bits >> 1 & 0x5);
+ bits = (bits & 0x3) + (bits >> 2 & 0x3);
+ return bits;
+}
+
// interrupt handle to be used by the target device
ISR(SERIAL_PIN_INTERRUPT) {
@@ -297,12 +424,15 @@ ISR(SERIAL_PIN_INTERRUPT) {
SSTD_t *trans = Transaction_table;
#else
// recive transaction table index
- uint8_t tid;
+ uint8_t tid, bits;
uint8_t pecount = 0;
sync_recv();
- tid = serial_read_chunk(&pecount,4);
- if(pecount> 0)
+ bits = serial_read_chunk(&pecount,7);
+ tid = bits>>3;
+ bits = (bits&7) != nibble_bits_count(tid);
+ if( bits || pecount> 0 || tid > Transaction_table_size ) {
return;
+ }
serial_delay_half1();
serial_high(); // response step1 low->high
@@ -315,17 +445,17 @@ ISR(SERIAL_PIN_INTERRUPT) {
// target send phase
if( trans->target2initiator_buffer_size > 0 )
serial_send_packet((uint8_t *)trans->target2initiator_buffer,
- trans->target2initiator_buffer_size);
+ trans->target2initiator_buffer_size);
// target switch to input
change_sender2reciver();
// target recive phase
if( trans->initiator2target_buffer_size > 0 ) {
if (serial_recive_packet((uint8_t *)trans->initiator2target_buffer,
- trans->initiator2target_buffer_size) ) {
- *trans->status = TRANSACTION_ACCEPTED;
+ trans->initiator2target_buffer_size) ) {
+ *trans->status = TRANSACTION_ACCEPTED;
} else {
- *trans->status = TRANSACTION_DATA_ERROR;
+ *trans->status = TRANSACTION_DATA_ERROR;
}
} else {
*trans->status = TRANSACTION_ACCEPTED;
@@ -349,6 +479,8 @@ int soft_serial_transaction(void) {
SSTD_t *trans = Transaction_table;
#else
int soft_serial_transaction(int sstd_index) {
+ if( sstd_index > Transaction_table_size )
+ return TRANSACTION_TYPE_ERROR;
SSTD_t *trans = &Transaction_table[sstd_index];
#endif
cli();
@@ -375,9 +507,10 @@ int soft_serial_transaction(int sstd_index) {
#else
// send transaction table index
+ int tid = (sstd_index<<3) | (7 & nibble_bits_count(sstd_index));
sync_send();
_delay_sub_us(TID_SEND_ADJUST);
- serial_write_chunk(sstd_index, 4);
+ serial_write_chunk(tid, 7);
serial_delay_half1();
// wait for the target response (step1 low->high)
@@ -389,12 +522,12 @@ int soft_serial_transaction(int sstd_index) {
// check if the target is present (step2 high->low)
for( int i = 0; serial_read_pin(); i++ ) {
if (i > SLAVE_INT_ACK_WIDTH + 1) {
- // slave failed to pull the line low, assume not present
- serial_output();
- serial_high();
- *trans->status = TRANSACTION_NO_RESPONSE;
- sei();
- return TRANSACTION_NO_RESPONSE;
+ // slave failed to pull the line low, assume not present
+ serial_output();
+ serial_high();
+ *trans->status = TRANSACTION_NO_RESPONSE;
+ sei();
+ return TRANSACTION_NO_RESPONSE;
}
_delay_sub_us(SLAVE_INT_ACK_WIDTH_UNIT);
}
@@ -404,12 +537,12 @@ int soft_serial_transaction(int sstd_index) {
// if the target is present syncronize with it
if( trans->target2initiator_buffer_size > 0 ) {
if (!serial_recive_packet((uint8_t *)trans->target2initiator_buffer,
- trans->target2initiator_buffer_size) ) {
- serial_output();
- serial_high();
- *trans->status = TRANSACTION_DATA_ERROR;
- sei();
- return TRANSACTION_DATA_ERROR;
+ trans->target2initiator_buffer_size) ) {
+ serial_output();
+ serial_high();
+ *trans->status = TRANSACTION_DATA_ERROR;
+ sei();
+ return TRANSACTION_DATA_ERROR;
}
}
@@ -419,7 +552,7 @@ int soft_serial_transaction(int sstd_index) {
// initiator send phase
if( trans->initiator2target_buffer_size > 0 ) {
serial_send_packet((uint8_t *)trans->initiator2target_buffer,
- trans->initiator2target_buffer_size);
+ trans->initiator2target_buffer_size);
}
// always, release the line when not in use
@@ -442,3 +575,16 @@ int soft_serial_get_and_clean_status(int sstd_index) {
#endif
#endif
+
+// Helix serial.c history
+// 2018-1-29 fork from let's split and add PD2, modify sync_recv() (#2308, bceffdefc)
+// 2018-6-28 bug fix master to slave comm and speed up (#3255, 1038bbef4)
+// (adjusted with avr-gcc 4.9.2)
+// 2018-7-13 remove USE_SERIAL_PD2 macro (#3374, f30d6dd78)
+// (adjusted with avr-gcc 4.9.2)
+// 2018-8-11 add support multi-type transaction (#3608, feb5e4aae)
+// (adjusted with avr-gcc 4.9.2)
+// 2018-10-21 fix serial and RGB animation conflict (#4191, 4665e4fff)
+// (adjusted with avr-gcc 7.3.0)
+// 2018-10-28 re-adjust compiler depend value of delay (#4269, 8517f8a66)
+// (adjusted with avr-gcc 5.4.0, 7.3.0)
diff --git a/keyboards/crkbd/serial.h b/keyboards/crkbd/serial.h
index 76c6aaa043..7e0c0847a4 100644
--- a/keyboards/crkbd/serial.h
+++ b/keyboards/crkbd/serial.h
@@ -1,16 +1,19 @@
-#pragma once
+#ifndef SOFT_SERIAL_H
+#define SOFT_SERIAL_H
#include
// /////////////////////////////////////////////////////////////////
-// Need Soft Serial defines in serial_config.h
+// Need Soft Serial defines in config.h
// /////////////////////////////////////////////////////////////////
// ex.
-// #define SERIAL_PIN_DDR DDRD
-// #define SERIAL_PIN_PORT PORTD
-// #define SERIAL_PIN_INPUT PIND
-// #define SERIAL_PIN_MASK _BV(PD?) ?=0,2
-// #define SERIAL_PIN_INTERRUPT INT?_vect ?=0,2
+// #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6
+// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5
+// // 1: about 137kbps (default)
+// // 2: about 75kbps
+// // 3: about 39kbps
+// // 4: about 26kbps
+// // 5: about 20kbps
//
// //// USE Simple API (OLD API, compatible with let's split serial.c)
// ex.
@@ -46,16 +49,18 @@ typedef struct _SSTD_t {
uint8_t target2initiator_buffer_size;
uint8_t *target2initiator_buffer;
} SSTD_t;
+#define TID_LIMIT( table ) (sizeof(table) / sizeof(SSTD_t))
// initiator is transaction start side
-void soft_serial_initiator_init(SSTD_t *sstd_table);
+void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size);
// target is interrupt accept side
-void soft_serial_target_init(SSTD_t *sstd_table);
+void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size);
// initiator resullt
#define TRANSACTION_END 0
#define TRANSACTION_NO_RESPONSE 0x1
#define TRANSACTION_DATA_ERROR 0x2
+#define TRANSACTION_TYPE_ERROR 0x4
#ifndef SERIAL_USE_MULTI_TRANSACTION
int soft_serial_transaction(void);
#else
@@ -71,7 +76,9 @@ int soft_serial_transaction(int sstd_index);
// target:
// TRANSACTION_DATA_ERROR
// or TRANSACTION_ACCEPTED
-#define TRANSACTION_ACCEPTED 0x4
+#define TRANSACTION_ACCEPTED 0x8
#ifdef SERIAL_USE_MULTI_TRANSACTION
int soft_serial_get_and_clean_status(int sstd_index);
#endif
+
+#endif /* SOFT_SERIAL_H */
--
cgit v1.2.3
From 5eb69ca224f3d4233860a658e6a27516d86c4de7 Mon Sep 17 00:00:00 2001
From: Ryoichi KATO
Date: Wed, 7 Nov 2018 23:04:02 -0800
Subject: Keyboard: fix ifdef for crkbd's default/keymap.c
undef SSD1306OLED should not kill entire process_record_user() function.
---
keyboards/crkbd/keymaps/default/keymap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/default/keymap.c b/keyboards/crkbd/keymaps/default/keymap.c
index e92fbdebfa..c7c9582e83 100644
--- a/keyboards/crkbd/keymaps/default/keymap.c
+++ b/keyboards/crkbd/keymaps/default/keymap.c
@@ -179,10 +179,13 @@ void iota_gfx_task_user(void) {
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();
}
@@ -244,4 +247,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
-#endif
--
cgit v1.2.3
From aa03049015855cdd5f61e6e8a7c6955abc5d3141 Mon Sep 17 00:00:00 2001
From: comaid <44457151+comaid@users.noreply.github.com>
Date: Tue, 13 Nov 2018 05:19:29 +0900
Subject: Fix up screen off timer of crkbd (#4346)
* fix about screen off timer
* Fix Up ScreenOffInterval exceeded uint16_t
* Fix Up never waking up once screen off if in case of matrix are not dirty.
* Revert "fix about screen off timer"
This reverts commit 3d175f2340c14250a71af78afec5a1e890d9f4e7.
* Fix up screen off timer of crkbd
* Fix Up ScreenOffInterval exceeded uint16_t
* Fix Up never waking up once screen off if in case of matrix are not dirty.
* Fix up screen off timer of helix
* Fix Up ScreenOffInterval exceeded uint16_t
* Fix Up never waking up once screen off if in case of matrix are not dirty
* Revert "Fix up screen off timer of helix"
This reverts commit f0efb82443a7dc34b75579359b0514e8bfa51100.
* Improve internal processing of process_record_kb()
* Use the return value of process_record_gfx()
* Fix a indent
Fix a indent
---
keyboards/crkbd/crkbd.c | 5 +++++
keyboards/crkbd/ssd1306.c | 16 ++++++++++++++--
keyboards/crkbd/ssd1306.h | 3 +++
3 files changed, 22 insertions(+), 2 deletions(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/crkbd.c b/keyboards/crkbd/crkbd.c
index 5e8ba8bacf..32f7af776e 100644
--- a/keyboards/crkbd/crkbd.c
+++ b/keyboards/crkbd/crkbd.c
@@ -1 +1,6 @@
#include "crkbd.h"
+#include "ssd1306.h"
+
+bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
+ return process_record_gfx(keycode,record) && process_record_user(keycode, record);
+}
\ No newline at end of file
diff --git a/keyboards/crkbd/ssd1306.c b/keyboards/crkbd/ssd1306.c
index 205ce67a9e..4330c8497d 100644
--- a/keyboards/crkbd/ssd1306.c
+++ b/keyboards/crkbd/ssd1306.c
@@ -24,12 +24,17 @@ static const unsigned char font[] PROGMEM;
//static uint16_t last_battery_update;
//static uint32_t vbat;
//#define BatteryUpdateInterval 10000 /* milliseconds */
-#define ScreenOffInterval 300000 /* milliseconds */
+
+// 'last_flush' is declared as uint16_t,
+// so this must be less than 65535
+#define ScreenOffInterval 60000 /* milliseconds */
#if DEBUG_TO_SCREEN
static uint8_t displaying;
#endif
static uint16_t last_flush;
+static bool force_dirty = true;
+
// Write command sequence.
// Returns true on success.
static inline bool _send_cmd1(uint8_t cmd) {
@@ -321,12 +326,19 @@ void iota_gfx_task_user(void) {
void iota_gfx_task(void) {
iota_gfx_task_user();
- if (display.dirty) {
+ if (display.dirty|| force_dirty) {
iota_gfx_flush();
+ force_dirty = false;
}
if (timer_elapsed(last_flush) > ScreenOffInterval) {
iota_gfx_off();
}
}
+
+bool process_record_gfx(uint16_t keycode, keyrecord_t *record) {
+ force_dirty = true;
+ return true;
+}
+
#endif
diff --git a/keyboards/crkbd/ssd1306.h b/keyboards/crkbd/ssd1306.h
index 76dd6a2a72..ea8c923280 100644
--- a/keyboards/crkbd/ssd1306.h
+++ b/keyboards/crkbd/ssd1306.h
@@ -3,6 +3,7 @@
#include
#include
#include "pincontrol.h"
+#include "action.h"
enum ssd1306_cmds {
DisplayOff = 0xAE,
@@ -86,3 +87,5 @@ void matrix_write(struct CharacterMatrix *matrix, const char *data);
void matrix_write_ln(struct CharacterMatrix *matrix, const char *data);
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
void matrix_render(struct CharacterMatrix *matrix);
+
+bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
\ No newline at end of file
--
cgit v1.2.3
From ecd21b44a8efd5c7241ebf48c65fc7b30134865f Mon Sep 17 00:00:00 2001
From: Drashna Jaelre
Date: Mon, 26 Nov 2018 16:45:24 -0800
Subject: Update to drashna userspace and keymaps (#4459)
* Fix reversed bool check in layer_state_set
* Add Quefrency 65 for a friend
* Add Ergodox EZ Glow keymap
* Add RGB Matrix Code
* Further changes to rgb matrix ErgoDox EZ
* Update bjohnson keymaps
* Fix CRKBD display
* Overhaul to corne keyboard
* Narrow scope for keylogger
* Minor layout tweaks to Corne Keyboard
* additional CRKBD tweaks
* Minor tweaks to CRKBD
* Add all characters for keylogger
* Ergodox EZ Glow overhaul
* Fix Ergodox EZ Glow layer colors
* Increase Tapping Term for Corne Keyboard
* Fix unicode-ish
* Revert some changes
* Add layer specific lighting effects
* Some minor tweaks to ergodox glow config
* revert changes to ergodox files
* Update Glow readme
* Add more tapping term defines
* Fix changes
* Fix ergodox keymap
* Hopefully fix sleeping
* Disable layer indications if rgb matrix is disabled
* Add support for sleeping and rgb layer change toggle to ergodox ez glow
* Make RGB Layer Indication Great Again
* Make Unicode Great Again
* Remove placeholder define
Co-Authored-By: drashna
* Remove placeholder define
Co-Authored-By: drashna
* Remove old EEPROM Reset keycode
---
keyboards/crkbd/keymaps/drashna/config.h | 7 +-
keyboards/crkbd/keymaps/drashna/keymap.c | 153 ++++++++++++++++++++++---------
keyboards/crkbd/keymaps/drashna/rules.mk | 8 +-
3 files changed, 121 insertions(+), 47 deletions(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/drashna/config.h b/keyboards/crkbd/keymaps/drashna/config.h
index adfd79044d..cbc3feeb61 100644
--- a/keyboards/crkbd/keymaps/drashna/config.h
+++ b/keyboards/crkbd/keymaps/drashna/config.h
@@ -41,5 +41,10 @@ along with this program. If not, see .
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
-#define RGBLIGHT_LIMIT_VAL 120
+#define RGBLIGHT_LIMIT_VAL 100
+#endif
+
+#ifdef AUDIO_ENABLE
+#define B6_AUDIO
+// #define NO_MUSIC_MODE
#endif
diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/keyboards/crkbd/keymaps/drashna/keymap.c
index 99dcdb4e17..282ee25725 100644
--- a/keyboards/crkbd/keymaps/drashna/keymap.c
+++ b/keyboards/crkbd/keymaps/drashna/keymap.c
@@ -26,10 +26,10 @@ enum crkbd_keycodes {
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
) \
LAYOUT_wrapper( \
- KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_BSPC, \
- KC_TAB, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, KC_QUOT, \
+ KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \
+ KC_TAB, ALT_T(K11), K12, K13, K14, K15, K16, K17, K18, K19, K1A, RGUI_T(KC_QUOT), \
OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, CTL_T(K2A), OS_RSFT, \
- LT(_LOWER,KC_GRV), KC_SPC, LALT_T(KC_BSPC), KC_DEL, KC_ENT, RAISE \
+ LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE \
)
#define LAYOUT_crkbd_base_wrapper(...) LAYOUT_crkbd_base(__VA_ARGS__)
@@ -66,14 +66,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[_LOWER] = LAYOUT_wrapper(
- KC_TILD, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_BSPC,
- KC_F11, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE,
- KC_F12, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______,
+ KC_F11, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_F11,
+ KC_F12, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE,
+ _______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______,
_______, _______, _______, _______, _______, _______
),
[_RAISE] = LAYOUT_wrapper( \
- KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, KC_BSPC,
+ _______, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______,
_______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS,
_______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______,
_______, _______, _______, _______, _______, _______
@@ -81,18 +81,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_ADJUST] = LAYOUT_wrapper( \
KC_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RESET,
- VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EPRM,
- TG_MODS, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY,
- _______, _______, _______, _______, _______, _______
+ VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EEP_RST,
+ _______, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY,
+ _______, _______, _______, KC_NUKE, TG_MODS, _______
)
};
-int RGB_current_mode;
-
void matrix_init_keymap(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
@@ -102,53 +97,118 @@ void matrix_init_keymap(void) {
PORTD &= ~(1<<5);
DDRB &= ~(1<<0);
- PORTB &= ~(1<<0);}
+ PORTB &= ~(1<<0);
+}
//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);
char layer_state_str[24];
+char modifier_state_str[24];
+char host_led_state_str[24];
+char keylog_str[24] = {};
+char keylogs_str[21] = {};
+int keylogs_str_idx = 0;
+
// const char *read_mode_icon(bool swap);
-const char *read_host_led_state(void);
// void set_timelog(void);
// const char *read_timelog(void);
+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 set_keylog(uint16_t keycode, keyrecord_t *record) {
+ char name = ' ';
+ if (keycode < 60) {
+ name = code_to_name[keycode];
+ }
+
+ // update keylog
+ snprintf(keylog_str, sizeof(keylog_str), "%dx%d, k%2d : %c",
+ record->event.key.row, record->event.key.col,
+ keycode, name);
+
+ // update keylogs
+ if (keylogs_str_idx == sizeof(keylogs_str) - 1) {
+ keylogs_str_idx = 0;
+ for (int i = 0; i < sizeof(keylogs_str) - 1; i++) {
+ keylogs_str[i] = ' ';
+ }
+ }
+
+ keylogs_str[keylogs_str_idx] = name;
+ keylogs_str_idx++;
+}
+
+const char *read_keylog(void) {
+ return keylog_str;
+}
+
+const char *read_keylogs(void) {
+ return keylogs_str;
+}
+
+
+const char* read_modifier_state(void) {
+ uint8_t modifiers = get_mods();
+ uint8_t one_shot = get_oneshot_mods();
+
+ snprintf(modifier_state_str, sizeof(modifier_state_str), "Mods:%s %s %s %s",
+ (modifiers & MODS_CTRL_MASK || one_shot & MODS_CTRL_MASK) ? "CTL" : " ",
+ (modifiers & MODS_GUI_MASK || one_shot & MODS_GUI_MASK) ? "GUI" : " ",
+ (modifiers & MODS_ALT_MASK || one_shot & MODS_ALT_MASK) ? "ALT" : " ",
+ (modifiers & MODS_SHIFT_MASK || one_shot & MODS_SHIFT_MASK) ? "SFT" : " "
+ );
+
+ return modifier_state_str;
+}
+
+const char *read_host_led_state(void) {
+ uint8_t leds = host_keyboard_leds();
+
+ snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s",
+ (leds & (1 << USB_LED_NUM_LOCK)) ? "on" : "- ",
+ (leds & (1 << USB_LED_CAPS_LOCK)) ? "on" : "- ",
+ (leds & (1 << USB_LED_SCROLL_LOCK)) ? "on" : "- "
+ );
+
+ return host_led_state_str;
+}
const char* read_layer_state(void) {
- switch (layer_state) {
- case _QWERTY:
- switch (default_layer_state) {
+ switch (biton32(layer_state)) {
+ case _RAISE:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Raise ");
+ break;
+ case _LOWER:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Lower ");
+ break;
+ case _ADJUST:
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Adjust ");
+ break;
+ default:
+ switch (biton32(default_layer_state)) {
case _QWERTY:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: QWERTY");
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Qwerty ");
break;
case _COLEMAK:
snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Colemak");
break;
case _DVORAK:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Dvorak");
+ snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Dvorak ");
break;
case _WORKMAN:
snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Workman");
break;
}
break;
- case _RAISE:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Raise");
- break;
- case _LOWER:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Lower");
- break;
- case _ADJUST:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Adjust");
- break;
- default:
- snprintf(layer_state_str, sizeof(layer_state_str), "Layer: Undef-%ld", layer_state);
}
return layer_state_str;
@@ -160,12 +220,13 @@ void matrix_scan_keymap(void) {
void matrix_render_user(struct CharacterMatrix *matrix) {
if (is_master) {
- // 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
matrix_write_ln(matrix, read_layer_state());
- matrix_write_ln(matrix, read_keylog());
+ matrix_write_ln(matrix, read_modifier_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_mode_icon(keymap_config.swap_lalt_lgui));
+ matrix_write(matrix, read_host_led_state());
//matrix_write_ln(matrix, read_timelog());
} else {
matrix_write(matrix, read_logo());
@@ -187,8 +248,14 @@ void iota_gfx_task_user(void) {
}
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
- if (record->event.pressed) {
- set_keylog(keycode, record);
+ switch (keycode) {
+ case KC_A ... KC_SLASH:
+ case KC_F1 ... KC_F12:
+ case KC_INSERT ... KC_UP:
+ case KC_KP_SLASH ... KC_KP_DOT:
+ case KC_F13 ... KC_F24:
+ if (record->event.pressed) { set_keylog(keycode, record); }
+ break;
// set_timelog();
}
return true;
diff --git a/keyboards/crkbd/keymaps/drashna/rules.mk b/keyboards/crkbd/keymaps/drashna/rules.mk
index ccf8e2b7c8..4b70f66f7b 100644
--- a/keyboards/crkbd/keymaps/drashna/rules.mk
+++ b/keyboards/crkbd/keymaps/drashna/rules.mk
@@ -20,12 +20,14 @@ 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
+BOOTLOADER = qmk-dfu
+
# If you want to change the display of OLED, you need to change here
SRC += ./lib/glcdfont.c \
./lib/rgb_state_reader.c \
./lib/logo_reader.c \
- ./lib/keylogger.c \
- ./lib/host_led_state_reader.c \
- # ./lib/layer_state_reader.c \
+ # ./lib/keylogger.c \
+ # ./lib/host_led_state_reader.c \
# ./lib/mode_icon_reader.c \
+ # ./lib/layer_state_reader.c \
# ./lib/timelogger.c \
--
cgit v1.2.3
From dd7534cccabd9e1cea86e69741ed8c68cb3d0299 Mon Sep 17 00:00:00 2001
From: epaew
Date: Wed, 28 Nov 2018 08:18:11 +0900
Subject: Keyboard: fix for debug crkbd (#4469)
---
keyboards/crkbd/crkbd.c | 10 +++++++---
keyboards/crkbd/rev1/split_scomm.c | 5 ++---
2 files changed, 9 insertions(+), 6 deletions(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/crkbd.c b/keyboards/crkbd/crkbd.c
index 32f7af776e..d420ccda27 100644
--- a/keyboards/crkbd/crkbd.c
+++ b/keyboards/crkbd/crkbd.c
@@ -1,6 +1,10 @@
#include "crkbd.h"
-#include "ssd1306.h"
+#include "ssd1306.h"
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
- return process_record_gfx(keycode,record) && process_record_user(keycode, record);
-}
\ No newline at end of file
+#ifdef SSD1306OLED
+ return process_record_gfx(keycode,record) && process_record_user(keycode, record);
+#else
+ return process_record_user(keycode, record);
+#endif
+}
diff --git a/keyboards/crkbd/rev1/split_scomm.c b/keyboards/crkbd/rev1/split_scomm.c
index ada7867960..a1fe6ba5b8 100644
--- a/keyboards/crkbd/rev1/split_scomm.c
+++ b/keyboards/crkbd/rev1/split_scomm.c
@@ -63,10 +63,9 @@ int serial_update_buffers(int master_update)
if( smatstatus == TRANSACTION_END ) {
s_change_old = s_change_new;
#ifdef CONSOLE_ENABLE
- uprintf("slave matrix = %b %b %b %b %b\n",
+ uprintf("slave matrix = %b %b %b %b\n",
serial_slave_buffer[0], serial_slave_buffer[1],
- serial_slave_buffer[2], serial_slave_buffer[3],
- serial_slave_buffer[4] );
+ serial_slave_buffer[2], serial_slave_buffer[3]);
#endif
}
} else {
--
cgit v1.2.3
From 19043197459c5c8ed4a7039f1a4c1da180da45e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?=
Date: Wed, 28 Nov 2018 00:34:06 +0100
Subject: Remove RGB_SMOD alias and replace uses with RGB_MOD (#4319)
---
keyboards/crkbd/keymaps/default/keymap.c | 4 ++--
keyboards/crkbd/keymaps/like_jis/keymap.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/default/keymap.c b/keyboards/crkbd/keymaps/default/keymap.c
index c7c9582e83..1e2e57a2b4 100644
--- a/keyboards/crkbd/keymaps/default/keymap.c
+++ b/keyboards/crkbd/keymaps/default/keymap.c
@@ -52,7 +52,7 @@ enum macro_keycodes {
#define KC_LSAD RGB_SAD
#define KC_LVAI RGB_VAI
#define KC_LVAD RGB_VAD
-#define KC_LSMOD RGB_SMOD
+#define KC_LMOD RGB_MOD
#define KC_CTLTB CTL_T(KC_TAB)
#define KC_GUIEI GUI_T(KC_LANG2)
#define KC_ALTKN ALT_T(KC_LANG1)
@@ -100,7 +100,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//|------+------+------+------+------+------| |------+------+------+------+------+------|
LTOG, LHUI, LSAI, LVAI, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX,\
//|------+------+------+------+------+------| |------+------+------+------+------+------|
- LSMOD, LHUD, LSAD, LVAD, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX,\
+ LMOD, LHUD, LSAD, LVAD, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX,\
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
GUIEI, LOWER, SPC, ENT, RAISE, ALTKN \
//`--------------------' `--------------------'
diff --git a/keyboards/crkbd/keymaps/like_jis/keymap.c b/keyboards/crkbd/keymaps/like_jis/keymap.c
index 05d31845c8..42d36de449 100644
--- a/keyboards/crkbd/keymaps/like_jis/keymap.c
+++ b/keyboards/crkbd/keymaps/like_jis/keymap.c
@@ -50,7 +50,7 @@ enum custom_keycodes {
#define KC_LSAD RGB_SAD
#define KC_LVAI RGB_VAI
#define KC_LVAD RGB_VAD
-#define KC_LSMOD RGB_SMOD
+#define KC_LMOD RGB_MOD
#define KC_KNRM AG_NORM
#define KC_KSWP AG_SWAP
@@ -99,7 +99,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//|------+-------+------+------+------+-----| |------+------+------+------+------+------|
_____, LTOG, LHUI, LSAI, LVAI,XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, PGUP, XXXXX,\
//|------+-------+------+------+------+-----| |------+------+------+------+------+------|
- _____, LSMOD, LHUD, LSAD, LVAD,XXXXX, XXXXX, XXXXX, XXXXX, HOME, PGDN, END,\
+ _____, LMOD, LHUD, LSAD, LVAD,XXXXX, XXXXX, XXXXX, XXXXX, HOME, PGDN, END,\
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
_____, _____, XXXXX, _____, _____, XXXXX \
//`--------------------' `--------------------'
--
cgit v1.2.3
From fe982caf5d69fdb2d6f1dec123a630df11a98282 Mon Sep 17 00:00:00 2001
From: epaew
Date: Tue, 4 Dec 2018 01:00:00 +0900
Subject: Add edvorakjp kepmap for crkbd (#4537)
* edvorakjp layout for crkbd
* bugfix of edvorakjp
QMK cannot send keycode that doesn't exists on new layer.
---
keyboards/crkbd/keymaps/edvorakjp/config.h | 24 +++++
keyboards/crkbd/keymaps/edvorakjp/keymap.c | 158 ++++++++++++++++++++++++++++
keyboards/crkbd/keymaps/edvorakjp/oled.c | 82 +++++++++++++++
keyboards/crkbd/keymaps/edvorakjp/oled.h | 24 +++++
keyboards/crkbd/keymaps/edvorakjp/readme.md | 21 ++++
keyboards/crkbd/keymaps/edvorakjp/rules.mk | 32 ++++++
6 files changed, 341 insertions(+)
create mode 100644 keyboards/crkbd/keymaps/edvorakjp/config.h
create mode 100644 keyboards/crkbd/keymaps/edvorakjp/keymap.c
create mode 100644 keyboards/crkbd/keymaps/edvorakjp/oled.c
create mode 100644 keyboards/crkbd/keymaps/edvorakjp/oled.h
create mode 100644 keyboards/crkbd/keymaps/edvorakjp/readme.md
create mode 100644 keyboards/crkbd/keymaps/edvorakjp/rules.mk
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/edvorakjp/config.h b/keyboards/crkbd/keymaps/edvorakjp/config.h
new file mode 100644
index 0000000000..515591a429
--- /dev/null
+++ b/keyboards/crkbd/keymaps/edvorakjp/config.h
@@ -0,0 +1,24 @@
+#ifndef CONFIG_USER_H
+#define CONFIG_USER_H
+
+/* Select hand configuration */
+
+#define MASTER_LEFT
+// #define MASTER_RIGHT
+// #define EE_HANDS
+
+#define SSD1306OLED
+#define SWAP_SCLN
+
+// #define TAPPING_FORCE_HOLD
+#define TAPPING_TERM 120
+
+#undef RGBLED_NUM
+#define RGBLIGHT_EFFECT_STATIC_GRADIENT
+#define RGBLED_NUM 27
+#define RGBLIGHT_LIMIT_VAL 100
+#define RGBLIGHT_HUE_STEP 10
+#define RGBLIGHT_SAT_STEP 17
+#define RGBLIGHT_VAL_STEP 17
+
+#endif // CONFIG_USER_H
diff --git a/keyboards/crkbd/keymaps/edvorakjp/keymap.c b/keyboards/crkbd/keymaps/edvorakjp/keymap.c
new file mode 100644
index 0000000000..ae2f710a03
--- /dev/null
+++ b/keyboards/crkbd/keymaps/edvorakjp/keymap.c
@@ -0,0 +1,158 @@
+#include QMK_KEYBOARD_H
+#ifdef PROTOCOL_LUFA
+ #include "split_util.h"
+#endif
+#ifdef SSD1306OLED
+ #include "oled.h"
+#endif
+
+#include "edvorakjp.h"
+
+/*
+ * enum custom_keycodes {
+ * KC_LOCK = NEW_SAFE_RANGE,
+ * };
+ */
+
+#define KC_ KC_TRNS
+
+#define KC_TMB1 LGUI_T(KC_TAB)
+#define KC_TMB2 LSFT_T(KC_SPC)
+#define KC_TMB3 TD(TD_LOWER) // act as LOWER when hold, as KC_LANG2(=English) when tapped
+#define KC_TMB4 TD(TD_RAISE) // act as RAISE when hold, as KC_LANG1(=Japanese) when tapped
+#define KC_TMB5 RCTL_T(KC_BSPC)
+#define KC_TMB6 RALT_T(KC_ENT)
+#define KC_TMB7 KC_DEL
+#define KC_TMB8 RALT(KC_ENT)
+#define KC_TMB9 LGUI(KC_TAB)
+
+#define KC_RST RESET
+#define KC_DBUG DEBUG
+#define KC_RTOG RGB_TOG
+#define KC_EDJP EDVORAK
+#define KC_QWER QWERTY
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ [_EDVORAK] = LAYOUT_kc(
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ ESC ,QUOT,COMM,DOT , Y , P , F , G , R , W , Q ,BSLS,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ EQL , A , O , E , I , U , D , T , N , S , M ,MINS,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ GRV ,SCLN, X , C , V , Z , B , H , J , K , L ,SLSH,
+ //`----+----+----+----+----+----+----| |----+----+----+----+----+----+----'
+ TMB1,TMB2,TMB3, TMB4,TMB5,TMB6
+ // `----+----+----' `----+----+----'
+ ),
+
+ [_EDVORAKJ1] = LAYOUT_kc(
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ , AI , OU , EI , , , , , , , , ,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ , , , , , , , , , Y , , ,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ ,ANN ,ONN ,ENN ,INN ,UNN , , , , , , ,
+ //`----+----+----+----+----+----+----| |----+----+----+----+----+----+----'
+ , , , , ,
+ // `----+----+----' `----+----+----'
+ ),
+
+ [_EDVORAKJ2] = LAYOUT_kc(
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ , AI , OU , EI , , , , , , , , ,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ , , , , , , , Y , , , , ,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ ,ANN ,ONN ,ENN ,INN ,UNN , , , , , , ,
+ //`----+----+----+----+----+----+----| |----+----+----+----+----+----+----'
+ , , , , ,
+ // `----+----+----' `----+----+----'
+ ),
+
+ [_QWERTY] = LAYOUT_kc(
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ EQL , A , S , D , F , G , H , J , K , L ,SCLN,QUOT,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ GRV , Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,BSLS,
+ //`----+----+----+----+----+----+----| |----+----+----+----+----+----+----'
+ , , , , ,
+ // `----+----+----' `----+----+----'
+ ),
+
+ [_LOWER] = LAYOUT_kc(
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ , , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , , ,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ , 1 ,EXLM, AT ,HASH,DLR , PERC,CIRC,AMPR,ASTR, 0 , ,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ , , LT ,LCBR,LPRN,LBRC, RBRC,RPRN,RCBR, GT , , ,
+ //`----+----+----+----+----+----+----| |----+----+----+----+----+----+----'
+ , , , ,TMB7,TMB8
+ // `----+----+----' `----+----+----'
+ ),
+
+ [_RAISE] = LAYOUT_kc(
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 , ,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ ,F11 ,F12 ,PSCR,SLCK,PAUS, ,HOME,PGDN,PGUP,END , ,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ , , , , , , ,LEFT,DOWN, UP ,RGHT, ,
+ //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----'
+ TMB9, , , , ,
+ // `----+----+----' `----+----+----'
+ ),
+
+ [_ADJUST] = LAYOUT_kc(
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ , , , ,EXTOFF, , ,EXTON, , , , ,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ , , ,QWER,WIN ,RST , RTOG,MAC ,EDJP, , , ,
+ //|----+----+----+----+----+----| |----+----+----+----+----+----|
+ , , , , , , , , , , , ,
+ //`----+----+----+----+----+----+----| |----+----+----+----+----+----+----'
+ , , , , ,
+ // `----+----+----' `----+----+----'
+ )
+};
+
+#ifdef SSD1306OLED
+void matrix_init_keymap(void) {
+ //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
+ iota_gfx_init(!has_usb()); // turns on the display
+}
+
+void matrix_scan_user(void) {
+ iota_gfx_task(); // this is what updates the display continuously
+}
+#endif
+
+#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT
+uint32_t layer_state_set_keymap(uint32_t state) {
+ rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
+ switch (biton32(state)) {
+ case _EDVORAKJ1:
+ case _EDVORAKJ2:
+ // _EDVORAKJ1 & J2 are same colored
+ rgblight_sethsv_noeeprom_white();
+ break;
+ case _LOWER:
+ rgblight_sethsv_noeeprom_red();
+ break;
+ case _RAISE:
+ rgblight_sethsv_noeeprom_blue();
+ break;
+ case _ADJUST:
+ rgblight_sethsv_noeeprom_green();
+ break;
+ default: // for any other layers, or the default layer
+ rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_GRADIENT + 3);
+ rgblight_sethsv_noeeprom_red();
+ break;
+ }
+ return state;
+}
+#endif
diff --git a/keyboards/crkbd/keymaps/edvorakjp/oled.c b/keyboards/crkbd/keymaps/edvorakjp/oled.c
new file mode 100644
index 0000000000..e4cccf3e7f
--- /dev/null
+++ b/keyboards/crkbd/keymaps/edvorakjp/oled.c
@@ -0,0 +1,82 @@
+#include
+#include "oled.h"
+
+// NOTE: Redefined to avoid to use snprintf(); It makes size of firmware big.
+const char *read_mode_icon(bool windows_mode) {
+ static const char logo[][2][3] = {{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}};
+ static char mode_icon[10];
+
+ int mode_number = windows_mode ? 1 : 0;
+ strcpy(mode_icon, logo[mode_number][0]);
+
+ strcat(mode_icon, "\n");
+ strcat(mode_icon, logo[mode_number][1]);
+
+ return mode_icon;
+}
+
+const char *read_layer_state(void) {
+ static char layer_state_str[24];
+ char layer_name[17];
+
+ switch (biton32(layer_state)) {
+ case L_BASE:
+ strcpy(layer_name, default_layer_state == 1UL<<_EDVORAK ? "EDVORAK" : "QWERTY");
+ break;
+ case _EDVORAKJ1:
+ case _EDVORAKJ2:
+ strcpy(layer_name, "JP_EXT");
+ break;
+ case _RAISE:
+ strcpy(layer_name, "Raise");
+ break;
+ case _LOWER:
+ strcpy(layer_name, "Lower");
+ break;
+ case _ADJUST:
+ strcpy(layer_name, "Adjust");
+ break;
+ default:
+ snprintf(layer_name, sizeof(layer_name), "Undef-%ld", layer_state);
+ }
+
+ strcpy(layer_state_str, "Layer: ");
+
+ strcat(layer_state_str, layer_name);
+ strcat(layer_state_str, "\n");
+ return layer_state_str;
+}
+
+const char *read_host_led_state(void) {
+ static char led_str[24];
+ bool ext_status = get_enable_jp_extra_layer() && get_japanese_mode();
+ strcpy(led_str, ext_status ? "EXT" : " ");
+
+ strcat(led_str, (host_keyboard_leds() & (1<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);
+ if (is_master) {
+ matrix_write(&matrix, read_mode_icon(!get_enable_kc_lang()));
+ matrix_write(&matrix, " ");
+ matrix_write(&matrix, read_layer_state());
+ matrix_write(&matrix, read_host_led_state());
+ } else {
+ matrix_write(&matrix, read_logo());
+ }
+ matrix_update(&display, &matrix);
+}
diff --git a/keyboards/crkbd/keymaps/edvorakjp/oled.h b/keyboards/crkbd/keymaps/edvorakjp/oled.h
new file mode 100644
index 0000000000..896347aea9
--- /dev/null
+++ b/keyboards/crkbd/keymaps/edvorakjp/oled.h
@@ -0,0 +1,24 @@
+#ifndef OLED_USER_H
+#define OLED_USER_H
+
+//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
+#include "ssd1306.h"
+#include "edvorakjp.h"
+
+//assign the right code to your layers for OLED display
+#define L_BASE 0
+
+extern uint8_t is_master;
+extern bool japanese_mode;
+
+// method prototypes defined in crkbd/lib
+extern const char *read_logo(void);
+
+const char *read_mode_icon(bool swap);
+const char *read_layer_state(void);
+const char *read_host_led_state(void);
+void matrix_update(struct CharacterMatrix *dest,
+ const struct CharacterMatrix *source);
+void iota_gfx_task_user(void);
+
+#endif // OLED_CONFIG_USER_H
diff --git a/keyboards/crkbd/keymaps/edvorakjp/readme.md b/keyboards/crkbd/keymaps/edvorakjp/readme.md
new file mode 100644
index 0000000000..dd406523d2
--- /dev/null
+++ b/keyboards/crkbd/keymaps/edvorakjp/readme.md
@@ -0,0 +1,21 @@
+# edvorakjp
+
+Epaew's Enhanced Dvorak layout for Japanese Programmer
+see [here](/users/edvorakjp) for more informations.
+
+## License
+
+Copyright 2018 Ryo Maeda epaew.333@gmail.com @epaew
+
+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 .
diff --git a/keyboards/crkbd/keymaps/edvorakjp/rules.mk b/keyboards/crkbd/keymaps/edvorakjp/rules.mk
new file mode 100644
index 0000000000..b4f6d2f1f1
--- /dev/null
+++ b/keyboards/crkbd/keymaps/edvorakjp/rules.mk
@@ -0,0 +1,32 @@
+# 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
+#
+BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
+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
+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 = yes # Enable WS2812 RGB underlight.
+SWAP_HANDS_ENABLE = no # Enable one-hand typing
+TAP_DANCE_ENABLE = yes
+
+# 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/glcdfont.c \
+ ./lib/logo_reader.c \
+ oled.c \
+ # ./lib/rgb_state_reader.c \
+ # ./lib/layer_state_reader.c \
+ # ./lib/keylogger.c \
+ # ./lib/mode_icon_reader.c \
+ # ./lib/host_led_state_reader.c \
+ # ./lib/timelogger.c \
--
cgit v1.2.3
From 11eaccdbce5246e7235ff91d0d04de83f7685919 Mon Sep 17 00:00:00 2001
From: marksard <38324387+marksard@users.noreply.github.com>
Date: Sun, 9 Dec 2018 02:43:57 +0900
Subject: Keymap: Modified like-jis keymap for crkbd (#4577)
---
keyboards/crkbd/keymaps/like_jis/config.h | 2 +-
keyboards/crkbd/keymaps/like_jis/keymap.c | 303 ++++++++++++++-----------
keyboards/crkbd/keymaps/like_jis/oled_helper.c | 83 +++++++
keyboards/crkbd/keymaps/like_jis/oled_helper.h | 35 +++
keyboards/crkbd/keymaps/like_jis/rules.mk | 17 +-
5 files changed, 304 insertions(+), 136 deletions(-)
create mode 100644 keyboards/crkbd/keymaps/like_jis/oled_helper.c
create mode 100644 keyboards/crkbd/keymaps/like_jis/oled_helper.h
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/like_jis/config.h b/keyboards/crkbd/keymaps/like_jis/config.h
index 0e2960a937..a061b4fb09 100644
--- a/keyboards/crkbd/keymaps/like_jis/config.h
+++ b/keyboards/crkbd/keymaps/like_jis/config.h
@@ -34,7 +34,7 @@ along with this program. If not, see .
#define PREVENT_STUCK_MODIFIERS
#define TAPPING_FORCE_HOLD
-#define TAPPING_TERM 150
+#define TAPPING_TERM 250
#undef RGBLED_NUM
#define RGBLIGHT_ANIMATIONS
diff --git a/keyboards/crkbd/keymaps/like_jis/keymap.c b/keyboards/crkbd/keymaps/like_jis/keymap.c
index 42d36de449..b1b6c64b1e 100644
--- a/keyboards/crkbd/keymaps/like_jis/keymap.c
+++ b/keyboards/crkbd/keymaps/like_jis/keymap.c
@@ -7,6 +7,7 @@
#ifdef SSD1306OLED
#include "ssd1306.h"
#endif
+#include "oled_helper.h"
extern keymap_config_t keymap_config;
@@ -21,27 +22,35 @@ extern uint8_t is_master;
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
-#define _QWERTY 0
-#define _LOWER 3
-#define _RAISE 4
-#define _ADJUST 16
+enum layer_number {
+ _BASE = 0,
+ _LOWER,
+ _RAISE,
+ _ADJUST,
+};
enum custom_keycodes {
LOWER = SAFE_RANGE,
RAISE,
ADJUST,
+ KANJI,
RGBRST
};
-#define KC______ KC_TRNS
-#define KC_XXXXX KC_NO
-#define KC_KANJI KC_GRV
+enum tapdances{
+ TD_CODO = 0,
+ // TD_MNUB,
+};
+// Layer Mode aliases
#define KC_LOWER LOWER
#define KC_RAISE RAISE
-#define KC_RST RESET
+#define KC______ KC_TRNS
+#define KC_XXXXX KC_NO
+#define KC_KANJI KANJI
+#define KC_RST RESET
#define KC_LRST RGBRST
#define KC_LTOG RGB_TOG
#define KC_LHUI RGB_HUI
@@ -51,31 +60,41 @@ enum custom_keycodes {
#define KC_LVAI RGB_VAI
#define KC_LVAD RGB_VAD
#define KC_LMOD RGB_MOD
-
#define KC_KNRM AG_NORM
#define KC_KSWP AG_SWAP
-#define KC_GUAP LALT_T(KC_APP)
+
+#define KC_TBSF LSFT_T(KC_TAB)
+// #define KC_SPSF LSFT_T(KC_SPC)
+#define KC_ALAP LALT_T(KC_APP)
+
+#define KC_CODO TD(TD_CODO)
+// #define KC_MNUB TD(TD_MNUB)
+
+qk_tap_dance_action_t tap_dance_actions[] = {
+ [TD_CODO] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_DOT),
+ // [TD_MNUB] = ACTION_TAP_DANCE_DOUBLE(KC_MINS, LSFT(KC_RO)),
+};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [_QWERTY] = LAYOUT_kc( \
+ [_BASE] = LAYOUT_kc( \
//,-----------------------------------------. ,-----------------------------------------.
ESC, Q, W, E, R, T, Y, U, I, O, P, MINS,\
//|------+------+------+------+------+------| |------+------+------+------+------+------|
- LSFT, A, S, D, F, G, H, J, K, L, UP, ENT,\
+ TBSF, A, S, D, F, G, H, J, K, L, UP, ENT,\
//|------+------+------+------+------+------| |------+------+------+------+------+------|
- LCTRL, Z, X, C, V, B, N, M, COMM, LEFT, DOWN, RGHT,\
+ LCTRL, Z, X, C, V, B, N, M, CODO, LEFT, DOWN, RGHT,\
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
- LGUI, LOWER, BSPC, SPC, RAISE, GUAP \
+ LGUI, LOWER, BSPC, SPC, RAISE, ALAP \
//`--------------------' `--------------------'
),
[_LOWER] = LAYOUT_kc( \
//,-----------------------------------------. ,-----------------------------------------.
- TAB, F1, F2, F3, F4, F5, XXXXX, MINS, EQL, JYEN, LBRC, RBRC,\
+ _____, F1, F2, F3, F4, F5, XXXXX, MINS, EQL, JYEN, LBRC, RBRC,\
//|------+------+------+------+------+------| |------+------+------+------+------+------|
_____, F6, F7, F8, F9, F10, XXXXX, XXXXX, XXXXX, SCLN, QUOT, BSLS,\
//|------+------+------+------+------+------| |------+------+------+------+------+------|
- _____, F11, F12, XXXXX, KANJI, ENT, XXXXX, XXXXX, COMM, DOT, SLSH, RO,\
+ _____, F11, F12, TAB, KANJI, ENT, XXXXX, XXXXX, COMM, DOT, SLSH, RO,\
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
_____, _____, DEL, _____, _____, APP \
//`--------------------' `--------------------'
@@ -83,11 +102,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_RAISE] = LAYOUT_kc( \
//,-----------------------------------------. ,-----------------------------------------.
- _____, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, XXXXX,\
+ _____, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, PSLS,\
//|------+------+------+------+------+------| |------+------+------+------+------+------|
- _____, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, 4, 5, 6, QUOT, XXXXX,\
+ _____, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, QUOT, 4, 5, 6, PPLS, PAST,\
//|------+------+------+------+------+------| |------+------+------+------+------+------|
- _____, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, 0, 1, 2, 3, DOT, XXXXX,\
+ _____, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, 0, 1, 2, 3, DOT, PMNS,\
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
_____, _____, BSPC, _____, _____, LALT \
//`--------------------' `--------------------'
@@ -95,152 +114,182 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_ADJUST] = LAYOUT_kc( \
//,-----------------------------------------. ,-----------------------------------------.
- _____, RST, LRST, KNRM, KSWP,XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX,\
+ _____, RST, LRST, KNRM, KSWP, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX,\
//|------+-------+------+------+------+-----| |------+------+------+------+------+------|
- _____, LTOG, LHUI, LSAI, LVAI,XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, PGUP, XXXXX,\
+ _____, LTOG, LHUI, LSAI, LVAI, XXXXX, XXXXX, XXXXX, XXXXX, XXXXX, PGUP, XXXXX,\
//|------+-------+------+------+------+-----| |------+------+------+------+------+------|
- _____, LMOD, LHUD, LSAD, LVAD,XXXXX, XXXXX, XXXXX, XXXXX, HOME, PGDN, END,\
+ _____, LMOD, LHUD, LSAD, LVAD, XXXXX, XXXXX, XXXXX, XXXXX, HOME, PGDN, END,\
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
_____, _____, XXXXX, _____, _____, XXXXX \
//`--------------------' `--------------------'
)
};
-int RGB_current_mode;
+#define L_BASE _BASE
+#define L_LOWER (1<<_LOWER)
+#define L_RAISE (1<<_RAISE)
+#define L_ADJUST (1<<_ADJUST)
+#define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER)
-// Setting ADJUST layer RGB back to default
-static inline 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);
+#ifdef SSD1306OLED
+typedef struct {
+ uint8_t state;
+ char name[8];
+}LAYER_DISPLAY_NAME;
+
+#define LAYER_DISPLAY_MAX 5
+const LAYER_DISPLAY_NAME layer_display_name[LAYER_DISPLAY_MAX] = {
+ {L_BASE, "Base"},
+ {L_BASE + 1, "Base"},
+ {L_LOWER, "Lower"},
+ {L_RAISE, "Raise"},
+ {L_ADJUST_TRI, "Adjust"}
+};
+
+static inline const char* get_leyer_status(void) {
+
+ for (uint8_t i = 0; i < LAYER_DISPLAY_MAX; ++i) {
+ if (layer_state == 0 && layer_display_name[i].state == default_layer_state) {
+
+ return layer_display_name[i].name;
+ } else if (layer_state != 0 && layer_display_name[i].state == layer_state) {
+
+ return layer_display_name[i].name;
+ }
}
-}
-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
+ return "?";
}
-//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
-#ifdef SSD1306OLED
+static char layer_status_buf[24] = "Layer state ready.\n";
+static inline void update_keymap_status(void) {
+ snprintf(layer_status_buf, sizeof(layer_status_buf) - 1, "OS:%s Layer:%s\n",
+ keymap_config.swap_lalt_lgui? "win" : "mac", get_leyer_status());
+}
-// 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);
+static inline void render_keymap_status(struct CharacterMatrix *matrix) {
-// const char *read_mode_icon(bool swap);
-// const char *read_host_led_state(void);
-// void set_timelog(void);
-// const char *read_timelog(void);
+ matrix_write(matrix, layer_status_buf);
+}
+
+#define UPDATE_KEYMAP_STATUS() update_keymap_status()
+#define RENDER_KEYMAP_STATUS(a) render_keymap_status(a)
-#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)
+
+#define UPDATE_KEYMAP_STATUS()
+#define RENDER_KEYMAP_STATUS(a)
+
#endif
+static inline void update_change_layer(bool pressed, uint8_t layer1, uint8_t layer2, uint8_t layer3) {
-void matrix_scan_user(void) {
- iota_gfx_task();
+ pressed ? layer_on(layer1) : layer_off(layer1);
+ IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2) ? layer_on(layer3) : layer_off(layer3);
}
-static 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());
- 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());
+int RGB_current_mode;
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+
+ UPDATE_KEY_STATUS(keycode, record);
+
+ bool result = false;
+ switch (keycode) {
+ case LOWER:
+ update_change_layer(record->event.pressed, _LOWER, _RAISE, _ADJUST);
+ break;
+ case RAISE:
+ update_change_layer(record->event.pressed, _RAISE, _LOWER, _ADJUST);
+ break;
+ case KANJI:
+ if (record->event.pressed) {
+ if (keymap_config.swap_lalt_lgui == false) {
+ register_code(KC_LANG2);
+ } else {
+ SEND_STRING(SS_LALT("`"));
+ }
+ } else {
+ unregister_code(KC_LANG2);
+ }
+ break;
+ #ifdef RGBLIGHT_ENABLE
+ case RGB_MOD:
+ if (record->event.pressed) {
+ rgblight_mode(RGB_current_mode);
+ rgblight_step();
+ RGB_current_mode = rgblight_config.mode;
+ }
+ break;
+ case RGBRST:
+ if (record->event.pressed) {
+ eeconfig_update_rgblight_default();
+ rgblight_enable();
+ RGB_current_mode = rgblight_config.mode;
+ }
+ break;
+ #endif
+ default:
+ result = true;
+ break;
}
+
+ UPDATE_KEYMAP_STATUS();
+ return result;
+}
+
+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
+
+void matrix_scan_user(void) {
+ iota_gfx_task(); // this is what updates the display continuously
}
-static inline void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
+static inline 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);
+static inline void render_status(struct CharacterMatrix *matrix) {
+
+ UPDATE_LED_STATUS();
+ RENDER_LED_STATUS(matrix);
+ RENDER_KEYMAP_STATUS(matrix);
+ UPDATE_LOCK_STATUS();
+ RENDER_LOCK_STATUS(matrix);
+ RENDER_KEY_STATUS(matrix);
}
-#endif
+void iota_gfx_task_user(void) {
+ struct CharacterMatrix matrix;
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- #ifdef SSD1306OLED
- if (record->event.pressed) {
- set_keylog(keycode, record);
- // set_timelog();
+ #if DEBUG_TO_SCREEN
+ if (debug_enable) {
+ return;
}
#endif
- switch (keycode) {
- case LOWER:
- if (record->event.pressed) {
- layer_on(_LOWER);
- update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
- } else {
- layer_off(_LOWER);
- update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
- }
- break;
- case RAISE:
- if (record->event.pressed) {
- layer_on(_RAISE);
- update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
- } else {
- layer_off(_RAISE);
- update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
- }
- break;
- case ADJUST:
- if (record->event.pressed) {
- layer_on(_ADJUST);
- } else {
- layer_off(_ADJUST);
- }
- break;
-
- #ifdef RGBLIGHT_ENABLE
- case RGB_MOD:
- if (record->event.pressed) {
- rgblight_mode(RGB_current_mode);
- rgblight_step();
- RGB_current_mode = rgblight_config.mode;
- }
- break;
- case RGBRST:
- if (record->event.pressed) {
- eeconfig_update_rgblight_default();
- rgblight_enable();
- RGB_current_mode = rgblight_config.mode;
- }
- break;
- #endif
- default:
- return true;
+ matrix_clear(&matrix);
+ if (is_master) {
+ render_status(&matrix);
+ } else {
+ RENDER_LOGO(&matrix);
}
- return false;
+ matrix_update(&display, &matrix);
}
+
+#endif
diff --git a/keyboards/crkbd/keymaps/like_jis/oled_helper.c b/keyboards/crkbd/keymaps/like_jis/oled_helper.c
new file mode 100644
index 0000000000..500d3c0dc1
--- /dev/null
+++ b/keyboards/crkbd/keymaps/like_jis/oled_helper.c
@@ -0,0 +1,83 @@
+#ifdef SSD1306OLED
+#include QMK_KEYBOARD_H
+#include "ssd1306.h"
+
+void render_logo(struct CharacterMatrix *matrix) {
+
+ const char logo_buf[]={
+ 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
+ 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
+ 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
+ 0};
+
+ matrix_write(matrix, logo_buf);
+}
+
+static char keylog_buf[24] = "Key state ready.";
+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 update_key_status(uint16_t keycode, keyrecord_t *record) {
+
+ if (!record->event.pressed) return;
+
+ char name = (keycode < 60) ? code_to_name[keycode] : ' ';
+ snprintf(keylog_buf, sizeof(keylog_buf) - 1, "Key:%dx%d %2x %c",
+ record->event.key.row, record->event.key.col,
+ (uint16_t)keycode, name);
+}
+
+void render_key_status(struct CharacterMatrix *matrix) {
+
+ matrix_write(matrix, keylog_buf);
+}
+
+static char lock_buf[24] = "Lock state ready.\n";
+void update_lock_status(void) {
+
+ uint8_t leds = host_keyboard_leds();
+ char *num_lock = (leds & (1<
Date: Mon, 31 Dec 2018 14:29:56 -0800
Subject: Keymap: Update for Drashna code - Proton C Prep Edition (#4708)
* Make CRKBD keylogger output actually show tap keys
* check MT/LT for twinkling
* Add ortho 5x12 support for fractal keyboard
* Use newer interface for setting pins/ports
* Remove custom unicode methods
* Reomve unicode input info
* Odd rules issue
* Redefine REST note to be more pleasing
* Properly disable PM LEDs with GPIO commands
* Update gitlab CI yaml file
* Remove extra mod tap check
* Remove initial state on ergodox glow
* Rev6 Cleanup
* Fix KC_MAKE macro
* Update GitLab CI yaml file
* More GitLab CI changes
* One final GitLab CI change
* Remove unneeded unicode support
* Optimize KC_MAKE
---
keyboards/crkbd/keymaps/drashna/keymap.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
(limited to 'keyboards/crkbd')
diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/keyboards/crkbd/keymaps/drashna/keymap.c
index 282ee25725..678fd33b57 100644
--- a/keyboards/crkbd/keymaps/drashna/keymap.c
+++ b/keyboards/crkbd/keymaps/drashna/keymap.c
@@ -88,16 +88,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
void matrix_init_keymap(void) {
- //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
- #ifdef SSD1306OLED
- iota_gfx_init(!has_usb()); // turns on the display
- #endif
-
- DDRD &= ~(1<<5);
- PORTD &= ~(1<<5);
-
- DDRB &= ~(1<<0);
- PORTB &= ~(1<<0);
+ //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
+ #ifdef SSD1306OLED
+ iota_gfx_init(!has_usb()); // turns on the display
+ #endif
+
+ #ifndef CONVERT_TO_PROTON_C
+ setPinOutput(D5);
+ writePinHigh(D5);
+
+ setPinOutput(B0);
+ writePinHigh(B0);
+ #endif
}
//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
@@ -126,10 +128,10 @@ const char code_to_name[60] = {
void set_keylog(uint16_t keycode, keyrecord_t *record) {
char name = ' ';
+ if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { keycode = keycode & 0xFF; }
if (keycode < 60) {
name = code_to_name[keycode];
}
-
// update keylog
snprintf(keylog_str, sizeof(keylog_str), "%dx%d, k%2d : %c",
record->event.key.row, record->event.key.col,
--
cgit v1.2.3