Hi,
I try to generate an Interrupt on a falling edge detected by a GPIO. I followed the IrqDemo, but my implementation fail. Cant’t find a reason…
As I have more than one irq I created a type which holds all data related to one Interrupt:
typedef struct
{
HANDLE hEvent;
DWORD dwSysIntrNumber;
}GPIO_IRQ_t;
And a Little helper:
static void SetupGpioInterrupt(HANDLE hIntr, HANDLE hGpio, uIo pin, GPIO_IRQ_t* irq)
{
DWORD irqNum = 0;
BOOL result =false;
//pin = Gpio_NormalizeIo(hGpio, pin);
Gpio_GetConfigInt(hGpio, pin, L"irq", &irqNum);
irq->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
irq->dwSysIntrNumber = Int_RequestSysInterrupt(hIntr, irq->dwSysIntrNumber);
result = Int_InterruptInitialize(hIntr, irq->dwSysIntrNumber, irq->hEvent, NULL, 0);
Int_InterruptDone(hIntr, irq->dwSysIntrNumber);
}
y pin:
#define TRIGGER_TRANSFER_PIN_NUM 101 // ISIS X16.16
To make typing easier I created a Symbol:
#define CFG_AS_IRQ_UP47k_SMTT_FALL L"altfn=-1, dir=in, pull=up47k, inmode=schmitt, irqtrig=falling"
Now I tried to Setup a pin:
uIo ioTrgTransfSig = COLIBRI_PIN( TRIGGER_TRANSFER_PIN_NUM );
GPIO_IRQ_t g_TriggerTransferIRQ;
success = Gpio_SetConfigString(hGpio, ioLastXFerSig, NULL, CFG_AS_INPUT_UP47k_SMTT, StoreVolatile);
hIntr = Int_Init();
SetupGpioInterrupt(hIntr, hGpio, ioTrgTransfSig, &g_TriggerTransferIRQ);
But no Interrupt, and yes, there is an falling edge, my scope told me.
I tried it with and without the pin = Gpio_NormalizeIo(hGpio, pin);
Statement.
Thanks for helping.
With best regards
Gerhard