Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SPI_TFT_ILI9341 TFT_fonts Touch_tft PowerControl mbed USBMIDI
light_pressed.h@10:ff7cdaeb8b9a, 2014-02-10 (annotated)
- Committer:
- Vekotin
- Date:
- Mon Feb 10 11:07:18 2014 +0000
- Revision:
- 10:ff7cdaeb8b9a
- Parent:
- 9:df3bff3a0b76
- Child:
- 13:f72d45d919b4
first working whole shebang
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| MetropoliaMies | 4:76c054f8b97e | 1 | #include "touch_tft.h" |
| MetropoliaMies | 4:76c054f8b97e | 2 | #include "SPI_TFT_ILI9341.h" |
| Vekotin | 10:ff7cdaeb8b9a | 3 | #include "USBMIDI.h" |
| MetropoliaMies | 4:76c054f8b97e | 4 | |
| MetropoliaMies | 4:76c054f8b97e | 5 | int slider; |
| Vekotin | 10:ff7cdaeb8b9a | 6 | //extern int Octaves[10] = [-24, -12, 0, 12, 24, 36, 48, 60, 72, 84]; |
| tanssisatu | 9:df3bff3a0b76 | 7 | extern int Oct = 0; |
| Vekotin | 10:ff7cdaeb8b9a | 8 | extern USBMIDI midi; |
| MetropoliaMies | 4:76c054f8b97e | 9 | |
| MetropoliaMies | 4:76c054f8b97e | 10 | 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 | 11 | |
| MetropoliaMies | 4:76c054f8b97e | 12 | void buttons(int b, unsigned short color) //button field |
| MetropoliaMies | 4:76c054f8b97e | 13 | { |
| MetropoliaMies | 4:76c054f8b97e | 14 | |
| MetropoliaMies | 5:8e13103b41be | 15 | if (b == 1) { |
| MetropoliaMies | 4:76c054f8b97e | 16 | tft.fillrect(3,88,78,318,color); |
| MetropoliaMies | 5:8e13103b41be | 17 | } |
| MetropoliaMies | 5:8e13103b41be | 18 | if (b == 2) { |
| MetropoliaMies | 5:8e13103b41be | 19 | tft.fillrect(83,88,158,158,color); |
| MetropoliaMies | 4:76c054f8b97e | 20 | } |
| MetropoliaMies | 5:8e13103b41be | 21 | if (b == 3) { |
| MetropoliaMies | 5:8e13103b41be | 22 | tft.fillrect(163,88,238,158,color); |
| MetropoliaMies | 5:8e13103b41be | 23 | } |
| MetropoliaMies | 5:8e13103b41be | 24 | if (b == 4) { |
| MetropoliaMies | 4:76c054f8b97e | 25 | tft.fillrect(3,163,78,238,color); |
| MetropoliaMies | 4:76c054f8b97e | 26 | } |
| MetropoliaMies | 4:76c054f8b97e | 27 | if (b == 5) { |
| MetropoliaMies | 4:76c054f8b97e | 28 | tft.fillrect(83,163,158,238,color); |
| MetropoliaMies | 4:76c054f8b97e | 29 | } |
| MetropoliaMies | 4:76c054f8b97e | 30 | if (b == 6) { |
| MetropoliaMies | 4:76c054f8b97e | 31 | tft.fillrect(163,163,238,238,color); |
| MetropoliaMies | 4:76c054f8b97e | 32 | } |
| MetropoliaMies | 4:76c054f8b97e | 33 | |
| MetropoliaMies | 5:8e13103b41be | 34 | if (b == 7) { |
| MetropoliaMies | 4:76c054f8b97e | 35 | tft.fillrect(3,243,78,318,color); |
| MetropoliaMies | 4:76c054f8b97e | 36 | } |
| MetropoliaMies | 4:76c054f8b97e | 37 | if (b == 8) { |
| MetropoliaMies | 4:76c054f8b97e | 38 | tft.fillrect(83,243,158,318,color); |
| MetropoliaMies | 4:76c054f8b97e | 39 | } |
| MetropoliaMies | 4:76c054f8b97e | 40 | if (b == 9) { |
| MetropoliaMies | 4:76c054f8b97e | 41 | tft.fillrect(163,243,238,318,color); |
| MetropoliaMies | 4:76c054f8b97e | 42 | } |
| MetropoliaMies | 4:76c054f8b97e | 43 | } |
| MetropoliaMies | 4:76c054f8b97e | 44 | |
| MetropoliaMies | 5:8e13103b41be | 45 | void light_pressed(unsigned short color, point p) |
| MetropoliaMies | 4:76c054f8b97e | 46 | { |
| MetropoliaMies | 4:76c054f8b97e | 47 | |
| MetropoliaMies | 5:8e13103b41be | 48 | if (p.x > 3 && p.x < 78) { //Slider |
| Vekotin | 10:ff7cdaeb8b9a | 49 | if (p.y > 88 && p.y < 111) { |
| Vekotin | 10:ff7cdaeb8b9a | 50 | slider = 8192; |
| MetropoliaMies | 4:76c054f8b97e | 51 | } |
| Vekotin | 10:ff7cdaeb8b9a | 52 | if (p.y > 111 && p.y < 134) { |
| Vekotin | 10:ff7cdaeb8b9a | 53 | slider = 6400; |
| Vekotin | 10:ff7cdaeb8b9a | 54 | midi.write(MIDIMessage::PitchWheel(slider)); |
| MetropoliaMies | 4:76c054f8b97e | 55 | } |
| Vekotin | 10:ff7cdaeb8b9a | 56 | if (p.y > 134 && p.y < 157) { |
| Vekotin | 10:ff7cdaeb8b9a | 57 | slider = 4915; |
| Vekotin | 10:ff7cdaeb8b9a | 58 | midi.write(MIDIMessage::PitchWheel(slider)); |
| MetropoliaMies | 4:76c054f8b97e | 59 | } |
| Vekotin | 10:ff7cdaeb8b9a | 60 | if (p.y > 157 && p.y < 180) { |
| Vekotin | 10:ff7cdaeb8b9a | 61 | slider = 3277; |
| Vekotin | 10:ff7cdaeb8b9a | 62 | midi.write(MIDIMessage::PitchWheel(slider)); |
| MetropoliaMies | 4:76c054f8b97e | 63 | } |
| Vekotin | 10:ff7cdaeb8b9a | 64 | if (p.y > 180 && p.y < 203) { |
| Vekotin | 10:ff7cdaeb8b9a | 65 | slider = 1638; |
| Vekotin | 10:ff7cdaeb8b9a | 66 | midi.write(MIDIMessage::PitchWheel(slider)); |
| MetropoliaMies | 4:76c054f8b97e | 67 | } |
| Vekotin | 10:ff7cdaeb8b9a | 68 | if (p.y > 203&& p.y < 226) { |
| Vekotin | 10:ff7cdaeb8b9a | 69 | slider = 0; |
| Vekotin | 10:ff7cdaeb8b9a | 70 | midi.write(MIDIMessage::PitchWheel(slider)); |
| MetropoliaMies | 4:76c054f8b97e | 71 | } |
| Vekotin | 10:ff7cdaeb8b9a | 72 | if (p.y > 226 && p.y < 249) { |
| Vekotin | 10:ff7cdaeb8b9a | 73 | slider = -1638; |
| Vekotin | 10:ff7cdaeb8b9a | 74 | midi.write(MIDIMessage::PitchWheel(slider)); |
| MetropoliaMies | 4:76c054f8b97e | 75 | } |
| Vekotin | 10:ff7cdaeb8b9a | 76 | if (p.y > 249 && p.y < 272) { |
| Vekotin | 10:ff7cdaeb8b9a | 77 | slider = -3277; |
| Vekotin | 10:ff7cdaeb8b9a | 78 | midi.write(MIDIMessage::PitchWheel(slider)); |
| MetropoliaMies | 4:76c054f8b97e | 79 | } |
| Vekotin | 10:ff7cdaeb8b9a | 80 | if (p.y > 272 && p.y < 295) { |
| Vekotin | 10:ff7cdaeb8b9a | 81 | slider = -4915; |
| Vekotin | 10:ff7cdaeb8b9a | 82 | midi.write(MIDIMessage::PitchWheel(slider)); |
| MetropoliaMies | 4:76c054f8b97e | 83 | } |
| Vekotin | 10:ff7cdaeb8b9a | 84 | if (p.y > 295 && p.y < 318) { |
| Vekotin | 10:ff7cdaeb8b9a | 85 | slider = -8192; |
| Vekotin | 10:ff7cdaeb8b9a | 86 | midi.write(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 | if (p.x > 163 && p.x < 238) { //button 6 |
| MetropoliaMies | 4:76c054f8b97e | 94 | buttons(6, color); |
| MetropoliaMies | 4:76c054f8b97e | 95 | } |
| MetropoliaMies | 4:76c054f8b97e | 96 | } |
| MetropoliaMies | 4:76c054f8b97e | 97 | |
| MetropoliaMies | 4:76c054f8b97e | 98 | if (p.y > 243 && p.y < 318) { //ROW C |
| Vekotin | 10:ff7cdaeb8b9a | 99 | if (p.x > 83 && p.x < 158) { //Octave down |
| MetropoliaMies | 5:8e13103b41be | 100 | buttons(8, color); |
| Vekotin | 10:ff7cdaeb8b9a | 101 | Oct -= 12; |
| Vekotin | 10:ff7cdaeb8b9a | 102 | wait(1); |
| MetropoliaMies | 4:76c054f8b97e | 103 | } |
| MetropoliaMies | 5:8e13103b41be | 104 | if (p.x > 163 && p.x < 238) { //Octave up |
| MetropoliaMies | 4:76c054f8b97e | 105 | buttons(9, color); |
| Vekotin | 10:ff7cdaeb8b9a | 106 | Oct += 12; |
| Vekotin | 10:ff7cdaeb8b9a | 107 | wait(1); |
| MetropoliaMies | 4:76c054f8b97e | 108 | } |
| MetropoliaMies | 4:76c054f8b97e | 109 | } |
| MetropoliaMies | 4:76c054f8b97e | 110 | } |
| MetropoliaMies | 4:76c054f8b97e | 111 | |
| MetropoliaMies | 4:76c054f8b97e | 112 | |
| MetropoliaMies | 4:76c054f8b97e | 113 |
