Skip to content

Commit

Permalink
[RP2XXX] build MBED target with ArduinoBLE
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Aug 14, 2024
1 parent 2b390d8 commit c476e73
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
'rp2040:rp2040:generic',
'rp2040:rp2040:rpipicow',
'arduino:mbed_rp2040:pico',
#'arduino:mbed_nano:nanorp2040connect',
'SiliconLabs:silabs:nano_matter:protocol_stack=ble_arduino',
'WCH:ch32v:CH32V30x_EVT'
]
Expand Down Expand Up @@ -397,9 +398,9 @@ jobs:
fi
if [[ "$BOARD" =~ "arduino:mbed_rp2040:" ]]; then
arduino --pref "boardsmanager.additional.urls=https://downloads.arduino.cc/packages/package_index.json" --save-prefs ;
arduino --install-boards arduino:mbed_rp2040:4.1.1 ;
arduino --install-boards arduino:mbed_rp2040:4.1.5 ;
arduino --board $BOARD --save-prefs ;
cd $HOME/.arduino15/packages/arduino/hardware/mbed_rp2040/4.1.1/variants/RASPBERRY_PI_PICO ;
cd $HOME/.arduino15/packages/arduino/hardware/mbed_rp2040/4.1.5/variants/RASPBERRY_PI_PICO ;
sed -i '62 a // Serial2' ${PINS_ARDUINO} ;
sed -i '63 a #define PIN_SERIAL2_TX (4ul)' ${PINS_ARDUINO} ;
sed -i '64 a #define PIN_SERIAL2_RX (5ul)' ${PINS_ARDUINO} ;
Expand Down
8 changes: 7 additions & 1 deletion software/firmware/source/SoftRF/src/driver/Bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ enum
#if defined(USE_ARDUINOBLE)
#include "../platform/bluetooth/ArduinoBLE.h"
#endif /* USE_ARDUINOBLE */
#elif defined(ARDUINO_ARCH_RP2040) && defined(ARDUINO_RASPBERRY_PI_PICO_W)
#elif defined(ARDUINO_ARCH_RP2040)
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
#include "../platform/bluetooth/BTstack.h"
#elif defined(ARDUINO_NANO_RP2040_CONNECT)
#if defined(USE_ARDUINOBLE)
#include "../platform/bluetooth/ArduinoBLE.h"
#endif /* USE_ARDUINOBLE */
#endif /* PI_PICO_W NANO_RP2040_CONNECT */
#elif defined(ARDUINO_ARCH_RENESAS) || defined(ARDUINO_ARCH_SILABS)
#include "../platform/bluetooth/ArduinoBLE.h"
#endif /* ESP32 or NRF52 or RP2040 or RENESAS or SILABS */
Expand Down
4 changes: 4 additions & 0 deletions software/firmware/source/SoftRF/src/platform/RP2XXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,11 @@ const SoC_ops_t RP2040_ops = {
RP2040_swSer_begin,
RP2040_swSer_enableRx,
#if !defined(EXCLUDE_BLUETOOTH)
#if defined(USE_ARDUINOBLE)
&ArdBLE_Bluetooth_ops,
#else
&CYW43_Bluetooth_ops,
#endif /* USE_ARDUINOBLE */
#else
NULL,
#endif /* EXCLUDE_BLUETOOTH */
Expand Down
18 changes: 17 additions & 1 deletion software/firmware/source/SoftRF/src/platform/RP2XXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ struct rst_info {

#define SOC_ADC_VOLTAGE_DIV (5.0 / 3)

#elif defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_RASPBERRY_PI_PICO_W)
#elif defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_RASPBERRY_PI_PICO_W) || \
defined(ARDUINO_NANO_RP2040_CONNECT)

/* Console I/O */
#define SOC_GPIO_PIN_CONS_RX (5u)
Expand Down Expand Up @@ -251,7 +252,16 @@ struct rst_info {
//#define Serial_setDebugOutput(x) ({})
//#define WIFI_STA_TIMEOUT 20000

#if !defined(ARDUINO_ARCH_MBED)
#define EXCLUDE_BLUETOOTH
#else
#if defined(ARDUINO_NANO_RP2040_CONNECT)
//#define EXCLUDE_BLUETOOTH
#define USE_ARDUINOBLE
#else
#define EXCLUDE_BLUETOOTH
#endif /* ARDUINO_NANO_RP2040_CONNECT */
#endif /* ARDUINO_ARCH_MBED */
#endif /* ARDUINO_RASPBERRY_PI_PICO_W */

#define EXCLUDE_CC13XX
Expand Down Expand Up @@ -299,6 +309,12 @@ struct rst_info {
#define USE_BOOTSEL_BUTTON
#else
#define EXCLUDE_EEPROM

#if defined(USE_ARDUINOBLE)
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#define ARDUINO_CORE_VERSION STR(CORE_MAJOR) "." STR(CORE_MINOR) "." STR(CORE_PATCH)
#endif /* USE_ARDUINOBLE */
#endif /* ARDUINO_ARCH_MBED */

#define USE_BASICMAC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "../../system/SoC.h"

#if !defined(EXCLUDE_BLUETOOTH)
#if !defined(EXCLUDE_BLUETOOTH) && !defined(USE_ARDUINOBLE)

#include <queue>
#include <pico/cyw43_arch.h>
Expand Down

0 comments on commit c476e73

Please sign in to comment.