Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for RPI Pico W #30

Closed
nordseele opened this issue Sep 20, 2022 · 1 comment
Closed

support for RPI Pico W #30

nordseele opened this issue Sep 20, 2022 · 1 comment

Comments

@nordseele
Copy link

nordseele commented Sep 20, 2022

Hi,
I'm testing ArduinoOSC on a Raspberry Pico W (w/ Arduino-Pico from Earl Philhower https://github.com/earlephilhower/arduino-pico) after quickly editing ArduinoOSCWiFi.h and adding the Pico platform to it:

defined(PICO_RP2040)

#if defined(ESP_PLATFORM) || defined(ESP8266) || defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_MKRVIDOR4000) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_NANO_33_IOT) || defined(PICO_RP2040)
#define ARDUINOOSC_ENABLE_WIFI
#endif

[...]


#elif defined(PICO_RP2040)
#include <WiFi.h>
#include <WiFiUdp.h>

It's kind of a dirty hack but I wanted to try your library. And it seems to work just fine. I'm not sure yet if there's anything else that needs to be modified to add full support for this board.

It's worth noting that I'm getting a compiler warning/error though (posted below). But I'm not sure it's totally related to ArduinoOSC yet.

defined(PICO_RP2040) is the only "define" I could find in the Pico SDK, I'm not familiar with these, perhaps there's a Define specific to identify the RPI Pico W (wifi). The cyw43 maybe.

/Users/matthias/Library/Arduino15/packages/rp2040/tools/pqt-gcc/1.4.0-c-0196c06/bin/arm-none-eabi-g++ -I /var/folders/cp/1rj8rlv11qb0v2srv_zph7mr0000gn/T/arduino_build_843132/core -c -Werror=return-type -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DUSB_VID=0x2e8a -DUSB_PID=0xf00a "-DUSB_MANUFACTURER=\"Raspberry Pi\"" "-DUSB_PRODUCT=\"Pico W\"" -DPICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1 -DCYW43_LWIP=0 -DLWIP_IPV6=0 -DLWIP_IPV4=1 -DLWIP_IGMP=1 -DLWIP_CHECKSUM_CTRL_PER_NETIF=1 "-DARDUINO_VARIANT=\"rpipicow\"" -march=armv6-m -mcpu=cortex-m0plus -mthumb -ffunction-sections -fdata-sections -fno-exceptions -DARM_MATH_CM0_FAMILY -DARM_MATH_CM0_PLUS -MMD -iprefix/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/ @/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/lib/platform_inc.txt -I/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/include -fno-rtti -std=gnu++17 -g -pipe -DSERIALUSB_PID=0xf00a -DUSBD_MAX_POWER_MA=250 -DF_CPU=133000000L -DARDUINO=10819 -DARDUINO_RASPBERRY_PI_PICO_W "-DBOARD_NAME=\"RASPBERRY_PI_PICO_W\"" -DARDUINO_ARCH_RP2040 -Os -I/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/cores/rp2040 -I/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/variants/rpipicow -I/Users/matthias/Documents/Arduino/libraries/ArduinoOSC -I/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/libraries/WiFi/src -I/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/libraries/Updater/src -I/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/libraries/MD5Builder/src -I/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/libraries/Wire/src -I/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/libraries/lwIP_Ethernet/src -I/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/libraries/lwIP_CYW43/src -I/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/libraries/SPI/src -I/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/libraries/LittleFS/src -I/Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/libraries/PicoOTA/src /var/folders/cp/1rj8rlv11qb0v2srv_zph7mr0000gn/T/arduino_build_843132/sketch/hans_2.ino.cpp -o /var/folders/cp/1rj8rlv11qb0v2srv_zph7mr0000gn/T/arduino_build_843132/sketch/hans_2.ino.cpp.o
In file included from /Users/matthias/Library/Arduino15/packages/rp2040/tools/pqt-gcc/1.4.0-c-0196c06/arm-none-eabi/include/c++/10.3.0/vector:72,
                 from /Users/matthias/Library/Arduino15/packages/rp2040/tools/pqt-gcc/1.4.0-c-0196c06/arm-none-eabi/include/c++/10.3.0/queue:61,
                 from /Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/cores/rp2040/SerialUART.h:26,
                 from /Users/matthias/Library/Arduino15/packages/rp2040/hardware/rp2040/2.5.2/cores/rp2040/Arduino.h:111,
                 from /var/folders/cp/1rj8rlv11qb0v2srv_zph7mr0000gn/T/arduino_build_843132/sketch/hans_2.ino.cpp:1:
