logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

minidivide.c (1142B)


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