Skip to content

Commit

Permalink
The comments are now a bit lighter and the conditional compilation is…
Browse files Browse the repository at this point in the history
… no more.
  • Loading branch information
Neil committed Jul 19, 2024
1 parent 19a6fcd commit b9c922e
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions light_ws2812_AVR/Light_WS2812/light_ws2812.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void ws2812_sendarray(uint8_t *data,uint16_t datlen)

void inline ws2812_sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi)
{
// `maskhi` is 0x80 if P?7 is the DATA line to the LED string, 0x04 for P?2 etc.
// `maskhi` is 0x80 if P?7 is LED DATA
uint8_t curbyte,ctr,masklo;
uint8_t sreg_prev;
#if __AVR_ARCH__ != 100
Expand All @@ -133,31 +133,21 @@ void inline ws2812_sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi)

ws2812_DDRREG |= maskhi; // Enable output

// `masklo` and `maskhi` are written to PORT? to drive the DATA line low or
// high (rather than setting or clearing the bit in PORT?)
masklo =~maskhi&ws2812_PORTREG;
// `masklo` becomes the value to write to the PORT? register in order to
// drive the DATA line low.
maskhi |= ws2812_PORTREG;
// `maskhi` becomes the value to write to the PORT? register in order to
// drive the DATA line high. All other bits in the PORT? register are
// preserved by becoming part of the byte that is written here.

sreg_prev=SREG;

// If we are not expected to support interrupts while driving the LED
// string..
#ifdef interrupt_is_disabled
cli();
#endif

// Go through each byte that should be sent to the LED string..
while (datlen--) {
curbyte=*data++;

#ifndef __GNUC__
asm volatile(
#else
__asm__ volatile(
#endif
" ldi %0,8 \n\t"
#ifndef interrupt_is_disabled
" clt \n\t"
Expand Down

0 comments on commit b9c922e

Please sign in to comment.