-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/add_new_esp32c2_eco4_module' into 'master'
feat: Added a new esp32c2-eco4-4mb module support See merge request application/esp-at!1692
- Loading branch information
Showing
15 changed files
with
585 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
branch:release/v5.1 | ||
commit:64849cb7039a93b7b3a4ad8e8da328fa9c09c5e7 | ||
repository:https://github.com/espressif/esp-idf.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Name, Type, SubType, Offset, Size | ||
mfg_nvs, data, nvs, 0x1f000, 124K | ||
fatfs, data, fat, 0x47000, 100K |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Name, Type, SubType, Offset, Size | ||
otadata, data, ota, 0xd000, 0x2000 | ||
phy_init, data, phy, 0xf000, 0x1000 | ||
nvs, data, nvs, 0x10000, 0xE000 | ||
at_customize, 0x40, 0, 0x1E000, 0x42000 | ||
ota_0, app, ota_0, 0x60000, 0x1d0000 | ||
ota_1, app, ota_1, 0x230000, 0x1d0000 |
147 changes: 147 additions & 0 deletions
147
module_config/module_esp32c2-eco4-4mb/patch/blufi-adv.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
From 880c46ed4830a561df3dc6ba72dfee9c39b0559a Mon Sep 17 00:00:00 2001 | ||
From: xiewenxiang <[email protected]> | ||
Date: Thu, 13 Jul 2023 19:24:50 +0800 | ||
Subject: [PATCH] feat(blufi): Support ext adv | ||
|
||
--- | ||
.../profile/esp/blufi/nimble_host/esp_blufi.c | 98 ++++++++++++++++++- | ||
1 file changed, 97 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c b/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c | ||
index 5a22773c7a..220a29de81 100644 | ||
--- a/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c | ||
+++ b/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c | ||
@@ -32,11 +32,22 @@ | ||
|
||
#if (BLUFI_INCLUDED == TRUE) | ||
|
||
+#if !CONFIG_BT_NIMBLE_EXT_ADV | ||
static uint8_t own_addr_type; | ||
+#endif | ||
|
||
struct gatt_value gatt_values[SERVER_MAX_VALUES]; | ||
const static char *TAG = "BLUFI_EXAMPLE"; | ||
|
||
+#if CONFIG_BT_NIMBLE_EXT_ADV | ||
+static uint8_t ext_adv_pattern_1[] = { | ||
+ 0x02, 0x01, 0x06, | ||
+ 0x03, 0x03, 0xFF, 0xFF, | ||
+ 0x0d, 0X09, 'B', 'L', 'U', 'F','I', '_' ,'D','E','V','I','C','E', | ||
+ 0x02, 0x0A, 0x09 | ||
+}; | ||
+#endif | ||
+ | ||
enum { | ||
GATT_VALUE_TYPE_CHR, | ||
GATT_VALUE_TYPE_DSC, | ||
@@ -333,6 +344,79 @@ esp_blufi_gap_event(struct ble_gap_event *event, void *arg) | ||
|
||
void esp_blufi_adv_start(void) | ||
{ | ||
+#if CONFIG_BT_NIMBLE_EXT_ADV //Extended Adv | ||
+ struct ble_gap_ext_adv_params params; | ||
+ struct os_mbuf *data; | ||
+ uint8_t instance = 0; | ||
+ int rc; | ||
+ const char *name; | ||
+ uint8_t adv_data[31] = {0}; | ||
+ | ||
+ /* use defaults for non-set params */ | ||
+ memset (¶ms, 0, sizeof(params)); | ||
+ | ||
+ /* enable connectable advertising */ | ||
+ params.connectable = 1; | ||
+ params.scannable = 1; | ||
+ params.legacy_pdu = 1; | ||
+ | ||
+ /* advertise using public addr */ | ||
+ params.own_addr_type = BLE_OWN_ADDR_PUBLIC; | ||
+ | ||
+ params.primary_phy = BLE_HCI_LE_PHY_1M; | ||
+ params.secondary_phy = BLE_HCI_LE_PHY_1M; | ||
+ params.sid = 1; | ||
+ | ||
+ params.itvl_min = BLE_GAP_ADV_FAST_INTERVAL1_MIN; | ||
+ params.itvl_max = BLE_GAP_ADV_FAST_INTERVAL1_MIN; | ||
+ | ||
+ /* configure instance 0 */ | ||
+ rc = ble_gap_ext_adv_configure(instance, ¶ms, NULL, | ||
+ esp_blufi_gap_event, NULL); | ||
+ if (rc != 0) { | ||
+ ESP_LOGE(TAG, "Configuration failed with reason : %d \n" , rc); | ||
+ return; | ||
+ } | ||
+ | ||
+ name = ble_svc_gap_device_name(); | ||
+ adv_data[0] = 0x02; | ||
+ adv_data[1] = 0x01; | ||
+ adv_data[2] = 0x06; | ||
+ adv_data[3] = 1 + strlen(name); | ||
+ adv_data[4] = 0x09; | ||
+ memcpy(adv_data + 5, name, strlen(name)); | ||
+ | ||
+ /* get mbuf for scan rsp data */ | ||
+ data = os_msys_get_pkthdr(strlen(name) + 5, 0); | ||
+ | ||
+ if (data == NULL) { | ||
+ ESP_LOGE(TAG, "Failed to get mbuf \n"); | ||
+ return; | ||
+ } | ||
+ | ||
+ /* fill mbuf with scan rsp data */ | ||
+ rc = os_mbuf_append(data, adv_data, strlen(name) + 5); | ||
+ | ||
+ if (rc != 0) { | ||
+ ESP_LOGE(TAG, "Failed to fill scan rsp data with reason: %d \n", rc); | ||
+ return; | ||
+ } | ||
+ | ||
+ rc = ble_gap_ext_adv_set_data(instance, data); | ||
+ | ||
+ if (rc != 0) { | ||
+ ESP_LOGE(TAG, "Failed to set adv data with reason: %d \n", rc); | ||
+ return; | ||
+ } | ||
+ | ||
+ /* start advertising */ | ||
+ rc = ble_gap_ext_adv_start(instance, 0, 0); | ||
+ | ||
+ if (rc != 0) { | ||
+ ESP_LOGE(TAG, "Failed to start ext adv with reason: %d \n", rc); | ||
+ return; | ||
+ } | ||
+#else // Legacy ADV | ||
int rc; | ||
|
||
rc = ble_hs_util_ensure_addr(0); | ||
@@ -404,6 +488,7 @@ void esp_blufi_adv_start(void) | ||
ESP_LOGE(TAG, "error enabling advertisement; rc=%d\n", rc); | ||
return; | ||
} | ||
+#endif | ||
} | ||
|
||
uint8_t esp_blufi_init(void) | ||
@@ -447,7 +532,18 @@ void esp_blufi_disconnect(void) | ||
ble_gap_terminate(blufi_env.conn_id, BLE_ERR_REM_USER_CONN_TERM); | ||
} | ||
|
||
-void esp_blufi_adv_stop(void) {} | ||
+void esp_blufi_adv_stop(void) | ||
+{ | ||
+#if CONFIG_BT_NIMBLE_EXT_ADV | ||
+ int i; | ||
+ | ||
+ for (i = 0; i < BLE_ADV_INSTANCES; i++) { | ||
+ ble_gap_ext_adv_stop(i); | ||
+ } | ||
+#else | ||
+ ble_gap_adv_stop(); | ||
+#endif | ||
+} | ||
|
||
void esp_blufi_send_encap(void *arg) | ||
{ | ||
-- | ||
2.25.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
; Add your patches to the section below | ||
|
||
[blufi-adv.patch] | ||
path = esp-idf | ||
note = "Add the support for BluFi advertising if uses nimble" | ||
|
||
[support_ext_partition.patch] | ||
path = esp-idf | ||
note = "[IDF-9560] Support to use partition table outside of the project directory" |
20 changes: 20 additions & 0 deletions
20
module_config/module_esp32c2-eco4-4mb/patch/support_ext_partition.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
diff --git a/components/partition_table/project_include.cmake b/components/partition_table/project_include.cmake | ||
index d0969ba408..89a0f02cbd 100644 | ||
--- a/components/partition_table/project_include.cmake | ||
+++ b/components/partition_table/project_include.cmake | ||
@@ -9,10 +9,14 @@ if(NOT BOOTLOADER_BUILD) | ||
# Set PARTITION_CSV_PATH to the configured partition CSV file | ||
# absolute path | ||
if(CONFIG_PARTITION_TABLE_CUSTOM) | ||
+ if(NOT CONFIG_PARTITION_TABLE_BASE_DIR) | ||
+ set(CONFIG_PARTITION_TABLE_BASE_DIR "${project_dir}") | ||
+ endif() | ||
+ | ||
idf_build_get_property(project_dir PROJECT_DIR) | ||
# Custom filename expands any path relative to the project | ||
get_filename_component(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}" | ||
- ABSOLUTE BASE_DIR "${project_dir}") | ||
+ ABSOLUTE BASE_DIR "${CONFIG_PARTITION_TABLE_BASE_DIR}") | ||
|
||
if(NOT EXISTS "${PARTITION_CSV_PATH}") | ||
message(WARNING "Partition table CSV file ${PARTITION_CSV_PATH} not found. " |
Oops, something went wrong.