how works CreateEvent from Windows? and how use the function FT_SetEventNotification from FTDI?

Alex Hyx 1 Reputation point
2021-03-22T21:49:27.19+00:00

Hi, im trying to understand the function FT_SetEventNotification and im not sure what i can do with that. I understood that the function allows create a custom event that fire when occurs a data from Rx for example. That is correct? and if so, how is possible with a C++ project?

I try create a function: void WINAPI DataReceived(){ return; }

and in a method of class:

HANDLE hEvent;

hEvent = CreateEvent(NULL, false, false, "MyEvent");
FT_STATUS_I = FTDI_I->SetEventNotification(FT_EVENT_RXCHAR | FT_EVENT_MODEM_STATUS, hEvent);
WaitForSingleObject(hEvent, INFINITE);

When i call WaitForSingleObject(), it stops until receive Data. But it is posible to make that an event fire a function like an interrupt?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,827 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.