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