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

Function Pixel_SecondaryProcessing

Macro/PixelMap/pixel.c:2320–2570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2318}
2319
2320void Pixel_SecondaryProcessing()
2321{
2322 // Copy KLL buffer into LED buffer
2323 for ( uint8_t buf = 0; buf < Pixel_BuffersLen_KLL; buf++ )
2324 {
2325 memcpy(
2326 LED_Buffers[buf].data,
2327 Pixel_Buffers[buf].data,
2328 Pixel_Buffers[buf].size * ( Pixel_Buffers[buf].width >> 3 ) // Size may not be multiples bytes
2329 );
2330 }
2331
2332 // Iterate over each of the pixels, applying the appropriate profile to each one
2333 for ( uint16_t pxin = 0; pxin < Pixel_TotalPixels_KLL; pxin++ )
2334 {
2335 // Select profile
2336 uint8_t profile_in = Pixel_pixel_fade_profile[pxin];
2337
2338 // Nothing to do
2339 if ( profile_in == 0 )
2340 {
2341 continue;
2342 }
2343
2344 // All profiles start from 1
2345 PixelFadeProfile *profile = &Pixel_pixel_fade_profile_entries[profile_in - 1];
2346 PixelPeriodConfig *period = &profile->conf[profile->period_conf];
2347
2348 // Lookup channels of the pixel
2349 const PixelElement *elem = &Pixel_Mapping[pxin];
2350 for ( uint8_t ch = 0; ch < elem->channels; ch++ )
2351 {
2352 // Lookup PixelBuf containing the channel
2353 uint16_t chan = elem->indices[ch];
2354 PixelBuf *buf = LED_bufferMap( chan );
2355
2356 // Lookup memory location
2357 // Then apply fade depending on the current position
2358 //
2359 // Percentage calculation using 32-bit integer instead of float
2360 // This is just a: pos / end * current value of LED
2361 // Ignores rounding
2362 // For 8-bit values, the maximum percentage spread must be no greater than 25-bits
2363 // e.g. 1 << 24
2364 uint32_t val;
2365 switch (buf->width)
2366 {
2367 case 8:
2368 switch ( profile->period_conf )
2369 {
2370 // Off -> On
2371 case PixelPeriodIndex_Off_to_On:
2372 // On -> Off
2373 case PixelPeriodIndex_On_to_Off:
2374 // If start and end are set to 0, ignore
2375 if ( period->end == 0 && period->start == 0 )
2376 {
2377 val = (uint8_t)((uint8_t*)buf->data)[chan - buf->offset];

Callers 1

Pixel_processFunction · 0.85

Calls 3

LED_bufferMapFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…