Skip to content

Commit 5a6f456

Browse files
committed
Add BLE scanning for S3 and C3.
Everything else should raise NotImplementedError. First step in #5926
1 parent 3904421 commit 5a6f456

37 files changed

+2529
-19
lines changed

devices/ble_hci/common-hal/_bleio/__init__.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include "hci.h"
3636

3737
void bleio_hci_background(void);
38-
void bleio_reset(void);
3938

4039
typedef struct {
4140
// ble_gap_enc_key_t own_enc;

ports/espressif/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf)
66

77
# The component list here determines what options we get in menuconfig and what the ninja file
88
# can build.
9-
set(COMPONENTS esptool_py soc driver log main esp-tls mbedtls esp_event esp_adc_cal esp_netif esp_wifi lwip wpa_supplicant freertos)
9+
set(COMPONENTS esptool_py soc driver log main esp-tls mbedtls esp_event esp_adc_cal esp_netif esp_wifi lwip wpa_supplicant freertos bt)
1010

1111
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
1212
project(circuitpython)

ports/espressif/Makefile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ INC += \
8686
-isystem esp-idf \
8787
-isystem esp-idf/components/app_update/include \
8888
-isystem esp-idf/components/bootloader_support/include \
89+
-isystem esp-idf/components/bt/host/nimble/esp-hci/include \
90+
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/include \
91+
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/services/gap/include \
92+
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/include \
93+
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/util/include \
94+
-isystem esp-idf/components/bt/host/nimble/nimble/porting/nimble/include \
95+
-isystem esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/include \
96+
-isystem esp-idf/components/bt/host/nimble/port/include \
8997
-isystem esp-idf/components/driver/include \
9098
-isystem esp-idf/components/driver/$(IDF_TARGET)/include \
9199
-isystem esp-idf/components/$(IDF_TARGET)/include \
@@ -133,6 +141,7 @@ endif
133141

134142
CFLAGS += \
135143
-DHAVE_CONFIG_H \
144+
-DESP_PLATFORM=1 \
136145
-DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" \
137146
-DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX
138147

@@ -298,8 +307,10 @@ else
298307
DEBUG_SDKCONFIG = esp-idf-config/sdkconfig-opt.defaults
299308
endif
300309

301-
SDKCONFIGS = esp-idf-config/sdkconfig.defaults;$(DEBUG_SDKCONFIG);$(FLASH_SDKCONFIG);$(TARGET_SDKCONFIG);boards/$(BOARD)/sdkconfig
302-
310+
SDKCONFIGS := esp-idf-config/sdkconfig.defaults;$(DEBUG_SDKCONFIG);$(FLASH_SDKCONFIG);$(TARGET_SDKCONFIG);boards/$(BOARD)/sdkconfig
311+
ifneq ($(CIRCUITPY_BLEIO),0)
312+
SDKCONFIGS := esp-idf-config/sdkconfig-ble.defaults;$(SDKCONFIGS)
313+
endif
303314
# create the config headers
304315
$(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig | $(BUILD)/esp-idf
305316
IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja
@@ -332,6 +343,12 @@ BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a l
332343
BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS))
333344

334345
ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc_cal esp_common esp_event esp_hw_support esp_ipc esp_netif esp_pm esp_phy esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant
346+
ifneq ($(CIRCUITPY_BLEIO),0)
347+
ESP_IDF_COMPONENTS_LINK += bt
348+
BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libbtbb.a \
349+
esp-idf/components/bt/controller/lib_esp32c3_family/$(IDF_TARGET)/libbtdm_app.a
350+
endif
351+
335352
ESP_IDF_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a)
336353

337354
MBEDTLS_COMPONENTS_LINK = crypto tls x509
@@ -372,6 +389,7 @@ esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h
372389
esp-idf/esp_system/__ldgen_output_sections.ld \
373390
esp-idf/app_update/libapp_update.a \
374391
esp-idf/bootloader_support/libbootloader_support.a \
392+
esp-idf/bt/libbt.a \
375393
esp-idf/driver/libdriver.a \
376394
esp-idf/efuse/libefuse.a \
377395
esp-idf/esp_adc_cal/libesp_adc_cal.a \

0 commit comments

Comments
 (0)