PD Buddy Sink Firmware
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

led.h 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * PD Buddy Sink Firmware - Smart power jack for USB Power Delivery
  3. * Copyright (C) 2017-2018 Clayton G. Hobbs <clay@lakeserv.net>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef PDBS_LED_H
  19. #define PDBS_LED_H
  20. #include <ch.h>
  21. /* Events for the LED thread */
  22. #define PDBS_EVT_LED_OFF EVENT_MASK(0)
  23. #define PDBS_EVT_LED_ON EVENT_MASK(1)
  24. #define PDBS_EVT_LED_FAST_BLINK EVENT_MASK(2)
  25. #define PDBS_EVT_LED_MEDIUM_BLINK_OFF EVENT_MASK(3)
  26. #define PDBS_EVT_LED_SLOW_BLINK EVENT_MASK(4)
  27. #define PDBS_EVT_LED_FAST_BLINK_SLOW EVENT_MASK(5)
  28. #define PDBS_EVT_LED_LONG_BLINK EVENT_MASK(6)
  29. /* Semantic LED event names */
  30. #define PDBS_EVT_LED_CONFIG PDBS_EVT_LED_SLOW_BLINK
  31. #define PDBS_EVT_LED_IDENTIFY PDBS_EVT_LED_FAST_BLINK_SLOW
  32. #define PDBS_EVT_LED_NEGOTIATING PDBS_EVT_LED_FAST_BLINK
  33. #define PDBS_EVT_LED_OUTPUT_ON PDBS_EVT_LED_MEDIUM_BLINK_OFF
  34. #define PDBS_EVT_LED_OUTPUT_OFF PDBS_EVT_LED_ON
  35. #define PDBS_EVT_LED_OUTPUT_OFF_NO_TYPEC PDBS_EVT_LED_LONG_BLINK
  36. /* The LED thread object */
  37. extern thread_t *pdbs_led_thread;
  38. /*
  39. * Start the LED thread
  40. */
  41. void pdbs_led_run(void);
  42. #endif /* PDBS_LED_H */