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.

112 lines
2.9 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #pragma once
  2. #include "sdk\components\dwin\dwin_screen.hpp"
  3. namespace iflytop {
  4. namespace dwin {
  5. using namespace std;
  6. /**
  7. * @brief
  8. *
  9. * 0x00 *VP
  10. *
  11. */
  12. /**
  13. *
  14. * 0x00: *VP 2 ıָ
  15. * 0x01: (X,Y) 4 ʼʾλãʾַϽ
  16. * 0x03: Color 2 ʾıɫ
  17. * 0x04: (xs,Ys)(xe,Ye) 8 ı
  18. * 0x08: Text_Length 2 ʾֽ0xFFFF0x0000ʾıβʾ
  19. * 0x09: Font0_ID(H) 1 ʽΪ0x01-0x04ʱASIIַʹõֿλá
  20. * 0x09: Font1_ID(L) 1 ʽΪ0x000x05Լ0x01-0x04ʱķASCIIַʹõֿλá
  21. * 0x0A: Font_x_Dots(H) 1 x0x01-0x04ģʽASCIIַxx/2
  22. * 0x0A: Font_Y_Dots(L) 1 Y
  23. * 0x0B: Encode_Mode(H) 1 .7ıʾַǷԶ
  24. * .7=0 ַԶ
  25. * .7=1ַԶַȹ̶Ϊĵ
  26. * .6-.0ıʽ0=8bit1=GB23122=GBK 3=BIG5 4=SJIS 5=UNICODE
  27. * 0x0B: HOR_Dis(L 1 ַˮƽ
  28. * 0x0C: VER_Dis(H) 1 ֱַ
  29. * 0x0C: δ(L) 1 д0x00
  30. *
  31. */
  32. #pragma pack(1)
  33. typedef struct {
  34. uint16_t VP;
  35. uint16_t PosX;
  36. uint16_t PosY;
  37. uint16_t Color;
  38. uint16_t Xs;
  39. uint16_t Ys;
  40. uint16_t Xe;
  41. uint16_t Ye;
  42. uint16_t TextLength;
  43. uint8_t Font1ID;
  44. uint8_t Font0ID;
  45. uint8_t FontYDots;
  46. uint8_t FontXDots;
  47. uint8_t LHORDis;
  48. uint8_t EncodeMode; // [7:7] 0�ַ������Զ�����,1�ַ����಻�Զ����� [6:0] 0=8bit����1=GB2312����2=GBK 3=BIG5 4=SJIS 5=UNICODE
  49. uint8_t mark;
  50. uint8_t LVERDis;
  51. } TextDisplayerDescript_t;
  52. #pragma pack()
  53. typedef enum {
  54. kcolor_red = 0xF800,
  55. kcolor_black = 0x0000,
  56. kcolor_white = 0xFFFF,
  57. kcolor_grey = 0xc618,
  58. } dwincolor_t;
  59. class TextDisplayer {
  60. DwinScreen *m_dwin_screen = nullptr;
  61. uint16_t m_descript_add = 0;
  62. TextDisplayerDescript_t m_descript;
  63. public:
  64. bool init(DwinScreen *dwin_screen, uint16_t valsize);
  65. bool init(DwinScreen *dwin_screen, uint16_t descript_add, uint16_t val_add);
  66. /**
  67. * @brief Set the Font object
  68. *
  69. * @param EncodeMode [7:7] 0ַԶ,1ַԶ [6:0] 0=8bit1=GB23122=GBK 3=BIG5 4=SJIS 5=UNICODE
  70. * @param font0id
  71. * @param font1id
  72. */
  73. void setFont(uint16_t EncodeMode, uint8_t font0id, uint8_t font1id, uint16_t frontxsize, uint16_t frontysize);
  74. /**
  75. * @brief Set the Pos object
  76. *
  77. * @param x
  78. * @param y
  79. * @param width ı
  80. * @param hight ı߶
  81. */
  82. void setPos(uint16_t x, uint16_t y, uint16_t width, uint16_t hight);
  83. /**
  84. * @brief ı
  85. *
  86. * @param
  87. */
  88. bool setVal(const char *val);
  89. void setColor(uint16_t color);
  90. bool setTextLengthDirect(uint16_t len);
  91. bool show();
  92. bool hide();
  93. public:
  94. bool flushcfg();
  95. bool readcfg();
  96. void dumpinfo();
  97. };
  98. } // namespace dwin
  99. } // namespace iflytop