@@ -54,7 +54,12 @@ class EEPROM:
54
54
Must be a ``DigitalInOut`` object.
55
55
"""
56
56
57
- def __init__ (self , max_size : int , write_protect : bool = False , wp_pin : Optional [DigitalInOut ] = None ) -> None :
57
+ def __init__ (
58
+ self ,
59
+ max_size : int ,
60
+ write_protect : bool = False ,
61
+ wp_pin : Optional [DigitalInOut ] = None ,
62
+ ) -> None :
58
63
self ._max_size = max_size
59
64
self ._wp = write_protect
60
65
self ._wraparound = False
@@ -97,7 +102,7 @@ def write_protected(self) -> bool:
97
102
def __len__ (self ) -> int :
98
103
"""The size of the current EEPROM chip. This is one more than the highest
99
104
address location that can be read or written to.
100
-
105
+
101
106
.. code-block:: python
102
107
103
108
eeprom = adafruit_24lc32.EEPROM_I2C()
@@ -148,7 +153,9 @@ def __getitem__(self, address: Union[int, slice]) -> bytearray:
148
153
149
154
return read_buffer
150
155
151
- def __setitem__ (self , address : Union [int , slice ], value : Union [int , Sequence [int ]]) -> None :
156
+ def __setitem__ (
157
+ self , address : Union [int , slice ], value : Union [int , Sequence [int ]]
158
+ ) -> None :
152
159
"""Write the value at the given starting index.
153
160
154
161
.. code-block:: python
@@ -200,7 +207,9 @@ def _read_address(self, address: int, read_buffer: bytearray) -> bytearray:
200
207
# Implemented by subclass
201
208
raise NotImplementedError
202
209
203
- def _write (self , start_address : int , data : Union [int , Sequence [int ]], wraparound : bool ) -> None :
210
+ def _write (
211
+ self , start_address : int , data : Union [int , Sequence [int ]], wraparound : bool
212
+ ) -> None :
204
213
# Implemened by subclass
205
214
raise NotImplementedError
206
215
@@ -217,7 +226,13 @@ class EEPROM_I2C(EEPROM):
217
226
"""
218
227
219
228
# pylint: disable=too-many-arguments
220
- def __init__ (self , i2c_bus : I2C , address : int = 0x50 , write_protect : bool = False , wp_pin : Optional [DigitalInOut ] = None ) -> None :
229
+ def __init__ (
230
+ self ,
231
+ i2c_bus : I2C ,
232
+ address : int = 0x50 ,
233
+ write_protect : bool = False ,
234
+ wp_pin : Optional [DigitalInOut ] = None ,
235
+ ) -> None :
221
236
from adafruit_bus_device .i2c_device import ( # pylint: disable=import-outside-toplevel
222
237
I2CDevice as i2cdev ,
223
238
)
@@ -233,7 +248,12 @@ def _read_address(self, address: int, read_buffer: bytearray) -> bytearray:
233
248
i2c .write_then_readinto (write_buffer , read_buffer )
234
249
return read_buffer
235
250
236
- def _write (self , start_address : int , data : Union [int , Sequence [int ]], wraparound : bool = False ) -> None :
251
+ def _write (
252
+ self ,
253
+ start_address : int ,
254
+ data : Union [int , Sequence [int ]],
255
+ wraparound : bool = False ,
256
+ ) -> None :
237
257
# Decided against using the chip's "Page Write", since that would require
238
258
# doubling the memory usage by creating a buffer that includes the passed
239
259
# in data so that it can be sent all in one `i2c.write`. The single-write
0 commit comments