11import typing
22
3- class GPIO :
3+ class GPIO ( typing . Protocol ) :
44 def __init__ (self , pin_name : str ):
55 pass
66
7- class ButtonPin (GPIO ):
7+ class ButtonPin (GPIO , typing . Protocol ):
88 def __init__ (self , pin_name : str ):
99 super ().__init__ (pin_name )
1010
@@ -15,15 +15,15 @@ def value(self) -> bool:
1515 def on_level_changed (self , callback : typing .Callable [[bool ], None ]) -> None :
1616 raise NotImplementedError ()
1717
18- class AnalogInputPin (GPIO ):
18+ class AnalogInputPin (GPIO , typing . Protocol ):
1919 def __init__ (self , pin_name : str ):
2020 super ().__init__ (pin_name )
2121
2222 @property
2323 def value (self ) -> float :
2424 raise NotImplementedError ()
2525
26- class DigitalOutputPin (GPIO ):
26+ class DigitalOutputPin (GPIO , typing . Protocol ):
2727 def __init__ (self , pin_name : str ):
2828 super ().__init__ (pin_name )
2929
@@ -40,7 +40,7 @@ def is_pwm(self):
4040 return False
4141
4242
43- class PWMPin (GPIO ):
43+ class PWMPin (GPIO , typing . Protocol ):
4444 def __init__ (self , pin_name : str ):
4545 super ().__init__ (pin_name )
4646
0 commit comments