Added crgb conversion

This commit is contained in:
CommanderRedYT
2022-01-17 17:39:50 +01:00
parent c44e683941
commit 8e3397c6e5

View File

@ -61,3 +61,19 @@ float wattToMotorCurrent(float watt);
uint8_t time_to_percent(espchrono::milliseconds32 repeat, espchrono::milliseconds32 riseTime, espchrono::milliseconds32 fullTime, size_t numLeds, bool invert);
std::string local_clock_string();
int16_t map_analog_stick(uint16_t middle, uint16_t start, uint16_t end, uint16_t raw);
inline uint32_t CRGB_TO_UINT32(CRGB crgb)
{
return crgb.raw[0]<<16 | crgb.raw[1]<<8 | crgb.raw[2];
}
inline CRGB UINT32_TO_CRGB(uint32_t color)
{
CRGB crgb;
crgb.raw[0]=color>>16 & 0xFF;
crgb.raw[1]=color>>8 & 0xFF;
crgb.raw[2]=color & 0xFF;
return crgb;
}