M5UnitUnified 0.1.5 git rev:23e84e7
Loading...
Searching...
No Matches
types.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
3 *
4 * SPDX-License-Identifier: MIT
5 */
10#ifndef M5_UNIT_COMPONENT_TYPES_HPP
11#define M5_UNIT_COMPONENT_TYPES_HPP
12
13#include <cstdint>
14#include <type_traits>
16#if defined(M5_UNIT_UNIFIED_USING_RMT_V2)
17#include <driver/rmt_types.h>
18#else
19#include <soc/rmt_struct.h>
20#endif
21#include <driver/gpio.h>
22
23namespace m5 {
24namespace unit {
29namespace types {
30
35enum class category_t {
36 None,
37 UnitLED,
38};
39
40using uid_t = uint32_t;
41using attr_t = uint32_t;
42using elapsed_time_t = unsigned long;
43
44namespace attribute {
47constexpr attr_t AccessI2C = 0x00000001;
48constexpr attr_t AccessGPIO = 0x00000002;
50} // namespace attribute
51
52} // namespace types
53
54namespace gpio {
59enum class Mode : uint8_t {
60 Input,
61 Output,
62 Pullup,
63 InputPullup,
64 Pulldown,
65 InputPulldown,
66 OpenDrain,
67 OutputOpenDrain,
68 Analog,
69 // RMT access
70 RmtRX = 0x80,
71 RmtTX,
72 RmtRXTX,
73};
74
79struct adapter_config_t {
80 struct config_t {
81 gpio_num_t gpio_num{};
82 uint32_t tick_ns{};
83 uint8_t mem_blocks{};
84 bool idle_output{};
85 bool idle_level_high{};
86 bool with_dma{};
87 bool loop_enabled{};
88 };
89 Mode mode{}; // Mode
90 config_t rx{}; // For RMT
91 config_t tx{}; // For RMT
92};
93
94#if defined(M5_UNIT_UNIFIED_USING_RMT_V2)
95using m5_rmt_item_t = rmt_symbol_word_t;
96#else
97using m5_rmt_item_t = rmt_item32_t;
98#endif
99
100} // namespace gpio
101
102} // namespace unit
103} // namespace m5
104#endif
Identification of functions to be used.
Top level namespace of M5stack.
Definition test_helper.hpp:18
Type and enumerator definitions.
Unit-related namespace.
unsigned long elapsed_time_t
Elapsed time unit (ms)
Definition types.hpp:42
uint32_t attr_t
Component attribute bits.
Definition types.hpp:41
uint32_t uid_t
Component unique identifier.
Definition types.hpp:40
constexpr attr_t AccessGPIO
GPIO Accessible Unit.
Definition types.hpp:48
constexpr attr_t AccessI2C
I2C Accessible Unit.
Definition types.hpp:47
Mode
Pin mode.
Definition types.hpp:59
category_t
Unit category (used for static class determination)
Definition types.hpp:35
@ UnitLED
Derived from UnitLED.