endzone34.c (2506B)
1 /* Copyright 2021 takashicompany 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 oled_rotation_t oled_init_kb(oled_rotation_t rotation) { 20 return OLED_ROTATION_270; 21 } 22 23 //Variable that stores the number of times the key was pressed 24 static uint16_t press_count = 0; 25 26 bool process_record_kb(uint16_t keycode, keyrecord_t *record) { 27 28 // Increment the counter when a key is pressed 29 if (record->event.pressed) { 30 press_count++; 31 } 32 33 return process_record_user(keycode, record); 34 } 35 36 #ifdef OLED_ENABLE 37 bool oled_task_kb(void) { 38 39 if (!oled_task_user()) { return false; } 40 41 static const char PROGMEM my_logo[] = { 42 0x00, 0x00, 0x00, 0xff, 0x01, 0x01, 0x39, 0x29, 0x29, 0x29, 0x29, 0x29, 0xe9, 0x0f, 0x00, 0x00, 43 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf8, 0x08, 0xf8, 0x00, 0x00, 0x00, 0x00, 44 0x80, 0x80, 0x80, 0xbf, 0xa0, 0xa0, 0xa7, 0xa5, 0xa5, 0xa5, 0xa5, 0x25, 0x25, 0x3c, 0x00, 0x1f, 45 0x20, 0x3e, 0x02, 0x3e, 0x20, 0x1f, 0x20, 0x2e, 0x2a, 0x2e, 0x20, 0x1f, 0x00, 0x00, 0x00, 0x00, 46 0x87, 0x44, 0x24, 0x14, 0x0c, 0x00, 0xc0, 0xa0, 0x90, 0x88, 0x87, 0x00, 0xe0, 0x10, 0xd0, 0x50, 47 0xd0, 0x10, 0xe0, 0x10, 0xd0, 0x50, 0xd0, 0x10, 0xe0, 0x10, 0xd0, 0x50, 0x50, 0x10, 0xf0, 0x00, 48 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x00, 0x03, 0x04, 0x05, 0x05, 49 0x05, 0x04, 0x03, 0x04, 0x07, 0x00, 0x07, 0x04, 0x03, 0x04, 0x05, 0x05, 0x05, 0x05, 0x07, 0x00 50 }; 51 52 oled_write_raw_P(my_logo, sizeof(my_logo)); 53 oled_set_cursor(0, 5); 54 55 oled_write_ln_P(PSTR("Layer"), false); 56 oled_write_ln(get_u8_str(get_highest_layer(layer_state), ' '), false); 57 58 oled_write_ln_P(PSTR(" "), false); 59 oled_write_ln_P(PSTR(" "), false); 60 61 oled_write_ln_P(PSTR("Count"), false); 62 oled_write_ln(get_u16_str(press_count, ' '), false); 63 64 return false; 65 66 } 67 #endif