• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FT_Close函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FT_Close函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_Close函数的具体用法?C++ FT_Close怎么用?C++ FT_Close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FT_Close函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:0x6a77,项目名称:JD2XX,代码行数:59,代码来源:main.c


示例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
}
开发者ID:xanthium-enterprises,项目名称:FT232-D2XX-Library-Programming,代码行数:29,代码来源:CBUS_bbm.c


示例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;
}
开发者ID:kouellet,项目名称:libnifalcon,代码行数:7,代码来源:nifalcon_ftd2xx.c


示例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;
}
开发者ID:Bot007,项目名称:openOCD,代码行数:7,代码来源:ublast_access_ftd2xx.c


示例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;
}
开发者ID:111X,项目名称:radare,代码行数:47,代码来源:libgecko.c


示例6: dxl_hal_close

void dxl_hal_close()
{
	if( ghFt_Handle != 0 )
	{
		FT_Close( ghFt_Handle );
		ghFt_Handle = 0;
	}
}
开发者ID:DavidJohan,项目名称:Assemble-and-Animate,代码行数:8,代码来源:dxl_hal.c


示例7: FT_Close

VOID CDriverInterface::Cleanup()
{
    if (m_FTHandle)
    {
        FT_Close(m_FTHandle);
        m_FTHandle = NULL;
    }
}
开发者ID:BastilleNetworks,项目名称:LimeSuite,代码行数:8,代码来源:DRV_DriverInterface.cpp


示例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);
}
开发者ID:bitwigglers,项目名称:lib-pm600x,代码行数:17,代码来源:libpm600x.c


示例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;
}
开发者ID:n12365,项目名称:adsb,代码行数:14,代码来源:kinetic_Kinetic1090Puck.c


示例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);
}
开发者ID:enbyted,项目名称:qlcplus,代码行数:56,代码来源:ftd2xx-interface.cpp


示例11: serial_close

static void
serial_close ()
{
  ProgramMode (0);
  Reset (1);
  /* >3 mSec reset pulse */
  usleep(3*1000);
  Reset (0);
  FT_Close (handle);
}
开发者ID:GBert,项目名称:openwrt-misc,代码行数:10,代码来源:d2xx.c


示例12: FT_Close

Dynamixel::~Dynamixel(){
    if(initialized_){
        FT_STATUS ftStatus = FT_Close(ftHandleDYNA_);
        if (ftStatus != FT_OK){
            emit failedToClose();
        }else{
            emit closed();
        }
    }
}
开发者ID:CreativeMachinesLab,项目名称:freeLoader,代码行数:10,代码来源:dynamixel.cpp


示例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;
}
开发者ID:cosmoharrigan,项目名称:clsquare,代码行数:11,代码来源:ftdxxdevice.cpp


示例14: FT_Close

int CKMotionIO::Disconnect()
{
	Mutex->Lock();
	
	m_Connected=false;
	
	FT_Close(ftHandle);
	
	Mutex->Unlock();
	return 0;
}
开发者ID:tedenda,项目名称:KMotionX,代码行数:11,代码来源:KmotionIO.cpp


示例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()));
}
开发者ID:nutrino,项目名称:telldus,代码行数:12,代码来源:tellstick.cpp


示例16: while

/*
	This is the main reader thread - continually waits for a read

*/
void *read_watch(void *pArgs)
{
	char buf[20];
	DWORD dwRet;
	FT_STATUS ftStatus;
		
	while(exit_reader != 1) {
//		printf("Write\n");
		FT_Write(ftHandle, buf, 20, &dwRet);
//		sleep(1);	
	}
	FT_Close(ftHandle);
}
开发者ID:0x6a77,项目名称:JD2XX,代码行数:17,代码来源:main.c


示例17: main

