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.

38 lines
1.1 KiB

  1. #include "Arduino.h"
  2. extern bool tintty_cursor_key_mode_application;
  3. /**
  4. * Renderer callbacks.
  5. */
  6. struct tintty_display {
  7. int16_t screen_width, screen_height;
  8. int16_t screen_col_count, screen_row_count; // width and height divided by char size
  9. void (*fill_rect)(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
  10. void (*draw_pixels)(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t *pixels);
  11. void (*print_character)(int16_t col, int16_t row, uint16_t fg_color, uint16_t bg_color, char character);
  12. void (*print_cursor)(int16_t col, int16_t row, uint16_t color);
  13. void (*set_vscroll)(int16_t offset); // scroll offset for entire screen
  14. };
  15. /**
  16. * Main entry point.
  17. * Peek/read callbacks are expected to block until input is available;
  18. * while sketch is waiting for input, it should call the tintty_idle() hook
  19. * to allow animating cursor, etc.
  20. */
  21. void tintty_run(
  22. char (*peek_char)(),
  23. char (*read_char)(),
  24. void (*send_char)(char str),
  25. tintty_display *display
  26. );
  27. /**
  28. * Hook to call while e.g. sketch is waiting for input
  29. */
  30. void tintty_idle(
  31. tintty_display *display
  32. );