minidivide.c (1142B)
1 // Copyright 2023 takashicompany (@takashicompany) 2 // SPDX-License-Identifier: GPL-2.0-or-later 3 4 #include "quantum.h" 5 6 #ifdef OLED_ENABLE 7 8 oled_rotation_t oled_init_kb(oled_rotation_t rotation) { 9 return OLED_ROTATION_270; 10 } 11 12 //Variable that stores the number of times the key was pressed 13 static uint16_t press_count = 0; 14 15 bool process_record_kb(uint16_t keycode, keyrecord_t *record) { 16 if (!process_record_user(keycode, record)) { 17 return false; 18 } 19 // Increment the counter when a key is pressed 20 if (record->event.pressed) { 21 press_count++; 22 } 23 24 return process_record_user(keycode, record); 25 } 26 27 bool oled_task_kb(void) { 28 29 if (!oled_task_user()) { return false; } 30 31 oled_write_ln_P(PSTR("mini"), false); 32 oled_write_ln_P(PSTR("Divide"), false); 33 34 oled_set_cursor(0, 5); 35 36 oled_write_ln_P(PSTR("Layer"), false); 37 oled_write_ln(get_u8_str(get_highest_layer(layer_state), ' '), false); 38 39 oled_write_ln_P(PSTR(" "), false); 40 oled_write_ln_P(PSTR(" "), false); 41 42 oled_write_ln_P(PSTR("Count"), false); 43 oled_write_ln(get_u16_str(press_count, ' '), false); 44 45 return false; 46 47 } 48 #endif