Adafruit Library
Wippersnapper_StatusLED.h
Go to the documentation of this file.
1 
16 #ifndef WIPPERSNAPPER_STATUSLED_H
17 #define WIPPERSNAPPER_STATUSLED_H
18 #include <Adafruit_DotStar.h>
19 #include <Adafruit_NeoPixel.h>
20 
21 // Use LEDC for ESP32 arch so we can PWM
22 #ifdef ARDUINO_ARCH_ESP32
23 #define LEDC_CHANNEL_0 \
24  0
25 #define LEDC_TIMER_12_BIT 12
26 #define LEDC_BASE_FREQ 5000
27 #endif
28 
29 #define STATUS_LED_KAT_BLINK_TIME \
30  120000
31 
33 
34 typedef enum ws_led_status_t {
35  WS_LED_STATUS_FS_WRITE,
36  WS_LED_STATUS_WIFI_CONNECTING,
37  WS_LED_STATUS_MQTT_CONNECTING,
38  WS_LED_STATUS_WAITING_FOR_REG_MSG,
39  WS_LED_STATUS_ERROR_RUNTIME,
40  WS_LED_STATUS_KAT,
42 
43 #define RED 0xFF0000
44 #define CYAN 0x00FFFF
45 #define YELLOW 0xFFFF00
46 #define GREEN 0x00A300
47 #define BLACK 0x000000
48 #define PINK 0xFF00FF
49 #define BLUE 0x0000FF
50 #define AMBER 0xFFBF00
51 
52 // colors for each status state
53 #define LED_NET_CONNECT PINK
54 #define LED_IO_CONNECT BLUE
55 #define LED_IO_REGISTER_HW YELLOW
56 #define LED_CONNECTED GREEN
57 #define LED_ERROR RED
58 
59 #define STATUS_PIXEL_BRIGHTNESS_DEFAULT 0.5
60 
61 // Status LED
62 void initStatusLED();
63 void releaseStatusLED();
64 int16_t getStatusNeoPixelPin();
65 int16_t getStatusDotStarDataPin();
66 uint32_t ledStatusStateToColor(ws_led_status_t statusState);
67 void setStatusLEDBrightness(float brightness);
68 void setStatusLEDColor(uint32_t color);
69 void setStatusLEDColor(uint32_t color, int brightness);
70 void statusLEDBlink(ws_led_status_t statusState = WS_LED_STATUS_ERROR_RUNTIME);
71 void statusLEDFade(uint32_t color, int numFades);
72 void statusLEDSolid(ws_led_status_t statusState);
73 
74 #endif // WIPPERSNAPPER_STATUSLED_H
void statusLEDSolid(ws_led_status_t statusState)
Sets the status LED to a specific color depending on the hardware&#39;s state.
Definition: Wippersnapper_StatusLED.cpp:360
void statusLEDFade(uint32_t color, int numFades)
Fades the status LED.
Definition: Wippersnapper_StatusLED.cpp:288
int16_t getStatusDotStarDataPin()
Retrieve the pin number used for DotStar data output.
Definition: Wippersnapper_StatusLED.cpp:272
ws_led_status_t
Definition: Wippersnapper_StatusLED.h:34
void initStatusLED()
Initializes board-specific status LED pixel.
Definition: Wippersnapper_StatusLED.cpp:36
void statusLEDBlink(ws_led_status_t statusState=WS_LED_STATUS_ERROR_RUNTIME)
Blinks a status LED a specific color depending on the hardware&#39;s state.
Definition: Wippersnapper_StatusLED.cpp:383
void setStatusLEDBrightness(float brightness)
Sets the status pixel&#39;s brightness.
Definition: Wippersnapper_StatusLED.cpp:129
uint32_t ledStatusStateToColor(ws_led_status_t statusState)
Converts the a ws_led_status_t status state to color.
Definition: Wippersnapper_StatusLED.cpp:324
int16_t getStatusNeoPixelPin()
Retrieve the pin number used for NeoPixel data output.
Definition: Wippersnapper_StatusLED.cpp:259
void releaseStatusLED()
De-initializes the status LED and releases pin.
Definition: Wippersnapper_StatusLED.cpp:101
void setStatusLEDColor(uint32_t color)
Sets a status RGB LED&#39;s color.
Definition: Wippersnapper_StatusLED.cpp:140