本文整理汇总了C++中FT_Close函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_Close函数的具体用法?C++ FT_Close怎么用?C++ FT_Close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FT_Close函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
unsigned char * pucUAdata;
DWORD dwUASize, dwUARead;
FILE * fp;
FT_HANDLE ftHandle0;
FT_STATUS ftStatus;
int iport;
if(argc > 1) {
sscanf(argv[1], "%d", &iport);
}
else {
iport = 0;
}
printf("opening port %d\n", iport);
ftStatus = FT_Open(iport, &ftHandle0);
if(ftStatus == FT_OK) {
printf("ftHandle0 = %p\n", ftHandle0);
}
else {
/*
This can fail if the ftdi_sio driver is loaded
use lsmod to check this and rmmod ftdi_sio to remove
also rmmod usbserial
*/
printf("FT_Open(%d) failed\n", iport);
return 1;
}
ftStatus = FT_EE_UASize(ftHandle0, &dwUASize);
if(ftStatus == FT_OK)
printf("dwUASize = %d\n", (int)dwUASize);
else {
printf("Could not read UA size\n");
FT_Close(ftHandle0);
return 1;
}
pucUAdata = (unsigned char *)malloc(dwUASize);
if(pucUAdata == NULL) {
printf("Out of resources\n");
FT_Close(ftHandle0);
return 1;
}
ftStatus = FT_EE_UARead(ftHandle0, pucUAdata, dwUASize, &dwUARead);
if(ftStatus == FT_OK) {
fp = fopen("UA_DATA.bin", "w+");
fwrite(pucUAdata, 1, dwUARead, fp);
fclose(fp);
}
else{
printf("could not read UA\n");
}
free(pucUAdata);
FT_Close(ftHandle0);
return 0;
}
示例2: main
int main(void)
{
FT_HANDLE FT_handle; // handle to FT 232 chip
FT_STATUS FT_status; // status of the FT 232 chip
UCHAR Mask; // for selecting which pins are input/output
UCHAR Mode; // Selects the mode of operation for the chip
UCHAR UpperNibble_Direction; //whether port is input/output
UCHAR LowerNibble_Data; // 4 bit data to be sent
UpperNibble_Direction = 0xF0; // setting the direction nibble
LowerNibble_Data = 0x0F; // setting the data nibble
Mask = UpperNibble_Direction | LowerNibble_Data;//OR'ing
FT_status = FT_Open(0,&FT_handle); // Open a connection to FT232RL
Mode = 0x20; // Select Chip mode as CBUS Bit Bang
FT_status = FT_SetBitMode(FT_handle,Mask,Mode); // Opening Bit Bang Mode
getchar();
Mode = 0x00; // Reset the chip
Mask = 0x00; //
FT_status = FT_SetBitMode(FT_handle,Mask,Mode); //Bring back the chip to default mode
FT_Close(FT_handle);//Close the connection
}
示例3: nifalcon_close
int nifalcon_close(falcon_device* dev)
{
if(!dev->is_open) nifalcon_error_return(NIFALCON_DEVICE_NOT_FOUND_ERROR, "tried to close an unopened device");
dev->is_open = 0;
FT_Close(dev->falcon);
return 0;
}
示例4: ublast_ftd2xx_quit
static int ublast_ftd2xx_quit(struct ublast_lowlevel *low)
{
FT_HANDLE *ftdih = ublast_getftdih(low);
FT_Close(*ftdih);
return ERROR_OK;
}
示例5: gecko_opendevice
int gecko_opendevice()
{
// Open by Serial Number
status = FT_OpenEx("GECKUSB0", FT_OPEN_BY_SERIAL_NUMBER, &fthandle);
if(status != FT_OK){
eprintf("Error: Couldn't connect to USB Gecko. Please check Installation\n");
return 0;
}
// Reset the Device
status = FT_ResetDevice(fthandle);
if(status != FT_OK){
eprintf("Error: Couldnt Reset Device %d\n",status);
status = FT_Close(fthandle);
return 0;
}
// Set a 3 second timeout for this example
status = FT_SetTimeouts(fthandle,3000,3000);
if(status != FT_OK){
eprintf("Error: Timeouts failed to set %d\n",status);
status = FT_Close(fthandle);
return 0;
}
// Purge RX buffer
status = FT_Purge(fthandle,FT_PURGE_RX);
if(status != FT_OK){
eprintf("Error: Problem clearing buffers %d\n",status);
status = FT_Close(fthandle);
return 0;
}
// Purge TX buffer
status = FT_Purge(fthandle,FT_PURGE_TX);
if(status != FT_OK){
eprintf("Error: Problem clearing buffers %d\n",status);
status = FT_Close(fthandle);
return 0;
}
// Set packet size in bytes - 65536 packet is maximum packet size (USB 2.0)
status = FT_SetUSBParameters(fthandle,65536,0);
if(status != FT_OK){
eprintf("Error: Couldnt Set USB Parameters %d\n",status);
status = FT_Close(fthandle);
return 0;
}
// take breath
sleep(1);
return 1;
}
示例6: dxl_hal_close
void dxl_hal_close()
{
if( ghFt_Handle != 0 )
{
FT_Close( ghFt_Handle );
ghFt_Handle = 0;
}
}
示例7: FT_Close
VOID CDriverInterface::Cleanup()
{
if (m_FTHandle)
{
FT_Close(m_FTHandle);
m_FTHandle = NULL;
}
}
示例8: pm_close
/**
Close a power meter probe
\param pm a pointer to a pm_context
\retval 0 - all fine
\retval -1 - invalid pm_context
*/
PM600X_EXPORT int pm_close(struct pm_context *pm)
{
if (!pm->handle)
pm_error_return(-1, "invalid pm_context");
FT_Close(pm->handle);
return pm_init(pm);
}
示例9: Java_kinetic_Kinetic1090Puck_puckClose
/*
* Class: kinetic_Kinetic1090Puck
* Method: puckClose
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_kinetic_Kinetic1090Puck_puckClose(JNIEnv * env, jobject obj)
{
FT_STATUS ftStatus = FT_Close(ftHandle);
if (ftStatus != FT_OK) {
return -1;
}
return 0;
}
示例10: QString
QString FTD2XXInterface::readLabel(uchar label, int *ESTA_code)
{
FT_HANDLE ftdi = NULL;
if (FT_Open(id(), &ftdi) != FT_OK)
return QString();
if(FT_ResetDevice(ftdi) != FT_OK)
return QString();
if(FT_SetBaudRate(ftdi, 250000) != FT_OK)
return QString();
if(FT_SetDataCharacteristics(ftdi, FT_BITS_8, FT_STOP_BITS_2, FT_PARITY_NONE) != FT_OK)
return QString();
if(FT_SetFlowControl(ftdi, 0, 0, 0) != FT_OK)
return QString();
QByteArray request;
request.append(ENTTEC_PRO_START_OF_MSG);
request.append(label);
request.append(ENTTEC_PRO_DMX_ZERO); // data length LSB
request.append(ENTTEC_PRO_DMX_ZERO); // data length MSB
request.append(ENTTEC_PRO_END_OF_MSG);
DWORD written = 0;
if (FT_Write(ftdi, (char*) request.data(), request.size(), &written) != FT_OK)
return QString();
if (written == 0)
{
qDebug() << Q_FUNC_INFO << "Cannot write data to device";
return QString();
}
uchar* buffer = (uchar*) malloc(sizeof(uchar) * 40);
Q_ASSERT(buffer != NULL);
int read = 0;
QByteArray array;
FT_SetTimeouts(ftdi, 500,0);
FT_Read(ftdi, buffer, 40, (LPDWORD) &read);
qDebug() << Q_FUNC_INFO << "----- Read: " << read << " ------";
for (int i = 0; i < read; i++)
array.append((char) buffer[i]);
if (array[0] != ENTTEC_PRO_START_OF_MSG)
qDebug() << Q_FUNC_INFO << "Reply message wrong start code: " << QString::number(array[0], 16);
*ESTA_code = (array[5] << 8) | array[4];
array.remove(0, 6); // 4 bytes of Enttec protocol + 2 of ESTA ID
array.replace(ENTTEC_PRO_END_OF_MSG, '\0'); // replace Enttec termination with string termination
FT_Close(ftdi);
return QString(array);
}
示例11: serial_close
static void
serial_close ()
{
ProgramMode (0);
Reset (1);
/* >3 mSec reset pulse */
usleep(3*1000);
Reset (0);
FT_Close (handle);
}
示例12: FT_Close
Dynamixel::~Dynamixel(){
if(initialized_){
FT_STATUS ftStatus = FT_Close(ftHandleDYNA_);
if (ftStatus != FT_OK){
emit failedToClose();
}else{
emit closed();
}
}
}
示例13: throw
bool FTDXXDevice::disconnect () throw ()
{
if (!_initialized) return false;
_initialized = false;
FTDLOG("Closing FTDI bus.");
#ifdef FOUND_ftd2xx
FT_Close(_handle);
FXXCHECK("Unable to close handle.");
#endif
return true;
}
示例14: FT_Close
int CKMotionIO::Disconnect()
{
Mutex->Lock();
m_Connected=false;
FT_Close(ftHandle);
Mutex->Unlock();
return 0;
}
示例15: FT_SetBitMode
void TellStick::rebootTellStick() {
FT_STATUS ftStatus = FT_SetBitMode(d->ftHandle, 0xff, 0x20);
for (int i = 0; i < 100; ++i) {
msleep(1);
QApplication::processEvents();
}
ftStatus = FT_SetBitMode(d->ftHandle, 0xf0, 0x20);
FT_Close(d->ftHandle);
QApplication::processEvents();
setUpgradeStep(5);
QTimer::singleShot(0, this, SLOT(connectTellStick()));
}