@@ -114,6 +114,7 @@ def verify_sig(self, chip, verbose=False):
114
114
return False
115
115
return True
116
116
117
+ # pylint: disable=too-many-branches
117
118
def program_file (self , chip , file_name , verbose = False , verify = True ):
118
119
"""
119
120
Perform a chip erase and program from a file that
@@ -243,25 +244,22 @@ def read_fuses(self, chip):
243
244
self .end ()
244
245
return (low , high , ext , lock )
245
246
246
- # pylint: disable=unused-argument,expression-not-assigned
247
+ # pylint: disable=unused-argument,too-many-arguments
247
248
def write_fuses (self , chip , low = None , high = None , ext = None , lock = None ):
248
249
"""
249
250
Write any of the 4 fuses. If the kwarg low/high/ext/lock is not
250
251
passed in or is None, that fuse is skipped
251
252
"""
253
+ transaction_comp = (0xE0 , 0xA0 , 0xA8 , 0xA4 )
254
+ fuses = (lock , low , high , ext )
252
255
self .begin (clock = _SLOW_CLOCK )
253
- lock and self ._transaction ((0xAC , 0xE0 , 0 , lock ))
254
- self ._busy_wait ()
255
- low and self ._transaction ((0xAC , 0xA0 , 0 , low ))
256
- self ._busy_wait ()
257
- high and self ._transaction ((0xAC , 0xA8 , 0 , high ))
258
- self ._busy_wait ()
259
- ext and self ._transaction ((0xAC , 0xA4 , 0 , ext ))
260
- self ._busy_wait ()
256
+ for fuse , comp in zip (fuses , transaction_comp ):
257
+ if fuse :
258
+ self ._transaction ((0xAC , comp , 0 , fuse ))
259
+ self ._busy_wait ()
261
260
self .end ()
262
261
263
- # pylint: enable=unused-argument,expression-not-assigned
264
-
262
+ # pylint: disable=too-many-arguments
265
263
def verify_fuses (self , chip , low = None , high = None , ext = None , lock = None ):
266
264
"""
267
265
Verify the 4 fuses. If the kwarg low/high/ext/lock is not
0 commit comments