240
« on: January 20, 2022, 02:11:25 PM »
Hi,
Here is a small code example.
It will tag the four circles and so when you hold your finger on them, you should see the corresponding tag displayed by the number command.
We set the clear tag to 100 and so if you touch an area of the screen outside of the circles, you'll get tag 100
With no touch, the tag will read 0
We also mask the tag so that the text and number are not tagged, this is useful if you want to turn off tagging for these after drawing the tagged items (the tag 13 for the last circle would otherwise also apply to the text and number)
Best Regards, BRT Community
uint8_t Tag = 0;
while(1)
{
EVE_LIB_BeginCoProList(); // Begin new screen
EVE_CMD_DLSTART(); // Tell co-processor to create new Display List
EVE_CLEAR_TAG(100); // Set tag to 100 for any un-tagged pixels
EVE_CLEAR_COLOR_RGB(0, 0, 0); // Specify color to clear screen to
EVE_CLEAR(1,1,1); // Clear color, stencil, and tag buffer
EVE_TAG_MASK(1); // Enable tagging
EVE_BEGIN(EVE_BEGIN_POINTS);
EVE_POINT_SIZE(800);
EVE_TAG(10);
EVE_VERTEX2F((100*16), (100*16));
EVE_TAG(11);
EVE_VERTEX2F((200*16), (100*16));
EVE_TAG(12);
EVE_VERTEX2F((300*16), (100*16));
EVE_TAG(13);
EVE_VERTEX2F((400*16), (100*16));
EVE_END();
EVE_TAG_MASK(1); // Disable tagging
EVE_CMD_TEXT(100, 200, 28, 0, "The Tag is...");
EVE_CMD_NUMBER(100, 250, 28, 0, Tag);
EVE_DISPLAY(); // Tell EVE that this is end of list
EVE_CMD_SWAP(); // Swap buffers in EVE to make this list active
EVE_LIB_EndCoProList(); // Finish the co-processor list burst write
EVE_LIB_AwaitCoProEmpty(); // Wait until co-processor has consumed all commands
Tag = HAL_MemRead8(EVE_REG_TOUCH_TAG);
}