LED.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef _LED_H_
  2. #define _LED_H_
  3. #include "driver/gpio.h"
  4. #include "driver/ledc.h"
  5. #include "freertos/FreeRTOS.h"
  6. #include "freertos/task.h"
  7. #if 1
  8. #define LEDC_TIMER LEDC_TIMER_0
  9. #define LEDC_MODE LEDC_LOW_SPEED_MODE
  10. #define LEDC_OUTPUT_IO (46) // Define the output GPIO
  11. #define LEDC_CHANNEL LEDC_CHANNEL_0
  12. #define LEDC_DUTY_RES LEDC_TIMER_13_BIT // Set duty resolution to 13 bits
  13. #define LEDC_DUTY (4095) // Set duty to 50%. ((2 ** 13) - 1) * 50% = 4095
  14. #define LEDC_FREQUENCY (2700) // Frequency in Hertz. Set frequency at 5 kHz
  15. // void beep_blink(uint16_t ms,uint16_t count);
  16. #endif
  17. #define LED_DATA_PIN 15 //DS //serial data input
  18. #define LED_SCLK_PIN 16 //STCP //storage register clock input
  19. #define LED_LCLK_PIN 19 //SHCP //shift register clock input
  20. #define LED_RST_PIN 46 //SHCP //shift register clock input
  21. #define LED_OUTPUT_PIN_SEL ((1ULL<<LED_DATA_PIN)|(1ULL<<LED_SCLK_PIN)|(1ULL<<LED_LCLK_PIN)|(1ULL<<LED_RST_PIN))
  22. #define LED_SCLK_0 gpio_set_level(LED_SCLK_PIN, 0)
  23. #define LED_SCLK_1 gpio_set_level(LED_SCLK_PIN, 1)
  24. #define LED_DATA_0 gpio_set_level(LED_DATA_PIN, 0)
  25. #define LED_DATA_1 gpio_set_level(LED_DATA_PIN, 1)
  26. #define LED_LCLK_0 gpio_set_level(LED_LCLK_PIN, 0)
  27. #define LED_LCLK_1 gpio_set_level(LED_LCLK_PIN, 1)
  28. #define LED_RST_0 gpio_set_level(LED_RST_PIN, 0)
  29. #define LED_RST_1 gpio_set_level(LED_RST_PIN, 1)
  30. void beep_init(void);
  31. void led_set(uint8_t led_index,uint8_t led_status);
  32. void beep_blink(uint16_t ms,uint16_t count);
  33. void beep_start_ms(uint16_t ms);
  34. #endif/*_LED_H_*/