Adafruit Library
Macros | Typedefs | Enumerations | Functions
Wippersnapper_StatusLED.h File Reference
#include <Adafruit_DotStar.h>
#include <Adafruit_NeoPixel.h>

Go to the source code of this file.

Macros

#define LEDC_CHANNEL_0   0
 use first channel of 16 channels (started from zero)
 
#define LEDC_TIMER_12_BIT   12
 use 12 bit precision for LEDC timer
 
#define LEDC_BASE_FREQ   5000
 use 5000Hz as a LEDC base frequency
 
#define STATUS_LED_KAT_BLINK_TIME   120000
 in-use More...
 
#define RED   0xFF0000
 Red (as a uint32)
 
#define CYAN   0x00FFFF
 Cyan (as a uint32)
 
#define YELLOW   0xFFFF00
 Yellow (as a uint32)
 
#define GREEN   0x00A300
 Green (as a uint32)
 
#define BLACK   0x000000
 Black (as a uint32)
 
#define PINK   0xFF00FF
 Pink (as a uint32)
 
#define BLUE   0x0000FF
 Blue (as a uint32)
 
#define AMBER   0xFFBF00
 Amber (as a uint32)
 
#define LED_NET_CONNECT   PINK
 Network connection state.
 
#define LED_IO_CONNECT   BLUE
 MQTT broker connection state.
 
#define LED_IO_REGISTER_HW   YELLOW
 Hardware registration state.
 
#define LED_CONNECTED   GREEN
 Successful registration state.
 
#define LED_ERROR   RED
 Error state.
 
#define STATUS_PIXEL_BRIGHTNESS_DEFAULT   0.5
 Default status pixel brightness.
 

Typedefs

typedef enum ws_led_status_t ws_led_status_t
 

Enumerations

enum  ws_led_status_t {
  WS_LED_STATUS_FS_WRITE, WS_LED_STATUS_WIFI_CONNECTING, WS_LED_STATUS_MQTT_CONNECTING, WS_LED_STATUS_WAITING_FOR_REG_MSG,
  WS_LED_STATUS_ERROR_RUNTIME, WS_LED_STATUS_KAT
}
 

Functions

void initStatusLED ()
 Initializes board-specific status LED pixel.
 
void releaseStatusLED ()
 De-initializes the status LED and releases pin.
 
int16_t getStatusNeoPixelPin ()
 Retrieve the pin number used for NeoPixel data output. More...
 
int16_t getStatusDotStarDataPin ()
 Retrieve the pin number used for DotStar data output. More...
 
uint32_t ledStatusStateToColor (ws_led_status_t statusState)
 Converts the a ws_led_status_t status state to color. More...
 
void setStatusLEDBrightness (float brightness)
 Sets the status pixel's brightness. More...
 
void setStatusLEDColor (uint32_t color)
 Sets a status RGB LED's color. More...
 
void setStatusLEDColor (uint32_t color, int brightness)
 Sets a status RGB LED's color. More...
 
void statusLEDBlink (ws_led_status_t statusState=WS_LED_STATUS_ERROR_RUNTIME)
 Blinks a status LED a specific color depending on the hardware's state. More...
 
void statusLEDFade (uint32_t color, int numFades)
 Fades the status LED. More...
 
void statusLEDSolid (ws_led_status_t statusState)
 Sets the status LED to a specific color depending on the hardware's state. More...
 

Detailed Description

Interfaces for the Wippersnapper status indicator LED/NeoPixel/Dotstar/RGB LED.

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Copyright (c) Brent Rubell 2022 for Adafruit Industries.

BSD license, all text here must be included in any redistribution.

Macro Definition Documentation

◆ STATUS_LED_KAT_BLINK_TIME

#define STATUS_LED_KAT_BLINK_TIME   120000

in-use

How often to blink the status LED while run() executes, if not

Typedef Documentation

◆ ws_led_status_t

Defines the Wippersnapper status LED states

Enumeration Type Documentation

◆ ws_led_status_t

Defines the Wippersnapper status LED states

Function Documentation

◆ getStatusNeoPixelPin()

int16_t getStatusNeoPixelPin ( )

Retrieve the pin number used for NeoPixel data output.

Returns
Arduino pin number (-2 if not set).

◆ getStatusDotStarDataPin()

int16_t getStatusDotStarDataPin ( )

Retrieve the pin number used for DotStar data output.

Returns
Arduino pin number (-2 if not set).

◆ ledStatusStateToColor()

uint32_t ledStatusStateToColor ( ws_led_status_t  statusState)

Converts the a ws_led_status_t status state to color.

Parameters
statusStateHardware's status state.
Returns
Color as a uint32_t

◆ setStatusLEDBrightness()

void setStatusLEDBrightness ( float  brightness)

Sets the status pixel's brightness.

Parameters
brightnessDesired pixel brightness, from 0.0 (0%) to 1.0 (100%).

◆ setStatusLEDColor() [1/2]

void setStatusLEDColor ( uint32_t  color)

Sets a status RGB LED's color.

Parameters
colorDesired RGB color.

◆ setStatusLEDColor() [2/2]

void setStatusLEDColor ( uint32_t  color,
int  brightness 
)

Sets a status RGB LED's color.

Parameters
colorDesired RGB color.
brightnessBrightness level, as an integer

◆ statusLEDBlink()

void statusLEDBlink ( ws_led_status_t  statusState)

Blinks a status LED a specific color depending on the hardware's state.

Parameters
statusStateHardware's status state.

◆ statusLEDFade()

void statusLEDFade ( uint32_t  color,
int  numFades = 3 
)

Fades the status LED.

Parameters
colorThe specific color to fade the status LED.
numFadesThe amount of time to fade/pulse the status LED.

◆ statusLEDSolid()

void statusLEDSolid ( ws_led_status_t  statusState = WS_LED_STATUS_ERROR_RUNTIME)

Sets the status LED to a specific color depending on the hardware's state.

Parameters
statusStateHardware's status state.