Fixed conflict with PS3Enums.h

This commit is contained in:
Kristian Sloth Lauszus 2013-02-17 18:12:05 +01:00
parent a80bc9aa0b
commit 34de3a4315
3 changed files with 10 additions and 10 deletions

View file

@ -381,7 +381,7 @@ uint8_t XBOXRECV::getButtonPress(uint8_t controller, Button b) {
return (uint8_t)(ButtonState[controller] >> 8); return (uint8_t)(ButtonState[controller] >> 8);
else if(b == R2) else if(b == R2)
return (uint8_t)ButtonState[controller]; return (uint8_t)ButtonState[controller];
return (ButtonState[controller] & ((uint32_t)pgm_read_word(&BUTTONS[(uint8_t)b]) << 16)); return (ButtonState[controller] & ((uint32_t)pgm_read_word(&XBOXBUTTONS[(uint8_t)b]) << 16));
} }
bool XBOXRECV::getButtonClick(uint8_t controller, Button b) { bool XBOXRECV::getButtonClick(uint8_t controller, Button b) {
if(b == L2) { if(b == L2) {
@ -398,7 +398,7 @@ bool XBOXRECV::getButtonClick(uint8_t controller, Button b) {
} }
return false; return false;
} }
uint16_t button = pgm_read_word(&BUTTONS[(uint8_t)b]); uint16_t button = pgm_read_word(&XBOXBUTTONS[(uint8_t)b]);
bool click = (ButtonClickState[controller] & button); bool click = (ButtonClickState[controller] & button);
ButtonClickState[controller] &= ~button; // clear "click" event ButtonClickState[controller] &= ~button; // clear "click" event
return click; return click;
@ -462,10 +462,10 @@ void XBOXRECV::setLedRaw(uint8_t controller, uint8_t value) {
} }
void XBOXRECV::setLedOn(uint8_t controller, LED led) { void XBOXRECV::setLedOn(uint8_t controller, LED led) {
if(led != ALL) // All LEDs can't be on a the same time if(led != ALL) // All LEDs can't be on a the same time
setLedRaw(controller,(pgm_read_byte(&LEDS[(uint8_t)led]))+4); setLedRaw(controller,(pgm_read_byte(&XBOXLEDS[(uint8_t)led]))+4);
} }
void XBOXRECV::setLedBlink(uint8_t controller, LED led) { void XBOXRECV::setLedBlink(uint8_t controller, LED led) {
setLedRaw(controller,pgm_read_byte(&LEDS[(uint8_t)led])); setLedRaw(controller,pgm_read_byte(&XBOXLEDS[(uint8_t)led]));
} }
void XBOXRECV::setLedMode(uint8_t controller, LEDMode ledMode) { // This function is used to do some speciel LED stuff the controller supports void XBOXRECV::setLedMode(uint8_t controller, LEDMode ledMode) { // This function is used to do some speciel LED stuff the controller supports
setLedRaw(controller,(uint8_t)ledMode); setLedRaw(controller,(uint8_t)ledMode);

View file

@ -280,7 +280,7 @@ uint8_t XBOXUSB::getButtonPress(Button b) {
return (uint8_t)(ButtonState >> 8); return (uint8_t)(ButtonState >> 8);
else if(b == R2) else if(b == R2)
return (uint8_t)ButtonState; return (uint8_t)ButtonState;
return (ButtonState & ((uint32_t)pgm_read_word(&BUTTONS[(uint8_t)b]) << 16)); return (ButtonState & ((uint32_t)pgm_read_word(&XBOXBUTTONS[(uint8_t)b]) << 16));
} }
bool XBOXUSB::getButtonClick(Button b) { bool XBOXUSB::getButtonClick(Button b) {
if(b == L2) { if(b == L2) {
@ -297,7 +297,7 @@ bool XBOXUSB::getButtonClick(Button b) {
} }
return false; return false;
} }
uint16_t button = pgm_read_word(&BUTTONS[(uint8_t)b]); uint16_t button = pgm_read_word(&XBOXBUTTONS[(uint8_t)b]);
bool click = (ButtonClickState & button); bool click = (ButtonClickState & button);
ButtonClickState &= ~button; // clear "click" event ButtonClickState &= ~button; // clear "click" event
return click; return click;
@ -320,10 +320,10 @@ void XBOXUSB::setLedRaw(uint8_t value) {
} }
void XBOXUSB::setLedOn(LED led) { void XBOXUSB::setLedOn(LED led) {
if(led != ALL) // All LEDs can't be on a the same time if(led != ALL) // All LEDs can't be on a the same time
setLedRaw((pgm_read_byte(&LEDS[(uint8_t)led]))+4); setLedRaw((pgm_read_byte(&XBOXLEDS[(uint8_t)led]))+4);
} }
void XBOXUSB::setLedBlink(LED led) { void XBOXUSB::setLedBlink(LED led) {
setLedRaw(pgm_read_byte(&LEDS[(uint8_t)led])); setLedRaw(pgm_read_byte(&XBOXLEDS[(uint8_t)led]));
} }
void XBOXUSB::setLedMode(LEDMode ledMode) { // This function is used to do some speciel LED stuff the controller supports void XBOXUSB::setLedMode(LEDMode ledMode) { // This function is used to do some speciel LED stuff the controller supports
setLedRaw((uint8_t)ledMode); setLedRaw((uint8_t)ledMode);

View file

@ -29,7 +29,7 @@ enum LEDMode {
}; };
/** Used to set the LEDs on the controllers */ /** Used to set the LEDs on the controllers */
const uint8_t LEDS[] PROGMEM = { const uint8_t XBOXLEDS[] PROGMEM = {
0x02, // LED1 0x02, // LED1
0x03, // LED2 0x03, // LED2
0x04, // LED3 0x04, // LED3
@ -37,7 +37,7 @@ const uint8_t LEDS[] PROGMEM = {
0x01 // ALL - Used to blink all LEDs 0x01 // ALL - Used to blink all LEDs
}; };
/** Buttons on the controllers */ /** Buttons on the controllers */
const uint16_t BUTTONS[] PROGMEM = { const uint16_t XBOXBUTTONS[] PROGMEM = {
0x0100, // UP 0x0100, // UP
0x0800, // RIGHT 0x0800, // RIGHT
0x0200, // DOWN 0x0200, // DOWN