Permalink
Browse files

Merge pull request #5 from Incanus-uk/master

getPixelColor always returns 127 for green
  • Loading branch information...
PaintYourDragon committed Jan 29, 2012
2 parents 91998a4 + 345404f commit 882b4fa2ced15283ac0ef6f42edc71ee8c9b85c5
Showing with 3 additions and 3 deletions.
  1. +3 −3 LPD8806.cpp
View
@@ -212,9 +212,9 @@ void LPD8806::setPixelColor(uint16_t n, uint32_t c) {
uint32_t LPD8806::getPixelColor(uint16_t n) {
if(n < numLEDs) {
uint16_t ofs = n * 3;
- return ((pixels[ofs ] << 16) |
- (pixels[ofs + 1] << 8) |
- pixels[ofs + 2]) & 0x7f7f7f;
+ return ((uint32_t)((uint32_t)pixels[ofs ] << 16) |
+ (uint32_t)((uint32_t)pixels[ofs + 1] << 8) |
+ (uint32_t)pixels[ofs + 2]) & 0x7f7f7f;
}
return 0; // Pixel # is out of bounds

0 comments on commit 882b4fa

Please sign in to comment.