Other Parts Discussed in Thread: DM3730
#define IRQ_BUTTON 101, also tried 55 with same result
when I set the mode to GPIO_INT_LOW, the interrupt constantly comes in and won't stop(even when I pull the pin high)
when I set the mode to any other mode (high, lowhigh, or highlow), the interrupt never triggers.
I am using Variscite's DVK board with the DM3730 cpu under WinCE Compact 7
I have errors coming back from all those GPIOxxx function
gButtonsIntrEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
// Open GPIO driver
hGPIO = GPIOOpen();
if (hGPIO == NULL)
{
RETAILMSG(1, (TEXT("ERROR: PddInitializeHardware: Failed open GPIO device driver\r\n")));
return (0);
}
// Setup IRQ for input mode, falling edge detect, debounce enable
//GPIOSetMode(hGPIO, IRQ_BUTTON, GPIO_DIR_INPUT|GPIO_INT_LOW); //this have constant trigger, even if we pull it high. other trigger can't be triggered no matter what
// GPIOSetMode(hGPIO, IRQ_BUTTON, GPIO_DIR_INPUT|GPIO_INT_HIGH_LOW|GPIO_DEBOUNCE_ENABLE);
GPIOSetMode(hGPIO, IRQ_BUTTON, GPIO_DIR_INPUT|GPIO_INT_LOW_HIGH|GPIO_DEBOUNCE_ENABLE);
// GPIOSetMode(hGPIO, IRQ_BUTTON, GPIO_DIR_INPUT|GPIO_INT_HIGH);
// GPIOPullup(hGPIO, IRQ_BUTTON,GPIO_PULLUP_ENABLE);
DWORD ibit=0x55aa55aa;
ibit=GPIOGetMode(hGPIO, IRQ_BUTTON);
RETAILMSG(1, (TEXT("*********** BTN: get mode=%d\r\n"),ibit));
if (!GPIOInterruptInitialize(hGPIO, IRQ_BUTTON, &SysIntrValue, gButtonsIntrEvent)) //this does GPIOGetSystemIrq, IOCTL_HAL_REQUEST_SYSINTR, and InterruptInitialize
{
RETAILMSG(1, (TEXT("Couldn't Initialize interrupt GPIOInterruptInitialize.\r\n")));
return 0;
}
// Set the interrupt as a wake-up source
if (!GPIOInterruptWakeUp(hGPIO, IRQ_BUTTON, SysIntrValue, TRUE))
{
RETAILMSG(1, (TEXT("ERROR: BTN: Couldn't get valid SysIntr.\r\n")));
return(0);
}
//SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
RETAILMSG(1, (TEXT("%s +BtnButton IST\r\n"),DRVR_NAME));
while (1)
{
WaitForSingleObject(gButtonsIntrEvent, INFINITE);
Sleep(10);
RETAILMSG(1, (TEXT("%s got intr\r\n"),DRVR_NAME));
// InterruptDone(SysIntrValue);
GPIOInterruptDone(hGPIO, IRQ_BUTTON, SysIntrValue); //this seems to be same as above; InterruptDone()
} // end while