Skip to content

Commit

Permalink
add some ideas from Phillip Burgess (www.PaintYourDragon.com)
Browse files Browse the repository at this point in the history
  • Loading branch information
neophob committed Mar 8, 2012
1 parent dcc1016 commit 79716d2
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions Neophob_LPD6803.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,17 @@ void Neophob_LPD6803::show(void) {


void Neophob_LPD6803::setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b) {
uint16_t data;

if (n > numLEDs) return;

data = g & 0x1F;

/* As a modest alternative to full double-buffering, the setPixel()
function blocks until the serial output interrupt has moved past
the pixel being modified here. If the animation-rendering loop
functions in reverse (high to low pixel index), then the two can
operate together relatively efficiently with only minimal blocking
and no second pixel buffer required. */
//while(nState==0); enable me

uint16_t data = g & 0x1F;
data <<= 5;
data |= b & 0x1F;
data <<= 5;
Expand All @@ -132,6 +138,14 @@ void Neophob_LPD6803::setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b)
void Neophob_LPD6803::setPixelColor(uint16_t n, uint16_t c) {
if (n > numLEDs) return;

/* As a modest alternative to full double-buffering, the setPixel()
function blocks until the serial output interrupt has moved past
the pixel being modified here. If the animation-rendering loop
functions in reverse (high to low pixel index), then the two can
operate together relatively efficiently with only minimal blocking
and no second pixel buffer required. */
//while(nState==0); enable me

pixels[n] = 0x8000 | c;
}

Expand Down

0 comments on commit 79716d2

Please sign in to comment.