Skip to content

Commit ef0bb22

Browse files
committed
Fixing CP-isnt-CPython bug
1 parent 9760246 commit ef0bb22

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

adafruit_mcp4728.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,11 @@ def _set_value(self, channel):
186186
write_command_byte = 0b01000000 # 0 1 0 0 0 DAC1 DAC0 UDAC
187187
write_command_byte |= (channel.channel_index<<1)
188188

189-
channel_bytes.insert(0, write_command_byte)
189+
output_buffer = bytearray([write_command_byte])
190+
output_buffer.extend(channel_bytes)
190191

191192
with self.i2c_device as i2c:
192-
i2c.write(bytearray(channel_bytes))
193+
i2c.write(output_buffer)
193194

194195
@staticmethod
195196
def _generate_bytes_with_flags(channel):

0 commit comments

Comments
 (0)