← index #11083Issue #8841
Related · high · value 1.184
QUERY · ISSUE

Can't find esp idf header file: esp_gap_ble_api.h: No such file or directory

openby MATTYGILOopened 2023-03-20updated 2024-05-18
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

Trying to #include "esp_wpa2.h", Failing

closedby MATTYGILOopened 2022-06-30updated 2022-07-08
bugport-esp32

I'm using an esp32 and creating a custom micropython function, however the project fails to build when trying to #include "esp_wpa2.h". From esp-idf.

How do I #include a function from esp idf.

What do I need to add to cmake and make for this work?

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied