Commit 6ffcefef authored by philip's avatar philip
Browse files

?

parent ca7a911f
......@@ -39,20 +39,44 @@ HostId | 2-4 | Which ID is used as part of hostname? |
Forward X to Y | 9 | Enable forwarding of messages from USB/MIDI/NET to USB/MIDI/NET (incl. echo) |
## Pinout
Pin | Description
--- | ---
D11 (PB5) | Motor 1
D10 (PD14)| Motor 2
D9 (PD15) | Motor 3
D6 (PE9) | Motor 4
D5 (PE9) | Motor 5
D3 (PE13) | Motor 6
D36 (PB10)| Motor 7
D35 (PB11)| Motor 8
D33 (PB0) | Reserve
D32 (PA0) | Reserve
## Pin Assignment
Pin | Function | Description | Connector
--- | --- | --- | ---
D11 (PB5) | PWM | Motor 1 | CN7
D10 (PD14)| PWM | Motor 2
D9 (PD15) | PWM | Motor 3
D6 (PE9) | PWM | Motor 4 | CN10
D5 (PE9) | PWM | Motor 5
D3 (PE13) | PWM | Motor 6
D36 (PB10)| PWM | Motor 7
D35 (PB11)| PWM | Motor 8
D33 (PB0) | PWM | *Reserve*
D32 (PA0) | PWM | *Reserve*
|
|
D43 (PC8) | GPIO IN | MIDI Channel Select 1 | CN8
D44 (PC9) | GPIO IN | MIDI Channel Select 2
D45 (PC10)| GPIO IN | MIDI Channel Select 3
D46 (PC11)| GPIO IN | MIDI Channel Select 4
D47 (PC12)| GPIO IN | Hostname ID 1
D48 (PD2) | GPIO IN | Hostname ID 2
D49 (PG2) | GPIO IN | Hostname ID 3
D50 (PG3) | GPIO IN | Hostname ID 4
D51 (PD7) | GPIO IN | USB to MIDI | CN9
D52 (PD6) | GPIO IN | USB to NET
D53 (PD5) | GPIO IN | MIDI to USB
D54 (PD4) | GPIO IN | MIDI to NET
D55 (PD3) | GPIO IN | NET to USB
D56 (PD2) | GPIO IN | NET to MIDI
A0 (PA3) | GPIO OUT | LED PWR
A1 (PC0) | GPIO OUT | LED MIDI RX
A2 (PC3) | GPIO OUT | LED MIDI TX
A3 (PB1) | GPIO OUT | LED USB Connected
A4 (PC2) | GPIO OUT | LED USB TX
A5 (PF10)| GPIO OUT | LED NET
## Installation / Flashing
......
......@@ -47,7 +47,7 @@
#define USB_POWER_PIN PA_9
#define USB_CONNECTED_LED LED1
#define USB_CONNECTED_LED A3 //LED1
// default value
#define USBMIDI_FORWARD_TO_MIDI true
......
Subproject commit a68c8ff060cc5aa8ad8b1a0182dc69d85805425f
Subproject commit 0c386bda03595523a0b1e734a4c9cd750fdb5af7
......@@ -23,6 +23,7 @@
#include "midimessage/midimessage.h"
#include "midimessage/simpleparser.h"
#include "midimessage/packers.h"
/************ TYPES ************/
......@@ -322,7 +323,7 @@ void controller_handle_msg(uint8_t * buffer, size_t length, Source source)
if (msg.type() == MIDIMessage::ControlChangeType){
// TO BE DEFINED
printf("channel %d\n",get_channel());
// printf("channel %d\n",get_channel());
// example
if (msg.channel() == get_channel()){
......@@ -338,15 +339,15 @@ void controller_handle_msg(uint8_t * buffer, size_t length, Source source)
}
// each channel controls a motor starting from channel_offset
// if (msg.type() == MIDIMessage::PitchWheelType){
// int32_t motori = msg.channel() - get_channel();
if (msg.type() == MIDIMessage::PitchWheelType){
int32_t motori = msg.channel();
// if (0 <= motori && motori < MOTOR_COUNT){
// float pos = s14_to_pos(msg.pitch());
// motors[motori] = pos;
// }
if (0 <= motori && motori < MOTOR_COUNT){
float pos = s14_to_pos(msg.pitch());
motors[motori] = pos;
}
// }
}
#endif //ENABLE_CONTROLLER_LOGIC == 1
......@@ -384,7 +385,75 @@ void controller_handle_msg(uint8_t * buffer, size_t length, Source source)
void controller_handle_nrpn(uint8_t channel, MidiMessage::NRpnType_t type, MidiMessage::NRpnAction_t action, uint16_t controller, uint16_t value, Source source)
{
// TO BE DEFINED
#if ENABLE_CONTROLLER_LOGIC == 1
if (type == MidiMessage::NRpnTypeNRPN && channel == get_channel() && action == MidiMessage::NRpnActionValue){
int32_t motori = controller - CONTROLLER_OFFSET;
// printf("controller %d\n", motori);
if (0 <= motori && motori < MOTOR_COUNT){
float pos = u14_to_pos(value);
// printf("motor[%d] = %d\n", motori, (int)(pos*100));
motors[motori] = pos;
}
}
#endif //ENABLE_CONTROLLER_LOGIC == 1
uint8_t buffer[12];
uint8_t length = 0;
if (type == MidiMessage::NRpnTypeNRPN){
if (action == MidiMessage::NRpnActionValue){
length = MidiMessage::packNrpnValue(buffer, channel, controller, value, false);
} else if (action == MidiMessage::NRpnActionIncrement){
length = MidiMessage::packNrpnIncrement(buffer, channel, controller, value, false);
} else if (action == MidiMessage::NRpnActionDecrement){
length = MidiMessage::packNrpnDecrement(buffer, channel, controller, value, false);
}
} else { // RPN
if (action == MidiMessage::NRpnActionValue){
length = MidiMessage::packRpnValue(buffer, channel, controller, value, false);
} else if (action == MidiMessage::NRpnActionIncrement){
length = MidiMessage::packRpnIncrement(buffer, channel, controller, value, false);
} else if (action == MidiMessage::NRpnActionDecrement){
length = MidiMessage::packRpnDecrement(buffer, channel, controller, value, false);
}
}
if (length == 0){
return;
}
#if USE_USBMIDI
if (source == SourceUsb){
if (usb_to_midi){
midi_tx(buffer, length);
}
if (usb_to_net){
netmidi_tx(buffer, length);
}
}
#endif
#if USE_MIDI
if (source == SourceMidi){
if (midi_to_usb){
usbmidi_tx(buffer, length);
}
if (midi_to_net){
netmidi_tx(buffer, length);
}
}
#endif
#if USE_NETMIDI
if (source == SourceNet){
if (net_to_usb){
usbmidi_tx(buffer, length);
}
if (net_to_midi){
netmidi_tx(buffer, length);
}
}
#endif
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment