M5UnitUnified 0.0.2 git rev:a353e8c
Loading...
Searching...
No Matches
M5UnitUnified.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
3 *
4 * SPDX-License-Identifier: MIT
5 */
16#ifndef M5_UNIT_UNIFIED_HPP
17#define M5_UNIT_UNIFIED_HPP
18
19#include <M5UnitComponent.hpp>
20#include <M5HAL.hpp>
21#include <vector>
22#include <string>
23
24class TwoWire;
25
30namespace m5 {
35namespace unit {
36class Component;
37
43public:
44 using container_type = std::vector<Component*>;
45
49 UnitUnified() = default;
50 UnitUnified(const UnitUnified&) = delete;
51 UnitUnified(UnitUnified&&) noexcept = default;
53
57 UnitUnified& operator=(const UnitUnified&) = delete;
58
59 UnitUnified& operator=(UnitUnified&&) noexcept = default;
61
64 // bool add(Component& u, Port& port);
65 bool add(Component& u, m5::hal::bus::Bus* bus);
66 // [[deprecated("use add(Component& u, Port& port) or add(Component& u,
67 // m5::hal::bus::Bus* bus);")]]
68 bool add(Component& u, TwoWire& wire);
70
72 bool begin();
74 void update(const bool force = false);
75
77 std::string debugInfo() const;
78
79protected:
80 bool add_children(Component& u);
81 bool add(Component& u, m5::unit::Adapter* a);
82
83 std::string make_unit_info(const Component* u, const uint8_t indent = 0) const;
84
85protected:
86 container_type _units{};
87
88private:
89 static uint32_t _registerCount;
90};
91
92} // namespace unit
93} // namespace m5
94
95#endif
Main header of M5UnitComponent.
Adapters to treat M5HAL and TwoWire in the same way.
Definition adapter.hpp:28
Base class of unit component.
Definition M5UnitComponent.hpp:38
For managing and leading units.
Definition M5UnitUnified.hpp:42
std::string debugInfo() const
Output information for debug.
Definition M5UnitUnified.cpp:125
bool begin()
Begin of all units under management.
Definition M5UnitUnified.cpp:102
void update(const bool force=false)
Update of all units under management.
Definition M5UnitUnified.cpp:115
Top level namespace of M5stack.
Definition test_helper.hpp:18
Unit-related namespace.