aboutsummaryrefslogtreecommitdiff
path: root/keyboards/helix/pico/keymaps/mtei/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/helix/pico/keymaps/mtei/keymap.c')
-rw-r--r--keyboards/helix/pico/keymaps/mtei/keymap.c163
1 files changed, 15 insertions, 148 deletions
diff --git a/keyboards/helix/pico/keymaps/mtei/keymap.c b/keyboards/helix/pico/keymaps/mtei/keymap.c
index 728ef0eb5..58684be49 100644
--- a/keyboards/helix/pico/keymaps/mtei/keymap.c
+++ b/keyboards/helix/pico/keymaps/mtei/keymap.c
@@ -1,31 +1,23 @@
1/* Copyright 2018 mtei
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#ifdef CONSOLE_ENABLE
14 #include <print.h>
15#endif
16 17
17#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) 18#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
18#define kc5(a,b,c,d,e) KC_##a, KC_##b, KC_##c, KC_##d, KC_##e 19#define kc5(a,b,c,d,e) KC_##a, KC_##b, KC_##c, KC_##d, KC_##e
19 20
20extern keymap_config_t keymap_config;
21
22#ifdef RGBLIGHT_ENABLE
23//Following line allows macro to read current RGB settings
24extern rgblight_config_t rgblight_config;
25#endif
26
27extern uint8_t is_master;
28
29// Each layer gets a name for readability, which is then used in the keymap matrix below. 21// Each layer gets a name for readability, which is then used in the keymap matrix below.
30// The underscores don't mean anything - you can have a layer called STUFF or any other name. 22// The underscores don't mean anything - you can have a layer called STUFF or any other name.
31// Layer names don't all need to be of the same length, obviously, and you can also skip them 23// Layer names don't all need to be of the same length, obviously, and you can also skip them
@@ -373,10 +365,6 @@ void matrix_init_user(void) {
373 #ifdef AUDIO_ENABLE 365 #ifdef AUDIO_ENABLE
374 startup_user(); 366 startup_user();
375 #endif 367 #endif
376 //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
377 #ifdef SSD1306OLED
378 iota_gfx_init(!has_usb()); // turns on the display
379 #endif
380} 368}
381 369
382 370
@@ -404,124 +392,3 @@ void music_scale_user(void)
404} 392}
405 393
406#endif 394#endif
407
408
409//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
410#ifdef SSD1306OLED
411
412void matrix_scan_user(void) {
413 iota_gfx_task(); // this is what updates the display continuously
414}
415
416void matrix_update(struct CharacterMatrix *dest,
417 const struct CharacterMatrix *source) {
418 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
419 memcpy(dest->display, source->display, sizeof(dest->display));
420 dest->dirty = true;
421 }
422}
423
424static void render_logo(struct CharacterMatrix *matrix) {
425
426 static char logo[]={
427 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
428 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
429 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
430 0};
431 matrix_write(matrix, logo);
432#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_ANIMATIONS)
433 char buf[30];
434 if(rgblight_config.enable) {
435 snprintf(buf, sizeof(buf), " LED %2d: %d,%d,%d ",
436 rgblight_config.mode,
437 rgblight_config.hue/RGBLIGHT_HUE_STEP,
438 rgblight_config.sat/RGBLIGHT_SAT_STEP,
439 rgblight_config.val/RGBLIGHT_VAL_STEP);
440 matrix_write(matrix, buf);
441 }
442#endif
443 //matrix_write_P(&matrix, PSTR(" Split keyboard kit"));
444}
445
446static const char Qwerty_name[] PROGMEM = " Qwerty";
447static const char Colemak_name[] PROGMEM = " Colemak";
448static const char Dvorak_name[] PROGMEM = " Dvorak";
449static const char Eucalyn_name[] PROGMEM = " Eucalyn";
450
451static const char NumL_name[] PROGMEM = ":NumL";
452static const char NumR_name[] PROGMEM = ":NumR";
453static const char Lower_name[] PROGMEM = ":Func";
454static const char Raise_name[] PROGMEM = ":Extra";
455static const char Adjust_name[] PROGMEM = ":Adjust";
456
457static const char *layer_names[] = {
458 [_QWERTY] = Qwerty_name,
459 [_COLEMAK] = Colemak_name,
460 [_DVORAK] = Dvorak_name,
461 [_EUCALYN] = Eucalyn_name,
462
463 [_NUML] = NumL_name,
464 [_NUMR] = NumR_name,
465 [_LOWER] = Lower_name,
466 [_RAISE] = Raise_name,
467 [_ADJUST] = Adjust_name
468};
469
470void render_status(struct CharacterMatrix *matrix) {
471
472 // Render to mode icon
473 static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
474 if(keymap_config.swap_lalt_lgui==false){
475 matrix_write(matrix, logo[0][0]);
476 matrix_write_P(matrix, PSTR("\n"));
477 matrix_write(matrix, logo[0][1]);
478 }else{
479 matrix_write(matrix, logo[1][0]);
480 matrix_write_P(matrix, PSTR("\n"));
481 matrix_write(matrix, logo[1][1]);
482 }
483
484 // 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
485 int name_num;
486 uint32_t lstate;
487 matrix_write_P(matrix, layer_names[current_default_layer]);
488 matrix_write_P(matrix, PSTR("\n"));
489 for( lstate = layer_state, name_num = 0;
490 lstate && name_num < sizeof(layer_names)/sizeof(char *);
491 lstate >>=1, name_num++ ) {
492 if( (lstate & 1) != 0 ) {
493 if( layer_names[name_num] ) {
494 matrix_write_P(matrix, layer_names[name_num]);
495 }
496 }
497 }
498
499 // Host Keyboard LED Status
500 char led[40];
501 snprintf(led, sizeof(led), "\n%s %s %s",
502 (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
503 (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
504 (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
505 matrix_write(matrix, led);
506}
507
508
509void iota_gfx_task_user(void) {
510 struct CharacterMatrix matrix;
511
512#if DEBUG_TO_SCREEN
513 if (debug_enable) {
514 return;
515 }
516#endif
517
518 matrix_clear(&matrix);
519 if(is_master){
520 render_status(&matrix);
521 }else{
522 render_logo(&matrix);
523 }
524 matrix_update(&display, &matrix);
525}
526
527#endif