murphpad.c (2643B)
1 /* Copyright 2021 Kyle McCreery 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 17 #include "quantum.h" 18 19 #ifdef ENCODER_ENABLE 20 bool encoder_update_kb(uint8_t index, bool clockwise) { 21 if (!encoder_update_user(index, clockwise)) { 22 return false; 23 } 24 25 switch (index) { 26 case 0: 27 if (clockwise) { 28 tap_code(KC_VOLU); 29 } else { 30 tap_code(KC_VOLD); 31 } 32 break; 33 case 1: 34 if (clockwise) { 35 tap_code(KC_BRIU); 36 } else { 37 tap_code(KC_BRID); 38 } 39 break; 40 } 41 return true; 42 } 43 #endif 44 45 #ifdef OLED_ENABLE 46 static const char PROGMEM mw_logo[] = { 47 0x8A, 0x8B, 0x8C, 0x8D, '\r', 48 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 49 0xCA, 0xCB, 0xCC, 0xCD, '\r', 50 0x20, 0x8E, 0x8F, 0x90, 0x00}; 51 52 oled_rotation_t oled_init_kb(oled_rotation_t rotation) { 53 return OLED_ROTATION_270; // flips the display 270 degrees 54 } 55 56 bool oled_task_kb(void) { 57 if (!oled_task_user()) { 58 return false; 59 } 60 61 oled_write_P(mw_logo, false); // Render MechWild "MW" Logo 62 oled_set_cursor(0,6); 63 64 oled_write_ln_P(PSTR("Layer"), false); 65 66 switch (get_highest_layer(layer_state)) { 67 case 0: 68 oled_write_ln_P(PSTR("Base"), false); 69 break; 70 case 1: 71 oled_write_ln_P(PSTR("FN 1"), false); 72 break; 73 case 2: 74 oled_write_ln_P(PSTR("FN 2"), false); 75 break; 76 case 3: 77 oled_write_ln_P(PSTR("FN 3"), false); 78 break; 79 default: 80 oled_write_ln_P(PSTR("Undef"), false); 81 } 82 83 oled_write_ln_P(PSTR(""), false); 84 85 // Host Keyboard LED Status 86 led_t led_state = host_keyboard_led_state(); 87 oled_write_ln_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); 88 oled_write_ln_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); 89 oled_write_ln_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); 90 91 return true; 92 } 93 #endif