Merge branch 'Arduino' into avr_core
This commit is contained in:
commit
d4ed134040
|
|
@ -619,7 +619,8 @@ WARN_LOGFILE =
|
||||||
# directories like "/usr/src/myproject". Separate the files or directories
|
# directories like "/usr/src/myproject". Separate the files or directories
|
||||||
# with spaces.
|
# with spaces.
|
||||||
|
|
||||||
INPUT = ../
|
INPUT = ../ \
|
||||||
|
../src
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
#include <MIDI.h>
|
||||||
|
/*
|
||||||
|
Basic I/O MIDI tutorial
|
||||||
|
by Franky
|
||||||
|
28/07/2009
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LED 13 // LED pin on Arduino board
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
pinMode(LED, OUTPUT);
|
||||||
|
MIDI.begin(4); // Launch MIDI with default options
|
||||||
|
// input channel is set to 4
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
if (MIDI.read()) {
|
||||||
|
digitalWrite(LED,HIGH); // Blink the LED
|
||||||
|
MIDI.sendNoteOn(42,127,1); // Send a Note (pitch 42, velo 127 on channel 1)
|
||||||
|
delay(1000); // Wait for a second
|
||||||
|
MIDI.sendNoteOff(42,0,1); // Stop the note
|
||||||
|
digitalWrite(LED,LOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
#include <MIDI.h>
|
||||||
|
|
||||||
|
unsigned long gTime_start = 0;
|
||||||
|
unsigned long gTime_stop = 0;
|
||||||
|
unsigned gCounter = 0;
|
||||||
|
unsigned long gTime_sum = 0;
|
||||||
|
unsigned long gTime_min = -1;
|
||||||
|
unsigned long gTime_max = 0;
|
||||||
|
|
||||||
|
|
||||||
|
void handleNoteOn(byte inChannel,byte inNote,byte inVelocity)
|
||||||
|
{
|
||||||
|
|
||||||
|
gTime_stop = micros();
|
||||||
|
|
||||||
|
const unsigned long diff = gTime_stop - gTime_start;
|
||||||
|
gTime_sum += diff;
|
||||||
|
|
||||||
|
if (diff > gTime_max) gTime_max = diff;
|
||||||
|
if (diff < gTime_min) gTime_min = diff;
|
||||||
|
|
||||||
|
gCounter++;
|
||||||
|
|
||||||
|
if (gCounter >= 100) {
|
||||||
|
|
||||||
|
const unsigned long average = gTime_sum / (float)gCounter;
|
||||||
|
|
||||||
|
Serial.println("Time to receive NoteOn: ");
|
||||||
|
|
||||||
|
Serial.print("Average: ");
|
||||||
|
Serial.print(average);
|
||||||
|
Serial.println(" microsecs");
|
||||||
|
|
||||||
|
Serial.print("Min: ");
|
||||||
|
Serial.print(gTime_min);
|
||||||
|
Serial.println(" microsecs");
|
||||||
|
|
||||||
|
Serial.print("Max: ");
|
||||||
|
Serial.print(gTime_max);
|
||||||
|
Serial.println(" microsecs");
|
||||||
|
|
||||||
|
gCounter = 0;
|
||||||
|
gTime_sum = 0;
|
||||||
|
gTime_max = 0;
|
||||||
|
gTime_min = -1;
|
||||||
|
|
||||||
|
MIDI.turnThruOff();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
|
||||||
|
MIDI.begin();
|
||||||
|
|
||||||
|
Serial.begin(38400);
|
||||||
|
Serial.print("MCU Ready");
|
||||||
|
|
||||||
|
MIDI.sendNoteOn(69,127,1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
|
||||||
|
gTime_start = micros();
|
||||||
|
|
||||||
|
MIDI.read();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
#include <MIDI.h>
|
||||||
|
|
||||||
|
|
||||||
|
// This function will be automatically called when a NoteOn is received.
|
||||||
|
// It must be a void-returning function with the correct parameters,
|
||||||
|
// see documentation here:
|
||||||
|
// http://arduinomidilib.sourceforge.net/class_m_i_d_i___class.html
|
||||||
|
|
||||||
|
void HandleNoteOn(byte channel, byte pitch, byte velocity) {
|
||||||
|
|
||||||
|
// Do whatever you want when you receive a Note On.
|
||||||
|
|
||||||
|
if (velocity == 0) {
|
||||||
|
// This acts like a NoteOff.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to keep your callbacks short (no delays ect) as the contrary would slow down the loop()
|
||||||
|
// and have a bad impact on real-time performance.
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// Initiate MIDI communications, listen to all channels
|
||||||
|
MIDI.begin(MIDI_CHANNEL_OMNI);
|
||||||
|
|
||||||
|
// Connect the HandleNoteOn function to the library, so it is called upon reception of a NoteOn.
|
||||||
|
MIDI.setHandleNoteOn(HandleNoteOn); // Put only the name of the function
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// Call MIDI.read the fastest you can for real-time performance.
|
||||||
|
MIDI.read();
|
||||||
|
|
||||||
|
// There is no need to check if there are messages incoming if they are bound to a Callback function.
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
#include <MIDI.h>
|
||||||
|
/*
|
||||||
|
MIDI Input tutorial
|
||||||
|
by Franky
|
||||||
|
28/07/2009
|
||||||
|
|
||||||
|
NOTE: for easier MIDI input reading,
|
||||||
|
take a look a the Callbacks example.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LED 13 // LED pin on Arduino board
|
||||||
|
|
||||||
|
void BlinkLed(byte num) { // Basic blink function
|
||||||
|
for (byte i=0;i<num;i++) {
|
||||||
|
digitalWrite(LED,HIGH);
|
||||||
|
delay(50);
|
||||||
|
digitalWrite(LED,LOW);
|
||||||
|
delay(50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
pinMode(LED, OUTPUT);
|
||||||
|
MIDI.begin(); // Launch MIDI with default options
|
||||||
|
// (input channel is default set to 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
if (MIDI.read()) { // Is there a MIDI message incoming ?
|
||||||
|
switch(MIDI.getType()) { // Get the type of the message we caught
|
||||||
|
case ProgramChange: // If it is a Program Change
|
||||||
|
BlinkLed(MIDI.getData1()); // Blink the LED a number of times
|
||||||
|
// correponding to the program number
|
||||||
|
// (0 to 127, it can last a while..)
|
||||||
|
break;
|
||||||
|
// See the online reference for other message types
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ -d /Applications/Arduino.app ]]
|
||||||
|
then
|
||||||
|
|
||||||
|
# Define locations
|
||||||
|
|
||||||
|
lib_path=/Applications/Arduino.app/Contents/Resources/Java/libraries/MIDI
|
||||||
|
|
||||||
|
if [[ -d $lib_path ]]
|
||||||
|
then
|
||||||
|
# Remove old lib
|
||||||
|
rm -rf $lib_path
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create folder
|
||||||
|
mkdir $lib_path
|
||||||
|
|
||||||
|
# Copy sources
|
||||||
|
cp ../src/MIDI.cpp $lib_path
|
||||||
|
cp ../src/MIDI.h $lib_path
|
||||||
|
|
||||||
|
# Copy resources
|
||||||
|
cp ../res/keywords.txt $lib_path
|
||||||
|
|
||||||
|
# Copy examples
|
||||||
|
mkdir $lib_path/examples
|
||||||
|
|
||||||
|
cp -r examples/* $lib_path/examples
|
||||||
|
|
||||||
|
# Copy doc
|
||||||
|
mkdir $lib_path/doc
|
||||||
|
|
||||||
|
cp ../doc/* $lib_path/doc
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "Arduino application not found."
|
||||||
|
fi
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ -d /Applications/Arduino.app ]]
|
||||||
|
then
|
||||||
|
|
||||||
|
# Define locations
|
||||||
|
|
||||||
|
lib_path=/Applications/Arduino.app/Contents/Resources/Java/libraries/MIDI
|
||||||
|
|
||||||
|
if [[ -d $lib_path ]]
|
||||||
|
then
|
||||||
|
# Remove old lib
|
||||||
|
rm -rf $lib_path
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create folder
|
||||||
|
mkdir $lib_path
|
||||||
|
|
||||||
|
# Install contents
|
||||||
|
cp -r * $lib_path
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
rm $lib_path/install_mac.sh
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "Arduino application not found."
|
||||||
|
fi
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
#######################################
|
||||||
|
# Syntax Coloring Map For Test
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Datatypes (KEYWORD1)
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
MIDI KEYWORD1
|
||||||
|
MIDI.h KEYWORD1
|
||||||
|
MIDI_Class KEYWORD1
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Methods and Functions (KEYWORD2)
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
send KEYWORD2
|
||||||
|
sendNoteOn KEYWORD2
|
||||||
|
sendNoteOff KEYWORD2
|
||||||
|
sendProgramChange KEYWORD2
|
||||||
|
sendControlChange KEYWORD2
|
||||||
|
sendPitchBend KEYWORD2
|
||||||
|
sendPolyPressure KEYWORD2
|
||||||
|
sendAfterTouch KEYWORD2
|
||||||
|
sendSysEx KEYWORD2
|
||||||
|
sendTimeCodeQuarterFrame KEYWORD2
|
||||||
|
sendSongPosition KEYWORD2
|
||||||
|
sendSongSelect KEYWORD2
|
||||||
|
sendTuneRequest KEYWORD2
|
||||||
|
sendRealTime KEYWORD2
|
||||||
|
begin KEYWORD2
|
||||||
|
read KEYWORD2
|
||||||
|
getType KEYWORD2
|
||||||
|
getChannel KEYWORD2
|
||||||
|
getData1 KEYWORD2
|
||||||
|
getData2 KEYWORD2
|
||||||
|
getSysExArray KEYWORD2
|
||||||
|
getFilterMode KEYWORD2
|
||||||
|
getThruState KEYWORD2
|
||||||
|
getInputChannel KEYWORD2
|
||||||
|
check KEYWORD2
|
||||||
|
delMsg KEYWORD2
|
||||||
|
delSysEx KEYWORD2
|
||||||
|
setInputChannel KEYWORD2
|
||||||
|
setStatus KEYWORD2
|
||||||
|
turnThruOn KEYWORD2
|
||||||
|
turnThruOff KEYWORD2
|
||||||
|
setThruFilterMode KEYWORD2
|
||||||
|
disconnectCallbackFromType KEYWORD2
|
||||||
|
setHandleNoteOff KEYWORD2
|
||||||
|
setHandleNoteOn KEYWORD2
|
||||||
|
setHandleAfterTouchPoly KEYWORD2
|
||||||
|
setHandleControlChange KEYWORD2
|
||||||
|
setHandleProgramChange KEYWORD2
|
||||||
|
setHandleAfterTouchChannel KEYWORD2
|
||||||
|
setHandlePitchBend KEYWORD2
|
||||||
|
setHandleSystemExclusive KEYWORD2
|
||||||
|
setHandleTimeCodeQuarterFrame KEYWORD2
|
||||||
|
setHandleSongPosition KEYWORD2
|
||||||
|
setHandleSongSelect KEYWORD2
|
||||||
|
setHandleTuneRequest KEYWORD2
|
||||||
|
setHandleClock KEYWORD2
|
||||||
|
setHandleStart KEYWORD2
|
||||||
|
setHandleContinue KEYWORD2
|
||||||
|
setHandleStop KEYWORD2
|
||||||
|
setHandleActiveSensing KEYWORD2
|
||||||
|
setHandleSystemReset KEYWORD2
|
||||||
|
getTypeFromStatusByte KEYWORD2
|
||||||
|
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Instances (KEYWORD2)
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Constants (LITERAL1)
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
NoteOff LITERAL1
|
||||||
|
NoteOn LITERAL1
|
||||||
|
AfterTouchPoly LITERAL1
|
||||||
|
ControlChange LITERAL1
|
||||||
|
ProgramChange LITERAL1
|
||||||
|
AfterTouchChannel LITERAL1
|
||||||
|
PitchBend LITERAL1
|
||||||
|
SystemExclusive LITERAL1
|
||||||
|
TimeCodeQuarterFrame LITERAL1
|
||||||
|
SongPosition LITERAL1
|
||||||
|
SongSelect LITERAL1
|
||||||
|
TuneRequest LITERAL1
|
||||||
|
Clock LITERAL1
|
||||||
|
Start LITERAL1
|
||||||
|
Stop LITERAL1
|
||||||
|
Continue LITERAL1
|
||||||
|
ActiveSensing LITERAL1
|
||||||
|
SystemReset LITERAL1
|
||||||
|
InvalidType LITERAL1
|
||||||
|
Off LITERAL1
|
||||||
|
Full LITERAL1
|
||||||
|
SameChannel LITERAL1
|
||||||
|
DifferentChannel LITERAL1
|
||||||
|
MIDI_CHANNEL_OMNI LITERAL1
|
||||||
|
MIDI_CHANNEL_OFF LITERAL1
|
||||||
|
MIDI_BAUDRATE LITERAL1
|
||||||
|
MIDI_SYSEX_ARRAY_SIZE LITERAL1
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Create a temporary destination folder
|
||||||
|
mkdir -p temp/doc
|
||||||
|
mkdir -p temp/examples
|
||||||
|
|
||||||
|
# Copy sources
|
||||||
|
cp ../src/* temp
|
||||||
|
|
||||||
|
# Copy resources
|
||||||
|
cp keywords.txt temp
|
||||||
|
|
||||||
|
# Copy examples
|
||||||
|
cp -r examples/* temp/examples
|
||||||
|
|
||||||
|
# Generate & copy doc
|
||||||
|
cd ../doc
|
||||||
|
/Applications/Doxygen.app/Contents/Resources/doxygen Doxyfile
|
||||||
|
rm -rf latex
|
||||||
|
cd ../res
|
||||||
|
|
||||||
|
cp -r ../doc/* temp/doc
|
||||||
|
|
||||||
|
# Generate package
|
||||||
|
mv temp MIDI
|
||||||
|
zip -r MIDI.zip MIDI
|
||||||
|
mv MIDI.zip Arduino_MIDI_Library_v.zip
|
||||||
Loading…
Reference in New Issue