Skip to content

Commit de6dd62

Browse files
authored
Merge branch 'master' into feature/rtos-cbuf
2 parents d565698 + e1a3525 commit de6dd62

File tree

4 files changed

+32
-16
lines changed

4 files changed

+32
-16
lines changed

Diff for: cores/esp32/esp32-hal-spi.h

+9-6
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ extern "C" {
3131
#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32S3
3232
#define FSPI 0
3333
#define HSPI 1
34-
#else
35-
#define FSPI 1 //SPI bus attached to the flash (can use the same data lines but different SS)
36-
#define HSPI 2 //SPI bus normally mapped to pins 12 - 15, but can be matrixed to any pins
37-
#if CONFIG_IDF_TARGET_ESP32
38-
#define VSPI 3 //SPI bus normally attached to pins 5, 18, 19 and 23, but can be matrixed to any pins
39-
#endif
34+
#elif CONFIG_IDF_TARGET_ESP32S2
35+
#define FSPI 1 //SPI 1 bus. ESP32S2: for external memory only (can use the same data lines but different SS)
36+
#define HSPI 2 //SPI 2 bus. ESP32S2: external memory or device - it can be matrixed to any pins
37+
#define SPI2 2 // Another name for ESP32S2 SPI 2
38+
#define SPI3 3 //SPI 3 bus. ESP32S2: device only - it can be matrixed to any pins
39+
#elif CONFIG_IDF_TARGET_ESP32
40+
#define FSPI 1 //SPI 1 bus attached to the flash (can use the same data lines but different SS)
41+
#define HSPI 2 //SPI 2 bus normally mapped to pins 12 - 15, but can be matrixed to any pins
42+
#define VSPI 3 //SPI 3 bus normally attached to pins 5, 18, 19 and 23, but can be matrixed to any pins
4043
#endif
4144

4245
// This defines are not representing the real Divider of the ESP32

Diff for: libraries/BLE/src/BLEClient.cpp

+15-3
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,23 @@ bool BLEClient::connect(BLEAdvertisedDevice* device) {
9292
return connect(address, type);
9393
}
9494

95+
/**
96+
* Add overloaded function to ease connect to peer device with not public address
97+
*/
98+
bool BLEClient::connectTimeout(BLEAdvertisedDevice* device, uint32_t timeoutMs) {
99+
BLEAddress address = device->getAddress();
100+
esp_ble_addr_type_t type = device->getAddressType();
101+
return connect(address, type, timeoutMs);
102+
}
103+
95104
/**
96105
* @brief Connect to the partner (BLE Server).
97106
* @param [in] address The address of the partner.
107+
* @param [in] type The type of the address.
108+
* @param [in] timeoutMs The number of milliseconds to wait for the connection to complete.
98109
* @return True on success.
99110
*/
100-
bool BLEClient::connect(BLEAddress address, esp_ble_addr_type_t type) {
111+
bool BLEClient::connect(BLEAddress address, esp_ble_addr_type_t type, uint32_t timeoutMs) {
101112
log_v(">> connect(%s)", address.toString().c_str());
102113

103114
// We need the connection handle that we get from registering the application. We register the app
@@ -142,9 +153,10 @@ bool BLEClient::connect(BLEAddress address, esp_ble_addr_type_t type) {
142153
return false;
143154
}
144155

145-
rc = m_semaphoreOpenEvt.wait("connect"); // Wait for the connection to complete.
156+
bool got_sem = m_semaphoreOpenEvt.timedWait("connect", timeoutMs); // Wait for the connection to complete.
157+
rc = m_semaphoreOpenEvt.value();
146158
// check the status of the connection and cleanup in case of failure
147-
if (rc != ESP_GATT_OK) {
159+
if (!got_sem || rc != ESP_GATT_OK) {
148160
BLEDevice::removePeerDevice(m_appId, true);
149161
esp_ble_gattc_app_unregister(m_gattc_if);
150162
m_gattc_if = ESP_GATT_IF_NONE;

Diff for: libraries/BLE/src/BLEClient.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ class BLEClient {
3737
~BLEClient();
3838

3939
bool connect(BLEAdvertisedDevice* device);
40-
bool connect(BLEAddress address, esp_ble_addr_type_t type = BLE_ADDR_TYPE_PUBLIC); // Connect to the remote BLE Server
40+
bool connectTimeout(BLEAdvertisedDevice* device, uint32_t timeoutMS = portMAX_DELAY);
41+
bool connect(BLEAddress address, esp_ble_addr_type_t type = BLE_ADDR_TYPE_PUBLIC, uint32_t timeoutMS = portMAX_DELAY); // Connect to the remote BLE Server
4142
void disconnect(); // Disconnect from the remote BLE Server
4243
BLEAddress getPeerAddress(); // Get the address of the remote BLE Server
4344
int getRssi(); // Get the RSSI of the remote BLE Server

Diff for: platform.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ recipe.hooks.prebuild.6.pattern.windows=cmd /c if not exist "{build.path}\build_
146146

147147
# Set -DARDUINO_CORE_BUILD only on core file compilation
148148
file_opts.path={build.path}/file_opts
149-
recipe.hooks.prebuild.set_core_build_flag.pattern=/usr/bin/env bash -c ": > '{file_opts.path}'"
150-
recipe.hooks.core.prebuild.set_core_build_flag.pattern=/usr/bin/env bash -c "echo -DARDUINO_CORE_BUILD > '{file_opts.path}'"
151-
recipe.hooks.core.postbuild.set_core_build_flag.pattern=/usr/bin/env bash -c ": > '{file_opts.path}'"
149+
recipe.hooks.prebuild.7.pattern=/usr/bin/env bash -c ": > '{file_opts.path}'"
150+
recipe.hooks.core.prebuild.1.pattern=/usr/bin/env bash -c "echo -DARDUINO_CORE_BUILD > '{file_opts.path}'"
151+
recipe.hooks.core.postbuild.1.pattern=/usr/bin/env bash -c ": > '{file_opts.path}'"
152152

153-
recipe.hooks.prebuild.set_core_build_flag.pattern.windows=cmd /c type nul > "{file_opts.path}"
154-
recipe.hooks.core.prebuild.set_core_build_flag.pattern.windows=cmd /c echo "-DARDUINO_CORE_BUILD" > "{file_opts.path}"
155-
recipe.hooks.core.postbuild.set_core_build_flag.pattern.windows=cmd /c type nul > "{file_opts.path}"
153+
recipe.hooks.prebuild.7.pattern.windows=cmd /c type nul > "{file_opts.path}"
154+
recipe.hooks.core.prebuild.1.pattern.windows=cmd /c echo "-DARDUINO_CORE_BUILD" > "{file_opts.path}"
155+
recipe.hooks.core.postbuild.1.pattern.windows=cmd /c type nul > "{file_opts.path}"
156156

157157
# Generate debug.cfg (must be postbuild)
158158
recipe.hooks.postbuild.1.pattern=/usr/bin/env bash -c "[ {build.copy_jtag_files} -eq 0 ] || cp -f "{debug.server.openocd.scripts_dir}"board/{build.openocdscript} "{build.source.path}"/debug.cfg"

0 commit comments

Comments
 (0)