@@ -152,9 +152,7 @@ def enable(self) -> None:
152
152
"""Enable this channel"""
153
153
config = self ._device ._read_register (CONFIGURATION , 2 )
154
154
config_value = (config [0 ] << 8 ) | config [1 ]
155
- config_value |= 1 << (
156
- 14 - self ._channel
157
- ) # Set the bit for the specific channel
155
+ config_value |= 1 << (14 - self ._channel ) # Set the bit for the specific channel
158
156
high_byte = (config_value >> 8 ) & 0xFF
159
157
low_byte = config_value & 0xFF
160
158
self ._device ._write_register (CONFIGURATION , bytes ([high_byte , low_byte ]))
@@ -242,9 +240,7 @@ def warning_alert_threshold(self, current: float) -> None:
242
240
class INA3221 :
243
241
"""Driver for the INA3221 device with three channels."""
244
242
245
- def __init__ (
246
- self , i2c , address : int = DEFAULT_ADDRESS , enable : List = [0 , 1 , 2 ]
247
- ) -> None :
243
+ def __init__ (self , i2c , address : int = DEFAULT_ADDRESS , enable : List = [0 , 1 , 2 ]) -> None :
248
244
"""Initializes the INA3221 class over I2C
249
245
Args:
250
246
i2c (I2C): The I2C bus to which the INA3221 is connected.
@@ -253,9 +249,7 @@ def __init__(
253
249
self .i2c_dev = I2CDevice (i2c , address )
254
250
self .reset ()
255
251
256
- self .channels : List [INA3221Channel ] = [
257
- INA3221Channel (self , i ) for i in range (3 )
258
- ]
252
+ self .channels : List [INA3221Channel ] = [INA3221Channel (self , i ) for i in range (3 )]
259
253
for i in enable :
260
254
self .channels [i ].enable ()
261
255
self .mode : int = MODE .SHUNT_BUS_CONT
@@ -439,9 +433,7 @@ def summation_channels(self) -> tuple:
439
433
@summation_channels .setter
440
434
def summation_channels (self , channels : tuple ) -> None :
441
435
if len (channels ) != 3 :
442
- raise ValueError (
443
- "Must pass a tuple of three boolean values (ch1, ch2, ch3)"
444
- )
436
+ raise ValueError ("Must pass a tuple of three boolean values (ch1, ch2, ch3)" )
445
437
ch1 , ch2 , ch3 = channels
446
438
scc_value = (ch1 << 2 ) | (ch2 << 1 ) | (ch3 << 0 )
447
439
result = self ._read_register (MASK_ENABLE , 2 )
0 commit comments