FastLED 3.9.3
Loading...
Searching...
No Matches
Apa102HDOverride.ino
1
3
4#define FASTLED_FIVE_BIT_HD_BITSHIFT_FUNCTION_OVERRIDE
5
6#include <Arduino.h>
7#include <FastLED.h>
8#include <lib8tion.h>
9
10#define NUM_LEDS 20
11// uint8_t DATA_PIN, uint8_t CLOCK_PIN,
12
13#define STRIP_0_DATA_PIN 1
14#define STRIP_0_CLOCK_PIN 2
15#define STRIP_1_DATA_PIN 3
16#define STRIP_1_CLOCK_PIN 4
17
18void five_bit_hd_gamma_bitshift(CRGB colors,
19 CRGB scale,
20 uint8_t global_brightness,
21 CRGB* out_colors,
22 uint8_t *out_power_5bit) {
23 // all 0 values for output
24 *out_colors = CRGB(0, 0, 0);
25 *out_power_5bit = 0;
26 Serial.println("Override function called");
27}
28
29CRGB leds_hd[NUM_LEDS] = {0}; // HD mode implies gamma.
30
31
32void setup() {
33 delay(500); // power-up safety delay
34 // Two strips of LEDs, one in HD mode, one in software gamma mode.
35 FastLED.addLeds<APA102HD, STRIP_0_DATA_PIN, STRIP_0_CLOCK_PIN, RGB>(
36 leds_hd, NUM_LEDS);
37}
38
39void loop() {
40 // Draw a a linear ramp of brightnesses to showcase the difference between
41 // the HD and non-HD mode.
42 for (int i = 0; i < NUM_LEDS; i++) {
43 uint8_t brightness = map(i, 0, NUM_LEDS - 1, 0, 255);
44 CRGB c(brightness, brightness,
45 brightness); // Just make a shade of white.
46 leds_hd[i] = c; // The APA102HD leds do their own gamma correction.
47 }
48 FastLED.show(); // All leds are now written out.
49 delay(8); // Wait 8 milliseconds until the next frame.
50}
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:33
central include file for FastLED, defines the CFastLED class/object
@ APA102HD
APA102 LED chipset with 5-bit gamma correction.
Definition FastLED.h:105
void show(uint8_t scale)
Update all our controllers with the current led colors, using the passed in brightness.
Definition FastLED.cpp:82
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
Definition FastLED.cpp:67
Fast, efficient 8-bit math functions specifically designed for high-performance LED programming.
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:39