M5Unit-COLOR 0.2.0 git rev:d6fe6e1
Loading...
Searching...
No Matches
m5::unit::tcs3472x::Data Struct Reference

Measurement data group. More...

#include <unit_TCS3472x_data.hpp>

Public Member Functions

int32_t IR (const bool usingCache=true) const
 Gets the IR component.
 
Raw value
uint16_t R16 () const
 Gets the raw red value.
 
uint16_t G16 () const
 Gets the raw green value.
 
uint16_t B16 () const
 Gets the raw blue value.
 
uint16_t C16 () const
 Gets the raw clear value.
 
uint16_t RnoIR16 () const
 Gets the raw red value without IR component.
 
uint16_t GnoIR16 () const
 Gets the raw green value without IR component.
 
uint16_t BnoIR16 () const
 Gets the raw blue value without IR component.
 
uint16_t CnoIR16 () const
 Gets the raw clear value without IR component.
 
RGB
uint8_t R8 () const
 Gets the red value (0-255)
 
uint8_t G8 () const
 Gets the green value (0-255)
 
uint8_t B8 () const
 Gets the blue value (0-255)
 
uint8_t RnoIR8 () const
 Gets the red value without IR component (0-255)
 
uint8_t GnoIR8 () const
 Gets the green value without IR component (0-255)
 
uint8_t BnoIR8 () const
 Gets the blue value without IR component (0-255)
 
uint16_t RGB565 () const
 Gets the value in RGB565 format.
 
uint32_t RGB888 () const
 Gets the value in RGB888 format.
 
uint16_t RGBnoIR565 () const
 Gets the value in RGB565 format without IR component.
 
uint32_t RGBnoIR888 () const
 Gets the value in RGB888 format without IR component.
 

Static Public Member Functions

static uint8_t raw_to_uint8 (const int32_t v, const int32_t c)
 Raw to uint8_t.
 
Conversion (Same as M5GFX)
static constexpr uint8_t color332 (const uint8_t r, const uint8_t g, const uint8_t b)
 Converts 8-bit RGB channels to RGB332 format.
 
static constexpr uint16_t color565 (const uint8_t r, const uint8_t g, const uint8_t b)
 Converts 8-bit RGB channels to RGB565 format.
 
static constexpr uint32_t color888 (const uint8_t r, const uint8_t g, const uint8_t b)
 Converts 8-bit RGB channels to RGB888 format.
 
static constexpr uint16_t swap565 (const uint8_t r, const uint8_t g, const uint8_t b)
 Converts 8-bit RGB channels to byte-swapped RGB565 format.
 
static constexpr uint32_t swap888 (const uint8_t r, const uint8_t g, const uint8_t b)
 Converts 8-bit RGB channels to byte-swapped RGB888 format.
 

Public Attributes

std::array< uint8_t, 8 > raw {}
 Raw data ClCh/RlRh/GlGh/BlBh.
 

Detailed Description

Measurement data group.

Member Function Documentation

◆ color332()

static constexpr uint8_t m5::unit::tcs3472x::Data::color332 ( const uint8_t r,
const uint8_t g,
const uint8_t b )
inlinestaticconstexpr

Converts 8-bit RGB channels to RGB332 format.

Parameters
rRed (0-255)
gGreen (0-255)
bBlue (0-255)
Returns
RGB332 value

◆ color565()

static constexpr uint16_t m5::unit::tcs3472x::Data::color565 ( const uint8_t r,
const uint8_t g,
const uint8_t b )
inlinestaticconstexpr

Converts 8-bit RGB channels to RGB565 format.

Parameters
rRed (0-255)
gGreen (0-255)
bBlue (0-255)
Returns
RGB565 value

◆ color888()

static constexpr uint32_t m5::unit::tcs3472x::Data::color888 ( const uint8_t r,
const uint8_t g,
const uint8_t b )
inlinestaticconstexpr

Converts 8-bit RGB channels to RGB888 format.

Parameters
rRed (0-255)
gGreen (0-255)
bBlue (0-255)
Returns
RGB888 value

◆ IR()

int32_t m5::unit::tcs3472x::Data::IR ( const bool usingCache = true) const
inline

Gets the IR component.

Parameters
usingCacheIf true, use cached value when available
Returns
IR component value
Note
The cache is rebuilt each time the unit reads a measurement into this object. If raw is modified directly, call with usingCache = false

◆ raw_to_uint8()

static uint8_t m5::unit::tcs3472x::Data::raw_to_uint8 ( const int32_t v,
const int32_t c )
inlinestatic

Raw to uint8_t.

Parameters
vRaw channel value
cRaw clear channel value
Returns
Scaled uint8_t value

◆ swap565()

static constexpr uint16_t m5::unit::tcs3472x::Data::swap565 ( const uint8_t r,
const uint8_t g,
const uint8_t b )
inlinestaticconstexpr

Converts 8-bit RGB channels to byte-swapped RGB565 format.

Parameters
rRed (0-255)
gGreen (0-255)
bBlue (0-255)
Returns
byte-swapped RGB565 value

◆ swap888()

static constexpr uint32_t m5::unit::tcs3472x::Data::swap888 ( const uint8_t r,
const uint8_t g,
const uint8_t b )
inlinestaticconstexpr

Converts 8-bit RGB channels to byte-swapped RGB888 format.

Parameters
rRed (0-255)
gGreen (0-255)
bBlue (0-255)
Returns
byte-swapped RGB888 value