diff --git a/examples/Bluetooth/PS3BT/PS3BT.ino b/examples/Bluetooth/PS3BT/PS3BT.ino index f8b13ad7..87cc9939 100644 --- a/examples/Bluetooth/PS3BT/PS3BT.ino +++ b/examples/Bluetooth/PS3BT/PS3BT.ino @@ -6,6 +6,10 @@ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; //USBHub Hub1(&Usb); // Some dongles have a hub inside diff --git a/examples/Bluetooth/PS3Multi/PS3Multi.ino b/examples/Bluetooth/PS3Multi/PS3Multi.ino index d7ec631c..dece1c98 100644 --- a/examples/Bluetooth/PS3Multi/PS3Multi.ino +++ b/examples/Bluetooth/PS3Multi/PS3Multi.ino @@ -7,6 +7,10 @@ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; //USBHub Hub1(&Usb); // Some dongles have a hub inside diff --git a/examples/Bluetooth/PS3SPP/PS3SPP.ino b/examples/Bluetooth/PS3SPP/PS3SPP.ino index 214ce26a..5c0a0d5a 100644 --- a/examples/Bluetooth/PS3SPP/PS3SPP.ino +++ b/examples/Bluetooth/PS3SPP/PS3SPP.ino @@ -12,6 +12,10 @@ #include #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; //USBHub Hub1(&Usb); // Some dongles have a hub inside diff --git a/examples/Bluetooth/SPP/SPP.ino b/examples/Bluetooth/SPP/SPP.ino index e5b92089..6a326a3d 100644 --- a/examples/Bluetooth/SPP/SPP.ino +++ b/examples/Bluetooth/SPP/SPP.ino @@ -6,6 +6,10 @@ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; //USBHub Hub1(&Usb); // Some dongles have a hub inside diff --git a/examples/Bluetooth/SPPMulti/SPPMulti.ino b/examples/Bluetooth/SPPMulti/SPPMulti.ino index af32fd85..23bb6ed6 100644 --- a/examples/Bluetooth/SPPMulti/SPPMulti.ino +++ b/examples/Bluetooth/SPPMulti/SPPMulti.ino @@ -6,6 +6,10 @@ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; //USBHub Hub1(&Usb); // Some dongles have a hub inside diff --git a/examples/Bluetooth/Wii/Wii.ino b/examples/Bluetooth/Wii/Wii.ino index 214625c5..f4d68a62 100644 --- a/examples/Bluetooth/Wii/Wii.ino +++ b/examples/Bluetooth/Wii/Wii.ino @@ -6,6 +6,10 @@ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; //USBHub Hub1(&Usb); // Some dongles have a hub inside diff --git a/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino b/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino index 5d0fa91b..5e49fad1 100644 --- a/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino +++ b/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino @@ -13,6 +13,10 @@ Otherwise, wire up a IR LED yourself. #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif #ifndef WIICAMERA // Used to check if WIICAMERA is defined #error "Uncomment WIICAMERA in Wii.h to use this example" diff --git a/examples/Bluetooth/WiiMulti/WiiMulti.ino b/examples/Bluetooth/WiiMulti/WiiMulti.ino index 51c9160b..d99da9a4 100644 --- a/examples/Bluetooth/WiiMulti/WiiMulti.ino +++ b/examples/Bluetooth/WiiMulti/WiiMulti.ino @@ -7,6 +7,10 @@ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; //USBHub Hub1(&Usb); // Some dongles have a hub inside diff --git a/examples/Bluetooth/WiiUProController/WiiUProController.ino b/examples/Bluetooth/WiiUProController/WiiUProController.ino index eb686879..59c4f1dc 100644 --- a/examples/Bluetooth/WiiUProController/WiiUProController.ino +++ b/examples/Bluetooth/WiiUProController/WiiUProController.ino @@ -6,6 +6,10 @@ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; //USBHub Hub1(&Usb); // Some dongles have a hub inside diff --git a/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino b/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino index b3adb558..b5944f0a 100644 --- a/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino +++ b/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino @@ -1,5 +1,9 @@ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif class KbdRptParser : public KeyboardReportParser { diff --git a/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino b/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino index 80dbcd4d..aa2e3b34 100644 --- a/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino +++ b/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino @@ -1,5 +1,9 @@ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif class MouseRptParser : public MouseReportParser { @@ -12,14 +16,14 @@ protected: virtual void OnMiddleButtonUp (MOUSEINFO *mi); virtual void OnMiddleButtonDown (MOUSEINFO *mi); }; -void MouseRptParser::OnMouseMove(MOUSEINFO *mi) +void MouseRptParser::OnMouseMove(MOUSEINFO *mi) { Serial.print("dx="); Serial.print(mi->dX, DEC); Serial.print(" dy="); Serial.println(mi->dY, DEC); }; -void MouseRptParser::OnLeftButtonUp (MOUSEINFO *mi) +void MouseRptParser::OnLeftButtonUp (MOUSEINFO *mi) { Serial.println("L Butt Up"); }; @@ -60,11 +64,11 @@ void setup() if (Usb.Init() == -1) Serial.println("OSC did not start."); - + delay( 200 ); - + next_time = millis() + 5000; - + HidMouse.SetReportParser(0,(HIDReportParser*)&Prs); } diff --git a/examples/HID/USBHID_desc/USBHID_desc.ino b/examples/HID/USBHID_desc/USBHID_desc.ino index 63ae76c7..d3558a8e 100644 --- a/examples/HID/USBHID_desc/USBHID_desc.ino +++ b/examples/HID/USBHID_desc/USBHID_desc.ino @@ -2,10 +2,11 @@ #include #include #include -#ifdef arm +#include "pgmstrings.h" +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude #include #endif -#include "pgmstrings.h" class HIDUniversal2 : public HIDUniversal { diff --git a/examples/HID/le3dp/le3dp.ino b/examples/HID/le3dp/le3dp.ino index 3728b307..fbf07b2f 100644 --- a/examples/HID/le3dp/le3dp.ino +++ b/examples/HID/le3dp/le3dp.ino @@ -5,6 +5,10 @@ #include #include "le3dp_rptparser.h" +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; USBHub Hub(&Usb); @@ -20,11 +24,11 @@ void setup() if (Usb.Init() == -1) Serial.println("OSC did not start."); - + delay( 200 ); if (!Hid.SetReportParser(0, &Joy)) - ErrorMessage(PSTR("SetReportParser"), 1 ); + ErrorMessage(PSTR("SetReportParser"), 1 ); } void loop() diff --git a/examples/HID/scale/scale.ino b/examples/HID/scale/scale.ino index 2f48c4c0..c790cb1c 100644 --- a/examples/HID/scale/scale.ino +++ b/examples/HID/scale/scale.ino @@ -6,6 +6,10 @@ #include #include "scale_rptparser.h" +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; USBHub Hub(&Usb); @@ -22,18 +26,18 @@ void setup() if (Usb.Init() == -1) Serial.println("OSC did not start."); - - // set up the LCD's number of rows and columns: + + // set up the LCD's number of rows and columns: LCD.begin(16, 2); LCD.clear(); LCD.home(); LCD.setCursor(0,0); - LCD.write('R'); - + LCD.write('R'); + delay( 200 ); if (!Hid.SetReportParser(0, &Scale)) - ErrorMessage(PSTR("SetReportParser"), 1 ); + ErrorMessage(PSTR("SetReportParser"), 1 ); } void loop() diff --git a/examples/PS3USB/PS3USB.ino b/examples/PS3USB/PS3USB.ino index b3e6e2c4..e05f55b5 100644 --- a/examples/PS3USB/PS3USB.ino +++ b/examples/PS3USB/PS3USB.ino @@ -5,6 +5,10 @@ */ #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; /* You can create the instance of the class in two ways */ diff --git a/examples/USB_desc/USB_desc.ino b/examples/USB_desc/USB_desc.ino index 7f4a363a..71e2fdc3 100644 --- a/examples/USB_desc/USB_desc.ino +++ b/examples/USB_desc/USB_desc.ino @@ -1,6 +1,10 @@ #include #include "pgmstrings.h" +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; //USBHub Hub1(&Usb); @@ -50,9 +54,9 @@ void setup() if (Usb.Init() == -1) Serial.println("OSC did not start."); - + delay( 200 ); - + next_time = millis() + 10000; } @@ -62,19 +66,19 @@ void PrintDescriptors(uint8_t addr) { uint8_t rcode = 0; byte num_conf = 0; - + rcode = getdevdescr( (byte)addr, num_conf ); - if( rcode ) + if( rcode ) { printProgStr(Gen_Error_str); print_hex( rcode, 8 ); } Serial.print("\r\n"); - + for (int i=0; i= next_time) { - Usb.ForEachUsbDevice(&PrintAllDescriptors); + Usb.ForEachUsbDevice(&PrintAllDescriptors); Usb.ForEachUsbDevice(&PrintAllAddresses); - + while( 1 ); //stop } - } + } } - + byte getdevdescr( byte addr, byte &num_conf ) { USB_DEVICE_DESCRIPTOR buf; @@ -122,7 +126,7 @@ byte getdevdescr( byte addr, byte &num_conf ) print_hex( buf.bDescriptorType, 8 ); printProgStr(Dev_Version_str); print_hex( buf.bcdUSB, 16 ); - printProgStr(Dev_Class_str); + printProgStr(Dev_Class_str); print_hex( buf.bDeviceClass, 8 ); printProgStr(Dev_Subclass_str); print_hex( buf.bDeviceSubClass, 8 ); @@ -147,46 +151,46 @@ byte getdevdescr( byte addr, byte &num_conf ) num_conf = buf.bNumConfigurations; return( 0 ); } - + void printhubdescr(uint8_t *descrptr, uint8_t addr) { HubDescriptor *pHub = (HubDescriptor*) descrptr; uint8_t len = *((uint8_t*)descrptr); - + printProgStr(PSTR("\r\n\r\nHub Descriptor:\r\n")); printProgStr(PSTR("bDescLength:\t\t")); Serial.println(pHub->bDescLength, HEX); - + printProgStr(PSTR("bDescriptorType:\t")); Serial.println(pHub->bDescriptorType, HEX); - + printProgStr(PSTR("bNbrPorts:\t\t")); Serial.println(pHub->bNbrPorts, HEX); - + printProgStr(PSTR("LogPwrSwitchMode:\t")); Serial.println(pHub->LogPwrSwitchMode, BIN); - + printProgStr(PSTR("CompoundDevice:\t\t")); Serial.println(pHub->CompoundDevice, BIN); - + printProgStr(PSTR("OverCurrentProtectMode:\t")); Serial.println(pHub->OverCurrentProtectMode, BIN); - + printProgStr(PSTR("TTThinkTime:\t\t")); Serial.println(pHub->TTThinkTime, BIN); - + printProgStr(PSTR("PortIndicatorsSupported:")); Serial.println(pHub->PortIndicatorsSupported, BIN); - + printProgStr(PSTR("Reserved:\t\t")); Serial.println(pHub->Reserved, HEX); printProgStr(PSTR("bPwrOn2PwrGood:\t\t")); Serial.println(pHub->bPwrOn2PwrGood, HEX); - + printProgStr(PSTR("bHubContrCurrent:\t")); Serial.println(pHub->bHubContrCurrent, HEX); - + for (uint8_t i=7; i> (num_nibbles-1) * 4)) & 0x0f; Serial.print(digit, HEX); - } + } while(--num_nibbles); } /* function to print configuration descriptor */ @@ -309,7 +313,7 @@ void printepdescr( uint8_t* descr_ptr ) print_hex( ep_ptr->wMaxPacketSize, 16 ); printProgStr(End_Interval_str); print_hex( ep_ptr->bInterval, 8 ); - + return; } /*function to print unknown descriptor */ @@ -329,8 +333,8 @@ void printunkdescr( uint8_t* descr_ptr ) descr_ptr++; } } - - + + /* Print a string from Program Memory directly to save RAM */ void printProgStr(const prog_char str[]) { diff --git a/examples/Xbox/XBOXOLD/XBOXOLD.ino b/examples/Xbox/XBOXOLD/XBOXOLD.ino index 1bdfc9f9..968c8df7 100644 --- a/examples/Xbox/XBOXOLD/XBOXOLD.ino +++ b/examples/Xbox/XBOXOLD/XBOXOLD.ino @@ -6,6 +6,10 @@ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; USBHub Hub1(&Usb); // The controller has a built in hub, so this instance is needed diff --git a/examples/Xbox/XBOXRECV/XBOXRECV.ino b/examples/Xbox/XBOXRECV/XBOXRECV.ino index 5896b9dc..1f43b912 100644 --- a/examples/Xbox/XBOXRECV/XBOXRECV.ino +++ b/examples/Xbox/XBOXRECV/XBOXRECV.ino @@ -6,6 +6,10 @@ */ #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; XBOXRECV Xbox(&Usb); diff --git a/examples/Xbox/XBOXUSB/XBOXUSB.ino b/examples/Xbox/XBOXUSB/XBOXUSB.ino index b7d5a625..89161d24 100644 --- a/examples/Xbox/XBOXUSB/XBOXUSB.ino +++ b/examples/Xbox/XBOXUSB/XBOXUSB.ino @@ -5,6 +5,10 @@ */ #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; XBOXUSB Xbox(&Usb); diff --git a/examples/acm/acm_terminal/acm_terminal.ino b/examples/acm/acm_terminal/acm_terminal.ino index 8fc8edea..5e4d152c 100644 --- a/examples/acm/acm_terminal/acm_terminal.ino +++ b/examples/acm/acm_terminal/acm_terminal.ino @@ -1,7 +1,12 @@ #include #include -#include "pgmstrings.h" +#include "pgmstrings.h" + +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif class ACMAsyncOper : public CDCAsyncOper { @@ -22,16 +27,16 @@ uint8_t ACMAsyncOper::OnInit(ACM *pacm) } LINE_CODING lc; - lc.dwDTERate = 115200; + lc.dwDTERate = 115200; lc.bCharFormat = 0; lc.bParityType = 0; - lc.bDataBits = 8; - + lc.bDataBits = 8; + rcode = pacm->SetLineCoding(&lc); if (rcode) ErrorMessage(PSTR("SetLineCoding"), rcode); - + return rcode; } @@ -48,17 +53,17 @@ void setup() if (Usb.Init() == -1) Serial.println("OSCOKIRQ failed to assert"); - - delay( 200 ); + + delay( 200 ); } void loop() { Usb.Task(); - - if( Acm.isReady()) { + + if( Acm.isReady()) { uint8_t rcode; - + /* reading the keyboard */ if(Serial.available()) { uint8_t data= Serial.read(); @@ -69,24 +74,24 @@ void loop() }//if(Serial.available()... delay(50); - + /* reading the phone */ /* buffer size must be greater or equal to max.packet size */ /* it it set to 64 (largest possible max.packet size) here, can be tuned down for particular endpoint */ - uint8_t buf[64]; + uint8_t buf[64]; uint16_t rcvd = 64; rcode = Acm.RcvData(&rcvd, buf); if (rcode && rcode != hrNAK) ErrorMessage(PSTR("Ret"), rcode); - + if( rcvd ) { //more than zero bytes received for(uint16_t i=0; i < rcvd; i++ ) { Serial.print((char)buf[i]); //printing on the screen - } + } } - delay(10); - }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING.. + delay(10); + }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING.. } diff --git a/examples/board_qc/board_qc.ino b/examples/board_qc/board_qc.ino index a2ca05c6..94df16cf 100644 --- a/examples/board_qc/board_qc.ino +++ b/examples/board_qc/board_qc.ino @@ -4,6 +4,10 @@ /* otherwise press any key after getting GPIO error to complete the test */ /**/ #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif /* variables */ uint8_t rcode; diff --git a/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino b/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino index ad3d319e..26b5624d 100644 --- a/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino +++ b/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino @@ -1,7 +1,11 @@ #include #include -#include "pgmstrings.h" +#include "pgmstrings.h" +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif class FTDIAsync : public FTDIAsyncOper { @@ -12,7 +16,7 @@ public: uint8_t FTDIAsync::OnInit(FTDI *pftdi) { uint8_t rcode = 0; - + rcode = pftdi->SetBaudRate(115200); if (rcode) @@ -21,10 +25,10 @@ uint8_t FTDIAsync::OnInit(FTDI *pftdi) return rcode; } rcode = pftdi->SetFlowControl(FTDI_SIO_DISABLE_FLOW_CTRL); - + if (rcode) ErrorMessage(PSTR("SetFlowControl"), rcode); - + return rcode; } @@ -43,48 +47,48 @@ void setup() if (Usb.Init() == -1) Serial.println("OSC did not start."); - + delay( 200 ); - + next_time = millis() + 5000; } void loop() { Usb.Task(); - + if( Usb.getUsbTaskState() == USB_STATE_RUNNING ) - { + { uint8_t rcode; char strbuf[] = "DEADBEEF"; //char strbuf[] = "The quick brown fox jumps over the lazy dog"; //char strbuf[] = "This string contains 61 character to demonstrate FTDI buffers"; //add one symbol to it to see some garbage Serial.print("."); - + rcode = Ftdi.SndData(strlen(strbuf), (uint8_t*)strbuf); if (rcode) ErrorMessage(PSTR("SndData"), rcode); delay(50); - + uint8_t buf[64]; - + for (uint8_t i=0; i<64; i++) buf[i] = 0; - + uint16_t rcvd = 64; rcode = Ftdi.RcvData(&rcvd, buf); - + if (rcode && rcode != hrNAK) ErrorMessage(PSTR("Ret"), rcode); - + // The device reserves the first two bytes of data // to contain the current values of the modem and line status registers. - if (rcvd > 2) - Serial.print((char*)(buf+2)); - - delay(10); - } + if (rcvd > 2) + Serial.print((char*)(buf+2)); + + delay(10); + } } diff --git a/examples/hub_demo/hub_demo.ino b/examples/hub_demo/hub_demo.ino index 77c502fe..d80d9ea2 100644 --- a/examples/hub_demo/hub_demo.ino +++ b/examples/hub_demo/hub_demo.ino @@ -1,5 +1,9 @@ #include #include "pgmstrings.h" +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif USB Usb; USBHub Hub1(&Usb); @@ -46,9 +50,9 @@ void setup() if (Usb.Init() == -1) Serial.println("OSC did not start."); - + delay( 200 ); - + next_time = millis() + 10000; } @@ -58,19 +62,19 @@ void PrintDescriptors(uint8_t addr) { uint8_t rcode = 0; byte num_conf = 0; - + rcode = getdevdescr( (byte)addr, num_conf ); - if( rcode ) + if( rcode ) { printProgStr(Gen_Error_str); print_hex( rcode, 8 ); } Serial.print("\r\n"); - + for (int i=0; i= next_time) { - Usb.ForEachUsbDevice(&PrintAllDescriptors); + Usb.ForEachUsbDevice(&PrintAllDescriptors); Usb.ForEachUsbDevice(&PrintAllAddresses); - + while( 1 ); //stop } - } + } } - + byte getdevdescr( byte addr, byte &num_conf ) { USB_DEVICE_DESCRIPTOR buf; @@ -118,7 +122,7 @@ byte getdevdescr( byte addr, byte &num_conf ) print_hex( buf.bDescriptorType, 8 ); printProgStr(Dev_Version_str); print_hex( buf.bcdUSB, 16 ); - printProgStr(Dev_Class_str); + printProgStr(Dev_Class_str); print_hex( buf.bDeviceClass, 8 ); printProgStr(Dev_Subclass_str); print_hex( buf.bDeviceSubClass, 8 ); @@ -143,46 +147,46 @@ byte getdevdescr( byte addr, byte &num_conf ) num_conf = buf.bNumConfigurations; return( 0 ); } - + void printhubdescr(uint8_t *descrptr, uint8_t addr) { HubDescriptor *pHub = (HubDescriptor*) descrptr; uint8_t len = *((uint8_t*)descrptr); - + printProgStr(PSTR("\r\n\r\nHub Descriptor:\r\n")); printProgStr(PSTR("bDescLength:\t\t")); Serial.println(pHub->bDescLength, HEX); - + printProgStr(PSTR("bDescriptorType:\t")); Serial.println(pHub->bDescriptorType, HEX); - + printProgStr(PSTR("bNbrPorts:\t\t")); Serial.println(pHub->bNbrPorts, HEX); - + printProgStr(PSTR("LogPwrSwitchMode:\t")); Serial.println(pHub->LogPwrSwitchMode, BIN); - + printProgStr(PSTR("CompoundDevice:\t\t")); Serial.println(pHub->CompoundDevice, BIN); - + printProgStr(PSTR("OverCurrentProtectMode:\t")); Serial.println(pHub->OverCurrentProtectMode, BIN); - + printProgStr(PSTR("TTThinkTime:\t\t")); Serial.println(pHub->TTThinkTime, BIN); - + printProgStr(PSTR("PortIndicatorsSupported:")); Serial.println(pHub->PortIndicatorsSupported, BIN); - + printProgStr(PSTR("Reserved:\t\t")); Serial.println(pHub->Reserved, HEX); printProgStr(PSTR("bPwrOn2PwrGood:\t\t")); Serial.println(pHub->bPwrOn2PwrGood, HEX); - + printProgStr(PSTR("bHubContrCurrent:\t")); Serial.println(pHub->bHubContrCurrent, HEX); - + for (uint8_t i=7; i> (num_nibbles-1) * 4)) & 0x0f; Serial.print(digit, HEX); - } + } while(--num_nibbles); } /* function to print configuration descriptor */ @@ -305,7 +309,7 @@ void printepdescr( uint8_t* descr_ptr ) print_hex( ep_ptr->wMaxPacketSize, 16 ); printProgStr(End_Interval_str); print_hex( ep_ptr->bInterval, 8 ); - + return; } /*function to print unknown descriptor */ @@ -325,8 +329,8 @@ void printunkdescr( uint8_t* descr_ptr ) descr_ptr++; } } - - + + /* Print a string from Program Memory directly to save RAM */ void printProgStr(const prog_char str[]) { diff --git a/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino b/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino index fea00e52..4770809d 100644 --- a/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino +++ b/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino @@ -4,6 +4,10 @@ /* CDC support */ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif class PLAsyncOper : public CDCAsyncOper { @@ -14,7 +18,7 @@ public: uint8_t PLAsyncOper::OnInit(ACM *pacm) { uint8_t rcode; - + // Set DTR = 1 rcode = pacm->SetControlLineState(1); @@ -29,13 +33,13 @@ uint8_t PLAsyncOper::OnInit(ACM *pacm) lc.dwDTERate = 115200; lc.bCharFormat = 0; lc.bParityType = 0; - lc.bDataBits = 8; - + lc.bDataBits = 8; + rcode = pacm->SetLineCoding(&lc); if (rcode) ErrorMessage(PSTR("SetLineCoding"), rcode); - + return rcode; } USB Usb; @@ -51,43 +55,43 @@ void setup() if (Usb.Init() == -1) Serial.println("OSCOKIRQ failed to assert"); - - delay( 200 ); + + delay( 200 ); } void loop() { Usb.Task(); - + if( Usb.getUsbTaskState() == USB_STATE_RUNNING ) - { + { uint8_t rcode; - + /* reading the keyboard */ if(Serial.available()) { uint8_t data= Serial.read(); - + /* sending to the phone */ rcode = Pl.SndData(1, &data); if (rcode) ErrorMessage(PSTR("SndData"), rcode); }//if(Serial.available()... - + /* reading the converter */ /* buffer size must be greater or equal to max.packet size */ /* it it set to 64 (largest possible max.packet size) here, can be tuned down for particular endpoint */ - uint8_t buf[64]; + uint8_t buf[64]; uint16_t rcvd = 64; rcode = Pl.RcvData(&rcvd, buf); if (rcode && rcode != hrNAK) ErrorMessage(PSTR("Ret"), rcode); - + if( rcvd ) { //more than zero bytes received for(uint16_t i=0; i < rcvd; i++ ) { - Serial.print((char)buf[i]); //printing on the screen - } + Serial.print((char)buf[i]); //printing on the screen + } }//if( rcvd ... - }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING.. + }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING.. } diff --git a/examples/pl2303/pl2303_gps/pl2303_gps.ino b/examples/pl2303/pl2303_gps/pl2303_gps.ino index f756f408..9f33766a 100644 --- a/examples/pl2303/pl2303_gps/pl2303_gps.ino +++ b/examples/pl2303/pl2303_gps/pl2303_gps.ino @@ -5,6 +5,10 @@ /* CDC support */ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif class PLAsyncOper : public CDCAsyncOper { @@ -15,7 +19,7 @@ public: uint8_t PLAsyncOper::OnInit(ACM *pacm) { uint8_t rcode; - + // Set DTR = 1 rcode = pacm->SetControlLineState(1); @@ -26,16 +30,16 @@ uint8_t PLAsyncOper::OnInit(ACM *pacm) } LINE_CODING lc; - lc.dwDTERate = 4800; //default serial speed of GPS unit + lc.dwDTERate = 4800; //default serial speed of GPS unit lc.bCharFormat = 0; lc.bParityType = 0; - lc.bDataBits = 8; - + lc.bDataBits = 8; + rcode = pacm->SetLineCoding(&lc); if (rcode) ErrorMessage(PSTR("SetLineCoding"), rcode); - + return rcode; } @@ -54,32 +58,32 @@ void setup() if (Usb.Init() == -1) Serial.println("OSCOKIRQ failed to assert"); - - delay( 200 ); + + delay( 200 ); } void loop() { uint8_t rcode; -uint8_t buf[64]; //serial buffer equals Max.packet size of bulk-IN endpoint -uint16_t rcvd = 64; +uint8_t buf[64]; //serial buffer equals Max.packet size of bulk-IN endpoint +uint16_t rcvd = 64; Usb.Task(); - - if( Pl.isReady()) { + + if( Pl.isReady()) { /* reading the GPS */ if( read_delay < millis() ){ - read_delay += READ_DELAY; + read_delay += READ_DELAY; rcode = Pl.RcvData(&rcvd, buf); if ( rcode && rcode != hrNAK ) - ErrorMessage(PSTR("Ret"), rcode); + ErrorMessage(PSTR("Ret"), rcode); if( rcvd ) { //more than zero bytes received for( uint16_t i=0; i < rcvd; i++ ) { Serial.print((char)buf[i]); //printing on the screen - }//for( uint16_t i=0; i < rcvd; i++... + }//for( uint16_t i=0; i < rcvd; i++... }//if( rcvd - }//if( read_delay > millis()... - }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING.. + }//if( read_delay > millis()... + }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING.. } diff --git a/examples/pl2303/pl2303_tinygps/pl2303_tinygps.ino b/examples/pl2303/pl2303_tinygps/pl2303_tinygps.ino index 818df512..db25e42a 100644 --- a/examples/pl2303/pl2303_tinygps/pl2303_tinygps.ino +++ b/examples/pl2303/pl2303_tinygps/pl2303_tinygps.ino @@ -11,6 +11,10 @@ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif /* This sample code demonstrates the normal use of a TinyGPS object. Modified to be used with USB Host Shield Library r2.0 @@ -26,7 +30,7 @@ public: uint8_t PLAsyncOper::OnInit(ACM *pacm) { uint8_t rcode; - + // Set DTR = 1 rcode = pacm->SetControlLineState(1); @@ -36,17 +40,17 @@ uint8_t PLAsyncOper::OnInit(ACM *pacm) } LINE_CODING lc; - lc.dwDTERate = 4800; //default serial speed of GPS unit + lc.dwDTERate = 4800; //default serial speed of GPS unit lc.bCharFormat = 0; lc.bParityType = 0; - lc.bDataBits = 8; - + lc.bDataBits = 8; + rcode = pacm->SetLineCoding(&lc); if (rcode) { ErrorMessage(PSTR("SetLineCoding"), rcode); } - + return rcode; } @@ -65,7 +69,7 @@ void setup() Serial.begin(115200); while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection - + Serial.print("Testing TinyGPS library v. "); Serial.println(TinyGPS::library_version()); Serial.println("by Mikal Hart"); Serial.println(); @@ -75,16 +79,16 @@ void setup() if (Usb.Init() == -1) { Serial.println("OSCOKIRQ failed to assert"); } - - delay( 200 ); + + delay( 200 ); } void loop() { Usb.Task(); - + if( Pl.isReady()) { - + bool newdata = false; unsigned long start = millis(); @@ -94,7 +98,7 @@ void loop() newdata = true; } }//while (millis()... - + if (newdata) { Serial.println("Acquired Data"); Serial.println("-------------"); @@ -118,7 +122,7 @@ void printFloat(double number, int digits) double rounding = 0.5; for (uint8_t i=0; i 0) - Serial.print("."); + Serial.print("."); // Extract digits from the remainder one at a time while (digits-- > 0) @@ -136,8 +140,8 @@ void printFloat(double number, int digits) remainder *= 10.0; int toPrint = int(remainder); Serial.print(toPrint); - remainder -= toPrint; - } + remainder -= toPrint; + } } void gpsdump(TinyGPS &gps) @@ -150,9 +154,9 @@ void gpsdump(TinyGPS &gps) unsigned short sentences, failed; gps.get_position(&lat, &lon, &age); - Serial.print("Lat/Long(10^-5 deg): "); Serial.print(lat); Serial.print(", "); Serial.print(lon); + Serial.print("Lat/Long(10^-5 deg): "); Serial.print(lat); Serial.print(", "); Serial.print(lon); Serial.print(" Fix age: "); Serial.print(age); Serial.println("ms."); - + feedgps(); // If we don't feed the gps during this long routine, we may drop characters and get checksum errors gps.f_get_position(&flat, &flon, &age); @@ -171,7 +175,7 @@ void gpsdump(TinyGPS &gps) Serial.print("Date: "); Serial.print(static_cast(month)); Serial.print("/"); Serial.print(static_cast(day)); Serial.print("/"); Serial.print(year); Serial.print(" Time: "); Serial.print(static_cast(hour)); Serial.print(":"); Serial.print(static_cast(minute)); Serial.print(":"); Serial.print(static_cast(second)); Serial.print("."); Serial.print(static_cast(hundredths)); Serial.print(" Fix age: "); Serial.print(age); Serial.println("ms."); - + feedgps(); Serial.print("Alt(cm): "); Serial.print(gps.altitude()); Serial.print(" Course(10^-2 deg): "); Serial.print(gps.course()); Serial.print(" Speed(10^-2 knots): "); Serial.println(gps.speed()); @@ -184,13 +188,13 @@ void gpsdump(TinyGPS &gps) gps.stats(&chars, &sentences, &failed); Serial.print("Stats: characters: "); Serial.print(chars); Serial.print(" sentences: "); Serial.print(sentences); Serial.print(" failed checksum: "); Serial.println(failed); } - + bool feedgps() { uint8_t rcode; - uint8_t buf[64]; //serial buffer equals Max.packet size of bulk-IN endpoint - uint16_t rcvd = 64; - { + uint8_t buf[64]; //serial buffer equals Max.packet size of bulk-IN endpoint + uint16_t rcvd = 64; + { /* reading the GPS */ rcode = Pl.RcvData(&rcvd, buf); if (rcode && rcode != hrNAK) @@ -201,7 +205,7 @@ bool feedgps() if( gps.encode((char)buf[i])) { //feed a character to gps object rcode = true; }//if( gps.encode(buf[i]... - }//for( uint16_t i=0; i < rcvd; i++... + }//for( uint16_t i=0; i < rcvd; i++... }//if( rcvd... } return( rcode ); diff --git a/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino b/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino index 60a3e15d..9e17d3cf 100644 --- a/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino +++ b/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino @@ -5,6 +5,10 @@ /* CDC support */ #include #include +// Satisfy IDE, which only needs to see the include statment in the ino. +#ifdef dobogusinclude +#include +#endif class PLAsyncOper : public CDCAsyncOper { @@ -15,7 +19,7 @@ public: uint8_t PLAsyncOper::OnInit(ACM *pacm) { uint8_t rcode; - + // Set DTR = 1 rcode = pacm->SetControlLineState(1); @@ -26,16 +30,16 @@ uint8_t PLAsyncOper::OnInit(ACM *pacm) } LINE_CODING lc; - lc.dwDTERate = 115200; + lc.dwDTERate = 115200; lc.bCharFormat = 0; lc.bParityType = 0; - lc.bDataBits = 8; - + lc.bDataBits = 8; + rcode = pacm->SetLineCoding(&lc); if (rcode) ErrorMessage(PSTR("SetLineCoding"), rcode); - + return rcode; } USB Usb; @@ -51,29 +55,29 @@ void setup() if (Usb.Init() == -1) Serial.println("OSCOKIRQ failed to assert"); - - delay( 200 ); + + delay( 200 ); } void loop() { Usb.Task(); - + if( Usb.getUsbTaskState() == USB_STATE_RUNNING ) - { + { uint8_t rcode; - + /* reading the keyboard */ if(Serial.available()) { uint8_t data= Serial.read(); - + if ( data == '\r' ) { Serial.print("\r\n"); //insert linefeed } else { Serial.print( data ); //echo back to the screen } - + /* sending to the phone */ rcode = Pl.SndData(1, &data); if (rcode) @@ -81,17 +85,17 @@ void loop() }//if(Serial.available()... delay(50); - + /* reading the converter */ /* buffer size must be greater or equal to max.packet size */ /* it it set to 64 (largest possible max.packet size) here, can be tuned down for particular endpoint */ - uint8_t buf[64]; + uint8_t buf[64]; uint16_t rcvd = 64; rcode = Pl.RcvData(&rcvd, buf); if (rcode && rcode != hrNAK) ErrorMessage(PSTR("Ret"), rcode); - + if( rcvd ) { //more than zero bytes received for(uint16_t i=0; i < rcvd; i++ ) { if( buf[i] =='\r' ) { @@ -100,10 +104,10 @@ void loop() else { Serial.print((char)buf[i]); //printing on the screen } - } + } } - delay(10); - }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING.. + delay(10); + }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING.. }