Introduction
How to write C++ programs using the new Simplified DLL starting from the old DLL.
...
Note |
---|
Both the Simplified Trenz Electronic C++ DLL and this porting guide are fully working developer versions but are not supported by Trenz Electronic till the official release, currently not yet planned. |
Function Declarations
#define TE_USB_FX2_CYAPI extern "C" __declspec(dllexport)
Exported function (from DLL)
- TE_USB_FX2_CYAPI int TE_USB_FX2_ScanCards ();
- TE_USB_FX2_CYAPI int TE_USB_FX2_Open (int CardNumber, unsigned long TimeOut, int DriverBufferSize);
- TE_USB_FX2_CYAPI int TE_USB_FX2_Close ();
- TE_USB_FX2_CYAPI int TE_USB_FX2_SendCommand ( byte* Command, long CmdLength, byte* Reply, long ReplyLength, unsigned long Timeout);
- TE_USB_FX2_CYAPI int TE_USB_FX2_GetData ( byte* DataRead, long DataReadLength);
- TE_USB_FX2_CYAPI int TE_USB_FX2_SetData ( byte* DataWrite, long DataWriteLength);
Internal Function (not exported from DLL)
The two functions that follow appear in the header but are used only internally by the DLL (TE_USB_FX2_CyAPI.dll) and are not exported to the user:
...
Info |
---|
This Simplified DLL is successfully used in the Python (using ctypes to import/export c types) program Open_FUT (Gen3) to program USB FX2 microcontroller's firmware and SPI Flash/FPGA's bitstream. This Simplified DLL is full extern C (C compatible). |
Function Translation
Scroll Title |
---|
title | Function translation between DLLs |
---|
|
Dewesoft C++ DLL | Simplified Trenz Electronic C++ DLL | HANDLE m_handle = 0; | Nothing (you must charge the DLL) | cout << endl << TE0300_ScanCards() << endl; | cout << endl << TE_USB_FX2_ScanCards() << endl; | TE0300_Open(&m_handle, 0)!=0 | TE_USB_FX2_Open(0, TimeOut, DriverBufferSize)!=0 | TE0300_Open(&m_handle, 1)!=0 | TE_USB_FX2_Open(1, TimeOut, DriverBufferSize)!=0 | TE0300_Close(&m_handle); | TE_USB_FX2_Close(); | TE0300_SendCommand(handle, cmd, cmd_length, reply, &reply_length, timeout) | TE_USB_FX2_SendCommand( cmd, cmd_length, reply, reply_length, timeout) | TE0300_SetData(handle, data, packetlen, PI_EP8) | TE_USB_FX2_SetData(data, packetlen) | TE0300_GetData(handle, data, &packetlen, PI_EP6, 1000) | TE_USB_FX2_GetData(data, packetlen) |
|
...