mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Updated some variables names and updated some debug messages
This commit is contained in:
parent
7334f7e9a4
commit
9426e4192d
2 changed files with 9 additions and 8 deletions
15
Wii.cpp
15
Wii.cpp
|
@ -264,7 +264,7 @@ void WII::ACLData(uint8_t* l2capinbuf) {
|
||||||
else if(wiiUProControllerConnected)
|
else if(wiiUProControllerConnected)
|
||||||
ButtonState = (uint32_t)(((~l2capinbuf[23]) & 0xFE) | ((uint16_t)(~l2capinbuf[24]) << 8) | ((uint32_t)((~l2capinbuf[25]) & 0x03) << 16));
|
ButtonState = (uint32_t)(((~l2capinbuf[23]) & 0xFE) | ((uint16_t)(~l2capinbuf[24]) << 8) | ((uint32_t)((~l2capinbuf[25]) & 0x03) << 16));
|
||||||
else if(motionPlusConnected) {
|
else if(motionPlusConnected) {
|
||||||
if(l2capinbuf[20] & 0x02) // Only update the wiimote buttons, since the extension bytes are from the Motion Plus
|
if(l2capinbuf[20] & 0x02) // Only update the Wiimote buttons, since the extension bytes are from the Motion Plus
|
||||||
ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)(ButtonState & 0xFFFF0000)));
|
ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)(ButtonState & 0xFFFF0000)));
|
||||||
else if(nunchuckConnected) // Update if it's a report from the Nunchuck
|
else if(nunchuckConnected) // Update if it's a report from the Nunchuck
|
||||||
ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)((~l2capinbuf[20]) & 0x0C) << 14));
|
ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)((~l2capinbuf[20]) & 0x0C) << 14));
|
||||||
|
@ -332,10 +332,11 @@ void WII::ACLData(uint8_t* l2capinbuf) {
|
||||||
setReportMode(false, 0x31); // If there is no extension connected we will read the buttons and accelerometer
|
setReportMode(false, 0x31); // If there is no extension connected we will read the buttons and accelerometer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef EXTRADEBUG
|
||||||
else
|
else
|
||||||
Notify(PSTR("\r\nChecking battery level"), 0x80);
|
Notify(PSTR("\r\nChecking battery level"), 0x80);
|
||||||
|
#endif
|
||||||
|
#ifdef DEBUG_USB_HOST
|
||||||
if(l2capinbuf[12] & 0x01)
|
if(l2capinbuf[12] & 0x01)
|
||||||
Notify(PSTR("\r\nWARNING: Battery is nearly empty"), 0x80);
|
Notify(PSTR("\r\nWARNING: Battery is nearly empty"), 0x80);
|
||||||
#endif
|
#endif
|
||||||
|
@ -405,7 +406,7 @@ void WII::ACLData(uint8_t* l2capinbuf) {
|
||||||
for(uint8_t j = 0; j < 4; j++)
|
for(uint8_t j = 0; j < 4; j++)
|
||||||
wiiBalanceBoardCal[2][j] = l2capinbuf[16 + 2 * j] | l2capinbuf[15 + 2 * j] << 8;
|
wiiBalanceBoardCal[2][j] = l2capinbuf[16 + 2 * j] | l2capinbuf[15 + 2 * j] << 8;
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef DEBUG_USB_HOST
|
||||||
Notify(PSTR("\r\nWii Balance Board calibrated successfully"), 0x80);
|
Notify(PSTR("\r\nWii Balance Board calibration values read successfully"), 0x80);
|
||||||
#endif
|
#endif
|
||||||
wiiBalanceBoardCalibrationComplete = true;
|
wiiBalanceBoardCalibrationComplete = true;
|
||||||
}
|
}
|
||||||
|
@ -793,9 +794,9 @@ void WII::Run() {
|
||||||
} else if(stateCounter == 400) {
|
} else if(stateCounter == 400) {
|
||||||
if(wiiBalanceBoardConnected) {
|
if(wiiBalanceBoardConnected) {
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef DEBUG_USB_HOST
|
||||||
Notify(PSTR("\r\nCalibrating Wii Balance Board"), 0x80);
|
Notify(PSTR("\r\nReading Wii Balance Board calibration values"), 0x80);
|
||||||
#endif
|
#endif
|
||||||
calibrateWiiBalanceBoard();
|
readWiiBalanceBoardCalibration();
|
||||||
} else
|
} else
|
||||||
stateCounter = 499;
|
stateCounter = 499;
|
||||||
} else if(stateCounter == 500) {
|
} else if(stateCounter == 500) {
|
||||||
|
@ -1071,7 +1072,7 @@ void WII::checkMotionPresent() {
|
||||||
readData(0xA600FA, 6, false);
|
readData(0xA600FA, 6, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WII::calibrateWiiBalanceBoard() {
|
void WII::readWiiBalanceBoardCalibration() {
|
||||||
readData(0xA40024, 24, false);
|
readData(0xA40024, 24, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
Wii.h
2
Wii.h
|
@ -475,11 +475,11 @@ private:
|
||||||
void readData(uint32_t offset, uint16_t size, bool EEPROM);
|
void readData(uint32_t offset, uint16_t size, bool EEPROM);
|
||||||
void readExtensionType();
|
void readExtensionType();
|
||||||
void readCalData();
|
void readCalData();
|
||||||
|
void readWiiBalanceBoardCalibration(); // Used by the library to read the Wii Balance Board calibration values
|
||||||
|
|
||||||
void checkMotionPresent(); // Used to see if a Motion Plus is connected to the Wiimote
|
void checkMotionPresent(); // Used to see if a Motion Plus is connected to the Wiimote
|
||||||
void initMotionPlus();
|
void initMotionPlus();
|
||||||
void activateMotionPlus();
|
void activateMotionPlus();
|
||||||
void calibrateWiiBalanceBoard();
|
|
||||||
|
|
||||||
uint16_t wiiBalanceBoardRaw[4]; // Wii Balance Board raw values
|
uint16_t wiiBalanceBoardRaw[4]; // Wii Balance Board raw values
|
||||||
uint16_t wiiBalanceBoardCal[3][4]; // Wii Balance Board calibration values
|
uint16_t wiiBalanceBoardCal[3][4]; // Wii Balance Board calibration values
|
||||||
|
|
Loading…
Reference in a new issue