Win Usb Test ,Usb Bulk . Made by Shoichi Yamasuge. movie http://youtu.be/uGPH3AwrFpU WIN USB テスト USB BULK テスト 動画は下記 http://youtu.be/uGPH3AwrFpU usbdevice Library add. usbdevice Library を追加する必要あり。 endpoint 1 = out. endpoint 2 = in. にする事! you input venderid/productid. コンパイルする前のmain.cの venderidとproduct idを入れる必要がある。
Revision 1:9517305f74ce, committed 2014-02-26
- Comitter:
- yamasho
- Date:
- Wed Feb 26 15:20:21 2014 +0000
- Parent:
- 0:b7d14646dadd
- Commit message:
- CQ ?????2014 / 3 ??????????????; Usb Bulk??????????????; vid / pid????????????????????????????
Changed in this revision
USBBulk.lib | Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/USBBulk.lib Sat Nov 30 15:07:12 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/yamasho/code/USBBulk/#e8c90969688d
--- a/main.cpp Sat Nov 30 15:07:12 2013 +0000 +++ b/main.cpp Wed Feb 26 15:20:21 2014 +0000 @@ -2,69 +2,32 @@ #include "USBBULK.h" -USBBULK bulk(0xXXXX ,0xYYYY, 0x0001); //xxxx vender-id/yyyy product-id - -BusOut leds(LED1, LED2, LED3, LED4); -Serial pc(USBTX, USBRX); +USBBULK bulk(0xxxxx ,0xyyyy, 0x0001); // Drirver xxxx vender-id/yyyy product-id +BusOut leds(P0_17, P0_23,P0_2,P0_14); // Counter Mesure Busout Bug?=>DegitalOut uint8_t DataBuffer[MAX_BULK_SIZE]; -#define DEBUG 1 - -DigitalOut Led1(LED1); - int main(void) { - #if defined(DEBUG) - pc.printf("\n"); - pc.printf("Connecting....\n"); - #endif - bulk.connect(); - - #if defined(DEBUG) - pc.printf("Usb Connected.\n"); - pc.printf(" Code Start!!........."); - #endif - + bulk.connect(); // usb connect while ( true ) { if(bulk.readNB(DataBuffer)) { - leds = DataBuffer[2]; - #if defined(DEBUG) - ///////// for Char Debug //////////////// - for(int i = 0; i < sizeof(DataBuffer) ; i++) - { - pc.printf("%c", (char)DataBuffer[i]); - } - pc.printf("\r\n"); - ///////// for Bin Debug //////////////// - for(int i = 0; i < sizeof(DataBuffer) ; i++) - { - pc.printf("%02x ", (char)DataBuffer[i]); - } - pc.printf("\r\n"); - #endif - + leds = DataBuffer[2] ^ 0xff; if(( DataBuffer[0] == 0x06 ) && (DataBuffer[1] == char('V'))) { - #if defined(DEBUG) - pc.printf(" Version Code UsbOut "); - #endif memset(DataBuffer,0,sizeof(DataBuffer)); DataBuffer[0] = 0x06; - DataBuffer[1] = 'V'; + DataBuffer[1] = 'V'; DataBuffer[2] = 00; DataBuffer[3] = 01; - DataBuffer[4] = 00; - DataBuffer[5] = 00; - bulk.WriteNB(DataBuffer); // For Wait; + DataBuffer[4] = 02; + DataBuffer[5] = 03; + bulk.WriteNB(DataBuffer); // Echo Back; } else { - #if defined(DEBUG) - pc.printf(" Echo Back UsbOut "); - #endif - bulk.WriteNB(DataBuffer); // For Wait; + bulk.WriteNB(DataBuffer); // Echo Back; } } - } + } } \ No newline at end of file