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.

46 lines
1.2 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. * Keyboard callbacks.
  17. */
  18. struct tintty_keyboard {
  19. void (*bell)();
  20. };
  21. /**
  22. * Main entry point.
  23. * Peek/read callbacks are expected to block until input is available;
  24. * while sketch is waiting for input, it should call the tintty_idle() hook
  25. * to allow animating cursor, etc.
  26. */
  27. void tintty_run(
  28. char (*peek_char)(),
  29. char (*read_char)(),
  30. void (*send_char)(char str),
  31. tintty_display *display,
  32. tintty_keyboard *keyboard
  33. );
  34. /**
  35. * Hook to call while e.g. sketch is waiting for input
  36. */
  37. void tintty_idle(
  38. tintty_display *display
  39. );