QUERY · ISSUE
Can't find esp idf header file: esp_gap_ble_api.h: No such file or directory
bug
I am trying to change the ble channel of my device, I am creating a custom user module but I get this error:
I am building with
esp idf commit:
5bb59b00e72f8f91eb24d8c65bf9a7ea2b8a4f5f
Micropython:
latest
/ble/ble.c:4:10: fatal error: esp_gap_ble_api.h: No such file or directory
#include "esp_gap_ble_api.h"
This is my usercmodule code:
#include <stdio.h>
#include "py/nlr.h"
#include "py/runtime.h"
#include "esp_gap_ble_api.h"
STATIC mp_obj_t ble_set_channel_mask(mp_obj_t mask_obj) {
esp_ble_adv_channel_t mask = mp_obj_get_int(mask_obj);
esp_ble_gap_set_channel_mask(mask);
printf("BLE channel mask set to %d\n", mask);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(ble_set_channel_mask_obj, ble_set_channel_mask);
STATIC const mp_map_elem_t ble_module_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_ble) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_set_channel_mask), (mp_obj_t)&ble_set_channel_mask_obj },
};
STATIC MP_DEFINE_CONST_DICT(ble_module_globals, ble_module_globals_table);
const mp_obj_module_t ble_module = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&ble_module_globals,
};
This is my micropython.cmake:
add_library(usermod_ble INTERFACE)
target_sources(usermod_ble INTERFACE
${CMAKE_CURRENT_LIST_DIR}/ble.c
)
target_include_directories(usermod_ble INTERFACE
${CMAKE_CURRENT_LIST_DIR}
)
target_link_libraries(usermod INTERFACE usermod_ble)
This is my micropython.mk:
MBEDTLS_MOD_DIR := $(USERMOD_DIR)
SRC_USERMOD += $(MBEDTLS_MOD_DIR)/ble.c
CANDIDATE · ISSUE
Using OpenSSL in user C module
I'm working on a C module that depends on OpenSSL. It tries to import the global SSL headers #include <openssl/ssl.h>. I noticed that ESP-IDF does contain OpenSSL among other components. Why can't I include it in my custom C modules? Target device is ESP32. Thanks.