example: add device esp32h2_devkit_c to example light

This commit is contained in:
WanqQixiang
2021-09-09 14:23:33 +08:00
parent 3499262ef4
commit d1a53e1cf1
7 changed files with 154 additions and 0 deletions
@@ -0,0 +1,45 @@
// 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 <light_driver.h>
#include <button_driver.h>
#define LED_GPIO_PIN 8 /* GPIO_NUM_8 */
#define LED_CHANNEL 0 /* RMT_CHANNEL_0 */
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,13 @@
cmake_minimum_required(VERSION 3.5)
if (NOT ("${IDF_TARGET}" STREQUAL "esp32h2"))
message(FATAL_ERROR "please set esp32h2 as the IDF_TARGET using 'idf.py -- preview set-target esp32h2'")
endif()
SET(device_hal_path $ENV{ESP_MATTER_DEVICE_PATH}/../../)
SET(device_name esp32h2_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")