@@ -132,3 +132,55 @@ impl InputPin for DummyPin {
132132
133133 fn disconnect_input_from_peripheral ( & mut self , _signal : InputSignal , _: private:: Internal ) { }
134134}
135+
136+ #[ cfg( feature = "embedded-hal-02" ) ]
137+ impl embedded_hal_02:: digital:: v2:: OutputPin for DummyPin {
138+ type Error = core:: convert:: Infallible ;
139+
140+ fn set_high ( & mut self ) -> Result < ( ) , Self :: Error > {
141+ self . set_output_high ( true , private:: Internal ) ;
142+ Ok ( ( ) )
143+ }
144+ fn set_low ( & mut self ) -> Result < ( ) , Self :: Error > {
145+ self . set_output_high ( false , private:: Internal ) ;
146+ Ok ( ( ) )
147+ }
148+ }
149+ #[ cfg( feature = "embedded-hal-02" ) ]
150+ impl embedded_hal_02:: digital:: v2:: StatefulOutputPin for DummyPin {
151+ fn is_set_high ( & self ) -> Result < bool , Self :: Error > {
152+ Ok ( OutputPin :: is_set_high ( self , private:: Internal ) )
153+ }
154+ fn is_set_low ( & self ) -> Result < bool , Self :: Error > {
155+ Ok ( !OutputPin :: is_set_high ( self , private:: Internal ) )
156+ }
157+ }
158+
159+ #[ cfg( feature = "embedded-hal" ) ]
160+ impl embedded_hal:: digital:: ErrorType for DummyPin {
161+ type Error = core:: convert:: Infallible ;
162+ }
163+
164+ #[ cfg( feature = "embedded-hal" ) ]
165+ impl embedded_hal:: digital:: OutputPin for DummyPin {
166+ fn set_low ( & mut self ) -> Result < ( ) , Self :: Error > {
167+ self . set_output_high ( true , private:: Internal ) ;
168+ Ok ( ( ) )
169+ }
170+
171+ fn set_high ( & mut self ) -> Result < ( ) , Self :: Error > {
172+ self . set_output_high ( false , private:: Internal ) ;
173+ Ok ( ( ) )
174+ }
175+ }
176+
177+ #[ cfg( feature = "embedded-hal" ) ]
178+ impl embedded_hal:: digital:: StatefulOutputPin for DummyPin {
179+ fn is_set_high ( & mut self ) -> Result < bool , Self :: Error > {
180+ Ok ( OutputPin :: is_set_high ( self , private:: Internal ) )
181+ }
182+
183+ fn is_set_low ( & mut self ) -> Result < bool , Self :: Error > {
184+ Ok ( !OutputPin :: is_set_high ( self , private:: Internal ) )
185+ }
186+ }
0 commit comments