/Users/matthias/Library/Arduino15/packages/rp2040/tools/pqt-gcc/1.4.0-c-0196c06/arm-none-eabi/include/c++/10.3.0/bits/vector.tcc: In member function 'void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {arduino::osc::message::Message}; _Tp = arduino::osc::message::Message; _Alloc = std::allocator<arduino::osc::message::Message>]':
/Users/matthias/Library/Arduino15/packages/rp2040/tools/pqt-gcc/1.4.0-c-0196c06/arm-none-eabi/include/c++/10.3.0/bits/vector.tcc:426:7: note: parameter passing for argument of type 'std::vector<arduino::osc::message::Message>::iterator' changed in GCC 7.1
  426 |       vector<_Tp, _Alloc>::
      |       ^~~~~~~~~~~~~~~~~~~
/Users/matthias/Library/Arduino15/packages/rp2040/tools/pqt-gcc/1.4.0-c-0196c06/arm-none-eabi/include/c++/10.3.0/bits/vector.tcc: In member function 'bool arduino::osc::message::Decoder::parse(const char*, const char*, const arduino::osc::TimeTag&)':
/Users/matthias/Library/Arduino15/packages/rp2040/tools/pqt-gcc/1.4.0-c-0196c06/arm-none-eabi/include/c++/10.3.0/bits/vector.tcc:121:21: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<arduino::osc::message::Message*, std::vector<arduino::osc::message::Message> >' changed in GCC 7.1
  121 |    _M_realloc_insert(end(), std::forward<_Args>(__args)...);
      |    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm happy to test in depth with the Pico W and to add more details if you'd like to add official support for it.

Best,

Edit: I've removed a question from my first post about OSC pattern matching notation. Both the { } and [ ]methods are confirmed working using your library. I was just misusing the curly braces notation, it's fixed now.

@nordseele nordseele changed the title support for RPI Pico W and OSC pattern matching notation support for RPI Pico W Sep 20, 2022
@nordseele
Copy link
Author

Using the Arduino Pico core and PlatformIO, it should be fine with:
ARDUINO_RASPBERRY_PI_PICO_W

cf.ArduinoOSCWiFi.h file:

#pragma once
#ifndef ARDUINOOSCWIFI_H
#define ARDUINOOSCWIFI_H

// Added 'ARDUINO_RASPBERRY_PI_PICO_W' for Arduino PIco & PlatformIO. Macro should be seen, but not always the case

#if defined(ESP_PLATFORM) || defined(ESP8266) || defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_MKRVIDOR4000) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_RASPBERRY_PI_PICO_W)
#define ARDUINOOSC_ENABLE_WIFI
#endif

#ifdef ARDUINOOSC_ENABLE_WIFI
#ifdef ESP_PLATFORM
#include <WiFi.h>
#include <WiFiUdp.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#elif defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_MKRVIDOR4000) || defined(ARDUINO_SAMD_NANO_33_IOT)
#include <SPI.h>
#include <WiFiNINA.h>
#include <WiFiUdp.h>
#elif defined(ARDUINO_SAMD_MKR1000)
#include <SPI.h>
#include <WiFi101.h>
#include <WiFiUdp.h>
#elif defined(ARDUINO_RASPBERRY_PI_PICO_W) 
#include <WiFi.h>
#include <WiFiUdp.h>
#endif

#include "ArduinoOSC/ArduinoOSCCommon.h"
using OscWiFiManager = ArduinoOSC::Manager<WiFiUDP>;
#define OscWiFi OscWiFiManager::getInstance()
using OscWiFiServer = OscServer<WiFiUDP>;
using OscWiFiClient = OscClient<WiFiUDP>;
#endif  // ARDUINOOSC_ENABLE_WIFI

#endif  // ARDUINOOSCWIFI_H

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant