M5Unit-COLOR 0.1.0 git rev:ba99933
Loading...
Searching...
No Matches
unit_color_utility.cpp File Reference

Utilities for UnitColor. More...

#include "unit_color_utility.hpp"
#include <M5Utility.hpp>
#include <limits>

Namespaces

namespace  m5
 Top level namespace of M5stack.
 

Functions

std::tuple< uint8_t, bool > m5::unit::tcs3472x::ms_to_wtime (const float ms)
 ms to WTIME and WLONG
 
float m5::unit::tcs3472x::calculateLux (const uint16_t rawR, const uint16_t rawG, const uint16_t rawB, const uint16_t rawC, const float atime_ms, const Gain gc, const float dgf=DGF, const float coefR=R_Coef, const float coefG=G_Coef, const float coefB=B_Coef)
 Calculate Lux.
 
float m5::unit::tcs3472x::calculateColorTemperature (const uint16_t rawR, const uint16_t rawG, const uint16_t rawB, const uint16_t rawC, const float coefCT=CT_Coef, const float offsetCT=CT_Offset)
 Calculate color temperature(degrees Kelvin)
 
uint16_t m5::unit::tcs3472x::calculateSaturation (const uint8_t atime)
 Calculate Saturation.
 
float m5::unit::tcs3472x::calculateCRATIO (const uint16_t rawR, const uint16_t rawG, const uint16_t rawB, const uint16_t rawC)
 Calculate CRATIO.
 
float m5::unit::tcs3472x::calculateCPL (const float atime_ms, const Gain gc, const float dgf=DGF)
 Calculate Counts per Lux (CPL)
 

Detailed Description

Utilities for UnitColor.

Function Documentation

◆ calculateColorTemperature()

float m5::unit::tcs3472x::calculateColorTemperature ( const uint16_t rawR,
const uint16_t rawG,
const uint16_t rawB,
const uint16_t rawC,
const float coefCT = CT_Coef,
const float offsetCT = CT_Offset )

Calculate color temperature(degrees Kelvin)

Parameters
rawRRaw red value
rawGRaw green value
rawBRaw blue value
rawCRaw clear value
coefCTCoefficient for the color temperature
offsetCTOffset for the the color temperature
Returns
Color temperature(degrees Kelvin)

◆ calculateCPL()

float m5::unit::tcs3472x::calculateCPL ( const float atime_ms,
const Gain gc,
const float dgf = DGF )

Calculate Counts per Lux (CPL)

Parameters
atime_msintegtation time(ms)
gcGain
dgfDevice and Glass Factor
Returns
CPL

◆ calculateCRATIO()

float m5::unit::tcs3472x::calculateCRATIO ( const uint16_t rawR,
const uint16_t rawG,
const uint16_t rawB,
const uint16_t rawC )

Calculate CRATIO.

Parameters
rawRraw red value
rawGraw green value
rawBraw blue value
rawCraw clear value
Returns
CRATIO (0.0f - 1.0f) Guidelines for CRATIO and Light Source Correspondence
Compare Description
CRATIO < 0.1 LED or fluorescent light
0.1 <= CRATIO < 0.25 Sunlight
0.25 <0 CRATIO Incandescent light

◆ calculateLux()

float m5::unit::tcs3472x::calculateLux ( const uint16_t rawR,
const uint16_t rawG,
const uint16_t rawB,
const uint16_t rawC,
const float atime_ms,
const Gain gc,
const float dgf = DGF,
const float coefR = R_Coef,
const float coefG = G_Coef,
const float coefB = B_Coef )

Calculate Lux.

Parameters
rawRRaw red value
rawGRaw green value
rawBRaw blue value
rawCRaw clear value
atime_msIntegtation time(ms)
gcGain
dgfDevice and Glass Factor
coefRCoefficient for the R channel
coefGCoefficient for the G channel
coefBCoefficient for the B channel
Returns
Lux (lx)

◆ calculateSaturation()

uint16_t m5::unit::tcs3472x::calculateSaturation ( const uint8_t atime)

Calculate Saturation.

Parameters
atimeATIME raw value
Returns
Saturation value
Note
Ripple saturation is also considered (in Analog)