![]() You may not use this file except in compliance with the License. Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, Version 3.0 or greater (the "License") Not being able to quickly grok the code, looking at the rainbow waveform image led me to implement an approximation of that as simply as I could. Yet the discussion of more natural looking HSV color-wheels led me to look back at FastLED HSV to RGB and at their Rainbow HSV. I added both power-efficient (saw-tooth) and smoother looking (sine) wave implementation leveraging the spectrum HSV code. ![]() Reading up on HSV again on Instructables, Ontaelio also spoke to power efficiency through using wave forms and in to how they effected percieved color. Kasper also addressed dimming for luminance normalization. Looking at it, I found I could simplify it a little more by pulling common calculation up out of the case I then implemented that in Xtensa. I tried copying the logic of the AVR in fast_hsv2rgb, and then the C logic, both of which use opaque iterative pointer-swapping, but I decided to use a jump table, and then to move to simplify the whole thing.Īnd the simplest HSV to RGB code out there, I found, is Kasper Kamperman's, with a simple flow through and case at the end. Next I came to use fast_hsv2rgb from Vagrearg: Lots of interesting math and theory on spectrum HSV, with C implementations, and also AVR, which got me thinking of why not an Xtensa version. Initially I looked at FastLED but determined it too broad a library for my use, and it dictated that FastLED be at the center of whatever you were doing which was not what I wanted. I came to write this library after looking into options to do HSV-to-RGB conversion. xrgb2rgbwgamma8 - RGB to RGBW with gamma correction.xhsv2rgbwgamma8 - HSV to RGB with gamma correction.xhsv2rgbgamma8 - HSV to RGB with gamma correction.xhsv2rgb8 - HSV to RGB default function that points to an above function of your choice.xhsv2rgb8w - HSV to RGB using a (sine) wave function.xhsv2rgb8t - HSV to RGB using a tweaked function aproximating FastLED Rainbow HSV.xhsv2rgb8e - HSV to RGB using a power efficient function.xhsv2rgb8s - HSV to RGB using the Spectrum algorythm.xrgbwgamma8 - Normalizes a set of 8-bit RGBW values.xrgbgamma8 - Normalizes a set of 8-bit RGB values.xgammaarray8 - Normalizes a range of 8-bit color values.xgamma8 - Normalizes the value of a single 8-bit color value. ![]() The examples folder contains sketches than can test the functions and generate look-up tables used by the code. The functions are grouped and can be included/excluded in the compiled code as dictated by pre-processor definitions. The library is compiled based on flags in the src/options.h file: Taking KasperKampemans C impementation of HSV as the baseline: HSV Implementationĭrop the library into your ~Arduino/libraries folder and include the ESPxRGB.h header in your project. Performanceīenching HSV Conversions for 6291456 iterations RGB chroma correction (for normalizing the perception of luminance across the spectrum)Įxternal C headers provide regular Arduino and ESP-IDF code access to the functions.RGB gamma correction (for normalizing the perception of pulsing luminance).HSV to RGB and RGBW, with a choice of four HSV algorythms.FeaturesĮSPxRGB currently works in the 8-bit RGB/W space only. S files are compiled along with the ESPxRGB.h header when pulled into a project. The assembler itself is contained in GNU-format assembler. Plus, they are easy to program with a nice instruction set. The ESP SoCs are great given their feature set, conectivity, power and price. ![]() Looking to use small, low-powered SoCs to drive long strings of LEDs with the optimum speed and power efficiency places a premium on efficient algorythms and code, and Assembler is as efficient as you can get. Why an assembler RGB manipulation library Why an assembler RGB manipulation library.ESPxRGB is an Arduino library of RGB, RGBW, HSV conversion functions and Gamma Correction written in Xtensa assembler for ESP SoCs that use Xtensa cores ( ESP32).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |