FastLED 3.7.8
Loading...
Searching...
No Matches
hsv2rgb.cpp File Reference

Detailed Description

Functions to convert from the HSV colorspace to the RGB colorspace.

Definition in file hsv2rgb.cpp.

#include <stdint.h>
#include "FastLED.h"

Go to the source code of this file.

Macros

#define FASTLED_INTERNAL
 Disables pragma messages and warnings.
 
#define APPLY_DIMMING(X)   (X)
 Apply dimming compensation to values.
 
#define HSV_SECTION_6   (0x20)
 Divide the color wheel into eight sections, 32 elements each.
 
#define HSV_SECTION_3   (0x40)
 Divide the color wheel into four sections, 64 elements each.
 
#define FORCE_REFERENCE(var)   asm volatile( "" : : "r" (var) )
 Force a variable reference to avoid compiler over-optimization.
 
#define FIXFRAC8(N, D)   (((N)*256)/(D))
 Convert a fractional input into a constant.
 

Functions

void hsv2rgb_raw_C (const struct CHSV &hsv, struct CRGB &rgb)
 HSV to RGB implementation in raw C, platform independent.
 
void hsv2rgb_raw_avr (const struct CHSV &hsv, struct CRGB &rgb)
 HSV to RGB implementation in raw C, for the AVR platform only.
 
void hsv2rgb_raw (const struct CHSV &hsv, struct CRGB &rgb)
 Convert an HSV value to RGB using a mathematically straight spectrum.
 
void hsv2rgb_spectrum (const struct CHSV &hsv, CRGB &rgb)
 Convert an HSV value to RGB using a mathematically straight spectrum.
 
void hsv2rgb_rainbow (const CHSV &hsv, CRGB &rgb)
 Forward declaration of hsv2rgb_rainbow here, to avoid circular dependencies.
 
void hsv2rgb_raw (const struct CHSV *phsv, struct CRGB *prgb, int numLeds)
 Convert an HSV value to RGB using a mathematically straight spectrum.
 
void hsv2rgb_rainbow (const struct CHSV *phsv, struct CRGB *prgb, int numLeds)
 Convert an HSV value to RGB using a visually balanced rainbow.
 
void hsv2rgb_spectrum (const struct CHSV *phsv, struct CRGB *prgb, int numLeds)
 Convert an HSV value to RGB using a mathematically straight spectrum.
 
CHSV rgb2hsv_approximate (const CRGB &rgb)
 Recover approximate HSV values from RGB.
 

Macro Definition Documentation

◆ APPLY_DIMMING

#define APPLY_DIMMING ( X)    (X)

Apply dimming compensation to values.

Definition at line 31 of file hsv2rgb.cpp.

◆ FASTLED_INTERNAL

#define FASTLED_INTERNAL

Disables pragma messages and warnings.

Definition at line 5 of file hsv2rgb.cpp.

◆ FIXFRAC8

#define FIXFRAC8 ( N,
D )   (((N)*256)/(D))

Convert a fractional input into a constant.

Definition at line 493 of file hsv2rgb.cpp.

◆ FORCE_REFERENCE

#define FORCE_REFERENCE ( var)    asm volatile( "" : : "r" (var) )

Force a variable reference to avoid compiler over-optimization.

Sometimes the compiler will do clever things to reduce code size that result in a net slowdown, if it thinks that a variable is not used in a certain location. This macro does its best to convince the compiler that the variable is used in this location, to help control code motion and de-duplication that would result in a slowdown.

Definition at line 241 of file hsv2rgb.cpp.

◆ HSV_SECTION_3

#define HSV_SECTION_3   (0x40)

Divide the color wheel into four sections, 64 elements each.

Todo
I believe this is mis-named, and should be HSV_SECTION_4

Definition at line 39 of file hsv2rgb.cpp.

◆ HSV_SECTION_6

#define HSV_SECTION_6   (0x20)

Divide the color wheel into eight sections, 32 elements each.

Todo
Unused. Remove?

Definition at line 35 of file hsv2rgb.cpp.

Function Documentation

◆ hsv2rgb_raw_C()

void hsv2rgb_raw_C ( const struct CHSV & hsv,
struct CRGB & rgb )

HSV to RGB implementation in raw C, platform independent.

Definition at line 41 of file hsv2rgb.cpp.