summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arduino/Laserharfe/Laserharfe.ino29
l---------arduino/Laserharfe/_config.c1
l---------arduino/Laserharfe/_engine.c1
l---------arduino/Laserharfe/config.h1
l---------arduino/Laserharfe/engine.h1
l---------arduino/Laserharfe/main.h1
l---------arduino/Laserharfe/midi.h1
7 files changed, 16 insertions, 19 deletions
diff --git a/arduino/Laserharfe/Laserharfe.ino b/arduino/Laserharfe/Laserharfe.ino
index 9f0d025..d8a7c6f 100644
--- a/arduino/Laserharfe/Laserharfe.ino
+++ b/arduino/Laserharfe/Laserharfe.ino
@@ -9,8 +9,9 @@
9#include "MIDIUSB.h" 9#include "MIDIUSB.h"
10#include <Wire.h> 10#include <Wire.h>
11 11
12#include "engine.h" 12#include "main.h"
13#include "config.h" 13#include "config.h"
14#include "engine.h"
14 15
15int led = 13; 16int led = 13;
16 17
@@ -20,23 +21,10 @@ enum {
20 MODE_REPORTPOINTS_PLAY = 2, 21 MODE_REPORTPOINTS_PLAY = 2,
21} g_mode = MODE_REPORTPOINTS_PLAY; 22} g_mode = MODE_REPORTPOINTS_PLAY;
22 23
23/* 24uint32_t now() {
24// First parameter is the event type (0x09 = note on, 0x08 = note off). 25 return millis();
25// Second parameter is note-on/note-off, combined with the channel.
26// Channel can be anything between 0-15. Typically reported to the user as 1-16.
27// Third parameter is the note number (48 = middle C).
28// Fourth parameter is the velocity (64 = normal, 127 = fastest).
29void noteOn(byte channel, byte pitch, byte velocity) {
30 midiEventPacket_t noteOn = {0x09, 0x90 | channel, pitch, velocity};
31 MidiUSB.sendMIDI(noteOn);
32} 26}
33 27
34void noteOff(byte channel, byte pitch, byte velocity) {
35 midiEventPacket_t noteOff = {0x08, 0x80 | channel, pitch, velocity};
36 MidiUSB.sendMIDI(noteOff);
37}
38*/
39
40void setup_pwm() { 28void setup_pwm() {
41 // Set up the generic clock (GCLK4) used to clock timers 29 // Set up the generic clock (GCLK4) used to clock timers
42 REG_GCLK_GENDIV = GCLK_GENDIV_DIV(1) | // Divide the 48MHz clock source by divisor 2: 48MHz/2=24MHz 30 REG_GCLK_GENDIV = GCLK_GENDIV_DIV(1) | // Divide the 48MHz clock source by divisor 2: 48MHz/2=24MHz
@@ -152,8 +140,9 @@ void handle_wire() {
152 if (p1.x==1023 && p2.x==1023 && p3.x==1023 && p4.x==1023) 140 if (p1.x==1023 && p2.x==1023 && p3.x==1023 && p4.x==1023)
153 return; 141 return;
154 142
155 long now = millis(); 143 uint32_t now = millis();
156 if (g_mode==MODE_STANDALONE || g_mode==MODE_REPORTPOINTS_PLAY) { 144 if (g_mode==MODE_STANDALONE || g_mode==MODE_REPORTPOINTS_PLAY) {
145/*
157 if (p1.x!=1023) 146 if (p1.x!=1023)
158 engine_handle_point(&p1, now); 147 engine_handle_point(&p1, now);
159 if (p2.x!=1023) 148 if (p2.x!=1023)
@@ -162,6 +151,7 @@ void handle_wire() {
162 engine_handle_point(&p3, now); 151 engine_handle_point(&p3, now);
163 if (p4.x!=1023) 152 if (p4.x!=1023)
164 engine_handle_point(&p4, now); 153 engine_handle_point(&p4, now);
154*/
165 } 155 }
166 156
167 if (g_mode==MODE_STANDALONE) 157 if (g_mode==MODE_STANDALONE)
@@ -214,7 +204,8 @@ void midi_silencenote( int channel, int note, int octave_offset ) {
214void midi_pitchbend( int channel, int pitch ) { 204void midi_pitchbend( int channel, int pitch ) {
215 pitch += 8192; 205 pitch += 8192;
216 if (pitch < 0) pitch = 0; 206 if (pitch < 0) pitch = 0;
217 if (pitch > 16383) pitch = 16383, 207 if (pitch > 16383) pitch = 16383;
208
218 midiEventPacket_t p = { 0xe, 0xe0 | channel, 0x7f & pitch, 0x7f & (pitch>>7) }; 209 midiEventPacket_t p = { 0xe, 0xe0 | channel, 0x7f & pitch, 0x7f & (pitch>>7) };
219 MidiUSB.sendMIDI(p); 210 MidiUSB.sendMIDI(p);
220} 211}
@@ -295,7 +286,7 @@ void loop() {
295 delay(1500); 286 delay(1500);
296*/ 287*/
297 288
298 engine_checksilence(millis()); 289 //engine_checksilence(millis());
299 digitalWrite(led, ++led_state & 1 ? HIGH : LOW); // turn the LED on (HIGH is the voltage level) 290 digitalWrite(led, ++led_state & 1 ? HIGH : LOW); // turn the LED on (HIGH is the voltage level)
300} 291}
301 292
diff --git a/arduino/Laserharfe/_config.c b/arduino/Laserharfe/_config.c
new file mode 120000
index 0000000..1353d74
--- /dev/null
+++ b/arduino/Laserharfe/_config.c
@@ -0,0 +1 @@
../../config.c \ No newline at end of file
diff --git a/arduino/Laserharfe/_engine.c b/arduino/Laserharfe/_engine.c
new file mode 120000
index 0000000..013d780
--- /dev/null
+++ b/arduino/Laserharfe/_engine.c
@@ -0,0 +1 @@
../../engine.c \ No newline at end of file
diff --git a/arduino/Laserharfe/config.h b/arduino/Laserharfe/config.h
new file mode 120000
index 0000000..bce5bfd
--- /dev/null
+++ b/arduino/Laserharfe/config.h
@@ -0,0 +1 @@
../../config.h \ No newline at end of file
diff --git a/arduino/Laserharfe/engine.h b/arduino/Laserharfe/engine.h
new file mode 120000
index 0000000..34e3ddb
--- /dev/null
+++ b/arduino/Laserharfe/engine.h
@@ -0,0 +1 @@
../../engine.h \ No newline at end of file
diff --git a/arduino/Laserharfe/main.h b/arduino/Laserharfe/main.h
new file mode 120000
index 0000000..c57517f
--- /dev/null
+++ b/arduino/Laserharfe/main.h
@@ -0,0 +1 @@
../../main.h \ No newline at end of file
diff --git a/arduino/Laserharfe/midi.h b/arduino/Laserharfe/midi.h
new file mode 120000
index 0000000..65ebe46
--- /dev/null
+++ b/arduino/Laserharfe/midi.h
@@ -0,0 +1 @@
../../midi.h \ No newline at end of file