M5Unit-RGB 0.0.2 git rev:51dfbe6
Loading...
Searching...
No Matches
m5unit_rgb_utility.hpp File Reference

Utilities for M5Unit-RGB. More...

#include <cstdint>

Go to the source code of this file.

Namespaces

namespace  m5
 Top level namespace of M5Stack.
 

Functions

uint32_t m5::unit::rgb::hsv2rgb (const uint8_t h, const uint8_t s, const uint8_t v)
 HSV to RGB.
 
uint8_t m5::unit::rgb::scale8 (const uint8_t a, const uint8_t b)
 Rounded 8-bit scale (divide-by-255)
 

Detailed Description

Utilities for M5Unit-RGB.

Function Documentation

◆ hsv2rgb()

uint32_t m5::unit::rgb::hsv2rgb ( const uint8_t h,
const uint8_t s,
const uint8_t v )

HSV to RGB.

Parameters
hHue (0-255)
sSaturation (0-255)
vValue (0-255)
Returns
Packed WRGB color (uint32_t)

◆ scale8()

uint8_t m5::unit::rgb::scale8 ( const uint8_t a,
const uint8_t b )
inline

Rounded 8-bit scale (divide-by-255)

Parameters
aValue to scale (0-255)
bScale factor (0-255, where 255 = 100%)
Returns
(a * b + 127) / 255. Maps scale8(255, 255) == 255 exactly (>> 8 would give 254).