Skip to content

Commit

Permalink
Fix how midi data is sent over i2c
Browse files Browse the repository at this point in the history
  • Loading branch information
MBeijer committed Apr 6, 2023
1 parent 6d85617 commit 3b90b22
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/camd-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,21 @@ struct PortInfo pi;

void ActivateXmit(APTR userdata asm("a2"), ULONG portnum asm("d0")) {
ULONG b;
UWORD length = 0;
UBYTE midiData[256];
while ( (b = pi.Transmit(userdata)) != 0x100 ) {
if ((b & 0x00008100) == 0x0000 ) {
UBYTE midiData = b & 0xFF;
ULONG result = SendI2C(iobase, 1, &midiData);
if ((result & 0xFF) != 0 )
break;
midiData[length] = b & 0xFF;
length++;
}

if ((!CAMDv40 && (b & 0x00ff0000) != 0) ||
(b & 0x00008100) != 0 ) {
break;
}
}
if (length > 0)
SendI2C(iobase, length, midiData);
}

struct MidiPortData MidiPortData =
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define NUMPORTS 1

/* Prototypes */
extern APTR Init(struct ExecBase *SysBase asm("a6"));
extern BOOL Init(struct ExecBase *SysBase asm("a6"));

extern void Expunge(void);

Expand Down

0 comments on commit 3b90b22

Please sign in to comment.