M5Unit-RGB 0.0.2 git rev:51dfbe6
Loading...
Searching...
No Matches
unit_SK6812.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
3 *
4 * SPDX-License-Identifier: MIT
5 */
10#ifndef M5_UNIT_RGB_UNIT_SK6812_HPP
11#define M5_UNIT_RGB_UNIT_SK6812_HPP
12
13#include "unit_LED.hpp"
14
15namespace m5 {
16namespace unit {
17
22class UnitSK6812 : public UnitLED {
23 M5_UNIT_COMPONENT_HPP_BUILDER(UnitSK6812, 0x00);
24
25protected:
26 UnitSK6812(const uint16_t num_of_pixels, const rgb::Order order) : UnitLED(num_of_pixels, order)
27 {
28 }
29
30public:
32 virtual ~UnitSK6812()
33 {
34 }
35
36protected:
37 virtual gpio::adapter_config_t rmt_config() override;
38 inline virtual gpio::m5_rmt_item_t rmt_item_one() override
39 {
40 return gpio::m5_rmt_item_t{{14, 1, 12, 0}};
41 }
42 inline virtual gpio::m5_rmt_item_t rmt_item_zero() override
43 {
44 return gpio::m5_rmt_item_t{{7, 1, 16, 0}};
45 }
46 inline virtual gpio::m5_rmt_item_t rmt_item_reset() override
47 {
48 return gpio::m5_rmt_item_t{{1600, 0, 0, 0}};
49 }
50};
51
56class UnitSK6812GRB : public UnitSK6812 {
57 M5_UNIT_COMPONENT_HPP_BUILDER(UnitSK6812GRB, 0x00);
58
59public:
64 explicit UnitSK6812GRB(const uint16_t num_of_pixels) : UnitSK6812(num_of_pixels, rgb::Order::grb24)
65 {
66 }
69 {
70 }
71};
72
77class UnitSK6812GRBW : public UnitSK6812 {
78 M5_UNIT_COMPONENT_HPP_BUILDER(UnitSK6812GRBW, 0x00);
79
80public:
85 explicit UnitSK6812GRBW(const uint16_t num_of_pixels) : UnitSK6812(num_of_pixels, rgb::Order::grbw32)
86 {
87 }
90 {
91 }
92};
93
94} // namespace unit
95} // namespace m5
96#endif
rgb::Order order() const
Color order.
Definition unit_LED.hpp:303
UnitSK6812GRB(const uint16_t num_of_pixels)
Constructor.
Definition unit_SK6812.hpp:64
virtual ~UnitSK6812GRB()
Destructor.
Definition unit_SK6812.hpp:68
UnitSK6812GRBW(const uint16_t num_of_pixels)
Constructor.
Definition unit_SK6812.hpp:85
virtual ~UnitSK6812GRBW()
Destructor.
Definition unit_SK6812.hpp:89
SK6812 base Unit.
virtual ~UnitSK6812()
Destructor.
Definition unit_SK6812.hpp:32
Top level namespace of M5Stack.
For M5Unit-RGB.
Unit-related namespace.
LED base unit for M5UnitUnified.