1. Gordon McGregor
  2. faux_vox

Commits

Gordon McGregor  committed 74785e3

midi sender enforces protocol format

  • Participants
  • Parent commits 2b3a22d
  • Branches default

Comments (0)

Files changed (3)

File bank_types.h

View file
  • Ignore whitespace
 const int MAX_SWITCHES = 4;
 const int MAX_STATES = 2;
 const int MIDI_MESSAGE_LENGTH = 3;
+const int MIDI_DEVICE_ID = 0x78;
 
+const int MIDI_BAUD_RATE=31250;
+const int FASTEST_BAUD_RATE=115200;
+
+const int MIDI_SYSEX_LENGTH = 5;
+
+const int ERROR_LED = 6;
+
+enum {OFF=0, INFO, DEBUG, TRACE} debug_levels_e;
 typedef enum {STATE0=0, STATE1=1} switch_state_e;
 
+const int DEBUG_LEVEL = OFF;
 typedef struct {
   int toggle_not_immediate;
   switch_state_e state;

File faux_vox.pde

View file
  • Ignore whitespace
 #include "EEPROMAnything.h"
 #include "bank_types.h"
 
-enum {OFF=0, INFO, DEBUG, TRACE} debug_levels;
-
-const int MIDI_DEVICE_ID = 0x78;
-const int MIDI_SYSEX_LENGTH = 5;
-
-const int DEBUG_LEVEL = OFF;
-
-const int ERROR_LED = 6;
-
 int previous_index, current_bank;
 
 banks_t banks;
 
 void setup() {
   if (DEBUG_LEVEL != OFF) {
-    Serial.begin(115200);
+    Serial.begin(FASTEST_BAUD_RATE);
   } else {
-    Serial.begin(31250); 
+    Serial.begin(MIDI_BAUD_RATE); 
     MIDI.begin(MIDI_CHANNEL_OMNI);
     MIDI.setHandleSystemExclusive(handle_system_exclusive_midi);
     MIDI.setHandleSystemReset(handle_system_reset_midi);
 
   for(int i=0; i < MIDI_MESSAGE_LENGTH; i++) {
     send_byte(message[i]);
-  }
+  
   
 //  
 //    if(i==0 && (message[0] < 128)) {
 //    }
 //  }
 }
+}
 
 void send_byte(byte b) {
   if (DEBUG_LEVEL == OFF) {

File midi_tester.py

View file
  • Ignore whitespace
   a = Arduino('/dev/tty.usbmodem24371', 31250)
 
   cnt = 0
+  command= "foo"
 
-  while (1):
+  while (ord(command[1]) != 0xf):
     command = a.read(3)
     print hex(ord(command[0])), hex(ord(command[1])), hex(ord(command[2]))
     if(cnt == 0):