6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@
path = ports/espressif/esp-camera
url = https://github.com/adafruit/esp32-camera.git
branch = circuitpython
[submodule "ports/espressif/components/esp-zigbee-sdk"]
path = ports/espressif/components/esp-zigbee-sdk
url = https://github.com/adafruit/components/esp-zigbee-sdk.git
[submodule "ports/espressif/components/esp-zboss-lib"]
path = ports/espressif/components/esp-zboss-lib
url = https://github.com/adafruit/components/esp-zboss-lib.git
[submodule "frozen/Adafruit_CircuitPython_ST7789"]
path = frozen/Adafruit_CircuitPython_ST7789
url = https://github.com/adafruit/Adafruit_CircuitPython_ST7789
Expand Down
4 changes: 2 additions & 2 deletions ports/espressif/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.16)
set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf)

# The component list here determines what options we get in menuconfig and what the ninja file can build.
set(COMPONENTS bt driver esp-tls esp_adc_cal esp_event esp_netif esp_psram esp_wifi esptool_py freertos log lwip main mbedtls mdns soc ulp usb wpa_supplicant esp-camera esp_lcd)
set(EXTRA_COMPONENT_DIRS "esp-protocols/components/mdns" "esp-camera")
set(COMPONENTS bt driver esp-tls esp_adc_cal esp_event esp_netif esp_psram esp_wifi esptool_py freertos ieee802154 log lwip main mbedtls mdns soc ulp usb wpa_supplicant esp-camera esp_lcd esp-zboss-lib esp-zigbee-sdk)
set(EXTRA_COMPONENT_DIRS "esp-protocols/components/mdns" "esp-camera" "components/esp-zigbee-sdk" "components/esp-zboss-lib")

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(circuitpython)
Expand Down
31 changes: 29 additions & 2 deletions ports/espressif/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ INC += \
-isystem esp-idf/components/driver/touch_sensor/include \
-isystem esp-idf/components/driver/touch_sensor/$(IDF_TARGET)/include \
-isystem esp-idf/components/driver/twai/include \
-isystem esp-idf/components/driver/uart/include \
-isystem esp-idf/components/efuse/include \
-isystem esp-idf/components/efuse/$(IDF_TARGET)/include \
-isystem esp-idf/components/$(IDF_TARGET)/include \
Expand Down Expand Up @@ -132,7 +133,9 @@ INC += \
-isystem esp-idf/components/ulp/ulp_common/include/$(IDF_TARGET) \
-isystem esp-idf/components/$(IDF_TARGET_ARCH)/include \
-isystem esp-idf/components/$(IDF_TARGET_ARCH)/$(IDF_TARGET)/include \
-isystem esp-protocols/components/mdns/include
-isystem esp-protocols/components/mdns/include \
-isystem components/esp-zboss-lib/include \
-isystem components/esp-zigbee-sdk/components/esp-zigbee-lib/include

CFLAGS += \
-DHAVE_CONFIG_H \
Expand Down Expand Up @@ -356,6 +359,15 @@ SRC_ULP := \
SRC_C += $(SRC_ULP)
endif

CFLAGS += -DCIRCUITPY_ZIGBEE=$(CIRCUITPY_ZIGBEE)
ifneq ($(CIRCUITPY_ZIGBEE),0)
SRC_ZIGBEE := \
$(wildcard common-hal/_zig/*.c) \
$(wildcard bindings/_zig/*.c)
SRC_C += $(SRC_ZIGBEE)
endif


SRC_COMMON_HAL_EXPANDED = \
$(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
Expand Down Expand Up @@ -413,7 +425,6 @@ endif
endif
FLASH_MODE_SDKCONFIG ?= esp-idf-config/sdkconfig-flash-$(CIRCUITPY_ESP_FLASH_MODE).defaults
FLASH_SPEED_SDKCONFIG ?= esp-idf-config/sdkconfig-flash-$(CIRCUITPY_ESP_FLASH_FREQ).defaults

ifneq ($(CIRCUITPY_ESP_PSRAM_SIZE), 0)
PSRAM_SDKCONFIG = esp-idf-config/sdkconfig-psram.defaults
PSRAM_SIZE_SDKCONFIG = esp-idf-config/sdkconfig-psram-$(CIRCUITPY_ESP_PSRAM_SIZE).defaults
Expand Down Expand Up @@ -543,6 +554,22 @@ ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/esp-camera/libesp-camera
#$(error $(ESP_IDF_COMPONENTS_EXPANDED))
endif

ifneq ($(DEBUG),0)
DEBUG_SUFFIX=debug.
else
# blank
DEBUG_SUFFIX=
endif
CIRCUITPY_ZIGBEE ?= 1
ifneq ($(CIRCUITPY_ZIGBEE),0)
ESP_IDF_COMPONENTS_EXPANDED += components/esp-zboss-lib/lib/$(IDF_TARGET)/libzboss_port.$(DEBUG_SUFFIX)a
ESP_IDF_COMPONENTS_EXPANDED += components/esp-zboss-lib/lib/$(IDF_TARGET)/libzboss_stack.zczr.$(DEBUG_SUFFIX)a
ESP_IDF_COMPONENTS_EXPANDED += components/esp-zigbee-sdk/components/esp-zigbee-lib/lib/$(IDF_TARGET)/libesp_zb_api_zczr.$(DEBUG_SUFFIX)a
#ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/ieee802154/lib/$(IDF_TARGET)/lib802154.a
ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/ieee802154/libieee802154.a
$(info components: $(ESP_IDF_COMPONENTS_EXPANDED))
endif

ifneq ($(VALID_BOARD),)
# From esp-idf/components/bootloader/Kconfig.projbuild
# BOOTLOADER_OFFSET is determined by chip type, based on the ROM bootloader, and is not changeable.
Expand Down
23 changes: 23 additions & 0 deletions ports/espressif/bindings/_zig/__init__.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "py/obj.h"
#include "py/runtime.h"
#include "common-hal/_zig/__init__.h"

static mp_obj_t zig_light_get_power(void) {
return mp_obj_new_bool(common_hal_zig_light_get_power());
}
MP_DEFINE_CONST_FUN_OBJ_0(zig_light_get_power_obj, zig_light_get_power);

static const mp_rom_map_elem_t zig_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__zig) },

{ MP_ROM_QSTR(MP_QSTR_light_get_power), MP_ROM_PTR(&zig_light_get_power_obj)},
};

static MP_DEFINE_CONST_DICT(zig_module_globals, zig_module_globals_table);

const mp_obj_module_t zig_module = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&zig_module_globals,
};

MP_REGISTER_MODULE(MP_QSTR__zig, zig_module);
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32c6"
# end of Component config

# end of Espressif IoT Development Framework Configuration

#
# Zboss
#
CONFIG_ZB_ENABLED=y
CONFIG_ZB_ZCZR=y
# end of Zboss
Loading