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

Function showRGBInternal

src/platforms/avr/attiny/clockless_blocking.h:490–619  ·  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

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

Callers 1

Calls 4

advanceByMethod · 0.80
portFunction · 0.50
maskFunction · 0.50

Tested by

no test coverage detected