Looking at a post in the 'Sensors' forum I saw you had posted some code. Here is a reimplementation of a short section in your library code -
struct rgb_t
{
union {
struct {
unsigned _b:5;
unsigned _g:6;
unsigned _r:5;
};
uint16_t _rgb;
};
rgb_t(uint8_t r, uint8_t g, uint8_t b)
: _r(r), _g(g), _b(b)
{}
rgb_t(uint16_t rgb)
: _rgb(rgb)
{}
operator uint16_t() const { return _rgb; };
uint8_t red() const { return _r; };
uint8_t green() const { return _g; };
uint8_t blue() const { return _b; };
};
uint32_t HacroCam::pixel(uint8_t r, uint8_t g, uint8_t b)
{
return rgb_t(r >> 3, g >> 2, b >> 3);
}
byte HacroCam::lsb(byte r, byte g, byte b) {
return lowByte(pixel(r, g, b));
}
byte HacroCam::msb(byte r, byte g, byte b) {
return highByte(pixel(r, g, b));
}