MCPcopy Create free account
hub / github.com/kiibohd/controller / Pixel_ApplyFadeBrightness

Function Pixel_ApplyFadeBrightness

Macro/PixelMap/pixel.c:2305–2318  ·  view source on GitHub ↗

Given a starting value and profile, calculate the resulting brightness The returned value is always equal to or less than val

Source from the content-addressed store, hash-verified

2303// Given a starting value and profile, calculate the resulting brightness
2304// The returned value is always equal to or less than val
2305static inline uint32_t Pixel_ApplyFadeBrightness( uint8_t brightness, uint32_t val )
2306{
2307 // No need to calculate if brightness is max or 0
2308 if ( brightness == 255 )
2309 {
2310 return val;
2311 }
2312 if ( brightness == 0 )
2313 {
2314 return 0;
2315 }
2316 uint32_t result = (val * brightness) >> 8; // val * brightness / 255
2317 return result;
2318}
2319
2320void Pixel_SecondaryProcessing()
2321{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…