led.h 665 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include <stdint.h>
  3. #include "board_config.h"
  4. #ifdef WS2812_LED_PIN
  5. #include <Adafruit_NeoPixel.h>
  6. #endif
  7. class Led {
  8. public:
  9. enum class LedState {
  10. INIT=0,
  11. PFST_FAIL,
  12. ARM_FAIL,
  13. ARM_OK
  14. };
  15. void set_state(LedState _state) {
  16. state = _state;
  17. }
  18. void update(void);
  19. private:
  20. void init(void);
  21. bool done_init;
  22. uint32_t last_led_trig_ms;
  23. LedState state;
  24. #ifdef WS2812_LED_PIN
  25. uint32_t last_led_strip_ms;
  26. Adafruit_NeoPixel ledStrip{2, WS2812_LED_PIN, NEO_GRB + NEO_KHZ800}; //the BlueMark db210pro boards has two LEDs, therefore we need to use 2.
  27. #endif
  28. };
  29. extern Led led;