summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--keyboards/40percentclub/nano/keymaps/drashna/keymap.c20
-rw-r--r--keyboards/40percentclub/nano/keymaps/drashna/rules.mk2
-rw-r--r--keyboards/crkbd/keymaps/drashna/keymap.c177
-rw-r--r--keyboards/kyria/keymaps/drashna/config.h2
-rw-r--r--keyboards/kyria/keymaps/drashna/keymap.c208
-rw-r--r--keyboards/kyria/keymaps/drashna/rules.mk2
-rw-r--r--layouts/community/ergodox/drashna/config.h2
-rw-r--r--layouts/community/ergodox/drashna/rules.mk7
-rw-r--r--layouts/community/ortho_4x12/drashna/config.h2
-rw-r--r--layouts/community/ortho_4x12/drashna/rules.mk2
-rw-r--r--users/drashna/config.h3
-rw-r--r--users/drashna/drashna.c35
-rw-r--r--users/drashna/drashna.h9
-rw-r--r--users/drashna/oled_stuff.c278
-rw-r--r--users/drashna/oled_stuff.h91
-rw-r--r--users/drashna/process_records.c359
-rw-r--r--users/drashna/process_records.h18
-rw-r--r--users/drashna/rgb_matrix_stuff.c86
-rw-r--r--users/drashna/rgb_matrix_stuff.h9
-rw-r--r--users/drashna/rgb_stuff.c404
-rw-r--r--users/drashna/rgb_stuff.h26
-rw-r--r--users/drashna/rules.mk13
22 files changed, 888 insertions, 867 deletions
diff --git a/keyboards/40percentclub/nano/keymaps/drashna/keymap.c b/keyboards/40percentclub/nano/keymaps/drashna/keymap.c
index 668178967b..998e55d5b2 100644
--- a/keyboards/40percentclub/nano/keymaps/drashna/keymap.c
+++ b/keyboards/40percentclub/nano/keymaps/drashna/keymap.c
@@ -1,5 +1,5 @@
#include "drashna.h"
-#include "analog.c"
+#include "analog.h"
#include "pointing_device.h"
#include "pincontrol.h"
@@ -17,8 +17,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Joystick
// Set Pins
-uint8_t xPin = 8; // VRx / /B4
-uint8_t yPin = 7; // VRy // B5
+// uint8_t xPin = 8; // VRx / /B4
+// uint8_t yPin = 7; // VRy // B5
uint8_t swPin = E6; // SW
// Set Parameters
@@ -43,7 +43,7 @@ int16_t axisCoordinate(uint8_t pin, uint16_t origin) {
int16_t distanceFromOrigin;
int16_t range;
- int16_t position = analogRead(pin);
+ int16_t position = analogReadPin(pin);
if (origin == position) {
return 0;
@@ -88,11 +88,11 @@ void pointing_device_task(void) {
// todo read as one vector
if (timer_elapsed(lastCursor) > cursorTimeout) {
lastCursor = timer_read();
- report.x = axisToMouseComponent(xPin, xOrigin, maxCursorSpeed, xPolarity);
- report.y = axisToMouseComponent(yPin, yOrigin, maxCursorSpeed, yPolarity);
+ report.x = axisToMouseComponent(B4, xOrigin, maxCursorSpeed, xPolarity);
+ report.y = axisToMouseComponent(B5, yOrigin, maxCursorSpeed, yPolarity);
}
//
- if (!readPin(swPin)) {
+ if (!readPin(E6)) {
report.buttons |= MOUSE_BTN1;
} else {
report.buttons &= ~MOUSE_BTN1;
@@ -104,8 +104,8 @@ void pointing_device_task(void) {
void matrix_init_keymap(void) {
// init pin? Is needed?
- setPinInputHigh(swPin);
+ setPinInputHigh(E6);
// Account for drift
- xOrigin = analogRead(xPin);
- yOrigin = analogRead(yPin);
+ xOrigin = analogReadPin(B4);
+ yOrigin = analogReadPin(B5);
}
diff --git a/keyboards/40percentclub/nano/keymaps/drashna/rules.mk b/keyboards/40percentclub/nano/keymaps/drashna/rules.mk
index 06110a0a2e..2b72a112b0 100644
--- a/keyboards/40percentclub/nano/keymaps/drashna/rules.mk
+++ b/keyboards/40percentclub/nano/keymaps/drashna/rules.mk
@@ -3,3 +3,5 @@ RGBLIGHT_ENABLE = no
CONSOLE_ENABLE = no
BOOTLOADER = qmk-dfu
+
+SRC += analog.c
diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/keyboards/crkbd/keymaps/drashna/keymap.c
index 9a1beeb74b..55d51eb08a 100644
--- a/keyboards/crkbd/keymaps/drashna/keymap.c
+++ b/keyboards/crkbd/keymaps/drashna/keymap.c
@@ -6,34 +6,6 @@ extern uint8_t is_master;
// Following line allows macro to read current RGB settings
extern rgblight_config_t rgblight_config;
#endif
-#ifdef OLED_DRIVER_ENABLE
-# define KEYLOGGER_LENGTH 5
-static uint32_t oled_timer = 0;
-static char keylog_str[KEYLOGGER_LENGTH + 1] = {"\n"};
-static uint16_t log_timer = 0;
-// clang-format off
-static const char PROGMEM code_to_name[0xFF] = {
-// 0 1 2 3 4 5 6 7 8 9 A B c D E F
- ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', // 0x
- 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', // 1x
- '3', '4', '5', '6', '7', '8', '9', '0', 20, 19, 27, 26, 22, '-', '=', '[', // 2x
- ']','\\', '#', ';','\'', '`', ',', '.', '/', 128, ' ', ' ', ' ', ' ', ' ', ' ', // 3x
- ' ', ' ', ' ', ' ', ' ', ' ', 'P', 'S', ' ', ' ', ' ', ' ', 16, ' ', ' ', ' ', // 4x
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 5x
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 6x
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 7x
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 8x
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 9x
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ax
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Bx
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Cx
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Dx
- 'C', 'S', 'A', 'C', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ex
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' // Fx
-};
-
-void add_keylog(uint16_t keycode);
-#endif
enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE };
@@ -139,10 +111,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
-#ifdef OLED_DRIVER_ENABLE
- oled_timer = timer_read32();
- add_keylog(keycode);
-#endif
#ifndef SPLIT_KEYBOARD
if (keycode == RESET && !is_master) {
return false;
@@ -154,151 +122,6 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
#ifdef OLED_DRIVER_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_270; }
-
-void add_keylog(uint16_t keycode) {
- if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) || (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) {
- keycode = keycode & 0xFF;
- } else if (keycode > 0xFF) {
- keycode = 0;
- }
-
- for (uint8_t i = (KEYLOGGER_LENGTH - 1); i > 0; --i) {
- keylog_str[i] = keylog_str[i - 1];
- }
-
- if (keycode < (sizeof(code_to_name) / sizeof(char))) {
- keylog_str[0] = pgm_read_byte(&code_to_name[keycode]);
- }
-
- log_timer = timer_read();
-}
-
-void update_log(void) {
- if (timer_elapsed(log_timer) > 750) {
- // add_keylog(0);
- }
-}
-
-void render_keylogger_status(void) {
- oled_write_P(PSTR("KLogr"), false);
- oled_write(keylog_str, false);
-}
-
-void render_default_layer_state(void) {
- oled_write_P(PSTR("Lyout"), false);
- switch (get_highest_layer(default_layer_state)) {
- case _QWERTY:
- oled_write_P(PSTR(" QRTY"), false);
- break;
- case _COLEMAK:
- oled_write_P(PSTR(" COLE"), false);
- break;
- case _DVORAK:
- oled_write_P(PSTR(" DVRK"), false);
- break;
- case _WORKMAN:
- oled_write_P(PSTR(" WKMN"), false);
- break;
- case _NORMAN:
- oled_write_P(PSTR(" NORM"), false);
- break;
- case _MALTRON:
- oled_write_P(PSTR(" MLTN"), false);
- break;
- case _EUCALYN:
- oled_write_P(PSTR(" ECLN"), false);
- break;
- case _CARPLAX:
- oled_write_P(PSTR(" CRPX"), false);
- break;
- }
-}
-
-void render_layer_state(void) {
- oled_write_P(PSTR("LAYER"), false);
- oled_write_P(PSTR("Lower"), layer_state_is(_LOWER));
- oled_write_P(PSTR("Raise"), layer_state_is(_RAISE));
- oled_write_P(PSTR(" Mods"), layer_state_is(_MODS));
-}
-
-void render_keylock_status(uint8_t led_usb_state) {
- oled_write_P(PSTR("Lock:"), false);
- oled_write_P(PSTR(" "), false);
- oled_write_P(PSTR("N"), led_usb_state & (1 << USB_LED_NUM_LOCK));
- oled_write_P(PSTR("C"), led_usb_state & (1 << USB_LED_CAPS_LOCK));
- oled_write_ln_P(PSTR("S"), led_usb_state & (1 << USB_LED_SCROLL_LOCK));
-}
-
-void render_mod_status(uint8_t modifiers) {
- oled_write_P(PSTR("Mods:"), false);
- oled_write_P(PSTR(" "), false);
- oled_write_P(PSTR("S"), (modifiers & MOD_MASK_SHIFT));
- oled_write_P(PSTR("C"), (modifiers & MOD_MASK_CTRL));
- oled_write_P(PSTR("A"), (modifiers & MOD_MASK_ALT));
- oled_write_P(PSTR("G"), (modifiers & MOD_MASK_GUI));
-}
-
-void render_bootmagic_status(void) {
- /* Show Ctrl-Gui Swap options */
- static const char PROGMEM logo[][2][3] = {
- {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
- {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
- };
- oled_write_P(PSTR("BTMGK"), false);
- oled_write_P(PSTR(" "), false);
- oled_write_P(logo[0][0], !keymap_config.swap_lctl_lgui);
- oled_write_P(logo[1][0], keymap_config.swap_lctl_lgui);
- oled_write_P(PSTR(" "), false);
- oled_write_P(logo[0][1], !keymap_config.swap_lctl_lgui);
- oled_write_P(logo[1][1], keymap_config.swap_lctl_lgui);
- oled_write_P(PSTR(" NKRO"), keymap_config.nkro);
-}
-
-void render_user_status(void) {
- oled_write_P(PSTR("USER:"), false);
- oled_write_P(PSTR(" Anim"), userspace_config.rgb_matrix_idle_anim);
- oled_write_P(PSTR(" Layr"), userspace_config.rgb_layer_change);
- oled_write_P(PSTR(" Nuke"), userspace_config.nuke_switch);
-}
-
-void render_status_main(void) {
- /* Show Keyboard Layout */
- render_default_layer_state();
- render_keylock_status(host_keyboard_leds());
- render_bootmagic_status();
- render_user_status();
-
- render_keylogger_status();
-}
-
-void render_status_secondary(void) {
- /* Show Keyboard Layout */
- render_default_layer_state();
- render_layer_state();
- render_mod_status(get_mods() | get_oneshot_mods());
-
- render_keylogger_status();
-}
-
-void oled_task_user(void) {
- if (timer_elapsed32(oled_timer) > 30000) {
- oled_off();
- return;
- }
-# ifndef SPLIT_KEYBOARD
- else {
- oled_on();
- }
-# endif
-
- update_log();
- if (is_master) {
- render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
- } else {
- render_status_secondary();
- }
-}
-
#endif
uint16_t get_tapping_term(uint16_t keycode) {
diff --git a/keyboards/kyria/keymaps/drashna/config.h b/keyboards/kyria/keymaps/drashna/config.h
index e566b16d5c..f93069ac00 100644
--- a/keyboards/kyria/keymaps/drashna/config.h
+++ b/keyboards/kyria/keymaps/drashna/config.h
@@ -37,3 +37,5 @@
// If you are using an Elite C rev3 on the slave side, uncomment the lines below:
#define SPLIT_USB_DETECT
#define SPLIT_USB_TIMEOUT 1000
+
+#define KEYLOGGER_LENGTH 10
diff --git a/keyboards/kyria/keymaps/drashna/keymap.c b/keyboards/kyria/keymaps/drashna/keymap.c
index 5604f1a692..5e97ca55ad 100644
--- a/keyboards/kyria/keymaps/drashna/keymap.c
+++ b/keyboards/kyria/keymaps/drashna/keymap.c
@@ -2,35 +2,6 @@
uint8_t is_master;
-#ifdef OLED_DRIVER_ENABLE
-# define KEYLOGGER_LENGTH 10
-static uint32_t oled_timer = 0;
-static char keylog_str[KEYLOGGER_LENGTH + 1] = {"\n"};
-static uint16_t log_timer = 0;
-// clang-format off
-static const char PROGMEM code_to_name[0xFF] = {
-// 0 1 2 3 4 5 6 7 8 9 A B c D E F
- ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', // 0x
- 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', // 1x
- '3', '4', '5', '6', '7', '8', '9', '0', 20, 19, 27, 26, 22, '-', '=', '[', // 2x
- ']','\\', '#', ';','\'', '`', ',', '.', '/', 128, ' ', ' ', ' ', ' ', ' ', ' ', // 3x
- ' ', ' ', ' ', ' ', ' ', ' ', 'P', 'S', ' ', ' ', ' ', ' ', 16, ' ', ' ', ' ', // 4x
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 5x
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 6x
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 7x
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 8x
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 9x
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ax
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Bx
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Cx
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Dx
- 'C', 'S', 'A', 'C', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ex
- ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' // Fx
-};
-
-void add_keylog(uint16_t keycode);
-#endif
-
#ifndef UNICODE_ENABLE
# define UC(x) KC_NO
#endif
@@ -52,7 +23,7 @@ void add_keylog(uint16_t keycode);
LAYOUT_wrapper( \
KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \
LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(KC_QUOT), \
- OS_LSFT, CTL_T(K21), K22, K23, K24, K25, KC_NO, KC_NO, MEH(KC_MINS), KC_NO, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \
+ OS_LSFT, CTL_T(K21), K22, K23, K24, K25, KC_NO, MEH(KC_MINS), TG(_DIABLO), KC_NO, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \
KC_MUTE, OS_LALT, KC_GRV, KC_SPC, BK_LWER, DL_RAIS, KC_ENT, OS_RGUI, UC(0x03A8), UC(0x2E2E) \
)
/* Re-pass though to allow templates to be used */
@@ -107,12 +78,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_____________CARPLAX_QFMLWY_L2_____________, _____________CARPLAX_QFMLWY_R2_____________,
_____________CARPLAX_QFMLWY_L3_____________, _____________CARPLAX_QFMLWY_R3_____________
),
+
[_MODS] = LAYOUT_wrapper(
_______, ___________________BLANK___________________, ___________________BLANK___________________, _______,
_______, ___________________BLANK___________________, ___________________BLANK___________________, _______,
KC_LSFT, ___________________BLANK___________________, _______, _______, _______, _______, ___________________BLANK___________________, KC_RSFT,
_______, _______, KC_LALT, _______, _______, _______, _______, KC_RGUI, _______, _______
),
+ [_DIABLO] = LAYOUT_wrapper(
+ KC_ESC, KC_S, KC_I, KC_F, KC_M, KC_T, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO,
+ KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_G, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_LCTL, KC_D3_1, KC_D3_2, KC_D3_3, KC_D3_4, KC_Z, KC_J, KC_L, TG(_DIABLO), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_DIABLO_CLEAR, KC_J, KC_NO, SFT_T(KC_SPACE), ALT_T(KC_Q), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO
+ ),
[_LOWER] = LAYOUT_wrapper(
KC_F12, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_F11,
_______, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE,
@@ -142,10 +120,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
-#ifdef OLED_DRIVER_ENABLE
- oled_timer = timer_read32();
- add_keylog(keycode);
-#endif
#ifndef SPLIT_KEYBOARD
if (keycode == RESET && !is_master) {
return false;
@@ -154,133 +128,16 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
}
return true;
}
+
void matrix_init_keymap(void) { is_master = (uint8_t)is_keyboard_master(); }
#ifdef OLED_DRIVER_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_180; }
-void add_keylog(uint16_t keycode) {
- if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) || (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) {
- keycode = keycode & 0xFF;
- } else if (keycode > 0xFF) {
- keycode = 0;
- }
-
- for (uint8_t i = (KEYLOGGER_LENGTH - 1); i > 0; --i) {
- keylog_str[i] = keylog_str[i - 1];
- }
-
- if (keycode < (sizeof(code_to_name) / sizeof(char))) {
- keylog_str[0] = pgm_read_byte(&code_to_name[keycode]);
- }
-
- log_timer = timer_read();
-}
-
-void update_log(void) {
- if (timer_elapsed(log_timer) > 750) {
- // add_keylog(0);
- }
-}
-
-void render_keylogger_status(void) {
- oled_write_P(PSTR("Keylogger: "), false);
- oled_write(keylog_str, false);
-}
-
-void render_default_layer_state(void) {
- oled_write_P(PSTR("Layout: "), false);
- switch (get_highest_layer(default_layer_state)) {
- case _QWERTY: oled_write_ln_P(PSTR("Qwerty"), false); break;
- case _COLEMAK: oled_write_ln_P(PSTR("Colemak"), false); break;
- case _DVORAK: oled_write_ln_P(PSTR("Dvorak"), false); break;
- case _WORKMAN: oled_write_ln_P(PSTR("Workman"), false); break;
- case _NORMAN: oled_write_ln_P(PSTR("Norman"), false); break;
- case _MALTRON: oled_write_ln_P(PSTR("Maltron"), false); break;
- case _EUCALYN: oled_write_ln_P(PSTR("Eucalyn"), false); break;
- case _CARPLAX: oled_write_ln_P(PSTR("Carplax"), false); break;
- }
-}
-
-void render_layer_state(void) {
- oled_write_ln_P(PSTR("Layer:"), false);
- oled_write_P(PSTR(" "), false);
- oled_write_P(PSTR("Lower"), layer_state_is(_LOWER));
- oled_write_P(PSTR(" "), false);
- oled_write_P(PSTR("Raise"), layer_state_is(_RAISE));
- oled_write_P(PSTR(" "), false);
- oled_write_ln_P(PSTR("Mods"), layer_state_is(_MODS));
-}
-
-void render_keylock_status(uint8_t led_usb_state) {
- oled_write_P(PSTR("Lock: "), false);
- oled_write_P(PSTR("NUML"), led_usb_state & (1 << USB_LED_NUM_LOCK));
- oled_write_P(PSTR(" "), false);
- oled_write_P(PSTR("CAPS"), led_usb_state & (1 << USB_LED_CAPS_LOCK));
- oled_write_P(PSTR(" "), false);
- oled_write_ln_P(PSTR("SCLK"), led_usb_state & (1 << USB_LED_SCROLL_LOCK));
-}
-
-void render_mod_status(uint8_t modifiers) {
- oled_write_P(PSTR("Mods: "), false);
- oled_write_P(PSTR("Sft"), (modifiers & MOD_MASK_SHIFT));
- oled_write_P(PSTR(" "), false);
- oled_write_P(PSTR("Ctl"), (modifiers & MOD_MASK_CTRL));
- oled_write_P(PSTR(" "), false);
- oled_write_P(PSTR("Alt"), (modifiers & MOD_MASK_ALT));
- oled_write_P(PSTR(" "), false);
- oled_write_P(PSTR("GUI"), (modifiers & MOD_MASK_GUI));
-}
-
-void render_bootmagic_status(void) {
- /* Show Ctrl-Gui Swap options */
- static const char PROGMEM logo[][2][3] = {
- {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
- {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
- };
- oled_write_P(PSTR("Boot "), false);
- if (keymap_config.swap_lctl_lgui) {
- oled_write_P(logo[1][0], false);
- } else {
- oled_write_P(logo[0][0], false);
- }
- oled_write_P(PSTR(" "), false);
- oled_write_P(PSTR("NKRO"), keymap_config.nkro);
- oled_write_P(PSTR(" "), false);
- oled_write_ln_P(PSTR("GUI"), !keymap_config.no_gui);
- oled_write_P(PSTR("Magic "), false);
- if (keymap_config.swap_lctl_lgui) {
- oled_write_P(logo[1][1], false);
- } else {
- oled_write_P(logo[0][1], false);
- }
- oled_write_P(PSTR(" "), false);
- oled_write_P(PSTR("GRV"), keymap_config.swap_grave_esc);
- oled_write_P(PSTR(" "), false);
- oled_write_ln_P(PSTR("CAPS"), keymap_config.swap_control_capslock);
-}
-
-void render_user_status(void) {
- oled_write_P(PSTR("USER: "), false);
- oled_write_P(PSTR("Anim"), userspace_config.rgb_matrix_idle_anim);
- oled_write_P(PSTR(" "), false);
- oled_write_P(PSTR("Layr"), userspace_config.rgb_layer_change);
- oled_write_P(PSTR(" "), false);
- oled_write_ln_P(PSTR("Nuke"), userspace_config.nuke_switch);
-}
-
// clang-format off
-void render_logo(void) {
- static const char PROGMEM qmk_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};
-
- oled_write_P(qmk_logo, false);
-}
# ifndef SPLIT_TRANSPORT_MIRROR
-void render_kyria_logo(void) {
+void oled_driver_render_logo(void) {
static const char PROGMEM kyria_logo[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,192,224,240,112,120, 56, 60, 28, 30, 14, 14, 14, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 14, 14, 14, 30, 28, 60, 56,120,112,240,224,192,128,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,192,224,240,124, 62, 31, 15, 7, 3, 1,128,192,224,240,120, 56, 60, 28, 30, 14, 14, 7, 7,135,231,127, 31,255,255, 31,127,231,135, 7, 7, 14, 14, 30, 28, 60, 56,120,240,224,192,128, 1, 3, 7, 15, 31, 62,124,240,224,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -294,51 +151,6 @@ void render_kyria_logo(void) {
oled_write_raw_P(kyria_logo, sizeof(kyria_logo));
}
# endif
-// clang-format on
-
-void render_status_main(void) {
- /* Show Keyboard Layout */
- render_default_layer_state();
- render_keylock_status(host_keyboard_leds());
- render_bootmagic_status();
- render_user_status();
-
- render_keylogger_status();
-}
-
-void render_status_secondary(void) {
- /* Show Keyboard Layout */
- render_logo();
- render_default_layer_state();
- render_layer_state();
- render_mod_status(get_mods() | get_oneshot_mods());
-
- render_keylogger_status();
-}
-
-void oled_task_user(void) {
- if (timer_elapsed32(oled_timer) > 30000) {
- oled_off();
- return;
- }
-# ifndef SPLIT_KEYBOARD
- else {
- oled_on();
- }
-# endif
-
- update_log();
- if (is_master) {
- render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
- } else {
-# ifdef SPLIT_TRANSPORT_MIRROR
- render_status_secondary();
-# else
- render_kyria_logo();
-# endif
- }
-}
-
#endif
#ifdef ENCODER_ENABLE
diff --git a/keyboards/kyria/keymaps/drashna/rules.mk b/keyboards/kyria/keymaps/drashna/rules.mk
index e835340bbf..2486ecd5d5 100644
--- a/keyboards/kyria/keymaps/drashna/rules.mk
+++ b/keyboards/kyria/keymaps/drashna/rules.mk
@@ -20,3 +20,5 @@ HD44780_ENABLE = no # Enable support for HD44780 based LCDs
BOOTLOADER = atmel-dfu
SPLIT_TRANSPORT = mirror
+
+TAP_DANCE_ENABLE = yes
diff --git a/layouts/community/ergodox/drashna/config.h b/layouts/community/ergodox/drashna/config.h
index ce25b0646b..8f1c9f6a2a 100644
--- a/layouts/community/ergodox/drashna/config.h
+++ b/layouts/community/ergodox/drashna/config.h
@@ -15,7 +15,7 @@
#define PRODUCT DrashnaDox - Hacked ErgoDox EZ Hybrid Monstrosity
#undef DEBOUNCE
-#define DEBOUNCE 30
+#define DEBOUNCE 60
#define TAPPING_TERM_PER_KEY
diff --git a/layouts/community/ergodox/drashna/rules.mk b/layouts/community/ergodox/drashna/rules.mk
index 78a3d15840..387bd20f68 100644
--- a/layouts/community/ergodox/drashna/rules.mk
+++ b/layouts/community/ergodox/drashna/rules.mk
@@ -1,8 +1,7 @@
BOOTMAGIC_ENABLE = lite
-TAP_DANCE_ENABLE = no
-SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
+TAP_DANCE_ENABLE = yes
COMMAND_ENABLE = no # Commands for debug and configuration
-CONSOLE_ENABLE = no
+CONSOLE_ENABLE =
SPACE_CADET_ENABLE = no
ifeq ($(strip $(KEYBOARD)), ergodox_ez)
@@ -10,7 +9,7 @@ ifeq ($(strip $(KEYBOARD)), ergodox_ez)
RGB_MATRIX_ENABLE = yes
RGBLIGHT_TWINKLE = no
INDICATOR_LIGHTS = no
- RGBLIGHT_STARTUP_ANIMATION = no
+ RGBLIGHT_STARTUP_ANIMATION = yes
endif
UNICODE_ENABLE = yes
diff --git a/layouts/community/ortho_4x12/drashna/config.h b/layouts/community/ortho_4x12/drashna/config.h
index 663708afa6..5342549e54 100644
--- a/layouts/community/ortho_4x12/drashna/config.h
+++ b/layouts/community/ortho_4x12/drashna/config.h
@@ -62,6 +62,8 @@
# endif
#endif
+#define EEPROM_I2C_RM24C512C
+
#define ENCODER_DIRECTION_FLIP
/*
* MIDI options
diff --git a/layouts/community/ortho_4x12/drashna/rules.mk b/layouts/community/ortho_4x12/drashna/rules.mk
index e4fe905341..3383cfd35f 100644
--- a/layouts/community/ortho_4x12/drashna/rules.mk
+++ b/layouts/community/ortho_4x12/drashna/rules.mk
@@ -18,8 +18,10 @@ else
CONSOLE_ENABLE = yes
COMMAND_ENABLE = yes
RGBLIGHT_ENABLE = yes
+ RGBLIGHT_STARTUP_ANIMATION = yes
RGB_MATRIX_ENABLE = no
AUDIO_ENABLE = yes
+ EEPROM_DRIVER = i2c
endif
ifeq ($(strip $(KEYBOARD)), planck/light)
RGB_MATRIX_ENABLE = yes
diff --git a/users/drashna/config.h b/users/drashna/config.h
index 106ae19c14..64b4b64ab7 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -1,7 +1,7 @@
#pragma once
// Use custom magic number so that when switching branches, EEPROM always gets reset
-#define EECONFIG_MAGIC_NUMBER (uint16_t)0x1337
+#define EECONFIG_MAGIC_NUMBER (uint16_t)0x1338
/* Set Polling rate to 1000Hz */
#define USB_POLLING_INTERVAL_MS 1
@@ -52,6 +52,7 @@
# if defined(__AVR__) && !defined(__AVR_AT90USB1286__)
# define DISABLE_RGB_MATRIX_ALPHAS_MODS
# define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
+# define DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
# define DISABLE_RGB_MATRIX_BREATHING
# define DISABLE_RGB_MATRIX_BAND_SAT
# define DISABLE_RGB_MATRIX_BAND_VAL
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 1a4ee9b414..ba19d4803f 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -18,12 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "drashna.h"
userspace_config_t userspace_config;
-#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
-# define DRASHNA_UNICODE_MODE UC_WIN
-#else
-// set to 2 for UC_WIN, set to 4 for UC_WINC
-# define DRASHNA_UNICODE_MODE 2
-#endif
bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed) {
static uint16_t this_timer;
@@ -93,19 +87,17 @@ void matrix_init_user(void) {
DDRB &= ~(1 << 0);
PORTB &= ~(1 << 0);
#endif
-
-#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
- set_unicode_input_mode(DRASHNA_UNICODE_MODE);
- get_unicode_input_mode();
-#endif // UNICODE_ENABLE
matrix_init_keymap();
}
__attribute__((weak)) void keyboard_post_init_keymap(void) {}
void keyboard_post_init_user(void) {
-#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
- keyboard_post_init_rgb();
+#if defined(RGBLIGHT_ENABLE)
+ keyboard_post_init_rgb_light();
+#endif
+#if defined(RGB_MATRIX_ENABLE)
+ keyboard_post_init_rgb_matrix();
#endif
keyboard_post_init_keymap();
}
@@ -155,9 +147,12 @@ void matrix_scan_user(void) {
run_diablo_macro_check();
#endif // TAP_DANCE_ENABLE
-#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
- matrix_scan_rgb();
+#if defined(RGBLIGHT_ENABLE)
+ matrix_scan_rgb_light();
#endif // RGBLIGHT_ENABLE
+#if defined(RGB_MATRIX_ENABLE)
+ matrix_scan_rgb_matrix();
+#endif
matrix_scan_keymap();
}
@@ -168,8 +163,8 @@ __attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state)
// Then runs keymap's layer change check
layer_state_t layer_state_set_user(layer_state_t state) {
state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
-#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
- state = layer_state_set_rgb(state);
+#if defined(RGBLIGHT_ENABLE)
+ state = layer_state_set_rgb_light(state);
#endif // RGBLIGHT_ENABLE
return layer_state_set_keymap(state);
}
@@ -200,12 +195,6 @@ void eeconfig_init_user(void) {
userspace_config.raw = 0;
userspace_config.rgb_layer_change = true;
eeconfig_update_user(userspace_config.raw);
-#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
- set_unicode_input_mode(DRASHNA_UNICODE_MODE);
- get_unicode_input_mode();
-#else
- eeprom_update_byte(EECONFIG_UNICODEMODE, DRASHNA_UNICODE_MODE);
-#endif
eeconfig_init_keymap();
keyboard_init();
}
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index 0ba1817604..c10ea5114a 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -25,9 +25,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef TAP_DANCE_ENABLE
# include "tap_dances.h"
#endif // TAP_DANCE_ENABLE
-#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
+#if defined(RGBLIGHT_ENABLE)
# include "rgb_stuff.h"
#endif
+#if defined(RGB_MATRIX_ENABLE)
+# include "rgb_matrix_stuff.h"
+#endif
+#if defined(OLED_DRIVER_ENABLE)
+# include "oled_stuff.h"
+#endif
/* Define layer names */
enum userspace_layers {
@@ -70,7 +76,6 @@ typedef union {
bool rgb_layer_change :1;
bool is_overwatch :1;
bool nuke_switch :1;
- uint8_t unicode_mod :4;
bool swapped_numbers :1;
bool rgb_matrix_idle_anim :1;
};
diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c
new file mode 100644
index 0000000000..7580de1d33
--- /dev/null
+++ b/users/drashna/oled_stuff.c
@@ -0,0 +1,278 @@
+#include "drashna.h"
+
+extern uint8_t is_master;
+
+#ifndef KEYLOGGER_LENGTH
+// # ifdef OLED_DISPLAY_128X64
+# define KEYLOGGER_LENGTH ((int)(OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH))
+// # else
+// # define KEYLOGGER_LENGTH (uint8_t *(OLED_DISPLAY_WIDTH / OLED_FONT_HEIGHT))
+// # endif
+#endif
+
+static uint32_t oled_timer = 0;
+static char keylog_str[KEYLOGGER_LENGTH + 1] = {"\n"};
+static uint16_t log_timer =