MIDI Interface in progress

Dependencies:   SPI_TFT_ILI9341 TFT_fonts Touch_tft PowerControl mbed USBMIDI

Files at this revision

API Documentation at this revision

Comitter:
Vekotin
Date:
Thu Jan 16 07:48:24 2014 +0000
Child:
1:7e2d93d70d2b
Commit message:
MIDI interface, joka ei toimi

Changed in this revision

SPI_TFT_ILI9341.lib Show annotated file Show diff for this revision Revisions of this file
TFT_fonts.lib Show annotated file Show diff for this revision Revisions of this file
Touch_tft.lib Show annotated file Show diff for this revision Revisions of this file
USBMIDI.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SPI_TFT_ILI9341.lib	Thu Jan 16 07:48:24 2014 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/dreschpe/code/SPI_TFT_ILI9341/#55aed13f2630
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFT_fonts.lib	Thu Jan 16 07:48:24 2014 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/dreschpe/code/TFT_fonts/#76774250fcec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Touch_tft.lib	Thu Jan 16 07:48:24 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Vekotin/code/Touch_tft/#ef67f9068850
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBMIDI.lib	Thu Jan 16 07:48:24 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/USBMIDI/#10d694d6ccdc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jan 16 07:48:24 2014 +0000
@@ -0,0 +1,89 @@
+#include "mbed.h"
+#include "SPI_TFT_ILI9341.h"
+#include "Arial12x12.h"
+#include "Arial28x28.h"
+#include "touch_tft.h"
+#include "USBMIDI.h"
+
+
+// the TFT is connected to SPI pin 5-7
+// the touch is connected to 19,20,16,17
+
+touch_tft tft(p20,p19,p18,p17,p5, p6, p7, p14, p15, p21, "TFT"); // x+,x-,y+,y-,mosi, miso, sclk, cs, reset, dc
+
+/* void show_message(MIDIMessage msg) {
+    switch (msg.type()) {
+        case MIDIMessage::NoteOnType:
+            printf("NoteOn key:%d, velocity: %d, channel: %d\n", msg.key(), msg.velocity(), msg.channel());
+            break;
+        case MIDIMessage::NoteOffType:
+            printf("NoteOff key:%d, velocity: %d, channel: %d\n", msg.key(), msg.velocity(), msg.channel());
+            break;
+        case MIDIMessage::ControlChangeType:    
+            printf("ControlChange controller: %d, data: %d\n", msg.controller(), msg.value());
+            break;
+        case MIDIMessage::PitchWheelType:
+            printf("PitchWheel channel: %d, pitch: %d\n", msg.channel(), msg.pitch());
+            break;
+        default:
+            printf("Another message\n");
+    }    
+} 
+
+USBMIDI midi; */
+
+int main() {
+    
+    point p;
+    unsigned short color = White;
+
+    tft.claim(stdout);        // send stdout to the TFT display
+    tft.background(Black);    // set background to black
+    tft.foreground(White);    // set chars to white
+    tft.cls();                // clear the screen
+    tft.set_font((unsigned char*) Arial28x28);  // select the font
+    
+    tft.set_orientation(0);
+    tft.calibrate();
+    
+    tft.locate(0,0);
+    printf(" HOPPODIHOI! ");    
+    
+    while (1) {
+        
+        color = White;
+        tft.fillrect(20,140,220,180,color);
+
+        p = tft.get_touch();
+        if (tft.is_touched(p)) {  // touch
+        
+            p = tft.to_pixel(p);                          // convert to pixel pos
+            if (p.y > 140 && p.y < 180) {                             // a button field
+                if (p.x > 20 && p.x < 220) {            
+                    color = Cyan;
+                    tft.fillrect(20,140,220,180,color);                                    
+                }
+            }
+        }
+        
+    }
+    
+    
+            
+    /* 
+    midi.attach(show_message);         // call back for messages received    
+    while (1) {    
+        for(int i=48; i<83; i++) {     // send some messages!
+            midi.write(MIDIMessage::NoteOn(i));
+            wait(0.25);
+            midi.write(MIDIMessage::NoteOff(i));
+            wait(0.5);
+        }
+    }
+    */
+    
+}
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jan 16 07:48:24 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912