diff options
Diffstat (limited to 'keyboards/helix/pico/keymaps/default/keymap.c')
-rw-r--r-- | keyboards/helix/pico/keymaps/default/keymap.c | 135 |
1 files changed, 15 insertions, 120 deletions
diff --git a/keyboards/helix/pico/keymaps/default/keymap.c b/keyboards/helix/pico/keymaps/default/keymap.c index f23ab8576..11ee30258 100644 --- a/keyboards/helix/pico/keymaps/default/keymap.c +++ b/keyboards/helix/pico/keymaps/default/keymap.c | |||
@@ -1,24 +1,25 @@ | |||
1 | /* Copyright 2018 MakotoKurauchi | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
1 | #include QMK_KEYBOARD_H | 16 | #include QMK_KEYBOARD_H |
2 | #include "bootloader.h" | ||
3 | #ifdef PROTOCOL_LUFA | ||
4 | #include "lufa.h" | ||
5 | #include "split_util.h" | ||
6 | #endif | ||
7 | #ifdef AUDIO_ENABLE | ||
8 | #include "audio.h" | ||
9 | #endif | ||
10 | #ifdef SSD1306OLED | ||
11 | #include "ssd1306.h" | ||
12 | #endif | ||
13 | |||
14 | 17 | ||
15 | #ifdef RGBLIGHT_ENABLE | 18 | #ifdef RGBLIGHT_ENABLE |
16 | //Following line allows macro to read current RGB settings | 19 | //Following line allows macro to read current RGB settings |
17 | extern rgblight_config_t rgblight_config; | 20 | extern rgblight_config_t rgblight_config; |
18 | #endif | 21 | #endif |
19 | 22 | ||
20 | extern uint8_t is_master; | ||
21 | |||
22 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | 23 | // Each layer gets a name for readability, which is then used in the keymap matrix below. |
23 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | 24 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. |
24 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | 25 | // Layer names don't all need to be of the same length, obviously, and you can also skip them |
@@ -334,10 +335,6 @@ void matrix_init_user(void) { | |||
334 | #ifdef RGBLIGHT_ENABLE | 335 | #ifdef RGBLIGHT_ENABLE |
335 | RGB_current_mode = rgblight_config.mode; | 336 | RGB_current_mode = rgblight_config.mode; |
336 | #endif | 337 | #endif |
337 | //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h | ||
338 | #ifdef SSD1306OLED | ||
339 | iota_gfx_init(!has_usb()); // turns on the display | ||
340 | #endif | ||
341 | } | 338 | } |
342 | 339 | ||
343 | 340 | ||
@@ -365,105 +362,3 @@ void music_scale_user(void) | |||
365 | } | 362 | } |
366 | 363 | ||
367 | #endif | 364 | #endif |
368 | |||
369 | |||
370 | //SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h | ||
371 | #ifdef SSD1306OLED | ||
372 | |||
373 | void matrix_scan_user(void) { | ||
374 | iota_gfx_task(); // this is what updates the display continuously | ||
375 | } | ||
376 | |||
377 | void matrix_update(struct CharacterMatrix *dest, | ||
378 | const struct CharacterMatrix *source) { | ||
379 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
380 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
381 | dest->dirty = true; | ||
382 | } | ||
383 | } | ||
384 | |||
385 | //assign the right code to your layers for OLED display | ||
386 | #define L_BASE 0 | ||
387 | #define L_LOWER (1<<_LOWER) | ||
388 | #define L_RAISE (1<<_RAISE) | ||
389 | #define L_ADJUST (1<<_ADJUST) | ||
390 | #define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER) | ||
391 | |||
392 | static void render_logo(struct CharacterMatrix *matrix) { | ||
393 | |||
394 | static char logo[]={ | ||
395 | 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, | ||
396 | 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, | ||
397 | 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4, | ||
398 | 0}; | ||
399 | matrix_write(matrix, logo); | ||
400 | //matrix_write_P(&matrix, PSTR(" Split keyboard kit")); | ||
401 | } | ||
402 | |||
403 | |||
404 | |||
405 | void render_status(struct CharacterMatrix *matrix) { | ||
406 | |||
407 | // Render to mode icon | ||
408 | static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}}; | ||
409 | if(keymap_config.swap_lalt_lgui==false){ | ||
410 | matrix_write(matrix, logo[0][0]); | ||
411 | matrix_write_P(matrix, PSTR("\n")); | ||
412 | matrix_write(matrix, logo[0][1]); | ||
413 | }else{ | ||
414 | matrix_write(matrix, logo[1][0]); | ||
415 | matrix_write_P(matrix, PSTR("\n")); | ||
416 | matrix_write(matrix, logo[1][1]); | ||
417 | } | ||
418 | |||
419 | // 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 | ||
420 | char buf[40]; | ||
421 | snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); | ||
422 | matrix_write_P(matrix, PSTR("\nLayer: ")); | ||
423 | switch (layer_state) { | ||
424 | case L_BASE: | ||
425 | matrix_write_P(matrix, PSTR("Default")); | ||
426 | break; | ||
427 | case L_RAISE: | ||
428 | matrix_write_P(matrix, PSTR("Raise")); | ||
429 | break; | ||
430 | case L_LOWER: | ||
431 | matrix_write_P(matrix, PSTR("Lower")); | ||
432 | break; | ||
433 | case L_ADJUST: | ||
434 | case L_ADJUST_TRI: | ||
435 | matrix_write_P(matrix, PSTR("Adjust")); | ||
436 | break; | ||
437 | default: | ||
438 | matrix_write(matrix, buf); | ||
439 | } | ||
440 | |||
441 | // Host Keyboard LED Status | ||
442 | char led[40]; | ||
443 | snprintf(led, sizeof(led), "\n%s %s %s", | ||
444 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | ||
445 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | ||
446 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
447 | matrix_write(matrix, led); | ||
448 | } | ||
449 | |||
450 | |||
451 | void iota_gfx_task_user(void) { | ||
452 | struct CharacterMatrix matrix; | ||
453 | |||
454 | #if DEBUG_TO_SCREEN | ||
455 | if (debug_enable) { | ||
456 | return; | ||
457 | } | ||
458 | #endif | ||
459 | |||
460 | matrix_clear(&matrix); | ||
461 | if(is_master){ | ||
462 | render_status(&matrix); | ||
463 | }else{ | ||
464 | render_logo(&matrix); | ||
465 | } | ||
466 | matrix_update(&display, &matrix); | ||
467 | } | ||
468 | |||
469 | #endif | ||