led.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Squeezelite for esp32
  3. *
  4. * (c) Sebastien 2019
  5. * Philippe G. 2019, philippe_44@outlook.com
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. #ifndef LED_H
  22. #include "driver/gpio.h"
  23. enum { LED_GREEN = 0, LED_RED };
  24. #define led_on(idx) led_blink_core(idx, 1, 0, false)
  25. #define led_off(idx) led_blink_core(idx, 0, 0, false)
  26. #define led_blink(idx, on, off) led_blink_core(idx, on, off, false)
  27. #define led_blink_wait(idx, on, off) led_blink_core(idx, on, off, true)
  28. bool led_blink_core(int idx, int ontime, int offtime, bool wait);
  29. bool led_release(int idx);
  30. bool led_config(int idx, gpio_num_t gpio, int onstate);
  31. #endif