#ifndef _LED_H_
#define _LED_H_

#include "driver/gpio.h"
#include "driver/ledc.h"

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#if 1



#define LEDC_TIMER              LEDC_TIMER_0
#define LEDC_MODE               LEDC_LOW_SPEED_MODE
#define LEDC_OUTPUT_IO          (46) // Define the output GPIO
#define LEDC_CHANNEL            LEDC_CHANNEL_0
#define LEDC_DUTY_RES           LEDC_TIMER_13_BIT // Set duty resolution to 13 bits
#define LEDC_DUTY               (4095) // Set duty to 50%. ((2 ** 13) - 1) * 50% = 4095
#define LEDC_FREQUENCY          (2700) // Frequency in Hertz. Set frequency at 5 kHz


// void beep_blink(uint16_t ms,uint16_t count);


#endif

#define LED_DATA_PIN  15    //DS    //serial data input
#define LED_SCLK_PIN  16    //STCP  //storage register clock input
#define LED_LCLK_PIN  19    //SHCP  //shift register clock input

#define LED_RST_PIN   46    //SHCP  //shift register clock input

#define LED_OUTPUT_PIN_SEL  ((1ULL<<LED_DATA_PIN)|(1ULL<<LED_SCLK_PIN)|(1ULL<<LED_LCLK_PIN)|(1ULL<<LED_RST_PIN))


#define LED_SCLK_0              gpio_set_level(LED_SCLK_PIN, 0)
#define LED_SCLK_1              gpio_set_level(LED_SCLK_PIN, 1)


#define LED_DATA_0              gpio_set_level(LED_DATA_PIN, 0)
#define LED_DATA_1              gpio_set_level(LED_DATA_PIN, 1)


#define LED_LCLK_0              gpio_set_level(LED_LCLK_PIN, 0)
#define LED_LCLK_1              gpio_set_level(LED_LCLK_PIN, 1)


#define LED_RST_0               gpio_set_level(LED_RST_PIN, 0)
#define LED_RST_1               gpio_set_level(LED_RST_PIN, 1)

void led_init(void);
void led_set(uint8_t led_index,uint8_t led_status);


#endif/*_LED_H_*/
