MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / map2_565

Method map2_565

libraries/map2colour/map2colour.cpp:95–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93
94
95uint16_t map2colour::map2_565(float value)
96{
97 uint32_t RGB = map2RGB(value);
98 uint16_t colour = 0x0000;
99 RGB >>= 3;
100 colour |= (RGB & 0x001F); // B channel 5 bits
101 RGB >>= 2;
102 colour |= (RGB & 0x07E0); // G channel 6 bits
103 RGB >>= 3;
104 colour |= (RGB & 0xF800); // R channel 5 bits
105 return colour;
106}
107
108
109/////////////////////////////////////////////////////////////////////////

Callers 1

unittestFunction · 0.80

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.64