This commit is contained in:
commit
95a533c876
451 changed files with 18255 additions and 0 deletions
4
templates/dev/esp-blink/main/CMakeLists.txt
Normal file
4
templates/dev/esp-blink/main/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
idf_component_register(
|
||||
SRCS "main.c"
|
||||
INCLUDE_DIRS "."
|
||||
)
|
||||
2
templates/dev/esp-blink/main/idf_component.yml
Normal file
2
templates/dev/esp-blink/main/idf_component.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
espressif/led_strip: "^3.0.0"
|
||||
33
templates/dev/esp-blink/main/main.c
Normal file
33
templates/dev/esp-blink/main/main.c
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include "driver/gpio.h"
|
||||
#include "esp_log.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static const char *TAG = "BLINK";
|
||||
|
||||
#define BLINK_GPIO 38
|
||||
#define BLINK_PERIOD 1000
|
||||
|
||||
static uint8_t s_led_state = 0;
|
||||
|
||||
static void blink_led(void) { gpio_set_level(BLINK_GPIO, s_led_state); }
|
||||
|
||||
static void configure_led(void) {
|
||||
ESP_LOGI(TAG, "Example configured to blink GPIO LED!");
|
||||
gpio_reset_pin(BLINK_GPIO);
|
||||
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
|
||||
}
|
||||
|
||||
static void delay_ms(uint32_t ms) { vTaskDelay(pdMS_TO_TICKS(ms)); }
|
||||
|
||||
void app_main(void) {
|
||||
configure_led();
|
||||
|
||||
while (1) {
|
||||
ESP_LOGI(TAG, "Turning the LED %s!", s_led_state == true ? "ON" : "OFF");
|
||||
blink_led();
|
||||
s_led_state = !s_led_state;
|
||||
delay_ms(BLINK_PERIOD);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue