You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.9 KiB

  1. // Copyright 2022 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. // Increment the counter when a key is pressed
  12. if (record->event.pressed) {
  13. press_count++;
  14. }
  15. return process_record_user(keycode, record);
  16. }
  17. bool oled_task_kb(void) {
  18. if (!oled_task_user()) { return false; }
  19. static const char PROGMEM my_logo[] = {
  20. 0x00, 0x00, 0x00, 0xf0, 0xf0, 0x30, 0x30, 0xf0, 0xe0, 0x30, 0x30, 0xf0, 0xe0, 0x00, 0x00, 0xf6,
  21. 0xf6, 0x00, 0x00, 0xf0, 0xf0, 0x20, 0x30, 0x30, 0xf0, 0xe0, 0x00, 0x00, 0xf6, 0xf6, 0x00, 0x00,
  22. 0x00, 0xc0, 0x40, 0x4f, 0x4f, 0x40, 0x40, 0x4f, 0x4f, 0xc0, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x0f,
  23. 0x0f, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00,
  24. 0x00, 0x03, 0xc2, 0x32, 0x0e, 0x82, 0x60, 0x18, 0x06, 0x03, 0xc0, 0xe0, 0x30, 0x30, 0x30, 0xe0,
  25. 0xc0, 0x00, 0xf0, 0xf0, 0x20, 0x30, 0x30, 0xf0, 0xe0, 0x00, 0xc0, 0xe0, 0xb0, 0xb0, 0xe0, 0xc0,
  26. 0x1e, 0x13, 0x10, 0x10, 0x12, 0x13, 0x12, 0x12, 0x12, 0x1c, 0x03, 0x07, 0x0c, 0x0c, 0x0c, 0x07,
  27. 0x03, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x03, 0x07, 0x0d, 0x0d, 0x0d, 0x09
  28. };
  29. oled_write_raw_P(my_logo, sizeof(my_logo));
  30. oled_set_cursor(0, 5);
  31. oled_write_ln_P(PSTR("Layer"), false);
  32. oled_write_ln(get_u8_str(get_highest_layer(layer_state), ' '), false);
  33. oled_write_ln_P(PSTR(" "), false);
  34. oled_write_ln_P(PSTR(" "), false);
  35. oled_write_ln_P(PSTR("Count"), false);
  36. oled_write_ln(get_u16_str(press_count, ' '), false);
  37. return false;
  38. }
  39. #endif