mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Fixed all libraries after 6c36eed239
This commit is contained in:
parent
6c36eed239
commit
a0d163b8fb
43 changed files with 269 additions and 267 deletions
|
@ -15,9 +15,9 @@
|
|||
#include <SPI.h>
|
||||
#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();
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
#include <SPI.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 */
|
||||
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) {
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
#include <SPI.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
|
||||
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) {
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
#include <SPI.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 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) {
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
#include <SPI.h>
|
||||
#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) {
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
#include <SPI.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 */
|
||||
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) {
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
#include <SPI.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
|
||||
|
||||
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) {
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
#include <SPI.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 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"));
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
#include <SPI.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 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++) {
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
#include <SPI.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
|
||||
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) {
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
#include <SPI.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 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"));
|
||||
|
|
|
@ -96,9 +96,9 @@ void KbdRptParser::OnKeyPressed(uint8_t key)
|
|||
Serial.println((char)key);
|
||||
};
|
||||
|
||||
USB Usb;
|
||||
//USBHub Hub(&Usb);
|
||||
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> HidKeyboard(&Usb);
|
||||
USBHost usb;
|
||||
//USBHub Hub(&usb);
|
||||
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> 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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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<USB_HID_PROTOCOL_KEYBOARD> HidKeyboard(&Usb);
|
||||
HIDBoot<USB_HID_PROTOCOL_MOUSE> HidMouse(&Usb);
|
||||
HIDBoot < USB_HID_PROTOCOL_KEYBOARD | USB_HID_PROTOCOL_MOUSE > HidComposite(&usb);
|
||||
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> HidKeyboard(&usb);
|
||||
HIDBoot<USB_HID_PROTOCOL_MOUSE> 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();
|
||||
}
|
||||
|
||||
|
|
|
@ -50,9 +50,9 @@ void MouseRptParser::OnMiddleButtonDown (MOUSEINFO *mi)
|
|||
Serial.println("M Butt Dn");
|
||||
};
|
||||
|
||||
USB Usb;
|
||||
USBHub Hub(&Usb);
|
||||
HIDBoot<USB_HID_PROTOCOL_MOUSE> HidMouse(&Usb);
|
||||
USBHost usb;
|
||||
USBHub Hub(&usb);
|
||||
HIDBoot<USB_HID_PROTOCOL_MOUSE> 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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
#include <SPI.h>
|
||||
#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();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
#include <SPI.h>
|
||||
#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();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
#include <SPI.h>
|
||||
#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) {
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include <SPI.h>
|
||||
#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) {
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
#include <SPI.h>
|
||||
#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++) {
|
||||
|
|
|
@ -8,18 +8,18 @@
|
|||
#include <SPI.h>
|
||||
#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 );
|
||||
|
|
|
@ -13,23 +13,23 @@
|
|||
#include <SPI.h>
|
||||
#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: ");
|
||||
|
|
|
@ -11,20 +11,22 @@
|
|||
#include <SPI.h>
|
||||
#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) {
|
||||
|
|
|
@ -13,22 +13,22 @@
|
|||
#include <SPI.h>
|
||||
#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]) {
|
||||
|
|
|
@ -12,22 +12,22 @@
|
|||
#include <SPI.h>
|
||||
#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: ");
|
||||
|
|
|
@ -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..
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
#include <SPI.h>
|
||||
#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) {
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
#include <SPI.h>
|
||||
#endif
|
||||
|
||||
USB Usb;
|
||||
USBHub Hub1(&Usb);
|
||||
USBHub Hub2(&Usb);
|
||||
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> HidKeyboard(&Usb);
|
||||
USBHost usb;
|
||||
USBHub Hub1(&usb);
|
||||
USBHub Hub2(&usb);
|
||||
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> 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();
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
#include <SPI.h>
|
||||
#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);
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
#include <SPI.h>
|
||||
#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;
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
#include <SPI.h>
|
||||
#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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
#include <SPI.h>
|
||||
#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 );
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include <SPI.h>
|
||||
#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:
|
||||
|
|
|
@ -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..
|
||||
}
|
||||
|
||||
|
|
|
@ -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..
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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..
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue