@@ -94,15 +94,15 @@ def value(self, val=None):
94
94
def __repr__ (self ):
95
95
return str (self .pin_id )
96
96
97
- @ staticmethod
97
+ # pylint: disable = too-few-public-methods
98
98
class DriveMode ():
99
99
"""DriveMode Enum."""
100
100
PUSH_PULL = None
101
101
OPEN_DRAIN = None
102
102
DriveMode .PUSH_PULL = DriveMode ()
103
103
DriveMode .OPEN_DRAIN = DriveMode ()
104
104
105
- @ staticmethod
105
+
106
106
class Direction ():
107
107
"""DriveMode Enum."""
108
108
INPUT = None
@@ -118,6 +118,7 @@ class DigitalInOut():
118
118
:param int pin: Valid ESP32 GPIO Pin, predefined in ESP32_GPIO_PINS.
119
119
"""
120
120
_pin = None
121
+ #pylint: disable = attribute-defined-outside-init
121
122
def __init__ (self , esp , pin ):
122
123
self ._esp = esp
123
124
self ._pin = Pin (pin , self ._esp )
@@ -138,9 +139,9 @@ def switch_to_output(self, value=False, drive_mode=DriveMode.PUSH_PULL):
138
139
:param bool value: Default mode to set upon switching.
139
140
:param DriveMode drive_mode: Drive mode for the output.
140
141
"""
141
- self .direction = Direction .OUTPUT
142
- self .value = value
142
+ self ._direction = Direction .OUTPUT
143
143
self ._drive_mode = drive_mode
144
+ self .value = value
144
145
145
146
def switch_to_input (self , pull = None ):
146
147
"""Sets the pull and then switch to read in digital values.
@@ -189,7 +190,7 @@ def value(self, val):
189
190
def drive_mode (self ):
190
191
"""Returns pin drive mode."""
191
192
if self .direction is Direction .OUTPUT :
192
- return self .__drive_mode
193
+ return self ._drive_mode
193
194
raise AttributeError ("Not an output" )
194
195
195
196
@drive_mode .setter
@@ -200,6 +201,6 @@ def drive_mode(self, mode):
200
201
"""
201
202
self .__drive_mode = mode
202
203
if mode is DriveMode .OPEN_DRAIN :
203
- self . _pin . init ( mode = Pin . OPEN_DRAIN )
204
+ raise NotImplementedError ( 'Drive mode %s not implemented in ESP32SPI.' % mode )
204
205
elif mode is DriveMode .PUSH_PULL :
205
206
self ._pin .init (mode = Pin .OUT )
0 commit comments