Skip to content

Commit a764c70

Browse files
author
Kevin J Walters
committed
Replacing MIDI.send() use of bytes(object) with object.__bytes__() due to a peculiar micropython-ism.
Leaving test cases for now - these do not (currently) execute in CircuitPython. #3 #9
1 parent 5cd820d commit a764c70

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

adafruit_midi/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ def send(self, msg, channel=None):
164164
channel = self.out_channel
165165
if isinstance(msg, MIDIMessage):
166166
msg.channel = channel
167-
data = bytes(msg)
167+
data = msg.__bytes__() # bytes(object) does not work in uPy
168168
else:
169169
data = bytearray()
170170
for each_msg in msg:
171171
each_msg.channel = channel
172-
data.extend(bytes(each_msg))
172+
data.extend(each_msg.__bytes__())
173173

174174
self._send(data, len(data))
175175

0 commit comments

Comments
 (0)