ESPHome
2026.11.0-dev
Loading...
Searching...
No Matches
esphome
components
as734x
color_helpers.h
Go to the documentation of this file.
1
#pragma once
2
#include <cstdint>
3
4
#include "
esphome/core/defines.h
"
5
6
namespace
esphome::as734x
{
7
8
// Smallest tristimulus sum that still carries a usable hue.
9
constexpr
float
MIN_TRISTIMULUS_SUM
= 0.001f;
10
11
// Correlated colour temperature in kelvin from CIE 1931 tristimulus values, using McCamy's
12
// approximation. Returns NAN when the input carries no usable hue, or when the result falls
13
// outside the range the approximation holds over.
14
float
tristimulus_to_cct
(
float
x
,
float
y
,
float
z
);
15
16
#ifdef USE_AS734X_RGB
17
// sRGB components for CIE 1931 tristimulus values. Pass chromaticity (x + y + z == 1) rather than
18
// absolute values, otherwise anything but dim light clamps to white.
19
void
tristimulus_to_rgb
(
float
x
,
float
y
,
float
z
, uint8_t &r, uint8_t &g, uint8_t &b);
20
#endif
21
22
}
// namespace esphome::as734x
defines.h
z
bool z
Definition
msa3xx.h:1
esphome::as734x
Definition
as734x.cpp:11
esphome::as734x::tristimulus_to_rgb
void tristimulus_to_rgb(float x, float y, float z, uint8_t &r, uint8_t &g, uint8_t &b)
Definition
color_helpers.cpp:52
esphome::as734x::tristimulus_to_cct
float tristimulus_to_cct(float x, float y, float z)
Definition
color_helpers.cpp:28
esphome::as734x::MIN_TRISTIMULUS_SUM
constexpr float MIN_TRISTIMULUS_SUM
Definition
color_helpers.h:9
x
uint16_t x
Definition
tt21100.cpp:5
y
uint16_t y
Definition
tt21100.cpp:6
Generated by
1.12.0