17
17
#include < libhal-arm-mcu/stm32f1/constants.hpp>
18
18
#include < libhal/adc.hpp>
19
19
#include < libhal/lock.hpp>
20
+ #include < libhal/pointers.hpp>
20
21
#include < libhal/units.hpp>
21
22
22
23
namespace hal ::stm32f1 {
@@ -125,13 +126,14 @@ class adc_manager::channel : public hal::adc
125
126
*/
126
127
template <peripheral id>
127
128
channel (stm32f1::adc<id>& p_adc, adc_pins p_pin)
128
- : channel(p_adc, p_pin)
129
+ : m_manager(&p_adc)
130
+ , m_pin(p_pin)
129
131
{
130
132
}
131
133
channel (channel const & p_other) = delete ;
132
134
channel& operator =(channel const & p_other) = delete ;
133
- channel (channel&& p_other) noexcept = delete ;
134
- channel& operator =(channel&& p_other) noexcept = delete ;
135
+ channel (channel&& p_other) noexcept = default ;
136
+ channel& operator =(channel&& p_other) noexcept = default ;
135
137
~channel () override ;
136
138
137
139
private:
@@ -152,4 +154,18 @@ class adc_manager::channel : public hal::adc
152
154
// / The pin that is used for this channel.
153
155
adc_pins m_pin;
154
156
};
157
+
158
+ template <peripheral id>
159
+ hal::v5::strong_ptr<adc_manager::channel> acquire_adc (
160
+ std::pmr::polymorphic_allocator<> p_allocator,
161
+ stm32f1::adc<id>& p_adc,
162
+ adc_pins p_pin)
163
+ {
164
+ return hal::v5::make_strong_ptr<hal::stm32f1::adc_manager::channel>(
165
+ p_allocator, p_adc, p_pin);
166
+ }
155
167
} // namespace hal::stm32f1
168
+
169
+ namespace hal {
170
+ using hal::stm32f1::acquire_adc;
171
+ }
0 commit comments