From 51cb078fa0579c5afa78c64159d8c55e0d39360f Mon Sep 17 00:00:00 2001 From: Matt Sieren Date: Fri, 18 Mar 2016 22:40:10 +0100 Subject: [PATCH 1/3] 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. --- PS3BT.cpp | 2 +- PS3USB.cpp | 2 +- XBOXRECV.cpp | 8 ++++---- XBOXUSB.cpp | 2 +- controllerEnums.h | 3 ++- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/PS3BT.cpp b/PS3BT.cpp index ab5a8ed5..f534ad7b 100644 --- a/PS3BT.cpp +++ b/PS3BT.cpp @@ -629,6 +629,6 @@ void PS3BT::onInit() { if(PS3MoveConnected) moveSetBulb(Red); else // Dualshock 3 or Navigation controller - setLedOn(LED1); + setLedOn(static_cast(LED1)); } } diff --git a/PS3USB.cpp b/PS3USB.cpp index f247cc91..18b881ca 100755 --- a/PS3USB.cpp +++ b/PS3USB.cpp @@ -566,6 +566,6 @@ void PS3USB::onInit() { if(PS3MoveConnected) moveSetBulb(Red); else // Dualshock 3 or Navigation controller - setLedOn(LED1); + setLedOn(static_cast(LED1)); } } diff --git a/XBOXRECV.cpp b/XBOXRECV.cpp index 39e14ef8..7431fa43 100644 --- a/XBOXRECV.cpp +++ b/XBOXRECV.cpp @@ -572,13 +572,13 @@ void XBOXRECV::onInit(uint8_t controller) { else { LEDEnum led; if(controller == 0) - led = LED1; + led = static_cast(LED1); else if(controller == 1) - led = LED2; + led = static_cast(LED2); else if(controller == 2) - led = LED3; + led = static_cast(LED3); else - led = LED4; + led = static_cast(LED4); setLedOn(led, controller); } } diff --git a/XBOXUSB.cpp b/XBOXUSB.cpp index ce69f82b..6799029d 100644 --- a/XBOXUSB.cpp +++ b/XBOXUSB.cpp @@ -358,5 +358,5 @@ void XBOXUSB::onInit() { if(pFuncOnInit) pFuncOnInit(); // Call the user function else - setLedOn(LED1); + setLedOn(static_cast(LED1)); } diff --git a/controllerEnums.h b/controllerEnums.h index 47fd975e..e51f15ca 100644 --- a/controllerEnums.h +++ b/controllerEnums.h @@ -26,11 +26,12 @@ /** Enum used to turn on the LEDs on the different controllers. */ enum LEDEnum { OFF = 0, +#ifndef RBL_NRF51822 LED1 = 1, LED2 = 2, LED3 = 3, LED4 = 4, - +#endif LED5 = 5, LED6 = 6, LED7 = 7, From 9b829e28b49ebe2c772b72793ce78f3cc18aed7f Mon Sep 17 00:00:00 2001 From: Matt Sieren Date: Sat, 16 Jan 2016 19:33:46 +0100 Subject: [PATCH 2/3] Print::write not on RBL It seems like this functionality got removed in the RBL SDK. Add condition for compiler target.. --- SPP.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SPP.h b/SPP.h index 233ac611..bb3027b4 100644 --- a/SPP.h +++ b/SPP.h @@ -120,7 +120,9 @@ public: */ size_t write(const uint8_t* data, size_t size); /** Pull in write(const char *str) from Print */ +#if !defined(RBL_NRF51822) using Print::write; +#endif #else /** * Writes the byte to send to a buffer. The message is send when either send() or after Usb.Task() is called. From 209e73bd72d84e178a26fd00bbdc22dc0a6b15d9 Mon Sep 17 00:00:00 2001 From: Matt Sieren Date: Fri, 26 Feb 2016 11:41:18 +0100 Subject: [PATCH 3/3] Add RBL SDK (S130) Headers Add the new SPI Headers and re-direct to the new SPI Interface. --- settings.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/settings.h b/settings.h index 6c1979af..97b46a0b 100644 --- a/settings.h +++ b/settings.h @@ -135,8 +135,13 @@ e-mail : support@circuitsathome.com #define USING_SPI4TEENSY3 0 #endif -#if ((defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)) || defined(RBL_NRF51822) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3 -#include // Use the Arduino SPI library for the Arduino Due, RedBearLab nRF51822, Intel Galileo 1 & 2, Intel Edison or if the SPI library with transaction is available +#if ((defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3 +#include // Use the Arduino SPI library for the Arduino Due, Intel Galileo 1 & 2, Intel Edison or if the SPI library with transaction is available +#endif +#ifdef RBL_NRF51822 +#include +#include +#define SPI SPI_Master #endif #if defined(__PIC32MX__) || defined(__PIC32MZ__) #include <../../../../hardware/pic32/libraries/SPI/SPI.h> // Hack to use the SPI library