1717#include < algorithm>
1818
1919#include " software_port.hpp"
20- #include " gpio_accessor .hpp"
20+ #include " runtime_gpio .hpp"
2121
2222namespace modm ::platform
2323{
@@ -37,7 +37,7 @@ namespace modm::platform
3737*
3838* Port port;
3939* // set pin C8
40- * GpioAccessor pin = port[0];
40+ * RtGpio pin = port[0];
4141* pin.set();
4242*
4343* auto reversedPins = port | std::views::reverse;
@@ -56,10 +56,10 @@ class RandomAccessPort : public SoftwareGpioPort<Gpios...>
5656{
5757public:
5858 using Index = int_fast8_t ;
59- static constexpr inline size_t Size{sizeof ...(Gpios)};
59+ static constexpr size_t Size{sizeof ...(Gpios)};
6060
6161private:
62- static constexpr inline std::array<GpioAccessor , Size> GpioPins = [](){
62+ static constexpr std::array<RtGpio , Size> gpioPins = [](){
6363 auto gpios = makeGpioArray<Gpios...>();
6464 // Reverse pin order to match SoftwareGpioPort indexing
6565 std::reverse (gpios.begin (), gpios.end ());
@@ -77,53 +77,53 @@ class RandomAccessPort : public SoftwareGpioPort<Gpios...>
7777 public:
7878 using iterator_category = std::random_access_iterator_tag;
7979 using difference_type = Index;
80- using value_type = GpioAccessor ;
81- using reference = const GpioAccessor &;
80+ using value_type = RtGpio ;
81+ using reference = RtGpio &;
8282
8383 constexpr GpioIterator () = default;
8484 constexpr explicit GpioIterator (Index index) : index_{index}
8585 {}
8686
87- constexpr inline GpioIterator&
87+ constexpr GpioIterator&
8888 operator +=(difference_type diff) { index_ += diff; return *this ; }
8989
90- constexpr inline GpioIterator&
90+ constexpr GpioIterator&
9191 operator -=(difference_type diff) { index_ -= diff; return *this ; }
9292
93- constexpr inline reference
94- operator *() const { return RandomAccessPort::GpioPins [index_]; }
93+ constexpr reference
94+ operator *() const { return RandomAccessPort::gpioPins [index_]; }
9595
96- constexpr inline reference
97- operator [](difference_type diff) const { return RandomAccessPort::GpioPins [index_ + diff]; }
96+ constexpr reference
97+ operator [](difference_type diff) const { return RandomAccessPort::gpioPins [index_ + diff]; }
9898
99- constexpr inline GpioIterator&
99+ constexpr GpioIterator&
100100 operator ++() { ++index_; return *this ; }
101101
102- constexpr inline GpioIterator&
102+ constexpr GpioIterator&
103103 operator --() { --index_; return *this ; }
104104
105- constexpr inline GpioIterator
105+ constexpr GpioIterator
106106 operator ++(int ) { GpioIterator tmp{*this }; ++index_; return tmp; }
107107
108- constexpr inline GpioIterator
108+ constexpr GpioIterator
109109 operator --(int ) { GpioIterator tmp{*this }; --index_; return tmp; }
110110
111- constexpr inline difference_type
111+ constexpr difference_type
112112 operator -(const GpioIterator& rhs) const { return index_ - rhs.index_ ; }
113113
114- constexpr inline GpioIterator
114+ constexpr GpioIterator
115115 operator +(difference_type diff) const { return GpioIterator{index_ + diff}; }
116116
117- constexpr inline GpioIterator
117+ constexpr GpioIterator
118118 operator -(difference_type diff) const { return GpioIterator{index_ - diff}; }
119119
120- friend constexpr inline GpioIterator
120+ friend constexpr GpioIterator
121121 operator +(difference_type lhs, const GpioIterator& rhs) { return GpioIterator{lhs + rhs.index_ }; }
122122
123- friend constexpr inline GpioIterator
123+ friend constexpr GpioIterator
124124 operator -(difference_type lhs, const GpioIterator& rhs) { return GpioIterator{lhs - rhs.index_ }; }
125125
126- constexpr inline auto
126+ constexpr auto
127127 operator <=>(const GpioIterator& rhs) const = default ;
128128 };
129129 static_assert (std::random_access_iterator<GpioIterator>);
@@ -134,40 +134,40 @@ class RandomAccessPort : public SoftwareGpioPort<Gpios...>
134134 constexpr GpioIterator
135135 end () const { return GpioIterator{Size}; }
136136
137- constexpr const GpioAccessor &
137+ constexpr const RtGpio &
138138 operator [](Index index) const
139139 {
140- return GpioPins [index];
140+ return gpioPins [index];
141141 }
142142
143143 static void set (Index index, bool enable)
144144 {
145- GpioPins [index].set (enable);
145+ gpioPins [index].set (enable);
146146 }
147147
148148 static void set (Index index)
149149 {
150- GpioPins [index].set ();
150+ gpioPins [index].set ();
151151 }
152152
153153 static void reset (Index index)
154154 {
155- GpioPins [index].reset ();
155+ gpioPins [index].reset ();
156156 }
157157
158158 static void toggle (Index index)
159159 {
160- GpioPins [index].toggle ();
160+ gpioPins [index].toggle ();
161161 }
162162
163163 static bool read (Index index)
164164 {
165- return GpioPins [index].read ();
165+ return gpioPins [index].read ();
166166 }
167167
168168 static bool isSet (Index index)
169169 {
170- return GpioPins [index].isSet ();
170+ return gpioPins [index].isSet ();
171171 }
172172};
173173
0 commit comments