eclipse / upm

UPM is a high level repository that provides software drivers for a wide variety of commonly used sensors and actuators. These software drivers interact with the underlying hardware platform through calls to MRAA APIs.
MIT License
662 stars 411 forks source link

p9813 incorrect header calculation #568

Closed geedubess closed 7 years ago

geedubess commented 7 years ago

upm/src/p9813/p9813.c:135

I'm not using this code, but I happened to do a google search for 'p9813 xor' while double-checking my own header algorithm, and found a bug in yours. Because I'm not using this code, I'm going to be lazy and not fork/issue a pull request. (:

    byte0 ^= (blue >> 2) & 0x30; // XOR bits 4-5
    byte0 ^= (green >> 4) & 0xC0; // XOR bits 2-3
    byte0 ^= (red >> 6) & 0x03; // XOR bits 0-1

0xC0 isn't bits 2-3. You want 0x0C for the green field mask to get bits 2-3!

malikabhi05 commented 7 years ago

Hi @geedubess , thanks for reporting this. It looks like there is a typo here, we will fix this.

malikabhi05 commented 7 years ago

This has been fixed and tested. Commit: bac9e3bbc020bac20d109096b15b3ad32fad739f