#ifndef H_29BB41A351824C13AA4B9673DCEC215D #define H_29BB41A351824C13AA4B9673DCEC215D #include struct Pixel { uint8_t green; uint8_t red; uint8_t blue; void set(uint8_t g, uint8_t r, uint8_t b) { green = g; red = r; blue = b; } void set(const uint8_t* grb) { set(grb[0], grb[1], grb[2]); } uint32_t get() { return green << 24 | red << 16 | blue << 8; } }; struct BigPixel { uint32_t value; //should check for endianness I think //but there is no fully compliant way to test at compile time #if defined(__BYTE_ORDER__)&&(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) uint8_t& green() { return *(reinterpret_cast(value)+0); } uint8_t& red() { return *(reinterpret_cast(value)+1); } uint8_t& blue() { return *(reinterpret_cast(value)+2); } uint8_t& white() { return *(reinterpret_cast(value)+3); } #else uint8_t& green() { return *(reinterpret_cast(value)+3); } uint8_t& red() { return *(reinterpret_cast(value)+2); } uint8_t& blue() { return *(reinterpret_cast(value)+1); } uint8_t& white() { return *(reinterpret_cast(value)+0); } #endif }; // GRB color const Pixel Callie = { 0xD0, 0xA0, 0xC8 }; const Pixel Coqui = { 0xF4, 0xFF, 0x91 }; const Pixel Meat = { 0xEA, 0xCD, 0xBF }; const Pixel Olivia = { 0xCC, 0xFF, 0xE7 }; const BigPixel bCallie = { 0xD0A0C800 }; const BigPixel bCoqui = { 0xF4FF9100 }; const BigPixel bMeat = { 0xEACDBF00 }; const BigPixel bOlivia = { 0xCCFFE700 }; #endif //H_29BB41A351824C13AA4B9673DCEC215D