From a0d163b8fb14485b5e1ca7adacf9fe6682dbab38 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Tue, 19 Jan 2016 16:52:34 +0100 Subject: [PATCH] Fixed all libraries after 6c36eed2394b7416f6cfa0a18b4376c4af6832e6 --- examples/Bluetooth/BTHID/BTHID.ino | 10 ++--- examples/Bluetooth/PS3BT/PS3BT.ino | 10 ++--- examples/Bluetooth/PS3Multi/PS3Multi.ino | 10 ++--- examples/Bluetooth/PS3SPP/PS3SPP.ino | 10 ++--- examples/Bluetooth/PS4BT/PS4BT.ino | 10 ++--- examples/Bluetooth/SPP/SPP.ino | 10 ++--- examples/Bluetooth/SPPMulti/SPPMulti.ino | 10 ++--- examples/Bluetooth/Wii/Wii.ino | 10 ++--- .../WiiBalanceBoard/WiiBalanceBoard.ino | 10 ++--- .../Bluetooth/WiiIRCamera/WiiIRCamera.ino | 10 ++--- examples/Bluetooth/WiiMulti/WiiMulti.ino | 10 ++--- .../WiiUProController/WiiUProController.ino | 10 ++--- examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino | 10 ++--- .../USBHIDBootKbdAndMouse.ino | 14 +++---- .../HID/USBHIDBootMouse/USBHIDBootMouse.ino | 10 ++--- .../HID/USBHIDJoystick/USBHIDJoystick.ino | 10 ++--- examples/HID/USBHID_desc/USBHID_desc.ino | 12 +++--- examples/HID/le3dp/le3dp.ino | 10 ++--- examples/HID/scale/scale.ino | 12 +++--- examples/PS3USB/PS3USB.ino | 10 ++--- examples/PS4USB/PS4USB.ino | 8 ++-- examples/PSBuzz/PSBuzz.ino | 8 ++-- examples/USB_desc/USB_desc.ino | 38 +++++++++--------- examples/Xbox/XBOXOLD/XBOXOLD.ino | 10 ++--- examples/Xbox/XBOXONE/XBOXONE.ino | 10 +++-- examples/Xbox/XBOXRECV/XBOXRECV.ino | 8 ++-- examples/Xbox/XBOXUSB/XBOXUSB.ino | 8 ++-- examples/acm/acm_terminal/acm_terminal.ino | 12 +++--- .../adk/ArduinoBlinkLED/ArduinoBlinkLED.ino | 8 ++-- examples/adk/adk_barcode/adk_barcode.ino | 18 ++++----- examples/adk/demokit_20/demokit_20.ino | 14 +++---- examples/adk/term_test/term_test.ino | 12 +++--- examples/adk/term_time/term_time.ino | 12 +++--- examples/board_qc/board_qc.ino | 40 +++++++++---------- .../cdc_XR21B1411/XR_terminal/XR_terminal.ino | 8 ++-- .../ftdi/USBFTDILoopback/USBFTDILoopback.ino | 12 +++--- examples/hub_demo/hub_demo.ino | 32 +++++++-------- examples/max_LCD/max_LCD.ino | 4 +- .../pl2303_gprs_terminal.ino | 14 +++---- examples/pl2303/pl2303_gps/pl2303_gps.ino | 12 +++--- .../pl2303/pl2303_tinygps/pl2303_tinygps.ino | 12 +++--- .../pl2303_xbee_terminal.ino | 14 +++---- examples/testusbhostFAT/testusbhostFAT.ino | 14 +++---- 43 files changed, 269 insertions(+), 267 deletions(-) diff --git a/examples/Bluetooth/BTHID/BTHID.ino b/examples/Bluetooth/BTHID/BTHID.ino index d0504012..80345461 100644 --- a/examples/Bluetooth/BTHID/BTHID.ino +++ b/examples/Bluetooth/BTHID/BTHID.ino @@ -15,9 +15,9 @@ #include #endif -USB Usb; -//USBHub Hub1(&Usb); // Some dongles have a hub inside -BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so +USBHost usb; +//USBHub Hub1(&usb); // Some dongles have a hub inside +BTD Btd(&usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instance of the class in two ways */ // This will start an inquiry and then pair with your device - you only have to do this once @@ -35,7 +35,7 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); // Halt } @@ -51,5 +51,5 @@ void setup() { Serial.print(F("\r\nHID Bluetooth Library Started")); } void loop() { - Usb.Task(); + usb.Task(); } diff --git a/examples/Bluetooth/PS3BT/PS3BT.ino b/examples/Bluetooth/PS3BT/PS3BT.ino index b8967344..afceda9f 100644 --- a/examples/Bluetooth/PS3BT/PS3BT.ino +++ b/examples/Bluetooth/PS3BT/PS3BT.ino @@ -13,10 +13,10 @@ #include #endif -USB Usb; -//USBHub Hub1(&Usb); // Some dongles have a hub inside +USBHost usb; +//USBHub Hub1(&usb); // Some dongles have a hub inside -BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so +BTD Btd(&usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instance of the class in two ways */ PS3BT PS3(&Btd); // This will just create the instance //PS3BT PS3(&Btd, 0x00, 0x15, 0x83, 0x3D, 0x0A, 0x57); // This will also store the bluetooth address - this can be obtained from the dongle when running the sketch @@ -29,14 +29,14 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nPS3 Bluetooth Library Started")); } void loop() { - Usb.Task(); + usb.Task(); if (PS3.PS3Connected || PS3.PS3NavigationConnected) { if (PS3.getAnalogHat(LeftHatX) > 137 || PS3.getAnalogHat(LeftHatX) < 117 || PS3.getAnalogHat(LeftHatY) > 137 || PS3.getAnalogHat(LeftHatY) < 117 || PS3.getAnalogHat(RightHatX) > 137 || PS3.getAnalogHat(RightHatX) < 117 || PS3.getAnalogHat(RightHatY) > 137 || PS3.getAnalogHat(RightHatY) < 117) { diff --git a/examples/Bluetooth/PS3Multi/PS3Multi.ino b/examples/Bluetooth/PS3Multi/PS3Multi.ino index 5ebfd781..86e9df4c 100644 --- a/examples/Bluetooth/PS3Multi/PS3Multi.ino +++ b/examples/Bluetooth/PS3Multi/PS3Multi.ino @@ -14,10 +14,10 @@ #include #endif -USB Usb; -//USBHub Hub1(&Usb); // Some dongles have a hub inside +USBHost usb; +//USBHub Hub1(&usb); // Some dongles have a hub inside -BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so +BTD Btd(&usb); // You have to create the Bluetooth Dongle instance like so PS3BT *PS3[2]; // We will use this pointer to store the two instance, you can easily make it larger if you like, but it will use a lot of RAM! const uint8_t length = sizeof(PS3) / sizeof(PS3[0]); // Get the lenght of the array bool printAngle[length]; @@ -33,14 +33,14 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nPS3 Bluetooth Library Started")); } void loop() { - Usb.Task(); + usb.Task(); for (uint8_t i = 0; i < length; i++) { if (PS3[i]->PS3Connected || PS3[i]->PS3NavigationConnected) { diff --git a/examples/Bluetooth/PS3SPP/PS3SPP.ino b/examples/Bluetooth/PS3SPP/PS3SPP.ino index 8f234cbd..bfc8e4c5 100644 --- a/examples/Bluetooth/PS3SPP/PS3SPP.ino +++ b/examples/Bluetooth/PS3SPP/PS3SPP.ino @@ -19,10 +19,10 @@ #include #endif -USB Usb; -//USBHub Hub1(&Usb); // Some dongles have a hub inside +USBHost usb; +//USBHub Hub1(&usb); // Some dongles have a hub inside -BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so +BTD Btd(&usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instances of the bluetooth services in two ways */ SPP SerialBT(&Btd); // This will set the name to the defaults: "Arduino" and the pin to "0000" @@ -38,7 +38,7 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } @@ -46,7 +46,7 @@ void setup() { output.reserve(200); // Reserve 200 bytes for the output string } void loop() { - Usb.Task(); // The SPP data is actually not send until this is called, one could call SerialBT.send() directly as well + usb.Task(); // The SPP data is actually not send until this is called, one could call SerialBT.send() directly as well if (SerialBT.connected) { if (firstMessage) { diff --git a/examples/Bluetooth/PS4BT/PS4BT.ino b/examples/Bluetooth/PS4BT/PS4BT.ino index c3ba696b..cd2ae6e3 100644 --- a/examples/Bluetooth/PS4BT/PS4BT.ino +++ b/examples/Bluetooth/PS4BT/PS4BT.ino @@ -13,9 +13,9 @@ #include #endif -USB Usb; -//USBHub Hub1(&Usb); // Some dongles have a hub inside -BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so +USBHost usb; +//USBHub Hub1(&usb); // Some dongles have a hub inside +BTD Btd(&usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instance of the PS4BT class in two ways */ // This will start an inquiry and then pair with the PS4 controller - you only have to do this once @@ -33,14 +33,14 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); // Halt } Serial.print(F("\r\nPS4 Bluetooth Library Started")); } void loop() { - Usb.Task(); + usb.Task(); if (PS4.connected()) { if (PS4.getAnalogHat(LeftHatX) > 137 || PS4.getAnalogHat(LeftHatX) < 117 || PS4.getAnalogHat(LeftHatY) > 137 || PS4.getAnalogHat(LeftHatY) < 117 || PS4.getAnalogHat(RightHatX) > 137 || PS4.getAnalogHat(RightHatX) < 117 || PS4.getAnalogHat(RightHatY) > 137 || PS4.getAnalogHat(RightHatY) < 117) { diff --git a/examples/Bluetooth/SPP/SPP.ino b/examples/Bluetooth/SPP/SPP.ino index 8fb9c4ec..c08e100f 100644 --- a/examples/Bluetooth/SPP/SPP.ino +++ b/examples/Bluetooth/SPP/SPP.ino @@ -13,10 +13,10 @@ #include #endif -USB Usb; -//USBHub Hub1(&Usb); // Some dongles have a hub inside +USBHost usb; +//USBHub Hub1(&usb); // Some dongles have a hub inside -BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so +BTD Btd(&usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instance of the class in two ways */ SPP SerialBT(&Btd); // This will set the name to the defaults: "Arduino" and the pin to "0000" //SPP SerialBT(&Btd, "Lauszus's Arduino", "1234"); // You can also set the name and pin like so @@ -28,14 +28,14 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nSPP Bluetooth Library Started")); } void loop() { - Usb.Task(); // The SPP data is actually not send until this is called, one could call SerialBT.send() directly as well + usb.Task(); // The SPP data is actually not send until this is called, one could call SerialBT.send() directly as well if (SerialBT.connected) { if (firstMessage) { diff --git a/examples/Bluetooth/SPPMulti/SPPMulti.ino b/examples/Bluetooth/SPPMulti/SPPMulti.ino index df521d8e..4b9685dd 100644 --- a/examples/Bluetooth/SPPMulti/SPPMulti.ino +++ b/examples/Bluetooth/SPPMulti/SPPMulti.ino @@ -13,10 +13,10 @@ #include #endif -USB Usb; -//USBHub Hub1(&Usb); // Some dongles have a hub inside +USBHost usb; +//USBHub Hub1(&usb); // Some dongles have a hub inside -BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so +BTD Btd(&usb); // You have to create the Bluetooth Dongle instance like so const uint8_t length = 2; // Set the number of instances here SPP *SerialBT[length]; // We will use this pointer to store the instances, you can easily make it larger if you like, but it will use a lot of RAM! @@ -31,7 +31,7 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); // Halt } @@ -39,7 +39,7 @@ void setup() { } void loop() { - Usb.Task(); // The SPP data is actually not send until this is called, one could call SerialBT.send() directly as well + usb.Task(); // The SPP data is actually not send until this is called, one could call SerialBT.send() directly as well for (uint8_t i = 0; i < length; i++) { if (SerialBT[i]->connected) { diff --git a/examples/Bluetooth/Wii/Wii.ino b/examples/Bluetooth/Wii/Wii.ino index b1935681..9f3cb9d9 100644 --- a/examples/Bluetooth/Wii/Wii.ino +++ b/examples/Bluetooth/Wii/Wii.ino @@ -13,10 +13,10 @@ #include #endif -USB Usb; -//USBHub Hub1(&Usb); // Some dongles have a hub inside +USBHost usb; +//USBHub Hub1(&usb); // Some dongles have a hub inside -BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so +BTD Btd(&usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instance of the class in two ways */ WII Wii(&Btd, PAIR); // This will start an inquiry and then pair with your Wiimote - you only have to do this once //WII Wii(&Btd); // After that you can simply create the instance like so and then press any button on the Wiimote @@ -28,14 +28,14 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nWiimote Bluetooth Library Started")); } void loop() { - Usb.Task(); + usb.Task(); if (Wii.wiimoteConnected) { if (Wii.getButtonClick(HOME)) { // You can use getButtonPress to see if the button is held down Serial.print(F("\r\nHOME")); diff --git a/examples/Bluetooth/WiiBalanceBoard/WiiBalanceBoard.ino b/examples/Bluetooth/WiiBalanceBoard/WiiBalanceBoard.ino index 18c5b411..5cdd3212 100644 --- a/examples/Bluetooth/WiiBalanceBoard/WiiBalanceBoard.ino +++ b/examples/Bluetooth/WiiBalanceBoard/WiiBalanceBoard.ino @@ -13,10 +13,10 @@ #include #endif -USB Usb; -//USBHub Hub1(&Usb); // Some dongles have a hub inside +USBHost usb; +//USBHub Hub1(&usb); // Some dongles have a hub inside -BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so +BTD Btd(&usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instance of the class in two ways */ WII Wii(&Btd, PAIR); // This will start an inquiry and then pair with your Wii Balance Board - you only have to do this once //WII Wii(&Btd); // After that you can simply create the instance like so and then press the power button on the Wii Balance Board @@ -26,14 +26,14 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nWii Balance Board Bluetooth Library Started")); } void loop() { - Usb.Task(); + usb.Task(); if (Wii.wiiBalanceBoardConnected) { Serial.print(F("\r\nWeight: ")); for (uint8_t i = 0; i < 4; i++) { diff --git a/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino b/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino index 573b8bd4..c67ef424 100644 --- a/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino +++ b/examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino @@ -24,10 +24,10 @@ Otherwise, wire up a IR LED yourself. #error "Please set ENABLE_WII_IR_CAMERA to 1 in settings.h" #endif -USB Usb; -//USBHub Hub1(&Usb); // Some dongles have a hub inside +USBHost usb; +//USBHub Hub1(&usb); // Some dongles have a hub inside -BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so +BTD Btd(&usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instance of the class in two ways */ WII Wii(&Btd, PAIR); // This will start an inquiry and then pair with your Wiimote - you only have to do this once //WII Wii(&Btd); // After the Wiimote pairs once with the line of code above, you can simply create the instance like so and re upload and then press any button on the Wiimote @@ -40,7 +40,7 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } @@ -48,7 +48,7 @@ void setup() { } void loop() { - Usb.Task(); + usb.Task(); if (Wii.wiimoteConnected) { if (Wii.getButtonClick(HOME)) { // You can use getButtonPress to see if the button is held down Serial.print(F("\r\nHOME")); diff --git a/examples/Bluetooth/WiiMulti/WiiMulti.ino b/examples/Bluetooth/WiiMulti/WiiMulti.ino index 07c6f13d..d5bdde49 100644 --- a/examples/Bluetooth/WiiMulti/WiiMulti.ino +++ b/examples/Bluetooth/WiiMulti/WiiMulti.ino @@ -14,10 +14,10 @@ #include #endif -USB Usb; -//USBHub Hub1(&Usb); // Some dongles have a hub inside +USBHost usb; +//USBHub Hub1(&usb); // Some dongles have a hub inside -BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so +BTD Btd(&usb); // You have to create the Bluetooth Dongle instance like so WII *Wii[2]; // We will use this pointer to store the two instance, you can easily make it larger if you like, but it will use a lot of RAM! const uint8_t length = sizeof(Wii) / sizeof(Wii[0]); // Get the lenght of the array bool printAngle[length]; @@ -33,14 +33,14 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nWiimote Bluetooth Library Started")); } void loop() { - Usb.Task(); + usb.Task(); for (uint8_t i = 0; i < length; i++) { if (Wii[i]->wiimoteConnected) { diff --git a/examples/Bluetooth/WiiUProController/WiiUProController.ino b/examples/Bluetooth/WiiUProController/WiiUProController.ino index ab35a274..442c70ca 100644 --- a/examples/Bluetooth/WiiUProController/WiiUProController.ino +++ b/examples/Bluetooth/WiiUProController/WiiUProController.ino @@ -13,10 +13,10 @@ #include #endif -USB Usb; -//USBHub Hub1(&Usb); // Some dongles have a hub inside +USBHost usb; +//USBHub Hub1(&usb); // Some dongles have a hub inside -BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so +BTD Btd(&usb); // You have to create the Bluetooth Dongle instance like so /* You can create the instance of the class in two ways */ WII Wii(&Btd, PAIR); // This will start an inquiry and then pair with your Wiimote - you only have to do this once //WII Wii(&Btd); // After that you can simply create the instance like so and then press any button on the Wiimote @@ -26,14 +26,14 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nWiimote Bluetooth Library Started")); } void loop() { - Usb.Task(); + usb.Task(); if (Wii.wiiUProControllerConnected) { if (Wii.getButtonClick(HOME)) { // You can use getButtonPress to see if the button is held down Serial.print(F("\r\nHome")); diff --git a/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino b/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino index 9667bfbc..2dae9c2a 100644 --- a/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino +++ b/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino @@ -96,9 +96,9 @@ void KbdRptParser::OnKeyPressed(uint8_t key) Serial.println((char)key); }; -USB Usb; -//USBHub Hub(&Usb); -HIDBoot HidKeyboard(&Usb); +USBHost usb; +//USBHub Hub(&usb); +HIDBoot HidKeyboard(&usb); uint32_t next_time; @@ -112,7 +112,7 @@ void setup() #endif Serial.println("Start"); - if (Usb.Init() == -1) + if (usb.Init() == -1) Serial.println("OSC did not start."); delay( 200 ); @@ -124,6 +124,6 @@ void setup() void loop() { - Usb.Task(); + usb.Task(); } diff --git a/examples/HID/USBHIDBootKbdAndMouse/USBHIDBootKbdAndMouse.ino b/examples/HID/USBHIDBootKbdAndMouse/USBHIDBootKbdAndMouse.ino index a4ffe25c..75fc405d 100644 --- a/examples/HID/USBHIDBootKbdAndMouse/USBHIDBootKbdAndMouse.ino +++ b/examples/HID/USBHIDBootKbdAndMouse/USBHIDBootKbdAndMouse.ino @@ -138,12 +138,12 @@ void KbdRptParser::OnKeyPressed(uint8_t key) Serial.println((char)key); }; -USB Usb; -USBHub Hub(&Usb); +USBHost usb; +USBHub Hub(&usb); -HIDBoot < USB_HID_PROTOCOL_KEYBOARD | USB_HID_PROTOCOL_MOUSE > HidComposite(&Usb); -HIDBoot HidKeyboard(&Usb); -HIDBoot HidMouse(&Usb); +HIDBoot < USB_HID_PROTOCOL_KEYBOARD | USB_HID_PROTOCOL_MOUSE > HidComposite(&usb); +HIDBoot HidKeyboard(&usb); +HIDBoot HidMouse(&usb); //uint32_t next_time; @@ -158,7 +158,7 @@ void setup() #endif Serial.println("Start"); - if (Usb.Init() == -1) + if (usb.Init() == -1) Serial.println("OSC did not start."); delay( 200 ); @@ -173,6 +173,6 @@ void setup() void loop() { - Usb.Task(); + usb.Task(); } diff --git a/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino b/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino index 03389959..55581be1 100644 --- a/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino +++ b/examples/HID/USBHIDBootMouse/USBHIDBootMouse.ino @@ -50,9 +50,9 @@ void MouseRptParser::OnMiddleButtonDown (MOUSEINFO *mi) Serial.println("M Butt Dn"); }; -USB Usb; -USBHub Hub(&Usb); -HIDBoot HidMouse(&Usb); +USBHost usb; +USBHub Hub(&usb); +HIDBoot HidMouse(&usb); uint32_t next_time; @@ -66,7 +66,7 @@ void setup() #endif Serial.println("Start"); - if (Usb.Init() == -1) + if (usb.Init() == -1) Serial.println("OSC did not start."); delay( 200 ); @@ -78,6 +78,6 @@ void setup() void loop() { - Usb.Task(); + usb.Task(); } diff --git a/examples/HID/USBHIDJoystick/USBHIDJoystick.ino b/examples/HID/USBHIDJoystick/USBHIDJoystick.ino index dff9cd50..8fce4563 100644 --- a/examples/HID/USBHIDJoystick/USBHIDJoystick.ino +++ b/examples/HID/USBHIDJoystick/USBHIDJoystick.ino @@ -10,9 +10,9 @@ #include "hidjoystickrptparser.h" -USB Usb; -USBHub Hub(&Usb); -HIDUniversal Hid(&Usb); +USBHost usb; +USBHub Hub(&usb); +HIDUniversal Hid(&usb); JoystickEvents JoyEvents; JoystickReportParser Joy(&JoyEvents); @@ -23,7 +23,7 @@ void setup() { #endif Serial.println("Start"); - if (Usb.Init() == -1) + if (usb.Init() == -1) Serial.println("OSC did not start."); delay(200); @@ -33,6 +33,6 @@ void setup() { } void loop() { - Usb.Task(); + usb.Task(); } diff --git a/examples/HID/USBHID_desc/USBHID_desc.ino b/examples/HID/USBHID_desc/USBHID_desc.ino index cd7ced23..20b810ab 100644 --- a/examples/HID/USBHID_desc/USBHID_desc.ino +++ b/examples/HID/USBHID_desc/USBHID_desc.ino @@ -13,7 +13,7 @@ class HIDUniversal2 : public HIDUniversal { public: - HIDUniversal2(USB *usb) : HIDUniversal(usb) {}; + HIDUniversal2(USBHost *usb) : HIDUniversal(usb) {}; protected: uint8_t OnInitSuccessful(); @@ -48,9 +48,9 @@ Fail: return rcode; } -USB Usb; -//USBHub Hub(&Usb); -HIDUniversal2 Hid(&Usb); +USBHost usb; +//USBHub Hub(&usb); +HIDUniversal2 Hid(&usb); UniversalReportParser Uni; void setup() @@ -61,7 +61,7 @@ void setup() #endif Serial.println("Start"); - if (Usb.Init() == -1) + if (usb.Init() == -1) Serial.println("OSC did not start."); delay( 200 ); @@ -72,6 +72,6 @@ void setup() void loop() { - Usb.Task(); + usb.Task(); } diff --git a/examples/HID/le3dp/le3dp.ino b/examples/HID/le3dp/le3dp.ino index 07a1da04..70fa0ec8 100644 --- a/examples/HID/le3dp/le3dp.ino +++ b/examples/HID/le3dp/le3dp.ino @@ -12,9 +12,9 @@ #include #endif -USB Usb; -USBHub Hub(&Usb); -HIDUniversal Hid(&Usb); +USBHost usb; +USBHub Hub(&usb); +HIDUniversal Hid(&usb); JoystickEvents JoyEvents; JoystickReportParser Joy(&JoyEvents); @@ -26,7 +26,7 @@ void setup() #endif Serial.println("Start"); - if (Usb.Init() == -1) + if (usb.Init() == -1) Serial.println("OSC did not start."); delay( 200 ); @@ -37,6 +37,6 @@ void setup() void loop() { - Usb.Task(); + usb.Task(); } diff --git a/examples/HID/scale/scale.ino b/examples/HID/scale/scale.ino index 0163df1e..4c4ad023 100644 --- a/examples/HID/scale/scale.ino +++ b/examples/HID/scale/scale.ino @@ -13,10 +13,10 @@ #include #endif -USB Usb; -USBHub Hub(&Usb); -HIDUniversal Hid(&Usb); -Max_LCD LCD(&Usb); +USBHost usb; +USBHub Hub(&usb); +HIDUniversal Hid(&usb); +Max_LCD LCD(&usb); ScaleEvents ScaleEvents(&LCD); ScaleReportParser Scale(&ScaleEvents); @@ -28,7 +28,7 @@ void setup() #endif Serial.println("Start"); - if (Usb.Init() == -1) + if (usb.Init() == -1) Serial.println("OSC did not start."); // set up the LCD's number of rows and columns: @@ -46,6 +46,6 @@ void setup() void loop() { - Usb.Task(); + usb.Task(); } diff --git a/examples/PS3USB/PS3USB.ino b/examples/PS3USB/PS3USB.ino index 9d033ea6..a3cd0dcf 100644 --- a/examples/PS3USB/PS3USB.ino +++ b/examples/PS3USB/PS3USB.ino @@ -12,10 +12,10 @@ #include #endif -USB Usb; +USBHost usb; /* You can create the instance of the class in two ways */ -PS3USB PS3(&Usb); // This will just create the instance -//PS3USB PS3(&Usb,0x00,0x15,0x83,0x3D,0x0A,0x57); // This will also store the bluetooth address - this can be obtained from the dongle when running the sketch +PS3USB PS3(&usb); // This will just create the instance +//PS3USB PS3(&usb,0x00,0x15,0x83,0x3D,0x0A,0x57); // This will also store the bluetooth address - this can be obtained from the dongle when running the sketch bool printAngle; uint8_t state = 0; @@ -25,14 +25,14 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nPS3 USB Library Started")); } void loop() { - Usb.Task(); + usb.Task(); if (PS3.PS3Connected || PS3.PS3NavigationConnected) { if (PS3.getAnalogHat(LeftHatX) > 137 || PS3.getAnalogHat(LeftHatX) < 117 || PS3.getAnalogHat(LeftHatY) > 137 || PS3.getAnalogHat(LeftHatY) < 117 || PS3.getAnalogHat(RightHatX) > 137 || PS3.getAnalogHat(RightHatX) < 117 || PS3.getAnalogHat(RightHatY) > 137 || PS3.getAnalogHat(RightHatY) < 117) { diff --git a/examples/PS4USB/PS4USB.ino b/examples/PS4USB/PS4USB.ino index d0d76790..ef7c8eef 100644 --- a/examples/PS4USB/PS4USB.ino +++ b/examples/PS4USB/PS4USB.ino @@ -12,8 +12,8 @@ #include #endif -USB Usb; -PS4USB PS4(&Usb); +USBHost usb; +PS4USB PS4(&usb); bool printAngle, printTouch; uint8_t oldL2Value, oldR2Value; @@ -23,7 +23,7 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); // Halt } @@ -31,7 +31,7 @@ void setup() { } void loop() { - Usb.Task(); + usb.Task(); if (PS4.connected()) { if (PS4.getAnalogHat(LeftHatX) > 137 || PS4.getAnalogHat(LeftHatX) < 117 || PS4.getAnalogHat(LeftHatY) > 137 || PS4.getAnalogHat(LeftHatY) < 117 || PS4.getAnalogHat(RightHatX) > 137 || PS4.getAnalogHat(RightHatX) < 117 || PS4.getAnalogHat(RightHatY) > 137 || PS4.getAnalogHat(RightHatY) < 117) { diff --git a/examples/PSBuzz/PSBuzz.ino b/examples/PSBuzz/PSBuzz.ino index 6ee462c1..d8a44de3 100644 --- a/examples/PSBuzz/PSBuzz.ino +++ b/examples/PSBuzz/PSBuzz.ino @@ -12,15 +12,15 @@ #include #endif -USB Usb; -PSBuzz Buzz(&Usb); +USBHost usb; +PSBuzz Buzz(&usb); void setup() { Serial.begin(115200); #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); // Halt } @@ -28,7 +28,7 @@ void setup() { } void loop() { - Usb.Task(); + usb.Task(); if (Buzz.connected()) { for (uint8_t i = 0; i < 4; i++) { diff --git a/examples/USB_desc/USB_desc.ino b/examples/USB_desc/USB_desc.ino index acfe57d3..3c7bf4dd 100644 --- a/examples/USB_desc/USB_desc.ino +++ b/examples/USB_desc/USB_desc.ino @@ -8,18 +8,18 @@ #include #endif -USB Usb; -//USBHub Hub1(&Usb); -//USBHub Hub2(&Usb); -//USBHub Hub3(&Usb); -//USBHub Hub4(&Usb); -//USBHub Hub5(&Usb); -//USBHub Hub6(&Usb); -//USBHub Hub7(&Usb); +USBHost usb; +//USBHub Hub1(&usb); +//USBHub Hub2(&usb); +//USBHub Hub3(&usb); +//USBHub Hub4(&usb); +//USBHub Hub5(&usb); +//USBHub Hub6(&usb); +//USBHub Hub7(&usb); uint32_t next_time; -void PrintAllAddresses(UsbDevice *pdev) +void PrintAllAddresses(UsbDeviceDefinition *pdev) { UsbDeviceAddress adr; adr.devAddress = pdev->address.devAddress; @@ -56,7 +56,7 @@ void setup() #endif Serial.println("Start"); - if (Usb.Init() == -1) + if (usb.Init() == -1) Serial.println("OSC did not start."); delay( 200 ); @@ -91,7 +91,7 @@ void PrintDescriptors(uint8_t addr) } } -void PrintAllDescriptors(UsbDevice *pdev) +void PrintAllDescriptors(UsbDeviceDefinition *pdev) { Serial.println("\r\n"); print_hex(pdev->address.devAddress, 8); @@ -101,14 +101,14 @@ void PrintAllDescriptors(UsbDevice *pdev) void loop() { - Usb.Task(); + usb.Task(); - if ( Usb.getUsbTaskState() == USB_STATE_RUNNING ) + if ( usb.getUsbTaskState() == USB_STATE_RUNNING ) { //if (millis() >= next_time) { - Usb.ForEachUsbDevice(&PrintAllDescriptors); - Usb.ForEachUsbDevice(&PrintAllAddresses); + usb.ForEachUsbDevice(&PrintAllDescriptors); + usb.ForEachUsbDevice(&PrintAllAddresses); while ( 1 ); //stop } @@ -119,7 +119,7 @@ byte getdevdescr( byte addr, byte &num_conf ) { USB_DEVICE_DESCRIPTOR buf; byte rcode; - rcode = Usb.getDevDescr( addr, 0, 0x12, ( uint8_t *)&buf ); + rcode = usb.getDevDescr( addr, 0, 0x12, ( uint8_t *)&buf ); if ( rcode ) { return ( rcode ); } @@ -199,7 +199,7 @@ void printhubdescr(uint8_t *descrptr, uint8_t addr) print_hex(descrptr[i], 8); //for (uint8_t i=1; i<=pHub->bNbrPorts; i++) - // PrintHubPortStatus(&Usb, addr, i, 1); + // PrintHubPortStatus(&usb, addr, i, 1); } byte getconfdescr( byte addr, byte conf ) @@ -210,14 +210,14 @@ byte getconfdescr( byte addr, byte conf ) byte descr_length; byte descr_type; unsigned int total_length; - rcode = Usb.getConfDescr( addr, 0, 4, conf, buf ); //get total length + rcode = usb.getConfDescr( addr, 0, 4, conf, buf ); //get total length LOBYTE( total_length ) = buf[ 2 ]; HIBYTE( total_length ) = buf[ 3 ]; if ( total_length > 256 ) { //check if total length is larger than buffer printProgStr(Conf_Trunc_str); total_length = 256; } - rcode = Usb.getConfDescr( addr, 0, total_length, conf, buf ); //get the whole descriptor + rcode = usb.getConfDescr( addr, 0, total_length, conf, buf ); //get the whole descriptor while ( buf_ptr < buf + total_length ) { //parsing descriptors descr_length = *( buf_ptr ); descr_type = *( buf_ptr + 1 ); diff --git a/examples/Xbox/XBOXOLD/XBOXOLD.ino b/examples/Xbox/XBOXOLD/XBOXOLD.ino index 64a3ed61..89b5345e 100644 --- a/examples/Xbox/XBOXOLD/XBOXOLD.ino +++ b/examples/Xbox/XBOXOLD/XBOXOLD.ino @@ -13,23 +13,23 @@ #include #endif -USB Usb; -USBHub Hub1(&Usb); // The controller has a built in hub, so this instance is needed -XBOXOLD Xbox(&Usb); +USBHost usb; +USBHub Hub1(&usb); // The controller has a built in hub, so this instance is needed +XBOXOLD Xbox(&usb); void setup() { Serial.begin(115200); #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); // halt } Serial.print(F("\r\nXBOX Library Started")); } void loop() { - Usb.Task(); + usb.Task(); if (Xbox.XboxConnected) { if (Xbox.getButtonPress(BLACK) || Xbox.getButtonPress(WHITE)) { Serial.print("BLACK: "); diff --git a/examples/Xbox/XBOXONE/XBOXONE.ino b/examples/Xbox/XBOXONE/XBOXONE.ino index 20d94a42..f0987fa5 100644 --- a/examples/Xbox/XBOXONE/XBOXONE.ino +++ b/examples/Xbox/XBOXONE/XBOXONE.ino @@ -11,20 +11,22 @@ #include #endif -USB Usb; -XBOXONE Xbox(&Usb); +USBHost usb; +XBOXONE Xbox(&usb); void setup() { Serial.begin(115200); +#if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection - if (Usb.Init() == -1) { +#endif + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nXBOX USB Library Started")); } void loop() { - Usb.Task(); + usb.Task(); if (Xbox.XboxOneConnected) { if (Xbox.getAnalogHat(LeftHatX) > 7500 || Xbox.getAnalogHat(LeftHatX) < -7500 || Xbox.getAnalogHat(LeftHatY) > 7500 || Xbox.getAnalogHat(LeftHatY) < -7500 || Xbox.getAnalogHat(RightHatX) > 7500 || Xbox.getAnalogHat(RightHatX) < -7500 || Xbox.getAnalogHat(RightHatY) > 7500 || Xbox.getAnalogHat(RightHatY) < -7500) { if (Xbox.getAnalogHat(LeftHatX) > 7500 || Xbox.getAnalogHat(LeftHatX) < -7500) { diff --git a/examples/Xbox/XBOXRECV/XBOXRECV.ino b/examples/Xbox/XBOXRECV/XBOXRECV.ino index 491b287e..b26edd40 100644 --- a/examples/Xbox/XBOXRECV/XBOXRECV.ino +++ b/examples/Xbox/XBOXRECV/XBOXRECV.ino @@ -13,22 +13,22 @@ #include #endif -USB Usb; -XBOXRECV Xbox(&Usb); +USBHost usb; +XBOXRECV Xbox(&usb); void setup() { Serial.begin(115200); #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nXbox Wireless Receiver Library Started")); } void loop() { - Usb.Task(); + usb.Task(); if (Xbox.XboxReceiverConnected) { for (uint8_t i = 0; i < 4; i++) { if (Xbox.Xbox360Connected[i]) { diff --git a/examples/Xbox/XBOXUSB/XBOXUSB.ino b/examples/Xbox/XBOXUSB/XBOXUSB.ino index 8a5691c6..8d650521 100644 --- a/examples/Xbox/XBOXUSB/XBOXUSB.ino +++ b/examples/Xbox/XBOXUSB/XBOXUSB.ino @@ -12,22 +12,22 @@ #include #endif -USB Usb; -XBOXUSB Xbox(&Usb); +USBHost usb; +XBOXUSB Xbox(&usb); void setup() { Serial.begin(115200); #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print(F("\r\nOSC did not start")); while (1); //halt } Serial.print(F("\r\nXBOX USB Library Started")); } void loop() { - Usb.Task(); + usb.Task(); if (Xbox.Xbox360Connected) { if (Xbox.getButtonPress(L2) || Xbox.getButtonPress(R2)) { Serial.print("L2: "); diff --git a/examples/acm/acm_terminal/acm_terminal.ino b/examples/acm/acm_terminal/acm_terminal.ino index f509cda8..f0ef9aea 100644 --- a/examples/acm/acm_terminal/acm_terminal.ino +++ b/examples/acm/acm_terminal/acm_terminal.ino @@ -41,10 +41,10 @@ uint8_t ACMAsyncOper::OnInit(ACM *pacm) return rcode; } -USB Usb; -//USBHub Hub(&Usb); +USBHost usb; +//USBHub Hub(&usb); ACMAsyncOper AsyncOper; -ACM Acm(&Usb, &AsyncOper); +ACM Acm(&usb, &AsyncOper); void setup() { @@ -54,7 +54,7 @@ void setup() #endif Serial.println("Start"); - if (Usb.Init() == -1) + if (usb.Init() == -1) Serial.println("OSCOKIRQ failed to assert"); delay( 200 ); @@ -62,7 +62,7 @@ void setup() void loop() { - Usb.Task(); + usb.Task(); if( Acm.isReady()) { uint8_t rcode; @@ -94,7 +94,7 @@ void loop() } } delay(10); - }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING.. + }//if( usb.getUsbTaskState() == USB_STATE_RUNNING.. } diff --git a/examples/adk/ArduinoBlinkLED/ArduinoBlinkLED.ino b/examples/adk/ArduinoBlinkLED/ArduinoBlinkLED.ino index d59b9bb3..0209d747 100644 --- a/examples/adk/ArduinoBlinkLED/ArduinoBlinkLED.ino +++ b/examples/adk/ArduinoBlinkLED/ArduinoBlinkLED.ino @@ -23,8 +23,8 @@ #include #endif -USB Usb; -ADK adk(&Usb, "TKJElectronics", // Manufacturer Name +USBHost usb; +ADK adk(&usb, "TKJElectronics", // Manufacturer Name "ArduinoBlinkLED", // Model Name "Example sketch for the USB Host Shield", // Description (user-visible string) "1.0", // Version @@ -39,7 +39,7 @@ void setup() { #if !defined(__MIPSEL__) while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection #endif - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.print("\r\nOSCOKIRQ failed to assert"); while (1); // halt } @@ -48,7 +48,7 @@ void setup() { } void loop() { - Usb.Task(); + usb.Task(); if (adk.isReady()) { if (!connected) { diff --git a/examples/adk/adk_barcode/adk_barcode.ino b/examples/adk/adk_barcode/adk_barcode.ino index b498ef93..eceff29c 100644 --- a/examples/adk/adk_barcode/adk_barcode.ino +++ b/examples/adk/adk_barcode/adk_barcode.ino @@ -11,13 +11,13 @@ #include #endif -USB Usb; -USBHub Hub1(&Usb); -USBHub Hub2(&Usb); -HIDBoot HidKeyboard(&Usb); +USBHost usb; +USBHub Hub1(&usb); +USBHub Hub2(&usb); +HIDBoot HidKeyboard(&usb); -ADK adk(&Usb,"Circuits@Home, ltd.", - "USB Host Shield", +ADK adk(&usb,"Circuits@Home, ltd.", + "USBHost Host Shield", "Arduino Terminal for Android", "1.0", "http://www.circuitsathome.com", @@ -75,10 +75,10 @@ void setup() #endif Serial.println("\r\nADK demo start"); - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.println("OSCOKIRQ failed to assert"); while(1); //halt - }//if (Usb.Init() == -1... + }//if (usb.Init() == -1... HidKeyboard.SetReportParser(0, (HIDReportParser*)&Prs); @@ -87,5 +87,5 @@ void setup() void loop() { - Usb.Task(); + usb.Task(); } diff --git a/examples/adk/demokit_20/demokit_20.ino b/examples/adk/demokit_20/demokit_20.ino index f65adf57..344ec693 100644 --- a/examples/adk/demokit_20/demokit_20.ino +++ b/examples/adk/demokit_20/demokit_20.ino @@ -7,10 +7,10 @@ #include #endif -USB Usb; -USBHub hub0(&Usb); -USBHub hub1(&Usb); -ADK adk(&Usb,"Google, Inc.", +USBHost usb; +USBHub hub0(&usb); +USBHub hub1(&usb); +ADK adk(&usb,"Google, Inc.", "DemoKit", "DemoKit Arduino Board", "1.0", @@ -45,10 +45,10 @@ void setup() #endif Serial.println("\r\nADK demo start"); - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.println("OSCOKIRQ failed to assert"); while(1); //halt - }//if (Usb.Init() == -1... + }//if (usb.Init() == -1... init_leds(); @@ -60,7 +60,7 @@ void loop() { uint8_t rcode; uint8_t msg[3] = { 0x00 }; - Usb.Task(); + usb.Task(); if( adk.isReady() == false ) { analogWrite(LED1_RED, 255); diff --git a/examples/adk/term_test/term_test.ino b/examples/adk/term_test/term_test.ino index db681c3b..0df23905 100644 --- a/examples/adk/term_test/term_test.ino +++ b/examples/adk/term_test/term_test.ino @@ -7,10 +7,10 @@ #include #endif -USB Usb; -//USBHub Hub(&Usb); +USBHost usb; +//USBHub Hub(&usb); -ADK adk(&Usb,"Circuits@Home, ltd.", +ADK adk(&usb,"Circuits@Home, ltd.", "USB Host Shield", "Arduino Terminal for Android", "1.0", @@ -25,10 +25,10 @@ void setup() #endif Serial.println("\r\nADK demo start"); - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.println("OSCOKIRQ failed to assert"); while(1); //halt - }//if (Usb.Init() == -1... + }//if (usb.Init() == -1... } void loop() @@ -37,7 +37,7 @@ void loop() uint8_t msg[64] = { 0x00 }; const char* recv = "Received: "; - Usb.Task(); + usb.Task(); if( adk.isReady() == false ) { return; diff --git a/examples/adk/term_time/term_time.ino b/examples/adk/term_time/term_time.ino index a3f1dbc8..4e223c03 100644 --- a/examples/adk/term_time/term_time.ino +++ b/examples/adk/term_time/term_time.ino @@ -7,10 +7,10 @@ #include #endif -USB Usb; +USBHost usb; -ADK adk(&Usb,"Circuits@Home, ltd.", - "USB Host Shield", +ADK adk(&usb,"Circuits@Home, ltd.", + "USBHost Host Shield", "Arduino Terminal for Android", "1.0", "http://www.circuitsathome.com", @@ -24,10 +24,10 @@ void setup() #endif Serial.println("\r\nADK demo start"); - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.println("OSCOKIRQ failed to assert"); while(1); //halt - }//if (Usb.Init() == -1... + }//if (usb.Init() == -1... } void loop() @@ -36,7 +36,7 @@ void loop() const char* sec_ela = " seconds elapsed\r"; uint8_t rcode; - Usb.Task(); + usb.Task(); if( adk.isReady() == false ) { return; } diff --git a/examples/board_qc/board_qc.ino b/examples/board_qc/board_qc.ino index 573c3ce0..ad7901da 100644 --- a/examples/board_qc/board_qc.ino +++ b/examples/board_qc/board_qc.ino @@ -20,8 +20,8 @@ uint8_t laststate; USB_DEVICE_DESCRIPTOR buf; /* objects */ -USB Usb; -//USBHub hub(&Usb); +USBHost usb; +//USBHub hub(&usb); void setup() { laststate = 0; @@ -33,9 +33,9 @@ void setup() { E_Notify(PSTR("\r\nUSB Host Shield Quality Control Routine"), 0x80); /* SPI quick test - check revision register */ E_Notify(PSTR("\r\nReading REVISION register... Die revision "), 0x80); - Usb.Init(); // Initializes SPI, we don't care about the return value here + usb.Init(); // Initializes SPI, we don't care about the return value here { - uint8_t tmpbyte = Usb.regRd(rREVISION); + uint8_t tmpbyte = usb.regRd(rREVISION); switch(tmpbyte) { case( 0x01): //rev.01 E_Notify(PSTR("01"), 0x80); @@ -58,11 +58,11 @@ void setup() { E_Notify(PSTR("\r\nSPI long test. Transfers 1MB of data. Each dot is 64K"), 0x80); uint8_t sample_wr = 0; uint8_t sample_rd = 0; - uint8_t gpinpol_copy = Usb.regRd(rGPINPOL); + uint8_t gpinpol_copy = usb.regRd(rGPINPOL); for(uint8_t i = 0; i < 16; i++) { for(uint16_t j = 0; j < 65535; j++) { - Usb.regWr(rGPINPOL, sample_wr); - sample_rd = Usb.regRd(rGPINPOL); + usb.regWr(rGPINPOL, sample_wr); + sample_rd = usb.regRd(rGPINPOL); if(sample_rd != sample_wr) { E_Notify(PSTR("\r\nTest failed. "), 0x80); E_Notify(PSTR("Value written: "), 0x80); @@ -75,7 +75,7 @@ void setup() { }//for( uint16_t j... E_Notify(PSTR("."), 0x80); }//for( uint8_t i... - Usb.regWr(rGPINPOL, gpinpol_copy); + usb.regWr(rGPINPOL, gpinpol_copy); E_Notify(PSTR(" SPI long test passed"), 0x80); }//SPI long test /* GPIO test */ @@ -85,8 +85,8 @@ void setup() { uint8_t tmpbyte; E_Notify(PSTR("\r\nGPIO test. Connect GPIN0 to GPOUT7, GPIN1 to GPOUT6, and so on"), 0x80); for(uint8_t sample_gpio = 0; sample_gpio < 255; sample_gpio++) { - Usb.gpioWr(sample_gpio); - tmpbyte = Usb.gpioRd(); + usb.gpioWr(sample_gpio); + tmpbyte = usb.gpioRd(); /* bit reversing code copied vetbatim from http://graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious */ tmpbyte = ((tmpbyte * 0x0802LU & 0x22110LU) | (tmpbyte * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16; if(sample_gpio != tmpbyte) { @@ -105,7 +105,7 @@ void setup() { { E_Notify(PSTR("\r\nPLL test. 100 chip resets will be performed"), 0x80); /* check current state of the oscillator */ - if(!(Usb.regRd(rUSBIRQ) & bmOSCOKIRQ)) { //wrong state - should be on + if(!(usb.regRd(rUSBIRQ) & bmOSCOKIRQ)) { //wrong state - should be on E_Notify(PSTR("\r\nCurrent oscillator state unexpected."), 0x80); press_any_key(); } @@ -114,15 +114,15 @@ void setup() { for(uint16_t i = 0; i < 100; i++) { E_Notify(PSTR("\rReset number "), 0x80); Serial.print(i, DEC); - Usb.regWr(rUSBCTL, bmCHIPRES); //reset - if(Usb.regRd(rUSBIRQ) & bmOSCOKIRQ) { //wrong state - should be off + usb.regWr(rUSBCTL, bmCHIPRES); //reset + if(usb.regRd(rUSBIRQ) & bmOSCOKIRQ) { //wrong state - should be off E_Notify(PSTR("\r\nCurrent oscillator state unexpected."), 0x80); halt55(); } - Usb.regWr(rUSBCTL, 0x00); //release from reset + usb.regWr(rUSBCTL, 0x00); //release from reset uint16_t j = 0; for(j = 1; j < 65535; j++) { //tracking off to on time - if(Usb.regRd(rUSBIRQ) & bmOSCOKIRQ) { + if(usb.regRd(rUSBIRQ) & bmOSCOKIRQ) { E_Notify(PSTR(" Time to stabilize - "), 0x80); Serial.print(j, DEC); E_Notify(PSTR(" cycles\r\n"), 0x80); @@ -137,7 +137,7 @@ void setup() { }//PLL test /* initializing USB stack */ - if(Usb.Init() == -1) { + if(usb.Init() == -1) { E_Notify(PSTR("\r\nOSCOKIRQ failed to assert"), 0x80); halt55(); } @@ -146,8 +146,8 @@ void setup() { void loop() { delay(200); - Usb.Task(); - usbstate = Usb.getUsbTaskState(); + usb.Task(); + usbstate = usb.getUsbTaskState(); if(usbstate != laststate) { laststate = usbstate; /**/ @@ -169,7 +169,7 @@ void loop() { break; case( USB_STATE_RUNNING): E_Notify(PSTR("\r\nGetting device descriptor"), 0x80); - rcode = Usb.getDevDescr(1, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*) & buf); + rcode = usb.getDevDescr(1, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*) & buf); if(rcode) { E_Notify(PSTR("\r\nError reading device descriptor. Error code "), 0x80); @@ -227,7 +227,7 @@ void halt55() { E_Notify(PSTR("\r\nPress RESET to restart test"), 0x80); while(1) { - Usb.regWr(0x55, 0x55); + usb.regWr(0x55, 0x55); } } diff --git a/examples/cdc_XR21B1411/XR_terminal/XR_terminal.ino b/examples/cdc_XR21B1411/XR_terminal/XR_terminal.ino index 0173a08b..53b5c2b2 100644 --- a/examples/cdc_XR21B1411/XR_terminal/XR_terminal.ino +++ b/examples/cdc_XR21B1411/XR_terminal/XR_terminal.ino @@ -38,9 +38,9 @@ uint8_t ACMAsyncOper::OnInit(ACM *pacm) return rcode; } -USB Usb; +USBHost usb; ACMAsyncOper AsyncOper; -XR21B1411 Acm(&Usb, &AsyncOper); +XR21B1411 Acm(&usb, &AsyncOper); void setup() { Serial.begin( 115200 ); @@ -49,11 +49,11 @@ void setup() { #endif Serial.println("\r\n\r\nStart"); - if (Usb.Init() == -1) Serial.println("OSCOKIRQ failed to assert"); + if (usb.Init() == -1) Serial.println("OSCOKIRQ failed to assert"); } void loop() { - Usb.Task(); + usb.Task(); if( Acm.isReady()) { uint8_t rcode; uint8_t buf[1]; diff --git a/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino b/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino index 5be7adc2..4f050da2 100644 --- a/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino +++ b/examples/ftdi/USBFTDILoopback/USBFTDILoopback.ino @@ -34,10 +34,10 @@ uint8_t FTDIAsync::OnInit(FTDI *pftdi) return rcode; } -USB Usb; -//USBHub Hub(&Usb); +USBHost usb; +//USBHub Hub(&usb); FTDIAsync FtdiAsync; -FTDI Ftdi(&Usb, &FtdiAsync); +FTDI Ftdi(&usb, &FtdiAsync); uint32_t next_time; @@ -49,7 +49,7 @@ void setup() #endif Serial.println("Start"); - if (Usb.Init() == -1) + if (usb.Init() == -1) Serial.println("OSC did not start."); delay( 200 ); @@ -59,9 +59,9 @@ void setup() void loop() { - Usb.Task(); + usb.Task(); - if( Usb.getUsbTaskState() == USB_STATE_RUNNING ) + if( usb.getUsbTaskState() == USB_STATE_RUNNING ) { uint8_t rcode; char strbuf[] = "DEADBEEF"; diff --git a/examples/hub_demo/hub_demo.ino b/examples/hub_demo/hub_demo.ino index d8b2d4bb..6e0c8f02 100644 --- a/examples/hub_demo/hub_demo.ino +++ b/examples/hub_demo/hub_demo.ino @@ -7,15 +7,15 @@ #include #endif -USB Usb; -USBHub Hub1(&Usb); -USBHub Hub2(&Usb); -USBHub Hub3(&Usb); -USBHub Hub4(&Usb); +USBHost usb; +USBHub Hub1(&usb); +USBHub Hub2(&usb); +USBHub Hub3(&usb); +USBHub Hub4(&usb); uint32_t next_time; -void PrintAllAddresses(UsbDevice *pdev) +void PrintAllAddresses(UsbDeviceDefinition *pdev) { UsbDeviceAddress adr; adr.devAddress = pdev->address.devAddress; @@ -52,7 +52,7 @@ void setup() #endif Serial.println("Start"); - if (Usb.Init() == -1) + if (usb.Init() == -1) Serial.println("OSC did not start."); delay( 200 ); @@ -87,7 +87,7 @@ void PrintDescriptors(uint8_t addr) } } -void PrintAllDescriptors(UsbDevice *pdev) +void PrintAllDescriptors(UsbDeviceDefinition *pdev) { Serial.println("\r\n"); print_hex(pdev->address.devAddress, 8); @@ -97,14 +97,14 @@ void PrintAllDescriptors(UsbDevice *pdev) void loop() { - Usb.Task(); + usb.Task(); - if ( Usb.getUsbTaskState() == USB_STATE_RUNNING ) + if ( usb.getUsbTaskState() == USB_STATE_RUNNING ) { if ((millis() - next_time) >= 0L) { - Usb.ForEachUsbDevice(&PrintAllDescriptors); - Usb.ForEachUsbDevice(&PrintAllAddresses); + usb.ForEachUsbDevice(&PrintAllDescriptors); + usb.ForEachUsbDevice(&PrintAllAddresses); while ( 1 ); //stop } @@ -115,7 +115,7 @@ byte getdevdescr( byte addr, byte &num_conf ) { USB_DEVICE_DESCRIPTOR buf; byte rcode; - rcode = Usb.getDevDescr( addr, 0, 0x12, ( uint8_t *)&buf ); + rcode = usb.getDevDescr( addr, 0, 0x12, ( uint8_t *)&buf ); if ( rcode ) { return ( rcode ); } @@ -195,7 +195,7 @@ void printhubdescr(uint8_t *descrptr, uint8_t addr) print_hex(descrptr[i], 8); //for (uint8_t i=1; i<=pHub->bNbrPorts; i++) - // PrintHubPortStatus(&Usb, addr, i, 1); + // PrintHubPortStatus(&usb, addr, i, 1); } byte getconfdescr( byte addr, byte conf ) @@ -206,14 +206,14 @@ byte getconfdescr( byte addr, byte conf ) byte descr_length; byte descr_type; unsigned int total_length; - rcode = Usb.getConfDescr( addr, 0, 4, conf, buf ); //get total length + rcode = usb.getConfDescr( addr, 0, 4, conf, buf ); //get total length LOBYTE( total_length ) = buf[ 2 ]; HIBYTE( total_length ) = buf[ 3 ]; if ( total_length > 256 ) { //check if total length is larger than buffer printProgStr(Conf_Trunc_str); total_length = 256; } - rcode = Usb.getConfDescr( addr, 0, total_length, conf, buf ); //get the whole descriptor + rcode = usb.getConfDescr( addr, 0, total_length, conf, buf ); //get the whole descriptor while ( buf_ptr < buf + total_length ) { //parsing descriptors descr_length = *( buf_ptr ); descr_type = *( buf_ptr + 1 ); diff --git a/examples/max_LCD/max_LCD.ino b/examples/max_LCD/max_LCD.ino index 6603ab90..470f1a2a 100644 --- a/examples/max_LCD/max_LCD.ino +++ b/examples/max_LCD/max_LCD.ino @@ -11,8 +11,8 @@ #include #endif -USB Usb; -Max_LCD lcd(&Usb); +USBHost usb; +Max_LCD lcd(&usb); void setup() { // Set up the LCD's number of columns and rows: diff --git a/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino b/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino index 7c4c9f6c..36c4def9 100644 --- a/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino +++ b/examples/pl2303/pl2303_gprs_terminal/pl2303_gprs_terminal.ino @@ -44,10 +44,10 @@ uint8_t PLAsyncOper::OnInit(ACM *pacm) return rcode; } -USB Usb; -//USBHub Hub(&Usb); +USBHost usb; +//USBHub Hub(&usb); PLAsyncOper AsyncOper; -PL2303 Pl(&Usb, &AsyncOper); +PL2303 Pl(&usb, &AsyncOper); void setup() { @@ -57,7 +57,7 @@ void setup() #endif Serial.println("Start"); - if (Usb.Init() == -1) + if (usb.Init() == -1) Serial.println("OSCOKIRQ failed to assert"); delay( 200 ); @@ -65,9 +65,9 @@ void setup() void loop() { - Usb.Task(); + usb.Task(); - if( Usb.getUsbTaskState() == USB_STATE_RUNNING ) + if( usb.getUsbTaskState() == USB_STATE_RUNNING ) { uint8_t rcode; @@ -96,6 +96,6 @@ void loop() 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 e8c8a022..5f282547 100644 --- a/examples/pl2303/pl2303_gps/pl2303_gps.ino +++ b/examples/pl2303/pl2303_gps/pl2303_gps.ino @@ -42,10 +42,10 @@ uint8_t PLAsyncOper::OnInit(ACM *pacm) { return rcode; } -USB Usb; -USBHub Hub(&Usb); +USBHost usb; +USBHub Hub(&usb); PLAsyncOper AsyncOper; -PL2303 Pl(&Usb, &AsyncOper); +PL2303 Pl(&usb, &AsyncOper); uint32_t read_delay; #define READ_DELAY 100 @@ -56,7 +56,7 @@ void setup() { #endif Serial.println("Start"); - if(Usb.Init() == -1) + if(usb.Init() == -1) Serial.println("OSCOKIRQ failed to assert"); delay(200); @@ -67,7 +67,7 @@ void loop() { uint8_t buf[64]; //serial buffer equals Max.packet size of bulk-IN endpoint uint16_t rcvd = 64; - Usb.Task(); + usb.Task(); if(Pl.isReady()) { /* reading the GPS */ @@ -82,7 +82,7 @@ void loop() { }//for( uint16_t i=0; i < rcvd; i++... }//if( rcvd }//if( read_delay > millis()... - }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING.. + }//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 d527eabe..719dce1b 100644 --- a/examples/pl2303/pl2303_tinygps/pl2303_tinygps.ino +++ b/examples/pl2303/pl2303_tinygps/pl2303_tinygps.ino @@ -56,10 +56,10 @@ uint8_t PLAsyncOper::OnInit(ACM *pacm) return rcode; } -USB Usb; -//USBHub Hub(&Usb); +USBHost usb; +//USBHub Hub(&usb); PLAsyncOper AsyncOper; -PL2303 Pl(&Usb, &AsyncOper); +PL2303 Pl(&usb, &AsyncOper); TinyGPS gps; void gpsdump(TinyGPS &gps); @@ -80,7 +80,7 @@ void setup() Serial.print("Sizeof(gpsobject) = "); Serial.println(sizeof(TinyGPS)); Serial.println(); /* USB Initialization */ - if (Usb.Init() == -1) { + if (usb.Init() == -1) { Serial.println("OSCOKIRQ failed to assert"); } @@ -89,7 +89,7 @@ void setup() void loop() { - Usb.Task(); + usb.Task(); if( Pl.isReady()) { @@ -110,7 +110,7 @@ void loop() Serial.println("-------------"); Serial.println(); }//if( newdata... - }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING... + }//if( usb.getUsbTaskState() == USB_STATE_RUNNING... } void printFloat(double number, int digits) diff --git a/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino b/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino index 67b7dab6..59de3d3e 100644 --- a/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino +++ b/examples/pl2303/pl2303_xbee_terminal/pl2303_xbee_terminal.ino @@ -44,10 +44,10 @@ uint8_t PLAsyncOper::OnInit(ACM *pacm) return rcode; } -USB Usb; -//USBHub Hub(&Usb); +USBHost usb; +//USBHub Hub(&usb); PLAsyncOper AsyncOper; -PL2303 Pl(&Usb, &AsyncOper); +PL2303 Pl(&usb, &AsyncOper); void setup() { @@ -57,7 +57,7 @@ void setup() #endif Serial.println("Start"); - if (Usb.Init() == -1) + if (usb.Init() == -1) Serial.println("OSCOKIRQ failed to assert"); delay( 200 ); @@ -65,9 +65,9 @@ void setup() void loop() { - Usb.Task(); + usb.Task(); - if( Usb.getUsbTaskState() == USB_STATE_RUNNING ) + if( usb.getUsbTaskState() == USB_STATE_RUNNING ) { uint8_t rcode; @@ -111,7 +111,7 @@ void loop() } } delay(10); - }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING.. + }//if( usb.getUsbTaskState() == USB_STATE_RUNNING.. } diff --git a/examples/testusbhostFAT/testusbhostFAT.ino b/examples/testusbhostFAT/testusbhostFAT.ino index e8b9cd35..4e66eba7 100644 --- a/examples/testusbhostFAT/testusbhostFAT.ino +++ b/examples/testusbhostFAT/testusbhostFAT.ino @@ -88,7 +88,7 @@ volatile int brightness = 0; // how bright the LED is volatile int fadeAmount = 80; // how many points to fade the LED by #endif -USB Usb; +USBHost usb; volatile uint8_t current_state = 1; volatile uint8_t last_state = 0; @@ -297,7 +297,7 @@ void setup() { // Besides, it is easier to initialize stuff... #if WANT_HUB_TEST for(int i = 0; i < MAX_HUBS; i++) { - Hubs[i] = new USBHub(&Usb); + Hubs[i] = new USBHub(&usb); #if defined(__AVR__) printf_P(PSTR("Available heap: %u Bytes\r\n"), freeHeap()); #endif @@ -306,7 +306,7 @@ void setup() { // Initialize generic storage. This must be done before USB starts. Init_Generic_Storage(); - while(Usb.Init(1000) == -1) { + while(usb.Init(1000) == -1) { printf_P(PSTR("No USB HOST Shield?\r\n")); Notify(PSTR("OSC did not start."), 0x40); } @@ -429,15 +429,15 @@ void loop() { if(change) { change = false; if(usbon) { - Usb.vbusPower(vbus_on); + usb.vbusPower(vbus_on); printf_P(PSTR("VBUS on\r\n")); } else { - Usb.vbusPower(vbus_off); + usb.vbusPower(vbus_off); usbon_time = millis() + 2000; } } - Usb.Task(); - current_state = Usb.getUsbTaskState(); + usb.Task(); + current_state = usb.getUsbTaskState(); if(current_state != last_state) { if(UsbDEBUGlvl > 0x50) printf_P(PSTR("USB state = %x\r\n"), current_state);