qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

ein_60.c (4922B)


      1 /* Copyright 2021 klackygears
      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  */
     16 #include "quantum.h"
     17 
     18 #ifdef AUDIO_ENABLE
     19 const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS] = {
     20    {30, 31, 32, 33, 34, 35, 35, 36, 37, 38, 39, 40, 41},
     21    {18, 19, 20, 21, 22, 23,  0, 25, 25, 26, 27, 28, 29},
     22    { 6,  7,  8,  9, 10, 11,  0, 12, 13, 14, 15, 16, 17},
     23    { 1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1}
     24 };
     25 #endif
     26 
     27 #ifdef OLED_ENABLE
     28 bool oled_task_kb(void) {
     29     if (!oled_task_user()) { return false; }
     30     // Host Keyboard Layer Status
     31     oled_write_P(PSTR("Layer: "), false);
     32     switch (get_highest_layer(layer_state)) {
     33         case 0:
     34             oled_write_P(PSTR("Default\n"), false);
     35             break;
     36         case 1:
     37             oled_write_P(PSTR("Lower\n"), false);
     38             break;
     39         case 2:
     40             oled_write_P(PSTR("Raise\n"), false);
     41             break;
     42         case 3:
     43             oled_write_P(PSTR("Adjust\n"), false);
     44             break;
     45         case 4:
     46             oled_write_P(PSTR("FN\n"), false);
     47             break;
     48         default:
     49             // Or use the write_ln shortcut over adding '\n' to the end of your string
     50             oled_write_ln_P(PSTR("Undefined"), false);
     51     }
     52 
     53 
     54     // Host Keyboard LED Status
     55     led_t led_state = host_keyboard_led_state();
     56     oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR("    "), false);
     57     oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR("    "), false);
     58     oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR("    "), false);
     59 
     60     oled_set_cursor(1,2);
     61     oled_advance_page(true);
     62     static const char PROGMEM ein60_logo[] = {
     63             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,  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,
     64         0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255,255, 11,251,139,139,139,139,139,139,139,139,139,139,139, 11, 15,  0,240,240, 16,240,  0,240,240, 16,240,224,192,128,  0,  0,  0,  0,240, 16,240,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,254,255, 11,251,139,139,139,139,139,139,139,139,139,139,139,143,128,  0,  0,  0,  0,254,255, 11,251, 11, 11, 11, 11,139,203,235,123,187,219,235,251,255,  7,252,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     65         0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255,255,  4,253,197,197,197,197,197,197,197,197,197,197,199,192,192,  0,255,255,  0,255,  0,255,255,  0,254, 13, 27, 55,111,222,188,120,255,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255,255,  0,255,197,197,197,197,197,197,197,197,197,197,253,253,255,131,254,  0,  0,255,255,  0,255,184,220,238,247,219,205,198,195,193,192,255,255,255,128,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     66         0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  3,  0,  3,  3,  2,  3,  0,  3,  3,  2,  3,  0,  0,  0,  0,  0,  1,  3,  2,  2,  3,  0,  8, 28, 20, 20, 20, 20, 20, 28,  8,  0,  1,  3,  3,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  3,  0,  0,  0,  1,  3,  3,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     67         };
     68 
     69     oled_write_raw_P(ein60_logo, sizeof(ein60_logo));
     70     return false;
     71 }
     72 #endif
     73 
     74 #ifdef ENCODER_ENABLE
     75 bool encoder_update_kb(uint8_t index, bool clockwise) {
     76     if (!encoder_update_user(index, clockwise)) { return false; }
     77     if (index == 0) { /* First encoder */
     78         if (clockwise) {
     79             tap_code_delay(KC_VOLU, 10);
     80         } else {
     81             tap_code_delay(KC_VOLD, 10);
     82         }
     83     } else if (index == 1) { /* Second encoder */
     84         if (clockwise) {
     85             tap_code(KC_DOWN);
     86         } else {
     87             tap_code(KC_UP);
     88         }
     89     }
     90     return true;
     91 }
     92 #endif