LED debuging, imported ColorUtil-Class from IoLight

This commit is contained in:
Ollo
2024-12-06 18:07:18 +01:00
parent f8c6b4d351
commit e7a2eab923
4 changed files with 243 additions and 32 deletions

45
include/ColorUtil.h Normal file
View File

@@ -0,0 +1,45 @@
/**
* @brief ColorUtil collection
* @file ColorUtil.h
*
*/
#ifndef COLOR_UTIL
#define COLOR_UTIL
#include <stdint.h>
#ifndef UNIT_TEST
#include <Adafruit_NeoPixel.h>
typedef enum dir_t {
FORWARD = 0,
BACKWARD
} Direction;
void RainbowCycle (Adafruit_NeoPixel* pix, uint8_t *pIndex);
#endif
/**
* @brief Extract color form a given string
* possible values are:
* - red
* - green
* - blue
* - white
* - black
* - off
* - #RRGGBB (red, green blue as hex values: 0-F (uppercase))
* - #rrggbb (red, green blue as hex values: 0-f (lowercase))
* @param text The text with the color information
* @param length The amount of characters in the given text
* @return uint32_t 32-bit color value. Most significant byte is white (for RGBW
pixels) or ignored (for RGB pixels), next is red, then green,
and least significant byte is blue.
*/
uint32_t extractColor(const char *text, int length);
uint32_t Color(uint8_t r, uint8_t g, uint8_t b);
#endif /* COLOR_UTIL */

View File

@@ -16,10 +16,10 @@
#define GPIO_DS18B20 D2 /**< One-Wire used for Dallas temperature sensor */
#define WS2812SINGLE_GPIO_PIN D5
#define WS2812SINGLE_GPIO_PIN D3
#define WS2812SINGLE_LEDS 3
#define WS2812STRIP_GPIO_PIN D3
#define WS2812STRIP_GPIO_PIN D5
#define WS2812STRIP_LEDS 13
#endif /* End FANLEDCTL_PINS */