29 lines
552 B
C
29 lines
552 B
C
/**
|
|
* @file led.c
|
|
* @brief Status LED control
|
|
*/
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "driver/gpio.h"
|
|
#include "esp_log.h"
|
|
#include "app_main.h"
|
|
|
|
static const char *TAG = "led";
|
|
|
|
void led_set(uint8_t on)
|
|
{
|
|
gpio_set_level(STATUS_LED_GPIO, on ? 1 : 0);
|
|
}
|
|
|
|
void led_blink(int times, int delay_ms)
|
|
{
|
|
for (int i = 0; i < times; i++) {
|
|
led_set(1);
|
|
vTaskDelay(pdMS_TO_TICKS(delay_ms));
|
|
led_set(0);
|
|
if (i < times - 1) {
|
|
vTaskDelay(pdMS_TO_TICKS(delay_ms));
|
|
}
|
|
}
|
|
}
|