M5UnitUnified 0.1.2 git rev:98f967c
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
31using uid_t = uint32_t;
32using attr_t = uint32_t;
33using elapsed_time_t = unsigned long;
34
35namespace attribute {
38constexpr attr_t AccessI2C = 0x00000001;
39constexpr attr_t AccessGPIO = 0x00000002;
41} // namespace attribute
42
43} // namespace types
44
45namespace gpio {
50enum class Mode : uint8_t {
51 Input,
52 Output,
53 Pullup,
54 InputPullup,
55 Pulldown,
56 InputPulldown,
57 OpenDrain,
58 OutputOpenDrain,
59 Analog,
60 // RMT access
61 RmtRX = 0x80,
62 RmtTX,
63 RmtRXTX,
64};
65
70struct adapter_config_t {
71 struct config_t {
72 gpio_num_t gpio_num{};
73 uint32_t tick_ns{};
74 uint8_t mem_blocks{};
75 bool idle_output{};
76 bool idle_level_high{};
77 bool with_dma{};
78 bool loop_enabled{};
79 };
80 Mode mode{}; // Mode
81 config_t rx{}; // For RMT
82 config_t tx{}; // For RMT
83};
84
85#if defined(M5_UNIT_UNIFIED_USING_RMT_V2)
86using m5_rmt_item_t = rmt_symbol_word_t;
87#else
88using m5_rmt_item_t = rmt_item32_t;
89#endif
90
91} // namespace gpio
92
93} // namespace unit
94} // namespace m5
95#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:33
uint32_t attr_t
Component attribute bits.
Definition types.hpp:32
uint32_t uid_t
Component unique identifier.
Definition types.hpp:31
constexpr attr_t AccessGPIO
GPIO Accessible Unit.
Definition types.hpp:39
constexpr attr_t AccessI2C
I2C Accessible Unit.
Definition types.hpp:38
Mode
Pin mode.
Definition types.hpp:50