display.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * (c) Philippe G. 2019, philippe_44@outlook.com
  3. *
  4. * This software is released under the MIT License.
  5. * https://opensource.org/licenses/MIT
  6. *
  7. */
  8. #pragma once
  9. #include "gds.h"
  10. /*
  11. The displayer is not thread-safe and the caller must ensure use its own
  12. mutexes if it wants something better. Especially, text() line() and draw()
  13. are not protected against each other.
  14. In text mode (text/line) when using DISPLAY_SUSPEND, the displayer will
  15. refreshed line 2 one last time before suspending itself. As a result if it
  16. is in a long sleep (scrolling pause), the refresh will happen after wakeup.
  17. So it can conflict with other display direct writes that have been made during
  18. sleep. Note that if DISPLAY_SHUTDOWN has been called meanwhile, it (almost)
  19. never happens
  20. The display_bus() shall be subscribed by other displayers so that at least
  21. when this one (the main) wants to take control over display, it can signal
  22. that to others
  23. */
  24. extern struct GDS_Device *display;
  25. enum displayer_cmd_e { DISPLAYER_SHUTDOWN, DISPLAYER_ACTIVATE, DISPLAYER_SUSPEND, DISPLAYER_TIMER_PAUSE, DISPLAYER_TIMER_RUN };
  26. enum displayer_time_e { DISPLAYER_ELAPSED, DISPLAYER_REMAINING };
  27. enum display_bus_cmd_e { DISPLAY_BUS_TAKE, DISPLAY_BUS_GIVE };
  28. bool (*display_bus)(void *from, enum display_bus_cmd_e cmd);
  29. const char *display_conf_get_driver_name(const char * driver);
  30. bool display_is_valid_driver(const char * driver);
  31. void displayer_scroll(char *string, int speed, int pause);
  32. void displayer_control(enum displayer_cmd_e cmd, ...);
  33. void displayer_metadata(char *artist, char *album, char *title);
  34. void displayer_artwork(uint8_t *data);
  35. void displayer_timer(enum displayer_time_e mode, int elapsed, int duration);
  36. bool displayer_can_artwork(void);
  37. char * display_get_supported_drivers(void);