@@ -130,7 +130,7 @@ def writeto(
130
130
buffer : ReadableBuffer ,
131
131
* ,
132
132
start : int = 0 ,
133
- end : Optional [int ] = None
133
+ end : Optional [int ] = None ,
134
134
) -> None :
135
135
"""Write data from the buffer to an address"""
136
136
if end is None :
@@ -144,7 +144,7 @@ def readfrom_into(
144
144
buffer : WriteableBuffer ,
145
145
* ,
146
146
start : int = 0 ,
147
- end : Optional [int ] = None
147
+ end : Optional [int ] = None ,
148
148
) -> None :
149
149
"""Read data from an address and into the buffer"""
150
150
if end is None :
@@ -164,7 +164,7 @@ def writeto_then_readfrom(
164
164
out_start : int = 0 ,
165
165
out_end : Optional [int ] = None ,
166
166
in_start : int = 0 ,
167
- in_end : Optional [int ] = None
167
+ in_end : Optional [int ] = None ,
168
168
) -> None :
169
169
"""Write data from buffer_out to an address and then
170
170
read data from an address and into buffer_in
@@ -279,7 +279,8 @@ def _probe(self, address: int) -> bool:
279
279
def _write (self , address : int , buffer : ReadableBuffer , transmit_stop : bool ) -> None :
280
280
self ._start ()
281
281
if not self ._write_byte (address << 1 ):
282
- raise RuntimeError ("Device not responding at 0x{:02X}" .format (address ))
282
+ # raise RuntimeError("Device not responding at 0x{:02X}".format(address))
283
+ raise RuntimeError (f"Device not responding at 0x{ address :02X} " )
283
284
for byte in buffer :
284
285
self ._write_byte (byte )
285
286
if transmit_stop :
@@ -288,7 +289,8 @@ def _write(self, address: int, buffer: ReadableBuffer, transmit_stop: bool) -> N
288
289
def _read (self , address : int , length : int ) -> bytearray :
289
290
self ._start ()
290
291
if not self ._write_byte (address << 1 | 1 ):
291
- raise RuntimeError ("Device not responding at 0x{:02X}" .format (address ))
292
+ # raise RuntimeError("Device not responding at 0x{:02X}".format(address))
293
+ raise RuntimeError (f"Device not responding at 0x{ address :02X} " )
292
294
buffer = bytearray (length )
293
295
for byte_position in range (length ):
294
296
buffer [byte_position ] = self ._read_byte (ack = (byte_position != length - 1 ))
@@ -344,7 +346,7 @@ def configure(
344
346
baudrate : int = 100000 ,
345
347
polarity : Literal [0 , 1 ] = 0 ,
346
348
phase : Literal [0 , 1 ] = 0 ,
347
- bits : int = 8
349
+ bits : int = 8 ,
348
350
) -> None :
349
351
"""Configures the SPI bus. Only valid when locked."""
350
352
if self ._check_lock ():
@@ -464,7 +466,7 @@ def write_readinto(
464
466
out_start : int = 0 ,
465
467
out_end : Optional [int ] = None ,
466
468
in_start : int = 0 ,
467
- in_end : Optional [int ] = None
469
+ in_end : Optional [int ] = None ,
468
470
) -> None :
469
471
"""Write out the data in buffer_out while simultaneously reading data into buffer_in.
470
472
The lengths of the slices defined by buffer_out[out_start:out_end] and
0 commit comments