MCPcopy Create free account
hub / github.com/FastLED/FastLED / showRGBInternal

Function showRGBInternal

src/platforms/avr/attiny/clockless_blocking_controller.h:479–608  ·  view source on GitHub ↗

This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then gcc will use register Y for the this pointer.

Source from the content-addressed store, hash-verified

477 // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then
478 // gcc will use register Y for the this pointer.
479 static void /*__attribute__((optimize("O0")))*/ /*__attribute__ ((always_inline))*/ showRGBInternal(PixelController<RGB_ORDER> & pixels) {
480 u8 *data = (u8*)pixels.mData;
481 data_ptr_t port = FastPin<DATA_PIN>::port();
482 data_t mask = FastPin<DATA_PIN>::mask();
483 u8 scale_base = 0;
484
485 // FASTLED_REGISTER uint8_t *end = data + nLeds;
486 data_t hi = *port | mask;
487 data_t lo = *port & ~mask;
488 *port = lo;
489
490 // the byte currently being written out
491 u8 b0 = 0;
492 // the byte currently being worked on to write the next out
493 u8 b1 = 0;
494
495 // Setup the pixel controller
496 pixels.preStepFirstByteDithering();
497
498 // pull the dithering/adjustment values out of the pixels object for direct asm access
499
500 // even though advanceBy is only an int8, we cast it to int16 for sign extension in case it's negative.
501 i16 advanceBy = pixels.advanceBy();
502 u16 count = pixels.mLen;
503
504 u8 s0 = pixels.mColorAdjustment.premixed.raw[RO(0)];
505 u8 s1 = pixels.mColorAdjustment.premixed.raw[RO(1)];
506 u8 s2 = pixels.mColorAdjustment.premixed.raw[RO(2)];
507#if (FASTLED_SCALE8_FIXED==1)
508 s0++; s1++; s2++;
509#endif
510 u8 d0 = pixels.d[RO(0)];
511 u8 d1 = pixels.d[RO(1)];
512 u8 d2 = pixels.d[RO(2)];
513 u8 e0 = pixels.e[RO(0)];
514 u8 e1 = pixels.e[RO(1)];
515 u8 e2 = pixels.e[RO(2)];
516
517 u8 loopvar=0;
518
519 // This has to be done in asm to keep gcc from messing up the asm code further down
520 b0 = data[RO(0)];
521 {
522 LDSCL4(b0,O0) PRESCALEA2(d0)
523 PRESCALEB4(d0) SCALE02(b0,0)
524 RORSC04(b0,1) ROR1(b0) CLC1
525 SCROR04(b0,2) SCALE02(b0,3)
526 RORSC04(b0,4) ROR1(b0) CLC1
527 SCROR04(b0,5) SCALE02(b0,6)
528 RORSC04(b0,7) ROR1(b0) CLC1
529 MOV_ADDDE04(b1,b0,d0,e0)
530 MOV1(b0,b1)
531 }
532
533 {
534 // while(--count)
535 {
536 // Loop beginning

Callers 1

Calls 4

advanceByMethod · 0.80
portFunction · 0.50
maskFunction · 0.50

Tested by

no test coverage detected