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>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub1(&Usb); // Some dongles have a hub inside
|
//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 */
|
/* 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
|
// 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__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); // Halt
|
while (1); // Halt
|
||||||
}
|
}
|
||||||
|
@ -51,5 +51,5 @@ void setup() {
|
||||||
Serial.print(F("\r\nHID Bluetooth Library Started"));
|
Serial.print(F("\r\nHID Bluetooth Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub1(&Usb); // Some dongles have a hub inside
|
//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 */
|
/* You can create the instance of the class in two ways */
|
||||||
PS3BT PS3(&Btd); // This will just create the instance
|
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
|
//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__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); //halt
|
while (1); //halt
|
||||||
}
|
}
|
||||||
Serial.print(F("\r\nPS3 Bluetooth Library Started"));
|
Serial.print(F("\r\nPS3 Bluetooth Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if (PS3.PS3Connected || PS3.PS3NavigationConnected) {
|
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) {
|
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>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub1(&Usb); // Some dongles have a hub inside
|
//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!
|
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
|
const uint8_t length = sizeof(PS3) / sizeof(PS3[0]); // Get the lenght of the array
|
||||||
bool printAngle[length];
|
bool printAngle[length];
|
||||||
|
@ -33,14 +33,14 @@ void setup() {
|
||||||
#if !defined(__MIPSEL__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); //halt
|
while (1); //halt
|
||||||
}
|
}
|
||||||
Serial.print(F("\r\nPS3 Bluetooth Library Started"));
|
Serial.print(F("\r\nPS3 Bluetooth Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
for (uint8_t i = 0; i < length; i++) {
|
for (uint8_t i = 0; i < length; i++) {
|
||||||
if (PS3[i]->PS3Connected || PS3[i]->PS3NavigationConnected) {
|
if (PS3[i]->PS3Connected || PS3[i]->PS3NavigationConnected) {
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub1(&Usb); // Some dongles have a hub inside
|
//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 */
|
/* 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"
|
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__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); //halt
|
while (1); //halt
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ void setup() {
|
||||||
output.reserve(200); // Reserve 200 bytes for the output string
|
output.reserve(200); // Reserve 200 bytes for the output string
|
||||||
}
|
}
|
||||||
void loop() {
|
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 (SerialBT.connected) {
|
||||||
if (firstMessage) {
|
if (firstMessage) {
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub1(&Usb); // Some dongles have a hub inside
|
//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 PS4BT class in two ways */
|
/* 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
|
// 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__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); // Halt
|
while (1); // Halt
|
||||||
}
|
}
|
||||||
Serial.print(F("\r\nPS4 Bluetooth Library Started"));
|
Serial.print(F("\r\nPS4 Bluetooth Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if (PS4.connected()) {
|
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) {
|
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>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub1(&Usb); // Some dongles have a hub inside
|
//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 */
|
/* 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); // 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
|
//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__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); //halt
|
while (1); //halt
|
||||||
}
|
}
|
||||||
Serial.print(F("\r\nSPP Bluetooth Library Started"));
|
Serial.print(F("\r\nSPP Bluetooth Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
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 (SerialBT.connected) {
|
||||||
if (firstMessage) {
|
if (firstMessage) {
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub1(&Usb); // Some dongles have a hub inside
|
//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
|
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!
|
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__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); // Halt
|
while (1); // Halt
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ void setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
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++) {
|
for (uint8_t i = 0; i < length; i++) {
|
||||||
if (SerialBT[i]->connected) {
|
if (SerialBT[i]->connected) {
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub1(&Usb); // Some dongles have a hub inside
|
//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 */
|
/* 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, 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
|
//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__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); //halt
|
while (1); //halt
|
||||||
}
|
}
|
||||||
Serial.print(F("\r\nWiimote Bluetooth Library Started"));
|
Serial.print(F("\r\nWiimote Bluetooth Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
if (Wii.wiimoteConnected) {
|
if (Wii.wiimoteConnected) {
|
||||||
if (Wii.getButtonClick(HOME)) { // You can use getButtonPress to see if the button is held down
|
if (Wii.getButtonClick(HOME)) { // You can use getButtonPress to see if the button is held down
|
||||||
Serial.print(F("\r\nHOME"));
|
Serial.print(F("\r\nHOME"));
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub1(&Usb); // Some dongles have a hub inside
|
//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 */
|
/* 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, 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
|
//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__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); //halt
|
while (1); //halt
|
||||||
}
|
}
|
||||||
Serial.print(F("\r\nWii Balance Board Bluetooth Library Started"));
|
Serial.print(F("\r\nWii Balance Board Bluetooth Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
if (Wii.wiiBalanceBoardConnected) {
|
if (Wii.wiiBalanceBoardConnected) {
|
||||||
Serial.print(F("\r\nWeight: "));
|
Serial.print(F("\r\nWeight: "));
|
||||||
for (uint8_t i = 0; i < 4; i++) {
|
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"
|
#error "Please set ENABLE_WII_IR_CAMERA to 1 in settings.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub1(&Usb); // Some dongles have a hub inside
|
//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 */
|
/* 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, 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
|
//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__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); //halt
|
while (1); //halt
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ void setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
if (Wii.wiimoteConnected) {
|
if (Wii.wiimoteConnected) {
|
||||||
if (Wii.getButtonClick(HOME)) { // You can use getButtonPress to see if the button is held down
|
if (Wii.getButtonClick(HOME)) { // You can use getButtonPress to see if the button is held down
|
||||||
Serial.print(F("\r\nHOME"));
|
Serial.print(F("\r\nHOME"));
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub1(&Usb); // Some dongles have a hub inside
|
//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!
|
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
|
const uint8_t length = sizeof(Wii) / sizeof(Wii[0]); // Get the lenght of the array
|
||||||
bool printAngle[length];
|
bool printAngle[length];
|
||||||
|
@ -33,14 +33,14 @@ void setup() {
|
||||||
#if !defined(__MIPSEL__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); //halt
|
while (1); //halt
|
||||||
}
|
}
|
||||||
Serial.print(F("\r\nWiimote Bluetooth Library Started"));
|
Serial.print(F("\r\nWiimote Bluetooth Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
for (uint8_t i = 0; i < length; i++) {
|
for (uint8_t i = 0; i < length; i++) {
|
||||||
if (Wii[i]->wiimoteConnected) {
|
if (Wii[i]->wiimoteConnected) {
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub1(&Usb); // Some dongles have a hub inside
|
//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 */
|
/* 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, 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
|
//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__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); //halt
|
while (1); //halt
|
||||||
}
|
}
|
||||||
Serial.print(F("\r\nWiimote Bluetooth Library Started"));
|
Serial.print(F("\r\nWiimote Bluetooth Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
if (Wii.wiiUProControllerConnected) {
|
if (Wii.wiiUProControllerConnected) {
|
||||||
if (Wii.getButtonClick(HOME)) { // You can use getButtonPress to see if the button is held down
|
if (Wii.getButtonClick(HOME)) { // You can use getButtonPress to see if the button is held down
|
||||||
Serial.print(F("\r\nHome"));
|
Serial.print(F("\r\nHome"));
|
||||||
|
|
|
@ -96,9 +96,9 @@ void KbdRptParser::OnKeyPressed(uint8_t key)
|
||||||
Serial.println((char)key);
|
Serial.println((char)key);
|
||||||
};
|
};
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub(&Usb);
|
//USBHub Hub(&usb);
|
||||||
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> HidKeyboard(&Usb);
|
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> HidKeyboard(&usb);
|
||||||
|
|
||||||
uint32_t next_time;
|
uint32_t next_time;
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (usb.Init() == -1)
|
||||||
Serial.println("OSC did not start.");
|
Serial.println("OSC did not start.");
|
||||||
|
|
||||||
delay( 200 );
|
delay( 200 );
|
||||||
|
@ -124,6 +124,6 @@ void setup()
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,12 +138,12 @@ void KbdRptParser::OnKeyPressed(uint8_t key)
|
||||||
Serial.println((char)key);
|
Serial.println((char)key);
|
||||||
};
|
};
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
USBHub Hub(&Usb);
|
USBHub Hub(&usb);
|
||||||
|
|
||||||
HIDBoot < USB_HID_PROTOCOL_KEYBOARD | USB_HID_PROTOCOL_MOUSE > HidComposite(&Usb);
|
HIDBoot < USB_HID_PROTOCOL_KEYBOARD | USB_HID_PROTOCOL_MOUSE > HidComposite(&usb);
|
||||||
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> HidKeyboard(&Usb);
|
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> HidKeyboard(&usb);
|
||||||
HIDBoot<USB_HID_PROTOCOL_MOUSE> HidMouse(&Usb);
|
HIDBoot<USB_HID_PROTOCOL_MOUSE> HidMouse(&usb);
|
||||||
|
|
||||||
//uint32_t next_time;
|
//uint32_t next_time;
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (usb.Init() == -1)
|
||||||
Serial.println("OSC did not start.");
|
Serial.println("OSC did not start.");
|
||||||
|
|
||||||
delay( 200 );
|
delay( 200 );
|
||||||
|
@ -173,6 +173,6 @@ void setup()
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,9 @@ void MouseRptParser::OnMiddleButtonDown (MOUSEINFO *mi)
|
||||||
Serial.println("M Butt Dn");
|
Serial.println("M Butt Dn");
|
||||||
};
|
};
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
USBHub Hub(&Usb);
|
USBHub Hub(&usb);
|
||||||
HIDBoot<USB_HID_PROTOCOL_MOUSE> HidMouse(&Usb);
|
HIDBoot<USB_HID_PROTOCOL_MOUSE> HidMouse(&usb);
|
||||||
|
|
||||||
uint32_t next_time;
|
uint32_t next_time;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (usb.Init() == -1)
|
||||||
Serial.println("OSC did not start.");
|
Serial.println("OSC did not start.");
|
||||||
|
|
||||||
delay( 200 );
|
delay( 200 );
|
||||||
|
@ -78,6 +78,6 @@ void setup()
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
#include "hidjoystickrptparser.h"
|
#include "hidjoystickrptparser.h"
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
USBHub Hub(&Usb);
|
USBHub Hub(&usb);
|
||||||
HIDUniversal Hid(&Usb);
|
HIDUniversal Hid(&usb);
|
||||||
JoystickEvents JoyEvents;
|
JoystickEvents JoyEvents;
|
||||||
JoystickReportParser Joy(&JoyEvents);
|
JoystickReportParser Joy(&JoyEvents);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ void setup() {
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (usb.Init() == -1)
|
||||||
Serial.println("OSC did not start.");
|
Serial.println("OSC did not start.");
|
||||||
|
|
||||||
delay(200);
|
delay(200);
|
||||||
|
@ -33,6 +33,6 @@ void setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
class HIDUniversal2 : public HIDUniversal
|
class HIDUniversal2 : public HIDUniversal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HIDUniversal2(USB *usb) : HIDUniversal(usb) {};
|
HIDUniversal2(USBHost *usb) : HIDUniversal(usb) {};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t OnInitSuccessful();
|
uint8_t OnInitSuccessful();
|
||||||
|
@ -48,9 +48,9 @@ Fail:
|
||||||
return rcode;
|
return rcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub(&Usb);
|
//USBHub Hub(&usb);
|
||||||
HIDUniversal2 Hid(&Usb);
|
HIDUniversal2 Hid(&usb);
|
||||||
UniversalReportParser Uni;
|
UniversalReportParser Uni;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
|
@ -61,7 +61,7 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (usb.Init() == -1)
|
||||||
Serial.println("OSC did not start.");
|
Serial.println("OSC did not start.");
|
||||||
|
|
||||||
delay( 200 );
|
delay( 200 );
|
||||||
|
@ -72,6 +72,6 @@ void setup()
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
USBHub Hub(&Usb);
|
USBHub Hub(&usb);
|
||||||
HIDUniversal Hid(&Usb);
|
HIDUniversal Hid(&usb);
|
||||||
JoystickEvents JoyEvents;
|
JoystickEvents JoyEvents;
|
||||||
JoystickReportParser Joy(&JoyEvents);
|
JoystickReportParser Joy(&JoyEvents);
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (usb.Init() == -1)
|
||||||
Serial.println("OSC did not start.");
|
Serial.println("OSC did not start.");
|
||||||
|
|
||||||
delay( 200 );
|
delay( 200 );
|
||||||
|
@ -37,6 +37,6 @@ void setup()
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
USBHub Hub(&Usb);
|
USBHub Hub(&usb);
|
||||||
HIDUniversal Hid(&Usb);
|
HIDUniversal Hid(&usb);
|
||||||
Max_LCD LCD(&Usb);
|
Max_LCD LCD(&usb);
|
||||||
ScaleEvents ScaleEvents(&LCD);
|
ScaleEvents ScaleEvents(&LCD);
|
||||||
ScaleReportParser Scale(&ScaleEvents);
|
ScaleReportParser Scale(&ScaleEvents);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (usb.Init() == -1)
|
||||||
Serial.println("OSC did not start.");
|
Serial.println("OSC did not start.");
|
||||||
|
|
||||||
// set up the LCD's number of rows and columns:
|
// set up the LCD's number of rows and columns:
|
||||||
|
@ -46,6 +46,6 @@ void setup()
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
/* You can create the instance of the class in two ways */
|
/* You can create the instance of the class in two ways */
|
||||||
PS3USB PS3(&Usb); // This will just create the instance
|
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,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;
|
bool printAngle;
|
||||||
uint8_t state = 0;
|
uint8_t state = 0;
|
||||||
|
@ -25,14 +25,14 @@ void setup() {
|
||||||
#if !defined(__MIPSEL__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); //halt
|
while (1); //halt
|
||||||
}
|
}
|
||||||
Serial.print(F("\r\nPS3 USB Library Started"));
|
Serial.print(F("\r\nPS3 USB Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if (PS3.PS3Connected || PS3.PS3NavigationConnected) {
|
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) {
|
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>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
PS4USB PS4(&Usb);
|
PS4USB PS4(&usb);
|
||||||
|
|
||||||
bool printAngle, printTouch;
|
bool printAngle, printTouch;
|
||||||
uint8_t oldL2Value, oldR2Value;
|
uint8_t oldL2Value, oldR2Value;
|
||||||
|
@ -23,7 +23,7 @@ void setup() {
|
||||||
#if !defined(__MIPSEL__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); // Halt
|
while (1); // Halt
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ void setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if (PS4.connected()) {
|
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) {
|
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>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
PSBuzz Buzz(&Usb);
|
PSBuzz Buzz(&usb);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
#if !defined(__MIPSEL__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); // Halt
|
while (1); // Halt
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ void setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if (Buzz.connected()) {
|
if (Buzz.connected()) {
|
||||||
for (uint8_t i = 0; i < 4; i++) {
|
for (uint8_t i = 0; i < 4; i++) {
|
||||||
|
|
|
@ -8,18 +8,18 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub1(&Usb);
|
//USBHub Hub1(&usb);
|
||||||
//USBHub Hub2(&Usb);
|
//USBHub Hub2(&usb);
|
||||||
//USBHub Hub3(&Usb);
|
//USBHub Hub3(&usb);
|
||||||
//USBHub Hub4(&Usb);
|
//USBHub Hub4(&usb);
|
||||||
//USBHub Hub5(&Usb);
|
//USBHub Hub5(&usb);
|
||||||
//USBHub Hub6(&Usb);
|
//USBHub Hub6(&usb);
|
||||||
//USBHub Hub7(&Usb);
|
//USBHub Hub7(&usb);
|
||||||
|
|
||||||
uint32_t next_time;
|
uint32_t next_time;
|
||||||
|
|
||||||
void PrintAllAddresses(UsbDevice *pdev)
|
void PrintAllAddresses(UsbDeviceDefinition *pdev)
|
||||||
{
|
{
|
||||||
UsbDeviceAddress adr;
|
UsbDeviceAddress adr;
|
||||||
adr.devAddress = pdev->address.devAddress;
|
adr.devAddress = pdev->address.devAddress;
|
||||||
|
@ -56,7 +56,7 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (usb.Init() == -1)
|
||||||
Serial.println("OSC did not start.");
|
Serial.println("OSC did not start.");
|
||||||
|
|
||||||
delay( 200 );
|
delay( 200 );
|
||||||
|
@ -91,7 +91,7 @@ void PrintDescriptors(uint8_t addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintAllDescriptors(UsbDevice *pdev)
|
void PrintAllDescriptors(UsbDeviceDefinition *pdev)
|
||||||
{
|
{
|
||||||
Serial.println("\r\n");
|
Serial.println("\r\n");
|
||||||
print_hex(pdev->address.devAddress, 8);
|
print_hex(pdev->address.devAddress, 8);
|
||||||
|
@ -101,14 +101,14 @@ void PrintAllDescriptors(UsbDevice *pdev)
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if ( Usb.getUsbTaskState() == USB_STATE_RUNNING )
|
if ( usb.getUsbTaskState() == USB_STATE_RUNNING )
|
||||||
{
|
{
|
||||||
//if (millis() >= next_time)
|
//if (millis() >= next_time)
|
||||||
{
|
{
|
||||||
Usb.ForEachUsbDevice(&PrintAllDescriptors);
|
usb.ForEachUsbDevice(&PrintAllDescriptors);
|
||||||
Usb.ForEachUsbDevice(&PrintAllAddresses);
|
usb.ForEachUsbDevice(&PrintAllAddresses);
|
||||||
|
|
||||||
while ( 1 ); //stop
|
while ( 1 ); //stop
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ byte getdevdescr( byte addr, byte &num_conf )
|
||||||
{
|
{
|
||||||
USB_DEVICE_DESCRIPTOR buf;
|
USB_DEVICE_DESCRIPTOR buf;
|
||||||
byte rcode;
|
byte rcode;
|
||||||
rcode = Usb.getDevDescr( addr, 0, 0x12, ( uint8_t *)&buf );
|
rcode = usb.getDevDescr( addr, 0, 0x12, ( uint8_t *)&buf );
|
||||||
if ( rcode ) {
|
if ( rcode ) {
|
||||||
return ( rcode );
|
return ( rcode );
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ void printhubdescr(uint8_t *descrptr, uint8_t addr)
|
||||||
print_hex(descrptr[i], 8);
|
print_hex(descrptr[i], 8);
|
||||||
|
|
||||||
//for (uint8_t i=1; i<=pHub->bNbrPorts; i++)
|
//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 )
|
byte getconfdescr( byte addr, byte conf )
|
||||||
|
@ -210,14 +210,14 @@ byte getconfdescr( byte addr, byte conf )
|
||||||
byte descr_length;
|
byte descr_length;
|
||||||
byte descr_type;
|
byte descr_type;
|
||||||
unsigned int total_length;
|
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 ];
|
LOBYTE( total_length ) = buf[ 2 ];
|
||||||
HIBYTE( total_length ) = buf[ 3 ];
|
HIBYTE( total_length ) = buf[ 3 ];
|
||||||
if ( total_length > 256 ) { //check if total length is larger than buffer
|
if ( total_length > 256 ) { //check if total length is larger than buffer
|
||||||
printProgStr(Conf_Trunc_str);
|
printProgStr(Conf_Trunc_str);
|
||||||
total_length = 256;
|
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
|
while ( buf_ptr < buf + total_length ) { //parsing descriptors
|
||||||
descr_length = *( buf_ptr );
|
descr_length = *( buf_ptr );
|
||||||
descr_type = *( buf_ptr + 1 );
|
descr_type = *( buf_ptr + 1 );
|
||||||
|
|
|
@ -13,23 +13,23 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
USBHub Hub1(&Usb); // The controller has a built in hub, so this instance is needed
|
USBHub Hub1(&usb); // The controller has a built in hub, so this instance is needed
|
||||||
XBOXOLD Xbox(&Usb);
|
XBOXOLD Xbox(&usb);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
#if !defined(__MIPSEL__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); // halt
|
while (1); // halt
|
||||||
}
|
}
|
||||||
Serial.print(F("\r\nXBOX Library Started"));
|
Serial.print(F("\r\nXBOX Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
if (Xbox.XboxConnected) {
|
if (Xbox.XboxConnected) {
|
||||||
if (Xbox.getButtonPress(BLACK) || Xbox.getButtonPress(WHITE)) {
|
if (Xbox.getButtonPress(BLACK) || Xbox.getButtonPress(WHITE)) {
|
||||||
Serial.print("BLACK: ");
|
Serial.print("BLACK: ");
|
||||||
|
|
|
@ -11,20 +11,22 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
XBOXONE Xbox(&Usb);
|
XBOXONE Xbox(&usb);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
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
|
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"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); //halt
|
while (1); //halt
|
||||||
}
|
}
|
||||||
Serial.print(F("\r\nXBOX USB Library Started"));
|
Serial.print(F("\r\nXBOX USB Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
if (Xbox.XboxOneConnected) {
|
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 || 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) {
|
if (Xbox.getAnalogHat(LeftHatX) > 7500 || Xbox.getAnalogHat(LeftHatX) < -7500) {
|
||||||
|
|
|
@ -13,22 +13,22 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
XBOXRECV Xbox(&Usb);
|
XBOXRECV Xbox(&usb);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
#if !defined(__MIPSEL__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); //halt
|
while (1); //halt
|
||||||
}
|
}
|
||||||
Serial.print(F("\r\nXbox Wireless Receiver Library Started"));
|
Serial.print(F("\r\nXbox Wireless Receiver Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
if (Xbox.XboxReceiverConnected) {
|
if (Xbox.XboxReceiverConnected) {
|
||||||
for (uint8_t i = 0; i < 4; i++) {
|
for (uint8_t i = 0; i < 4; i++) {
|
||||||
if (Xbox.Xbox360Connected[i]) {
|
if (Xbox.Xbox360Connected[i]) {
|
||||||
|
|
|
@ -12,22 +12,22 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
XBOXUSB Xbox(&Usb);
|
XBOXUSB Xbox(&usb);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
#if !defined(__MIPSEL__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print(F("\r\nOSC did not start"));
|
Serial.print(F("\r\nOSC did not start"));
|
||||||
while (1); //halt
|
while (1); //halt
|
||||||
}
|
}
|
||||||
Serial.print(F("\r\nXBOX USB Library Started"));
|
Serial.print(F("\r\nXBOX USB Library Started"));
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
if (Xbox.Xbox360Connected) {
|
if (Xbox.Xbox360Connected) {
|
||||||
if (Xbox.getButtonPress(L2) || Xbox.getButtonPress(R2)) {
|
if (Xbox.getButtonPress(L2) || Xbox.getButtonPress(R2)) {
|
||||||
Serial.print("L2: ");
|
Serial.print("L2: ");
|
||||||
|
|
|
@ -41,10 +41,10 @@ uint8_t ACMAsyncOper::OnInit(ACM *pacm)
|
||||||
return rcode;
|
return rcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub(&Usb);
|
//USBHub Hub(&usb);
|
||||||
ACMAsyncOper AsyncOper;
|
ACMAsyncOper AsyncOper;
|
||||||
ACM Acm(&Usb, &AsyncOper);
|
ACM Acm(&usb, &AsyncOper);
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,7 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (usb.Init() == -1)
|
||||||
Serial.println("OSCOKIRQ failed to assert");
|
Serial.println("OSCOKIRQ failed to assert");
|
||||||
|
|
||||||
delay( 200 );
|
delay( 200 );
|
||||||
|
@ -62,7 +62,7 @@ void setup()
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if( Acm.isReady()) {
|
if( Acm.isReady()) {
|
||||||
uint8_t rcode;
|
uint8_t rcode;
|
||||||
|
@ -94,7 +94,7 @@ void loop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delay(10);
|
delay(10);
|
||||||
}//if( Usb.getUsbTaskState() == USB_STATE_RUNNING..
|
}//if( usb.getUsbTaskState() == USB_STATE_RUNNING..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
ADK adk(&Usb, "TKJElectronics", // Manufacturer Name
|
ADK adk(&usb, "TKJElectronics", // Manufacturer Name
|
||||||
"ArduinoBlinkLED", // Model Name
|
"ArduinoBlinkLED", // Model Name
|
||||||
"Example sketch for the USB Host Shield", // Description (user-visible string)
|
"Example sketch for the USB Host Shield", // Description (user-visible string)
|
||||||
"1.0", // Version
|
"1.0", // Version
|
||||||
|
@ -39,7 +39,7 @@ void setup() {
|
||||||
#if !defined(__MIPSEL__)
|
#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
|
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||||
#endif
|
#endif
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.print("\r\nOSCOKIRQ failed to assert");
|
Serial.print("\r\nOSCOKIRQ failed to assert");
|
||||||
while (1); // halt
|
while (1); // halt
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ void setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if (adk.isReady()) {
|
if (adk.isReady()) {
|
||||||
if (!connected) {
|
if (!connected) {
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
USBHub Hub1(&Usb);
|
USBHub Hub1(&usb);
|
||||||
USBHub Hub2(&Usb);
|
USBHub Hub2(&usb);
|
||||||
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> HidKeyboard(&Usb);
|
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> HidKeyboard(&usb);
|
||||||
|
|
||||||
ADK adk(&Usb,"Circuits@Home, ltd.",
|
ADK adk(&usb,"Circuits@Home, ltd.",
|
||||||
"USB Host Shield",
|
"USBHost Host Shield",
|
||||||
"Arduino Terminal for Android",
|
"Arduino Terminal for Android",
|
||||||
"1.0",
|
"1.0",
|
||||||
"http://www.circuitsathome.com",
|
"http://www.circuitsathome.com",
|
||||||
|
@ -75,10 +75,10 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("\r\nADK demo start");
|
Serial.println("\r\nADK demo start");
|
||||||
|
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.println("OSCOKIRQ failed to assert");
|
Serial.println("OSCOKIRQ failed to assert");
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
}//if (Usb.Init() == -1...
|
}//if (usb.Init() == -1...
|
||||||
|
|
||||||
HidKeyboard.SetReportParser(0, (HIDReportParser*)&Prs);
|
HidKeyboard.SetReportParser(0, (HIDReportParser*)&Prs);
|
||||||
|
|
||||||
|
@ -87,5 +87,5 @@ void setup()
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
USBHub hub0(&Usb);
|
USBHub hub0(&usb);
|
||||||
USBHub hub1(&Usb);
|
USBHub hub1(&usb);
|
||||||
ADK adk(&Usb,"Google, Inc.",
|
ADK adk(&usb,"Google, Inc.",
|
||||||
"DemoKit",
|
"DemoKit",
|
||||||
"DemoKit Arduino Board",
|
"DemoKit Arduino Board",
|
||||||
"1.0",
|
"1.0",
|
||||||
|
@ -45,10 +45,10 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("\r\nADK demo start");
|
Serial.println("\r\nADK demo start");
|
||||||
|
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.println("OSCOKIRQ failed to assert");
|
Serial.println("OSCOKIRQ failed to assert");
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
}//if (Usb.Init() == -1...
|
}//if (usb.Init() == -1...
|
||||||
|
|
||||||
|
|
||||||
init_leds();
|
init_leds();
|
||||||
|
@ -60,7 +60,7 @@ void loop()
|
||||||
{
|
{
|
||||||
uint8_t rcode;
|
uint8_t rcode;
|
||||||
uint8_t msg[3] = { 0x00 };
|
uint8_t msg[3] = { 0x00 };
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if( adk.isReady() == false ) {
|
if( adk.isReady() == false ) {
|
||||||
analogWrite(LED1_RED, 255);
|
analogWrite(LED1_RED, 255);
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub(&Usb);
|
//USBHub Hub(&usb);
|
||||||
|
|
||||||
ADK adk(&Usb,"Circuits@Home, ltd.",
|
ADK adk(&usb,"Circuits@Home, ltd.",
|
||||||
"USB Host Shield",
|
"USB Host Shield",
|
||||||
"Arduino Terminal for Android",
|
"Arduino Terminal for Android",
|
||||||
"1.0",
|
"1.0",
|
||||||
|
@ -25,10 +25,10 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("\r\nADK demo start");
|
Serial.println("\r\nADK demo start");
|
||||||
|
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.println("OSCOKIRQ failed to assert");
|
Serial.println("OSCOKIRQ failed to assert");
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
}//if (Usb.Init() == -1...
|
}//if (usb.Init() == -1...
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
|
@ -37,7 +37,7 @@ void loop()
|
||||||
uint8_t msg[64] = { 0x00 };
|
uint8_t msg[64] = { 0x00 };
|
||||||
const char* recv = "Received: ";
|
const char* recv = "Received: ";
|
||||||
|
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if( adk.isReady() == false ) {
|
if( adk.isReady() == false ) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
|
|
||||||
ADK adk(&Usb,"Circuits@Home, ltd.",
|
ADK adk(&usb,"Circuits@Home, ltd.",
|
||||||
"USB Host Shield",
|
"USBHost Host Shield",
|
||||||
"Arduino Terminal for Android",
|
"Arduino Terminal for Android",
|
||||||
"1.0",
|
"1.0",
|
||||||
"http://www.circuitsathome.com",
|
"http://www.circuitsathome.com",
|
||||||
|
@ -24,10 +24,10 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("\r\nADK demo start");
|
Serial.println("\r\nADK demo start");
|
||||||
|
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.println("OSCOKIRQ failed to assert");
|
Serial.println("OSCOKIRQ failed to assert");
|
||||||
while(1); //halt
|
while(1); //halt
|
||||||
}//if (Usb.Init() == -1...
|
}//if (usb.Init() == -1...
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
|
@ -36,7 +36,7 @@ void loop()
|
||||||
const char* sec_ela = " seconds elapsed\r";
|
const char* sec_ela = " seconds elapsed\r";
|
||||||
uint8_t rcode;
|
uint8_t rcode;
|
||||||
|
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
if( adk.isReady() == false ) {
|
if( adk.isReady() == false ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,8 @@ uint8_t laststate;
|
||||||
USB_DEVICE_DESCRIPTOR buf;
|
USB_DEVICE_DESCRIPTOR buf;
|
||||||
|
|
||||||
/* objects */
|
/* objects */
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub hub(&Usb);
|
//USBHub hub(&usb);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
laststate = 0;
|
laststate = 0;
|
||||||
|
@ -33,9 +33,9 @@ void setup() {
|
||||||
E_Notify(PSTR("\r\nUSB Host Shield Quality Control Routine"), 0x80);
|
E_Notify(PSTR("\r\nUSB Host Shield Quality Control Routine"), 0x80);
|
||||||
/* SPI quick test - check revision register */
|
/* SPI quick test - check revision register */
|
||||||
E_Notify(PSTR("\r\nReading REVISION register... Die revision "), 0x80);
|
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) {
|
switch(tmpbyte) {
|
||||||
case( 0x01): //rev.01
|
case( 0x01): //rev.01
|
||||||
E_Notify(PSTR("01"), 0x80);
|
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);
|
E_Notify(PSTR("\r\nSPI long test. Transfers 1MB of data. Each dot is 64K"), 0x80);
|
||||||
uint8_t sample_wr = 0;
|
uint8_t sample_wr = 0;
|
||||||
uint8_t sample_rd = 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(uint8_t i = 0; i < 16; i++) {
|
||||||
for(uint16_t j = 0; j < 65535; j++) {
|
for(uint16_t j = 0; j < 65535; j++) {
|
||||||
Usb.regWr(rGPINPOL, sample_wr);
|
usb.regWr(rGPINPOL, sample_wr);
|
||||||
sample_rd = Usb.regRd(rGPINPOL);
|
sample_rd = usb.regRd(rGPINPOL);
|
||||||
if(sample_rd != sample_wr) {
|
if(sample_rd != sample_wr) {
|
||||||
E_Notify(PSTR("\r\nTest failed. "), 0x80);
|
E_Notify(PSTR("\r\nTest failed. "), 0x80);
|
||||||
E_Notify(PSTR("Value written: "), 0x80);
|
E_Notify(PSTR("Value written: "), 0x80);
|
||||||
|
@ -75,7 +75,7 @@ void setup() {
|
||||||
}//for( uint16_t j...
|
}//for( uint16_t j...
|
||||||
E_Notify(PSTR("."), 0x80);
|
E_Notify(PSTR("."), 0x80);
|
||||||
}//for( uint8_t i...
|
}//for( uint8_t i...
|
||||||
Usb.regWr(rGPINPOL, gpinpol_copy);
|
usb.regWr(rGPINPOL, gpinpol_copy);
|
||||||
E_Notify(PSTR(" SPI long test passed"), 0x80);
|
E_Notify(PSTR(" SPI long test passed"), 0x80);
|
||||||
}//SPI long test
|
}//SPI long test
|
||||||
/* GPIO test */
|
/* GPIO test */
|
||||||
|
@ -85,8 +85,8 @@ void setup() {
|
||||||
uint8_t tmpbyte;
|
uint8_t tmpbyte;
|
||||||
E_Notify(PSTR("\r\nGPIO test. Connect GPIN0 to GPOUT7, GPIN1 to GPOUT6, and so on"), 0x80);
|
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++) {
|
for(uint8_t sample_gpio = 0; sample_gpio < 255; sample_gpio++) {
|
||||||
Usb.gpioWr(sample_gpio);
|
usb.gpioWr(sample_gpio);
|
||||||
tmpbyte = Usb.gpioRd();
|
tmpbyte = usb.gpioRd();
|
||||||
/* bit reversing code copied vetbatim from http://graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious */
|
/* bit reversing code copied vetbatim from http://graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious */
|
||||||
tmpbyte = ((tmpbyte * 0x0802LU & 0x22110LU) | (tmpbyte * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16;
|
tmpbyte = ((tmpbyte * 0x0802LU & 0x22110LU) | (tmpbyte * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16;
|
||||||
if(sample_gpio != tmpbyte) {
|
if(sample_gpio != tmpbyte) {
|
||||||
|
@ -105,7 +105,7 @@ void setup() {
|
||||||
{
|
{
|
||||||
E_Notify(PSTR("\r\nPLL test. 100 chip resets will be performed"), 0x80);
|
E_Notify(PSTR("\r\nPLL test. 100 chip resets will be performed"), 0x80);
|
||||||
/* check current state of the oscillator */
|
/* 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);
|
E_Notify(PSTR("\r\nCurrent oscillator state unexpected."), 0x80);
|
||||||
press_any_key();
|
press_any_key();
|
||||||
}
|
}
|
||||||
|
@ -114,15 +114,15 @@ void setup() {
|
||||||
for(uint16_t i = 0; i < 100; i++) {
|
for(uint16_t i = 0; i < 100; i++) {
|
||||||
E_Notify(PSTR("\rReset number "), 0x80);
|
E_Notify(PSTR("\rReset number "), 0x80);
|
||||||
Serial.print(i, DEC);
|
Serial.print(i, DEC);
|
||||||
Usb.regWr(rUSBCTL, bmCHIPRES); //reset
|
usb.regWr(rUSBCTL, bmCHIPRES); //reset
|
||||||
if(Usb.regRd(rUSBIRQ) & bmOSCOKIRQ) { //wrong state - should be off
|
if(usb.regRd(rUSBIRQ) & bmOSCOKIRQ) { //wrong state - should be off
|
||||||
E_Notify(PSTR("\r\nCurrent oscillator state unexpected."), 0x80);
|
E_Notify(PSTR("\r\nCurrent oscillator state unexpected."), 0x80);
|
||||||
halt55();
|
halt55();
|
||||||
}
|
}
|
||||||
Usb.regWr(rUSBCTL, 0x00); //release from reset
|
usb.regWr(rUSBCTL, 0x00); //release from reset
|
||||||
uint16_t j = 0;
|
uint16_t j = 0;
|
||||||
for(j = 1; j < 65535; j++) { //tracking off to on time
|
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);
|
E_Notify(PSTR(" Time to stabilize - "), 0x80);
|
||||||
Serial.print(j, DEC);
|
Serial.print(j, DEC);
|
||||||
E_Notify(PSTR(" cycles\r\n"), 0x80);
|
E_Notify(PSTR(" cycles\r\n"), 0x80);
|
||||||
|
@ -137,7 +137,7 @@ void setup() {
|
||||||
|
|
||||||
}//PLL test
|
}//PLL test
|
||||||
/* initializing USB stack */
|
/* initializing USB stack */
|
||||||
if(Usb.Init() == -1) {
|
if(usb.Init() == -1) {
|
||||||
E_Notify(PSTR("\r\nOSCOKIRQ failed to assert"), 0x80);
|
E_Notify(PSTR("\r\nOSCOKIRQ failed to assert"), 0x80);
|
||||||
halt55();
|
halt55();
|
||||||
}
|
}
|
||||||
|
@ -146,8 +146,8 @@ void setup() {
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
delay(200);
|
delay(200);
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
usbstate = Usb.getUsbTaskState();
|
usbstate = usb.getUsbTaskState();
|
||||||
if(usbstate != laststate) {
|
if(usbstate != laststate) {
|
||||||
laststate = usbstate;
|
laststate = usbstate;
|
||||||
/**/
|
/**/
|
||||||
|
@ -169,7 +169,7 @@ void loop() {
|
||||||
break;
|
break;
|
||||||
case( USB_STATE_RUNNING):
|
case( USB_STATE_RUNNING):
|
||||||
E_Notify(PSTR("\r\nGetting device descriptor"), 0x80);
|
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) {
|
if(rcode) {
|
||||||
E_Notify(PSTR("\r\nError reading device descriptor. Error code "), 0x80);
|
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);
|
E_Notify(PSTR("\r\nPress RESET to restart test"), 0x80);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
Usb.regWr(0x55, 0x55);
|
usb.regWr(0x55, 0x55);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,9 @@ uint8_t ACMAsyncOper::OnInit(ACM *pacm)
|
||||||
return rcode;
|
return rcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
ACMAsyncOper AsyncOper;
|
ACMAsyncOper AsyncOper;
|
||||||
XR21B1411 Acm(&Usb, &AsyncOper);
|
XR21B1411 Acm(&usb, &AsyncOper);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
@ -49,11 +49,11 @@ void setup() {
|
||||||
#endif
|
#endif
|
||||||
Serial.println("\r\n\r\nStart");
|
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() {
|
void loop() {
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
if( Acm.isReady()) {
|
if( Acm.isReady()) {
|
||||||
uint8_t rcode;
|
uint8_t rcode;
|
||||||
uint8_t buf[1];
|
uint8_t buf[1];
|
||||||
|
|
|
@ -34,10 +34,10 @@ uint8_t FTDIAsync::OnInit(FTDI *pftdi)
|
||||||
return rcode;
|
return rcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub(&Usb);
|
//USBHub Hub(&usb);
|
||||||
FTDIAsync FtdiAsync;
|
FTDIAsync FtdiAsync;
|
||||||
FTDI Ftdi(&Usb, &FtdiAsync);
|
FTDI Ftdi(&usb, &FtdiAsync);
|
||||||
|
|
||||||
uint32_t next_time;
|
uint32_t next_time;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (usb.Init() == -1)
|
||||||
Serial.println("OSC did not start.");
|
Serial.println("OSC did not start.");
|
||||||
|
|
||||||
delay( 200 );
|
delay( 200 );
|
||||||
|
@ -59,9 +59,9 @@ void setup()
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if( Usb.getUsbTaskState() == USB_STATE_RUNNING )
|
if( usb.getUsbTaskState() == USB_STATE_RUNNING )
|
||||||
{
|
{
|
||||||
uint8_t rcode;
|
uint8_t rcode;
|
||||||
char strbuf[] = "DEADBEEF";
|
char strbuf[] = "DEADBEEF";
|
||||||
|
|
|
@ -7,15 +7,15 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
USBHub Hub1(&Usb);
|
USBHub Hub1(&usb);
|
||||||
USBHub Hub2(&Usb);
|
USBHub Hub2(&usb);
|
||||||
USBHub Hub3(&Usb);
|
USBHub Hub3(&usb);
|
||||||
USBHub Hub4(&Usb);
|
USBHub Hub4(&usb);
|
||||||
|
|
||||||
uint32_t next_time;
|
uint32_t next_time;
|
||||||
|
|
||||||
void PrintAllAddresses(UsbDevice *pdev)
|
void PrintAllAddresses(UsbDeviceDefinition *pdev)
|
||||||
{
|
{
|
||||||
UsbDeviceAddress adr;
|
UsbDeviceAddress adr;
|
||||||
adr.devAddress = pdev->address.devAddress;
|
adr.devAddress = pdev->address.devAddress;
|
||||||
|
@ -52,7 +52,7 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (usb.Init() == -1)
|
||||||
Serial.println("OSC did not start.");
|
Serial.println("OSC did not start.");
|
||||||
|
|
||||||
delay( 200 );
|
delay( 200 );
|
||||||
|
@ -87,7 +87,7 @@ void PrintDescriptors(uint8_t addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintAllDescriptors(UsbDevice *pdev)
|
void PrintAllDescriptors(UsbDeviceDefinition *pdev)
|
||||||
{
|
{
|
||||||
Serial.println("\r\n");
|
Serial.println("\r\n");
|
||||||
print_hex(pdev->address.devAddress, 8);
|
print_hex(pdev->address.devAddress, 8);
|
||||||
|
@ -97,14 +97,14 @@ void PrintAllDescriptors(UsbDevice *pdev)
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if ( Usb.getUsbTaskState() == USB_STATE_RUNNING )
|
if ( usb.getUsbTaskState() == USB_STATE_RUNNING )
|
||||||
{
|
{
|
||||||
if ((millis() - next_time) >= 0L)
|
if ((millis() - next_time) >= 0L)
|
||||||
{
|
{
|
||||||
Usb.ForEachUsbDevice(&PrintAllDescriptors);
|
usb.ForEachUsbDevice(&PrintAllDescriptors);
|
||||||
Usb.ForEachUsbDevice(&PrintAllAddresses);
|
usb.ForEachUsbDevice(&PrintAllAddresses);
|
||||||
|
|
||||||
while ( 1 ); //stop
|
while ( 1 ); //stop
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ byte getdevdescr( byte addr, byte &num_conf )
|
||||||
{
|
{
|
||||||
USB_DEVICE_DESCRIPTOR buf;
|
USB_DEVICE_DESCRIPTOR buf;
|
||||||
byte rcode;
|
byte rcode;
|
||||||
rcode = Usb.getDevDescr( addr, 0, 0x12, ( uint8_t *)&buf );
|
rcode = usb.getDevDescr( addr, 0, 0x12, ( uint8_t *)&buf );
|
||||||
if ( rcode ) {
|
if ( rcode ) {
|
||||||
return ( rcode );
|
return ( rcode );
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ void printhubdescr(uint8_t *descrptr, uint8_t addr)
|
||||||
print_hex(descrptr[i], 8);
|
print_hex(descrptr[i], 8);
|
||||||
|
|
||||||
//for (uint8_t i=1; i<=pHub->bNbrPorts; i++)
|
//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 )
|
byte getconfdescr( byte addr, byte conf )
|
||||||
|
@ -206,14 +206,14 @@ byte getconfdescr( byte addr, byte conf )
|
||||||
byte descr_length;
|
byte descr_length;
|
||||||
byte descr_type;
|
byte descr_type;
|
||||||
unsigned int total_length;
|
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 ];
|
LOBYTE( total_length ) = buf[ 2 ];
|
||||||
HIBYTE( total_length ) = buf[ 3 ];
|
HIBYTE( total_length ) = buf[ 3 ];
|
||||||
if ( total_length > 256 ) { //check if total length is larger than buffer
|
if ( total_length > 256 ) { //check if total length is larger than buffer
|
||||||
printProgStr(Conf_Trunc_str);
|
printProgStr(Conf_Trunc_str);
|
||||||
total_length = 256;
|
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
|
while ( buf_ptr < buf + total_length ) { //parsing descriptors
|
||||||
descr_length = *( buf_ptr );
|
descr_length = *( buf_ptr );
|
||||||
descr_type = *( buf_ptr + 1 );
|
descr_type = *( buf_ptr + 1 );
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
Max_LCD lcd(&Usb);
|
Max_LCD lcd(&usb);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Set up the LCD's number of columns and rows:
|
// Set up the LCD's number of columns and rows:
|
||||||
|
|
|
@ -44,10 +44,10 @@ uint8_t PLAsyncOper::OnInit(ACM *pacm)
|
||||||
|
|
||||||
return rcode;
|
return rcode;
|
||||||
}
|
}
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub(&Usb);
|
//USBHub Hub(&usb);
|
||||||
PLAsyncOper AsyncOper;
|
PLAsyncOper AsyncOper;
|
||||||
PL2303 Pl(&Usb, &AsyncOper);
|
PL2303 Pl(&usb, &AsyncOper);
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (usb.Init() == -1)
|
||||||
Serial.println("OSCOKIRQ failed to assert");
|
Serial.println("OSCOKIRQ failed to assert");
|
||||||
|
|
||||||
delay( 200 );
|
delay( 200 );
|
||||||
|
@ -65,9 +65,9 @@ void setup()
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if( Usb.getUsbTaskState() == USB_STATE_RUNNING )
|
if( usb.getUsbTaskState() == USB_STATE_RUNNING )
|
||||||
{
|
{
|
||||||
uint8_t rcode;
|
uint8_t rcode;
|
||||||
|
|
||||||
|
@ -96,6 +96,6 @@ void loop()
|
||||||
Serial.print((char)buf[i]); //printing on the screen
|
Serial.print((char)buf[i]); //printing on the screen
|
||||||
}
|
}
|
||||||
}//if( rcvd ...
|
}//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;
|
return rcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
USBHub Hub(&Usb);
|
USBHub Hub(&usb);
|
||||||
PLAsyncOper AsyncOper;
|
PLAsyncOper AsyncOper;
|
||||||
PL2303 Pl(&Usb, &AsyncOper);
|
PL2303 Pl(&usb, &AsyncOper);
|
||||||
uint32_t read_delay;
|
uint32_t read_delay;
|
||||||
#define READ_DELAY 100
|
#define READ_DELAY 100
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ void setup() {
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if(Usb.Init() == -1)
|
if(usb.Init() == -1)
|
||||||
Serial.println("OSCOKIRQ failed to assert");
|
Serial.println("OSCOKIRQ failed to assert");
|
||||||
|
|
||||||
delay(200);
|
delay(200);
|
||||||
|
@ -67,7 +67,7 @@ void loop() {
|
||||||
uint8_t buf[64]; //serial buffer equals Max.packet size of bulk-IN endpoint
|
uint8_t buf[64]; //serial buffer equals Max.packet size of bulk-IN endpoint
|
||||||
uint16_t rcvd = 64;
|
uint16_t rcvd = 64;
|
||||||
|
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if(Pl.isReady()) {
|
if(Pl.isReady()) {
|
||||||
/* reading the GPS */
|
/* reading the GPS */
|
||||||
|
@ -82,7 +82,7 @@ void loop() {
|
||||||
}//for( uint16_t i=0; i < rcvd; i++...
|
}//for( uint16_t i=0; i < rcvd; i++...
|
||||||
}//if( rcvd
|
}//if( rcvd
|
||||||
}//if( read_delay > millis()...
|
}//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;
|
return rcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub(&Usb);
|
//USBHub Hub(&usb);
|
||||||
PLAsyncOper AsyncOper;
|
PLAsyncOper AsyncOper;
|
||||||
PL2303 Pl(&Usb, &AsyncOper);
|
PL2303 Pl(&usb, &AsyncOper);
|
||||||
TinyGPS gps;
|
TinyGPS gps;
|
||||||
|
|
||||||
void gpsdump(TinyGPS &gps);
|
void gpsdump(TinyGPS &gps);
|
||||||
|
@ -80,7 +80,7 @@ void setup()
|
||||||
Serial.print("Sizeof(gpsobject) = "); Serial.println(sizeof(TinyGPS));
|
Serial.print("Sizeof(gpsobject) = "); Serial.println(sizeof(TinyGPS));
|
||||||
Serial.println();
|
Serial.println();
|
||||||
/* USB Initialization */
|
/* USB Initialization */
|
||||||
if (Usb.Init() == -1) {
|
if (usb.Init() == -1) {
|
||||||
Serial.println("OSCOKIRQ failed to assert");
|
Serial.println("OSCOKIRQ failed to assert");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ void setup()
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if( Pl.isReady()) {
|
if( Pl.isReady()) {
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ void loop()
|
||||||
Serial.println("-------------");
|
Serial.println("-------------");
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}//if( newdata...
|
}//if( newdata...
|
||||||
}//if( Usb.getUsbTaskState() == USB_STATE_RUNNING...
|
}//if( usb.getUsbTaskState() == USB_STATE_RUNNING...
|
||||||
}
|
}
|
||||||
|
|
||||||
void printFloat(double number, int digits)
|
void printFloat(double number, int digits)
|
||||||
|
|
|
@ -44,10 +44,10 @@ uint8_t PLAsyncOper::OnInit(ACM *pacm)
|
||||||
|
|
||||||
return rcode;
|
return rcode;
|
||||||
}
|
}
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
//USBHub Hub(&Usb);
|
//USBHub Hub(&usb);
|
||||||
PLAsyncOper AsyncOper;
|
PLAsyncOper AsyncOper;
|
||||||
PL2303 Pl(&Usb, &AsyncOper);
|
PL2303 Pl(&usb, &AsyncOper);
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
Serial.println("Start");
|
Serial.println("Start");
|
||||||
|
|
||||||
if (Usb.Init() == -1)
|
if (usb.Init() == -1)
|
||||||
Serial.println("OSCOKIRQ failed to assert");
|
Serial.println("OSCOKIRQ failed to assert");
|
||||||
|
|
||||||
delay( 200 );
|
delay( 200 );
|
||||||
|
@ -65,9 +65,9 @@ void setup()
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
|
|
||||||
if( Usb.getUsbTaskState() == USB_STATE_RUNNING )
|
if( usb.getUsbTaskState() == USB_STATE_RUNNING )
|
||||||
{
|
{
|
||||||
uint8_t rcode;
|
uint8_t rcode;
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ void loop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delay(10);
|
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
|
volatile int fadeAmount = 80; // how many points to fade the LED by
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB Usb;
|
USBHost usb;
|
||||||
|
|
||||||
volatile uint8_t current_state = 1;
|
volatile uint8_t current_state = 1;
|
||||||
volatile uint8_t last_state = 0;
|
volatile uint8_t last_state = 0;
|
||||||
|
@ -297,7 +297,7 @@ void setup() {
|
||||||
// Besides, it is easier to initialize stuff...
|
// Besides, it is easier to initialize stuff...
|
||||||
#if WANT_HUB_TEST
|
#if WANT_HUB_TEST
|
||||||
for(int i = 0; i < MAX_HUBS; i++) {
|
for(int i = 0; i < MAX_HUBS; i++) {
|
||||||
Hubs[i] = new USBHub(&Usb);
|
Hubs[i] = new USBHub(&usb);
|
||||||
#if defined(__AVR__)
|
#if defined(__AVR__)
|
||||||
printf_P(PSTR("Available heap: %u Bytes\r\n"), freeHeap());
|
printf_P(PSTR("Available heap: %u Bytes\r\n"), freeHeap());
|
||||||
#endif
|
#endif
|
||||||
|
@ -306,7 +306,7 @@ void setup() {
|
||||||
// Initialize generic storage. This must be done before USB starts.
|
// Initialize generic storage. This must be done before USB starts.
|
||||||
Init_Generic_Storage();
|
Init_Generic_Storage();
|
||||||
|
|
||||||
while(Usb.Init(1000) == -1) {
|
while(usb.Init(1000) == -1) {
|
||||||
printf_P(PSTR("No USB HOST Shield?\r\n"));
|
printf_P(PSTR("No USB HOST Shield?\r\n"));
|
||||||
Notify(PSTR("OSC did not start."), 0x40);
|
Notify(PSTR("OSC did not start."), 0x40);
|
||||||
}
|
}
|
||||||
|
@ -429,15 +429,15 @@ void loop() {
|
||||||
if(change) {
|
if(change) {
|
||||||
change = false;
|
change = false;
|
||||||
if(usbon) {
|
if(usbon) {
|
||||||
Usb.vbusPower(vbus_on);
|
usb.vbusPower(vbus_on);
|
||||||
printf_P(PSTR("VBUS on\r\n"));
|
printf_P(PSTR("VBUS on\r\n"));
|
||||||
} else {
|
} else {
|
||||||
Usb.vbusPower(vbus_off);
|
usb.vbusPower(vbus_off);
|
||||||
usbon_time = millis() + 2000;
|
usbon_time = millis() + 2000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Usb.Task();
|
usb.Task();
|
||||||
current_state = Usb.getUsbTaskState();
|
current_state = usb.getUsbTaskState();
|
||||||
if(current_state != last_state) {
|
if(current_state != last_state) {
|
||||||
if(UsbDEBUGlvl > 0x50)
|
if(UsbDEBUGlvl > 0x50)
|
||||||
printf_P(PSTR("USB state = %x\r\n"), current_state);
|
printf_P(PSTR("USB state = %x\r\n"), current_state);
|
||||||
|
|
Loading…
Reference in a new issue