——From DWIN Developer Forum
In this issue, we will introduce the award-winning open source case of the DWIN Developer Forum – Interval Gesture Recognition Test System. Engineers use a 7-inch COF smart screen to interact with the PAJ7620U2 gesture recognition sensor through the T5L OS core. There is no need to use any buttons. You only need to put your hand close to the sensor to enter the menu system control screen, and realize 9 gesture effects of up, down, left, right, close, far away, left rotation, right rotation, and wave.
1.UI Material Display
2.C51 Engineering Design
The T5L OS core interacts with the PAJ7620U2 gesture recognition sensor for data interaction, detects the current gesture, determines the currently displayed picture and the picture displayed by turning the page, and realizes the function of switching pages using gestures. The reference code is as follows:
void select_operate(uint16_t gesrure_value)
{
if(gesrure_value == GES_UP) //up
{
if(select_value >= 2)
{
select_value -= 2;
}
dgus_show_variate_icon_location_set(SELECT_DESCRIBE_RECTANGLE, select_pos[select_value][0], select_pos[select_value][1]);
}
else if(gesrure_value == GES_DOWN) //down
{
if(select_value <= 1)
{
select_value += 2;
}
dgus_show_variate_icon_location_set(SELECT_DESCRIBE_RECTANGLE, select_pos[select_value][0], select_pos[select_value][1]);
}
else if(gesrure_value == GES_LEFT) //left
{
if(select_value % 2 == 1)
{
select_value -= 1;
}
dgus_show_variate_icon_location_set(SELECT_DESCRIBE_RECTANGLE, select_pos[select_value][0], select_pos[select_value][1]);
}
else if(gesrure_value == GES_RIGHT) //right
{
if(select_value % 2 == 0)
{
select_value += 1;
}
dgus_show_variate_icon_location_set(SELECT_DESCRIBE_RECTANGLE, select_pos[select_value][0], select_pos[select_value][1]);
}
}
void turning_operate(uint16_t gesrure_value)
{
uint16_t i = 0;
uint8_t turning_mode = 0; // Page turning mode, 0 up, 1 down, 2 left, 3 right
uint16_t turning_count = 0; // Last number of page turns
if(gesrure_value == GES_UP || gesrure_value == GES_DOWN || gesrure_value == GES_LEFT || gesrure_value == GES_RIGHT)
{
if(gesrure_value == GES_UP) //up
{
turning_mode = 0;
turning_count = 48;
}
else if(gesrure_value == GES_DOWN) //down
{
turning_mode = 1;
turning_count = 48;
}
else if(gesrure_value == GES_LEFT) //left
{
turning_mode = 2;
turning_count = 80;
}
else if(gesrure_value == GES_RIGHT) //right
{
turning_mode = 3;
turning_count = 80;
}
if(turning_current_image == 0 || turning_current_image == 2)
{
turning_current_image = 1;
}
else
{
turning_current_image = 2;
}
for(i = 0;i <= turning_count;i++)
{
switch(turning_mode)
{
case 0:
dgus_show_variate_icon_location_set(turning_current_image * 0x100 + 0x2000, 0, 480 - i * 10);
t5l0_sys_delay_ms(20);
if(turning_last_image != 0)
{
dgus_show_variate_icon_location_set(turning_last_image * 0x100 + 0x2000, 0, 0 - i * 10);
}
break;
case 1:
dgus_show_variate_icon_location_set(turning_current_image * 0x100 + 0x2000, 0, -480 + i * 10);
t5l0_sys_delay_ms(20);
if(turning_last_image != 0)
{
dgus_show_variate_icon_location_set(turning_last_image * 0x100 + 0x2000, 0, 0 + i * 10);
}
break;
case 2:
dgus_show_variate_icon_location_set(turning_current_image * 0x100 + 0x2000, 800 - i * 10, 0);
t5l0_sys_delay_ms(20);
if(turning_last_image != 0)
{
dgus_show_variate_icon_location_set(turning_last_image * 0x100 + 0x2000, 0 - i * 10, 0);
}
break;
case 3:
dgus_show_variate_icon_location_set(turning_current_image * 0x100 + 0x2000, -800 + i * 10, 0);
t5l0_sys_delay_ms(20);
if(turning_last_image != 0)
{
dgus_show_variate_icon_location_set(turning_last_image * 0x100 + 0x2000, 0 + i * 10, 0);
}
break;
}
t5l0_sys_delay_ms(20);
}
turning_last_image = turning_current_image;
}
}
Post time: Mar-21-2024