ImpulseAdventure / GUIslice-Builder

Cross-platform drag & drop GUI builder for GUIslice
Other
163 stars 34 forks source link

Is there a support for rp2040 board ? #254

Closed eagl1 closed 2 months ago

eagl1 commented 2 months ago

Hello,

I'm trying to run my code on the black rp2040 board:

image

But I think there's no support in GUIslice_config.h, so I want to add the required lines for the rp2040. Is there an easy way for this ?

My addition would be like this:

// Detect device platform
#if defined(__linux__)
  #define GSLC_CFG_LINUX
#elif defined(__AVR__) && !defined(TEENSYDUINO)
  // Note: Teensy 2 also defines __AVR__, so differentiate with TEENSYDUINO
  #define GSLC_CFG_ARD
#elif defined(ARDUINO_SAMD_ZERO)
  #define GSLC_CFG_ARD
#elif defined(ESP8266) || defined(ESP32)
  #define GSLC_CFG_ARD
#elif defined(NRF52)
  #define GSLC_CFG_ARD
#elif defined(ARDUINO_STM32_FEATHER) || defined(__STM32F1__) || defined(__STM32F4__)
  #define GSLC_CFG_ARD
#elif defined(ARDUINO_ARCH_STM32)  // ST Core from STMicroelectronics
  #define GSLC_CFG_ARD
#elif defined(ARDUINO_ARCH_MBED)   // RP2040
  #define GSLC_CFG_ARD
#elif defined(ARDUINO_ARCH_SAM)   // Arduino Due
  #define GSLC_CFG_ARD
#elif defined(ARDUINO_ARCH_SAMD)   // M0_PRO
  #define GSLC_CFG_ARD
#elif defined(__AVR__) && defined(TEENSYDUINO) // Teensy 2
  #define GSLC_CFG_ARD
  #define GSLC_DEV_TEENSY
  #define GSLC_DEV_TEENSY_2
#elif defined(__MKL26Z64__) // Teensy LC
  #define GSLC_CFG_ARD
  #define GSLC_DEV_TEENSY
  #define GSLC_DEV_TEENSY_LC
#elif defined(__MK20DX256__) // Teensy 3.2
  #define GSLC_CFG_ARD
  #define GSLC_DEV_TEENSY
  #define GSLC_DEV_TEENSY_3_2
#elif defined(__MK64FX512__) // Teensy 3.5
  #define GSLC_CFG_ARD
  #define GSLC_DEV_TEENSY
  #define GSLC_DEV_TEENSY_3_5
#elif defined(__MK66FX1M0__) // Teensy 3.6
  #define GSLC_CFG_ARD
  #define GSLC_DEV_TEENSY
  #define GSLC_DEV_TEENSY_3_6
#elif defined(__IMXRT1062__) // Teensy 4.0
  //#elif defined(ARDUINO_TEENSY40)
  //#elif defined(ARDUINO_TEENSY41)
  #define GSLC_CFG_ARD
  #define GSLC_DEV_TEENSY
  #define GSLC_DEV_TEENSY_4_0
#else
  #warning Unknown device platform
#endif

I added:

#elif defined(ARDUINO_ARCH_MBED)   // RP2040
  #define GSLC_CFG_ARD

Would that work ?

I tried to compile the code and it compiled with this warning:

WARNING: library GUIslice-master claims to run on avr, esp8266, esp32, stm32, STM32F1, samd, sam, teensy architecture(s) and may be incompatible with your current board which runs on rp2040 architecture(s). In file included from E:\Programs_Files\Arduino\libraries\GUIslice-master\src/GUIslice.h:55,

Pconti31 commented 2 months ago

@eagl1 The rp2040 pico can work with Arduino IDE or PlatformIO. GUIslice really doesn't care so much about the MCU board as much as what TFT Display it will use and what abstract driver supports that display. So I think you are on the right track. The warning you are getting isn't from GUIslice but the Arduino IDE. It's looking at GUIslice/library.properties

architectures=avr,esp8266,esp32,stm32,STM32F1,samd,sam,teensy

You need either rp2040 or mbed_rp2040 added depending upon you using either RP2040 Arduino-mbed or arduino-pico core. Paul--

eagl1 commented 2 months ago

Is the header for the rp2040 I should use in:

E:\Programs_Files\Arduino\libraries\TFT_eSPI\User_Setup_Select.h

this one: #include <User_Setups/Setup36_RPi_touch_ST7796.h> // Setup file configured for RP2040 and RPi ST7796 TFT with touch

?

eagl1 commented 2 months ago

I compiled the code with earlephilhower/arduino-pico/GenericRP2040

I get this result:

WARNING: library GUIslice-master claims to run on avr, esp8266, esp32, stm32, STM32F1, samd, sam, teensy architecture(s) and may be incompatible with your current board which runs on rp2040 architecture(s).
In file included from E:\Programs_Files\Arduino\libraries\GUIslice-master\src/GUIslice.h:55,
                 from E:\projects_electronics_programming\tft\GUIslice\guislice\project1\project1_GSLC.h:18,
                 from E:\projects_electronics_programming\tft\GUIslice\guislice\project1\project1.ino:18:
E:\Programs_Files\Arduino\libraries\GUIslice-master\src/GUIslice_config.h:219:4: warning: #warning Unknown device platform [-Wcpp]
  219 |   #warning Unknown device platform
      |    ^~~~~~~
Sketch uses 136860 bytes (6%) of program storage space. Maximum is 2093056 bytes.
Global variables use 16400 bytes (6%) of dynamic memory, leaving 245744 bytes for local variables. Maximum is 262144 bytes.

Even with embedding

#elif defined(ARDUINO_ARCH_MBED)   // RP2040
  #define GSLC_CFG_ARD

in GUIslice_config.h

Pconti31 commented 2 months ago

@eagl1Well, progress. You got rid of the Arduino IDE warning. I thing your GUIslice_config.h warning is now simply because your test is incorrect. Try:

#elif defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_ARCH_RP2040)
  #define GSLC_CFG_ARD
eagl1 commented 2 months ago

More better, after compiling the code I got this:

WARNING: library GUIslice-master claims to run on avr, esp8266, esp32, stm32, STM32F1, samd, sam, teensy architecture(s) and may be incompatible with your current board which runs on rp2040 architecture(s).
Sketch uses 136860 bytes (6%) of program storage space. Maximum is 2093056 bytes.
Global variables use 16400 bytes (6%) of dynamic memory, leaving 245744 bytes for local variables. Maximum is 262144 bytes.
eagl1 commented 2 months ago

OK, it worked, editing the properties file solved the last warning:

architectures=avr,esp8266,esp32,stm32,STM32F1,samd,sam,teensy,rp2040,mbed_rp2040

Thank you so much man !