2016-08-02 13 views
0

FPGA上のLEDにアクセスするコードを記述しました。とにかく、私は成功したのVisual Studioで次のコードをコンパイルすることはできません。'USB_Close':識別子が見つかりません... 'len':宣言されていない識別子...

#ifdef STATS_LIBRARY_EXPORTS 
# define LIBRARY_API __declspec(dllexport) 
#else 
# define LIBRARY_API __declspec(dllimport) 
#endif 

#include <windows.h> 
#include "stdafx.h" 
#include <iostream> 
#include <fstream> 
#include <conio.h> 
#include <time.h> 
#include <bitset> 
#include <stdio.h> 

#include "C:\Cypress\Cypress Suite USB 3.4.7\CyAPI\inc\CyAPI.h" 





_declspec(dllexport) int excite_LED(bool start, int on) { 


int i; 
USB_Open(); 
for(i=0; i<100; i++) // blink the LEDs for a few seconds 
{ 
USB_BulkWrite(2, &i, 1); // send one single byte (= the value of i) to FIFO2 
Sleep(50); // and wait 50ms 


BulkOutPipe2->XferData((PUCHAR)&i, len); // send one byte (the value of i) to FIFO2 


//Send command to FPGA 
//status = !BulkOutPipe2->XferData(fpgaCommunicator, fpgaCommunicatorBytes); 


} 
USB_Close(); 

} 

を、私は、次のエラーを取得しています:

left of '->XferData' must point to class/struct/union/generic type 
identifier "USB_Open" is undefined 
identifier "USB_Close" is undefined 
identifier "USB_BulkWrite" is undefined 
identifier "len" is undefined 
identifier "BulkOutPipe2" is undefined 
cannot open source file "stdafx.h" 
'USB_Open': identifier not found 
'USB_Close': identifier not found 
'USB_BulkWrite': identifier not found 
'len': undeclared identifier 
'BulkOutPipe2': undeclared identifier 

私は私のコードは、これらのエラーを取り除くために解決することができますか?

答えて

0

BulkOutPipe2は、あなたがそれを自分で設定する必要があるので、一般的な多くのサンプル内のエンドポイント3のために定義しますが、そのCyAPI.hに設定されていない:

あなたが初期化する必要が
#define BulkOutPipe2 USBDevice->EndPoints[3] 

: CCyUSBDevice * USBDevice =新しいCCyUSBDevice(NULL、...);

レンも定義されていない。

LONG len= 512000; 

USB_BulkWrite(および他USB_は)のlibusb APIの一部であるusb_bulk_write、のように見えます。しかし、あなたはCyApi(これは非常に異なる)を使用しようとしているので、それらのメソッド呼び出しを削除してください。

+0

ありがとうございました! newCCYUSBDevice(NULL、...)の2番目のパラメータはどのようにして決定しますか? –

+0

ドキュメントによると、2番目のパラメータは、必要なIDを持つデバイスを定義します。 1つしか持っていない場合は、そのまま残してCCyUSBDevice(NULL)にしてください。 –

関連する問題