int main(int argc, char *argv[])
{
	DWORD dwBytesInQueue = 0;
	EVENT_HANDLE eh;
	FT_STATUS	ftStatus;
	FT_HANDLE	ftHandle;
	int iport;
	
	if(argc > 1) {
		sscanf(argv[1], "%d", &iport);
	}
	else {
		iport = 0;
	}
	
	pthread_mutex_init(&eh.eMutex, NULL);
	pthread_cond_init(&eh.eCondVar, NULL);
	
	ftStatus = FT_Open(iport, &ftHandle);
	if(ftStatus != FT_OK) {
		/* 
			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_SetFlowControl(ftHandle, FT_FLOW_NONE, 0, 0);
	if(ftStatus != FT_OK) {
		printf("Failed to set flow control\n");	
	}

	ftStatus = FT_SetEventNotification(ftHandle, FT_EVENT_RXCHAR, (PVOID)&eh);
	if(ftStatus != FT_OK) {
		printf("Failed to set events\n");
		return 1;
	}
	
	pthread_mutex_lock(&eh.eMutex);
	pthread_cond_wait(&eh.eCondVar, &eh.eMutex);
	pthread_mutex_unlock(&eh.eMutex);
	
	FT_GetQueueStatus(ftHandle, &dwBytesInQueue);
	printf("Received chars %d bytes in queue\n", (int)dwBytesInQueue);
	
	FT_Close(ftHandle);
	
	return 0;
}
开发者ID:0x6a77,项目名称:JD2XX,代码行数:51,代码来源:main.c


示例18: presto_close

static int presto_close(void)
{

	int result = ERROR_OK;

#if BUILD_PRESTO_FTD2XX == 1
	DWORD ftbytes;

	if (presto->handle == (FT_HANDLE)INVALID_HANDLE_VALUE)
		return result;

	presto->status = FT_Purge(presto->handle, FT_PURGE_TX | FT_PURGE_RX);
	if (presto->status != FT_OK)
		result = ERROR_JTAG_DEVICE_ERROR;

	presto->status = FT_Write(presto->handle,
			&presto_init_seq,
			sizeof(presto_init_seq),
			&ftbytes);
	if (presto->status != FT_OK || ftbytes != sizeof(presto_init_seq))
		result = ERROR_JTAG_DEVICE_ERROR;

	presto->status = FT_SetLatencyTimer(presto->handle, 16);
	if (presto->status != FT_OK)
		result = ERROR_JTAG_DEVICE_ERROR;

	presto->status = FT_Close(presto->handle);
	if (presto->status != FT_OK)
		result = ERROR_JTAG_DEVICE_ERROR;
	else
		presto->handle = (FT_HANDLE)INVALID_HANDLE_VALUE;

#elif BUILD_PRESTO_LIBFTDI == 1

	presto->retval = ftdi_write_data(&presto->ftdic, presto_init_seq, sizeof(presto_init_seq));
	if (presto->retval != sizeof(presto_init_seq))
		result = ERROR_JTAG_DEVICE_ERROR;

	presto->retval = ftdi_set_latency_timer(&presto->ftdic, 16);
	if (presto->retval < 0)
		result = ERROR_JTAG_DEVICE_ERROR;

	presto->retval = ftdi_usb_close(&presto->ftdic);
	if (presto->retval < 0)
		result = ERROR_JTAG_DEVICE_ERROR;
	else
		ftdi_deinit(&presto->ftdic);
#endif

	return result;
}
开发者ID:01org,项目名称:CODK-A-Flashpack,代码行数:51,代码来源:presto.c


示例19: gecko_sendbyte

int gecko_sendbyte(unsigned char Textbyte)
{
	unsigned int ret = 0;

	ret = gecko_writebyte(&cmd_sendbyte, 1, &TxSent);
	if(ret == 0 || ret == 2) {
		eprintf("Couldn't send the command to console, check DOL is loaded and connection\n");
		status = FT_Close(fthandle);
		return 0;
	}
	gecko_writebyte(&Testbyte, 1, &TxSent);  // Send byte

	return 1;
}
开发者ID:111X,项目名称:radare,代码行数:14,代码来源:libgecko.c


示例20: main

int main(int argc, char *argv[])
{
	char * pcBufRead;
	DWORD dwBytesRead;
	FILE * fh;
	FT_HANDLE ftHandle;
	FT_STATUS ftStatus;
	int iport;
	
	if(argc > 1) {
		sscanf(argv[1], "%d", &iport);
	}
	else {
		iport = 0;
	}
	
	fh = fopen("target.bin", "wb+");
	if(fh == NULL) {
		printf("Cant open source file\n");
		return 1;
	}
		
	ftStatus = FT_Open(iport, &ftHandle);
	if(ftStatus != FT_OK) {
		/* 
			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;
	}

	pcBufRead = (char *)malloc(BUF_SIZE);
	FT_ResetDevice(ftHandle);
	FT_SetBaudRate(ftHandle, 115200);
	FT_SetDtr(ftHandle);
	FT_SetRts(ftHandle);
	FT_SetFlowControl(ftHandle, FT_FLOW_RTS_CTS, 0, 0);
	FT_SetTimeouts(ftHandle, 0, 0);				// infinite timeouts	
	FT_SetBitMode(ftHandle, 0xFF, 0x01);
	FT_Read(ftHandle, pcBufRead, BUF_SIZE, &dwBytesRead);

	fwrite(pcBufRead, 1, dwBytesRead, fh);
	fclose(fh);
	free(pcBufRead);
	FT_Close(ftHandle);
	
	return 0;
}
开发者ID:0x6a77,项目名称:JD2XX,代码行数:50,代码来源:main.c



注:本文中的FT_Close函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FT_DivFix函数代码示例发布时间:2022-05-30
下一篇:
C++ FT_CMAP_FACE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap