M5Unit-RGB 0.1.0 git rev:b7fdb9a
Loading...
Searching...
No Matches
unit_LED_data.hpp File Reference

Color type and data line timing for M5Unit-RGB. More...

#include "../utility/m5unit_rgb_utility.hpp"
#include <cstdint>

Go to the source code of this file.

Classes

union  m5::unit::rgb::Color
 WRGB 32bits. More...
 

Namespaces

namespace  m5
 Top level namespace of M5Stack.
 
namespace  rgb
 For M5Unit-RGB.
 
namespace  timing
 Data line timing shared by the SK6812 and WS2812 units (ns)
 

Typedefs

using m5::unit::rgb::wrgb32_color_t = uint32_t
 WRGB 32bits.
 

Functions

constexpr bool m5::unit::rgb::operator== (const Color &lhs, const Color &rhs)
 Compare two Colors.
 
constexpr uint32_t m5::unit::rgb::ticks_from_ns (const uint32_t ns, const uint32_t resolution_hz)
 Convert a duration to RMT ticks.
 

Variables

constexpr uint32_t m5::unit::rgb::timing::T0H_NS {350}
 0 code, high
 
constexpr uint32_t m5::unit::rgb::timing::T0L_NS {800}
 0 code, low
 
constexpr uint32_t m5::unit::rgb::timing::T1H_NS {700}
 1 code, high
 
constexpr uint32_t m5::unit::rgb::timing::T1L_NS {600}
 1 code, low
 
constexpr uint32_t m5::unit::rgb::timing::RESET_NS {300000}
 Reset (latch), WS2812C-2020 needs > 280 us.
 

Detailed Description

Color type and data line timing for M5Unit-RGB.

Kept apart from unit_LED.hpp so the native (host) tests can include it without pulling in M5UnitComponent.

Function Documentation

◆ operator==()

bool m5::unit::rgb::operator== ( const Color & lhs,
const Color & rhs )
constexpr

Compare two Colors.

Parameters
lhsLeft-hand side
rhsRight-hand side
Returns
True if equal

◆ ticks_from_ns()

uint32_t m5::unit::rgb::ticks_from_ns ( const uint32_t ns,
const uint32_t resolution_hz )
constexpr

Convert a duration to RMT ticks.

Parameters
nsDuration (ns)
resolution_hzRMT resolution (Hz)
Returns
Ticks, rounded to the nearest (not clamped to the 15-bit RMT duration)