M5Unit-RGB 0.0.1 git rev:55cb205
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:
31 virtual ~UnitSK6812()
32 {
33 }
34
35protected:
36 virtual gpio::adapter_config_t rmt_config() override;
37 inline virtual gpio::m5_rmt_item_t rmt_item_one() override
38 {
39 return gpio::m5_rmt_item_t{{14, 1, 12, 0}};
40 }
41 inline virtual gpio::m5_rmt_item_t rmt_item_zero() override
42 {
43 return gpio::m5_rmt_item_t{{7, 1, 16, 0}};
44 }
45 inline virtual gpio::m5_rmt_item_t rmt_item_reset() override
46 {
47 return gpio::m5_rmt_item_t{{1600, 0, 0, 0}};
48 }
49};
50
55class UnitSK6812GRB : public UnitSK6812 {
56 M5_UNIT_COMPONENT_HPP_BUILDER(UnitSK6812GRB, 0x00);
57
58public:
59 explicit UnitSK6812GRB(const uint16_t num_of_pixels) : UnitSK6812(num_of_pixels, rgb::Order::grb24)
60 {
61 }
62 virtual ~UnitSK6812GRB()
63 {
64 }
65};
66
71class UnitSK6812GRBW : public UnitSK6812 {
72 M5_UNIT_COMPONENT_HPP_BUILDER(UnitSK6812GRBW, 0x00);
73
74public:
75 explicit UnitSK6812GRBW(const uint16_t num_of_pixels) : UnitSK6812(num_of_pixels, rgb::Order::grbw32)
76 {
77 }
78 virtual ~UnitSK6812GRBW()
79 {
80 }
81};
82
83} // namespace unit
84} // namespace m5
85#endif
UnitLED(const uint16_t num_of_pixels, const rgb::Order order)
Constructor.
Definition unit_LED.hpp:188
rgb::Order order() const
Color order.
Definition unit_LED.hpp:236
Top level namespace of M5stack.
For M5Unit-RGB.
Unit-related namespace.
LED base unit for M5UnitUnified.
Order
Color order.
Definition unit_LED.hpp:65