Skip to content

Commit

Permalink
Merge pull request #6 from AntonKast/master
Browse files Browse the repository at this point in the history
Adafruit_WS2801.getPixelColor() suffers overflow
  • Loading branch information
ladyada committed Aug 13, 2012
2 parents 2a058b0 + d221943 commit 2fd0b33
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Adafruit_WS2801.cpp
Expand Up @@ -187,7 +187,7 @@ uint32_t Adafruit_WS2801::getPixelColor(uint16_t n) {
// types. For compatibility with existing code, 'packed' RGB
// values passed in or out are always 0xRRGGBB order.
return (rgb_order == WS2801_RGB) ?
((uint32_t)pixels[ofs] << 16) | (pixels[ofs + 1] << 8) | pixels[ofs + 2] :
((uint32_t)pixels[ofs] << 16) | ((uint16_t) pixels[ofs + 1] << 8) | pixels[ofs + 2] :
(pixels[ofs] << 8) | ((uint32_t)pixels[ofs + 1] << 16) | pixels[ofs + 2];
}

Expand Down

0 comments on commit 2fd0b33

Please sign in to comment.