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

This commit is contained in:
Andrew J. Kroll 2013-03-30 11:55:55 -04:00
commit 4b43ac4968
4 changed files with 7 additions and 7 deletions

6
Wii.h
View file

@ -204,6 +204,10 @@ public:
*/
void setLedStatus();
/**
* Call this to update battery level and Wiimote state
*/
void statusRequest();
/**
* Return the battery level of the Wiimote.
* @return The battery level in the range 0-255.
@ -211,7 +215,6 @@ public:
uint8_t getBatteryLevel() {
return batteryLevel;
};
/**
* Return the Wiimote state.
* @return See: http://wiibrew.org/wiki/Wiimote#0x20:_Status.
@ -438,7 +441,6 @@ private:
/* HID Commands */
void HID_Command(uint8_t* data, uint8_t nbytes);
void setReportMode(bool continuous, uint8_t mode);
void statusRequest();
void writeData(uint32_t offset, uint8_t size, uint8_t* data);
void initExtension1();

View file

@ -439,10 +439,7 @@ ControllerStatus Breakdown
ControllerStatus[controller] & 0x8000 // 0
*/
uint8_t XBOXRECV::getBatteryLevel(uint8_t controller) {
uint8_t batteryLevel = ((controllerStatus[controller] & 0x00C0) >> 6) * 33;
if (batteryLevel == 99)
batteryLevel = 100;
return batteryLevel;
return ((controllerStatus[controller] & 0x00C0) >> 6);
}
void XBOXRECV::XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes) {

View file

@ -191,7 +191,7 @@ public:
/**
* Used to get the battery level from the controller.
* @param controller The controller to read from.
* @return Returns the battery level in percentage in 33% steps.
* @return Returns the battery level as an integer in the range of 0-3.
*/
uint8_t getBatteryLevel(uint8_t controller);
/**

View file

@ -238,6 +238,7 @@ getPitch KEYWORD2
getRoll KEYWORD2
getYaw KEYWORD2
PAIR KEYWORD2
statusRequest KEYWORD2
getBatteryLevel KEYWORD2
getWiiState KEYWORD2