Veikko Kero / Mbed 2 deprecated MIDI_Interface_ver_1

Dependencies:   SPI_TFT_ILI9341 TFT_fonts Touch_tft PowerControl mbed USBMIDI

Committer:
tanssisatu
Date:
Thu Feb 06 08:37:47 2014 +0000
Revision:
7:4aec4a6acac2
Parent:
5:8e13103b41be
Child:
9:df3bff3a0b76
Rev 2.0002

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MetropoliaMies 4:76c054f8b97e 1 #include "touch_tft.h"
MetropoliaMies 4:76c054f8b97e 2 #include "SPI_TFT_ILI9341.h"
MetropoliaMies 4:76c054f8b97e 3
MetropoliaMies 4:76c054f8b97e 4
MetropoliaMies 4:76c054f8b97e 5 int slider;
MetropoliaMies 5:8e13103b41be 6 int Octave = 0;
MetropoliaMies 5:8e13103b41be 7
MetropoliaMies 4:76c054f8b97e 8
MetropoliaMies 4:76c054f8b97e 9 touch_tft tft(p20,p19,p18,p17,p5, p6, p7, p14, p15, p21, "TFT"); // x+,x-,y+,y-,mosi, miso, sclk, cs, reset, dc
MetropoliaMies 4:76c054f8b97e 10
MetropoliaMies 4:76c054f8b97e 11 void buttons(int b, unsigned short color) //button field
MetropoliaMies 4:76c054f8b97e 12 {
MetropoliaMies 4:76c054f8b97e 13
MetropoliaMies 5:8e13103b41be 14 if (b == 1) {
MetropoliaMies 4:76c054f8b97e 15 tft.fillrect(3,88,78,318,color);
MetropoliaMies 5:8e13103b41be 16 }
MetropoliaMies 5:8e13103b41be 17 if (b == 2) {
MetropoliaMies 5:8e13103b41be 18 tft.fillrect(83,88,158,158,color);
MetropoliaMies 4:76c054f8b97e 19 }
MetropoliaMies 5:8e13103b41be 20 if (b == 3) {
MetropoliaMies 5:8e13103b41be 21 tft.fillrect(163,88,238,158,color);
MetropoliaMies 5:8e13103b41be 22 }
MetropoliaMies 5:8e13103b41be 23 if (b == 4) {
MetropoliaMies 4:76c054f8b97e 24 tft.fillrect(3,163,78,238,color);
MetropoliaMies 4:76c054f8b97e 25 }
MetropoliaMies 4:76c054f8b97e 26 if (b == 5) {
MetropoliaMies 4:76c054f8b97e 27 tft.fillrect(83,163,158,238,color);
MetropoliaMies 4:76c054f8b97e 28 }
MetropoliaMies 4:76c054f8b97e 29 if (b == 6) {
MetropoliaMies 4:76c054f8b97e 30 tft.fillrect(163,163,238,238,color);
MetropoliaMies 4:76c054f8b97e 31 }
MetropoliaMies 4:76c054f8b97e 32
MetropoliaMies 5:8e13103b41be 33 if (b == 7) {
MetropoliaMies 4:76c054f8b97e 34 tft.fillrect(3,243,78,318,color);
MetropoliaMies 4:76c054f8b97e 35 }
MetropoliaMies 4:76c054f8b97e 36 if (b == 8) {
MetropoliaMies 4:76c054f8b97e 37 tft.fillrect(83,243,158,318,color);
MetropoliaMies 4:76c054f8b97e 38 }
MetropoliaMies 4:76c054f8b97e 39 if (b == 9) {
MetropoliaMies 4:76c054f8b97e 40 tft.fillrect(163,243,238,318,color);
MetropoliaMies 4:76c054f8b97e 41 }
MetropoliaMies 4:76c054f8b97e 42 }
MetropoliaMies 4:76c054f8b97e 43
MetropoliaMies 5:8e13103b41be 44 void light_pressed(unsigned short color, point p)
MetropoliaMies 4:76c054f8b97e 45 {
MetropoliaMies 4:76c054f8b97e 46
MetropoliaMies 5:8e13103b41be 47 if (p.x > 3 && p.x < 78) { //Slider
MetropoliaMies 5:8e13103b41be 48 if (p.y > 88 && p.y < 111) { //button 1
tanssisatu 7:4aec4a6acac2 49 slider = 16383;
tanssisatu 7:4aec4a6acac2 50
MetropoliaMies 4:76c054f8b97e 51 }
MetropoliaMies 5:8e13103b41be 52 if (p.y > 111 && p.y < 134) { //button 2
tanssisatu 7:4aec4a6acac2 53 slider = 14742;
tanssisatu 7:4aec4a6acac2 54 MIDIMessage::PitchWheel(slider);
MetropoliaMies 4:76c054f8b97e 55 }
MetropoliaMies 4:76c054f8b97e 56 if (p.y > 134 && p.y < 157) { //button 3
tanssisatu 7:4aec4a6acac2 57 slider = 13104;
tanssisatu 7:4aec4a6acac2 58 MIDIMessage::PitchWheel(slider);
MetropoliaMies 4:76c054f8b97e 59 }
MetropoliaMies 4:76c054f8b97e 60 if (p.y > 157 && p.y < 180) { //button 3
tanssisatu 7:4aec4a6acac2 61 slider = 11466;
tanssisatu 7:4aec4a6acac2 62 MIDIMessage::PitchWheel(slider);
MetropoliaMies 4:76c054f8b97e 63 }
MetropoliaMies 4:76c054f8b97e 64 if (p.y > 180 && p.y < 203) { //button 3
tanssisatu 7:4aec4a6acac2 65 slider = 9828;
tanssisatu 7:4aec4a6acac2 66 MIDIMessage::PitchWheel(slider);
MetropoliaMies 4:76c054f8b97e 67 }
MetropoliaMies 5:8e13103b41be 68 if (p.y > 203&& p.y < 226) { //button 3
tanssisatu 7:4aec4a6acac2 69 slider = 8192;
tanssisatu 7:4aec4a6acac2 70 MIDIMessage::PitchWheel(slider);
MetropoliaMies 4:76c054f8b97e 71 }
MetropoliaMies 4:76c054f8b97e 72 if (p.y > 226 && p.y < 249) { //button 3
tanssisatu 7:4aec4a6acac2 73 slider = 4915;
tanssisatu 7:4aec4a6acac2 74 MIDIMessage::PitchWheel(slider);
MetropoliaMies 4:76c054f8b97e 75 }
MetropoliaMies 4:76c054f8b97e 76 if (p.y > 249 && p.y < 272) { //button 3
tanssisatu 7:4aec4a6acac2 77 slider = 3277;
tanssisatu 7:4aec4a6acac2 78 MIDIMessage::PitchWheel(slider);
MetropoliaMies 4:76c054f8b97e 79 }
MetropoliaMies 4:76c054f8b97e 80 if (p.y > 272 && p.y < 295) { //button 3
tanssisatu 7:4aec4a6acac2 81 slider = 1638;
tanssisatu 7:4aec4a6acac2 82 MIDIMessage::PitchWheel(slider);
MetropoliaMies 4:76c054f8b97e 83 }
MetropoliaMies 4:76c054f8b97e 84 if (p.y > 295 && p.y < 318) { //button 3
tanssisatu 7:4aec4a6acac2 85 slider = 0;
tanssisatu 7:4aec4a6acac2 86 MIDIMessage::PitchWheel(slider);
MetropoliaMies 4:76c054f8b97e 87 }
MetropoliaMies 4:76c054f8b97e 88 }
MetropoliaMies 4:76c054f8b97e 89 if (p.y > 163 && p.y < 238) { //ROW B
MetropoliaMies 4:76c054f8b97e 90 if (p.x > 83 && p.x < 158) { //button 5
MetropoliaMies 4:76c054f8b97e 91 buttons(5, color);
MetropoliaMies 4:76c054f8b97e 92
MetropoliaMies 4:76c054f8b97e 93 }
MetropoliaMies 4:76c054f8b97e 94 if (p.x > 163 && p.x < 238) { //button 6
MetropoliaMies 4:76c054f8b97e 95 buttons(6, color);
MetropoliaMies 4:76c054f8b97e 96
MetropoliaMies 4:76c054f8b97e 97 }
MetropoliaMies 4:76c054f8b97e 98 }
MetropoliaMies 4:76c054f8b97e 99
MetropoliaMies 4:76c054f8b97e 100 if (p.y > 243 && p.y < 318) { //ROW C
MetropoliaMies 5:8e13103b41be 101 if (p.x > 83 && p.x < 158) { //Ocatave down
MetropoliaMies 5:8e13103b41be 102 buttons(8, color);
MetropoliaMies 5:8e13103b41be 103
MetropoliaMies 4:76c054f8b97e 104 }
MetropoliaMies 5:8e13103b41be 105 if (p.x > 163 && p.x < 238) { //Octave up
MetropoliaMies 4:76c054f8b97e 106 buttons(9, color);
MetropoliaMies 4:76c054f8b97e 107
MetropoliaMies 5:8e13103b41be 108
MetropoliaMies 4:76c054f8b97e 109 }
MetropoliaMies 4:76c054f8b97e 110 }
MetropoliaMies 4:76c054f8b97e 111 }
MetropoliaMies 4:76c054f8b97e 112
MetropoliaMies 4:76c054f8b97e 113
MetropoliaMies 4:76c054f8b97e 114