From 0b257cfcefa1144579f8dfe4103a97146665fac6 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 12 Jan 2017 13:30:39 +1100 Subject: [PATCH 1/6] bt: esp_ble_gatts_send_indicate: Fix description --- components/bt/bluedroid/api/include/esp_gatts_api.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/bt/bluedroid/api/include/esp_gatts_api.h b/components/bt/bluedroid/api/include/esp_gatts_api.h index b18039ce79..777bbec3de 100644 --- a/components/bt/bluedroid/api/include/esp_gatts_api.h +++ b/components/bt/bluedroid/api/include/esp_gatts_api.h @@ -449,7 +449,8 @@ esp_err_t esp_ble_gatts_stop_service(uint16_t service_handle); * @param[in] attr_handle - attribute handle to indicate. * @param[in] value_len - indicate value length. * @param[in] value: value to indicate. - * @param[in] need_confirm - if this indication expects a confirmation or not. + * @param[in] need_confirm - Whether a confirmation is required. + * false sends a GATT notification, true sends a GATT indication. * * @return * - ESP_OK : success From b022232e8415f1362ada131df253cc4e07b53ce9 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 18 Jan 2017 10:57:53 +1100 Subject: [PATCH 2/6] esp_panic.h: Add C++ include guards --- components/esp32/include/esp_panic.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/esp32/include/esp_panic.h b/components/esp32/include/esp_panic.h index aa83c6d381..e9668facc5 100644 --- a/components/esp32/include/esp_panic.h +++ b/components/esp32/include/esp_panic.h @@ -1,6 +1,10 @@ #ifndef PANIC_H #define PANIC_H +#ifdef __cplusplus +extern "C" +{ +#endif #define PANIC_RSN_NONE 0 #define PANIC_RSN_DEBUGEXCEPTION 1 @@ -59,4 +63,8 @@ void esp_clear_watchpoint(int no); #endif +#ifdef __cplusplus +} +#endif + #endif From ac412feb69abad798d6b989d23293d61092f6eaa Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Thu, 19 Jan 2017 23:46:41 +1100 Subject: [PATCH 3/6] gpio: Attach gpio intr to the isr_server on the right core. Make sure GPIO interrupts get attached to the core that the ISR service routine is running on, otherwise they don't arrive. --- components/driver/gpio.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/components/driver/gpio.c b/components/driver/gpio.c index 4e83705408..f1e724dd57 100644 --- a/components/driver/gpio.c +++ b/components/driver/gpio.c @@ -133,10 +133,10 @@ esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type) return ESP_OK; } -esp_err_t gpio_intr_enable(gpio_num_t gpio_num) +static esp_err_t gpio_intr_enable_on_core (gpio_num_t gpio_num, uint32_t core_id) { GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG); - if (xPortGetCoreID() == 0) { + if (core_id == 0) { GPIO.pin[gpio_num].int_ena = GPIO_PRO_CPU_INTR_ENA; //enable pro cpu intr } else { GPIO.pin[gpio_num].int_ena = GPIO_APP_CPU_INTR_ENA; //enable pro cpu intr @@ -144,6 +144,11 @@ esp_err_t gpio_intr_enable(gpio_num_t gpio_num) return ESP_OK; } +esp_err_t gpio_intr_enable(gpio_num_t gpio_num) +{ + return gpio_intr_enable_on_core (gpio_num, xPortGetCoreID()); +} + esp_err_t gpio_intr_disable(gpio_num_t gpio_num) { GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG); @@ -380,7 +385,7 @@ esp_err_t gpio_isr_handler_add(gpio_num_t gpio_num, gpio_isr_t isr_handler, void gpio_isr_func[gpio_num].fn = isr_handler; gpio_isr_func[gpio_num].args = args; } - gpio_intr_enable(gpio_num); + gpio_intr_enable_on_core (gpio_num, esp_intr_get_cpu(gpio_isr_handle)); portEXIT_CRITICAL(&gpio_spinlock); return ESP_OK; } From a14f22f65bf7bb69a4a11db22011cc1cd57e5ee4 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Fri, 20 Jan 2017 14:17:03 +1100 Subject: [PATCH 4/6] netconn_gethostbyname: Fix race reporting success If the DNS request is dispatched and performed very quickly, then it can complete before tcpip_callback() actually returns, in which case we'll destroy the actual err_t error value passed in the message. Use a local variable for the tcpip_callback error code so that can't happen. Resolves #269 https://github.com/espressif/esp-idf/pull/269 --- components/lwip/api/api_lib.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/lwip/api/api_lib.c b/components/lwip/api/api_lib.c index 087115f0b9..e5c247f0bc 100755 --- a/components/lwip/api/api_lib.c +++ b/components/lwip/api/api_lib.c @@ -880,10 +880,11 @@ netconn_gethostbyname(const char *name, ip_addr_t *addr) { API_VAR_DECLARE(struct dns_api_msg, msg); + err_t localerr; #if !LWIP_MPU_COMPATIBLE sys_sem_t sem; #endif /* LWIP_MPU_COMPATIBLE */ - err_t err; + err_t err = ERR_OK; LWIP_ERROR("netconn_gethostbyname: invalid name", (name != NULL), return ERR_ARG;); LWIP_ERROR("netconn_gethostbyname: invalid addr", (addr != NULL), return ERR_ARG;); @@ -918,14 +919,14 @@ netconn_gethostbyname(const char *name, ip_addr_t *addr) } #endif /* LWIP_NETCONN_SEM_PER_THREAD */ - err = tcpip_callback(lwip_netconn_do_gethostbyname, &API_VAR_REF(msg)); - if (err != ERR_OK) { + localerr = tcpip_callback(lwip_netconn_do_gethostbyname, &API_VAR_REF(msg)); + if (localerr != ERR_OK) { #if !LWIP_NETCONN_SEM_PER_THREAD sys_sem_free(API_EXPR_REF(API_VAR_REF(msg).sem)); #endif /* !LWIP_NETCONN_SEM_PER_THREAD */ API_VAR_FREE(MEMP_DNS_API_MSG, msg); - return err; + return localerr; } sys_sem_wait(API_EXPR_REF_SEM(API_VAR_REF(msg).sem)); From 6f3f3bb30c0c9d0170fd92de7084c579427a55c2 Mon Sep 17 00:00:00 2001 From: Dermot Duffy Date: Sat, 31 Dec 2016 01:09:54 +0000 Subject: [PATCH 5/6] Add missing bit from LEDC interrupt state struct. Resolves #191 https://github.com/espressif/esp-idf/pull/191 --- components/esp32/include/soc/ledc_struct.h | 1 + 1 file changed, 1 insertion(+) diff --git a/components/esp32/include/soc/ledc_struct.h b/components/esp32/include/soc/ledc_struct.h index d119289acd..c52f670770 100644 --- a/components/esp32/include/soc/ledc_struct.h +++ b/components/esp32/include/soc/ledc_struct.h @@ -122,6 +122,7 @@ typedef volatile struct { uint32_t lstimer1_ovf: 1; /*The interrupt status bit for low speed channel1 counter overflow event.*/ uint32_t lstimer2_ovf: 1; /*The interrupt status bit for low speed channel2 counter overflow event.*/ uint32_t lstimer3_ovf: 1; /*The interrupt status bit for low speed channel3 counter overflow event.*/ + uint32_t duty_chng_end_hsch0: 1; /*The interrupt enable bit for high speed channel 0 duty change done event.*/ uint32_t duty_chng_end_hsch1: 1; /*The interrupt status bit for high speed channel 1 duty change done event.*/ uint32_t duty_chng_end_hsch2: 1; /*The interrupt status bit for high speed channel 2 duty change done event.*/ uint32_t duty_chng_end_hsch3: 1; /*The interrupt status bit for high speed channel 3 duty change done event.*/ From 74aff89918e173fa724b38ccb2f38920db66a6c8 Mon Sep 17 00:00:00 2001 From: Mike Ryan Date: Wed, 11 Jan 2017 16:40:37 -0800 Subject: [PATCH 6/6] gatts_demo: re-enter advertising after client disconnects In the existing tree, after a connected client disconnects the device will never re-enter the advertising state. Additional clients will not be able to discover or connect to the device. This patch forces the device back into the advertising state upon disconnection. Resolves Pull Request #217 https://github.com/espressif/esp-idf/pull/217 --- examples/bluetooth/gatt_server/main/gatts_demo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/bluetooth/gatt_server/main/gatts_demo.c b/examples/bluetooth/gatt_server/main/gatts_demo.c index 11b3da6473..a018ddb752 100644 --- a/examples/bluetooth/gatt_server/main/gatts_demo.c +++ b/examples/bluetooth/gatt_server/main/gatts_demo.c @@ -250,6 +250,8 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i gl_profile_tab[PROFILE_A_APP_ID].conn_id = param->connect.conn_id; break; case ESP_GATTS_DISCONNECT_EVT: + esp_ble_gap_start_advertising(&test_adv_params); + break; case ESP_GATTS_OPEN_EVT: case ESP_GATTS_CANCEL_OPEN_EVT: case ESP_GATTS_CLOSE_EVT: