summaryrefslogtreecommitdiff
path: root/keyboards/lets_split/keymaps/OLED_sample/keymap.c
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-07-11 14:23:26 -0400
committerJack Humbert <jack.humb@gmail.com>2017-07-11 14:23:26 -0400
commitcc468523dfec8175939f575a214714eea8aaa7a3 (patch)
tree2e50037483a8f895fed2842ec630a512d16ab11e /keyboards/lets_split/keymaps/OLED_sample/keymap.c
parent387b07404a1c3f7e8de15345157d4d0fb482d28c (diff)
downloadqmk_firmware-cc468523dfec8175939f575a214714eea8aaa7a3.tar.gz
qmk_firmware-cc468523dfec8175939f575a214714eea8aaa7a3.zip
clean up ssd1306 implementation
Diffstat (limited to 'keyboards/lets_split/keymaps/OLED_sample/keymap.c')
-rw-r--r--keyboards/lets_split/keymaps/OLED_sample/keymap.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/keyboards/lets_split/keymaps/OLED_sample/keymap.c b/keyboards/lets_split/keymaps/OLED_sample/keymap.c
index 5dbab5332e..ad32269c80 100644
--- a/keyboards/lets_split/keymaps/OLED_sample/keymap.c
+++ b/keyboards/lets_split/keymaps/OLED_sample/keymap.c
@@ -357,3 +357,81 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
return MACRO_NONE;
}
+
+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) {
+#if DEBUG_TO_SCREEN
+ if (debug_enable) {
+ return;
+ }
+#endif
+
+ struct CharacterMatrix matrix;
+
+ matrix_clear(&matrix);
+ matrix_write_P(&matrix, PSTR("USB: "));
+#ifdef PROTOCOL_LUFA
+ switch (USB_DeviceState) {
+ case DEVICE_STATE_Unattached:
+ matrix_write_P(&matrix, PSTR("Unattached"));
+ break;
+ case DEVICE_STATE_Suspended:
+ matrix_write_P(&matrix, PSTR("Suspended"));
+ break;
+ case DEVICE_STATE_Configured:
+ matrix_write_P(&matrix, PSTR("Connected"));
+ break;
+ case DEVICE_STATE_Powered:
+ matrix_write_P(&matrix, PSTR("Powered"));
+ break;
+ case DEVICE_STATE_Default:
+ matrix_write_P(&matrix, PSTR("Default"));
+ break;
+ case DEVICE_STATE_Addressed:
+ matrix_write_P(&matrix, PSTR("Addressed"));
+ break;
+ default:
+ matrix_write_P(&matrix, PSTR("Invalid"));
+ }
+#endif
+
+// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
+
+ char buf[40];
+ snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
+ matrix_write_P(&matrix, PSTR("\n\nLayer: "));
+ switch (layer_state) {
+ case _QWERTY:
+ case _COLEMAK:
+ case _DVORAK:
+ matrix_write_P(&matrix, PSTR("Default"));
+ break;
+ case _RAISE:
+ matrix_write_P(&matrix, PSTR("Raise"));
+ break;
+ case _LOWER:
+ matrix_write_P(&matrix, PSTR("Lower"));
+ break;
+ case _ADJUST:
+ matrix_write_P(&matrix, PSTR("ADJUST"));
+ break;
+ default:
+ matrix_write(&matrix, buf);
+ }
+
+ // Host Keyboard LED Status
+ char led[40];
+ snprintf(led, sizeof(led), "\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" : " ");
+ matrix_write(&matrix, led);
+ matrix_update(&display, &matrix);
+} \ No newline at end of file