EasyManua.ls Logo

FTDI LibFT4222 - Page 18

Default Icon
78 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
17
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
{
BOOL value;
WaitForSingleObject(hRxEvent,INFINITE);
// FT4222_GPIO_Read is a read clear function for interrupt
if(FT4222_GPIO_Read(ftHandle, (GPIO_Port)GPIO_PORT3, &value) == FT4222_OK)
{
if(value == TRUE)
{
// got interrupt
}
else
{
// no interrupt
}
}
}
FT4222_UnInitialize(ftHandle);
FT_Close(ftHandle);
// example 2: This test code is running in Mode 0.
// Monitor how many interrupts happen in a period of time.
FT_HANDLE ftHandle = NULL;
FT_STATUS ftStatus;
FT4222_STATUS ft4222Status;
ftStatus = FT_OpenEx("FT4222 B",FT_OPEN_BY_DESCRIPTION, &ftHandle);
if (FT_OK != ftStatus)
{
// open failed
return;
}
GPIO_Dir gpioDir[4];
gpioDir[0] = GPIO_OUTPUT;
gpioDir[1] = GPIO_OUTPUT;
gpioDir[2] = GPIO_OUTPUT;
gpioDir[3] = GPIO_INPUT;
// we must initial gpio before FT4222_SetInterruptTrigger, because interrupt data is transmitted
by gpio interface.
FT4222_GPIO_Init(ftHandle, gpioDir);
// enable interrupt
FT4222_SetWakeUpInterrupt(ftHandle, true);
// setup interrupt trigger level
FT4222_SetInterruptTrigger(ftHandle, GPIO_TRIGGER_RISING);
while(1)
{
uint16 queueSize;
// sleep 1s
Sleep(1000);
if(FT4222_GPIO_GetTriggerStatus(ftHandle, GPIO_PORT3, &queueSize) == FT4222_OK)
{
// got interrupt times in 1s
if(queueSize > 0)
{
BOOL value;
// clear the interrupt result
FT4222_GPIO_Read(ftHandle, (GPIO_Port)GPIO_PORT3, &value);

Table of Contents