adafruit / adafruit/Adafruit_CircuitPython_MIDI
Is correct this modification for work in a raspberry Pi?
- Dominant language
- Python
- Stars
- 56
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I use my raspberry Pi B+ for sending data for serial UART port. TX pin
```python
uart = serial.Serial(port='/dev/ttyAMA0', baudrate=31250)
midi = adafruit_midi.MIDI(midi_out= uart, out_channel=0, debug=True)`
```
But this error appear:
```python
File "/home/raspbi/.local/lib/python3.9/site-packages/adafruit_midi/__init__.py", line 171, in _send
self._midi_out.write(packet, num)
TypeError: write() takes 2 positional arguments but 3 were given`
```
Work fine if delete 'num' argument..
Change this
```python
def _send(self, packet, num):
if self._debug:
print("Sending: ", [hex(i) for i in packet[:num]])
self._midi_out.write(packet, num)
```
To
```python
def _send(self, packet, num):
if self._debug:
print("Sending: ", [hex(i) for i in packet[:num]])
self._midi_out.write(packet)
```
It is correct?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with adafruit_midi/__init__.py, especially _send, and compare its _midi_out.write call with the serial.Serial API used by the Raspberry Pi snippet. Reproduce the TypeError with the shown UART configuration and determine which write signature preserves the intended packet handling; the issue is done when the example sends MIDI data without the argument-count error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, raspberry-pi
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100