MIDI Interface in progress
Dependencies: SPI_TFT_ILI9341 TFT_fonts Touch_tft PowerControl mbed USBMIDI
main.cpp
- Committer:
- MetropoliaMies
- Date:
- 2014-02-06
- Revision:
- 5:8e13103b41be
- Parent:
- 4:76c054f8b97e
- Child:
- 6:17e0520e346f
File content as of revision 5:8e13103b41be:
#include "mbed.h" #include "Arial12x12.h" #include "Arial28x28.h" #include "USBMIDI.h" #include "light_pressed.h" // the TFT is connected to SPI pin 5-7 // the touch is connected to 19,20,16,17 Serial pc(USBTX, USBRX); void draw_buttons(unsigned short color) { unsigned int i = 0; for (i = 0; i<10; i++) { //draw buttons tft.locate(10,50); printf("Shift"); } } int main() { // PERUSPOHJA, ÄLÄ MUOKKAA! 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*) Arial12x12); // select the font tft.set_orientation(0); tft.calibrate(); tft.locate(180,0); //show coordinates printf(" x = "); tft.locate(180,12); printf(" y = "); tft.locate(85,0); printf(" Octave = "); tft.locate(85, 12); printf(" Slider = "); tft.locate(0,0); printf(" MIDIMAN! "); tft.line(0,83,239,83,White); tft.locate(163,250); printf("Octave up"); tft.locate(83,250); printf("Octave dwn"); while (1) { color = White; draw_buttons(color); while (tft.is_touched(tft.get_touch())) { // touch p = tft.get_touch(); p = tft.to_pixel(p); // convert to pixel position tft.locate(210,0); printf("%3d",p.x); tft.locate(210,12); printf("%3d",p.y); tft.locate(160, 0); printf("%i", Octave); tft.locate(160, 12); printf("%i", slider); } } }