-
Notifications
You must be signed in to change notification settings - Fork 6
FTDIConnection
FTDIConnection component handles the FTDI communication for devices. When you create a device with FTDIConnection component, its assigned to FTDI scan checks and will be compared to scanned FTDI devices. If it matches your device will be activated in the code.
FTDIConnection component gives user few usefull functions. These are listed below.
-
bool fConnect()function handles FTDI's open device and open MPSSE calls with chip type checks. This means FTDI chip will be checked automatically in the code. You dont need to specify your device's FTDI chip yourself. You need to call this in your device'sconnect()function for it to properly work. Order you call is your own choice. This function returnstrueif connection initalized successfuly andfalseif anything fails. Thus in yourconnect()function you can call it like:if (!connection.fConnect()) return false; -
bool fDisconnect()function handles FTDI's close device and other closing stuff. This needs to be called inside your device'sdisconnect()function. After this function call you wont be able to use any FTDI communication systems so be aware of that. This function returnstrueif device disconnects successfuly andfalseif anything fails. -
FT_STATUS sendData(const unsigned char* data, DWORD size)function send the data you create in your own script to the FTDI device with Write function. You should create an array of char's and give in the car array. Bug detections will be handled inside this function so you dont need to do it yourself. This function returns its FT_STATUS so you can check it if you need. -
FT_STATUS receiveData(unsigned char* buffer, DWORD size, DWORD& bytesRead)function reads the recived data. Its a bit complicated to time this function. If you are working syncronusly a good rule of thumb is that you should wait 20-30 ms before read functions to make sure data is ready to read. -
int getFTDIIndex()function returns the FTDI index of the device as const. -
FT_DEVICE_LIST_INFO_NODE getDevInfo()function returns the development info of the FTDI chip. This includes:ULONG FlagsULONG TypeULONG IDDWORD LocIdchar SerialNumber[16]char Description[64]FT_HANDLE ftHandle -
bool isConnected()function returnstrueif the device is connected. -
bool isDeviceOpen()function returnstrueif the device is open. -
bool isTryingToConnect()function returnstrueif the device is trying to connect insidefConnect()function at the moment.