From 888edae4af8cde042f036039f7e4c6604fadc665 Mon Sep 17 00:00:00 2001 From: Linar Yusupov Date: Wed, 18 Sep 2024 16:51:47 +0300 Subject: [PATCH] [nRF52] bring up of I2C air pressure sensor with Cozy Edition --- .../firmware/source/SkyWatch/Platform_ESP32.h | 4 ++-- .../SoftRF/src/platform/iomap/Heltec_T114.h | 10 ++++++--- .../source/SoftRF/src/platform/nRF52.cpp | 21 ++++++++++++++++++- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/software/firmware/source/SkyWatch/Platform_ESP32.h b/software/firmware/source/SkyWatch/Platform_ESP32.h index 503e99d02..f209719cc 100644 --- a/software/firmware/source/SkyWatch/Platform_ESP32.h +++ b/software/firmware/source/SkyWatch/Platform_ESP32.h @@ -249,8 +249,8 @@ extern PCF8563_Class *rtc; #undef SOC_GPIO_PIN_GNSS_RX #undef SOC_GPIO_PIN_GNSS_TX -#define SOC_GPIO_PIN_GNSS_RX SOC_GPIO_PIN_TULTIMA_ESP_MOSI -#define SOC_GPIO_PIN_GNSS_TX SOC_GPIO_PIN_TULTIMA_ESP_MISO +#define SOC_GPIO_PIN_GNSS_RX SOC_GPIO_PIN_TULTIMA_ESP_HS +#define SOC_GPIO_PIN_GNSS_TX SOC_GPIO_PIN_TULTIMA_ESP_DR extern IODev_ops_t ArdBLE_Bluetooth_ops; #endif /* CONFIG_IDF_TARGET_ESP32C6 */ diff --git a/software/firmware/source/SoftRF/src/platform/iomap/Heltec_T114.h b/software/firmware/source/SoftRF/src/platform/iomap/Heltec_T114.h index b0d706a43..8ad437193 100644 --- a/software/firmware/source/SoftRF/src/platform/iomap/Heltec_T114.h +++ b/software/firmware/source/SoftRF/src/platform/iomap/Heltec_T114.h @@ -21,9 +21,13 @@ #define SOC_GPIO_PIN_T114_DIO1 _PINNUM(0, 20) // P0.20 #define SOC_GPIO_PIN_T114_BUSY _PINNUM(0, 17) // P0.17 -/* I2C */ -#define SOC_GPIO_PIN_T114_SDA _PINNUM(0, 26) // P0.26 -#define SOC_GPIO_PIN_T114_SCL _PINNUM(0, 27) // P0.27 +/* I2C int. (same that T-Echo has) */ +#define SOC_GPIO_PIN_T114_SDA_INT _PINNUM(0, 26) // P0.26 +#define SOC_GPIO_PIN_T114_SCL_INT _PINNUM(0, 27) // P0.27 + +/* I2C ext. (air pressure sensor) */ +#define SOC_GPIO_PIN_T114_SDA_EXT _PINNUM(0, 16) // P0.16 +#define SOC_GPIO_PIN_T114_SCL_EXT _PINNUM(0, 13) // P0.13 /* button */ #define SOC_GPIO_PIN_T114_BUTTON _PINNUM(1, 10) // P1.10 diff --git a/software/firmware/source/SoftRF/src/platform/nRF52.cpp b/software/firmware/source/SoftRF/src/platform/nRF52.cpp index f7d7ad51f..7d64a89e8 100644 --- a/software/firmware/source/SoftRF/src/platform/nRF52.cpp +++ b/software/firmware/source/SoftRF/src/platform/nRF52.cpp @@ -793,7 +793,7 @@ static void nRF52_setup() case NRF52_LILYGO_TECHO_REV_1: case NRF52_LILYGO_TECHO_REV_2: case NRF52_NORDIC_PCA10059: - case NRF52_HELTEC_T114: + case NRF52_HELTEC_T114: /* internal bus */ default: Wire.setPins(SOC_GPIO_PIN_SDA, SOC_GPIO_PIN_SCL); break; @@ -880,6 +880,10 @@ static void nRF52_setup() nRF52_board = NRF52_HELTEC_T114; hw_info.model = SOFTRF_MODEL_COZY; nRF52_Device_Model = "Cozy Edition"; +#if !defined(ARDUINO_ARCH_MBED) + /* external bus */ + Wire.setPins(SOC_GPIO_PIN_T114_SDA_EXT, SOC_GPIO_PIN_T114_SCL_EXT); +#endif /* ARDUINO_ARCH_MBED */ } #endif /* USE_TFT */ @@ -1758,6 +1762,21 @@ static void nRF52_fini(int reason) pinMode(SOC_GPIO_PIN_SFL_SS, INPUT); break; + case NRF52_LILYGO_TULTIMA: +#if !defined(ARDUINO_ARCH_MBED) + if (nRF52_has_extension) { + xl9555->pinMode(ExtensionIOXL9555::I2C_EXP_PIN_GNSS_TULTIMA_PWR, INPUT); + xl9555->pinMode(ExtensionIOXL9555::I2C_EXP_PIN_SENS_TULTIMA_PWR, INPUT); + xl9555->pinMode(ExtensionIOXL9555::I2C_EXP_PIN_LORA_TULTIMA_PWR, INPUT); + xl9555->pinMode(ExtensionIOXL9555::I2C_EXP_PIN_WIFI_TULTIMA_PWR, INPUT); + + xl9555->pinMode(ExtensionIOXL9555::I2C_EXP_PIN_MOTOR_TULTIMA_EN, INPUT); + xl9555->pinMode(ExtensionIOXL9555::I2C_EXP_PIN_AMP_TULTIMA_EN, INPUT); + xl9555->deinit(); + } +#endif /* ARDUINO_ARCH_MBED */ + break; + case NRF52_NORDIC_PCA10059: default: // ledOff(SOC_GPIO_LED_PCA10059_GREEN);