mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Rename Kconfig options (examples)
This commit is contained in:
parent
1ad2283641
commit
151f757912
@ -1,41 +1,41 @@
|
|||||||
menu "A2DP Example Configuration"
|
menu "A2DP Example Configuration"
|
||||||
|
|
||||||
choice A2DP_SINK_OUTPUT
|
choice EXAMPLE_A2DP_SINK_OUTPUT
|
||||||
prompt "A2DP Sink Output"
|
prompt "A2DP Sink Output"
|
||||||
default A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
default EXAMPLE_A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
||||||
help
|
help
|
||||||
Select to use Internal DAC or external I2S driver
|
Select to use Internal DAC or external I2S driver
|
||||||
|
|
||||||
config A2DP_SINK_OUTPUT_INTERNAL_DAC
|
config EXAMPLE_A2DP_SINK_OUTPUT_INTERNAL_DAC
|
||||||
bool "Internal DAC"
|
bool "Internal DAC"
|
||||||
help
|
help
|
||||||
Select this to use Internal DAC sink output
|
Select this to use Internal DAC sink output
|
||||||
|
|
||||||
config A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
config EXAMPLE_A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
||||||
bool "External I2S Codec"
|
bool "External I2S Codec"
|
||||||
help
|
help
|
||||||
Select this to use External I2S sink output
|
Select this to use External I2S sink output
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config I2S_LRCK_PIN
|
config EXAMPLE_I2S_LRCK_PIN
|
||||||
int "I2S LRCK (WS) GPIO"
|
int "I2S LRCK (WS) GPIO"
|
||||||
default 22
|
default 22
|
||||||
depends on A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
depends on EXAMPLE_A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
||||||
help
|
help
|
||||||
GPIO number to use for I2S LRCK(WS) Driver.
|
GPIO number to use for I2S LRCK(WS) Driver.
|
||||||
|
|
||||||
config I2S_BCK_PIN
|
config EXAMPLE_I2S_BCK_PIN
|
||||||
int "I2S BCK GPIO"
|
int "I2S BCK GPIO"
|
||||||
default 26
|
default 26
|
||||||
depends on A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
depends on EXAMPLE_A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
||||||
help
|
help
|
||||||
GPIO number to use for I2S BCK Driver.
|
GPIO number to use for I2S BCK Driver.
|
||||||
|
|
||||||
config I2S_DATA_PIN
|
config EXAMPLE_I2S_DATA_PIN
|
||||||
int "I2S DATA GPIO"
|
int "I2S DATA GPIO"
|
||||||
default 25
|
default 25
|
||||||
depends on A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
depends on EXAMPLE_A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
||||||
help
|
help
|
||||||
GPIO number to use for I2S Data Driver.
|
GPIO number to use for I2S Data Driver.
|
||||||
|
|
||||||
|
@ -680,7 +680,7 @@ void app_main()
|
|||||||
ESP_ERROR_CHECK(err);
|
ESP_ERROR_CHECK(err);
|
||||||
|
|
||||||
i2s_config_t i2s_config = {
|
i2s_config_t i2s_config = {
|
||||||
#ifdef CONFIG_A2DP_SINK_OUTPUT_INTERNAL_DAC
|
#ifdef CONFIG_EXAMPLE_A2DP_SINK_OUTPUT_INTERNAL_DAC
|
||||||
.mode = I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN,
|
.mode = I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN,
|
||||||
#else
|
#else
|
||||||
.mode = I2S_MODE_MASTER | I2S_MODE_TX, // Only TX
|
.mode = I2S_MODE_MASTER | I2S_MODE_TX, // Only TX
|
||||||
@ -697,14 +697,14 @@ void app_main()
|
|||||||
|
|
||||||
|
|
||||||
i2s_driver_install(0, &i2s_config, 0, NULL);
|
i2s_driver_install(0, &i2s_config, 0, NULL);
|
||||||
#ifdef CONFIG_A2DP_SINK_OUTPUT_INTERNAL_DAC
|
#ifdef CONFIG_EXAMPLE_A2DP_SINK_OUTPUT_INTERNAL_DAC
|
||||||
i2s_set_dac_mode(I2S_DAC_CHANNEL_BOTH_EN);
|
i2s_set_dac_mode(I2S_DAC_CHANNEL_BOTH_EN);
|
||||||
i2s_set_pin(0, NULL);
|
i2s_set_pin(0, NULL);
|
||||||
#else
|
#else
|
||||||
i2s_pin_config_t pin_config = {
|
i2s_pin_config_t pin_config = {
|
||||||
.bck_io_num = CONFIG_I2S_BCK_PIN,
|
.bck_io_num = CONFIG_EXAMPLE_I2S_BCK_PIN,
|
||||||
.ws_io_num = CONFIG_I2S_LRCK_PIN,
|
.ws_io_num = CONFIG_EXAMPLE_I2S_LRCK_PIN,
|
||||||
.data_out_num = CONFIG_I2S_DATA_PIN,
|
.data_out_num = CONFIG_EXAMPLE_I2S_DATA_PIN,
|
||||||
.data_in_num = -1 //Not used
|
.data_in_num = -1 //Not used
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,41 +1,41 @@
|
|||||||
menu "A2DP Example Configuration"
|
menu "A2DP Example Configuration"
|
||||||
|
|
||||||
choice A2DP_SINK_OUTPUT
|
choice EXAMPLE_A2DP_SINK_OUTPUT
|
||||||
prompt "A2DP Sink Output"
|
prompt "A2DP Sink Output"
|
||||||
default A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
default EXAMPLE_A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
||||||
help
|
help
|
||||||
Select to use Internal DAC or external I2S driver
|
Select to use Internal DAC or external I2S driver
|
||||||
|
|
||||||
config A2DP_SINK_OUTPUT_INTERNAL_DAC
|
config EXAMPLE_A2DP_SINK_OUTPUT_INTERNAL_DAC
|
||||||
bool "Internal DAC"
|
bool "Internal DAC"
|
||||||
help
|
help
|
||||||
Select this to use Internal DAC sink output
|
Select this to use Internal DAC sink output
|
||||||
|
|
||||||
config A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
config EXAMPLE_A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
||||||
bool "External I2S Codec"
|
bool "External I2S Codec"
|
||||||
help
|
help
|
||||||
Select this to use External I2S sink output
|
Select this to use External I2S sink output
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config I2S_LRCK_PIN
|
config EXAMPLE_I2S_LRCK_PIN
|
||||||
int "I2S LRCK (WS) GPIO"
|
int "I2S LRCK (WS) GPIO"
|
||||||
default 22
|
default 22
|
||||||
depends on A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
depends on EXAMPLE_A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
||||||
help
|
help
|
||||||
GPIO number to use for I2S LRCK(WS) Driver.
|
GPIO number to use for I2S LRCK(WS) Driver.
|
||||||
|
|
||||||
config I2S_BCK_PIN
|
config EXAMPLE_I2S_BCK_PIN
|
||||||
int "I2S BCK GPIO"
|
int "I2S BCK GPIO"
|
||||||
default 26
|
default 26
|
||||||
depends on A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
depends on EXAMPLE_A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
||||||
help
|
help
|
||||||
GPIO number to use for I2S BCK Driver.
|
GPIO number to use for I2S BCK Driver.
|
||||||
|
|
||||||
config I2S_DATA_PIN
|
config EXAMPLE_I2S_DATA_PIN
|
||||||
int "I2S DATA GPIO"
|
int "I2S DATA GPIO"
|
||||||
default 25
|
default 25
|
||||||
depends on A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
depends on EXAMPLE_A2DP_SINK_OUTPUT_EXTERNAL_I2S
|
||||||
help
|
help
|
||||||
GPIO number to use for I2S Data Driver.
|
GPIO number to use for I2S Data Driver.
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ void app_main()
|
|||||||
ESP_ERROR_CHECK(err);
|
ESP_ERROR_CHECK(err);
|
||||||
|
|
||||||
i2s_config_t i2s_config = {
|
i2s_config_t i2s_config = {
|
||||||
#ifdef CONFIG_A2DP_SINK_OUTPUT_INTERNAL_DAC
|
#ifdef CONFIG_EXAMPLE_A2DP_SINK_OUTPUT_INTERNAL_DAC
|
||||||
.mode = I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN,
|
.mode = I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN,
|
||||||
#else
|
#else
|
||||||
.mode = I2S_MODE_MASTER | I2S_MODE_TX, // Only TX
|
.mode = I2S_MODE_MASTER | I2S_MODE_TX, // Only TX
|
||||||
@ -70,14 +70,14 @@ void app_main()
|
|||||||
|
|
||||||
|
|
||||||
i2s_driver_install(0, &i2s_config, 0, NULL);
|
i2s_driver_install(0, &i2s_config, 0, NULL);
|
||||||
#ifdef CONFIG_A2DP_SINK_OUTPUT_INTERNAL_DAC
|
#ifdef CONFIG_EXAMPLE_A2DP_SINK_OUTPUT_INTERNAL_DAC
|
||||||
i2s_set_dac_mode(I2S_DAC_CHANNEL_BOTH_EN);
|
i2s_set_dac_mode(I2S_DAC_CHANNEL_BOTH_EN);
|
||||||
i2s_set_pin(0, NULL);
|
i2s_set_pin(0, NULL);
|
||||||
#else
|
#else
|
||||||
i2s_pin_config_t pin_config = {
|
i2s_pin_config_t pin_config = {
|
||||||
.bck_io_num = CONFIG_I2S_BCK_PIN,
|
.bck_io_num = CONFIG_EXAMPLE_I2S_BCK_PIN,
|
||||||
.ws_io_num = CONFIG_I2S_LRCK_PIN,
|
.ws_io_num = CONFIG_EXAMPLE_I2S_LRCK_PIN,
|
||||||
.data_out_num = CONFIG_I2S_DATA_PIN,
|
.data_out_num = CONFIG_EXAMPLE_I2S_DATA_PIN,
|
||||||
.data_in_num = -1 //Not used
|
.data_in_num = -1 //Not used
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
menu "Example 'GATT SERVER THROUGHPUT' Config"
|
menu "Example 'GATT SERVER THROUGHPUT' Config"
|
||||||
|
|
||||||
config SET_RAW_ADV_DATA
|
config EXAMPLE_SET_RAW_ADV_DATA
|
||||||
bool "Use raw data for advertising packets and scan response data"
|
bool "Use raw data for advertising packets and scan response data"
|
||||||
help
|
help
|
||||||
If this config item is set, raw binary data will be used to generate advertising & scan response data.
|
If this config item is set, raw binary data will be used to generate advertising & scan response data.
|
||||||
@ -11,17 +11,17 @@ menu "Example 'GATT SERVER THROUGHPUT' Config"
|
|||||||
esp_ble_adv_data_t structure. The lower layer will generate the BLE packets. This option has higher
|
esp_ble_adv_data_t structure. The lower layer will generate the BLE packets. This option has higher
|
||||||
overhead at runtime.
|
overhead at runtime.
|
||||||
|
|
||||||
config GATTS_NOTIFY_THROUGHPUT
|
config EXAMPLE_GATTS_NOTIFY_THROUGHPUT
|
||||||
bool "test the gatts notify throughput"
|
bool "test the gatts notify throughput"
|
||||||
help
|
help
|
||||||
If this config item is set, then the 'GATTC_WRITE_THROUGHPUT' config should be close, it can't test both
|
If this config item is set, then the 'EXAMPLE_GATTC_WRITE_THROUGHPUT' config should be close, it can't test
|
||||||
write or notify at the same time at this demo
|
both write or notify at the same time at this demo
|
||||||
|
|
||||||
config GATTC_WRITE_THROUGHPUT
|
config EXAMPLE_GATTC_WRITE_THROUGHPUT
|
||||||
bool "test the gattc write throughput"
|
bool "test the gattc write throughput"
|
||||||
help
|
help
|
||||||
If this config item is set, then the 'GATTS_NOTIFY_THROUGHPUT' config should be close, it can't test both
|
If this config item is set, then the 'EXAMPLE_GATTS_NOTIFY_THROUGHPUT' config should be close, it can't
|
||||||
write or notify at the same time at this demo
|
test both write or notify at the same time at this demo
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,20 +38,20 @@
|
|||||||
|
|
||||||
#define GATTS_TAG "GATTS_DEMO"
|
#define GATTS_TAG "GATTS_DEMO"
|
||||||
|
|
||||||
#if (CONFIG_GATTS_NOTIFY_THROUGHPUT)
|
#if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT)
|
||||||
#define GATTS_NOTIFY_LEN 490
|
#define GATTS_NOTIFY_LEN 490
|
||||||
static SemaphoreHandle_t gatts_semaphore;
|
static SemaphoreHandle_t gatts_semaphore;
|
||||||
static bool can_send_notify = false;
|
static bool can_send_notify = false;
|
||||||
static uint8_t indicate_data[GATTS_NOTIFY_LEN] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a};
|
static uint8_t indicate_data[GATTS_NOTIFY_LEN] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a};
|
||||||
|
|
||||||
#endif /* #if (CONFIG_GATTS_NOTIFY_THROUGHPUT) */
|
#endif /* #if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT) */
|
||||||
|
|
||||||
#if (CONFIG_GATTC_WRITE_THROUGHPUT)
|
#if (CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT)
|
||||||
static bool start = false;
|
static bool start = false;
|
||||||
static uint64_t write_len = 0;
|
static uint64_t write_len = 0;
|
||||||
static uint64_t start_time = 0;
|
static uint64_t start_time = 0;
|
||||||
static uint64_t current_time = 0;
|
static uint64_t current_time = 0;
|
||||||
#endif /* #if (CONFIG_GATTC_WRITE_THROUGHPUT) */
|
#endif /* #if (CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT) */
|
||||||
|
|
||||||
static bool is_connecet = false;
|
static bool is_connecet = false;
|
||||||
///Declare the static function
|
///Declare the static function
|
||||||
@ -88,7 +88,7 @@ static uint8_t adv_config_done = 0;
|
|||||||
#define adv_config_flag (1 << 0)
|
#define adv_config_flag (1 << 0)
|
||||||
#define scan_rsp_config_flag (1 << 1)
|
#define scan_rsp_config_flag (1 << 1)
|
||||||
|
|
||||||
#ifdef CONFIG_SET_RAW_ADV_DATA
|
#ifdef CONFIG_EXAMPLE_SET_RAW_ADV_DATA
|
||||||
static uint8_t raw_adv_data[] = {
|
static uint8_t raw_adv_data[] = {
|
||||||
0x02, 0x01, 0x06,
|
0x02, 0x01, 0x06,
|
||||||
0x02, 0x0a, 0xeb, 0x03, 0x03, 0xab, 0xcd
|
0x02, 0x0a, 0xeb, 0x03, 0x03, 0xab, 0xcd
|
||||||
@ -142,7 +142,7 @@ static esp_ble_adv_data_t scan_rsp_data = {
|
|||||||
.flag = (ESP_BLE_ADV_FLAG_GEN_DISC | ESP_BLE_ADV_FLAG_BREDR_NOT_SPT),
|
.flag = (ESP_BLE_ADV_FLAG_GEN_DISC | ESP_BLE_ADV_FLAG_BREDR_NOT_SPT),
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CONFIG_SET_RAW_ADV_DATA */
|
#endif /* CONFIG_EXAMPLE_SET_RAW_ADV_DATA */
|
||||||
|
|
||||||
static esp_ble_adv_params_t adv_params = {
|
static esp_ble_adv_params_t adv_params = {
|
||||||
.adv_int_min = 0x20,
|
.adv_int_min = 0x20,
|
||||||
@ -214,7 +214,7 @@ static uint8_t check_sum(uint8_t *addr, uint16_t count)
|
|||||||
static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
|
static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
|
||||||
{
|
{
|
||||||
switch (event) {
|
switch (event) {
|
||||||
#ifdef CONFIG_SET_RAW_ADV_DATA
|
#ifdef CONFIG_EXAMPLE_SET_RAW_ADV_DATA
|
||||||
case ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT:
|
case ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT:
|
||||||
adv_config_done &= (~adv_config_flag);
|
adv_config_done &= (~adv_config_flag);
|
||||||
if (adv_config_done==0){
|
if (adv_config_done==0){
|
||||||
@ -341,7 +341,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
|||||||
if (set_dev_name_ret){
|
if (set_dev_name_ret){
|
||||||
ESP_LOGE(GATTS_TAG, "set device name failed, error code = %x", set_dev_name_ret);
|
ESP_LOGE(GATTS_TAG, "set device name failed, error code = %x", set_dev_name_ret);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_SET_RAW_ADV_DATA
|
#ifdef CONFIG_EXAMPLE_SET_RAW_ADV_DATA
|
||||||
esp_err_t raw_adv_ret = esp_ble_gap_config_adv_data_raw(raw_adv_data, sizeof(raw_adv_data));
|
esp_err_t raw_adv_ret = esp_ble_gap_config_adv_data_raw(raw_adv_data, sizeof(raw_adv_data));
|
||||||
if (raw_adv_ret){
|
if (raw_adv_ret){
|
||||||
ESP_LOGE(GATTS_TAG, "config raw adv data failed, error code = %x ", raw_adv_ret);
|
ESP_LOGE(GATTS_TAG, "config raw adv data failed, error code = %x ", raw_adv_ret);
|
||||||
@ -384,7 +384,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESP_GATTS_WRITE_EVT: {
|
case ESP_GATTS_WRITE_EVT: {
|
||||||
#if (CONFIG_GATTS_NOTIFY_THROUGHPUT)
|
#if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT)
|
||||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %d, handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %d, handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||||
if (!param->write.is_prep){
|
if (!param->write.is_prep){
|
||||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len);
|
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len);
|
||||||
@ -425,9 +425,9 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* #if (CONFIG_GATTS_NOTIFY_THROUGHPUT) */
|
#endif /* #if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT) */
|
||||||
example_write_event_env(gatts_if, &a_prepare_write_env, param);
|
example_write_event_env(gatts_if, &a_prepare_write_env, param);
|
||||||
#if (CONFIG_GATTC_WRITE_THROUGHPUT)
|
#if (CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT)
|
||||||
if (param->write.handle == gl_profile_tab[PROFILE_A_APP_ID].char_handle) {
|
if (param->write.handle == gl_profile_tab[PROFILE_A_APP_ID].char_handle) {
|
||||||
// The last value byte is the checksum data, should used to check the data is received corrected or not.
|
// The last value byte is the checksum data, should used to check the data is received corrected or not.
|
||||||
if (param->write.value[param->write.len - 1] ==
|
if (param->write.value[param->write.len - 1] ==
|
||||||
@ -441,13 +441,13 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* #if (CONFIG_GATTC_WRITE_THROUGHPUT) */
|
#endif /* #if (CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT) */
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESP_GATTS_EXEC_WRITE_EVT:
|
case ESP_GATTS_EXEC_WRITE_EVT:
|
||||||
ESP_LOGI(GATTS_TAG,"ESP_GATTS_EXEC_WRITE_EVT");
|
ESP_LOGI(GATTS_TAG,"ESP_GATTS_EXEC_WRITE_EVT");
|
||||||
#if (CONFIG_GATTC_WRITE_THROUGHPUT)
|
#if (CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT)
|
||||||
if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_CANCEL) {
|
if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_CANCEL) {
|
||||||
if (write_len > a_prepare_write_env.prepare_len) {
|
if (write_len > a_prepare_write_env.prepare_len) {
|
||||||
write_len -= a_prepare_write_env.prepare_len;
|
write_len -= a_prepare_write_env.prepare_len;
|
||||||
@ -455,7 +455,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
|||||||
write_len = 0;
|
write_len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* #if (CONFIG_GATTC_WRITE_THROUGHPUT) */
|
#endif /* #if (CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT) */
|
||||||
esp_ble_gatts_send_response(gatts_if, param->write.conn_id, param->write.trans_id, ESP_GATT_OK, NULL);
|
esp_ble_gatts_send_response(gatts_if, param->write.conn_id, param->write.trans_id, ESP_GATT_OK, NULL);
|
||||||
example_exec_write_event_env(&a_prepare_write_env, param);
|
example_exec_write_event_env(&a_prepare_write_env, param);
|
||||||
break;
|
break;
|
||||||
@ -546,11 +546,11 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
|||||||
break;
|
break;
|
||||||
case ESP_GATTS_CONF_EVT:
|
case ESP_GATTS_CONF_EVT:
|
||||||
ESP_LOGI(GATTS_TAG, "ESP_GATTS_CONF_EVT, status %d", param->conf.status);
|
ESP_LOGI(GATTS_TAG, "ESP_GATTS_CONF_EVT, status %d", param->conf.status);
|
||||||
#if (CONFIG_GATTC_WRITE_THROUGHPUT)
|
#if (CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT)
|
||||||
start_time = false;
|
start_time = false;
|
||||||
current_time = 0;
|
current_time = 0;
|
||||||
write_len = 0;
|
write_len = 0;
|
||||||
#endif /* #if (CONFIG_GATTC_WRITE_THROUGHPUT) */
|
#endif /* #if (CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT) */
|
||||||
break;
|
break;
|
||||||
case ESP_GATTS_OPEN_EVT:
|
case ESP_GATTS_OPEN_EVT:
|
||||||
case ESP_GATTS_CANCEL_OPEN_EVT:
|
case ESP_GATTS_CANCEL_OPEN_EVT:
|
||||||
@ -558,14 +558,14 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
|||||||
case ESP_GATTS_LISTEN_EVT:
|
case ESP_GATTS_LISTEN_EVT:
|
||||||
break;
|
break;
|
||||||
case ESP_GATTS_CONGEST_EVT:
|
case ESP_GATTS_CONGEST_EVT:
|
||||||
#if (CONFIG_GATTS_NOTIFY_THROUGHPUT)
|
#if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT)
|
||||||
if (param->congest.congested) {
|
if (param->congest.congested) {
|
||||||
can_send_notify = false;
|
can_send_notify = false;
|
||||||
} else {
|
} else {
|
||||||
can_send_notify = true;
|
can_send_notify = true;
|
||||||
xSemaphoreGive(gatts_semaphore);
|
xSemaphoreGive(gatts_semaphore);
|
||||||
}
|
}
|
||||||
#endif /* #if (CONFIG_GATTS_NOTIFY_THROUGHPUT) */
|
#endif /* #if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT) */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -604,14 +604,14 @@ static void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_
|
|||||||
void throughput_server_task(void *param)
|
void throughput_server_task(void *param)
|
||||||
{
|
{
|
||||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||||
#if (CONFIG_GATTS_NOTIFY_THROUGHPUT)
|
#if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT)
|
||||||
uint8_t sum = check_sum(indicate_data, sizeof(indicate_data) - 1);
|
uint8_t sum = check_sum(indicate_data, sizeof(indicate_data) - 1);
|
||||||
// Added the check sum in the last data value.
|
// Added the check sum in the last data value.
|
||||||
indicate_data[GATTS_NOTIFY_LEN - 1] = sum;
|
indicate_data[GATTS_NOTIFY_LEN - 1] = sum;
|
||||||
#endif /* #if (CONFIG_GATTS_NOTIFY_THROUGHPUT) */
|
#endif /* #if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT) */
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
#if (CONFIG_GATTS_NOTIFY_THROUGHPUT)
|
#if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT)
|
||||||
if (!can_send_notify) {
|
if (!can_send_notify) {
|
||||||
int res = xSemaphoreTake(gatts_semaphore, portMAX_DELAY);
|
int res = xSemaphoreTake(gatts_semaphore, portMAX_DELAY);
|
||||||
assert(res == pdTRUE);
|
assert(res == pdTRUE);
|
||||||
@ -622,9 +622,9 @@ void throughput_server_task(void *param)
|
|||||||
sizeof(indicate_data), indicate_data, false);
|
sizeof(indicate_data), indicate_data, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* #if (CONFIG_GATTS_NOTIFY_THROUGHPUT) */
|
#endif /* #if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT) */
|
||||||
|
|
||||||
#if (CONFIG_GATTC_WRITE_THROUGHPUT)
|
#if (CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT)
|
||||||
uint32_t bit_rate = 0;
|
uint32_t bit_rate = 0;
|
||||||
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||||
if (start_time) {
|
if (start_time) {
|
||||||
@ -635,7 +635,7 @@ void throughput_server_task(void *param)
|
|||||||
} else {
|
} else {
|
||||||
ESP_LOGI(GATTS_TAG, "GATTC write Bit rate = 0 Btye/s, = 0 bit/s");
|
ESP_LOGI(GATTS_TAG, "GATTC write Bit rate = 0 Btye/s, = 0 bit/s");
|
||||||
}
|
}
|
||||||
#endif /* #if (CONFIG_GATTC_WRITE_THROUGHPUT) */
|
#endif /* #if (CONFIG_EXAMPLE_GATTC_WRITE_THROUGHPUT) */
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -699,12 +699,12 @@ void app_main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
xTaskCreate(&throughput_server_task, "throughput_server_task", 4048, NULL, 15, NULL);
|
xTaskCreate(&throughput_server_task, "throughput_server_task", 4048, NULL, 15, NULL);
|
||||||
#if (CONFIG_GATTS_NOTIFY_THROUGHPUT)
|
#if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT)
|
||||||
gatts_semaphore = xSemaphoreCreateMutex();
|
gatts_semaphore = xSemaphoreCreateMutex();
|
||||||
if (!gatts_semaphore) {
|
if (!gatts_semaphore) {
|
||||||
ESP_LOGE(GATTS_TAG, "%s, init fail, the gatts semaphore create fail.", __func__);
|
ESP_LOGE(GATTS_TAG, "%s, init fail, the gatts semaphore create fail.", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* #if (CONFIG_GATTS_NOTIFY_THROUGHPUT) */
|
#endif /* #if (CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT) */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y
|
|||||||
CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=
|
CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=
|
||||||
CONFIG_BTDM_CTRL_MODE_BTDM=
|
CONFIG_BTDM_CTRL_MODE_BTDM=
|
||||||
CONFIG_BTDM_CTRL_BLE_MAX_CONN=9
|
CONFIG_BTDM_CTRL_BLE_MAX_CONN=9
|
||||||
CONFIG_GATTS_NOTIFY_THROUGHPUT=y
|
CONFIG_EXAMPLE_GATTS_NOTIFY_THROUGHPUT=y
|
||||||
CONFIG_BTDM_MODEM_SLEEP=n
|
CONFIG_BTDM_MODEM_SLEEP=n
|
||||||
CONFIG_BTDM_CTRL_PINNED_TO_CORE_1=y
|
CONFIG_BTDM_CTRL_PINNED_TO_CORE_1=y
|
||||||
CONFIG_BTDM_CTRL_PINNED_TO_CORE=1
|
CONFIG_BTDM_CTRL_PINNED_TO_CORE=1
|
||||||
|
@ -31,25 +31,25 @@ menu "Example Connection Configuration"
|
|||||||
Can be left blank if the network has no security set.
|
Can be left blank if the network has no security set.
|
||||||
|
|
||||||
|
|
||||||
choice PHY_MODEL
|
choice EXAMPLE_PHY_MODEL
|
||||||
prompt "Ethernet PHY"
|
prompt "Ethernet PHY"
|
||||||
depends on EXAMPLE_CONNECT_ETHERNET
|
depends on EXAMPLE_CONNECT_ETHERNET
|
||||||
default CONFIG_PHY_TLK110
|
default EXAMPLE_PHY_TLK110
|
||||||
help
|
help
|
||||||
Select the PHY driver to use for the example.
|
Select the PHY driver to use for the example.
|
||||||
|
|
||||||
config PHY_IP101
|
config EXAMPLE_PHY_IP101
|
||||||
bool "IP101"
|
bool "IP101"
|
||||||
help
|
help
|
||||||
IP101 is a single port 10/100 MII/RMII/TP/Fiber Fast Ethernet Transceiver.
|
IP101 is a single port 10/100 MII/RMII/TP/Fiber Fast Ethernet Transceiver.
|
||||||
Goto http://www.icplus.com.tw/pp-IP101G.html for more information about it.
|
Goto http://www.icplus.com.tw/pp-IP101G.html for more information about it.
|
||||||
|
|
||||||
config PHY_TLK110
|
config EXAMPLE_PHY_TLK110
|
||||||
bool "TI TLK110 PHY"
|
bool "TI TLK110 PHY"
|
||||||
help
|
help
|
||||||
Select this to use the TI TLK110 PHY
|
Select this to use the TI TLK110 PHY
|
||||||
|
|
||||||
config PHY_LAN8720
|
config EXAMPLE_PHY_LAN8720
|
||||||
bool "Microchip LAN8720 PHY"
|
bool "Microchip LAN8720 PHY"
|
||||||
help
|
help
|
||||||
Select this to use the Microchip LAN8720 PHY
|
Select this to use the Microchip LAN8720 PHY
|
||||||
@ -57,7 +57,7 @@ menu "Example Connection Configuration"
|
|||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
|
||||||
config PHY_ADDRESS
|
config EXAMPLE_PHY_ADDRESS
|
||||||
int "PHY Address (0-31)"
|
int "PHY Address (0-31)"
|
||||||
depends on EXAMPLE_CONNECT_ETHERNET
|
depends on EXAMPLE_CONNECT_ETHERNET
|
||||||
default 31
|
default 31
|
||||||
@ -68,32 +68,32 @@ menu "Example Connection Configuration"
|
|||||||
LAN8720 default 1 or 0
|
LAN8720 default 1 or 0
|
||||||
|
|
||||||
|
|
||||||
choice PHY_CLOCK_MODE
|
choice EXAMPLE_PHY_CLOCK_MODE
|
||||||
prompt "EMAC clock mode"
|
prompt "EMAC clock mode"
|
||||||
depends on EXAMPLE_CONNECT_ETHERNET
|
depends on EXAMPLE_CONNECT_ETHERNET
|
||||||
default PHY_CLOCK_GPIO0_IN
|
default EXAMPLE_PHY_CLOCK_GPIO0_IN
|
||||||
help
|
help
|
||||||
Select external (input on GPIO0) or internal (output on GPIO16 or GPIO17) clock
|
Select external (input on GPIO0) or internal (output on GPIO16 or GPIO17) clock
|
||||||
|
|
||||||
|
|
||||||
config PHY_CLOCK_GPIO0_IN
|
config EXAMPLE_PHY_CLOCK_GPIO0_IN
|
||||||
bool "GPIO0 input"
|
bool "GPIO0 input"
|
||||||
depends on EXAMPLE_CONNECT_ETHERNET
|
depends on EXAMPLE_CONNECT_ETHERNET
|
||||||
help
|
help
|
||||||
Input of 50MHz PHY clock on GPIO0.
|
Input of 50MHz PHY clock on GPIO0.
|
||||||
|
|
||||||
config PHY_CLOCK_GPIO0_OUT
|
config EXAMPLE_PHY_CLOCK_GPIO0_OUT
|
||||||
bool "GPIO0 Output"
|
bool "GPIO0 Output"
|
||||||
help
|
help
|
||||||
Output the internal 50MHz RMII clock on GPIO0.
|
Output the internal 50MHz RMII clock on GPIO0.
|
||||||
|
|
||||||
config PHY_CLOCK_GPIO16_OUT
|
config EXAMPLE_PHY_CLOCK_GPIO16_OUT
|
||||||
bool "GPIO16 output"
|
bool "GPIO16 output"
|
||||||
depends on EXAMPLE_CONNECT_ETHERNET
|
depends on EXAMPLE_CONNECT_ETHERNET
|
||||||
help
|
help
|
||||||
Output the internal 50MHz APLL clock on GPIO16.
|
Output the internal 50MHz APLL clock on GPIO16.
|
||||||
|
|
||||||
config PHY_CLOCK_GPIO17_OUT
|
config EXAMPLE_PHY_CLOCK_GPIO17_OUT
|
||||||
bool "GPIO17 output (inverted)"
|
bool "GPIO17 output (inverted)"
|
||||||
depends on EXAMPLE_CONNECT_ETHERNET
|
depends on EXAMPLE_CONNECT_ETHERNET
|
||||||
help
|
help
|
||||||
@ -101,16 +101,16 @@ menu "Example Connection Configuration"
|
|||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config PHY_CLOCK_MODE
|
config EXAMPLE_PHY_CLOCK_MODE
|
||||||
int
|
int
|
||||||
depends on EXAMPLE_CONNECT_ETHERNET
|
depends on EXAMPLE_CONNECT_ETHERNET
|
||||||
default 0 if PHY_CLOCK_GPIO0_IN
|
default 0 if EXAMPLE_PHY_CLOCK_GPIO0_IN
|
||||||
default 1 if PHY_CLOCK_GPIO0_OUT
|
default 1 if EXAMPLE_PHY_CLOCK_GPIO0_OUT
|
||||||
default 2 if PHY_CLOCK_GPIO16_OUT
|
default 2 if EXAMPLE_PHY_CLOCK_GPIO16_OUT
|
||||||
default 3 if PHY_CLOCK_GPIO17_OUT
|
default 3 if EXAMPLE_PHY_CLOCK_GPIO17_OUT
|
||||||
|
|
||||||
|
|
||||||
config PHY_USE_POWER_PIN
|
config EXAMPLE_PHY_USE_POWER_PIN
|
||||||
bool "Use PHY Power (enable/disable) pin"
|
bool "Use PHY Power (enable/disable) pin"
|
||||||
depends on EXAMPLE_CONNECT_ETHERNET
|
depends on EXAMPLE_CONNECT_ETHERNET
|
||||||
default y
|
default y
|
||||||
@ -118,16 +118,16 @@ menu "Example Connection Configuration"
|
|||||||
Use a GPIO "power pin" to power the PHY on/off during operation.
|
Use a GPIO "power pin" to power the PHY on/off during operation.
|
||||||
Consult the example README for more details
|
Consult the example README for more details
|
||||||
|
|
||||||
config PHY_POWER_PIN
|
config EXAMPLE_PHY_POWER_PIN
|
||||||
int "PHY Power GPIO"
|
int "PHY Power GPIO"
|
||||||
depends on EXAMPLE_CONNECT_ETHERNET
|
depends on EXAMPLE_CONNECT_ETHERNET
|
||||||
default 17
|
default 17
|
||||||
range 0 33
|
range 0 33
|
||||||
depends on PHY_USE_POWER_PIN
|
depends on EXAMPLE_PHY_USE_POWER_PIN
|
||||||
help
|
help
|
||||||
GPIO number to use for powering on/off the PHY.
|
GPIO number to use for powering on/off the PHY.
|
||||||
|
|
||||||
config PHY_SMI_MDC_PIN
|
config EXAMPLE_PHY_SMI_MDC_PIN
|
||||||
int "SMI MDC Pin"
|
int "SMI MDC Pin"
|
||||||
depends on EXAMPLE_CONNECT_ETHERNET
|
depends on EXAMPLE_CONNECT_ETHERNET
|
||||||
default 23
|
default 23
|
||||||
@ -135,7 +135,7 @@ menu "Example Connection Configuration"
|
|||||||
help
|
help
|
||||||
GPIO number to use for SMI clock output MDC to PHY.
|
GPIO number to use for SMI clock output MDC to PHY.
|
||||||
|
|
||||||
config PHY_SMI_MDIO_PIN
|
config EXAMPLE_PHY_SMI_MDIO_PIN
|
||||||
int "SMI MDIO Pin"
|
int "SMI MDIO Pin"
|
||||||
depends on EXAMPLE_CONNECT_ETHERNET
|
depends on EXAMPLE_CONNECT_ETHERNET
|
||||||
default 18
|
default 18
|
||||||
|
@ -160,23 +160,23 @@ static void stop()
|
|||||||
|
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
|
|
||||||
#ifdef CONFIG_PHY_LAN8720
|
#ifdef CONFIG_EXAMPLE_PHY_LAN8720
|
||||||
#include "eth_phy/phy_lan8720.h"
|
#include "eth_phy/phy_lan8720.h"
|
||||||
#define DEFAULT_ETHERNET_PHY_CONFIG phy_lan8720_default_ethernet_config
|
#define DEFAULT_ETHERNET_PHY_CONFIG phy_lan8720_default_ethernet_config
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_PHY_TLK110
|
#ifdef CONFIG_EXAMPLE_PHY_TLK110
|
||||||
#include "eth_phy/phy_tlk110.h"
|
#include "eth_phy/phy_tlk110.h"
|
||||||
#define DEFAULT_ETHERNET_PHY_CONFIG phy_tlk110_default_ethernet_config
|
#define DEFAULT_ETHERNET_PHY_CONFIG phy_tlk110_default_ethernet_config
|
||||||
#elif CONFIG_PHY_IP101
|
#elif CONFIG_EXAMPLE_PHY_IP101
|
||||||
#include "eth_phy/phy_ip101.h"
|
#include "eth_phy/phy_ip101.h"
|
||||||
#define DEFAULT_ETHERNET_PHY_CONFIG phy_ip101_default_ethernet_config
|
#define DEFAULT_ETHERNET_PHY_CONFIG phy_ip101_default_ethernet_config
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PIN_PHY_POWER CONFIG_PHY_POWER_PIN
|
#define PIN_PHY_POWER CONFIG_EXAMPLE_PHY_POWER_PIN
|
||||||
#define PIN_SMI_MDC CONFIG_PHY_SMI_MDC_PIN
|
#define PIN_SMI_MDC CONFIG_EXAMPLE_PHY_SMI_MDC_PIN
|
||||||
#define PIN_SMI_MDIO CONFIG_PHY_SMI_MDIO_PIN
|
#define PIN_SMI_MDIO CONFIG_EXAMPLE_PHY_SMI_MDIO_PIN
|
||||||
|
|
||||||
#ifdef CONFIG_PHY_USE_POWER_PIN
|
#ifdef CONFIG_EXAMPLE_PHY_USE_POWER_PIN
|
||||||
/**
|
/**
|
||||||
* @brief re-define power enable func for phy
|
* @brief re-define power enable func for phy
|
||||||
*
|
*
|
||||||
@ -252,12 +252,12 @@ static void on_eth_event(void* arg, esp_event_base_t event_base,
|
|||||||
static void start()
|
static void start()
|
||||||
{
|
{
|
||||||
eth_config_t config = DEFAULT_ETHERNET_PHY_CONFIG;
|
eth_config_t config = DEFAULT_ETHERNET_PHY_CONFIG;
|
||||||
config.phy_addr = CONFIG_PHY_ADDRESS;
|
config.phy_addr = CONFIG_EXAMPLE_PHY_ADDRESS;
|
||||||
config.gpio_config = eth_gpio_config_rmii;
|
config.gpio_config = eth_gpio_config_rmii;
|
||||||
config.tcpip_input = tcpip_adapter_eth_input;
|
config.tcpip_input = tcpip_adapter_eth_input;
|
||||||
config.clock_mode = CONFIG_PHY_CLOCK_MODE;
|
config.clock_mode = CONFIG_EXAMPLE_PHY_CLOCK_MODE;
|
||||||
|
|
||||||
#ifdef CONFIG_PHY_USE_POWER_PIN
|
#ifdef CONFIG_EXAMPLE_PHY_USE_POWER_PIN
|
||||||
/* Replace the default 'power enable' function with an example-specific one
|
/* Replace the default 'power enable' function with an example-specific one
|
||||||
that toggles a power GPIO. */
|
that toggles a power GPIO. */
|
||||||
config.phy_power_enable = phy_device_power_enable_via_gpio;
|
config.phy_power_enable = phy_device_power_enable_via_gpio;
|
||||||
|
@ -1,61 +1,61 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
choice ADC2_EXAMPLE_CHANNEL
|
choice EXAMPLE_ADC2_CHANNEL
|
||||||
bool "ADC2 Channel Num"
|
bool "ADC2 Channel Num"
|
||||||
default ADC2_EXAMPLE_CHANNEL_7
|
default EXAMPLE_ADC2_CHANNEL_7
|
||||||
help
|
help
|
||||||
The channel of ADC2 used in this example.
|
The channel of ADC2 used in this example.
|
||||||
|
|
||||||
config ADC2_EXAMPLE_CHANNEL_0
|
config EXAMPLE_ADC2_CHANNEL_0
|
||||||
bool "ADC2 Channel 0 (GPIO 4)"
|
bool "ADC2 Channel 0 (GPIO 4)"
|
||||||
config ADC2_EXAMPLE_CHANNEL_1
|
config EXAMPLE_ADC2_CHANNEL_1
|
||||||
bool "ADC2 Channel 1 (GPIO 0)"
|
bool "ADC2 Channel 1 (GPIO 0)"
|
||||||
config ADC2_EXAMPLE_CHANNEL_2
|
config EXAMPLE_ADC2_CHANNEL_2
|
||||||
bool "ADC2 Channel 2 (GPIO 2)"
|
bool "ADC2 Channel 2 (GPIO 2)"
|
||||||
config ADC2_EXAMPLE_CHANNEL_3
|
config EXAMPLE_ADC2_CHANNEL_3
|
||||||
bool "ADC2 Channel 3 (GPIO 15)"
|
bool "ADC2 Channel 3 (GPIO 15)"
|
||||||
config ADC2_EXAMPLE_CHANNEL_4
|
config EXAMPLE_ADC2_CHANNEL_4
|
||||||
bool "ADC2 Channel 4 (GPIO 13)"
|
bool "ADC2 Channel 4 (GPIO 13)"
|
||||||
config ADC2_EXAMPLE_CHANNEL_5
|
config EXAMPLE_ADC2_CHANNEL_5
|
||||||
bool "ADC2 Channel 5 (GPIO 12)"
|
bool "ADC2 Channel 5 (GPIO 12)"
|
||||||
config ADC2_EXAMPLE_CHANNEL_6
|
config EXAMPLE_ADC2_CHANNEL_6
|
||||||
bool "ADC2 Channel 6 (GPIO 14)"
|
bool "ADC2 Channel 6 (GPIO 14)"
|
||||||
config ADC2_EXAMPLE_CHANNEL_7
|
config EXAMPLE_ADC2_CHANNEL_7
|
||||||
bool "ADC2 Channel 7 (GPIO 27)"
|
bool "ADC2 Channel 7 (GPIO 27)"
|
||||||
config ADC2_EXAMPLE_CHANNEL_8
|
config EXAMPLE_ADC2_CHANNEL_8
|
||||||
bool "ADC2 Channel 8 (GPIO 25)"
|
bool "ADC2 Channel 8 (GPIO 25)"
|
||||||
config ADC2_EXAMPLE_CHANNEL_9
|
config EXAMPLE_ADC2_CHANNEL_9
|
||||||
bool "ADC2 Channel 9 (GPIO 26)"
|
bool "ADC2 Channel 9 (GPIO 26)"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config ADC2_EXAMPLE_CHANNEL
|
config EXAMPLE_ADC2_CHANNEL
|
||||||
int
|
int
|
||||||
default 0 if ADC2_EXAMPLE_CHANNEL_0
|
default 0 if EXAMPLE_ADC2_CHANNEL_0
|
||||||
default 1 if ADC2_EXAMPLE_CHANNEL_1
|
default 1 if EXAMPLE_ADC2_CHANNEL_1
|
||||||
default 2 if ADC2_EXAMPLE_CHANNEL_2
|
default 2 if EXAMPLE_ADC2_CHANNEL_2
|
||||||
default 3 if ADC2_EXAMPLE_CHANNEL_3
|
default 3 if EXAMPLE_ADC2_CHANNEL_3
|
||||||
default 4 if ADC2_EXAMPLE_CHANNEL_4
|
default 4 if EXAMPLE_ADC2_CHANNEL_4
|
||||||
default 5 if ADC2_EXAMPLE_CHANNEL_5
|
default 5 if EXAMPLE_ADC2_CHANNEL_5
|
||||||
default 6 if ADC2_EXAMPLE_CHANNEL_6
|
default 6 if EXAMPLE_ADC2_CHANNEL_6
|
||||||
default 7 if ADC2_EXAMPLE_CHANNEL_7
|
default 7 if EXAMPLE_ADC2_CHANNEL_7
|
||||||
default 8 if ADC2_EXAMPLE_CHANNEL_8
|
default 8 if EXAMPLE_ADC2_CHANNEL_8
|
||||||
default 9 if ADC2_EXAMPLE_CHANNEL_9
|
default 9 if EXAMPLE_ADC2_CHANNEL_9
|
||||||
|
|
||||||
choice DAC_EXAMPLE_CHANNEL
|
choice EXAMPLE_DAC_CHANNEL
|
||||||
bool "DAC Channel Num"
|
bool "DAC Channel Num"
|
||||||
default DAC_EXAMPLE_CHANNEL_1
|
default EXAMPLE_DAC_CHANNEL_1
|
||||||
help
|
help
|
||||||
The channel of DAC used in this example.
|
The channel of DAC used in this example.
|
||||||
|
|
||||||
config DAC_EXAMPLE_CHANNEL_1
|
config EXAMPLE_DAC_CHANNEL_1
|
||||||
bool "DAC Channel 1 (GPIO25)"
|
bool "DAC Channel 1 (GPIO25)"
|
||||||
config DAC_EXAMPLE_CHANNEL_2
|
config EXAMPLE_DAC_CHANNEL_2
|
||||||
bool "DAC Channel 2 (GPIO26)"
|
bool "DAC Channel 2 (GPIO26)"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config DAC_EXAMPLE_CHANNEL
|
config EXAMPLE_DAC_CHANNEL
|
||||||
int
|
int
|
||||||
default 1 if DAC_EXAMPLE_CHANNEL_1
|
default 1 if EXAMPLE_DAC_CHANNEL_1
|
||||||
default 2 if DAC_EXAMPLE_CHANNEL_2
|
default 2 if EXAMPLE_DAC_CHANNEL_2
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
#include "esp_adc_cal.h"
|
#include "esp_adc_cal.h"
|
||||||
|
|
||||||
#define DAC_EXAMPLE_CHANNEL CONFIG_DAC_EXAMPLE_CHANNEL
|
#define DAC_EXAMPLE_CHANNEL CONFIG_EXAMPLE_DAC_CHANNEL
|
||||||
#define ADC2_EXAMPLE_CHANNEL CONFIG_ADC2_EXAMPLE_CHANNEL
|
#define ADC2_EXAMPLE_CHANNEL CONFIG_EXAMPLE_ADC2_CHANNEL
|
||||||
|
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config STORE_HISTORY
|
config EXAMPLE_STORE_HISTORY
|
||||||
bool "Store command history in flash"
|
bool "Store command history in flash"
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
@ -8,14 +8,14 @@ menu "Example Configuration"
|
|||||||
command history. If this option is enabled, initalizes a FAT filesystem
|
command history. If this option is enabled, initalizes a FAT filesystem
|
||||||
and uses it to store command history.
|
and uses it to store command history.
|
||||||
|
|
||||||
config MAX_CMD_ARGUMENTS
|
config EXAMPLE_MAX_CMD_ARGUMENTS
|
||||||
int "Maximum number of command line arguments"
|
int "Maximum number of command line arguments"
|
||||||
default 16
|
default 16
|
||||||
range 8 256
|
range 8 256
|
||||||
help
|
help
|
||||||
maximum number of command line arguments to parse
|
maximum number of command line arguments to parse
|
||||||
|
|
||||||
config MAX_CMD_LENGTH
|
config EXAMPLE_MAX_CMD_LENGTH
|
||||||
int "Command line buffer length"
|
int "Command line buffer length"
|
||||||
default 256
|
default 256
|
||||||
range 256 512
|
range 256 512
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
static const char *TAG = "i2c-tools";
|
static const char *TAG = "i2c-tools";
|
||||||
|
|
||||||
#if CONFIG_STORE_HISTORY
|
#if CONFIG_EXAMPLE_STORE_HISTORY
|
||||||
|
|
||||||
#define MOUNT_PATH "/data"
|
#define MOUNT_PATH "/data"
|
||||||
#define HISTORY_PATH MOUNT_PATH "/history.txt"
|
#define HISTORY_PATH MOUNT_PATH "/history.txt"
|
||||||
@ -42,7 +42,7 @@ static void initialize_filesystem()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // CONFIG_STORE_HISTORY
|
#endif // CONFIG_EXAMPLE_STORE_HISTORY
|
||||||
|
|
||||||
static void initialize_nvs()
|
static void initialize_nvs()
|
||||||
{
|
{
|
||||||
@ -85,8 +85,8 @@ static void initialize_console()
|
|||||||
|
|
||||||
/* Initialize the console */
|
/* Initialize the console */
|
||||||
esp_console_config_t console_config = {
|
esp_console_config_t console_config = {
|
||||||
.max_cmdline_args = CONFIG_MAX_CMD_ARGUMENTS,
|
.max_cmdline_args = CONFIG_EXAMPLE_MAX_CMD_ARGUMENTS,
|
||||||
.max_cmdline_length = CONFIG_MAX_CMD_LENGTH,
|
.max_cmdline_length = CONFIG_EXAMPLE_MAX_CMD_LENGTH,
|
||||||
#if CONFIG_LOG_COLORS
|
#if CONFIG_LOG_COLORS
|
||||||
.hint_color = atoi(LOG_COLOR_CYAN)
|
.hint_color = atoi(LOG_COLOR_CYAN)
|
||||||
#endif
|
#endif
|
||||||
@ -103,7 +103,7 @@ static void initialize_console()
|
|||||||
/* Set command history size */
|
/* Set command history size */
|
||||||
linenoiseHistorySetMaxLen(100);
|
linenoiseHistorySetMaxLen(100);
|
||||||
|
|
||||||
#if CONFIG_STORE_HISTORY
|
#if CONFIG_EXAMPLE_STORE_HISTORY
|
||||||
/* Load command history from filesystem */
|
/* Load command history from filesystem */
|
||||||
linenoiseHistoryLoad(HISTORY_PATH);
|
linenoiseHistoryLoad(HISTORY_PATH);
|
||||||
#endif
|
#endif
|
||||||
@ -113,7 +113,7 @@ void app_main()
|
|||||||
{
|
{
|
||||||
initialize_nvs();
|
initialize_nvs();
|
||||||
|
|
||||||
#if CONFIG_STORE_HISTORY
|
#if CONFIG_EXAMPLE_STORE_HISTORY
|
||||||
initialize_filesystem();
|
initialize_filesystem();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ void app_main()
|
|||||||
}
|
}
|
||||||
/* Add the command to the history */
|
/* Add the command to the history */
|
||||||
linenoiseHistoryAdd(line);
|
linenoiseHistoryAdd(line);
|
||||||
#if CONFIG_STORE_HISTORY
|
#if CONFIG_EXAMPLE_STORE_HISTORY
|
||||||
/* Save command history to filesystem */
|
/* Save command history to filesystem */
|
||||||
linenoiseHistorySave(HISTORY_PATH);
|
linenoiseHistorySave(HISTORY_PATH);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config SDIO_EXAMPLE_OVER_SPI
|
config EXAMPLE_SDIO_OVER_SPI
|
||||||
bool "Host use SPI bus to communicate with slave"
|
bool "Host use SPI bus to communicate with slave"
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
If this is set, the host tries using SPI bus to communicate with slave.
|
If this is set, the host tries using SPI bus to communicate with slave.
|
||||||
Otherwise, the standarad SD bus is used.
|
Otherwise, the standarad SD bus is used.
|
||||||
|
|
||||||
config SDIO_EXAMPLE_4BIT
|
config EXAMPLE_SDIO_4BIT
|
||||||
bool "Host tries using 4-bit mode to communicate with slave"
|
bool "Host tries using 4-bit mode to communicate with slave"
|
||||||
default n
|
default n
|
||||||
depends on !SDIO_EXAMPLE_OVER_SPI
|
depends on !EXAMPLE_SDIO_OVER_SPI
|
||||||
help
|
help
|
||||||
If this is set, the host tries using 4-bit mode to communicate with
|
If this is set, the host tries using 4-bit mode to communicate with
|
||||||
slave. If failed, the communication falls back to 1-bit mode.
|
slave. If failed, the communication falls back to 1-bit mode.
|
||||||
@ -21,7 +21,7 @@ menu "Example Configuration"
|
|||||||
Note that 4-bit mode is not compatible (by default) if the slave is
|
Note that 4-bit mode is not compatible (by default) if the slave is
|
||||||
using 3.3V flash which requires a pull-down on the MTDI pin.
|
using 3.3V flash which requires a pull-down on the MTDI pin.
|
||||||
|
|
||||||
config SDIO_EXAMPLE_HIGHSPEED
|
config EXAMPLE_SDIO_HIGHSPEED
|
||||||
bool "Host tries using HS mode to communicate with slave"
|
bool "Host tries using HS mode to communicate with slave"
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
|
@ -121,7 +121,7 @@ esp_err_t slave_reset(esp_slave_context_t *context)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SDIO_EXAMPLE_OVER_SPI
|
#ifdef CONFIG_EXAMPLE_SDIO_OVER_SPI
|
||||||
static void gpio_d2_set_high()
|
static void gpio_d2_set_high()
|
||||||
{
|
{
|
||||||
gpio_config_t d2_config = {
|
gpio_config_t d2_config = {
|
||||||
@ -139,9 +139,9 @@ esp_err_t slave_init(esp_slave_context_t *context)
|
|||||||
{
|
{
|
||||||
esp_err_t err;
|
esp_err_t err;
|
||||||
/* Probe */
|
/* Probe */
|
||||||
#ifndef CONFIG_SDIO_EXAMPLE_OVER_SPI
|
#ifndef CONFIG_EXAMPLE_SDIO_OVER_SPI
|
||||||
sdmmc_host_t config = SDMMC_HOST_DEFAULT();
|
sdmmc_host_t config = SDMMC_HOST_DEFAULT();
|
||||||
#ifdef CONFIG_SDIO_EXAMPLE_4BIT
|
#ifdef CONFIG_EXAMPLE_SDIO_4BIT
|
||||||
ESP_LOGI(TAG, "Probe using SD 4-bit...\n");
|
ESP_LOGI(TAG, "Probe using SD 4-bit...\n");
|
||||||
config.flags = SDMMC_HOST_FLAG_4BIT;
|
config.flags = SDMMC_HOST_FLAG_4BIT;
|
||||||
#else
|
#else
|
||||||
@ -149,7 +149,7 @@ esp_err_t slave_init(esp_slave_context_t *context)
|
|||||||
config.flags = SDMMC_HOST_FLAG_1BIT;
|
config.flags = SDMMC_HOST_FLAG_1BIT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SDIO_EXAMPLE_HIGHSPEED
|
#ifdef CONFIG_EXAMPLE_SDIO_HIGHSPEED
|
||||||
config.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
|
config.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
|
||||||
#else
|
#else
|
||||||
config.max_freq_khz = SDMMC_FREQ_DEFAULT;
|
config.max_freq_khz = SDMMC_FREQ_DEFAULT;
|
||||||
|
@ -4,7 +4,7 @@ EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_
|
|||||||
|
|
||||||
include $(IDF_PATH)/make/project.mk
|
include $(IDF_PATH)/make/project.mk
|
||||||
|
|
||||||
ifdef CONFIG_WEB_DEPLOY_SF
|
ifdef CONFIG_EXAMPLE_WEB_DEPLOY_SF
|
||||||
WEB_SRC_DIR = $(shell pwd)/front/web-demo
|
WEB_SRC_DIR = $(shell pwd)/front/web-demo
|
||||||
ifneq ($(wildcard $(WEB_SRC_DIR)/dist/.*),)
|
ifneq ($(wildcard $(WEB_SRC_DIR)/dist/.*),)
|
||||||
$(eval $(call spiffs_create_partition_image,www,$(WEB_SRC_DIR)/dist,FLASH_IN_PROJECT))
|
$(eval $(call spiffs_create_partition_image,www,$(WEB_SRC_DIR)/dist,FLASH_IN_PROJECT))
|
||||||
|
@ -3,7 +3,7 @@ set(COMPONENT_ADD_INCLUDEDIRS ".")
|
|||||||
|
|
||||||
register_component()
|
register_component()
|
||||||
|
|
||||||
if(CONFIG_WEB_DEPLOY_SF)
|
if(CONFIG_EXAMPLE_WEB_DEPLOY_SF)
|
||||||
set(WEB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../front/web-demo")
|
set(WEB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../front/web-demo")
|
||||||
if(EXISTS ${WEB_SRC_DIR}/dist)
|
if(EXISTS ${WEB_SRC_DIR}/dist)
|
||||||
spiffs_create_partition_image(www ${WEB_SRC_DIR}/dist FLASH_IN_PROJECT)
|
spiffs_create_partition_image(www ${WEB_SRC_DIR}/dist FLASH_IN_PROJECT)
|
||||||
|
@ -1,39 +1,39 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config MDNS_HOST_NAME
|
config EXAMPLE_MDNS_HOST_NAME
|
||||||
string "mDNS Host Name"
|
string "mDNS Host Name"
|
||||||
default "esp-home"
|
default "esp-home"
|
||||||
help
|
help
|
||||||
Specify the domain name used in the mDNS service.
|
Specify the domain name used in the mDNS service.
|
||||||
Note that webpage also take it as a part of URL where it will send GET/POST requests to.
|
Note that webpage also take it as a part of URL where it will send GET/POST requests to.
|
||||||
|
|
||||||
choice WEB_DEPLOY_MODE
|
choice EXAMPLE_WEB_DEPLOY_MODE
|
||||||
prompt "Website deploy mode"
|
prompt "Website deploy mode"
|
||||||
default WEB_DEPLOY_SEMIHOST
|
default EXAMPLE_WEB_DEPLOY_SEMIHOST
|
||||||
help
|
help
|
||||||
Select website deploy mode.
|
Select website deploy mode.
|
||||||
You can deploy website to host, and ESP32 will retrieve them in a semihost way (JTAG is needed).
|
You can deploy website to host, and ESP32 will retrieve them in a semihost way (JTAG is needed).
|
||||||
You can deploy website to SD card or SPI flash, and ESP32 will retrieve them via SDIO/SPI interface.
|
You can deploy website to SD card or SPI flash, and ESP32 will retrieve them via SDIO/SPI interface.
|
||||||
Detailed operation steps are listed in the example README file.
|
Detailed operation steps are listed in the example README file.
|
||||||
config WEB_DEPLOY_SEMIHOST
|
config EXAMPLE_WEB_DEPLOY_SEMIHOST
|
||||||
bool "Deploy website to host (JTAG is needed)"
|
bool "Deploy website to host (JTAG is needed)"
|
||||||
help
|
help
|
||||||
Deploy website to host.
|
Deploy website to host.
|
||||||
It is recommended to choose this mode during developing.
|
It is recommended to choose this mode during developing.
|
||||||
config WEB_DEPLOY_SD
|
config EXAMPLE_WEB_DEPLOY_SD
|
||||||
bool "Deploy website to SD card"
|
bool "Deploy website to SD card"
|
||||||
help
|
help
|
||||||
Deploy website to SD card.
|
Deploy website to SD card.
|
||||||
Choose this production mode if the size of website is too large (bigger than 2MB).
|
Choose this production mode if the size of website is too large (bigger than 2MB).
|
||||||
config WEB_DEPLOY_SF
|
config EXAMPLE_WEB_DEPLOY_SF
|
||||||
bool "Deploy website to SPI Nor Flash"
|
bool "Deploy website to SPI Nor Flash"
|
||||||
help
|
help
|
||||||
Deploy website to SPI Nor Flash.
|
Deploy website to SPI Nor Flash.
|
||||||
Choose this production mode if the size of website is small (less than 2MB).
|
Choose this production mode if the size of website is small (less than 2MB).
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
if WEB_DEPLOY_SEMIHOST
|
if EXAMPLE_WEB_DEPLOY_SEMIHOST
|
||||||
config HOST_PATH_TO_MOUNT
|
config EXAMPLE_HOST_PATH_TO_MOUNT
|
||||||
string "Host path to mount (e.g. absolute path to web dist directory)"
|
string "Host path to mount (e.g. absolute path to web dist directory)"
|
||||||
default "PATH-TO-WEB-DIST_DIR"
|
default "PATH-TO-WEB-DIST_DIR"
|
||||||
help
|
help
|
||||||
@ -41,7 +41,7 @@ menu "Example Configuration"
|
|||||||
Note that only absolute path is acceptable.
|
Note that only absolute path is acceptable.
|
||||||
endif
|
endif
|
||||||
|
|
||||||
config WEB_MOUNT_POINT
|
config EXAMPLE_WEB_MOUNT_POINT
|
||||||
string "Website mount point in VFS"
|
string "Website mount point in VFS"
|
||||||
default "/www"
|
default "/www"
|
||||||
help
|
help
|
||||||
|
@ -30,7 +30,7 @@ esp_err_t start_rest_server(const char *base_path);
|
|||||||
static void initialise_mdns(void)
|
static void initialise_mdns(void)
|
||||||
{
|
{
|
||||||
mdns_init();
|
mdns_init();
|
||||||
mdns_hostname_set(CONFIG_MDNS_HOST_NAME);
|
mdns_hostname_set(CONFIG_EXAMPLE_MDNS_HOST_NAME);
|
||||||
mdns_instance_name_set(MDNS_INSTANCE);
|
mdns_instance_name_set(MDNS_INSTANCE);
|
||||||
|
|
||||||
mdns_txt_item_t serviceTxtData[] = {
|
mdns_txt_item_t serviceTxtData[] = {
|
||||||
@ -42,10 +42,10 @@ static void initialise_mdns(void)
|
|||||||
sizeof(serviceTxtData) / sizeof(serviceTxtData[0])));
|
sizeof(serviceTxtData) / sizeof(serviceTxtData[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_WEB_DEPLOY_SEMIHOST
|
#if CONFIG_EXAMPLE_WEB_DEPLOY_SEMIHOST
|
||||||
esp_err_t init_fs(void)
|
esp_err_t init_fs(void)
|
||||||
{
|
{
|
||||||
esp_err_t ret = esp_vfs_semihost_register(CONFIG_WEB_MOUNT_POINT, CONFIG_HOST_PATH_TO_MOUNT);
|
esp_err_t ret = esp_vfs_semihost_register(CONFIG_EXAMPLE_WEB_MOUNT_POINT, CONFIG_EXAMPLE_HOST_PATH_TO_MOUNT);
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to register semihost driver (%s)!", esp_err_to_name(ret));
|
ESP_LOGE(TAG, "Failed to register semihost driver (%s)!", esp_err_to_name(ret));
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
@ -54,7 +54,7 @@ esp_err_t init_fs(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_WEB_DEPLOY_SD
|
#if CONFIG_EXAMPLE_WEB_DEPLOY_SD
|
||||||
esp_err_t init_fs(void)
|
esp_err_t init_fs(void)
|
||||||
{
|
{
|
||||||
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
|
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
|
||||||
@ -73,7 +73,7 @@ esp_err_t init_fs(void)
|
|||||||
};
|
};
|
||||||
|
|
||||||
sdmmc_card_t *card;
|
sdmmc_card_t *card;
|
||||||
esp_err_t ret = esp_vfs_fat_sdmmc_mount(CONFIG_WEB_MOUNT_POINT, &host, &slot_config, &mount_config, &card);
|
esp_err_t ret = esp_vfs_fat_sdmmc_mount(CONFIG_EXAMPLE_WEB_MOUNT_POINT, &host, &slot_config, &mount_config, &card);
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
if (ret == ESP_FAIL) {
|
if (ret == ESP_FAIL) {
|
||||||
ESP_LOGE(TAG, "Failed to mount filesystem.");
|
ESP_LOGE(TAG, "Failed to mount filesystem.");
|
||||||
@ -88,11 +88,11 @@ esp_err_t init_fs(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_WEB_DEPLOY_SF
|
#if CONFIG_EXAMPLE_WEB_DEPLOY_SF
|
||||||
esp_err_t init_fs(void)
|
esp_err_t init_fs(void)
|
||||||
{
|
{
|
||||||
esp_vfs_spiffs_conf_t conf = {
|
esp_vfs_spiffs_conf_t conf = {
|
||||||
.base_path = CONFIG_WEB_MOUNT_POINT,
|
.base_path = CONFIG_EXAMPLE_WEB_MOUNT_POINT,
|
||||||
.partition_label = NULL,
|
.partition_label = NULL,
|
||||||
.max_files = 5,
|
.max_files = 5,
|
||||||
.format_if_mount_failed = false
|
.format_if_mount_failed = false
|
||||||
@ -130,5 +130,5 @@ void app_main()
|
|||||||
|
|
||||||
ESP_ERROR_CHECK(example_connect());
|
ESP_ERROR_CHECK(example_connect());
|
||||||
ESP_ERROR_CHECK(init_fs());
|
ESP_ERROR_CHECK(init_fs());
|
||||||
ESP_ERROR_CHECK(start_rest_server(CONFIG_WEB_MOUNT_POINT));
|
ESP_ERROR_CHECK(start_rest_server(CONFIG_EXAMPLE_WEB_MOUNT_POINT));
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ make -j4 flash monitor
|
|||||||
- You can now ping the device at `[board-hostname].local`, where `[board-hostname]` is preconfigured hostname, `esp32-mdns` by default.
|
- You can now ping the device at `[board-hostname].local`, where `[board-hostname]` is preconfigured hostname, `esp32-mdns` by default.
|
||||||
- You can also browse for `_http._tcp` on the same network to find the advertised service
|
- You can also browse for `_http._tcp` on the same network to find the advertised service
|
||||||
- Pressing the BOOT button will start querying the local network for the predefined in `check_button` hosts and services
|
- Pressing the BOOT button will start querying the local network for the predefined in `check_button` hosts and services
|
||||||
- Note that for purpose of CI tests, configuration options of `RESOLVE_TEST_SERVICES` and `MDNS_ADD_MAC_TO_HOSTNAME` are available, but disabled by default. If enabled, then the hostname suffix of last 3 bytes from device MAC address is added, e.g. `esp32-mdns-80FFFF`, and a query for test service is issued.
|
- Note that for purpose of CI tests, configuration options of `MDNS_RESOLVE_TEST_SERVICES` and `MDNS_ADD_MAC_TO_HOSTNAME` are available, but disabled by default. If enabled, then the hostname suffix of last 3 bytes from device MAC address is added, e.g. `esp32-mdns-80FFFF`, and a query for test service is issued.
|
||||||
|
|
||||||
|
|
||||||
(To exit the serial monitor, type ``Ctrl-]``.)
|
(To exit the serial monitor, type ``Ctrl-]``.)
|
||||||
|
@ -12,7 +12,7 @@ menu "Example Configuration"
|
|||||||
help
|
help
|
||||||
mDNS Instance Name for example to use
|
mDNS Instance Name for example to use
|
||||||
|
|
||||||
config RESOLVE_TEST_SERVICES
|
config MDNS_RESOLVE_TEST_SERVICES
|
||||||
bool "Resolve test services"
|
bool "Resolve test services"
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
|
@ -165,7 +165,7 @@ static void check_button(void)
|
|||||||
|
|
||||||
static void mdns_example_task(void *pvParameters)
|
static void mdns_example_task(void *pvParameters)
|
||||||
{
|
{
|
||||||
#if CONFIG_RESOLVE_TEST_SERVICES == 1
|
#if CONFIG_MDNS_RESOLVE_TEST_SERVICES == 1
|
||||||
/* Send initial queries that are started by CI tester */
|
/* Send initial queries that are started by CI tester */
|
||||||
query_mdns_host("tinytester");
|
query_mdns_host("tinytester");
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
CONFIG_RESOLVE_TEST_SERVICES=y
|
CONFIG_MDNS_RESOLVE_TEST_SERVICES=y
|
||||||
CONFIG_MDNS_ADD_MAC_TO_HOSTNAME=y
|
CONFIG_MDNS_ADD_MAC_TO_HOSTNAME=y
|
||||||
|
@ -1,50 +1,50 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config BROKER_SSL_URI
|
config EXAMPLE_BROKER_SSL_URI
|
||||||
string "Broker SSL URL"
|
string "Broker SSL URL"
|
||||||
default "mqtts://iot.eclipse.org:8883"
|
default "mqtts://iot.eclipse.org:8883"
|
||||||
help
|
help
|
||||||
URL of an mqtt broker for ssl transport
|
URL of an mqtt broker for ssl transport
|
||||||
|
|
||||||
config BROKER_TCP_URI
|
config EXAMPLE_BROKER_TCP_URI
|
||||||
string "Broker TCP URL"
|
string "Broker TCP URL"
|
||||||
default "mqtt://iot.eclipse.org:1883"
|
default "mqtt://iot.eclipse.org:1883"
|
||||||
help
|
help
|
||||||
URL of an mqtt broker for tcp transport
|
URL of an mqtt broker for tcp transport
|
||||||
|
|
||||||
config BROKER_WS_URI
|
config EXAMPLE_BROKER_WS_URI
|
||||||
string "Broker WS URL"
|
string "Broker WS URL"
|
||||||
default "ws://iot.eclipse.org:80/ws"
|
default "ws://iot.eclipse.org:80/ws"
|
||||||
help
|
help
|
||||||
URL of an mqtt broker for ws transport
|
URL of an mqtt broker for ws transport
|
||||||
|
|
||||||
config BROKER_WSS_URI
|
config EXAMPLE_BROKER_WSS_URI
|
||||||
string "Broker WSS URL"
|
string "Broker WSS URL"
|
||||||
default "wss://iot.eclipse.org:443/ws"
|
default "wss://iot.eclipse.org:443/ws"
|
||||||
help
|
help
|
||||||
URL of an mqtt broker for wss transport
|
URL of an mqtt broker for wss transport
|
||||||
|
|
||||||
config PUBLISH_TOPIC
|
config EXAMPLE_PUBLISH_TOPIC
|
||||||
string "publish topic"
|
string "publish topic"
|
||||||
default "/topic/publish/esp2py"
|
default "/topic/publish/esp2py"
|
||||||
help
|
help
|
||||||
topic to which esp32 client publishes
|
topic to which esp32 client publishes
|
||||||
|
|
||||||
config SUBSCIBE_TOPIC
|
config EXAMPLE_SUBSCIBE_TOPIC
|
||||||
string "subscribe topic"
|
string "subscribe topic"
|
||||||
default "/topic/subscribe/py2esp"
|
default "/topic/subscribe/py2esp"
|
||||||
help
|
help
|
||||||
topic to which esp32 client subsribes (and expects data)
|
topic to which esp32 client subsribes (and expects data)
|
||||||
|
|
||||||
config BROKER_CERTIFICATE_OVERRIDE
|
config EXAMPLE_BROKER_CERTIFICATE_OVERRIDE
|
||||||
string "Broker certificate override"
|
string "Broker certificate override"
|
||||||
default ""
|
default ""
|
||||||
help
|
help
|
||||||
Please leave empty if broker certificate included from a textfile; otherwise fill in a base64 part of PEM
|
Please leave empty if broker certificate included from a textfile; otherwise fill in a base64 part of PEM
|
||||||
format certificate
|
format certificate
|
||||||
|
|
||||||
config BROKER_CERTIFICATE_OVERRIDDEN
|
config EXAMPLE_BROKER_CERTIFICATE_OVERRIDDEN
|
||||||
bool
|
bool
|
||||||
default y if BROKER_CERTIFICATE_OVERRIDE != ""
|
default y if EXAMPLE_BROKER_CERTIFICATE_OVERRIDE != ""
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -45,8 +45,8 @@ static size_t actual_published = 0;
|
|||||||
static int qos_test = 0;
|
static int qos_test = 0;
|
||||||
|
|
||||||
|
|
||||||
#if CONFIG_BROKER_CERTIFICATE_OVERRIDDEN == 1
|
#if CONFIG_EXAMPLE_BROKER_CERTIFICATE_OVERRIDDEN == 1
|
||||||
static const uint8_t iot_eclipse_org_pem_start[] = "-----BEGIN CERTIFICATE-----\n" CONFIG_BROKER_CERTIFICATE_OVERRIDE "\n-----END CERTIFICATE-----";
|
static const uint8_t iot_eclipse_org_pem_start[] = "-----BEGIN CERTIFICATE-----\n" CONFIG_EXAMPLE_BROKER_CERTIFICATE_OVERRIDE "\n-----END CERTIFICATE-----";
|
||||||
#else
|
#else
|
||||||
extern const uint8_t iot_eclipse_org_pem_start[] asm("_binary_iot_eclipse_org_pem_start");
|
extern const uint8_t iot_eclipse_org_pem_start[] asm("_binary_iot_eclipse_org_pem_start");
|
||||||
#endif
|
#endif
|
||||||
@ -62,7 +62,7 @@ static esp_err_t mqtt_event_handler(esp_mqtt_event_handle_t event)
|
|||||||
case MQTT_EVENT_CONNECTED:
|
case MQTT_EVENT_CONNECTED:
|
||||||
ESP_LOGI(TAG, "MQTT_EVENT_CONNECTED");
|
ESP_LOGI(TAG, "MQTT_EVENT_CONNECTED");
|
||||||
xEventGroupSetBits(mqtt_event_group, CONNECTED_BIT);
|
xEventGroupSetBits(mqtt_event_group, CONNECTED_BIT);
|
||||||
msg_id = esp_mqtt_client_subscribe(client, CONFIG_SUBSCIBE_TOPIC, qos_test);
|
msg_id = esp_mqtt_client_subscribe(client, CONFIG_EXAMPLE_SUBSCIBE_TOPIC, qos_test);
|
||||||
ESP_LOGI(TAG, "sent subscribe successful, msg_id=%d", msg_id);
|
ESP_LOGI(TAG, "sent subscribe successful, msg_id=%d", msg_id);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -199,16 +199,16 @@ void app_main()
|
|||||||
|
|
||||||
if (0 == strcmp(transport, "tcp")) {
|
if (0 == strcmp(transport, "tcp")) {
|
||||||
ESP_LOGI(TAG, "[TCP transport] Startup..");
|
ESP_LOGI(TAG, "[TCP transport] Startup..");
|
||||||
esp_mqtt_client_set_uri(mqtt_client, CONFIG_BROKER_TCP_URI);
|
esp_mqtt_client_set_uri(mqtt_client, CONFIG_EXAMPLE_BROKER_TCP_URI);
|
||||||
} else if (0 == strcmp(transport, "ssl")) {
|
} else if (0 == strcmp(transport, "ssl")) {
|
||||||
ESP_LOGI(TAG, "[SSL transport] Startup..");
|
ESP_LOGI(TAG, "[SSL transport] Startup..");
|
||||||
esp_mqtt_client_set_uri(mqtt_client, CONFIG_BROKER_SSL_URI);
|
esp_mqtt_client_set_uri(mqtt_client, CONFIG_EXAMPLE_BROKER_SSL_URI);
|
||||||
} else if (0 == strcmp(transport, "ws")) {
|
} else if (0 == strcmp(transport, "ws")) {
|
||||||
ESP_LOGI(TAG, "[WS transport] Startup..");
|
ESP_LOGI(TAG, "[WS transport] Startup..");
|
||||||
esp_mqtt_client_set_uri(mqtt_client, CONFIG_BROKER_WS_URI);
|
esp_mqtt_client_set_uri(mqtt_client, CONFIG_EXAMPLE_BROKER_WS_URI);
|
||||||
} else if (0 == strcmp(transport, "wss")) {
|
} else if (0 == strcmp(transport, "wss")) {
|
||||||
ESP_LOGI(TAG, "[WSS transport] Startup..");
|
ESP_LOGI(TAG, "[WSS transport] Startup..");
|
||||||
esp_mqtt_client_set_uri(mqtt_client, CONFIG_BROKER_WSS_URI);
|
esp_mqtt_client_set_uri(mqtt_client, CONFIG_EXAMPLE_BROKER_WSS_URI);
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGE(TAG, "Unexpected transport");
|
ESP_LOGE(TAG, "Unexpected transport");
|
||||||
abort();
|
abort();
|
||||||
@ -219,7 +219,7 @@ void app_main()
|
|||||||
xEventGroupWaitBits(mqtt_event_group, CONNECTED_BIT, false, true, portMAX_DELAY);
|
xEventGroupWaitBits(mqtt_event_group, CONNECTED_BIT, false, true, portMAX_DELAY);
|
||||||
|
|
||||||
for (int i = 0; i < expected_published; i++) {
|
for (int i = 0; i < expected_published; i++) {
|
||||||
int msg_id = esp_mqtt_client_publish(mqtt_client, CONFIG_PUBLISH_TOPIC, expected_data, expected_size, qos_test, 0);
|
int msg_id = esp_mqtt_client_publish(mqtt_client, CONFIG_EXAMPLE_PUBLISH_TOPIC, expected_data, expected_size, qos_test, 0);
|
||||||
ESP_LOGI(TAG, "[%d] Publishing...", msg_id);
|
ESP_LOGI(TAG, "[%d] Publishing...", msg_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
CONFIG_BROKER_SSL_URI="mqtts://${EXAMPLE_MQTT_BROKER_SSL}"
|
CONFIG_EXAMPLE_BROKER_SSL_URI="mqtts://${EXAMPLE_MQTT_BROKER_SSL}"
|
||||||
CONFIG_BROKER_TCP_URI="mqtt://${EXAMPLE_MQTT_BROKER_TCP}"
|
CONFIG_EXAMPLE_BROKER_TCP_URI="mqtt://${EXAMPLE_MQTT_BROKER_TCP}"
|
||||||
CONFIG_BROKER_WS_URI="ws://${EXAMPLE_MQTT_BROKER_WS}/ws"
|
CONFIG_EXAMPLE_BROKER_WS_URI="ws://${EXAMPLE_MQTT_BROKER_WS}/ws"
|
||||||
CONFIG_BROKER_WSS_URI="wss://${EXAMPLE_MQTT_BROKER_WSS}/ws"
|
CONFIG_EXAMPLE_BROKER_WSS_URI="wss://${EXAMPLE_MQTT_BROKER_WSS}/ws"
|
||||||
CONFIG_BROKER_CERTIFICATE_OVERRIDE="${EXAMPLE_MQTT_BROKER_CERTIFICATE}"
|
CONFIG_EXAMPLE_BROKER_CERTIFICATE_OVERRIDE="${EXAMPLE_MQTT_BROKER_CERTIFICATE}"
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
#define ESP_MODEM_LINE_BUFFER_SIZE (CONFIG_UART_RX_BUFFER_SIZE / 2)
|
#define ESP_MODEM_LINE_BUFFER_SIZE (CONFIG_EXAMPLE_UART_RX_BUFFER_SIZE / 2)
|
||||||
#define ESP_MODEM_EVENT_QUEUE_SIZE (16)
|
#define ESP_MODEM_EVENT_QUEUE_SIZE (16)
|
||||||
|
|
||||||
#define MIN_PATTERN_INTERVAL (10000)
|
#define MIN_PATTERN_INTERVAL (10000)
|
||||||
@ -299,7 +299,7 @@ static esp_err_t esp_modem_dte_change_mode(modem_dte_t *dte, modem_mode_t new_mo
|
|||||||
uart_disable_rx_intr(esp_dte->uart_port);
|
uart_disable_rx_intr(esp_dte->uart_port);
|
||||||
uart_flush(esp_dte->uart_port);
|
uart_flush(esp_dte->uart_port);
|
||||||
uart_enable_pattern_det_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE);
|
uart_enable_pattern_det_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE);
|
||||||
uart_pattern_queue_reset(esp_dte->uart_port, CONFIG_UART_PATTERN_QUEUE_SIZE);
|
uart_pattern_queue_reset(esp_dte->uart_port, CONFIG_EXAMPLE_UART_PATTERN_QUEUE_SIZE);
|
||||||
MODEM_CHECK(dce->set_working_mode(dce, new_mode) == ESP_OK, "set new working mode:%d failed", err, new_mode);
|
MODEM_CHECK(dce->set_working_mode(dce, new_mode) == ESP_OK, "set new working mode:%d failed", err, new_mode);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -373,10 +373,10 @@ modem_dte_t *esp_modem_dte_init(const esp_modem_dte_config_t *config)
|
|||||||
};
|
};
|
||||||
MODEM_CHECK(uart_param_config(esp_dte->uart_port, &uart_config) == ESP_OK, "config uart parameter failed", err_uart_config);
|
MODEM_CHECK(uart_param_config(esp_dte->uart_port, &uart_config) == ESP_OK, "config uart parameter failed", err_uart_config);
|
||||||
if (config->flow_control == MODEM_FLOW_CONTROL_HW) {
|
if (config->flow_control == MODEM_FLOW_CONTROL_HW) {
|
||||||
res = uart_set_pin(esp_dte->uart_port, CONFIG_MODEM_TX_PIN, CONFIG_MODEM_RX_PIN,
|
res = uart_set_pin(esp_dte->uart_port, CONFIG_EXAMPLE_UART_MODEM_TX_PIN, CONFIG_EXAMPLE_UART_MODEM_RX_PIN,
|
||||||
CONFIG_MODEM_RTS_PIN, CONFIG_MODEM_CTS_PIN);
|
CONFIG_EXAMPLE_UART_MODEM_RTS_PIN, CONFIG_EXAMPLE_UART_MODEM_CTS_PIN);
|
||||||
} else {
|
} else {
|
||||||
res = uart_set_pin(esp_dte->uart_port, CONFIG_MODEM_TX_PIN, CONFIG_MODEM_RX_PIN,
|
res = uart_set_pin(esp_dte->uart_port, CONFIG_EXAMPLE_UART_MODEM_TX_PIN, CONFIG_EXAMPLE_UART_MODEM_RX_PIN,
|
||||||
UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
|
UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
|
||||||
}
|
}
|
||||||
MODEM_CHECK(res == ESP_OK, "config uart gpio failed", err_uart_config);
|
MODEM_CHECK(res == ESP_OK, "config uart gpio failed", err_uart_config);
|
||||||
@ -388,13 +388,13 @@ modem_dte_t *esp_modem_dte_init(const esp_modem_dte_config_t *config)
|
|||||||
}
|
}
|
||||||
MODEM_CHECK(res == ESP_OK, "config uart flow control failed", err_uart_config);
|
MODEM_CHECK(res == ESP_OK, "config uart flow control failed", err_uart_config);
|
||||||
/* Install UART driver and get event queue used inside driver */
|
/* Install UART driver and get event queue used inside driver */
|
||||||
res = uart_driver_install(esp_dte->uart_port, CONFIG_UART_RX_BUFFER_SIZE, CONFIG_UART_TX_BUFFER_SIZE,
|
res = uart_driver_install(esp_dte->uart_port, CONFIG_EXAMPLE_UART_RX_BUFFER_SIZE, CONFIG_EXAMPLE_UART_TX_BUFFER_SIZE,
|
||||||
CONFIG_UART_EVENT_QUEUE_SIZE, &(esp_dte->event_queue), 0);
|
CONFIG_EXAMPLE_UART_EVENT_QUEUE_SIZE, &(esp_dte->event_queue), 0);
|
||||||
MODEM_CHECK(res == ESP_OK, "install uart driver failed", err_uart_config);
|
MODEM_CHECK(res == ESP_OK, "install uart driver failed", err_uart_config);
|
||||||
/* Set pattern interrupt, used to detect the end of a line. */
|
/* Set pattern interrupt, used to detect the end of a line. */
|
||||||
res = uart_enable_pattern_det_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE);
|
res = uart_enable_pattern_det_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE);
|
||||||
/* Set pattern queue size */
|
/* Set pattern queue size */
|
||||||
res |= uart_pattern_queue_reset(esp_dte->uart_port, CONFIG_UART_PATTERN_QUEUE_SIZE);
|
res |= uart_pattern_queue_reset(esp_dte->uart_port, CONFIG_EXAMPLE_UART_PATTERN_QUEUE_SIZE);
|
||||||
MODEM_CHECK(res == ESP_OK, "config uart pattern failed", err_uart_pattern);
|
MODEM_CHECK(res == ESP_OK, "config uart pattern failed", err_uart_pattern);
|
||||||
/* Create Event loop */
|
/* Create Event loop */
|
||||||
esp_event_loop_args_t loop_args = {
|
esp_event_loop_args_t loop_args = {
|
||||||
@ -408,9 +408,9 @@ modem_dte_t *esp_modem_dte_init(const esp_modem_dte_config_t *config)
|
|||||||
/* Create UART Event task */
|
/* Create UART Event task */
|
||||||
BaseType_t ret = xTaskCreate(uart_event_task_entry, //Task Entry
|
BaseType_t ret = xTaskCreate(uart_event_task_entry, //Task Entry
|
||||||
"uart_event", //Task Name
|
"uart_event", //Task Name
|
||||||
CONFIG_UART_EVENT_TASK_STACK_SIZE, //Task Stack Size(Bytes)
|
CONFIG_EXAMPLE_UART_EVENT_TASK_STACK_SIZE, //Task Stack Size(Bytes)
|
||||||
esp_dte, //Task Parameter
|
esp_dte, //Task Parameter
|
||||||
CONFIG_UART_EVENT_TASK_PRIORITY, //Task Priority
|
CONFIG_EXAMPLE_UART_EVENT_TASK_PRIORITY, //Task Priority
|
||||||
& (esp_dte->uart_event_task_hdl) //Task Handler
|
& (esp_dte->uart_event_task_hdl) //Task Handler
|
||||||
);
|
);
|
||||||
MODEM_CHECK(ret == pdTRUE, "create uart event task failed", err_tsk_create);
|
MODEM_CHECK(ret == pdTRUE, "create uart event task failed", err_tsk_create);
|
||||||
@ -573,7 +573,7 @@ esp_err_t esp_modem_setup_ppp(modem_dte_t *dte)
|
|||||||
MODEM_CHECK(dce, "DTE has not yet bind with DCE", err);
|
MODEM_CHECK(dce, "DTE has not yet bind with DCE", err);
|
||||||
esp_modem_dte_t *esp_dte = __containerof(dte, esp_modem_dte_t, parent);
|
esp_modem_dte_t *esp_dte = __containerof(dte, esp_modem_dte_t, parent);
|
||||||
/* Set PDP Context */
|
/* Set PDP Context */
|
||||||
MODEM_CHECK(dce->define_pdp_context(dce, 1, "IP", CONFIG_ESP_MODEM_APN) == ESP_OK, "set MODEM APN failed", err);
|
MODEM_CHECK(dce->define_pdp_context(dce, 1, "IP", CONFIG_EXAMPLE_MODEM_APN) == ESP_OK, "set MODEM APN failed", err);
|
||||||
/* Enter PPP mode */
|
/* Enter PPP mode */
|
||||||
MODEM_CHECK(dte->change_mode(dte, MODEM_PPP_MODE) == ESP_OK, "enter ppp mode failed", err);
|
MODEM_CHECK(dte->change_mode(dte, MODEM_PPP_MODE) == ESP_OK, "enter ppp mode failed", err);
|
||||||
/* Create PPPoS interface */
|
/* Create PPPoS interface */
|
||||||
@ -589,9 +589,9 @@ esp_err_t esp_modem_setup_ppp(modem_dte_t *dte)
|
|||||||
ppp_set_usepeerdns(esp_dte->ppp, 1);
|
ppp_set_usepeerdns(esp_dte->ppp, 1);
|
||||||
/* Auth configuration */
|
/* Auth configuration */
|
||||||
#if PAP_SUPPORT
|
#if PAP_SUPPORT
|
||||||
pppapi_set_auth(esp_dte->ppp, PPPAUTHTYPE_PAP, CONFIG_ESP_MODEM_PPP_AUTH_USERNAME, CONFIG_ESP_MODEM_PPP_AUTH_PASSWORD);
|
pppapi_set_auth(esp_dte->ppp, PPPAUTHTYPE_PAP, CONFIG_EXAMPLE_MODEM_PPP_AUTH_USERNAME, CONFIG_EXAMPLE_MODEM_PPP_AUTH_PASSWORD);
|
||||||
#elif CHAP_SUPPORT
|
#elif CHAP_SUPPORT
|
||||||
pppapi_set_auth(esp_dte->ppp, PPPAUTHTYPE_CHAP, CONFIG_ESP_MODEM_PPP_AUTH_USERNAME, CONFIG_ESP_MODEM_PPP_AUTH_PASSWORD);
|
pppapi_set_auth(esp_dte->ppp, PPPAUTHTYPE_CHAP, CONFIG_EXAMPLE_MODEM_PPP_AUTH_USERNAME, CONFIG_EXAMPLE_MODEM_PPP_AUTH_PASSWORD);
|
||||||
#else
|
#else
|
||||||
#error "Unsupported AUTH Negotiation"
|
#error "Unsupported AUTH Negotiation"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,47 +1,47 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
choice ESP_MODEM_DEVICE
|
choice EXAMPLE_MODEM_DEVICE
|
||||||
prompt "Choose supported modem device (DCE)"
|
prompt "Choose supported modem device (DCE)"
|
||||||
default ESP_MODEM_DEVICE_BG96
|
default EXAMPLE_MODEM_DEVICE_BG96
|
||||||
help
|
help
|
||||||
Select modem device connected to the ESP DTE.
|
Select modem device connected to the ESP DTE.
|
||||||
config ESP_MODEM_DEVICE_SIM800
|
config EXAMPLE_MODEM_DEVICE_SIM800
|
||||||
bool "SIM800"
|
bool "SIM800"
|
||||||
help
|
help
|
||||||
SIMCom SIM800L is a GSM/GPRS module.
|
SIMCom SIM800L is a GSM/GPRS module.
|
||||||
It supports Quad-band 850/900/1800/1900MHz.
|
It supports Quad-band 850/900/1800/1900MHz.
|
||||||
config ESP_MODEM_DEVICE_BG96
|
config EXAMPLE_MODEM_DEVICE_BG96
|
||||||
bool "BG96"
|
bool "BG96"
|
||||||
help
|
help
|
||||||
Quectel BG96 is a series of LTE Cat M1/Cat NB1/EGPRS module.
|
Quectel BG96 is a series of LTE Cat M1/Cat NB1/EGPRS module.
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config ESP_MODEM_APN
|
config EXAMPLE_MODEM_APN
|
||||||
string "Set Access Point Name (APN)"
|
string "Set Access Point Name (APN)"
|
||||||
default "CMNET"
|
default "CMNET"
|
||||||
help
|
help
|
||||||
Logical name which is used to select the GGSN or the external packet data network.
|
Logical name which is used to select the GGSN or the external packet data network.
|
||||||
|
|
||||||
config ESP_MODEM_PPP_AUTH_USERNAME
|
config EXAMPLE_MODEM_PPP_AUTH_USERNAME
|
||||||
string "Set username for authentication"
|
string "Set username for authentication"
|
||||||
default "espressif"
|
default "espressif"
|
||||||
help
|
help
|
||||||
Set username for PPP Authentication.
|
Set username for PPP Authentication.
|
||||||
|
|
||||||
config ESP_MODEM_PPP_AUTH_PASSWORD
|
config EXAMPLE_MODEM_PPP_AUTH_PASSWORD
|
||||||
string "Set password for authentication"
|
string "Set password for authentication"
|
||||||
default "esp32"
|
default "esp32"
|
||||||
help
|
help
|
||||||
Set password for PPP Authentication.
|
Set password for PPP Authentication.
|
||||||
|
|
||||||
config SEND_MSG
|
config EXAMPLE_SEND_MSG
|
||||||
bool "Short message (SMS)"
|
bool "Short message (SMS)"
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
Select this, the modem will send a short message before power off.
|
Select this, the modem will send a short message before power off.
|
||||||
|
|
||||||
if SEND_MSG
|
if EXAMPLE_SEND_MSG
|
||||||
config SEND_MSG_PEER_PHONE_NUMBER
|
config EXAMPLE_SEND_MSG_PEER_PHONE_NUMBER
|
||||||
string "Peer Phone Number (with area code)"
|
string "Peer Phone Number (with area code)"
|
||||||
default "+8610086"
|
default "+8610086"
|
||||||
help
|
help
|
||||||
@ -49,70 +49,70 @@ menu "Example Configuration"
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
menu "UART Configuration"
|
menu "UART Configuration"
|
||||||
config MODEM_TX_PIN
|
config EXAMPLE_UART_MODEM_TX_PIN
|
||||||
int "TXD Pin Number"
|
int "TXD Pin Number"
|
||||||
default 25
|
default 25
|
||||||
range 0 31
|
range 0 31
|
||||||
help
|
help
|
||||||
Pin number of UART TX.
|
Pin number of UART TX.
|
||||||
|
|
||||||
config MODEM_RX_PIN
|
config EXAMPLE_UART_MODEM_RX_PIN
|
||||||
int "RXD Pin Number"
|
int "RXD Pin Number"
|
||||||
default 26
|
default 26
|
||||||
range 0 31
|
range 0 31
|
||||||
help
|
help
|
||||||
Pin number of UART RX.
|
Pin number of UART RX.
|
||||||
|
|
||||||
config MODEM_RTS_PIN
|
config EXAMPLE_UART_MODEM_RTS_PIN
|
||||||
int "RTS Pin Number"
|
int "RTS Pin Number"
|
||||||
default 27
|
default 27
|
||||||
range 0 31
|
range 0 31
|
||||||
help
|
help
|
||||||
Pin number of UART RTS.
|
Pin number of UART RTS.
|
||||||
|
|
||||||
config MODEM_CTS_PIN
|
config EXAMPLE_UART_MODEM_CTS_PIN
|
||||||
int "CTS Pin Number"
|
int "CTS Pin Number"
|
||||||
default 23
|
default 23
|
||||||
range 0 31
|
range 0 31
|
||||||
help
|
help
|
||||||
Pin number of UART CTS.
|
Pin number of UART CTS.
|
||||||
|
|
||||||
config UART_EVENT_TASK_STACK_SIZE
|
config EXAMPLE_UART_EVENT_TASK_STACK_SIZE
|
||||||
int "UART Event Task Stack Size"
|
int "UART Event Task Stack Size"
|
||||||
range 2000 6000
|
range 2000 6000
|
||||||
default 2048
|
default 2048
|
||||||
help
|
help
|
||||||
Stack size of UART event task.
|
Stack size of UART event task.
|
||||||
|
|
||||||
config UART_EVENT_TASK_PRIORITY
|
config EXAMPLE_UART_EVENT_TASK_PRIORITY
|
||||||
int "UART Event Task Priority"
|
int "UART Event Task Priority"
|
||||||
range 3 22
|
range 3 22
|
||||||
default 5
|
default 5
|
||||||
help
|
help
|
||||||
Priority of UART event task.
|
Priority of UART event task.
|
||||||
|
|
||||||
config UART_EVENT_QUEUE_SIZE
|
config EXAMPLE_UART_EVENT_QUEUE_SIZE
|
||||||
int "UART Event Queue Size"
|
int "UART Event Queue Size"
|
||||||
range 10 40
|
range 10 40
|
||||||
default 30
|
default 30
|
||||||
help
|
help
|
||||||
Length of UART event queue.
|
Length of UART event queue.
|
||||||
|
|
||||||
config UART_PATTERN_QUEUE_SIZE
|
config EXAMPLE_UART_PATTERN_QUEUE_SIZE
|
||||||
int "UART Pattern Queue Size"
|
int "UART Pattern Queue Size"
|
||||||
range 10 40
|
range 10 40
|
||||||
default 20
|
default 20
|
||||||
help
|
help
|
||||||
Length of UART pattern queue.
|
Length of UART pattern queue.
|
||||||
|
|
||||||
config UART_TX_BUFFER_SIZE
|
config EXAMPLE_UART_TX_BUFFER_SIZE
|
||||||
int "UART TX Buffer Size"
|
int "UART TX Buffer Size"
|
||||||
range 256 2048
|
range 256 2048
|
||||||
default 512
|
default 512
|
||||||
help
|
help
|
||||||
Buffer size of UART TX buffer.
|
Buffer size of UART TX buffer.
|
||||||
|
|
||||||
config UART_RX_BUFFER_SIZE
|
config EXAMPLE_UART_RX_BUFFER_SIZE
|
||||||
int "UART RX Buffer Size"
|
int "UART RX Buffer Size"
|
||||||
range 256 2048
|
range 256 2048
|
||||||
default 1024
|
default 1024
|
||||||
|
@ -24,7 +24,7 @@ static const int CONNECT_BIT = BIT0;
|
|||||||
static const int STOP_BIT = BIT1;
|
static const int STOP_BIT = BIT1;
|
||||||
static const int GOT_DATA_BIT = BIT2;
|
static const int GOT_DATA_BIT = BIT2;
|
||||||
|
|
||||||
#if CONFIG_SEND_MSG
|
#if CONFIG_EXAMPLE_SEND_MSG
|
||||||
/**
|
/**
|
||||||
* @brief This example will also show how to send short message using the infrastructure provided by esp modem library.
|
* @brief This example will also show how to send short message using the infrastructure provided by esp modem library.
|
||||||
* @note Not all modem support SMG.
|
* @note Not all modem support SMG.
|
||||||
@ -189,9 +189,9 @@ void app_main()
|
|||||||
/* Register event handler */
|
/* Register event handler */
|
||||||
ESP_ERROR_CHECK(esp_modem_add_event_handler(dte, modem_event_handler, NULL));
|
ESP_ERROR_CHECK(esp_modem_add_event_handler(dte, modem_event_handler, NULL));
|
||||||
/* create dce object */
|
/* create dce object */
|
||||||
#if CONFIG_ESP_MODEM_DEVICE_SIM800
|
#if CONFIG_EXAMPLE_MODEM_DEVICE_SIM800
|
||||||
modem_dce_t *dce = sim800_init(dte);
|
modem_dce_t *dce = sim800_init(dte);
|
||||||
#elif CONFIG_ESP_MODEM_DEVICE_BG96
|
#elif CONFIG_EXAMPLE_MODEM_DEVICE_BG96
|
||||||
modem_dce_t *dce = bg96_init(dte);
|
modem_dce_t *dce = bg96_init(dte);
|
||||||
#else
|
#else
|
||||||
#error "Unsupported DCE"
|
#error "Unsupported DCE"
|
||||||
@ -227,9 +227,9 @@ void app_main()
|
|||||||
/* Exit PPP mode */
|
/* Exit PPP mode */
|
||||||
ESP_ERROR_CHECK(esp_modem_exit_ppp(dte));
|
ESP_ERROR_CHECK(esp_modem_exit_ppp(dte));
|
||||||
xEventGroupWaitBits(event_group, STOP_BIT, pdTRUE, pdTRUE, portMAX_DELAY);
|
xEventGroupWaitBits(event_group, STOP_BIT, pdTRUE, pdTRUE, portMAX_DELAY);
|
||||||
#if CONFIG_SEND_MSG
|
#if CONFIG_EXAMPLE_SEND_MSG
|
||||||
const char *message = "Welcome to ESP32!";
|
const char *message = "Welcome to ESP32!";
|
||||||
ESP_ERROR_CHECK(example_send_message_text(dce, CONFIG_SEND_MSG_PEER_PHONE_NUMBER, message));
|
ESP_ERROR_CHECK(example_send_message_text(dce, CONFIG_EXAMPLE_SEND_MSG_PEER_PHONE_NUMBER, message));
|
||||||
ESP_LOGI(TAG, "Send send message [%s] ok", message);
|
ESP_LOGI(TAG, "Send send message [%s] ok", message);
|
||||||
#endif
|
#endif
|
||||||
/* Power down module */
|
/* Power down module */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config USE_SEC_1
|
config EXAMPLE_USE_SEC_1
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
prompt "Use Security Version 1"
|
prompt "Use Security Version 1"
|
||||||
@ -8,9 +8,9 @@ menu "Example Configuration"
|
|||||||
Security version 1 used Curve25519 key exchange for establishing
|
Security version 1 used Curve25519 key exchange for establishing
|
||||||
secure session between device and client during provisioning
|
secure session between device and client during provisioning
|
||||||
|
|
||||||
config USE_POP
|
config EXAMPLE_USE_POP
|
||||||
bool
|
bool
|
||||||
depends on USE_SEC_1
|
depends on EXAMPLE_USE_SEC_1
|
||||||
default y
|
default y
|
||||||
prompt "Use proof-of-possession"
|
prompt "Use proof-of-possession"
|
||||||
help
|
help
|
||||||
@ -18,12 +18,12 @@ menu "Example Configuration"
|
|||||||
in possession of the user who is provisioning the device. This proof-of-possession
|
in possession of the user who is provisioning the device. This proof-of-possession
|
||||||
is internally used to generate the shared secret through key exchange.
|
is internally used to generate the shared secret through key exchange.
|
||||||
|
|
||||||
config POP
|
config EXAMPLE_POP
|
||||||
string "Proof-of-possession"
|
string "Proof-of-possession"
|
||||||
default "abcd1234"
|
default "abcd1234"
|
||||||
depends on USE_POP
|
depends on EXAMPLE_USE_POP
|
||||||
|
|
||||||
config RESET_PROVISIONED
|
config EXAMPLE_RESET_PROVISIONED
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
prompt "Reset provisioned status of the device"
|
prompt "Reset provisioned status of the device"
|
||||||
@ -31,7 +31,7 @@ menu "Example Configuration"
|
|||||||
This erases the NVS to reset provisioned status of the device on every reboot.
|
This erases the NVS to reset provisioned status of the device on every reboot.
|
||||||
Provisioned status is determined by the Wi-Fi STA configuration, saved on the NVS.
|
Provisioned status is determined by the Wi-Fi STA configuration, saved on the NVS.
|
||||||
|
|
||||||
config AP_RECONN_ATTEMPTS
|
config EXAMPLE_AP_RECONN_ATTEMPTS
|
||||||
int "Maximum AP connection attempts"
|
int "Maximum AP connection attempts"
|
||||||
default 5
|
default 5
|
||||||
help
|
help
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "app_prov.h"
|
#include "app_prov.h"
|
||||||
|
|
||||||
#define EXAMPLE_AP_RECONN_ATTEMPTS CONFIG_AP_RECONN_ATTEMPTS
|
#define EXAMPLE_AP_RECONN_ATTEMPTS CONFIG_EXAMPLE_AP_RECONN_ATTEMPTS
|
||||||
|
|
||||||
static const char *TAG = "app";
|
static const char *TAG = "app";
|
||||||
|
|
||||||
@ -94,15 +94,15 @@ static void start_ble_provisioning()
|
|||||||
/* Proof of possession */
|
/* Proof of possession */
|
||||||
const protocomm_security_pop_t *pop = NULL;
|
const protocomm_security_pop_t *pop = NULL;
|
||||||
|
|
||||||
#ifdef CONFIG_USE_SEC_1
|
#ifdef CONFIG_EXAMPLE_USE_SEC_1
|
||||||
security = 1;
|
security = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Having proof of possession is optional */
|
/* Having proof of possession is optional */
|
||||||
#ifdef CONFIG_USE_POP
|
#ifdef CONFIG_EXAMPLE_USE_POP
|
||||||
const static protocomm_security_pop_t app_pop = {
|
const static protocomm_security_pop_t app_pop = {
|
||||||
.data = (uint8_t *) CONFIG_POP,
|
.data = (uint8_t *) CONFIG_EXAMPLE_POP,
|
||||||
.len = (sizeof(CONFIG_POP)-1)
|
.len = (sizeof(CONFIG_EXAMPLE_POP)-1)
|
||||||
};
|
};
|
||||||
pop = &app_pop;
|
pop = &app_pop;
|
||||||
#endif
|
#endif
|
||||||
|
@ -253,7 +253,7 @@ esp_err_t app_prov_is_provisioned(bool *provisioned)
|
|||||||
{
|
{
|
||||||
*provisioned = false;
|
*provisioned = false;
|
||||||
|
|
||||||
#ifdef CONFIG_RESET_PROVISIONED
|
#ifdef CONFIG_EXAMPLE_RESET_PROVISIONED
|
||||||
nvs_flash_erase();
|
nvs_flash_erase();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config USE_SEC_1
|
config EXAMPLE_USE_SEC_1
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
prompt "Use Security Version 1"
|
prompt "Use Security Version 1"
|
||||||
@ -8,9 +8,9 @@ menu "Example Configuration"
|
|||||||
Security version 1 used Curve25519 key exchange for establishing
|
Security version 1 used Curve25519 key exchange for establishing
|
||||||
secure session between device and client during provisioning
|
secure session between device and client during provisioning
|
||||||
|
|
||||||
config USE_POP
|
config EXAMPLE_USE_POP
|
||||||
bool
|
bool
|
||||||
depends on USE_SEC_1
|
depends on EXAMPLE_USE_SEC_1
|
||||||
default y
|
default y
|
||||||
prompt "Use proof-of-possession"
|
prompt "Use proof-of-possession"
|
||||||
help
|
help
|
||||||
@ -18,12 +18,12 @@ menu "Example Configuration"
|
|||||||
in possession of the user who is provisioning the device. This proof-of-possession
|
in possession of the user who is provisioning the device. This proof-of-possession
|
||||||
is internally used to generate the shared secret through key exchange.
|
is internally used to generate the shared secret through key exchange.
|
||||||
|
|
||||||
config POP
|
config EXAMPLE_POP
|
||||||
string "Proof-of-possession"
|
string "Proof-of-possession"
|
||||||
default "abcd1234"
|
default "abcd1234"
|
||||||
depends on USE_POP
|
depends on EXAMPLE_USE_POP
|
||||||
|
|
||||||
config RESET_PROVISIONED
|
config EXAMPLE_RESET_PROVISIONED
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
prompt "Reset provisioned status of the device"
|
prompt "Reset provisioned status of the device"
|
||||||
@ -31,7 +31,7 @@ menu "Example Configuration"
|
|||||||
This erases the NVS to reset provisioned status of the device on every reboot.
|
This erases the NVS to reset provisioned status of the device on every reboot.
|
||||||
Provisioned status is determined by the Wi-Fi STA configuration, saved on the NVS.
|
Provisioned status is determined by the Wi-Fi STA configuration, saved on the NVS.
|
||||||
|
|
||||||
config AP_RECONN_ATTEMPTS
|
config EXAMPLE_AP_RECONN_ATTEMPTS
|
||||||
int "Maximum AP connection attempts"
|
int "Maximum AP connection attempts"
|
||||||
default 5
|
default 5
|
||||||
help
|
help
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "app_prov.h"
|
#include "app_prov.h"
|
||||||
|
|
||||||
#define EXAMPLE_AP_RECONN_ATTEMPTS CONFIG_AP_RECONN_ATTEMPTS
|
#define EXAMPLE_AP_RECONN_ATTEMPTS CONFIG_EXAMPLE_AP_RECONN_ATTEMPTS
|
||||||
|
|
||||||
static const char *TAG = "app";
|
static const char *TAG = "app";
|
||||||
|
|
||||||
@ -65,15 +65,15 @@ static void start_console_provisioning()
|
|||||||
/* Proof of possession */
|
/* Proof of possession */
|
||||||
const protocomm_security_pop_t *pop = NULL;
|
const protocomm_security_pop_t *pop = NULL;
|
||||||
|
|
||||||
#ifdef CONFIG_USE_SEC_1
|
#ifdef CONFIG_EXAMPLE_USE_SEC_1
|
||||||
security = 1;
|
security = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Having proof of possession is optional */
|
/* Having proof of possession is optional */
|
||||||
#ifdef CONFIG_USE_POP
|
#ifdef CONFIG_EXAMPLE_USE_POP
|
||||||
const static protocomm_security_pop_t app_pop = {
|
const static protocomm_security_pop_t app_pop = {
|
||||||
.data = (uint8_t *) CONFIG_POP,
|
.data = (uint8_t *) CONFIG_EXAMPLE_POP,
|
||||||
.len = (sizeof(CONFIG_POP)-1)
|
.len = (sizeof(CONFIG_EXAMPLE_POP)-1)
|
||||||
};
|
};
|
||||||
pop = &app_pop;
|
pop = &app_pop;
|
||||||
#endif
|
#endif
|
||||||
|
@ -219,7 +219,7 @@ esp_err_t app_prov_is_provisioned(bool *provisioned)
|
|||||||
{
|
{
|
||||||
*provisioned = false;
|
*provisioned = false;
|
||||||
|
|
||||||
#ifdef CONFIG_RESET_PROVISIONED
|
#ifdef CONFIG_EXAMPLE_RESET_PROVISIONED
|
||||||
nvs_flash_erase();
|
nvs_flash_erase();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config SOFTAP_SSID
|
config EXAMPLE_SSID
|
||||||
string "Wi-Fi SSID"
|
string "Wi-Fi SSID"
|
||||||
default "myssid"
|
default "myssid"
|
||||||
help
|
help
|
||||||
SSID (network name) for the example to connect to.
|
SSID (network name) for the example to connect to.
|
||||||
|
|
||||||
config SOFTAP_PASS
|
config EXAMPLE_PASS
|
||||||
string "Wi-Fi Password"
|
string "Wi-Fi Password"
|
||||||
default "mypassword"
|
default "mypassword"
|
||||||
help
|
help
|
||||||
Wi-Fi password (WPA or WPA2) for the example to use.
|
Wi-Fi password (WPA or WPA2) for the example to use.
|
||||||
|
|
||||||
config USE_SEC_1
|
config EXAMPLE_USE_SEC_1
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
prompt "Use Security Version 1"
|
prompt "Use Security Version 1"
|
||||||
@ -20,9 +20,9 @@ menu "Example Configuration"
|
|||||||
Security version 1 used Curve25519 key exchange for establishing
|
Security version 1 used Curve25519 key exchange for establishing
|
||||||
secure session between device and client during provisioning
|
secure session between device and client during provisioning
|
||||||
|
|
||||||
config USE_POP
|
config EXAMPLE_USE_POP
|
||||||
bool
|
bool
|
||||||
depends on USE_SEC_1
|
depends on EXAMPLE_USE_SEC_1
|
||||||
default n
|
default n
|
||||||
prompt "Use proof-of-possession"
|
prompt "Use proof-of-possession"
|
||||||
help
|
help
|
||||||
@ -30,18 +30,18 @@ menu "Example Configuration"
|
|||||||
in possession of the user who is provisioning the device. This proof-of-possession
|
in possession of the user who is provisioning the device. This proof-of-possession
|
||||||
is internally used to generate the shared secret through key exchange.
|
is internally used to generate the shared secret through key exchange.
|
||||||
|
|
||||||
config POP
|
config EXAMPLE_POP
|
||||||
string "Proof-of-possession"
|
string "Proof-of-possession"
|
||||||
default "abcd1234"
|
default "abcd1234"
|
||||||
depends on USE_POP
|
depends on EXAMPLE_USE_POP
|
||||||
|
|
||||||
config PROTOCOMM_HTTPD_PORT
|
config EXAMPLE_PROTOCOMM_HTTPD_PORT
|
||||||
int "Protocomm HTTP Port"
|
int "Protocomm HTTP Port"
|
||||||
default 80
|
default 80
|
||||||
help
|
help
|
||||||
Port on which to run Protocomm HTTP based provisioning service
|
Port on which to run Protocomm HTTP based provisioning service
|
||||||
|
|
||||||
config RESET_PROVISIONED
|
config EXAMPLE_RESET_PROVISIONED
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
prompt "Reset provisioned status of the device"
|
prompt "Reset provisioned status of the device"
|
||||||
@ -49,7 +49,7 @@ menu "Example Configuration"
|
|||||||
This erases the NVS to reset provisioned status of the device on every reboot.
|
This erases the NVS to reset provisioned status of the device on every reboot.
|
||||||
Provisioned status is determined by the Wi-Fi STA configuration, saved on the NVS.
|
Provisioned status is determined by the Wi-Fi STA configuration, saved on the NVS.
|
||||||
|
|
||||||
config AP_RECONN_ATTEMPTS
|
config EXAMPLE_AP_RECONN_ATTEMPTS
|
||||||
int "Maximum AP connection attempts"
|
int "Maximum AP connection attempts"
|
||||||
default 5
|
default 5
|
||||||
help
|
help
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "app_prov.h"
|
#include "app_prov.h"
|
||||||
|
|
||||||
#define EXAMPLE_AP_RECONN_ATTEMPTS CONFIG_AP_RECONN_ATTEMPTS
|
#define EXAMPLE_AP_RECONN_ATTEMPTS CONFIG_EXAMPLE_AP_RECONN_ATTEMPTS
|
||||||
|
|
||||||
static const char *TAG = "app";
|
static const char *TAG = "app";
|
||||||
|
|
||||||
@ -65,21 +65,21 @@ static void start_softap_provisioning()
|
|||||||
/* Proof of possession */
|
/* Proof of possession */
|
||||||
const protocomm_security_pop_t *pop = NULL;
|
const protocomm_security_pop_t *pop = NULL;
|
||||||
|
|
||||||
#ifdef CONFIG_USE_SEC_1
|
#ifdef CONFIG_EXAMPLE_USE_SEC_1
|
||||||
security = 1;
|
security = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Having proof of possession is optional */
|
/* Having proof of possession is optional */
|
||||||
#ifdef CONFIG_USE_POP
|
#ifdef CONFIG_EXAMPLE_USE_POP
|
||||||
const static protocomm_security_pop_t app_pop = {
|
const static protocomm_security_pop_t app_pop = {
|
||||||
.data = (uint8_t *) CONFIG_POP,
|
.data = (uint8_t *) CONFIG_EXAMPLE_POP,
|
||||||
.len = (sizeof(CONFIG_POP)-1)
|
.len = (sizeof(CONFIG_EXAMPLE_POP)-1)
|
||||||
};
|
};
|
||||||
pop = &app_pop;
|
pop = &app_pop;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_ERROR_CHECK(app_prov_start_softap_provisioning(
|
ESP_ERROR_CHECK(app_prov_start_softap_provisioning(
|
||||||
CONFIG_SOFTAP_SSID, CONFIG_SOFTAP_PASS, security, pop));
|
CONFIG_EXAMPLE_SSID, CONFIG_EXAMPLE_PASS, security, pop));
|
||||||
}
|
}
|
||||||
|
|
||||||
void app_main()
|
void app_main()
|
||||||
|
@ -244,7 +244,7 @@ esp_err_t app_prov_is_provisioned(bool *provisioned)
|
|||||||
{
|
{
|
||||||
*provisioned = false;
|
*provisioned = false;
|
||||||
|
|
||||||
#ifdef CONFIG_RESET_PROVISIONED
|
#ifdef CONFIG_EXAMPLE_RESET_PROVISIONED
|
||||||
nvs_flash_erase();
|
nvs_flash_erase();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config SOFTAP_SSID_SET_MAC
|
config EXAMPLE_SSID_SET_MAC
|
||||||
bool "Use MAC as SSID"
|
bool "Use MAC as SSID"
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Set SoftAP SSID as PROV_<MAC>.
|
Set SoftAP SSID as PROV_<MAC>.
|
||||||
|
|
||||||
config SOFTAP_SSID
|
config EXAMPLE_SSID
|
||||||
string "Wi-Fi SSID"
|
string "Wi-Fi SSID"
|
||||||
default "PROV_SSID"
|
default "PROV_SSID"
|
||||||
depends on !SOFTAP_SSID_SET_MAC
|
depends on !EXAMPLE_SSID_SET_MAC
|
||||||
help
|
help
|
||||||
SSID (network name) for the example to connect to.
|
SSID (network name) for the example to connect to.
|
||||||
|
|
||||||
config SOFTAP_PASS
|
config EXAMPLE_PASS
|
||||||
string "Wi-Fi Password"
|
string "Wi-Fi Password"
|
||||||
default "PROV_PASS"
|
default "PROV_PASS"
|
||||||
help
|
help
|
||||||
Wi-Fi password (WPA or WPA2) for the example to use.
|
Wi-Fi password (WPA or WPA2) for the example to use.
|
||||||
|
|
||||||
config USE_SEC_1
|
config EXAMPLE_USE_SEC_1
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
prompt "Use Security Version 1"
|
prompt "Use Security Version 1"
|
||||||
@ -27,9 +27,9 @@ menu "Example Configuration"
|
|||||||
Security version 1 used Curve25519 key exchange for establishing
|
Security version 1 used Curve25519 key exchange for establishing
|
||||||
secure session between device and client during provisioning
|
secure session between device and client during provisioning
|
||||||
|
|
||||||
config USE_POP
|
config EXAMPLE_USE_POP
|
||||||
bool
|
bool
|
||||||
depends on USE_SEC_1
|
depends on EXAMPLE_USE_SEC_1
|
||||||
default y
|
default y
|
||||||
prompt "Use proof-of-possession"
|
prompt "Use proof-of-possession"
|
||||||
help
|
help
|
||||||
@ -37,12 +37,12 @@ menu "Example Configuration"
|
|||||||
in possession of the user who is provisioning the device. This proof-of-possession
|
in possession of the user who is provisioning the device. This proof-of-possession
|
||||||
is internally used to generate the shared secret through key exchange.
|
is internally used to generate the shared secret through key exchange.
|
||||||
|
|
||||||
config POP
|
config EXAMPLE_POP
|
||||||
string "Proof-of-possession"
|
string "Proof-of-possession"
|
||||||
default "abcd1234"
|
default "abcd1234"
|
||||||
depends on USE_POP
|
depends on EXAMPLE_USE_POP
|
||||||
|
|
||||||
config RESET_PROVISIONED
|
config EXAMPLE_RESET_PROVISIONED
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
prompt "Reset provisioned status of the device"
|
prompt "Reset provisioned status of the device"
|
||||||
@ -50,7 +50,7 @@ menu "Example Configuration"
|
|||||||
This erases the NVS to reset provisioned status of the device on every reboot.
|
This erases the NVS to reset provisioned status of the device on every reboot.
|
||||||
Provisioned status is determined by the Wi-Fi STA configuration, saved on the NVS.
|
Provisioned status is determined by the Wi-Fi STA configuration, saved on the NVS.
|
||||||
|
|
||||||
config AP_RECONN_ATTEMPTS
|
config EXAMPLE_AP_RECONN_ATTEMPTS
|
||||||
int "Maximum AP connection attempts"
|
int "Maximum AP connection attempts"
|
||||||
default 5
|
default 5
|
||||||
help
|
help
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "app_prov.h"
|
#include "app_prov.h"
|
||||||
|
|
||||||
#define EXAMPLE_AP_RECONN_ATTEMPTS CONFIG_AP_RECONN_ATTEMPTS
|
#define EXAMPLE_AP_RECONN_ATTEMPTS CONFIG_EXAMPLE_AP_RECONN_ATTEMPTS
|
||||||
|
|
||||||
static const char *TAG = "app";
|
static const char *TAG = "app";
|
||||||
|
|
||||||
@ -65,23 +65,23 @@ static void start_softap_provisioning()
|
|||||||
/* Proof of possession */
|
/* Proof of possession */
|
||||||
const protocomm_security_pop_t *pop = NULL;
|
const protocomm_security_pop_t *pop = NULL;
|
||||||
|
|
||||||
#ifdef CONFIG_USE_SEC_1
|
#ifdef CONFIG_EXAMPLE_USE_SEC_1
|
||||||
security = 1;
|
security = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Having proof of possession is optional */
|
/* Having proof of possession is optional */
|
||||||
#ifdef CONFIG_USE_POP
|
#ifdef CONFIG_EXAMPLE_USE_POP
|
||||||
const static protocomm_security_pop_t app_pop = {
|
const static protocomm_security_pop_t app_pop = {
|
||||||
.data = (uint8_t *) CONFIG_POP,
|
.data = (uint8_t *) CONFIG_EXAMPLE_POP,
|
||||||
.len = (sizeof(CONFIG_POP)-1)
|
.len = (sizeof(CONFIG_EXAMPLE_POP)-1)
|
||||||
};
|
};
|
||||||
pop = &app_pop;
|
pop = &app_pop;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *ssid = NULL;
|
const char *ssid = NULL;
|
||||||
|
|
||||||
#ifdef CONFIG_SOFTAP_SSID
|
#ifdef CONFIG_EXAMPLE_SSID
|
||||||
ssid = CONFIG_SOFTAP_SSID;
|
ssid = CONFIG_EXAMPLE_SSID;
|
||||||
#else
|
#else
|
||||||
uint8_t eth_mac[6];
|
uint8_t eth_mac[6];
|
||||||
esp_wifi_get_mac(WIFI_IF_STA, eth_mac);
|
esp_wifi_get_mac(WIFI_IF_STA, eth_mac);
|
||||||
@ -94,7 +94,7 @@ static void start_softap_provisioning()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_ERROR_CHECK(app_prov_start_softap_provisioning(
|
ESP_ERROR_CHECK(app_prov_start_softap_provisioning(
|
||||||
ssid, CONFIG_SOFTAP_PASS, security, pop));
|
ssid, CONFIG_EXAMPLE_PASS, security, pop));
|
||||||
}
|
}
|
||||||
|
|
||||||
void app_main()
|
void app_main()
|
||||||
|
@ -230,7 +230,7 @@ esp_err_t app_prov_is_provisioned(bool *provisioned)
|
|||||||
{
|
{
|
||||||
*provisioned = false;
|
*provisioned = false;
|
||||||
|
|
||||||
#ifdef CONFIG_RESET_PROVISIONED
|
#ifdef CONFIG_EXAMPLE_RESET_PROVISIONED
|
||||||
nvs_flash_erase();
|
nvs_flash_erase();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -23,10 +23,10 @@ menu "Example Configuration"
|
|||||||
bool "Other external storage"
|
bool "Other external storage"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
choice BASE_MAC_STORED_EFUSE_BLK3_ERROR_BEHAVIOR
|
choice BASE_MAC_STORED_EFUSE_BLK3_ERROR_BEHAV
|
||||||
prompt "Read base MAC address from BLK3 of eFuse error behavior"
|
prompt "Read base MAC address from BLK3 of eFuse error behavior"
|
||||||
depends on BASE_MAC_STORED_EFUSE_BLK3
|
depends on BASE_MAC_STORED_EFUSE_BLK3
|
||||||
default BASE_MAC_STORED_EFUSE_BLK3_ERROR_USE_DEFAULT
|
default BASE_MAC_STORED_EFUSE_BLK3_ERROR_DEFAULT
|
||||||
help
|
help
|
||||||
Select behavior when reading base MAC address from BLK3 of eFuse error.
|
Select behavior when reading base MAC address from BLK3 of eFuse error.
|
||||||
If "Abort" is selected, esp32 will abort.
|
If "Abort" is selected, esp32 will abort.
|
||||||
@ -35,7 +35,7 @@ menu "Example Configuration"
|
|||||||
|
|
||||||
config BASE_MAC_STORED_EFUSE_BLK3_ERROR_ABORT
|
config BASE_MAC_STORED_EFUSE_BLK3_ERROR_ABORT
|
||||||
bool "Abort"
|
bool "Abort"
|
||||||
config BASE_MAC_STORED_EFUSE_BLK3_ERROR_USE_DEFAULT
|
config BASE_MAC_STORED_EFUSE_BLK3_ERROR_DEFAULT
|
||||||
bool "Use base MAC address from BLK3 of eFuse"
|
bool "Use base MAC address from BLK3 of eFuse"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config WIFI_SSID
|
config EXAMPLE_WIFI_SSID
|
||||||
string "WiFi SSID"
|
string "WiFi SSID"
|
||||||
default "myssid"
|
default "myssid"
|
||||||
help
|
help
|
||||||
SSID (network name) for the example to connect to.
|
SSID (network name) for the example to connect to.
|
||||||
|
|
||||||
config WIFI_PASSWORD
|
config EXAMPLE_WIFI_PASSWORD
|
||||||
string "WiFi Password"
|
string "WiFi Password"
|
||||||
default "mypassword"
|
default "mypassword"
|
||||||
help
|
help
|
||||||
WiFi password (WPA or WPA2) for the example to use.
|
WiFi password (WPA or WPA2) for the example to use.
|
||||||
|
|
||||||
config FIRMWARE_UPGRADE_URL
|
config EXAMPLE_FIRMWARE_UPGRADE_URL
|
||||||
string "firmware upgrade url endpoint"
|
string "firmware upgrade url endpoint"
|
||||||
default "https://192.168.0.3:8070/hello-world.bin"
|
default "https://192.168.0.3:8070/hello-world.bin"
|
||||||
help
|
help
|
||||||
|
@ -65,8 +65,8 @@ static void initialise_wifi(void)
|
|||||||
ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
|
ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
|
||||||
wifi_config_t wifi_config = {
|
wifi_config_t wifi_config = {
|
||||||
.sta = {
|
.sta = {
|
||||||
.ssid = CONFIG_WIFI_SSID,
|
.ssid = CONFIG_EXAMPLE_WIFI_SSID,
|
||||||
.password = CONFIG_WIFI_PASSWORD,
|
.password = CONFIG_EXAMPLE_WIFI_PASSWORD,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
ESP_LOGI(TAG, "Setting WiFi configuration SSID %s", wifi_config.sta.ssid);
|
ESP_LOGI(TAG, "Setting WiFi configuration SSID %s", wifi_config.sta.ssid);
|
||||||
@ -104,7 +104,7 @@ void advanced_ota_example_task(void * pvParameter)
|
|||||||
|
|
||||||
esp_err_t ota_finish_err = ESP_OK;
|
esp_err_t ota_finish_err = ESP_OK;
|
||||||
esp_http_client_config_t config = {
|
esp_http_client_config_t config = {
|
||||||
.url = CONFIG_FIRMWARE_UPGRADE_URL,
|
.url = CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL,
|
||||||
.cert_pem = (char *)server_cert_pem_start,
|
.cert_pem = (char *)server_cert_pem_start,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config WIFI_SSID
|
config EXAMPLE_WIFI_SSID
|
||||||
string "WiFi SSID"
|
string "WiFi SSID"
|
||||||
default "myssid"
|
default "myssid"
|
||||||
help
|
help
|
||||||
SSID (network name) for the example to connect to.
|
SSID (network name) for the example to connect to.
|
||||||
|
|
||||||
config WIFI_PASSWORD
|
config EXAMPLE_WIFI_PASSWORD
|
||||||
string "WiFi Password"
|
string "WiFi Password"
|
||||||
default "mypassword"
|
default "mypassword"
|
||||||
help
|
help
|
||||||
@ -14,7 +14,7 @@ menu "Example Configuration"
|
|||||||
|
|
||||||
Can be left blank if the network has no security set.
|
Can be left blank if the network has no security set.
|
||||||
|
|
||||||
config FIRMWARE_UPG_URL
|
config EXAMPLE_FIRMWARE_UPG_URL
|
||||||
string "HTTP Server URL"
|
string "HTTP Server URL"
|
||||||
default "https://192.168.0.3:8070/hello-world.bin"
|
default "https://192.168.0.3:8070/hello-world.bin"
|
||||||
help
|
help
|
||||||
@ -22,7 +22,7 @@ menu "Example Configuration"
|
|||||||
|
|
||||||
See example README.md for details.
|
See example README.md for details.
|
||||||
|
|
||||||
config GPIO_DIAGNOSTIC
|
config EXAMPLE_GPIO_DIAGNOSTIC
|
||||||
int "Number of the GPIO input for diagnostic"
|
int "Number of the GPIO input for diagnostic"
|
||||||
range 0 39
|
range 0 39
|
||||||
default 4
|
default 4
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
|
|
||||||
#define EXAMPLE_WIFI_SSID CONFIG_WIFI_SSID
|
#define EXAMPLE_WIFI_SSID CONFIG_EXAMPLE_WIFI_SSID
|
||||||
#define EXAMPLE_WIFI_PASS CONFIG_WIFI_PASSWORD
|
#define EXAMPLE_WIFI_PASS CONFIG_EXAMPLE_WIFI_PASSWORD
|
||||||
#define EXAMPLE_SERVER_URL CONFIG_FIRMWARE_UPG_URL
|
#define EXAMPLE_SERVER_URL CONFIG_EXAMPLE_FIRMWARE_UPG_URL
|
||||||
#define BUFFSIZE 1024
|
#define BUFFSIZE 1024
|
||||||
#define HASH_LEN 32 /* SHA-256 digest length */
|
#define HASH_LEN 32 /* SHA-256 digest length */
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ static bool diagnostic(void)
|
|||||||
gpio_config_t io_conf;
|
gpio_config_t io_conf;
|
||||||
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
|
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
|
||||||
io_conf.mode = GPIO_MODE_INPUT;
|
io_conf.mode = GPIO_MODE_INPUT;
|
||||||
io_conf.pin_bit_mask = (1ULL << CONFIG_GPIO_DIAGNOSTIC);
|
io_conf.pin_bit_mask = (1ULL << CONFIG_EXAMPLE_GPIO_DIAGNOSTIC);
|
||||||
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
||||||
io_conf.pull_up_en = GPIO_PULLUP_ENABLE;
|
io_conf.pull_up_en = GPIO_PULLUP_ENABLE;
|
||||||
gpio_config(&io_conf);
|
gpio_config(&io_conf);
|
||||||
@ -274,9 +274,9 @@ static bool diagnostic(void)
|
|||||||
ESP_LOGI(TAG, "Diagnostics (5 sec)...");
|
ESP_LOGI(TAG, "Diagnostics (5 sec)...");
|
||||||
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
bool diagnostic_is_ok = gpio_get_level(CONFIG_GPIO_DIAGNOSTIC);
|
bool diagnostic_is_ok = gpio_get_level(CONFIG_EXAMPLE_GPIO_DIAGNOSTIC);
|
||||||
|
|
||||||
gpio_reset_pin(CONFIG_GPIO_DIAGNOSTIC);
|
gpio_reset_pin(CONFIG_EXAMPLE_GPIO_DIAGNOSTIC);
|
||||||
return diagnostic_is_ok;
|
return diagnostic_is_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config WIFI_SSID
|
config EXAMPLE_WIFI_SSID
|
||||||
string "WiFi SSID"
|
string "WiFi SSID"
|
||||||
default "myssid"
|
default "myssid"
|
||||||
help
|
help
|
||||||
SSID (network name) for the example to connect to.
|
SSID (network name) for the example to connect to.
|
||||||
|
|
||||||
config WIFI_PASSWORD
|
config EXAMPLE_WIFI_PASSWORD
|
||||||
string "WiFi Password"
|
string "WiFi Password"
|
||||||
default "mypassword"
|
default "mypassword"
|
||||||
help
|
help
|
||||||
WiFi password (WPA or WPA2) for the example to use.
|
WiFi password (WPA or WPA2) for the example to use.
|
||||||
|
|
||||||
config FIRMWARE_UPGRADE_URL
|
config EXAMPLE_FIRMWARE_UPGRADE_URL
|
||||||
string "firmware upgrade url endpoint"
|
string "firmware upgrade url endpoint"
|
||||||
default "https://192.168.0.3:8070/hello-world.bin"
|
default "https://192.168.0.3:8070/hello-world.bin"
|
||||||
help
|
help
|
||||||
|
@ -92,8 +92,8 @@ static void initialise_wifi(void)
|
|||||||
ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
|
ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
|
||||||
wifi_config_t wifi_config = {
|
wifi_config_t wifi_config = {
|
||||||
.sta = {
|
.sta = {
|
||||||
.ssid = CONFIG_WIFI_SSID,
|
.ssid = CONFIG_EXAMPLE_WIFI_SSID,
|
||||||
.password = CONFIG_WIFI_PASSWORD,
|
.password = CONFIG_EXAMPLE_WIFI_PASSWORD,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
ESP_LOGI(TAG, "Setting WiFi configuration SSID %s", wifi_config.sta.ssid);
|
ESP_LOGI(TAG, "Setting WiFi configuration SSID %s", wifi_config.sta.ssid);
|
||||||
@ -114,7 +114,7 @@ void simple_ota_example_task(void * pvParameter)
|
|||||||
ESP_LOGI(TAG, "Connected to WiFi network! Attempting to connect to server...");
|
ESP_LOGI(TAG, "Connected to WiFi network! Attempting to connect to server...");
|
||||||
|
|
||||||
esp_http_client_config_t config = {
|
esp_http_client_config_t config = {
|
||||||
.url = CONFIG_FIRMWARE_UPGRADE_URL,
|
.url = CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL,
|
||||||
.cert_pem = (char *)server_cert_pem_start,
|
.cert_pem = (char *)server_cert_pem_start,
|
||||||
.event_handler = _http_event_handler,
|
.event_handler = _http_event_handler,
|
||||||
};
|
};
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
choice WIFI_MODE
|
choice ESPNOW_WIFI_MODE
|
||||||
prompt "WiFi mode"
|
prompt "WiFi mode"
|
||||||
default STATION_MODE
|
default ESPNOW_WIFI_MODE_STATION
|
||||||
help
|
help
|
||||||
WiFi mode(station or softap).
|
WiFi mode(station or softap).
|
||||||
|
|
||||||
config STATION_MODE
|
config ESPNOW_WIFI_MODE_STATION
|
||||||
bool "Station"
|
bool "Station"
|
||||||
config SOFTAP_MODE
|
config ESPNOW_WIFI_MODE_STATION_SOFTAP
|
||||||
bool "Softap"
|
bool "Softap"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ menu "Example Configuration"
|
|||||||
help
|
help
|
||||||
Length of ESPNOW data to be sent, unit: byte.
|
Length of ESPNOW data to be sent, unit: byte.
|
||||||
|
|
||||||
config ENABLE_LONG_RANGE
|
config ESPNOW_ENABLE_LONG_RANGE
|
||||||
bool "Enable Long Range"
|
bool "Enable Long Range"
|
||||||
default "n"
|
default "n"
|
||||||
help
|
help
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#define ESPNOW_EXAMPLE_H
|
#define ESPNOW_EXAMPLE_H
|
||||||
|
|
||||||
/* ESPNOW can work in both station and softap mode. It is configured in menuconfig. */
|
/* ESPNOW can work in both station and softap mode. It is configured in menuconfig. */
|
||||||
#if CONFIG_STATION_MODE
|
#if CONFIG_ESPNOW_WIFI_MODE_STATION
|
||||||
#define ESPNOW_WIFI_MODE WIFI_MODE_STA
|
#define ESPNOW_WIFI_MODE WIFI_MODE_STA
|
||||||
#define ESPNOW_WIFI_IF ESP_IF_WIFI_STA
|
#define ESPNOW_WIFI_IF ESP_IF_WIFI_STA
|
||||||
#else
|
#else
|
||||||
|
@ -56,7 +56,7 @@ static void example_wifi_init(void)
|
|||||||
*/
|
*/
|
||||||
ESP_ERROR_CHECK( esp_wifi_set_channel(CONFIG_ESPNOW_CHANNEL, 0) );
|
ESP_ERROR_CHECK( esp_wifi_set_channel(CONFIG_ESPNOW_CHANNEL, 0) );
|
||||||
|
|
||||||
#if CONFIG_ENABLE_LONG_RANGE
|
#if CONFIG_ESPNOW_ENABLE_LONG_RANGE
|
||||||
ESP_ERROR_CHECK( esp_wifi_set_protocol(ESPNOW_WIFI_IF, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_LR) );
|
ESP_ERROR_CHECK( esp_wifi_set_protocol(ESPNOW_WIFI_IF, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_LR) );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ menu "Example Configuration"
|
|||||||
help
|
help
|
||||||
WiFi password (WPA or WPA2) for the example to use.
|
WiFi password (WPA or WPA2) for the example to use.
|
||||||
|
|
||||||
config MAX_STA_CONN
|
config ESP_MAX_STA_CONN
|
||||||
int "Maximal STA connections"
|
int "Maximal STA connections"
|
||||||
default 4
|
default 4
|
||||||
help
|
help
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
#define EXAMPLE_ESP_WIFI_SSID CONFIG_ESP_WIFI_SSID
|
#define EXAMPLE_ESP_WIFI_SSID CONFIG_ESP_WIFI_SSID
|
||||||
#define EXAMPLE_ESP_WIFI_PASS CONFIG_ESP_WIFI_PASSWORD
|
#define EXAMPLE_ESP_WIFI_PASS CONFIG_ESP_WIFI_PASSWORD
|
||||||
#define EXAMPLE_MAX_STA_CONN CONFIG_MAX_STA_CONN
|
#define EXAMPLE_MAX_STA_CONN CONFIG_ESP_MAX_STA_CONN
|
||||||
|
|
||||||
/* FreeRTOS event group to signal when we are connected*/
|
/* FreeRTOS event group to signal when we are connected*/
|
||||||
static EventGroupHandle_t s_wifi_event_group;
|
static EventGroupHandle_t s_wifi_event_group;
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config WIFI_SSID
|
config EXAMPLE_WIFI_SSID
|
||||||
string "WiFi SSID"
|
string "WiFi SSID"
|
||||||
default "myssid"
|
default "myssid"
|
||||||
help
|
help
|
||||||
SSID (network name) for the example to connect to.
|
SSID (network name) for the example to connect to.
|
||||||
|
|
||||||
config WIFI_PASSWORD
|
config EXAMPLE_WIFI_PASSWORD
|
||||||
string "WiFi Password"
|
string "WiFi Password"
|
||||||
default "mypassword"
|
default "mypassword"
|
||||||
help
|
help
|
||||||
WiFi password (WPA or WPA2) for the example to use.
|
WiFi password (WPA or WPA2) for the example to use.
|
||||||
|
|
||||||
config WIFI_LISTEN_INTERVAL
|
config EXAMPLE_WIFI_LISTEN_INTERVAL
|
||||||
int "WiFi listen interval"
|
int "WiFi listen interval"
|
||||||
default 3
|
default 3
|
||||||
help
|
help
|
||||||
@ -20,9 +20,9 @@ menu "Example Configuration"
|
|||||||
For example, if beacon interval is 100 ms and listen interval is 3, the interval for station to listen
|
For example, if beacon interval is 100 ms and listen interval is 3, the interval for station to listen
|
||||||
to beacon is 300 ms.
|
to beacon is 300 ms.
|
||||||
|
|
||||||
choice POWER_SAVE_MODE
|
choice EXAMPLE_POWER_SAVE_MODE
|
||||||
prompt "power save mode"
|
prompt "power save mode"
|
||||||
default POWER_SAVE_MIN_MODEM
|
default EXAMPLE_POWER_SAVE_MIN_MODEM
|
||||||
help
|
help
|
||||||
Power save mode for the esp32 to use. Modem sleep mode includes minimum and maximum power save modes.
|
Power save mode for the esp32 to use. Modem sleep mode includes minimum and maximum power save modes.
|
||||||
In minimum power save mode, station wakes up every DTIM to receive beacon. Broadcast data will not be
|
In minimum power save mode, station wakes up every DTIM to receive beacon. Broadcast data will not be
|
||||||
@ -32,11 +32,11 @@ menu "Example Configuration"
|
|||||||
may be lost because station may be in sleep state at DTIM time. If listen interval is longer, more power
|
may be lost because station may be in sleep state at DTIM time. If listen interval is longer, more power
|
||||||
is saved but broadcast data is more easy to lose.
|
is saved but broadcast data is more easy to lose.
|
||||||
|
|
||||||
config POWER_SAVE_NONE
|
config EXAMPLE_POWER_SAVE_NONE
|
||||||
bool "none"
|
bool "none"
|
||||||
config POWER_SAVE_MIN_MODEM
|
config EXAMPLE_POWER_SAVE_MIN_MODEM
|
||||||
bool "minimum modem"
|
bool "minimum modem"
|
||||||
config POWER_SAVE_MAX_MODEM
|
config EXAMPLE_POWER_SAVE_MAX_MODEM
|
||||||
bool "maximum modem"
|
bool "maximum modem"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
@ -21,16 +21,16 @@
|
|||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
|
|
||||||
/*set the ssid and password via "make menuconfig"*/
|
/*set the ssid and password via "make menuconfig"*/
|
||||||
#define DEFAULT_SSID CONFIG_WIFI_SSID
|
#define DEFAULT_SSID CONFIG_EXAMPLE_WIFI_SSID
|
||||||
#define DEFAULT_PWD CONFIG_WIFI_PASSWORD
|
#define DEFAULT_PWD CONFIG_EXAMPLE_WIFI_PASSWORD
|
||||||
|
|
||||||
#define DEFAULT_LISTEN_INTERVAL CONFIG_WIFI_LISTEN_INTERVAL
|
#define DEFAULT_LISTEN_INTERVAL CONFIG_EXAMPLE_WIFI_LISTEN_INTERVAL
|
||||||
|
|
||||||
#if CONFIG_POWER_SAVE_MIN_MODEM
|
#if CONFIG_EXAMPLE_POWER_SAVE_MIN_MODEM
|
||||||
#define DEFAULT_PS_MODE WIFI_PS_MIN_MODEM
|
#define DEFAULT_PS_MODE WIFI_PS_MIN_MODEM
|
||||||
#elif CONFIG_POWER_SAVE_MAX_MODEM
|
#elif CONFIG_EXAMPLE_POWER_SAVE_MAX_MODEM
|
||||||
#define DEFAULT_PS_MODE WIFI_PS_MAX_MODEM
|
#define DEFAULT_PS_MODE WIFI_PS_MAX_MODEM
|
||||||
#elif CONFIG_POWER_SAVE_NONE
|
#elif CONFIG_EXAMPLE_POWER_SAVE_NONE
|
||||||
#define DEFAULT_PS_MODE WIFI_PS_NONE
|
#define DEFAULT_PS_MODE WIFI_PS_NONE
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_PS_MODE WIFI_PS_NONE
|
#define DEFAULT_PS_MODE WIFI_PS_NONE
|
||||||
|
@ -1,67 +1,67 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config WIFI_SSID
|
config EXAMPLE_WIFI_SSID
|
||||||
string "WiFi SSID"
|
string "WiFi SSID"
|
||||||
default "myssid"
|
default "myssid"
|
||||||
help
|
help
|
||||||
SSID (network name) for the example to connect to.
|
SSID (network name) for the example to connect to.
|
||||||
|
|
||||||
config WIFI_PASSWORD
|
config EXAMPLE_WIFI_PASSWORD
|
||||||
string "WiFi Password"
|
string "WiFi Password"
|
||||||
default "mypassword"
|
default "mypassword"
|
||||||
help
|
help
|
||||||
WiFi password (WPA or WPA2) for the example to use.
|
WiFi password (WPA or WPA2) for the example to use.
|
||||||
|
|
||||||
choice SCAN_METHOD
|
choice EXAMPLE_SCAN_METHOD
|
||||||
prompt "scan method"
|
prompt "scan method"
|
||||||
default WIFI_FAST_SCAN
|
default EXAMPLE_WIFI_FAST_SCAN
|
||||||
help
|
help
|
||||||
scan method for the esp32 to use
|
scan method for the esp32 to use
|
||||||
|
|
||||||
config WIFI_FAST_SCAN
|
config EXAMPLE_WIFI_FAST_SCAN
|
||||||
bool "fast"
|
bool "fast"
|
||||||
config WIFI_ALL_CHANNEL_SCAN
|
config EXAMPLE_WIFI_ALL_CHANNEL_SCAN
|
||||||
bool "all"
|
bool "all"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
choice SORT_METHOD
|
choice EXAMPLE_SORT_METHOD
|
||||||
prompt "sort method"
|
prompt "sort method"
|
||||||
default WIFI_CONNECT_AP_BY_SIGNAL
|
default EXAMPLE_WIFI_CONNECT_AP_BY_SIGNAL
|
||||||
help
|
help
|
||||||
sort method for the esp32 to use
|
sort method for the esp32 to use
|
||||||
|
|
||||||
config WIFI_CONNECT_AP_BY_SIGNAL
|
config EXAMPLE_WIFI_CONNECT_AP_BY_SIGNAL
|
||||||
bool "rssi"
|
bool "rssi"
|
||||||
config WIFI_CONNECT_AP_BY_SECURITY
|
config EXAMPLE_WIFI_CONNECT_AP_BY_SECURITY
|
||||||
bool "authmode"
|
bool "authmode"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config FAST_SCAN_THRESHOLD
|
config EXAMPLE_FAST_SCAN_THRESHOLD
|
||||||
bool "fast scan threshold"
|
bool "fast scan threshold"
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
wifi fast scan threshold
|
wifi fast scan threshold
|
||||||
|
|
||||||
config FAST_SCAN_MINIMUM_SIGNAL
|
config EXAMPLE_FAST_SCAN_MINIMUM_SIGNAL
|
||||||
int "fast scan minimum rssi"
|
int "fast scan minimum rssi"
|
||||||
depends on FAST_SCAN_THRESHOLD
|
depends on EXAMPLE_FAST_SCAN_THRESHOLD
|
||||||
range -127 0
|
range -127 0
|
||||||
default -127
|
default -127
|
||||||
help
|
help
|
||||||
rssi is use to measure the signal
|
rssi is use to measure the signal
|
||||||
|
|
||||||
choice FAST_SCAN_WEAKEST_AUTHMODE
|
choice EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE
|
||||||
prompt "fast scan weakest authmode"
|
prompt "fast scan weakest authmode"
|
||||||
depends on FAST_SCAN_THRESHOLD
|
depends on EXAMPLE_FAST_SCAN_THRESHOLD
|
||||||
default EXAMPLE_OPEN
|
default EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_OPEN
|
||||||
|
|
||||||
config EXAMPLE_OPEN
|
config EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_OPEN
|
||||||
bool "open"
|
bool "open"
|
||||||
config EXAMPLE_WEP
|
config EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_WEP
|
||||||
bool "wep"
|
bool "wep"
|
||||||
config EXAMPLE_WPA
|
config EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_WPA
|
||||||
bool "wpa"
|
bool "wpa"
|
||||||
config EXAMPLE_WPA2
|
config EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_WPA2
|
||||||
bool "wpa2"
|
bool "wpa2"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
@ -29,34 +29,34 @@
|
|||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
|
|
||||||
/*Set the SSID and Password via "make menuconfig"*/
|
/*Set the SSID and Password via "make menuconfig"*/
|
||||||
#define DEFAULT_SSID CONFIG_WIFI_SSID
|
#define DEFAULT_SSID CONFIG_EXAMPLE_WIFI_SSID
|
||||||
#define DEFAULT_PWD CONFIG_WIFI_PASSWORD
|
#define DEFAULT_PWD CONFIG_EXAMPLE_WIFI_PASSWORD
|
||||||
|
|
||||||
#if CONFIG_WIFI_ALL_CHANNEL_SCAN
|
#if CONFIG_EXAMPLE_WIFI_ALL_CHANNEL_SCAN
|
||||||
#define DEFAULT_SCAN_METHOD WIFI_ALL_CHANNEL_SCAN
|
#define DEFAULT_SCAN_METHOD WIFI_ALL_CHANNEL_SCAN
|
||||||
#elif CONFIG_WIFI_FAST_SCAN
|
#elif CONFIG_EXAMPLE_WIFI_FAST_SCAN
|
||||||
#define DEFAULT_SCAN_METHOD WIFI_FAST_SCAN
|
#define DEFAULT_SCAN_METHOD WIFI_FAST_SCAN
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_SCAN_METHOD WIFI_FAST_SCAN
|
#define DEFAULT_SCAN_METHOD WIFI_FAST_SCAN
|
||||||
#endif /*CONFIG_SCAN_METHOD*/
|
#endif /*CONFIG_EXAMPLE_SCAN_METHOD*/
|
||||||
|
|
||||||
#if CONFIG_WIFI_CONNECT_AP_BY_SIGNAL
|
#if CONFIG_EXAMPLE_WIFI_CONNECT_AP_BY_SIGNAL
|
||||||
#define DEFAULT_SORT_METHOD WIFI_CONNECT_AP_BY_SIGNAL
|
#define DEFAULT_SORT_METHOD WIFI_CONNECT_AP_BY_SIGNAL
|
||||||
#elif CONFIG_WIFI_CONNECT_AP_BY_SECURITY
|
#elif CONFIG_EXAMPLE_WIFI_CONNECT_AP_BY_SECURITY
|
||||||
#define DEFAULT_SORT_METHOD WIFI_CONNECT_AP_BY_SECURITY
|
#define DEFAULT_SORT_METHOD WIFI_CONNECT_AP_BY_SECURITY
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_SORT_METHOD WIFI_CONNECT_AP_BY_SIGNAL
|
#define DEFAULT_SORT_METHOD WIFI_CONNECT_AP_BY_SIGNAL
|
||||||
#endif /*CONFIG_SORT_METHOD*/
|
#endif /*CONFIG_EXAMPLE_SORT_METHOD*/
|
||||||
|
|
||||||
#if CONFIG_FAST_SCAN_THRESHOLD
|
#if CONFIG_EXAMPLE_FAST_SCAN_THRESHOLD
|
||||||
#define DEFAULT_RSSI CONFIG_FAST_SCAN_MINIMUM_SIGNAL
|
#define DEFAULT_RSSI CONFIG_EXAMPLE_FAST_SCAN_MINIMUM_SIGNAL
|
||||||
#if CONFIG_EXAMPLE_OPEN
|
#if CONFIG_EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_OPEN
|
||||||
#define DEFAULT_AUTHMODE WIFI_AUTH_OPEN
|
#define DEFAULT_AUTHMODE WIFI_AUTH_OPEN
|
||||||
#elif CONFIG_EXAMPLE_WEP
|
#elif CONFIG_EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_WEP
|
||||||
#define DEFAULT_AUTHMODE WIFI_AUTH_WEP
|
#define DEFAULT_AUTHMODE WIFI_AUTH_WEP
|
||||||
#elif CONFIG_EXAMPLE_WPA
|
#elif CONFIG_EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_WPA
|
||||||
#define DEFAULT_AUTHMODE WIFI_AUTH_WPA_PSK
|
#define DEFAULT_AUTHMODE WIFI_AUTH_WPA_PSK
|
||||||
#elif CONFIG_EXAMPLE_WPA2
|
#elif CONFIG_EXAMPLE_FAST_SCAN_WEAKEST_AUTHMODE_WPA2
|
||||||
#define DEFAULT_AUTHMODE WIFI_AUTH_WPA2_PSK
|
#define DEFAULT_AUTHMODE WIFI_AUTH_WPA2_PSK
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_AUTHMODE WIFI_AUTH_OPEN
|
#define DEFAULT_AUTHMODE WIFI_AUTH_OPEN
|
||||||
@ -64,7 +64,7 @@
|
|||||||
#else
|
#else
|
||||||
#define DEFAULT_RSSI -127
|
#define DEFAULT_RSSI -127
|
||||||
#define DEFAULT_AUTHMODE WIFI_AUTH_OPEN
|
#define DEFAULT_AUTHMODE WIFI_AUTH_OPEN
|
||||||
#endif /*CONFIG_FAST_SCAN_THRESHOLD*/
|
#endif /*CONFIG_EXAMPLE_FAST_SCAN_THRESHOLD*/
|
||||||
|
|
||||||
static const char *TAG = "scan";
|
static const char *TAG = "scan";
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config STORE_HISTORY
|
config SNIFFER_STORE_HISTORY
|
||||||
bool "Store command history into flash"
|
bool "Store command history into flash"
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
@ -30,7 +30,7 @@ menu "Example Configuration"
|
|||||||
help
|
help
|
||||||
Specify the mount point in the VFS (Virtual File System) for SD card.
|
Specify the mount point in the VFS (Virtual File System) for SD card.
|
||||||
|
|
||||||
config PCAP_FILE_NAME_MAX_LEN
|
config SNIFFER_PCAP_FILE_NAME_MAX_LEN
|
||||||
int "Max name length of pcap file"
|
int "Max name length of pcap file"
|
||||||
default 32
|
default 32
|
||||||
help
|
help
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
#define SNIFFER_DEFAULT_FILE_NAME "esp-sniffer"
|
#define SNIFFER_DEFAULT_FILE_NAME "esp-sniffer"
|
||||||
#define SNIFFER_FILE_NAME_MAX_LEN CONFIG_PCAP_FILE_NAME_MAX_LEN
|
#define SNIFFER_FILE_NAME_MAX_LEN CONFIG_SNIFFER_PCAP_FILE_NAME_MAX_LEN
|
||||||
#define SNIFFER_DEFAULT_CHANNEL (1)
|
#define SNIFFER_DEFAULT_CHANNEL (1)
|
||||||
#define SNIFFER_PAYLOAD_FCS_LEN (4)
|
#define SNIFFER_PAYLOAD_FCS_LEN (4)
|
||||||
#define SNIFFER_PROCESS_PACKET_TIMEOUT_MS (100)
|
#define SNIFFER_PROCESS_PACKET_TIMEOUT_MS (100)
|
||||||
|
@ -27,14 +27,14 @@
|
|||||||
#include "cmd_decl.h"
|
#include "cmd_decl.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
#if CONFIG_STORE_HISTORY
|
#if CONFIG_SNIFFER_STORE_HISTORY
|
||||||
#define HISTORY_MOUNT_POINT "/data"
|
#define HISTORY_MOUNT_POINT "/data"
|
||||||
#define HISTORY_FILE_PATH HISTORY_MOUNT_POINT "/history.txt"
|
#define HISTORY_FILE_PATH HISTORY_MOUNT_POINT "/history.txt"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char *TAG = "example";
|
static const char *TAG = "example";
|
||||||
|
|
||||||
#if CONFIG_STORE_HISTORY
|
#if CONFIG_SNIFFER_STORE_HISTORY
|
||||||
/* Initialize filesystem for command history store */
|
/* Initialize filesystem for command history store */
|
||||||
static void initialize_filesystem()
|
static void initialize_filesystem()
|
||||||
{
|
{
|
||||||
@ -113,7 +113,7 @@ static void initialize_console()
|
|||||||
/* Set command history size */
|
/* Set command history size */
|
||||||
linenoiseHistorySetMaxLen(100);
|
linenoiseHistorySetMaxLen(100);
|
||||||
|
|
||||||
#if CONFIG_STORE_HISTORY
|
#if CONFIG_SNIFFER_STORE_HISTORY
|
||||||
/* Load command history from filesystem */
|
/* Load command history from filesystem */
|
||||||
linenoiseHistoryLoad(HISTORY_FILE_PATH);
|
linenoiseHistoryLoad(HISTORY_FILE_PATH);
|
||||||
#endif
|
#endif
|
||||||
@ -223,7 +223,7 @@ void app_main(void)
|
|||||||
{
|
{
|
||||||
initialize_nvs();
|
initialize_nvs();
|
||||||
|
|
||||||
#if CONFIG_STORE_HISTORY
|
#if CONFIG_SNIFFER_STORE_HISTORY
|
||||||
initialize_filesystem();
|
initialize_filesystem();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ void app_main(void)
|
|||||||
/* Add the command to the history */
|
/* Add the command to the history */
|
||||||
linenoiseHistoryAdd(line);
|
linenoiseHistoryAdd(line);
|
||||||
|
|
||||||
#if CONFIG_STORE_HISTORY
|
#if CONFIG_SNIFFER_STORE_HISTORY
|
||||||
/* Save command history to filesystem */
|
/* Save command history to filesystem */
|
||||||
linenoiseHistorySave(HISTORY_FILE_PATH);
|
linenoiseHistorySave(HISTORY_FILE_PATH);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config WIFI_SSID
|
config EXAMPLE_WIFI_SSID
|
||||||
string "WiFi SSID"
|
string "WiFi SSID"
|
||||||
default "wpa2_test"
|
default "wpa2_test"
|
||||||
help
|
help
|
||||||
SSID (network name) for the example to connect to.
|
SSID (network name) for the example to connect to.
|
||||||
|
|
||||||
config EAP_METHOD
|
config EXAMPLE_EAP_METHOD
|
||||||
int "EAP METHOD"
|
int "EAP METHOD"
|
||||||
default 1
|
default 1
|
||||||
help
|
help
|
||||||
EAP method (TLS, PEAP or TTLS) for the example to use.
|
EAP method (TLS, PEAP or TTLS) for the example to use.
|
||||||
TLS: 0, PEAP: 1, TTLS: 2
|
TLS: 0, PEAP: 1, TTLS: 2
|
||||||
|
|
||||||
config EAP_ID
|
config EXAMPLE_EAP_ID
|
||||||
string "EAP ID"
|
string "EAP ID"
|
||||||
default "example@espressif.com"
|
default "example@espressif.com"
|
||||||
help
|
help
|
||||||
Identity in phase 1 of EAP procedure.
|
Identity in phase 1 of EAP procedure.
|
||||||
|
|
||||||
config EAP_USERNAME
|
config EXAMPLE_EAP_USERNAME
|
||||||
string "EAP USERNAME"
|
string "EAP USERNAME"
|
||||||
default "espressif"
|
default "espressif"
|
||||||
help
|
help
|
||||||
Username for EAP method (PEAP and TTLS).
|
Username for EAP method (PEAP and TTLS).
|
||||||
|
|
||||||
config EAP_PASSWORD
|
config EXAMPLE_EAP_PASSWORD
|
||||||
string "EAP PASSWORD"
|
string "EAP PASSWORD"
|
||||||
default "test11"
|
default "test11"
|
||||||
help
|
help
|
||||||
Password for EAP method (PEAP and TTLS).
|
Password for EAP method (PEAP and TTLS).
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -38,12 +38,12 @@
|
|||||||
You can choose EAP method via 'make menuconfig' according to the
|
You can choose EAP method via 'make menuconfig' according to the
|
||||||
configuration of AP.
|
configuration of AP.
|
||||||
*/
|
*/
|
||||||
#define EXAMPLE_WIFI_SSID CONFIG_WIFI_SSID
|
#define EXAMPLE_WIFI_SSID CONFIG_EXAMPLE_WIFI_SSID
|
||||||
#define EXAMPLE_EAP_METHOD CONFIG_EAP_METHOD
|
#define EXAMPLE_EAP_METHOD CONFIG_EXAMPLE_EAP_METHOD
|
||||||
|
|
||||||
#define EXAMPLE_EAP_ID CONFIG_EAP_ID
|
#define EXAMPLE_EAP_ID CONFIG_EXAMPLE_EAP_ID
|
||||||
#define EXAMPLE_EAP_USERNAME CONFIG_EAP_USERNAME
|
#define EXAMPLE_EAP_USERNAME CONFIG_EXAMPLE_EAP_USERNAME
|
||||||
#define EXAMPLE_EAP_PASSWORD CONFIG_EAP_PASSWORD
|
#define EXAMPLE_EAP_PASSWORD CONFIG_EXAMPLE_EAP_PASSWORD
|
||||||
|
|
||||||
/* FreeRTOS event group to signal when we are connected & ready to make a request */
|
/* FreeRTOS event group to signal when we are connected & ready to make a request */
|
||||||
static EventGroupHandle_t wifi_event_group;
|
static EventGroupHandle_t wifi_event_group;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user