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.

115 lines
3.0 KiB

2 years ago
2 years ago
2 years ago
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. bool m_hide = false;
  64. public:
  65. bool init(DwinScreen *dwin_screen, uint16_t valsize);
  66. bool init(DwinScreen *dwin_screen, uint16_t descript_add, uint16_t val_add);
  67. /**
  68. * @brief Set the Font object
  69. *
  70. * @param EncodeMode [7:7] 0ַԶ,1ַԶ [6:0] 0=8bit1=GB23122=GBK 3=BIG5 4=SJIS 5=UNICODE
  71. * @param font0id
  72. * @param font1id
  73. */
  74. void setFont(uint16_t EncodeMode, uint8_t font0id, uint8_t font1id, uint16_t frontxsize, uint16_t frontysize);
  75. /**
  76. * @brief Set the Pos object
  77. *
  78. * @param x
  79. * @param y
  80. * @param width ı
  81. * @param hight ı߶
  82. */
  83. void setPos(uint16_t x, uint16_t y, uint16_t width, uint16_t hight);
  84. /**
  85. * @brief ı
  86. *
  87. * @param
  88. */
  89. bool setVal(const char *val);
  90. void setColor(uint16_t color);
  91. bool setTextLengthDirect(uint16_t len);
  92. bool show();
  93. bool hide();
  94. bool isHide() { return m_hide; }
  95. public:
  96. bool flushcfg();
  97. bool readcfg();
  98. void dumpinfo();
  99. };
  100. } // namespace dwin
  101. } // namespace iflytop