Exclude specific enum defines and cast

The unscoped Enum for the Controller LEDs is colliding
with changes in the recent RedBearLab nRF51288 SDK, specifically
the PinName enum in the mbed.h header file.
As a simple RBL/mBed specific work-around we are now casting
the LED enums into the USBH LEDEnum enum.

This will potentially break support for controllers on RBL,
but restore the ability to compile the project.
This commit is contained in:
Matt Sieren 2016-03-18 22:40:10 +01:00
parent f90ba2c16d
commit 51cb078fa0
5 changed files with 9 additions and 8 deletions

View file

@ -629,6 +629,6 @@ void PS3BT::onInit() {
if(PS3MoveConnected) if(PS3MoveConnected)
moveSetBulb(Red); moveSetBulb(Red);
else // Dualshock 3 or Navigation controller else // Dualshock 3 or Navigation controller
setLedOn(LED1); setLedOn(static_cast<LEDEnum>(LED1));
} }
} }

View file

@ -566,6 +566,6 @@ void PS3USB::onInit() {
if(PS3MoveConnected) if(PS3MoveConnected)
moveSetBulb(Red); moveSetBulb(Red);
else // Dualshock 3 or Navigation controller else // Dualshock 3 or Navigation controller
setLedOn(LED1); setLedOn(static_cast<LEDEnum>(LED1));
} }
} }

View file

@ -572,13 +572,13 @@ void XBOXRECV::onInit(uint8_t controller) {
else { else {
LEDEnum led; LEDEnum led;
if(controller == 0) if(controller == 0)
led = LED1; led = static_cast<LEDEnum>(LED1);
else if(controller == 1) else if(controller == 1)
led = LED2; led = static_cast<LEDEnum>(LED2);
else if(controller == 2) else if(controller == 2)
led = LED3; led = static_cast<LEDEnum>(LED3);
else else
led = LED4; led = static_cast<LEDEnum>(LED4);
setLedOn(led, controller); setLedOn(led, controller);
} }
} }

View file

@ -358,5 +358,5 @@ void XBOXUSB::onInit() {
if(pFuncOnInit) if(pFuncOnInit)
pFuncOnInit(); // Call the user function pFuncOnInit(); // Call the user function
else else
setLedOn(LED1); setLedOn(static_cast<LEDEnum>(LED1));
} }

View file

@ -26,11 +26,12 @@
/** Enum used to turn on the LEDs on the different controllers. */ /** Enum used to turn on the LEDs on the different controllers. */
enum LEDEnum { enum LEDEnum {
OFF = 0, OFF = 0,
#ifndef RBL_NRF51822
LED1 = 1, LED1 = 1,
LED2 = 2, LED2 = 2,
LED3 = 3, LED3 = 3,
LED4 = 4, LED4 = 4,
#endif
LED5 = 5, LED5 = 5,
LED6 = 6, LED6 = 6,
LED7 = 7, LED7 = 7,