mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Print raw Wii Balance Board values in example
This commit is contained in:
parent
03e0ec5d6d
commit
e555195e42
3 changed files with 21 additions and 26 deletions
33
Wii.cpp
33
Wii.cpp
|
@ -421,32 +421,13 @@ void WII::ACLData(uint8_t* l2capinbuf) {
|
||||||
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
|
||||||
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
|
||||||
#if 1
|
// See: http://wiibrew.org/wiki/Wii_Balance_Board#Data_Format
|
||||||
uint16_t length = ((uint16_t)l2capinbuf[5] << 8 | l2capinbuf[4]);
|
topRight = l2capinbuf[13] | l2capinbuf[12] << 8;
|
||||||
Notify(PSTR("\r\nLength: "), 0x80);
|
botRight = l2capinbuf[15] | l2capinbuf[14] << 8;
|
||||||
D_PrintHex<uint16_t > (length - 2, 0x80);
|
topLeft = l2capinbuf[17] | l2capinbuf[16] << 8;
|
||||||
Notify(PSTR("\tData: "), 0x80);
|
botleft = l2capinbuf[19] | l2capinbuf[18] << 8;
|
||||||
for(uint8_t i = 0; i < length - 2; i++) {
|
break;
|
||||||
D_PrintHex<uint8_t > (l2capinbuf[10 + i], 0x80);
|
|
||||||
Notify(PSTR(" "), 0x80);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t topRight = (l2capinbuf[13] | l2capinbuf[12] << 8);
|
|
||||||
uint16_t botRight = (l2capinbuf[15] | l2capinbuf[14] << 8);
|
|
||||||
uint16_t topLeft = (l2capinbuf[17] | l2capinbuf[16] << 8);
|
|
||||||
uint16_t botleft = (l2capinbuf[19] | l2capinbuf[18] << 8);
|
|
||||||
|
|
||||||
Notify(PSTR("\ttopRight: "), 0x80);
|
|
||||||
Serial.print(topRight);
|
|
||||||
Notify(PSTR("\tbotRight: "), 0x80);
|
|
||||||
Serial.print(botRight);
|
|
||||||
Notify(PSTR("\ttopLeft: "), 0x80);
|
|
||||||
Serial.print(topLeft);
|
|
||||||
Notify(PSTR("\tbotleft: "), 0x80);
|
|
||||||
Serial.print(botleft);
|
|
||||||
#endif
|
|
||||||
} 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
|
||||||
#ifdef WIICAMERA
|
#ifdef WIICAMERA
|
||||||
// Read the IR data
|
// Read the IR data
|
||||||
|
|
5
Wii.h
5
Wii.h
|
@ -263,6 +263,11 @@ public:
|
||||||
int16_t gyroPitchZero;
|
int16_t gyroPitchZero;
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
|
/**@{*/
|
||||||
|
/** Wii Balance Board raw values. */
|
||||||
|
uint16_t topRight, botRight, topLeft, botleft;
|
||||||
|
/**@}*/
|
||||||
|
|
||||||
#ifdef WIICAMERA
|
#ifdef WIICAMERA
|
||||||
/** @name Wiimote IR camera functions
|
/** @name Wiimote IR camera functions
|
||||||
* You will have to set ::ENABLE_WII_IR_CAMERA in settings.h to 1 in order use the IR camera.
|
* You will have to set ::ENABLE_WII_IR_CAMERA in settings.h to 1 in order use the IR camera.
|
||||||
|
|
|
@ -35,6 +35,15 @@ void setup() {
|
||||||
void loop() {
|
void loop() {
|
||||||
Usb.Task();
|
Usb.Task();
|
||||||
if (Wii.wiiBalanceBoardConnected) {
|
if (Wii.wiiBalanceBoardConnected) {
|
||||||
|
Serial.print(F("\r\ntopRight: "));
|
||||||
|
Serial.print(Wii.topRight);
|
||||||
|
Serial.print(F("\tbotRight: "));
|
||||||
|
Serial.print(Wii.botRight);
|
||||||
|
Serial.print(F("\ttopLeft: "));
|
||||||
|
Serial.print(Wii.topLeft);
|
||||||
|
Serial.print(F("\tbotleft: "));
|
||||||
|
Serial.print(Wii.botleft);
|
||||||
|
|
||||||
if (Wii.getButtonClick(A)) {
|
if (Wii.getButtonClick(A)) {
|
||||||
Serial.print(F("\r\nA"));
|
Serial.print(F("\r\nA"));
|
||||||
Wii.setLedToggle(LED1);
|
Wii.setLedToggle(LED1);
|
||||||
|
|
Loading…
Reference in a new issue