@@ -69,7 +69,12 @@ class FRAM:
69
69
Must be a ``DigitalInOut`` object.
70
70
"""
71
71
72
- def __init__ (self , max_size : int , write_protect : bool = False , wp_pin : Optional [DigitalInOut ] = None ) -> None :
72
+ def __init__ (
73
+ self ,
74
+ max_size : int ,
75
+ write_protect : bool = False ,
76
+ wp_pin : Optional [DigitalInOut ] = None ,
77
+ ) -> None :
73
78
self ._max_size = max_size
74
79
self ._wp = write_protect
75
80
self ._wraparound = False
@@ -219,7 +224,9 @@ def _read_address(self, address: int, read_buffer: bytearray) -> bytearray:
219
224
# Implemented by subclass
220
225
raise NotImplementedError
221
226
222
- def _write (self , start_address : int , data : Union [int , Sequence [int ]], wraparound : bool ) -> None :
227
+ def _write (
228
+ self , start_address : int , data : Union [int , Sequence [int ]], wraparound : bool
229
+ ) -> None :
223
230
# Implemened by subclass
224
231
raise NotImplementedError
225
232
@@ -236,7 +243,13 @@ class FRAM_I2C(FRAM):
236
243
"""
237
244
238
245
# pylint: disable=too-many-arguments
239
- def __init__ (self , i2c_bus : I2C , address : int = 0x50 , write_protect : bool = False , wp_pin : Optional [DigitalInOut ] = None ) -> None :
246
+ def __init__ (
247
+ self ,
248
+ i2c_bus : I2C ,
249
+ address : int = 0x50 ,
250
+ write_protect : bool = False ,
251
+ wp_pin : Optional [DigitalInOut ] = None ,
252
+ ) -> None :
240
253
from adafruit_bus_device .i2c_device import ( # pylint: disable=import-outside-toplevel
241
254
I2CDevice as i2cdev ,
242
255
)
@@ -261,7 +274,12 @@ def _read_address(self, address: int, read_buffer: bytearray) -> bytearray:
261
274
i2c .write_then_readinto (write_buffer , read_buffer )
262
275
return read_buffer
263
276
264
- def _write (self , start_address : int , data : Union [int , Sequence [int ]], wraparound : bool = False ) -> None :
277
+ def _write (
278
+ self ,
279
+ start_address : int ,
280
+ data : Union [int , Sequence [int ]],
281
+ wraparound : bool = False ,
282
+ ) -> None :
265
283
# Decided against using the chip's "Page Write", since that would require
266
284
# doubling the memory usage by creating a buffer that includes the passed
267
285
# in data so that it can be sent all in one `i2c.write`. The single-write
@@ -359,7 +377,12 @@ def _read_address(self, address: int, read_buffer: bytearray) -> bytearray:
359
377
spi .readinto (read_buffer )
360
378
return read_buffer
361
379
362
- def _write (self , start_address : int , data : Union [int , Sequence [int ]], wraparound : bool = False ) -> None :
380
+ def _write (
381
+ self ,
382
+ start_address : int ,
383
+ data : Union [int , Sequence [int ]],
384
+ wraparound : bool = False ,
385
+ ) -> None :
363
386
buffer = bytearray (4 )
364
387
if not isinstance (data , int ):
365
388
data_length = len (data )
0 commit comments