From 8c9cedaab245d49e7cac2e10b2b90a9b5a067d6e Mon Sep 17 00:00:00 2001 From: Linar Yusupov Date: Sat, 16 Mar 2024 21:31:21 +0300 Subject: [PATCH] RA4M1: Bluetooth LE and 2nd IIC I/O are doing good --- README.md | 1 + .../source/SoftRF/src/platform/RA4M1.cpp | 3 +++ .../source/SoftRF/src/platform/RA4M1.h | 10 ++++++++++ .../firmware/source/SoftRF/src/ui/Web.cpp | 20 +++++++++++-------- .../Adafruit_BMP280_Library/Adafruit_BMP280.h | 2 ++ .../source/libraries/U8g2/src/U8x8lib.h | 3 ++- 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9f05c8d6e..4579c19a3 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,7 @@ Model(s)|Platform|First appearance|       Sta [**Standalone**](https://github.com/lyusupov/SoftRF/wiki/Standalone-Edition) **upgrade**![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/hot_icon.jpg)|[Espressif
ESP32-C3](https://en.wikipedia.org/wiki/ESP32#ESP32-C3)|Q1 2023|![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/icon_good.png)|[RISC-V](https://en.wikipedia.org/wiki/RISC-V) 1 [**Prime Mark III**](https://github.com/lyusupov/SoftRF/wiki/Prime-Edition-MkIII)![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/new-icon.jpg)
2 [**SkyView Pico**](https://github.com/lyusupov/SoftRF/wiki/SkyView-Pico#alternative-hardware-option) ![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/new-icon.jpg)
3 [**Ham**](https://github.com/lyusupov/SoftRF/wiki/Ham-Edition) ![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/new-icon.jpg)
4 [**Midi**](https://github.com/lyusupov/SoftRF/wiki/Midi-Edition) ![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/new-icon.jpg)|[Espressif
ESP32-S3](https://en.wikipedia.org/wiki/ESP32#ESP32-S3)|Q1 2023|![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/icon_may_need_imp.png)| [**Standalone**](https://github.com/lyusupov/SoftRF/wiki/Standalone-Edition) **upgrade**![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/new-icon.jpg)|[Espressif
ESP32-C6](https://en.wikipedia.org/wiki/ESP32#ESP32-C6)|Q1 2024|![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/icon_may_need_imp.png)|2 [RISC-V](https://en.wikipedia.org/wiki/RISC-V) cores
big.LITTLE +[**Academy**](https://github.com/lyusupov/SoftRF/wiki/Academy-Edition) **upgrade**|[Renesas
RA4M1](https://en.wikipedia.org/wiki/Renesas_Electronics#The_RA_MCU_family)|Q1 2024|![](https://github.com/lyusupov/SoftRF/raw/master/documents/images/icon_in_progress.png)| ## By sub-1 GHz radio Radio|Model(s)|First appearance|       Status       |Notes diff --git a/software/firmware/source/SoftRF/src/platform/RA4M1.cpp b/software/firmware/source/SoftRF/src/platform/RA4M1.cpp index 9b77e7bf7..3d7f57e4d 100644 --- a/software/firmware/source/SoftRF/src/platform/RA4M1.cpp +++ b/software/firmware/source/SoftRF/src/platform/RA4M1.cpp @@ -404,6 +404,9 @@ static void RA4M1_EEPROM_extension(int cmd) #if defined(ARDUINO_UNOR4_WIFI) if (cmd == EEPROM_EXT_DEFAULTS) { settings->nmea_out = NMEA_UART; +#if defined(EXCLUDE_WIFI) && !defined(EXCLUDE_BLUETOOTH) + settings->bluetooth = BLUETOOTH_LE_HM10_SERIAL; +#endif /* EXCLUDE_BLUETOOTH */ } #endif /* ARDUINO_UNOR4_WIFI */ diff --git a/software/firmware/source/SoftRF/src/platform/RA4M1.h b/software/firmware/source/SoftRF/src/platform/RA4M1.h index ebbb60cb3..6d72b4a7f 100644 --- a/software/firmware/source/SoftRF/src/platform/RA4M1.h +++ b/software/firmware/source/SoftRF/src/platform/RA4M1.h @@ -117,8 +117,14 @@ struct rst_info { #define SOC_GPIO_PIN_ANT_RXTX SOC_UNUSED_PIN /* I2C */ +#if defined(ARDUINO_UNOR4_WIFI) +#define SOC_GPIO_PIN_SDA WIRE1_SDA_PIN +#define SOC_GPIO_PIN_SCL WIRE1_SCL_PIN +#define Wire Wire1 +#else #define SOC_GPIO_PIN_SDA WIRE_SDA_PIN #define SOC_GPIO_PIN_SCL WIRE_SCL_PIN +#endif /* ARDUINO_UNOR4_WIFI */ #define SOC_GPIO_PIN_LED SOC_UNUSED_PIN #define SOC_GPIO_PIN_GNSS_PPS PIN_A3 @@ -183,7 +189,11 @@ extern Adafruit_NeoPixel strip; #endif /* EXCLUDE_LED_RING */ #if defined(USE_OLED) +#if defined(ARDUINO_UNOR4_WIFI) +#define U8X8_OLED_I2C_BUS_TYPE U8X8_SSD1306_128X64_NONAME_2ND_HW_I2C +#else #define U8X8_OLED_I2C_BUS_TYPE U8X8_SSD1306_128X64_NONAME_HW_I2C +#endif /* ARDUINO_UNOR4_WIFI */ #endif /* USE_OLED */ #endif /* PLATFORM_RA4M1_H */ diff --git a/software/firmware/source/SoftRF/src/ui/Web.cpp b/software/firmware/source/SoftRF/src/ui/Web.cpp index 26a89cfda..ae95f0fcb 100644 --- a/software/firmware/source/SoftRF/src/ui/Web.cpp +++ b/software/firmware/source/SoftRF/src/ui/Web.cpp @@ -373,8 +373,9 @@ void handleSettings() { offset += len; size -= len; - } else if (SoC->id == SOC_ESP32S3 || SoC->id == SOC_ESP32C3 || - SoC->id == SOC_ESP32C6) { + } else if (SoC->id == SOC_ESP32S3 || SoC->id == SOC_ESP32C2 || + SoC->id == SOC_ESP32C3 || SoC->id == SOC_ESP32C6 || + SoC->id == SOC_RA4M1) { snprintf_P ( offset, size, PSTR("\ @@ -452,8 +453,9 @@ void handleSettings() { /* SoC specific part 2 */ if (SoC->id == SOC_ESP32 || SoC->id == SOC_ESP32S3 || - SoC->id == SOC_ESP32C3 || SoC->id == SOC_ESP32C6 || - SoC->id == SOC_RP2040) { + SoC->id == SOC_ESP32C2 || SoC->id == SOC_ESP32C3 || + SoC->id == SOC_ESP32C6 || SoC->id == SOC_RP2040 || + SoC->id == SOC_RA4M1) { snprintf_P ( offset, size, PSTR("\ \ @@ -501,8 +503,9 @@ void handleSettings() { #if !defined(EXCLUDE_BLUETOOTH) /* SoC specific part 3 */ if (SoC->id == SOC_ESP32 || SoC->id == SOC_ESP32S3 || - SoC->id == SOC_ESP32C3 || SoC->id == SOC_ESP32C6 || - SoC->id == SOC_RP2040) { + SoC->id == SOC_ESP32C2 || SoC->id == SOC_ESP32C3 || + SoC->id == SOC_ESP32C6 || SoC->id == SOC_RP2040 || + SoC->id == SOC_RA4M1) { snprintf_P ( offset, size, PSTR(""), (settings->gdl90 == GDL90_BLUETOOTH ? "selected" : ""), GDL90_BLUETOOTH); @@ -547,8 +550,9 @@ void handleSettings() { #if !defined(EXCLUDE_BLUETOOTH) /* SoC specific part 4 */ if (SoC->id == SOC_ESP32 || SoC->id == SOC_ESP32S3 || - SoC->id == SOC_ESP32C3 || SoC->id == SOC_ESP32C6 || - SoC->id == SOC_RP2040) { + SoC->id == SOC_ESP32C2 || SoC->id == SOC_ESP32C3 || + SoC->id == SOC_ESP32C6 || SoC->id == SOC_RP2040 || + SoC->id == SOC_RA4M1) { snprintf_P ( offset, size, PSTR(""), (settings->d1090 == D1090_BLUETOOTH ? "selected" : ""), D1090_BLUETOOTH); diff --git a/software/firmware/source/libraries/Adafruit_BMP280_Library/Adafruit_BMP280.h b/software/firmware/source/libraries/Adafruit_BMP280_Library/Adafruit_BMP280.h index 8675efe95..dd53cc51e 100644 --- a/software/firmware/source/libraries/Adafruit_BMP280_Library/Adafruit_BMP280.h +++ b/software/firmware/source/libraries/Adafruit_BMP280_Library/Adafruit_BMP280.h @@ -39,6 +39,8 @@ #include #if defined(ARDUINO_ARCH_RP2040) && defined(ARDUINO_GENERIC_RP2040) #define Wire Wire1 + #elif defined(ARDUINO_ARCH_RENESAS) && defined(ARDUINO_UNOR4_WIFI) + #define Wire Wire1 #elif defined(ARDUINO_ARCH_ASR6601) && defined(CubeCell_BoardPRO) #define Wire Wire2 #endif diff --git a/software/firmware/source/libraries/U8g2/src/U8x8lib.h b/software/firmware/source/libraries/U8g2/src/U8x8lib.h index bc1a09259..84ac8edde 100644 --- a/software/firmware/source/libraries/U8g2/src/U8x8lib.h +++ b/software/firmware/source/libraries/U8g2/src/U8x8lib.h @@ -98,7 +98,8 @@ #endif -#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_ARCH_ASR6601) +#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_RP2040) || \ + defined(ARDUINO_ARCH_ASR6601) || defined(ARDUINO_UNOR4_WIFI) #define WIRE_INTERFACES_COUNT 2 #if defined(CubeCell_BoardPRO)