EVE-14 Slider Dial Toggle Number

1.      Slider(滑块)

CMD_SLIDER –绘制一个滑块

#define ftCoCmdSlider(x, y, w, h, options, val, range)\

{\

      ftWrDispCmd(CMD_SLIDER);\

      ftWrDispCmd(((uint32_t)(y) << 16) | ((x) & 0xffff));\

      ftWrDispCmd(((uint32_t)(h) << 16) | (w));\

      ftWrDispCmd(((uint32_t)(val) << 16) | (options));\

      ftWrDispCmd(((uint32_t)range));\

}

参数含义与progress相同。

ftCoCmdSlider((PANEL_WIDTH / 2 - 60), (PANEL_HEIGHT / 2 - 30), 120, 12, 0, progress, 10);

ftCoCmdSlider((PANEL_WIDTH / 2 + 120), (PANEL_HEIGHT / 2 - 60), 12, 120, OPT_FLAT, progress, 10);

EVE-14 Slider Dial Toggle Number

 

2.      Dial

CMD_DIAL –绘制一个旋转拨号控制

#define ftCoCmdDial(x, y, r, options, val)\

{\

      ftWrDispCmd(CMD_SLIDER);\

      ftWrDispCmd(((uint32_t)(y) << 16) | ((x) & 0xffff));\

      ftWrDispCmd(((uint32_t)(options) << 16) | (r));\

      ftWrDispCmd((uint32_t)val);\

}

参数options支持0和OPT_FLAT,val表示拨号盘指针的位置,有效值0-65535,以正下面中间为起始点,360°等分为65535份。

ftCoCmdDial((PANEL_WIDTH / 2 - 100), (PANEL_HEIGHT / 2), 60, 0, dial * 65535 / 360);

ftCoCmdDial((PANEL_WIDTH / 2 + 100), (PANEL_HEIGHT / 2), 60, OPT_FLAT, dial * 65535 / 360);

EVE-14 Slider Dial Toggle Number

 

3.      Toggle

CMD_TOGGLE –绘制一个切换开关

#define ftCoCmdToggle(x, y, w, font, options, state, const char *s)\

{\

      uint16_t len = strlen((char *)s) + 1; \

      ftWrDispCmd(CMD_TOGGLE);\

      ftWrDispCmd(((uint32_t)(y) << 16) | ((x) & 0xffff));\

      ftWrDispCmd(((uint32_t)(font) << 16) | ((w) & 0xffff));\

      ftWrDispCmd(((uint32_t)(state) << 16) | ((options) & 0xffff));\

      ftWrDispBuf(s, len);\

}

参数x, y是开关左上角的坐标。options只支持0和OPT_FLAT。state是开关的状态,0为关,65535为开。字符串是用字符值255区隔开关的字符串。

ftWrDispCmd(TAG_MASK(1));

ftWrDispCmd(TAG(2));

if (toggle == 0)

{

      ftCoCmdToggle((PANEL_WIDTH / 2 - 20), (PANEL_HEIGHT / 2), 40, 27, 0, 0, "No""\xff""Yes");

}

else

{

      ftCoCmdToggle((PANEL_WIDTH / 2 - 20), (PANEL_HEIGHT / 2), 40, 27, 0, 65535, "No""\xff""Yes");

}

 EVE-14 Slider Dial Toggle Number

4.     Number

CMD_NUMBER –绘制一个十进位数字

#define ftCoCmdNumber(x, y, font, options, n)\

{\

      ftWrDispCmd(CMD_NUMBER);\

      ftWrDispCmd(((uint32_t)(y) << 16) | ((x) & 0xffff));\

      ftWrDispCmd(((uint32_t)(options) << 16) | (font));\

      ftWrDispCmd(n);\

}

FT80x只能显示十进制数字,FT81x可以通过命令CMD_SETBASE设置成2-36进制显示。参数n是int32或uint32的数据类型。如果是int32类型,options要增加OPT_SIGNED的参数。

ftCoCmdNumber((LCD_WIDTH / 2), (LCD_HEIGHT / 2 - 60), 27, OPT_SIGNED, -2700);

ftCoCmdNumber((LCD_WIDTH / 2), (LCD_HEIGHT / 2), 31, OPT_CENTER, 2700);

EVE-14 Slider Dial Toggle Number