apps/graphics/ft80x: Ooops 5 touch points, not 4. apps/examples/ft80x: Re-order to some tests.
This commit is contained in:
parent
e15526f683
commit
4eeadd7b5d
@ -157,6 +157,7 @@ int ft80x_coproc_button(int fd, FAR struct ft80x_dlbuffer_s *buffer);
|
||||
int ft80x_coproc_clock(int fd, FAR struct ft80x_dlbuffer_s *buffer);
|
||||
int ft80x_coproc_gauge(int fd, FAR struct ft80x_dlbuffer_s *buffer);
|
||||
int ft80x_coproc_keys(int fd, FAR struct ft80x_dlbuffer_s *buffer);
|
||||
int ft80x_coproc_interactive(int fd, FAR struct ft80x_dlbuffer_s *buffer);
|
||||
int ft80x_coproc_progressbar(int fd, FAR struct ft80x_dlbuffer_s *buffer);
|
||||
int ft80x_coproc_scrollbar(int fd, FAR struct ft80x_dlbuffer_s *buffer);
|
||||
int ft80x_coproc_slider(int fd, FAR struct ft80x_dlbuffer_s *buffer);
|
||||
@ -169,7 +170,6 @@ int ft80x_coproc_spinner(int fd, FAR struct ft80x_dlbuffer_s *buffer);
|
||||
#endif
|
||||
int ft80x_coproc_screensaver(int fd, FAR struct ft80x_dlbuffer_s *buffer);
|
||||
int ft80x_coproc_logo(int fd, FAR struct ft80x_dlbuffer_s *buffer);
|
||||
int ft80x_coproc_interactive(int fd, FAR struct ft80x_dlbuffer_s *buffer);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
|
@ -1833,6 +1833,373 @@ int ft80x_coproc_keys(int fd, FAR struct ft80x_dlbuffer_s *buffer)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ft80x_coproc_interactive
|
||||
*
|
||||
* Description:
|
||||
* Demonstrate the keys HMI interactions
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int ft80x_coproc_interactive(int fd, FAR struct ft80x_dlbuffer_s *buffer)
|
||||
{
|
||||
int16_t fontid;
|
||||
int16_t width ;
|
||||
int16_t height;
|
||||
int16_t ydist;
|
||||
int16_t yoffset;
|
||||
char text[INTERACTIVE_TEXTSIZE];
|
||||
char ch = '|';
|
||||
uint8_t currtag = 0;
|
||||
uint8_t prevtag = 0;
|
||||
int32_t textndx = 0;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
/* Formatted output chunks */
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
struct ft80x_cmd32_s clearrgb;
|
||||
struct ft80x_cmd32_s clear;
|
||||
struct ft80x_cmd32_s colorrgb;
|
||||
} a;
|
||||
struct
|
||||
{
|
||||
struct ft80x_cmd32_s tagmask;
|
||||
struct ft80x_cmd_text_s text;
|
||||
} b;
|
||||
struct
|
||||
{
|
||||
struct ft80x_cmd32_s tagmask;
|
||||
struct ft80x_cmd_gradcolor_s gradcolor;
|
||||
struct ft80x_cmd_keys_s keys;
|
||||
} c;
|
||||
struct
|
||||
{
|
||||
struct ft80x_cmd_gradcolor_s gradcolor;
|
||||
struct ft80x_cmd_keys_s keys;
|
||||
} d;
|
||||
struct
|
||||
{
|
||||
struct ft80x_cmd32_s tag;
|
||||
struct ft80x_cmd_button_s button;
|
||||
} e;
|
||||
struct
|
||||
{
|
||||
struct ft80x_cmd32_s colora;
|
||||
struct ft80x_cmd_keys_s keys;
|
||||
} f;
|
||||
struct ft80x_cmd_keys_s keys;
|
||||
} cmds;
|
||||
|
||||
#ifdef CONFIG_LCD_FT80X_QVGA
|
||||
fontid = 27;
|
||||
width = 22;
|
||||
height = 22;
|
||||
ydist = 3;
|
||||
#else
|
||||
fontid = 29;
|
||||
width = 30;
|
||||
height = 30;
|
||||
ydist = 5;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 600; i++)
|
||||
{
|
||||
/* Check the user input and then add the characters into array.
|
||||
* Hmmm... a better example might use the FT80X_IOC_EVENTNOTIFY ioctl
|
||||
* command to wait for a touch event.
|
||||
*/
|
||||
|
||||
currtag = ft80x_touch_tag(fd);
|
||||
|
||||
ch = currtag;
|
||||
if (currtag == 0)
|
||||
{
|
||||
/* No touch */
|
||||
|
||||
ch = '|';
|
||||
|
||||
/* Check if we lost the touch */
|
||||
|
||||
if (prevtag != 0)
|
||||
{
|
||||
textndx++;
|
||||
|
||||
/* Clear all the characters after 100 are pressed */
|
||||
|
||||
if (textndx > 24)
|
||||
{
|
||||
textndx = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Create the hardware display list */
|
||||
|
||||
ret = ft80x_dl_start(fd, buffer, true);
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_start failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cmds.a.clearrgb.cmd = FT80X_CLEAR_COLOR_RGB(64, 64, 64);
|
||||
cmds.a.clear.cmd = FT80X_CLEAR(1 ,1, 1);
|
||||
cmds.a.colorrgb.cmd = FT80X_COLOR_RGB(0xff, 0xff, 0xff);
|
||||
|
||||
/* Copy the commands into the display list */
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.a, sizeof(cmds.a));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Draw text entered by user */
|
||||
/* Make sure the array is a NUL terminated string */
|
||||
|
||||
text[textndx] = ch;
|
||||
text[textndx + 1] = '\0';
|
||||
|
||||
cmds.b.tagmask.cmd = FT80X_TAG_MASK(0);
|
||||
|
||||
cmds.b.text.cmd = FT80X_CMD_TEXT; /* Text */
|
||||
cmds.b.text.x = FT80X_DISPLAY_WIDTH / 2;
|
||||
cmds.b.text.y = 40;
|
||||
cmds.b.text.font = fontid;
|
||||
cmds.b.text.options = FT80X_OPT_CENTER;
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.b, sizeof(cmds.b));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, text);
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cmds.c.tagmask.cmd = FT80X_TAG_MASK(1);
|
||||
|
||||
/* Construct a simple keyboard - note that the tags associated with
|
||||
* the keys are the character values given in the arguments.
|
||||
*/
|
||||
|
||||
yoffset = 80 + 10;
|
||||
|
||||
cmds.c.gradcolor.cmd = FT80X_CMD_GRADCOLOR; /* Gradient color */
|
||||
cmds.c.gradcolor.c = 0x00ffff;
|
||||
|
||||
cmds.c.keys.cmd = FT80X_CMD_KEYS; /* Keys */
|
||||
cmds.c.keys.x = ydist;
|
||||
cmds.c.keys.y = yoffset;
|
||||
cmds.c.keys.w = 10 * width;
|
||||
cmds.c.keys.h = height;
|
||||
cmds.c.keys.font = fontid;
|
||||
cmds.c.keys.options = (FT80X_OPT_CENTER | currtag);
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.c, sizeof(cmds.c));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "qwertyuiop");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset += height + ydist;
|
||||
|
||||
cmds.d.gradcolor.cmd = FT80X_CMD_GRADCOLOR; /* Gradient color */
|
||||
cmds.d.gradcolor.c = 0x00ffff;
|
||||
|
||||
cmds.d.keys.cmd = FT80X_CMD_KEYS; /* Keys */
|
||||
cmds.d.keys.x = ydist;
|
||||
cmds.d.keys.y = yoffset;
|
||||
cmds.d.keys.w = 10 * width;
|
||||
cmds.d.keys.h = height;
|
||||
cmds.d.keys.font = fontid;
|
||||
cmds.d.keys.options = (FT80X_OPT_CENTER | currtag);
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.d, sizeof(cmds.d));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "asdfghijkl");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset += height + ydist;
|
||||
cmds.d.gradcolor.c = 0xffff00;
|
||||
cmds.d.keys.y = yoffset;
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.d, sizeof(cmds.d));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "zxcvbnm");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset += height + ydist;
|
||||
|
||||
cmds.e.tag.cmd = FT80X_TAG(' ');
|
||||
|
||||
cmds.e.button.cmd = FT80X_CMD_BUTTON;
|
||||
cmds.e.button.x = ydist;
|
||||
cmds.e.button.y = yoffset;
|
||||
cmds.e.button.w = 10 *width;
|
||||
cmds.e.button.h = height;
|
||||
cmds.e.button.font = fontid;
|
||||
|
||||
if (currtag == ' ')
|
||||
{
|
||||
cmds.e.button.options = (FT80X_OPT_CENTER | FT80X_OPT_FLAT);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmds.e.button.options = FT80X_OPT_CENTER;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.e, sizeof(cmds.e));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, " ");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset = 80 + 10;
|
||||
|
||||
cmds.keys.cmd = FT80X_CMD_KEYS; /* Keys */
|
||||
cmds.keys.x = 11 * width;
|
||||
cmds.keys.y = yoffset;
|
||||
cmds.keys.w = 3 * width;
|
||||
cmds.keys.h = height;
|
||||
cmds.keys.font = fontid;
|
||||
cmds.keys.options = (0 | currtag);
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.keys, sizeof(cmds.keys));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "789");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset += height + ydist;
|
||||
cmds.keys.y = yoffset;
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.keys, sizeof(cmds.keys));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "456");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset += height + ydist;
|
||||
cmds.keys.y = yoffset;
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.keys, sizeof(cmds.keys));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "123");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset += height + ydist;
|
||||
|
||||
cmds.f.colora.cmd = FT80X_COLOR_A(255);
|
||||
|
||||
cmds.f.keys.cmd = FT80X_CMD_KEYS; /* Keys */
|
||||
cmds.f.keys.x = 11 * width;
|
||||
cmds.f.keys.y = yoffset;
|
||||
cmds.f.keys.w = 3 * width;
|
||||
cmds.f.keys.h = height;
|
||||
cmds.f.keys.font = fontid;
|
||||
cmds.f.keys.options = (9 | currtag);
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.f, sizeof(cmds.f));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "0.");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Terminate the display list */
|
||||
|
||||
ret = ft80x_dl_end(fd, buffer);
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_end failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
usleep(10 * 1000);
|
||||
prevtag = currtag;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
/****************************************************************************
|
||||
* Name: ft80x_coproc_progressbar
|
||||
*
|
||||
@ -4105,370 +4472,3 @@ int ft80x_coproc_logo(int fd, FAR struct ft80x_dlbuffer_s *buffer)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ft80x_coproc_interactive
|
||||
*
|
||||
* Description:
|
||||
* Demonstrate the keys HMI interactions
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int ft80x_coproc_interactive(int fd, FAR struct ft80x_dlbuffer_s *buffer)
|
||||
{
|
||||
int16_t fontid;
|
||||
int16_t width ;
|
||||
int16_t height;
|
||||
int16_t ydist;
|
||||
int16_t yoffset;
|
||||
char text[INTERACTIVE_TEXTSIZE];
|
||||
char ch = '|';
|
||||
uint8_t currtag = 0;
|
||||
uint8_t prevtag = 0;
|
||||
int32_t textndx = 0;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
/* Formatted output chunks */
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
struct ft80x_cmd32_s clearrgb;
|
||||
struct ft80x_cmd32_s clear;
|
||||
struct ft80x_cmd32_s colorrgb;
|
||||
} a;
|
||||
struct
|
||||
{
|
||||
struct ft80x_cmd32_s tagmask;
|
||||
struct ft80x_cmd_text_s text;
|
||||
} b;
|
||||
struct
|
||||
{
|
||||
struct ft80x_cmd32_s tagmask;
|
||||
struct ft80x_cmd_gradcolor_s gradcolor;
|
||||
struct ft80x_cmd_keys_s keys;
|
||||
} c;
|
||||
struct
|
||||
{
|
||||
struct ft80x_cmd_gradcolor_s gradcolor;
|
||||
struct ft80x_cmd_keys_s keys;
|
||||
} d;
|
||||
struct
|
||||
{
|
||||
struct ft80x_cmd32_s tag;
|
||||
struct ft80x_cmd_button_s button;
|
||||
} e;
|
||||
struct
|
||||
{
|
||||
struct ft80x_cmd32_s colora;
|
||||
struct ft80x_cmd_keys_s keys;
|
||||
} f;
|
||||
struct ft80x_cmd_keys_s keys;
|
||||
} cmds;
|
||||
|
||||
#ifdef CONFIG_LCD_FT80X_QVGA
|
||||
fontid = 27;
|
||||
width = 22;
|
||||
height = 22;
|
||||
ydist = 3;
|
||||
#else
|
||||
fontid = 29;
|
||||
width = 30;
|
||||
height = 30;
|
||||
ydist = 5;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 600; i++)
|
||||
{
|
||||
/* Check the user input and then add the characters into array.
|
||||
* Hmmm... a better example might use the FT80X_IOC_EVENTNOTIFY ioctl
|
||||
* command to wait for a touch event.
|
||||
*/
|
||||
|
||||
currtag = ft80x_touch_tag(fd);
|
||||
|
||||
ch = currtag;
|
||||
if (currtag == 0)
|
||||
{
|
||||
/* No touch */
|
||||
|
||||
ch = '|';
|
||||
|
||||
/* Check if we lost the touch */
|
||||
|
||||
if (prevtag != 0)
|
||||
{
|
||||
textndx++;
|
||||
|
||||
/* Clear all the characters after 100 are pressed */
|
||||
|
||||
if (textndx > 24)
|
||||
{
|
||||
textndx = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Create the hardware display list */
|
||||
|
||||
ret = ft80x_dl_start(fd, buffer, true);
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_start failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cmds.a.clearrgb.cmd = FT80X_CLEAR_COLOR_RGB(64, 64, 64);
|
||||
cmds.a.clear.cmd = FT80X_CLEAR(1 ,1, 1);
|
||||
cmds.a.colorrgb.cmd = FT80X_COLOR_RGB(0xff, 0xff, 0xff);
|
||||
|
||||
/* Copy the commands into the display list */
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.a, sizeof(cmds.a));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Draw text entered by user */
|
||||
/* Make sure the array is a NUL terminated string */
|
||||
|
||||
text[textndx] = ch;
|
||||
text[textndx + 1] = '\0';
|
||||
|
||||
cmds.b.tagmask.cmd = FT80X_TAG_MASK(0);
|
||||
|
||||
cmds.b.text.cmd = FT80X_CMD_TEXT; /* Text */
|
||||
cmds.b.text.x = FT80X_DISPLAY_WIDTH / 2;
|
||||
cmds.b.text.y = 40;
|
||||
cmds.b.text.font = fontid;
|
||||
cmds.b.text.options = FT80X_OPT_CENTER;
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.b, sizeof(cmds.b));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, text);
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cmds.c.tagmask.cmd = FT80X_TAG_MASK(1);
|
||||
|
||||
/* Construct a simple keyboard - note that the tags associated with
|
||||
* the keys are the character values given in the arguments.
|
||||
*/
|
||||
|
||||
yoffset = 80 + 10;
|
||||
|
||||
cmds.c.gradcolor.cmd = FT80X_CMD_GRADCOLOR; /* Gradient color */
|
||||
cmds.c.gradcolor.c = 0x00ffff;
|
||||
|
||||
cmds.c.keys.cmd = FT80X_CMD_KEYS; /* Keys */
|
||||
cmds.c.keys.x = ydist;
|
||||
cmds.c.keys.y = yoffset;
|
||||
cmds.c.keys.w = 10 * width;
|
||||
cmds.c.keys.h = height;
|
||||
cmds.c.keys.font = fontid;
|
||||
cmds.c.keys.options = (FT80X_OPT_CENTER | currtag);
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.c, sizeof(cmds.c));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "qwertyuiop");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset += height + ydist;
|
||||
|
||||
cmds.d.gradcolor.cmd = FT80X_CMD_GRADCOLOR; /* Gradient color */
|
||||
cmds.d.gradcolor.c = 0x00ffff;
|
||||
|
||||
cmds.d.keys.cmd = FT80X_CMD_KEYS; /* Keys */
|
||||
cmds.d.keys.x = ydist;
|
||||
cmds.d.keys.y = yoffset;
|
||||
cmds.d.keys.w = 10 * width;
|
||||
cmds.d.keys.h = height;
|
||||
cmds.d.keys.font = fontid;
|
||||
cmds.d.keys.options = (FT80X_OPT_CENTER | currtag);
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.d, sizeof(cmds.d));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "asdfghijkl");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset += height + ydist;
|
||||
cmds.d.gradcolor.c = 0xffff00;
|
||||
cmds.d.keys.y = yoffset;
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.d, sizeof(cmds.d));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "zxcvbnm");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset += height + ydist;
|
||||
|
||||
cmds.e.tag.cmd = FT80X_TAG(' ');
|
||||
|
||||
cmds.e.button.cmd = FT80X_CMD_BUTTON;
|
||||
cmds.e.button.x = ydist;
|
||||
cmds.e.button.y = yoffset;
|
||||
cmds.e.button.w = 10 *width;
|
||||
cmds.e.button.h = height;
|
||||
cmds.e.button.font = fontid;
|
||||
|
||||
if (currtag == ' ')
|
||||
{
|
||||
cmds.e.button.options = (FT80X_OPT_CENTER | FT80X_OPT_FLAT);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmds.e.button.options = FT80X_OPT_CENTER;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.e, sizeof(cmds.e));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, " ");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset = 80 + 10;
|
||||
|
||||
cmds.keys.cmd = FT80X_CMD_KEYS; /* Keys */
|
||||
cmds.keys.x = 11 * width;
|
||||
cmds.keys.y = yoffset;
|
||||
cmds.keys.w = 3 * width;
|
||||
cmds.keys.h = height;
|
||||
cmds.keys.font = fontid;
|
||||
cmds.keys.options = (0 | currtag);
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.keys, sizeof(cmds.keys));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "789");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset += height + ydist;
|
||||
cmds.keys.y = yoffset;
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.keys, sizeof(cmds.keys));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "456");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset += height + ydist;
|
||||
cmds.keys.y = yoffset;
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.keys, sizeof(cmds.keys));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "123");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
yoffset += height + ydist;
|
||||
|
||||
cmds.f.colora.cmd = FT80X_COLOR_A(255);
|
||||
|
||||
cmds.f.keys.cmd = FT80X_CMD_KEYS; /* Keys */
|
||||
cmds.f.keys.x = 11 * width;
|
||||
cmds.f.keys.y = yoffset;
|
||||
cmds.f.keys.w = 3 * width;
|
||||
cmds.f.keys.h = height;
|
||||
cmds.f.keys.font = fontid;
|
||||
cmds.f.keys.options = (9 | currtag);
|
||||
|
||||
ret = ft80x_dl_data(fd, buffer, &cmds.f, sizeof(cmds.f));
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_dl_string(fd, buffer, "0.");
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Terminate the display list */
|
||||
|
||||
ret = ft80x_dl_end(fd, buffer);
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_dl_end failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
usleep(10 * 1000);
|
||||
prevtag = currtag;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ static const struct ft80x_exampleinfo_s g_primitives[] =
|
||||
* ft80x_coproc_clock CMD_CLOCK Draw an analog clock
|
||||
* ft80x_coproc_gauge CMD_GAUGE Draw a gauge
|
||||
* ft80x_coproc_keys CMD_KEYS Draw a row of keys
|
||||
* ft80x_coproc_interactive CMD_KEYS Interactive keys
|
||||
* ft80x_coproc_progressbar CMD_PROGRESS Draw a progress bar
|
||||
* ft80x_coproc_scrollbar CMD_SCROLLBAR Draw a scroll bar
|
||||
* ft80x_coproc_slider CMD_SLIDER Draw a slider
|
||||
@ -126,7 +127,6 @@ static const struct ft80x_exampleinfo_s g_primitives[] =
|
||||
* (To be provided) CMD_SNAPSHOT Take a snapshot of the current
|
||||
screen
|
||||
* ft80x_coproc_logo CMD_LOGO Play device log animation
|
||||
* ft80x_coproc_interactive CMD_KEYS Interactive keys
|
||||
*/
|
||||
|
||||
static const struct ft80x_exampleinfo_s g_coproc[] =
|
||||
@ -135,6 +135,7 @@ static const struct ft80x_exampleinfo_s g_coproc[] =
|
||||
{ "Clock", ft80x_coproc_clock },
|
||||
{ "Gauge", ft80x_coproc_gauge },
|
||||
{ "Keys", ft80x_coproc_keys },
|
||||
{ "Interactive", ft80x_coproc_interactive },
|
||||
{ "Progress Bar", ft80x_coproc_progressbar },
|
||||
{ "Scroll Bar", ft80x_coproc_scrollbar },
|
||||
{ "Slider", ft80x_coproc_slider },
|
||||
@ -146,8 +147,7 @@ static const struct ft80x_exampleinfo_s g_coproc[] =
|
||||
#ifndef CONFIG_EXAMPLES_FT80X_EXCLUDE_BITMAPS
|
||||
{ "Screen Saver", ft80x_coproc_screensaver },
|
||||
#endif
|
||||
{ "Logo", ft80x_coproc_logo },
|
||||
{ "Interactive", ft80x_coproc_interactive },
|
||||
{ "Logo", ft80x_coproc_logo }
|
||||
};
|
||||
|
||||
#define NCOPROC (sizeof(g_primitives) / sizeof(ft80x_example_t))
|
||||
|
@ -383,6 +383,22 @@ int ft80x_touch_info(int fd, FAR struct ft80x_touchinfo_s *info)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Read the FT80X_REG_CTOUCH_TOUCH4_X and Y registers */
|
||||
|
||||
ret = ft80x_getreg16(fd, FT80X_REG_CTOUCH_TOUCH4_X, &info->pos[4].u.x);
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_getreg16 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ft80x_getreg16(fd, FT80X_REG_CTOUCH_TOUCH4_Y, &info->pos[4].u.y);
|
||||
if (ret < 0)
|
||||
{
|
||||
ft80x_err("ERROR: ft80x_getreg16 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_LCD_FT801_MULTITOUCH */
|
||||
#endif /* CONFIG_LCD_FT800/1 */
|
||||
|
||||
|
@ -92,7 +92,7 @@ struct ft80x_touchinfo_s
|
||||
#if defined(CONFIG_LCD_FT800) || !defined(CONFIG_LCD_FT801_MULTITOUCH)
|
||||
union ft80x_touchpos_u pos; /* Current touch position */
|
||||
#else
|
||||
union ft80x_touchpos_u pos[4]; /* Current touch position for up to 4 touches */
|
||||
union ft80x_touchpos_u pos[4]; /* Current touch position for up to 5 touches */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user