This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CRGB ColorFromPalette12(CRGBPalette16 pal, uint16_t index, uint8_t brightness, TBlendType blendType) { | |
//index is a 12-bit number, range 0-4095 | |
//uint8_t hi4 = lsrX4(index); | |
//uint8_t lo4 = index & 0x0F; | |
uint8_t hi4 = (index & 0x0F00) >> 8; //***shift 8 bits to the right instead of 4 | |
uint8_t lo8 = index & 0xFF; //***keep right 8 bytes instead of right 4 bytes | |
// const CRGB* entry = &(pal[0]) + hi4; | |
// since hi4 is always 0..15, hi4 * sizeof(CRGB) can be a single-byte value, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* A FastLED example showing how to | |
* map a virtual 2d matrix onto a circular led setup | |
* | |
* limitations: works so far only up to 255 leds | |
* | |
* written by Stefan Petrick 2016 | |
*/ | |
#include "FastLED.h" |