Add ESP32-S3 Target in device_hal

This commit is contained in:
WanqQixiang
2022-01-27 12:27:32 +08:00
parent 0113aca55b
commit 9c16cbf318
5 changed files with 69 additions and 0 deletions
@@ -0,0 +1,48 @@
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
#include <esp_log.h>
#include <button_driver.h>
#include <light_driver.h>
#define DEVICE_VERSION_1_0
#ifdef DEVICE_VERSION_1_0
#define LED_GPIO_PIN 48 /* GPIO_NUM_48 */
#define LED_CHANNEL 0 /* RMT_CHANNEL_0 */
#endif
static const char *TAG = "device";
static esp_err_t device_light_init()
{
light_driver_config_t config = {
.gpio = LED_GPIO_PIN,
.channel = LED_CHANNEL,
};
return light_driver_init(&config);
}
static esp_err_t device_button_init()
{
return button_driver_init(NULL);
}
esp_err_t device_init()
{
ESP_LOGI(TAG, "Initializing device");
device_light_init();
device_button_init();
return ESP_OK;
}
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.5)
if(NOT ("${IDF_TARGET}" STREQUAL "esp32s3" ))
message(FATAL_ERROR "please set esp32s3 as the IDF_TARGET using 'idf.py set-target esp32s3'")
endif()
SET(device_hal_path $ENV{ESP_MATTER_DEVICE_PATH}/../../)
SET(device_name esp32s3_devkit_c)
SET(light_type ws2812)
SET(button_type hollow)
SET(used_driver light_driver button_driver)
SET(extra_components_dirs_append "${device_hal_path}/light_driver"
"${device_hal_path}/button_driver"
"$ENV{IDF_PATH}/examples/common_components/led_strip")
+2
View File
@@ -15,6 +15,8 @@ if(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH})
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32h2_devkit_c)
elseif("${IDF_TARGET}" STREQUAL "esp32s2")
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32s2_devkit_c)
elseif("${IDF_TARGET}" STREQUAL "esp32s3")
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32s3_devkit_c)
else()
message(FATAL_ERROR "Unsupported IDF_TARGET")
endif()
+2
View File
@@ -13,6 +13,8 @@ if(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH})
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32c3_devkit_m)
elseif("${IDF_TARGET}" STREQUAL "esp32s2")
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32s2_devkit_c)
elseif("${IDF_TARGET}" STREQUAL "esp32s3")
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32s3_devkit_c)
else()
message(FATAL_ERROR "Unsupported IDF_TARGET")
endif()
+2
View File
@@ -15,6 +15,8 @@ if(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH})
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32h2_devkit_c)
elseif("${IDF_TARGET}" STREQUAL "esp32s2")
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32s2_devkit_c)
elseif("${IDF_TARGET}" STREQUAL "esp32s3")
set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32s3_devkit_c)
else()
message(FATAL_ERROR "Unsupported IDF_TARGET")
endif()