led.h 795 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Squeezelite for esp32
  3. *
  4. * (c) Sebastien 2019
  5. * Philippe G. 2019, philippe_44@outlook.com
  6. *
  7. * This software is released under the MIT License.
  8. * https://opensource.org/licenses/MIT
  9. *
  10. */
  11. #ifndef LED_H
  12. #define LED_H
  13. #include "driver/gpio.h"
  14. enum { LED_GREEN = 0, LED_RED };
  15. #define led_on(idx) led_blink_core(idx, 1, 0, false)
  16. #define led_off(idx) led_blink_core(idx, 0, 0, false)
  17. #define led_blink(idx, on, off) led_blink_core(idx, on, off, false)
  18. #define led_blink_pushed(idx, on, off) led_blink_core(idx, on, off, true)
  19. bool led_config(int idx, gpio_num_t gpio, int onstate, int pwm);
  20. bool led_brightness(int idx, int percent);
  21. bool led_blink_core(int idx, int ontime, int offtime, bool push);
  22. bool led_unpush(int idx);
  23. int led_allocate(void);
  24. #endif