Veikko Kero / Mbed 2 deprecated MIDI_Interface_ver_1

Dependencies:   SPI_TFT_ILI9341 TFT_fonts Touch_tft PowerControl mbed USBMIDI

light_pressed.h

Committer:
MetropoliaMies
Date:
2014-02-06
Revision:
5:8e13103b41be
Parent:
4:76c054f8b97e
Child:
7:4aec4a6acac2

File content as of revision 5:8e13103b41be:

#include "touch_tft.h"
#include "SPI_TFT_ILI9341.h"


int slider;
int Octave = 0;


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 buttons(int b, unsigned short color)              //button field
{

    if (b == 1) {
        tft.fillrect(3,88,78,318,color);
    }
    if (b == 2) {
        tft.fillrect(83,88,158,158,color);
    }
    if (b == 3) {
        tft.fillrect(163,88,238,158,color);
    }
    if (b == 4) {
        tft.fillrect(3,163,78,238,color);
    }
    if (b == 5) {
        tft.fillrect(83,163,158,238,color);
    }
    if (b == 6) {
        tft.fillrect(163,163,238,238,color);
    }

    if (b == 7) {
        tft.fillrect(3,243,78,318,color);
    }
    if (b == 8) {
        tft.fillrect(83,243,158,318,color);
    }
    if (b == 9) {
        tft.fillrect(163,243,238,318,color);
    }
}

void light_pressed(unsigned short color, point p)
{

    if (p.x > 3 && p.x < 78) {              //Slider
        if (p.y > 88 && p.y < 111) {        //button 1
            slider = 100;
        }
        if (p.y > 111 && p.y < 134) {       //button 2
            slider = 90;
        }
        if (p.y > 134 && p.y < 157) {       //button 3
            slider = 80;
        }
        if (p.y > 157 && p.y < 180) {       //button 3
            slider = 70;
        }
        if (p.y > 180 && p.y < 203) {       //button 3
            slider = 60;
        }
        if (p.y > 203&& p.y < 226) {        //button 3
            slider = 50;
        }
        if (p.y > 226 && p.y < 249) {       //button 3
            slider = 40;
        }
        if (p.y > 249 && p.y < 272) {       //button 3
            slider = 30;
        }
        if (p.y > 272 && p.y < 295) {       //button 3
            slider = 20;
        }
        if (p.y > 295 && p.y < 318) {       //button 3
            slider = 10;
        }
    }
    if (p.y > 163 && p.y < 238) {           //ROW B
        if (p.x > 83 && p.x < 158) {        //button 5
            buttons(5, color);

        }
        if (p.x > 163 && p.x < 238) {       //button 6
            buttons(6, color);

        }
    }

    if (p.y > 243 && p.y < 318) {           //ROW C
        if (p.x > 83 && p.x < 158) {        //Ocatave down
            buttons(8, color);

        }
        if (p.x > 163 && p.x < 238) {       //Octave up
            buttons(9, color);


        }
    }
}