Mirror of CollapseOS
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

42 行
1.2KB

  1. #include <stdint.h>
  2. #include <stdbool.h>
  3. #define T6A04_ROWSIZE (120/8)
  4. #define T6A04_RAMSIZE 64*T6A04_ROWSIZE
  5. typedef enum {
  6. T6A04_XDEC = 0,
  7. T6A04_XINC = 1,
  8. T6A04_YDEC = 2,
  9. T6A04_YINC = 3
  10. } T6A04_INCMODE;
  11. typedef struct {
  12. // RAM is organized in 64 rows of 120 pixels (there is some offscreen
  13. // memory). Each byte holds 8 pixels. unset means no pixel, set means pixel.
  14. uint8_t ram[T6A04_RAMSIZE];
  15. bool enabled;
  16. // Whether the 8bit mode is enabled.
  17. bool has8bitmode;
  18. // Current "increment mode"
  19. T6A04_INCMODE incmode;
  20. // current Z offset
  21. uint8_t offset;
  22. // Currently active row
  23. uint8_t currow;
  24. // Currently active col (actual meaning depends on whether we're in 8bit
  25. // mode)
  26. uint8_t curcol;
  27. // True when a movement command was just made or if the LCD was just
  28. // initialized. When this is true, a read operation on the data port will be
  29. // invalid (returns zero and doesn't autoinc).
  30. bool just_moved;
  31. } T6A04;
  32. void t6a04_init(T6A04 *lcd);
  33. uint8_t t6a04_cmd_rd(T6A04 *lcd);
  34. void t6a04_cmd_wr(T6A04 *lcd, uint8_t val);
  35. uint8_t t6a04_data_rd(T6A04 *lcd);
  36. void t6a04_data_wr(T6A04 *lcd, uint8_t val);
  37. bool t6a04_pixel(T6A04 *lcd, uint8_t y, uint8_t x);