This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to set GPIO Debounce time with Unified BSP 1.00?

Other Parts Discussed in Thread: TSC2046, OMAP3530

Hi,

In PddInitializeHardware(VOID) of touchscreen.c BSP6.15.00, the following code are for setting the debounce time of PenIRQ pin:

IOCTL_GPIO_SET_DEBOUNCE_TIME_IN debounce;

 

debounce.gpioId = s_TouchDevice.nPenGPIO;

debounce.debounceTime = 10;

 

GPIOIoControl(s_TouchDevice.hGPIO, IOCTL_GPIO_SET_DEBOUNCE_TIME, (UCHAR*)&debounce, sizeof(debounce), NULL, 0, NULL, NULL);

In Unified BSP 1.00,

IOCTL_GPIO_SET_DEBOUNCE_TIME_IN debounce;

 

debounce.gpioId = s_TouchDevice.nPenGPIO;

debounce.debounceTime = 10;

I added the function call GPIOIoControl() as above and got a compile error. Is this method of setting GPIO debounce time intentionally eliminated in the new BSP?

Thanks,

Luan

  • Hi Luan,

    GPIOIoControl()  is still present in the Unified BSP and has not been removed. Try to include "sdk_gpio.h" in your code and relaunch the build to see if you get past this compilation error. If you still get a build issue, please provide error log to help us debug your issue.

  • Hi Anthony,

    I already had "sdk_gpio.h" included.  I should have reported that it passed the compilation but failed the linking stage as shown below

    BUILD: [01:0000010494:PROGC ] Linking C:\WINCE600\platform\EVM_OMAP3530\target\ARMV4I\retail\TSC2046_touch.dll

    BUILD: [01:0000010783:ERRORE] touchscreen.obj : error LNK2019: unresolved external symbol GPIOIoControl referenced in function "int __cdecl PddInitializeHardware(void)" (?PddInitializeHardware@@YAHXZ)

    BUILD: [01:0000010784:ERRORE] C:\WINCE600\platform\EVM_OMAP3530\target\ARMV4I\retail\TSC2046_touch.dll : fatal error LNK1120: 1 unresolved externals.

     

    This is the original sample project for EVM3530.  All I did was adding the GPIOIoControl() call to function PddInitializeHardware() in touchscreen.c as we had in BSP6.15.00.

    Thanks for your help,

    Luan

  • I am seeing this problem also. He is correct the line to set the debounce time in the touch driver is missing and the wrapper function is also missing.

    I believe the GPIOIoControl function needs to be added to the gpio_dispatch.c file. It is in the header file but is not implemented.

    I do not believe you could do a DeviceIoControl directly from the touch file as the context handle would be wrong.

  • You can implement GPIOIocontrol in the gpio_dispatch files (both OAL and DEVICE) and filling up the right function pointer in interface table during IOCTL_DDK_GET_DRIVER_IFC IOCTL in xxx_gpio.cpp files

    OR

    you could use the simple workaround in touchscreen.cpp as follows:

        // Set debounce time on GPIO
        IOCTL_GPIO_SET_DEBOUNCE_TIME_IN debounce;
        
        debounce.gpioId = s_TouchDevice.nPenGPIO;
        debounce.debounceTime = 10;

        HANDLE hTempGPIO = NULL;    
        hTempGPIO = CreateFile(L"GIO1:",
                           GENERIC_READ|GENERIC_WRITE,
                           FILE_SHARE_READ|FILE_SHARE_WRITE,
                           NULL,
                           OPEN_EXISTING,              
                           0,                                
                           NULL);                            
        
        DeviceIoControl(hTempGPIO, IOCTL_GPIO_SET_DEBOUNCE_TIME, (UCHAR*)&debounce, sizeof(debounce), NULL, 0, NULL, NULL);
        CloseHandle(hTempGPIO);

     

    -Madhvi