From ff1e21aba77ea4c633ecd15d7d1a786f03e89ea5 Mon Sep 17 00:00:00 2001 From: Liu Han Date: Tue, 2 Mar 2021 14:49:19 +0800 Subject: [PATCH] esp_hap_platform: Add support for ESP32C3 --- README.md | 10 +++++----- components/homekit/esp_hap_platform/Kconfig | 2 ++ components/homekit/esp_hap_platform/src/esp_mfi_i2c.c | 4 ++++ examples/common/app_wifi/Kconfig.projbuild | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3d31749..acd5ec7 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ ## Introduction [HomeKit](https://developer.apple.com/homekit/) is a framework developed by Apple for communicating with and controlling connected accessories in a user’s home using iOS devices. -ESP HomeKit SDK has been developed in-house by Espressif to build Apple HomeKit compatible accessories using ESP32/ESP32-S2/ESP8266 SoCs. +ESP HomeKit SDK has been developed in-house by Espressif to build Apple HomeKit compatible accessories using ESP32/ESP32-S2/ESP32-C3/ESP8266 SoCs. -> Note: If you want to use HomeKit for commercial products, please check [here](https://www.espressif.com/en/products/sdks/esp-homekit-sdk) for access to the MFi variant of this SDK. It has the exact same APIs as this and so, moving to it should be easy. However, commercial HomeKit products can be built only with ESP32/ESP32-S2 since ESP8266 cannot meet all the HomeKit Certification requirements. +> Note: If you want to use HomeKit for commercial products, please check [here](https://www.espressif.com/en/products/sdks/esp-homekit-sdk) for access to the MFi variant of this SDK. It has the exact same APIs as this and so, moving to it should be easy. However, commercial HomeKit products can be built only with ESP32/ESP32-S2/ESP32-C3 since ESP8266 cannot meet all the HomeKit Certification requirements. > If you want to use a port of Apple's ADK instead, please check [here](https://github.com/espressif/esp-apple-homekit-adk) @@ -39,14 +39,14 @@ git clone --recursive https://github.com/espressif/esp-homekit-sdk.git ### Compile and Flash -You can use esp-homekit-sdk with any ESP32, ESP32-S2 or ESP8266 board (though we have tested only with the ESP32-DevKit-C, ESP32-S2-Saola-1 and ESP8266-DevKit-C). We have provided multiple examples for reference. Compile and flash as below (fan used as example): +You can use esp-homekit-sdk with any ESP32, ESP32-S2, ESP32-C3 or ESP8266 board (though we have tested only with the ESP32-DevKit-C, ESP32-S2-Saola-1, ESP32-C3-DevKit-M-1, ESP8266-DevKit-C). We have provided multiple examples for reference. Compile and flash as below (fan used as example): -**For ESP32/ESP32-S2** +**For ESP32/ESP32-S2/ESP32-C3** ```text $ cd /path/to/esp-homekit-sdk/examples/fan $ export ESPPORT=/dev/tty.SLAB_USBtoUART #Set your board's serial port here -$ idf.py set-target +$ idf.py set-target $ idf.py flash monitor ``` diff --git a/components/homekit/esp_hap_platform/Kconfig b/components/homekit/esp_hap_platform/Kconfig index 9eb3b6a..d61bf0c 100644 --- a/components/homekit/esp_hap_platform/Kconfig +++ b/components/homekit/esp_hap_platform/Kconfig @@ -21,6 +21,7 @@ menu "MFi I2C Setup" int "SDA GPIO" default 26 if IDF_TARGET_ESP32 default 4 if IDF_TARGET_ESP32S2 + default 5 if IDF_TARGET_ESP32C3 default 2 if IDF_TARGET_ESP8266 help GPIO for SDA - please check schematic carefully @@ -29,6 +30,7 @@ menu "MFi I2C Setup" int "SCL GPIO" default 27 if IDF_TARGET_ESP32 default 5 if IDF_TARGET_ESP32S2 + default 6 if IDF_TARGET_ESP32C3 default 14 if IDF_TARGET_ESP8266 help GPIO for SCL - please check schematic carefully diff --git a/components/homekit/esp_hap_platform/src/esp_mfi_i2c.c b/components/homekit/esp_hap_platform/src/esp_mfi_i2c.c index c75e8b6..062b660 100644 --- a/components/homekit/esp_hap_platform/src/esp_mfi_i2c.c +++ b/components/homekit/esp_hap_platform/src/esp_mfi_i2c.c @@ -28,8 +28,12 @@ #ifdef CONFIG_IDF_TARGET_ESP32S2 #include "esp32s2/rom/ets_sys.h" #else +#ifdef CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/rom/ets_sys.h" +#else #include "esp32/rom/ets_sys.h" #endif +#endif #ifdef CONFIG_I2C_SOFTWARE #include "driver/gpio.h" diff --git a/examples/common/app_wifi/Kconfig.projbuild b/examples/common/app_wifi/Kconfig.projbuild index 396a7eb..cffc587 100644 --- a/examples/common/app_wifi/Kconfig.projbuild +++ b/examples/common/app_wifi/Kconfig.projbuild @@ -74,7 +74,7 @@ menu "App Wi-Fi" config APP_WIFI_PROV_TRANSPORT_BLE bool "BLE" select BT_ENABLED - depends on IDF_TARGET_ESP32 + depends on IDF_TARGET_ESP32 || IDF_TARGET_ESP32C3 endchoice config APP_WIFI_PROV_TRANSPORT