display.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * (c) Philippe G. 2019, philippe_44@outlook.com
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. */
  18. #pragma once
  19. #define DISPLAY_CLEAR 0x01
  20. #define DISPLAY_UPDATE 0x02
  21. enum display_pos_e { DISPLAY_TOP_LEFT, DISPLAY_MIDDLE_LEFT, DISPLAY_BOTTOM_LEFT, DISPLAY_CENTER };
  22. // don't change anything there w/o changing all drivers init code
  23. extern struct display_s {
  24. int width, height;
  25. bool (*init)(char *config, char *welcome);
  26. void (*on)(bool state);
  27. void (*brightness)(u8_t level);
  28. void (*text)(enum display_pos_e pos, int attribute, char *msg);
  29. void (*update)(void);
  30. void (*draw)(int x1, int y1, int x2, int y2, bool by_column, u8_t *data);
  31. void (*draw_cbr)(u8_t *data, int height); // height is the # of columns in data, as oppoosed to display height (0 = display height)
  32. } *display;