Merge branch 'xxxajk' of github.com:felis/USB_Host_Shield_2.0 into xxxajk

This commit is contained in:
Andrew J. Kroll 2013-10-21 13:49:11 -04:00
commit 13d625e6be
18 changed files with 202 additions and 114 deletions

View file

@ -167,6 +167,7 @@ uint8_t BTD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
goto FailSetDevTblEntry; goto FailSetDevTblEntry;
if (VID == PS3_VID && (PID == PS3_PID || PID == PS3NAVIGATION_PID || PID == PS3MOVE_PID)) { if (VID == PS3_VID && (PID == PS3_PID || PID == PS3NAVIGATION_PID || PID == PS3MOVE_PID)) {
delay(100);
rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, 1); // We only need the Control endpoint, so we don't have to initialize the other endpoints of device rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, 1); // We only need the Control endpoint, so we don't have to initialize the other endpoints of device
if (rcode) if (rcode)
goto FailSetConfDescr; goto FailSetConfDescr;

View file

@ -66,7 +66,7 @@ By default serial debugging is disabled. To turn it on simply change ```ENABLE_U
Currently the following boards are supported by the library: Currently the following boards are supported by the library:
* All official Arduino AVR boards (Uno, Duemilanove, Mega, Mega 2560, Mega ADK, Leonardo etc.) * All official Arduino AVR boards (Uno, Duemilanove, Mega, Mega 2560, Mega ADK, Leonardo etc.)
* Teensy (Teensy 1.0, Teensy 2.0 and Teensy++ 2.0) * Teensy (Teensy++ 1.0, Teensy 2.0, Teensy++ 2.0, and Teensy 3.0)
* Balanduino * Balanduino
* Sanguino * Sanguino
* Black Widdow * Black Widdow

1
Usb.h
View file

@ -18,7 +18,6 @@ e-mail : support@circuitsathome.com
#ifndef _usb_h_ #ifndef _usb_h_
#define _usb_h_ #define _usb_h_
// WARNING: Do not change the order of includes, or stuff will break! // WARNING: Do not change the order of includes, or stuff will break!
#include <inttypes.h> #include <inttypes.h>
#include <stddef.h> #include <stddef.h>

View file

@ -18,13 +18,13 @@
#ifdef BOARD_BLACK_WIDDOW #ifdef BOARD_BLACK_WIDDOW
typedef MAX3421e<P6, P3> MAX3421E; // Black Widow typedef MAX3421e<P6, P3> MAX3421E; // Black Widow
#elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)) #elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
typedef MAX3421e<P9, P8> MAX3421E; // Teensy++ 2.0 & 1.0 typedef MAX3421e<P9, P8> MAX3421E; // Teensy++ 1.0 and 2.0
#elif defined(BOARD_MEGA_ADK) #elif defined(BOARD_MEGA_ADK)
typedef MAX3421e<P53, P54> MAX3421E; // Arduino Mega ADK typedef MAX3421e<P53, P54> MAX3421E; // Arduino Mega ADK
#elif defined(ARDUINO_AVR_BALANDUINO) #elif defined(ARDUINO_AVR_BALANDUINO)
typedef MAX3421e<P20, P19> MAX3421E; // Balanduino typedef MAX3421e<P20, P19> MAX3421E; // Balanduino
#else #else
typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo etc.) typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo etc.) or Teensy 2.0 and 3.0
#endif #endif
/* Common setup data constant combinations */ /* Common setup data constant combinations */

35
Wii.cpp
View file

@ -285,11 +285,9 @@ void WII::ACLData(uint8_t* l2capinbuf) {
} }
} }
if (l2capinbuf[9] == 0x31 || l2capinbuf[9] == 0x33 || l2capinbuf[9] == 0x35 || l2capinbuf[9] == 0x37) { // Read the accelerometer if (l2capinbuf[9] == 0x31 || l2capinbuf[9] == 0x33 || l2capinbuf[9] == 0x35 || l2capinbuf[9] == 0x37) { // Read the accelerometer
accX = ((l2capinbuf[12] << 2) | (l2capinbuf[10] & 0x60 >> 5)) - 500; accXwiimote = ((l2capinbuf[12] << 2) | (l2capinbuf[10] & 0x60 >> 5)) - 500;
accY = ((l2capinbuf[13] << 2) | (l2capinbuf[11] & 0x20 >> 4)) - 500; accYwiimote = ((l2capinbuf[13] << 2) | (l2capinbuf[11] & 0x20 >> 4)) - 500;
accZ = ((l2capinbuf[14] << 2) | (l2capinbuf[11] & 0x40 >> 5)) - 500; accZwiimote = ((l2capinbuf[14] << 2) | (l2capinbuf[11] & 0x40 >> 5)) - 500;
wiimotePitch = (atan2(accY, accZ) + PI) * RAD_TO_DEG;
wiimoteRoll = (atan2(accX, accZ) + PI) * RAD_TO_DEG;
} }
switch (l2capinbuf[9]) { switch (l2capinbuf[9]) {
case 0x20: // Status Information - (a1) 20 BB BB LF 00 00 VV case 0x20: // Status Information - (a1) 20 BB BB LF 00 00 VV
@ -416,14 +414,10 @@ void WII::ACLData(uint8_t* l2capinbuf) {
case 0x30: // Core buttons - (a1) 30 BB BB case 0x30: // Core buttons - (a1) 30 BB BB
break; break;
case 0x31: // Core Buttons and Accelerometer - (a1) 31 BB BB AA AA AA case 0x31: // Core Buttons and Accelerometer - (a1) 31 BB BB AA AA AA
pitch = wiimotePitch; // The pitch is just equal to the angle calculated from the wiimote as there is no Motion Plus connected
roll = wiimoteRoll;
break; break;
case 0x32: // Core Buttons with 8 Extension bytes - (a1) 32 BB BB EE EE EE EE EE EE EE EE case 0x32: // Core Buttons with 8 Extension bytes - (a1) 32 BB BB EE EE EE EE EE EE EE EE
break; break;
case 0x33: // Core Buttons with Accelerometer and 12 IR bytes - (a1) 33 BB BB AA AA AA II II II II II II II II II II II II case 0x33: // Core Buttons with Accelerometer and 12 IR bytes - (a1) 33 BB BB AA AA AA II II II II II II II II II II II II
pitch = wiimotePitch; // The pitch is just equal to the angle calculated from the wiimote as there is no Motion Plus data available
roll = wiimoteRoll;
#ifdef WIICAMERA #ifdef WIICAMERA
// Read the IR data // Read the IR data
IR_object_x1 = (l2capinbuf[15] | ((uint16_t)(l2capinbuf[17] & 0x30) << 4)); // x position IR_object_x1 = (l2capinbuf[15] | ((uint16_t)(l2capinbuf[17] & 0x30) << 4)); // x position
@ -486,8 +480,8 @@ void WII::ACLData(uint8_t* l2capinbuf) {
if (!(l2capinbuf[19] & 0x02)) // Check if fast more is used if (!(l2capinbuf[19] & 0x02)) // Check if fast more is used
rollGyroSpeed *= 4.545; rollGyroSpeed *= 4.545;
pitch = (0.93 * (pitch + (pitchGyroSpeed * (double)(micros() - timer) / 1000000)))+(0.07 * wiimotePitch); // Use a complimentary filter to calculate the angle compPitch = (0.93 * (compPitch + (pitchGyroSpeed * (double)(micros() - timer) / 1000000)))+(0.07 * getWiimotePitch()); // Use a complimentary filter to calculate the angle
roll = (0.93 * (roll + (rollGyroSpeed * (double)(micros() - timer) / 1000000)))+(0.07 * wiimoteRoll); compRoll = (0.93 * (compRoll + (rollGyroSpeed * (double)(micros() - timer) / 1000000)))+(0.07 * getWiimoteRoll());
gyroYaw += (yawGyroSpeed * ((double)(micros() - timer) / 1000000)); gyroYaw += (yawGyroSpeed * ((double)(micros() - timer) / 1000000));
gyroRoll += (rollGyroSpeed * ((double)(micros() - timer) / 1000000)); gyroRoll += (rollGyroSpeed * ((double)(micros() - timer) / 1000000));
@ -533,11 +527,9 @@ void WII::ACLData(uint8_t* l2capinbuf) {
if (nunchuckConnected) { if (nunchuckConnected) {
hatValues[HatX] = l2capinbuf[15]; hatValues[HatX] = l2capinbuf[15];
hatValues[HatY] = l2capinbuf[16]; hatValues[HatY] = l2capinbuf[16];
accX = ((l2capinbuf[17] << 2) | (l2capinbuf[20] & 0x10 >> 3)) - 416; accXnunchuck = ((l2capinbuf[17] << 2) | (l2capinbuf[20] & 0x10 >> 3)) - 416;
accY = ((l2capinbuf[18] << 2) | (l2capinbuf[20] & 0x20 >> 4)) - 416; accYnunchuck = ((l2capinbuf[18] << 2) | (l2capinbuf[20] & 0x20 >> 4)) - 416;
accZ = (((l2capinbuf[19] & 0xFE) << 2) | (l2capinbuf[20] & 0xC0 >> 5)) - 416; accZnunchuck = (((l2capinbuf[19] & 0xFE) << 2) | (l2capinbuf[20] & 0xC0 >> 5)) - 416;
nunchuckPitch = (atan2(accY, accZ) + PI) * RAD_TO_DEG;
nunchuckRoll = (atan2(accX, accZ) + PI) * RAD_TO_DEG;
} }
//else if(classicControllerConnected) { } //else if(classicControllerConnected) { }
} }
@ -563,14 +555,9 @@ void WII::ACLData(uint8_t* l2capinbuf) {
} else if (nunchuckConnected) { } else if (nunchuckConnected) {
hatValues[HatX] = l2capinbuf[15]; hatValues[HatX] = l2capinbuf[15];
hatValues[HatY] = l2capinbuf[16]; hatValues[HatY] = l2capinbuf[16];
accX = ((l2capinbuf[17] << 2) | (l2capinbuf[20] & 0x0C >> 2)) - 416; accXnunchuck = ((l2capinbuf[17] << 2) | (l2capinbuf[20] & 0x0C >> 2)) - 416;
accY = ((l2capinbuf[18] << 2) | (l2capinbuf[20] & 0x30 >> 4)) - 416; accYnunchuck = ((l2capinbuf[18] << 2) | (l2capinbuf[20] & 0x30 >> 4)) - 416;
accZ = ((l2capinbuf[19] << 2) | (l2capinbuf[20] & 0xC0 >> 6)) - 416; accZnunchuck = ((l2capinbuf[19] << 2) | (l2capinbuf[20] & 0xC0 >> 6)) - 416;
nunchuckPitch = (atan2(accY, accZ) + PI) * RAD_TO_DEG;
nunchuckRoll = (atan2(accX, accZ) + PI) * RAD_TO_DEG;
pitch = wiimotePitch; // The pitch is just equal to the angle calculated from the wiimote as there is no Motion Plus connected
roll = wiimoteRoll;
} else if (wiiUProControllerConnected) { } else if (wiiUProControllerConnected) {
hatValues[LeftHatX] = (l2capinbuf[15] | l2capinbuf[16] << 8); hatValues[LeftHatX] = (l2capinbuf[15] | l2capinbuf[16] << 8);
hatValues[RightHatX] = (l2capinbuf[17] | l2capinbuf[18] << 8); hatValues[RightHatX] = (l2capinbuf[17] | l2capinbuf[18] << 8);

33
Wii.h
View file

@ -152,7 +152,9 @@ public:
* @return Pitch in the range from 0-360. * @return Pitch in the range from 0-360.
*/ */
double getPitch() { double getPitch() {
return pitch; if (motionPlusConnected)
return compPitch;
return getWiimotePitch();
}; };
/** /**
@ -160,7 +162,9 @@ public:
* @return Roll in the range from 0-360. * @return Roll in the range from 0-360.
*/ */
double getRoll() { double getRoll() {
return roll; if (motionPlusConnected)
return compRoll;
return getWiimoteRoll();
}; };
/** /**
@ -250,21 +254,28 @@ public:
/**@{*/ /**@{*/
/** Pitch and roll calculated from the accelerometer inside the Wiimote. */ /** Pitch and roll calculated from the accelerometer inside the Wiimote. */
double wiimotePitch; double getWiimotePitch() {
double wiimoteRoll; return (atan2(accYwiimote, accZwiimote) + PI) * RAD_TO_DEG;
};
double getWiimoteRoll() {
return (atan2(accXwiimote, accZwiimote) + PI) * RAD_TO_DEG;
};
/**@}*/ /**@}*/
/**@{*/ /**@{*/
/** Pitch and roll calculated from the accelerometer inside the Nunchuck. */ /** Pitch and roll calculated from the accelerometer inside the Nunchuck. */
double nunchuckPitch; double getNunchuckPitch() {
double nunchuckRoll; return (atan2(accYnunchuck, accZnunchuck) + PI) * RAD_TO_DEG;
};
double getNunchuckRoll() {
return (atan2(accXnunchuck, accZnunchuck) + PI) * RAD_TO_DEG;
};
/**@}*/ /**@}*/
/**@{*/ /**@{*/
/** Accelerometer values used to calculate pitch and roll. */ /** Accelerometer values used to calculate pitch and roll. */
int16_t accX; int16_t accXwiimote, accYwiimote, accZwiimote;
int16_t accY; int16_t accXnunchuck, accYnunchuck, accZnunchuck;
int16_t accZ;
/**@}*/ /**@}*/
/* Variables for the gyro inside the Motion Plus */ /* Variables for the gyro inside the Motion Plus */
@ -476,8 +487,8 @@ private:
void initMotionPlus(); void initMotionPlus();
void activateMotionPlus(); void activateMotionPlus();
double pitch; // Fusioned angle using a complimentary filter if the Motion Plus is connected double compPitch; // Fusioned angle using a complimentary filter if the Motion Plus is connected
double roll; // Fusioned angle using a complimentary filter if the Motion Plus is connected double compRoll; // Fusioned angle using a complimentary filter if the Motion Plus is connected
bool activateNunchuck; bool activateNunchuck;
bool motionValuesReset; // This bool is true when the gyro values has been reset bool motionValuesReset; // This bool is true when the gyro values has been reset

View file

@ -22,6 +22,11 @@ e-mail : support@circuitsathome.com
#else #else
#define _avrpins_h_ #define _avrpins_h_
#if defined(__AVR__)
// pointers are 16 bits on AVR
#define pgm_read_pointer(p) pgm_read_word(p)
// Support for these boards needs to be manually activated in settings.h or in a makefile // Support for these boards needs to be manually activated in settings.h or in a makefile
#if !defined(BOARD_MEGA_ADK) && defined(__AVR_ATmega2560__) && (USE_UHS_MEGA_ADK || defined(ARDUINO_AVR_ADK)) #if !defined(BOARD_MEGA_ADK) && defined(__AVR_ATmega2560__) && (USE_UHS_MEGA_ADK || defined(ARDUINO_AVR_ADK))
#define BOARD_MEGA_ADK #define BOARD_MEGA_ADK
@ -505,7 +510,11 @@ public:
#define P51 Pb2 #define P51 Pb2
#define P52 Pb1 #define P52 Pb1
#define P53 Pb0 #define P53 Pb0
#ifdef BOARD_MEGA_ADK // These pins are not broken out on the Arduino ADK
#define P54 Pe6 // INT on Arduino ADK #define P54 Pe6 // INT on Arduino ADK
#define P55 Pj2 // MAX_RESET on Arduino ADK
#endif
// "Mega" pin numbers // "Mega" pin numbers
@ -608,7 +617,7 @@ public:
// Arduino Leonardo pin numbers // Arduino Leonardo pin numbers
#elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)) #elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
// Teensy++ 2.0 pin numbers // Teensy++ 1.0 and 2.0 pin numbers
// http://www.pjrc.com/teensy/pinout.html // http://www.pjrc.com/teensy/pinout.html
#define P0 Pd0 #define P0 Pd0
#define P1 Pd1 #define P1 Pd1
@ -656,7 +665,7 @@ public:
#define P43 Pf5 #define P43 Pf5
#define P44 Pf6 #define P44 Pf6
#define P45 Pf7 #define P45 Pf7
// Teensy++ 2.0 // Teensy++ 1.0 and 2.0
#elif defined(ARDUINO_AVR_BALANDUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega1284P__)) #elif defined(ARDUINO_AVR_BALANDUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega1284P__))
// Balanduino pin numbers // Balanduino pin numbers
@ -733,6 +742,83 @@ public:
#define P31 Pa7 #define P31 Pa7
// Sanguino // Sanguino
#else
#error "Please define board in avrpins.h"
#endif // Arduino pin definitions #endif // Arduino pin definitions
#endif // __AVR__
#if defined(__arm__) && defined(CORE_TEENSY)
// pointers are 32 bits on ARM
#define pgm_read_pointer(p) pgm_read_dword(p)
#include "core_pins.h"
#include "avr_emulation.h"
#define GPIO_BITBAND_ADDR(reg, bit) (((uint32_t)&(reg) - 0x40000000) * 32 + (bit) * 4 + 0x42000000)
#define GPIO_BITBAND_PTR(reg, bit) ((uint8_t *)GPIO_BITBAND_ADDR((reg), (bit)))
#define MAKE_PIN(className, baseReg, pinNum, configReg) \
class className { \
public: \
static void Set() { \
*GPIO_BITBAND_PTR(baseReg, pinNum) = 1; \
} \
static void Clear() { \
*GPIO_BITBAND_PTR(baseReg, pinNum) = 0; \
} \
static void SetDirRead() { \
configReg = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); \
*(GPIO_BITBAND_PTR(baseReg, pinNum) + 640) = 0; \
} \
static void SetDirWrite() { \
configReg = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); \
*(GPIO_BITBAND_PTR(baseReg, pinNum) + 640) = 1; \
} \
static uint8_t IsSet() { \
return *(GPIO_BITBAND_PTR(baseReg, pinNum) + 512); \
} \
};
MAKE_PIN(P0, CORE_PIN0_PORTREG, CORE_PIN0_BIT, CORE_PIN0_CONFIG);
MAKE_PIN(P1, CORE_PIN1_PORTREG, CORE_PIN1_BIT, CORE_PIN1_CONFIG);
MAKE_PIN(P2, CORE_PIN2_PORTREG, CORE_PIN2_BIT, CORE_PIN2_CONFIG);
MAKE_PIN(P3, CORE_PIN3_PORTREG, CORE_PIN3_BIT, CORE_PIN3_CONFIG);
MAKE_PIN(P4, CORE_PIN4_PORTREG, CORE_PIN4_BIT, CORE_PIN4_CONFIG);
MAKE_PIN(P5, CORE_PIN5_PORTREG, CORE_PIN5_BIT, CORE_PIN5_CONFIG);
MAKE_PIN(P6, CORE_PIN6_PORTREG, CORE_PIN6_BIT, CORE_PIN6_CONFIG);
MAKE_PIN(P7, CORE_PIN7_PORTREG, CORE_PIN7_BIT, CORE_PIN7_CONFIG);
MAKE_PIN(P8, CORE_PIN8_PORTREG, CORE_PIN8_BIT, CORE_PIN8_CONFIG);
MAKE_PIN(P9, CORE_PIN9_PORTREG, CORE_PIN9_BIT, CORE_PIN9_CONFIG);
MAKE_PIN(P10, CORE_PIN10_PORTREG, CORE_PIN10_BIT, CORE_PIN10_CONFIG);
MAKE_PIN(P11, CORE_PIN11_PORTREG, CORE_PIN11_BIT, CORE_PIN11_CONFIG);
MAKE_PIN(P12, CORE_PIN12_PORTREG, CORE_PIN12_BIT, CORE_PIN12_CONFIG);
MAKE_PIN(P13, CORE_PIN13_PORTREG, CORE_PIN13_BIT, CORE_PIN13_CONFIG);
MAKE_PIN(P14, CORE_PIN14_PORTREG, CORE_PIN14_BIT, CORE_PIN14_CONFIG);
MAKE_PIN(P15, CORE_PIN15_PORTREG, CORE_PIN15_BIT, CORE_PIN15_CONFIG);
MAKE_PIN(P16, CORE_PIN16_PORTREG, CORE_PIN16_BIT, CORE_PIN16_CONFIG);
MAKE_PIN(P17, CORE_PIN17_PORTREG, CORE_PIN17_BIT, CORE_PIN17_CONFIG);
MAKE_PIN(P18, CORE_PIN18_PORTREG, CORE_PIN18_BIT, CORE_PIN18_CONFIG);
MAKE_PIN(P19, CORE_PIN19_PORTREG, CORE_PIN19_BIT, CORE_PIN19_CONFIG);
MAKE_PIN(P20, CORE_PIN20_PORTREG, CORE_PIN20_BIT, CORE_PIN20_CONFIG);
MAKE_PIN(P21, CORE_PIN21_PORTREG, CORE_PIN21_BIT, CORE_PIN21_CONFIG);
MAKE_PIN(P22, CORE_PIN22_PORTREG, CORE_PIN22_BIT, CORE_PIN22_CONFIG);
MAKE_PIN(P23, CORE_PIN23_PORTREG, CORE_PIN23_BIT, CORE_PIN23_CONFIG);
MAKE_PIN(P24, CORE_PIN24_PORTREG, CORE_PIN24_BIT, CORE_PIN24_CONFIG);
MAKE_PIN(P25, CORE_PIN25_PORTREG, CORE_PIN25_BIT, CORE_PIN25_CONFIG);
MAKE_PIN(P26, CORE_PIN26_PORTREG, CORE_PIN26_BIT, CORE_PIN26_CONFIG);
MAKE_PIN(P27, CORE_PIN27_PORTREG, CORE_PIN27_BIT, CORE_PIN27_CONFIG);
MAKE_PIN(P28, CORE_PIN28_PORTREG, CORE_PIN28_BIT, CORE_PIN28_CONFIG);
MAKE_PIN(P29, CORE_PIN29_PORTREG, CORE_PIN29_BIT, CORE_PIN29_CONFIG);
MAKE_PIN(P30, CORE_PIN30_PORTREG, CORE_PIN30_BIT, CORE_PIN30_CONFIG);
MAKE_PIN(P31, CORE_PIN31_PORTREG, CORE_PIN31_BIT, CORE_PIN31_CONFIG);
MAKE_PIN(P32, CORE_PIN32_PORTREG, CORE_PIN32_BIT, CORE_PIN32_CONFIG);
MAKE_PIN(P33, CORE_PIN33_PORTREG, CORE_PIN33_BIT, CORE_PIN33_CONFIG);
#undef MAKE_PIN
#endif // __arm__
#endif //_avrpins_h_ #endif //_avrpins_h_

View file

@ -83,9 +83,9 @@ void loop() {
} }
if(Wii.nunchuckConnected) { if(Wii.nunchuckConnected) {
Serial.print(F("\tNunchuck Pitch: ")); Serial.print(F("\tNunchuck Pitch: "));
Serial.print(Wii.nunchuckPitch); Serial.print(Wii.getNunchuckPitch());
Serial.print(F("\tNunchuck Roll: ")); Serial.print(F("\tNunchuck Roll: "));
Serial.print(Wii.nunchuckRoll); Serial.print(Wii.getNunchuckRoll());
} }
} }
} }

View file

@ -91,9 +91,9 @@ void loop() {
} }
if(Wii[i]->nunchuckConnected) { if(Wii[i]->nunchuckConnected) {
Serial.print(F("\tNunchuck Pitch: ")); Serial.print(F("\tNunchuck Pitch: "));
Serial.print(Wii[i]->nunchuckPitch); Serial.print(Wii[i]->getNunchuckPitch());
Serial.print(F("\tNunchuck Roll: ")); Serial.print(F("\tNunchuck Roll: "));
Serial.print(Wii[i]->nunchuckRoll); Serial.print(Wii[i]->getNunchuckRoll());
} }
} }
} }

View file

@ -1216,13 +1216,13 @@ void ReportDescParserBase::SetUsagePage(uint16_t page) {
pfUsage = NULL; pfUsage = NULL;
if (page > 0x00 && page < 0x11) if (page > 0x00 && page < 0x11)
pfUsage = /*(UsagePageFunc)pgm_read_word*/(usagePageFunctions[page - 1]); pfUsage = /*(UsagePageFunc)pgm_read_pointer*/(usagePageFunctions[page - 1]);
//else if (page > 0x7f && page < 0x84) //else if (page > 0x7f && page < 0x84)
// E_Notify(pstrUsagePageMonitor); // E_Notify(pstrUsagePageMonitor);
//else if (page > 0x83 && page < 0x8c) //else if (page > 0x83 && page < 0x8c)
// E_Notify(pstrUsagePagePower); // E_Notify(pstrUsagePagePower);
//else if (page > 0x8b && page < 0x92) //else if (page > 0x8b && page < 0x92)
// E_Notify((char*)pgm_read_word(&usagePageTitles1[page - 0x8c])); // E_Notify((char*)pgm_read_pointer(&usagePageTitles1[page - 0x8c]));
//else if (page > 0xfeff && page <= 0xffff) //else if (page > 0xfeff && page <= 0xffff)
// E_Notify(pstrUsagePageVendorDefined); // E_Notify(pstrUsagePageVendorDefined);
else else
@ -1240,13 +1240,13 @@ void ReportDescParserBase::PrintUsagePage(uint16_t page) {
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (page > 0x00 && page < 0x11) if (page > 0x00 && page < 0x11)
E_Notify((char*)pgm_read_word(&usagePageTitles0[page - 1]), 0x80); E_Notify((char*)pgm_read_pointer(&usagePageTitles0[page - 1]), 0x80);
else if (page > 0x7f && page < 0x84) else if (page > 0x7f && page < 0x84)
E_Notify(pstrUsagePageMonitor, 0x80); E_Notify(pstrUsagePageMonitor, 0x80);
else if (page > 0x83 && page < 0x8c) else if (page > 0x83 && page < 0x8c)
E_Notify(pstrUsagePagePower, 0x80); E_Notify(pstrUsagePagePower, 0x80);
else if (page > 0x8b && page < 0x92) else if (page > 0x8b && page < 0x92)
E_Notify((char*)pgm_read_word(&usagePageTitles1[page - 0x8c]), 0x80); E_Notify((char*)pgm_read_pointer(&usagePageTitles1[page - 0x8c]), 0x80);
else if (page > 0xfeff && page <= 0xffff) else if (page > 0xfeff && page <= 0xffff)
E_Notify(pstrUsagePageVendorDefined, 0x80); E_Notify(pstrUsagePageVendorDefined, 0x80);
else else
@ -1283,15 +1283,15 @@ void ReportDescParserBase::PrintGenericDesktopPageUsage(uint16_t usage) {
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x0a) if (usage > 0x00 && usage < 0x0a)
E_Notify((char*)pgm_read_word(&genDesktopTitles0[usage - 1]), 0x80); E_Notify((char*)pgm_read_pointer(&genDesktopTitles0[usage - 1]), 0x80);
else if (usage > 0x2f && usage < 0x49) else if (usage > 0x2f && usage < 0x49)
E_Notify((char*)pgm_read_word(&genDesktopTitles1[usage - 0x30]), 0x80); E_Notify((char*)pgm_read_pointer(&genDesktopTitles1[usage - 0x30]), 0x80);
else if (usage > 0x7f && usage < 0x94) else if (usage > 0x7f && usage < 0x94)
E_Notify((char*)pgm_read_word(&genDesktopTitles2[usage - 0x80]), 0x80); E_Notify((char*)pgm_read_pointer(&genDesktopTitles2[usage - 0x80]), 0x80);
else if (usage > 0x9f && usage < 0xa9) else if (usage > 0x9f && usage < 0xa9)
E_Notify((char*)pgm_read_word(&genDesktopTitles3[usage - 0xa0]), 0x80); E_Notify((char*)pgm_read_pointer(&genDesktopTitles3[usage - 0xa0]), 0x80);
else if (usage > 0xaf && usage < 0xb8) else if (usage > 0xaf && usage < 0xb8)
E_Notify((char*)pgm_read_word(&genDesktopTitles4[usage - 0xb0]), 0x80); E_Notify((char*)pgm_read_pointer(&genDesktopTitles4[usage - 0xb0]), 0x80);
else else
E_Notify(pstrUsagePageUndefined, 0x80); E_Notify(pstrUsagePageUndefined, 0x80);
} }
@ -1300,11 +1300,11 @@ void ReportDescParserBase::PrintSimulationControlsPageUsage(uint16_t usage) {
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x0d) if (usage > 0x00 && usage < 0x0d)
E_Notify((char*)pgm_read_word(&simuTitles0[usage - 1]), 0x80); E_Notify((char*)pgm_read_pointer(&simuTitles0[usage - 1]), 0x80);
else if (usage > 0x1f && usage < 0x26) else if (usage > 0x1f && usage < 0x26)
E_Notify((char*)pgm_read_word(&simuTitles1[usage - 0x20]), 0x80); E_Notify((char*)pgm_read_pointer(&simuTitles1[usage - 0x20]), 0x80);
else if (usage > 0xaf && usage < 0xd1) else if (usage > 0xaf && usage < 0xd1)
E_Notify((char*)pgm_read_word(&simuTitles2[usage - 0xb0]), 0x80); E_Notify((char*)pgm_read_pointer(&simuTitles2[usage - 0xb0]), 0x80);
else else
E_Notify(pstrUsagePageUndefined, 0x80); E_Notify(pstrUsagePageUndefined, 0x80);
} }
@ -1313,9 +1313,9 @@ void ReportDescParserBase::PrintVRControlsPageUsage(uint16_t usage) {
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x0b) if (usage > 0x00 && usage < 0x0b)
E_Notify((char*)pgm_read_word(&vrTitles0[usage - 1]), 0x80); E_Notify((char*)pgm_read_pointer(&vrTitles0[usage - 1]), 0x80);
else if (usage > 0x1f && usage < 0x22) else if (usage > 0x1f && usage < 0x22)
E_Notify((char*)pgm_read_word(&vrTitles1[usage - 0x20]), 0x80); E_Notify((char*)pgm_read_pointer(&vrTitles1[usage - 0x20]), 0x80);
else else
E_Notify(pstrUsagePageUndefined, 0x80); E_Notify(pstrUsagePageUndefined, 0x80);
} }
@ -1324,11 +1324,11 @@ void ReportDescParserBase::PrintSportsControlsPageUsage(uint16_t usage) {
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x05) if (usage > 0x00 && usage < 0x05)
E_Notify((char*)pgm_read_word(&sportsCtrlTitles0[usage - 1]), 0x80); E_Notify((char*)pgm_read_pointer(&sportsCtrlTitles0[usage - 1]), 0x80);
else if (usage > 0x2f && usage < 0x3a) else if (usage > 0x2f && usage < 0x3a)
E_Notify((char*)pgm_read_word(&sportsCtrlTitles1[usage - 0x30]), 0x80); E_Notify((char*)pgm_read_pointer(&sportsCtrlTitles1[usage - 0x30]), 0x80);
else if (usage > 0x4f && usage < 0x64) else if (usage > 0x4f && usage < 0x64)
E_Notify((char*)pgm_read_word(&sportsCtrlTitles2[usage - 0x50]), 0x80); E_Notify((char*)pgm_read_pointer(&sportsCtrlTitles2[usage - 0x50]), 0x80);
else else
E_Notify(pstrUsagePageUndefined, 0x80); E_Notify(pstrUsagePageUndefined, 0x80);
} }
@ -1337,9 +1337,9 @@ void ReportDescParserBase::PrintGameControlsPageUsage(uint16_t usage) {
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x04) if (usage > 0x00 && usage < 0x04)
E_Notify((char*)pgm_read_word(&gameTitles0[usage - 1]), 0x80); E_Notify((char*)pgm_read_pointer(&gameTitles0[usage - 1]), 0x80);
else if (usage > 0x1f && usage < 0x3a) else if (usage > 0x1f && usage < 0x3a)
E_Notify((char*)pgm_read_word(&gameTitles1[usage - 0x20]), 0x80); E_Notify((char*)pgm_read_pointer(&gameTitles1[usage - 0x20]), 0x80);
else else
E_Notify(pstrUsagePageUndefined, 0x80); E_Notify(pstrUsagePageUndefined, 0x80);
} }
@ -1348,7 +1348,7 @@ void ReportDescParserBase::PrintGenericDeviceControlsPageUsage(uint16_t usage) {
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x1f && usage < 0x27) if (usage > 0x1f && usage < 0x27)
E_Notify((char*)pgm_read_word(&genDevCtrlTitles[usage - 0x20]), 0x80); E_Notify((char*)pgm_read_pointer(&genDevCtrlTitles[usage - 0x20]), 0x80);
else else
E_Notify(pstrUsagePageUndefined, 0x80); E_Notify(pstrUsagePageUndefined, 0x80);
} }
@ -1357,7 +1357,7 @@ void ReportDescParserBase::PrintLEDPageUsage(uint16_t usage) {
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x4e) if (usage > 0x00 && usage < 0x4e)
E_Notify((char*)pgm_read_word(&ledTitles[usage - 1]), 0x80); E_Notify((char*)pgm_read_pointer(&ledTitles[usage - 1]), 0x80);
else else
E_Notify(pstrUsagePageUndefined, 0x80); E_Notify(pstrUsagePageUndefined, 0x80);
} }
@ -1366,17 +1366,17 @@ void ReportDescParserBase::PrintTelephonyPageUsage(uint16_t usage) {
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x08) if (usage > 0x00 && usage < 0x08)
E_Notify((char*)pgm_read_word(&telTitles0[usage - 1]), 0x80); E_Notify((char*)pgm_read_pointer(&telTitles0[usage - 1]), 0x80);
else if (usage > 0x1f && usage < 0x32) else if (usage > 0x1f && usage < 0x32)
E_Notify((char*)pgm_read_word(&telTitles1[usage - 0x1f]), 0x80); E_Notify((char*)pgm_read_pointer(&telTitles1[usage - 0x1f]), 0x80);
else if (usage > 0x4f && usage < 0x54) else if (usage > 0x4f && usage < 0x54)
E_Notify((char*)pgm_read_word(&telTitles2[usage - 0x4f]), 0x80); E_Notify((char*)pgm_read_pointer(&telTitles2[usage - 0x4f]), 0x80);
else if (usage > 0x6f && usage < 0x75) else if (usage > 0x6f && usage < 0x75)
E_Notify((char*)pgm_read_word(&telTitles3[usage - 0x6f]), 0x80); E_Notify((char*)pgm_read_pointer(&telTitles3[usage - 0x6f]), 0x80);
else if (usage > 0x8f && usage < 0x9f) else if (usage > 0x8f && usage < 0x9f)
E_Notify((char*)pgm_read_word(&telTitles4[usage - 0x8f]), 0x80); E_Notify((char*)pgm_read_pointer(&telTitles4[usage - 0x8f]), 0x80);
else if (usage > 0xaf && usage < 0xc0) else if (usage > 0xaf && usage < 0xc0)
E_Notify((char*)pgm_read_word(&telTitles5[usage - 0xaf]), 0x80); E_Notify((char*)pgm_read_pointer(&telTitles5[usage - 0xaf]), 0x80);
else else
E_Notify(pstrUsagePageUndefined, 0x80); E_Notify(pstrUsagePageUndefined, 0x80);
} }
@ -1385,35 +1385,35 @@ void ReportDescParserBase::PrintConsumerPageUsage(uint16_t usage) {
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x07) if (usage > 0x00 && usage < 0x07)
E_Notify((char*)pgm_read_word(&consTitles0[usage - 1]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitles0[usage - 1]), 0x80);
else if (usage > 0x1f && usage < 0x23) else if (usage > 0x1f && usage < 0x23)
E_Notify((char*)pgm_read_word(&consTitles1[usage - 0x1f]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitles1[usage - 0x1f]), 0x80);
else if (usage > 0x2f && usage < 0x37) else if (usage > 0x2f && usage < 0x37)
E_Notify((char*)pgm_read_word(&consTitles2[usage - 0x2f]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitles2[usage - 0x2f]), 0x80);
else if (usage > 0x3f && usage < 0x49) else if (usage > 0x3f && usage < 0x49)
E_Notify((char*)pgm_read_word(&consTitles3[usage - 0x3f]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitles3[usage - 0x3f]), 0x80);
else if (usage > 0x5f && usage < 0x67) else if (usage > 0x5f && usage < 0x67)
E_Notify((char*)pgm_read_word(&consTitles4[usage - 0x5f]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitles4[usage - 0x5f]), 0x80);
else if (usage > 0x7f && usage < 0xa5) else if (usage > 0x7f && usage < 0xa5)
E_Notify((char*)pgm_read_word(&consTitles5[usage - 0x7f]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitles5[usage - 0x7f]), 0x80);
else if (usage > 0xaf && usage < 0xcf) else if (usage > 0xaf && usage < 0xcf)
E_Notify((char*)pgm_read_word(&consTitles6[usage - 0xaf]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitles6[usage - 0xaf]), 0x80);
else if (usage > 0xdf && usage < 0xeb) else if (usage > 0xdf && usage < 0xeb)
E_Notify((char*)pgm_read_word(&consTitles7[usage - 0xdf]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitles7[usage - 0xdf]), 0x80);
else if (usage > 0xef && usage < 0xf6) else if (usage > 0xef && usage < 0xf6)
E_Notify((char*)pgm_read_word(&consTitles8[usage - 0xef]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitles8[usage - 0xef]), 0x80);
else if (usage > 0xff && usage < 0x10e) else if (usage > 0xff && usage < 0x10e)
E_Notify((char*)pgm_read_word(&consTitles9[usage - 0xff]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitles9[usage - 0xff]), 0x80);
else if (usage > 0x14f && usage < 0x156) else if (usage > 0x14f && usage < 0x156)
E_Notify((char*)pgm_read_word(&consTitlesA[usage - 0x14f]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitlesA[usage - 0x14f]), 0x80);
else if (usage > 0x15f && usage < 0x16b) else if (usage > 0x15f && usage < 0x16b)
E_Notify((char*)pgm_read_word(&consTitlesB[usage - 0x15f]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitlesB[usage - 0x15f]), 0x80);
else if (usage > 0x16f && usage < 0x175) else if (usage > 0x16f && usage < 0x175)
E_Notify((char*)pgm_read_word(&consTitlesC[usage - 0x16f]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitlesC[usage - 0x16f]), 0x80);
else if (usage > 0x17f && usage < 0x1c8) else if (usage > 0x17f && usage < 0x1c8)
E_Notify((char*)pgm_read_word(&consTitlesD[usage - 0x17f]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitlesD[usage - 0x17f]), 0x80);
else if (usage > 0x1ff && usage < 0x29d) else if (usage > 0x1ff && usage < 0x29d)
E_Notify((char*)pgm_read_word(&consTitlesE[usage - 0x1ff]), 0x80); E_Notify((char*)pgm_read_pointer(&consTitlesE[usage - 0x1ff]), 0x80);
else else
E_Notify(pstrUsagePageUndefined, 0x80); E_Notify(pstrUsagePageUndefined, 0x80);
} }
@ -1422,11 +1422,11 @@ void ReportDescParserBase::PrintDigitizerPageUsage(uint16_t usage) {
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x0e) if (usage > 0x00 && usage < 0x0e)
E_Notify((char*)pgm_read_word(&digitTitles0[usage - 1]), 0x80); E_Notify((char*)pgm_read_pointer(&digitTitles0[usage - 1]), 0x80);
else if (usage > 0x1f && usage < 0x23) else if (usage > 0x1f && usage < 0x23)
E_Notify((char*)pgm_read_word(&digitTitles1[usage - 0x1f]), 0x80); E_Notify((char*)pgm_read_pointer(&digitTitles1[usage - 0x1f]), 0x80);
else if (usage > 0x2f && usage < 0x47) else if (usage > 0x2f && usage < 0x47)
E_Notify((char*)pgm_read_word(&digitTitles2[usage - 0x2f]), 0x80); E_Notify((char*)pgm_read_pointer(&digitTitles2[usage - 0x2f]), 0x80);
else else
E_Notify(pstrUsagePageUndefined, 0x80); E_Notify(pstrUsagePageUndefined, 0x80);
} }
@ -1435,11 +1435,11 @@ void ReportDescParserBase::PrintAlphanumDisplayPageUsage(uint16_t usage) {
E_Notify(pstrSpace, 0x80); E_Notify(pstrSpace, 0x80);
if (usage > 0x00 && usage < 0x03) if (usage > 0x00 && usage < 0x03)
E_Notify((char*)pgm_read_word(&aplphanumTitles0[usage - 1]), 0x80); E_Notify((char*)pgm_read_pointer(&aplphanumTitles0[usage - 1]), 0x80);
else if (usage > 0x1f && usage < 0x4e) else if (usage > 0x1f && usage < 0x4e)
E_Notify((char*)pgm_read_word(&aplphanumTitles1[usage - 0x1f]), 0x80); E_Notify((char*)pgm_read_pointer(&aplphanumTitles1[usage - 0x1f]), 0x80);
else if (usage > 0x7f && usage < 0x96) else if (usage > 0x7f && usage < 0x96)
E_Notify((char*)pgm_read_word(&digitTitles2[usage - 0x80]), 0x80); E_Notify((char*)pgm_read_pointer(&digitTitles2[usage - 0x80]), 0x80);
else else
E_Notify(pstrUsagePageUndefined, 0x80); E_Notify(pstrUsagePageUndefined, 0x80);
} }
@ -1450,17 +1450,17 @@ void ReportDescParserBase::PrintMedicalInstrumentPageUsage(uint16_t usage) {
if (usage == 1) if (usage == 1)
E_Notify(pstrUsageMedicalUltrasound, 0x80); E_Notify(pstrUsageMedicalUltrasound, 0x80);
else if (usage > 0x1f && usage < 0x28) else if (usage > 0x1f && usage < 0x28)
E_Notify((char*)pgm_read_word(&medInstrTitles0[usage - 0x1f]), 0x80); E_Notify((char*)pgm_read_pointer(&medInstrTitles0[usage - 0x1f]), 0x80);
else if (usage > 0x3f && usage < 0x45) else if (usage > 0x3f && usage < 0x45)
E_Notify((char*)pgm_read_word(&medInstrTitles1[usage - 0x40]), 0x80); E_Notify((char*)pgm_read_pointer(&medInstrTitles1[usage - 0x40]), 0x80);
else if (usage > 0x5f && usage < 0x62) else if (usage > 0x5f && usage < 0x62)
E_Notify((char*)pgm_read_word(&medInstrTitles2[usage - 0x60]), 0x80); E_Notify((char*)pgm_read_pointer(&medInstrTitles2[usage - 0x60]), 0x80);
else if (usage == 0x70) else if (usage == 0x70)
E_Notify(pstrUsageDepthGainCompensation, 0x80); E_Notify(pstrUsageDepthGainCompensation, 0x80);
else if (usage > 0x7f && usage < 0x8a) else if (usage > 0x7f && usage < 0x8a)
E_Notify((char*)pgm_read_word(&medInstrTitles3[usage - 0x80]), 0x80); E_Notify((char*)pgm_read_pointer(&medInstrTitles3[usage - 0x80]), 0x80);
else if (usage > 0x9f && usage < 0xa2) else if (usage > 0x9f && usage < 0xa2)
E_Notify((char*)pgm_read_word(&medInstrTitles4[usage - 0xa0]), 0x80); E_Notify((char*)pgm_read_pointer(&medInstrTitles4[usage - 0xa0]), 0x80);
else else
E_Notify(pstrUsagePageUndefined, 0x80); E_Notify(pstrUsagePageUndefined, 0x80);
} }

View file

@ -245,6 +245,10 @@ setRumbleToggle KEYWORD2
getPitch KEYWORD2 getPitch KEYWORD2
getRoll KEYWORD2 getRoll KEYWORD2
getYaw KEYWORD2 getYaw KEYWORD2
getWiimotePitch KEYWORD2
getWiimoteRoll KEYWORD2
getNunchuckPitch KEYWORD2
getNunchuckRoll KEYWORD2
PAIR KEYWORD2 PAIR KEYWORD2
statusRequest KEYWORD2 statusRequest KEYWORD2
getBatteryLevel KEYWORD2 getBatteryLevel KEYWORD2
@ -267,8 +271,6 @@ ZL LITERAL1
ZR LITERAL1 ZR LITERAL1
HatX LITERAL1 HatX LITERAL1
HatY LITERAL1 HatY LITERAL1
nunchuckPitch LITERAL1
nunchuckRoll LITERAL1
#################################################### ####################################################
# Methods and Functions for the IR Camera # Methods and Functions for the IR Camera

View file

@ -14,6 +14,7 @@ Circuits At Home, LTD
Web : http://www.circuitsathome.com Web : http://www.circuitsathome.com
e-mail : support@circuitsathome.com e-mail : support@circuitsathome.com
*/ */
#if !defined(_usb_h_) || defined(__PARSETOOLS_H__) #if !defined(_usb_h_) || defined(__PARSETOOLS_H__)
#error "Never include parsetools.h directly; include Usb.h instead" #error "Never include parsetools.h directly; include Usb.h instead"
#else #else

View file

@ -44,12 +44,14 @@ public:
/* SPI pin definitions. see avrpins.h */ /* SPI pin definitions. see avrpins.h */
#if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__) || defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) #if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__) || defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
typedef SPi< Pb1, Pb2, Pb3, Pb0 > spi; typedef SPi< Pb1, Pb2, Pb3, Pb0 > spi;
#endif #elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
typedef SPi< Pb5, Pb3, Pb4, Pb2 > spi; typedef SPi< Pb5, Pb3, Pb4, Pb2 > spi;
#endif #elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)
#if defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)
typedef SPi< Pb7, Pb5, Pb6, Pb4 > spi; typedef SPi< Pb7, Pb5, Pb6, Pb4 > spi;
#elif defined(__MK20DX128__)
typedef SPi< P13, P11, P12, P10 > spi;
#else
#error "No SPI entry in usbhost.h"
#endif #endif
typedef enum { typedef enum {
@ -93,10 +95,9 @@ template< typename SS, typename INTR >
MAX3421e< SS, INTR >::MAX3421e() { MAX3421e< SS, INTR >::MAX3421e() {
// Leaving ADK hardware setup in here, for now. This really belongs with the other parts. // Leaving ADK hardware setup in here, for now. This really belongs with the other parts.
#ifdef BOARD_MEGA_ADK #ifdef BOARD_MEGA_ADK
/* For Mega ADK, which has Max3421e on-board, set MAX_RESET to Output mode, and pull Reset to HIGH */ // For Mega ADK, which has a Max3421e on-board, set MAX_RESET to output mode, and then set it to HIGH
DDRJ |= _BV(PJ2); P55::SetDirWrite();
PORTJ &= ~_BV(PJ2); P55::Set();
PORTJ |= _BV(PJ2);
#endif #endif
}; };