Synergy S7G2 Capacitive Touch Screen Calibration using FT5X16

Hi 

   I am using a capacitive touch screen similar to the one used in PE-HMI board. The LCD is working fine even the CTP panel is responding so no hardware issues.

The touch events are working till x and y coordinates are 478 and 478 (approx 480) after that i am not getting any events only coordinates are transmitted on the virtual terminal. 

since i am getting coordinates for my 800X480 panel I am not able to figure out why it is not registering events beyond 480X480.

For reference the virtual log is attached.

 

Virtual Com log2.log
touch_panel_thread_entry started
touch panel down
touch panel x = 1 & y = 10
touch panel up
touch panel x = 1 & y = 7
touch panel down
touch panel x = 473 & y = 11
touch panel up
touch panel x = 470 & y = 14
touch panel down
touch panel x = 8 & y = 196
touch panel up
touch panel x = 9 & y = 192
touch panel down
touch panel x = 10 & y = 291
touch panel up
touch panel x = 9 & y = 292
touch panel down
touch panel x = 5 & y = 398
touch panel up
touch panel x = 6 & y = 396
touch panel down
touch panel x = 6 & y = 438
touch panel up
touch panel x = 5 & y = 436
touch panel up
touch panel x = 5 & y = 436
touch panel down
touch panel x = 6 & y = 469
touch panel up
touch panel x = 5 & y = 469
touch panel x = 1 & y = 481
touch panel up
touch panel x = 3 & y = 479
touch panel x = 6 & y = 526
touch panel x = 8 & y = 546
touch panel x = 6 & y = 549
touch panel x = 26 & y = 584
touch panel x = 28 & y = 595
touch panel x = 44 & y = 606
touch panel x = 38 & y = 628
touch panel x = 10 & y = 677
touch panel x = 14 & y = 692
touch panel x = 33 & y = 700
touch panel x = 31 & y = 754
touch panel x = 24 & y = 794
touch panel x = 187 & y = 563
touch panel x = 185 & y = 564
touch panel x = 303 & y = 590
touch panel x = 403 & y = 568
touch panel x = 473 & y = 518
touch panel x = 471 & y = 513
touch panel x = 470 & y = 630
touch panel x = 470 & y = 690
touch panel x = 471 & y = 735
touch panel x = 472 & y = 731
touch panel x = 463 & y = 747
touch panel x = 473 & y = 781
touch panel x = 473 & y = 797
touch panel x = 472 & y = 557
touch panel x = 473 & y = 557
touch panel down
touch panel x = 470 & y = 451
touch panel up
touch panel x = 472 & y = 459
touch panel up
touch panel x = 472 & y = 459
touch panel down
touch panel x = 472 & y = 360
touch panel up
touch panel x = 471 & y = 359
touch panel up
touch panel x = 471 & y = 359
touch panel down
touch panel x = 458 & y = 203
touch panel up
touch panel x = 456 & y = 199
touch panel down
touch panel x = 283 & y = 378
touch panel up
touch panel x = 280 & y = 369
touch panel up
touch panel x = 280 & y = 369
touch panel down
touch panel x = 247 & y = 415
touch panel up
touch panel x = 246 & y = 411
touch panel down
touch panel x = 275 & y = 479
touch panel up
touch panel x = 271 & y = 479
touch panel x = 225 & y = 576
touch panel x = 228 & y = 574
touch panel x = 224 & y = 617
touch panel x = 178 & y = 671
touch panel x = 147 & y = 685
touch panel x = 250 & y = 716
touch panel x = 252 & y = 721
touch panel x = 312 & y = 741
touch panel x = 313 & y = 740
touch panel x = 424 & y = 738
touch panel x = 207 & y = 748
touch panel x = 207 & y = 747
touch panel x = 25 & y = 791
touch panel x = 14 & y = 790
touch panel x = 9 & y = 791
touch panel x = 213 & y = 753
touch panel x = 297 & y = 741
touch panel x = 428 & y = 737
touch panel x = 423 & y = 733

  • Hi Pranav,

    >since i am getting coordinates for my 800X480 panel I am not able to figure out why it is not registering events beyond 480X480.

    Have you changed display size both settings on SSP and GUIX?
    If you only change them on SSP, GUIX system doesn't know real display size.

     

  • In reply to tenballs:

    Hi I have checked it already I am getting the display screen as 800x480 and set 800 and 480 on touch panel framework as well.
  • In reply to Pranav:

    Sorry, you seem you have changed the settings on display driver also.

     

    >Hi I have checked it already I am getting the display screen as 800x480 and set 800 and 480 on touch panel framework as well.

     

    I am afraid you misunderstand your display size.

    The default size of graphic screen2 is 800 x 480, not 480 x 800 like your display.

    So you should swap the size of vertical and horizontal. 

     

  • In reply to tenballs:

       I have checked the settings all the settings are set to 800X480 in all the three parameters.

    The log file i sent is from the touch calibration example code provided by renesas there is no display involved.

    I used the calibration program because i was not getting proper response from the CTP on display.

    I am not able to figure out why it stops registering PANEL UP DOWN or HOLD MOVE events beyond 478.  though it is registering all the coordinates why it does not take events beyond 480 X 480.

    Here is the event registering code. also i have attached the parameter screen shots that you mentioned

    while(1)

    {

    ssp_err_t        err;

    sf_message_header_t * p_message = NULL;

    err = g_sf_message0.p_api->pend(g_sf_message0.p_ctrl, &touch_panel_thread_message_queue, (sf_message_header_t **) &p_message,TX_WAIT_FOREVER);

    if (err)

    {

    /** TODO: Handle error. */

    }

    switch (p_message->event_b.class_code)

    {

    case SF_MESSAGE_EVENT_CLASS_TOUCH:

    {

    switch (p_message->event_b.code)

    {

    case SF_MESSAGE_EVENT_NEW_DATA:

    {

    const sf_touch_panel_payload_t * p_touch_payload = (sf_touch_panel_payload_t *) p_message;

    switch (p_touch_payload->event_type)

    {

    case SF_TOUCH_PANEL_EVENT_DOWN:

    //g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_00 , IOPORT_LEVEL_LOW);

    //g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_01 , IOPORT_LEVEL_HIGH);

    //g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_02 , IOPORT_LEVEL_HIGH);

    #ifdef SEMI_HOSTING

    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)

    {

    //Debugger is connected

    printf("touch panel down\r\n");

    }

    #endif

    break;

    case SF_TOUCH_PANEL_EVENT_UP:

    //g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_00 , IOPORT_LEVEL_HIGH);

    //g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_01 , IOPORT_LEVEL_HIGH);

    //g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_02 , IOPORT_LEVEL_HIGH);

    #ifdef SEMI_HOSTING

    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)

    {

    //Debugger is connected

    printf("touch panel up\r\n");

    }

    #endif

    break;

    case SF_TOUCH_PANEL_EVENT_HOLD:

    //g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_00 , IOPORT_LEVEL_LOW);

    //g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_01 , IOPORT_LEVEL_LOW);

    //g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_02 , IOPORT_LEVEL_HIGH);

    #ifdef SEMI_HOSTING

    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)

    {

    //Debugger is connected

    printf("touch panel hold\r\n");

    }

    #endif

    break;

    case SF_TOUCH_PANEL_EVENT_MOVE:

    //g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_00 , IOPORT_LEVEL_LOW);

    //g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_01 , IOPORT_LEVEL_HIGH);

    //g_ioport.p_api->pinWrite(IOPORT_PORT_06_PIN_02 , IOPORT_LEVEL_LOW);

    #ifdef SEMI_HOSTING

    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)

    {

    //Debugger is connected

    printf("touch panel move\r\n");

    }

    #endif

    break;

    case SF_TOUCH_PANEL_EVENT_INVALID:

    break;

    default:

    break;

    }

    #ifdef SEMI_HOSTING

    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)

    {

    //Debugger is connected

    printf("touch panel x = %d & y = %d\r\n",p_touch_payload->x,p_touch_payload->y);

    }

    #endif

    }

    default:

    break;

    }

    break;

    }

    default:

    break;

    }

    /** Message is processed, so release buffer. */

    err = g_sf_message0.p_api->bufferRelease(g_sf_message0.p_ctrl, (sf_message_header_t *) p_message, SF_MESSAGE_RELEASE_OPTION_FORCED_RELEASE);

    if (SSP_SUCCESS != err)

    {

    #ifdef SEMI_HOSTING

    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)

    {

    //Debugger is connected

    printf("g_sf_message0.p_api->bufferRelease failed - error = 0x%x\r\n",err);

    }

    #endif

    while(1)

    {

    }

    }

    }

    }

  • In reply to Pranav:

    >I have checked the settings all the settings are set to 800X480 in all the three parameters.
    I mean you should set 480 for x-axis and 800 for y-axis.
    Let's have a look line 106 in virtual log.
    Y-value is 791.

    ---------------------------------------------
    touch panel x = 9 & y = 791
    ----------------------------------------------

    The default setting presumes 800 for x-axis and 480 for y-axis.
    So you need to swap x-size with y-size of each display setting.
  • In reply to Pranav:

    Maybe do you mean you want to use same display size as PE-HMI?
    Then you have to swap x with y in touch panel message process function.

    See the below sample code snippet.
    If the board type is SK-S7G2 or PK-S5D9, the code do swapping x with y.

    >#if defined(BSP_BOARD_S7G2_SK) || defined(BSP_BOARD_S5D9_PK)
    > gx_event->gx_event_payload.gx_event_pointdata.gx_point_y = (GX_VALUE)(320 - p_touch_payload->y); // SK-S7G2, PK_S5D9
    >#else
    > gx_event->gx_event_payload.gx_event_pointdata.gx_point_y = p_touch_payload->y; // DK-S7G2, PE-HMI1
    >#endif


    ---------- in main_thread_entry() ----------------------------
    while(1)
    {
    bool new_gui_event = false;

    err = g_sf_message0.p_api->pend(g_sf_message0.p_ctrl, &main_thread_message_queue, (sf_message_header_t **) &p_message, TX_WAIT_FOREVER);
    if (err)
    {
    /** TODO: Handle error. */
    }

    switch (p_message->event_b.class_code)
    {
    case SF_MESSAGE_EVENT_CLASS_TOUCH:
    {
    switch (p_message->event_b.code)
    {
    case SF_MESSAGE_EVENT_NEW_DATA:
    {
    /** Translate an SSP touch event into a GUIX event */
    new_gui_event = ssp_touch_to_guix((sf_touch_panel_payload_t*)p_message, &g_gx_event);
    }
    default:
    break;
    }
    break;
    }
    default:
    break;
    }

    /** Message is processed, so release buffer. */
    err = g_sf_message0.p_api->bufferRelease(g_sf_message0.p_ctrl, (sf_message_header_t *) p_message, SF_MESSAGE_RELEASE_OPTION_FORCED_RELEASE);

    if (err)
    {
    /** TODO: Handle error. */
    }

    /** Post message. */
    if (new_gui_event) {
    gx_system_event_send(&g_gx_event);
    }
    }
    --------------------------------------------------

    --------------------------------------------------
    static bool ssp_touch_to_guix(sf_touch_panel_payload_t * p_touch_payload, GX_EVENT * gx_event)
    {
    bool send_event = true;

    switch (p_touch_payload->event_type)
    {
    case SF_TOUCH_PANEL_EVENT_DOWN:
    gx_event->gx_event_type = GX_EVENT_PEN_DOWN;
    break;
    case SF_TOUCH_PANEL_EVENT_UP:
    gx_event->gx_event_type = GX_EVENT_PEN_UP;
    break;
    case SF_TOUCH_PANEL_EVENT_HOLD:
    case SF_TOUCH_PANEL_EVENT_MOVE:
    gx_event->gx_event_type = GX_EVENT_PEN_DRAG;
    break;
    case SF_TOUCH_PANEL_EVENT_INVALID:
    send_event = false;
    break;
    default:
    break;
    }

    if (send_event)
    {
    /** Send event to GUI */
    gx_event->gx_event_sender = GX_ID_NONE;
    gx_event->gx_event_target = 0;
    gx_event->gx_event_display_handle = 0;

    gx_event->gx_event_payload.gx_event_pointdata.gx_point_x = p_touch_payload->x;

    #if defined(BSP_BOARD_S7G2_SK) || defined(BSP_BOARD_S5D9_PK)
    gx_event->gx_event_payload.gx_event_pointdata.gx_point_y = (GX_VALUE)(320 - p_touch_payload->y); // SK-S7G2, PK_S5D9
    #else
    gx_event->gx_event_payload.gx_event_pointdata.gx_point_y = p_touch_payload->y; // DK-S7G2, PE-HMI1
    #endif

    /* get corrected coordinate */
    if(g_calibration_done)
    {
    calibration_get_coordinate((uint16_t *)(&gx_event->gx_event_payload.gx_event_pointdata.gx_point_x),
    (uint16_t *)(&gx_event->gx_event_payload.gx_event_pointdata.gx_point_y));
    }
    }

    return send_event;
    }
    --------------------------------------------------
  • In reply to tenballs:

    Changing the screen orientation will not help as my screen is exactly same as that of PE-HMI 800X480 resolution so i have to stick to this configuration only.

    I tried changing the x and y on main thread now the touch works at exact location but only up to 480 X 480 .

    You are right that the x and y coordinates are working in reverse with the screen orientation. I can not change the screen orientation I need to change the x and y raw data being transmitted on the driver end as changing it in the main thread will not reverse the x and y coordinates fetched from the driver itself.

    can you help in changing the FT5XX6 code given in SSP_supplemental
  • In reply to tenballs:

    Hi 

     

     I was going through the FT5x06 driver provided with the SSP, There the x and y coordinates are reversed for landscape mode, I dont have a PE-HMI board so do not know on what configuration there CTP is working and why the x and y coordinates are swapped. Is there a way to reverse this x and y in user threads?

  • In reply to Pranav:

    >I was going through the FT5x06 driver provided with the SSP, There the x and y coordinates are reversed for landscape mode,

    >I dont have a PE-HMI board so do not know on what configuration there CTP is working and why the x and y coordinates are swapped.

    >Is there a way to reverse this x and y in user threads?

     

    Sure.

    Have a look attached code file .

     

    ssp_touch_to_guix() function is the key part.

    It is called from main_thread_entry() and convert X-Y coordinates.

     

    --------------------------------------------------------------------

    static bool ssp_touch_to_guix(sf_touch_panel_payload_t * p_touch_payload, GX_EVENT * gx_event)
    {
    bool send_event = true;

    switch (p_touch_payload->event_type)
    {
    case SF_TOUCH_PANEL_EVENT_DOWN:
    gx_event->gx_event_type = GX_EVENT_PEN_DOWN;
    break;
    case SF_TOUCH_PANEL_EVENT_UP:
    gx_event->gx_event_type = GX_EVENT_PEN_UP;
    break;
    case SF_TOUCH_PANEL_EVENT_HOLD:
    case SF_TOUCH_PANEL_EVENT_MOVE:
    gx_event->gx_event_type = GX_EVENT_PEN_DRAG;
    break;
    case SF_TOUCH_PANEL_EVENT_INVALID:
    send_event = false;
    break;
    default:
    break;
    }

    if (send_event)
    {
    /** Send event to GUI */
    gx_event->gx_event_sender = GX_ID_NONE;
    gx_event->gx_event_target = 0;
    gx_event->gx_event_display_handle = 0;

    gx_event->gx_event_payload.gx_event_pointdata.gx_point_x = p_touch_payload->x;

    #if defined(BSP_BOARD_FT5X16)
    gx_event->gx_event_payload.gx_event_pointdata.gx_point_y = (GX_VALUE)p_touch_payload->x;
    gx_event->gx_event_payload.gx_event_pointdata.gx_point_x = (GX_VALUE)p_touch_payload->y;
    #else
    #if defined(BSP_BOARD_S7G2_SK) || defined(BSP_BOARD_S5D9_PK)
    gx_event->gx_event_payload.gx_event_pointdata.gx_point_y = (GX_VALUE)(320 - p_touch_payload->y); // SK-S7G2, PK_S5D9
    #else
    gx_event->gx_event_payload.gx_event_pointdata.gx_point_y = p_touch_payload->y; // DK-S7G2, PE-HMI1
    #endif
    #endif

    /* get corrected coordinate */
    if(g_calibration_done)
    {
    calibration_get_coordinate((uint16_t *)(&gx_event->gx_event_payload.gx_event_pointdata.gx_point_x),
    (uint16_t *)(&gx_event->gx_event_payload.gx_event_pointdata.gx_point_y));
    }
    }

    return send_event;
    }

    --------------------------------------------------------------------

     

    4135.main_thread_entry.c.txt
    /* Main Thread entry function */
    #include "main_thread.h"
    #include "bsp_api.h"
    #include "gx_api.h"
    #include "gui/guiapp_specifications.h"
    #include "gui/guiapp_resources.h"
    
    #if defined(BSP_BOARD_S7G2_SK)
    #include "hardware/lcd.h"
    #endif
    #include "calibration.h"
    
    #define BSP_BOARD_FT5X16
    
    /***********************************************************************************************************************
        Private function prototypes
     ***********************************************************************************************************************/
    static bool ssp_touch_to_guix(sf_touch_panel_payload_t * p_touch_payload, GX_EVENT * g_gx_event);
    void main_thread_entry(void);
    
    #if defined(BSP_BOARD_S7G2_SK)
    void g_lcd_spi_callback(spi_callback_args_t * p_args);
    #endif
    
    /***********************************************************************************************************************
        Private global variables
     ***********************************************************************************************************************/
    static GX_EVENT g_gx_event;
    
    GX_WINDOW_ROOT * p_window_root;
    extern GX_CONST GX_STUDIO_WIDGET *guiapp_widget_table[];
    
    /***********************************************************************************************************************
        global variables
     ***********************************************************************************************************************/
    uint8_t g_calibration_done = 0;
    
    /*******************************************************************************************************************//**
        @brief  Primary logic for handling events generated by the various sub-systems.
     ***********************************************************************************************************************/
    void main_thread_entry(void) {
    	ssp_err_t        err;
    	sf_message_header_t * p_message = NULL;
    	UINT      status = TX_SUCCESS;
    
        /* Initializes GUIX. */
        status = gx_system_initialize();
        if(TX_SUCCESS != status)
        {
            while(1);
        }
    
        /* Initializes GUIX drivers. */
        err = g_sf_el_gx.p_api->open (g_sf_el_gx.p_ctrl, g_sf_el_gx.p_cfg);
        if(SSP_SUCCESS != err)
        {
            while(1);
        }
    
        gx_studio_display_configure ( DISPLAY_1,
                                      g_sf_el_gx.p_api->setup,
                                      LANGUAGE_ENGLISH,
                                      DISPLAY_1_THEME_1,
                                      &p_window_root );
    
        err = g_sf_el_gx.p_api->canvasInit(g_sf_el_gx.p_ctrl, p_window_root);
        if(SSP_SUCCESS != err)
        {
            while(1);
        }
    
        // Create the widgets we have defined with the GUIX data structures and resources.
        GX_CONST GX_STUDIO_WIDGET ** pp_studio_widget = &guiapp_widget_table[0];
        GX_WIDGET * p_first_screen = NULL;
    
        while (GX_NULL != *pp_studio_widget)
        {
            // We must first create the widgets according the data generated in GUIX Studio.
    
            // Once we are working on the widget we want to see first, save the pointer for later.
            if (0 == strcmp("window_calibration", (char*)(*pp_studio_widget)->widget_name))
            {
                gx_studio_named_widget_create((*pp_studio_widget)->widget_name, (GX_WIDGET *)p_window_root, GX_NULL);
            } else {
                gx_studio_named_widget_create((*pp_studio_widget)->widget_name, GX_NULL, GX_NULL);
            }
            // Move to next top-level widget
            pp_studio_widget++;
        }
        // Attach the first screen to the root so we can see it when the root is shown
       gx_widget_attach(p_window_root, p_first_screen);
    
    
        if(TX_SUCCESS != status)
        {
                while(1);
        }
    
        /* Shows the root window to make it and patients screen visible. */
        status = gx_widget_show(p_window_root);
        if(TX_SUCCESS != status)
        {
            while(1);
        }
    
        /* Lets GUIX run. */
        status = gx_system_start();
        if(TX_SUCCESS != status)
        {
            while(1);
        }
    
    #if defined(BSP_BOARD_S7G2_SK)
        /** Open the SPI driver to initialize the LCD (SK-S7G2) **/
        err = g_spi_lcdc.p_api->open(g_spi_lcdc.p_ctrl, (spi_cfg_t *)g_spi_lcdc.p_cfg);
        if (err)
        {
            while(1);
        }
        /** Setup the ILI9341V (SK-S7G2) **/
        ILI9341V_Init();
    #endif
    
        /* Controls the GPIO pin for LCD ON (DK-S7G2, PE-HMI1) */
    #if defined(BSP_BOARD_S7G2_DK)
        err = g_ioport.p_api->pinWrite(IOPORT_PORT_07_PIN_10, IOPORT_LEVEL_HIGH);
        if (err)
        {
            while(1);
        }
    #elif defined(BSP_BOARD_S7G2_PE_HMI1)
        err = g_ioport.p_api->pinWrite(IOPORT_PORT_10_PIN_03, IOPORT_LEVEL_HIGH);
        if (err)
        {
            while(1);
        }
    #endif
    
        /* Opens PWM driver and controls the TFT panel back light (DK-S7G2, PE-HMI1) */
    #if defined(BSP_BOARD_S7G2_DK) || defined(BSP_BOARD_S7G2_PE_HMI1)
        err = g_pwm_backlight.p_api->open(g_pwm_backlight.p_ctrl, g_pwm_backlight.p_cfg);
        if (err)
        {
            while(1);
        }
    #endif
    
    	while(1)
    	{
    		bool new_gui_event = false;
    
    		err = g_sf_message0.p_api->pend(g_sf_message0.p_ctrl, &main_thread_message_queue, (sf_message_header_t **) &p_message, TX_WAIT_FOREVER);
    		if (err)
    		{
    			/** TODO: Handle error. */
    		}
    
    		switch (p_message->event_b.class_code)
    		{
    		case SF_MESSAGE_EVENT_CLASS_TOUCH:
    		{
    			switch (p_message->event_b.code)
    			{
    			case SF_MESSAGE_EVENT_NEW_DATA:
    			{
    				/** Translate an SSP touch event into a GUIX event */
    				new_gui_event = ssp_touch_to_guix((sf_touch_panel_payload_t*)p_message, &g_gx_event);
    			}
    			default:
    				break;
    			}
    			break;
    		}
    		default:
    			break;
    		}
    
    		/** Message is processed, so release buffer. */
    		err = g_sf_message0.p_api->bufferRelease(g_sf_message0.p_ctrl, (sf_message_header_t *) p_message, SF_MESSAGE_RELEASE_OPTION_FORCED_RELEASE);
    		
    		if (err)
    		{
    			/** TODO: Handle error. */
    		}
    
    		/** Post message. */
    		if (new_gui_event) {
    			gx_system_event_send(&g_gx_event);
    		}
    	}
    }
    
    
    static bool ssp_touch_to_guix(sf_touch_panel_payload_t * p_touch_payload, GX_EVENT * gx_event)
    {
        bool send_event = true;
        
        switch (p_touch_payload->event_type)
        {
        case SF_TOUCH_PANEL_EVENT_DOWN:
            gx_event->gx_event_type = GX_EVENT_PEN_DOWN;
            break;
        case SF_TOUCH_PANEL_EVENT_UP:
            gx_event->gx_event_type = GX_EVENT_PEN_UP;
            break;
        case SF_TOUCH_PANEL_EVENT_HOLD:
        case SF_TOUCH_PANEL_EVENT_MOVE:
            gx_event->gx_event_type = GX_EVENT_PEN_DRAG;
            break;
        case SF_TOUCH_PANEL_EVENT_INVALID:
            send_event = false;
            break;
        default:
            break;
        }
        
        if (send_event)
        {
            /** Send event to GUI */
            gx_event->gx_event_sender = GX_ID_NONE;
            gx_event->gx_event_target = 0;
            gx_event->gx_event_display_handle = 0;
            
            gx_event->gx_event_payload.gx_event_pointdata.gx_point_x = p_touch_payload->x;
    
    #if defined(BSP_BOARD_FT5X16)
            gx_event->gx_event_payload.gx_event_pointdata.gx_point_y = (GX_VALUE)p_touch_payload->x;
            gx_event->gx_event_payload.gx_event_pointdata.gx_point_x = (GX_VALUE)p_touch_payload->y;
    #else
    #if defined(BSP_BOARD_S7G2_SK) || defined(BSP_BOARD_S5D9_PK)
            gx_event->gx_event_payload.gx_event_pointdata.gx_point_y = (GX_VALUE)(320 - p_touch_payload->y);  // SK-S7G2, PK_S5D9
    #else
            gx_event->gx_event_payload.gx_event_pointdata.gx_point_y = p_touch_payload->y;  // DK-S7G2, PE-HMI1
    #endif
    #endif
            
            /* get corrected coordinate */
    		if(g_calibration_done)
    		{
    	        calibration_get_coordinate((uint16_t *)(&gx_event->gx_event_payload.gx_event_pointdata.gx_point_x),
                                       (uint16_t *)(&gx_event->gx_event_payload.gx_event_pointdata.gx_point_y));
    		}
        }
        
        return send_event;
    }
    
    
    #if defined(BSP_BOARD_S7G2_SK)
    void g_lcd_spi_callback(spi_callback_args_t * p_args)
    {
        (void)p_args;
        tx_semaphore_ceiling_put(&g_main_semaphore_lcdc, 1);
    }
    #endif
    

  • In reply to Pranav:

    Hi Pranav,

    You can set screen size to 800x800 in the touch panel framework to ensure no values get filtered out. Coordinate swapping can be done using the method shown in the post above.

    Regards
  • In reply to Renesas Karol:

    Hi Karol

    Thanks the screen is working perfectly now.