bcat_oled.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright 2021 Jonathan Rascher
  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. #pragma once
  17. #include <stdbool.h>
  18. #include <stdint.h>
  19. #include "led.h"
  20. /* Keyboard status passed to the oled_task_keymap function and used by the
  21. * various keyboard pet implementations.
  22. */
  23. typedef struct {
  24. uint8_t mods;
  25. led_t leds;
  26. uint8_t wpm;
  27. } oled_keyboard_state_t;
  28. /* Note: Functions below assume a vertical OLED that is 32px (5 chars) wide. */
  29. /* Renders layer status at the cursor. Occupies 5x1 character cells. */
  30. void render_oled_layers(void);
  31. /* Renders LED indicators (Num/Caps/Scroll Lock) at the cursor. Occupies 5x3
  32. * character cells.
  33. */
  34. void render_oled_indicators(led_t leds);
  35. /* Renders calculated WPM count at the cursor. Occupies 5x2 character cells. */
  36. void render_oled_wpm(uint8_t wpm);
  37. #if defined(BCAT_OLED_PET)
  38. /* Renders an animated critter at the cursor that can respond to keystrokes,
  39. * typing speed, etc. Should be about 5 character cells wide, but exact height
  40. * varies depending on the specific OLED pet implementation linked in.
  41. *
  42. * The rendered image will be one line taller than the OLED pet's animation
  43. * frame height to accommodate pets that "jump" when the spacebar is pressed.
  44. */
  45. void render_oled_pet(uint8_t col, uint8_t line, const oled_keyboard_state_t *keyboard_state);
  46. #endif