Microcontroller

Dependencies:   TS_DISCO_F746NG mbed LCD_DISCO_F746NG BSP_DISCO_F746NG DISCO_F746NG_USBDevice

Committer:
noonsiee2
Date:
Thu May 23 15:57:48 2019 +0000
Revision:
0:06f32e106c93
micro

Who changed what in which revision?

UserRevisionLine numberNew contents of line
noonsiee2 0:06f32e106c93 1 #include "mbed.h"
noonsiee2 0:06f32e106c93 2 #include "USBMIDI.h"
noonsiee2 0:06f32e106c93 3 #include "TS_DISCO_F746NG.h"
noonsiee2 0:06f32e106c93 4 #include "LCD_DISCO_F746NG.h"
noonsiee2 0:06f32e106c93 5
noonsiee2 0:06f32e106c93 6 #define FastSpeedInterface 0
noonsiee2 0:06f32e106c93 7 #define HighSpeedInterface 1
noonsiee2 0:06f32e106c93 8 #define MAXRead 10
noonsiee2 0:06f32e106c93 9
noonsiee2 0:06f32e106c93 10 void PL1(void);
noonsiee2 0:06f32e106c93 11
noonsiee2 0:06f32e106c93 12 Serial pc(USBTX, USBRX);
noonsiee2 0:06f32e106c93 13 Timeout TU1;
noonsiee2 0:06f32e106c93 14
noonsiee2 0:06f32e106c93 15 TS_DISCO_F746NG ts;
noonsiee2 0:06f32e106c93 16 LCD_DISCO_F746NG lcd;
noonsiee2 0:06f32e106c93 17
noonsiee2 0:06f32e106c93 18 USBMIDI midi(HighSpeedInterface);
noonsiee2 0:06f32e106c93 19
noonsiee2 0:06f32e106c93 20 DigitalIn I0(D0);
noonsiee2 0:06f32e106c93 21 DigitalIn I1(D1);
noonsiee2 0:06f32e106c93 22 DigitalIn I2(D2);
noonsiee2 0:06f32e106c93 23 DigitalIn I3(D3);
noonsiee2 0:06f32e106c93 24 DigitalIn I4(D4);
noonsiee2 0:06f32e106c93 25 DigitalIn I5(D5);
noonsiee2 0:06f32e106c93 26 DigitalIn I6(D6);
noonsiee2 0:06f32e106c93 27 DigitalIn I7(D7);
noonsiee2 0:06f32e106c93 28
noonsiee2 0:06f32e106c93 29 DigitalOut L8(D8);
noonsiee2 0:06f32e106c93 30 DigitalOut L9(D9);
noonsiee2 0:06f32e106c93 31 DigitalOut L10(D10);
noonsiee2 0:06f32e106c93 32 DigitalOut L11(D11);
noonsiee2 0:06f32e106c93 33 DigitalOut L12(D12);
noonsiee2 0:06f32e106c93 34 DigitalOut L13(D13);
noonsiee2 0:06f32e106c93 35 DigitalOut L14(D14);
noonsiee2 0:06f32e106c93 36 DigitalOut L15(D15);
noonsiee2 0:06f32e106c93 37
noonsiee2 0:06f32e106c93 38 AnalogIn Ain(A0);
noonsiee2 0:06f32e106c93 39
noonsiee2 0:06f32e106c93 40 int XA[8];
noonsiee2 0:06f32e106c93 41 int XB[8];
noonsiee2 0:06f32e106c93 42 int XC[8];
noonsiee2 0:06f32e106c93 43 int XD[8];
noonsiee2 0:06f32e106c93 44 int XE[8];
noonsiee2 0:06f32e106c93 45 int XF[8];
noonsiee2 0:06f32e106c93 46 int XG[8];
noonsiee2 0:06f32e106c93 47 int XH[8];
noonsiee2 0:06f32e106c93 48
noonsiee2 0:06f32e106c93 49 float tempo=120;
noonsiee2 0:06f32e106c93 50 int Xtap=0;
noonsiee2 0:06f32e106c93 51 float Af;
noonsiee2 0:06f32e106c93 52
noonsiee2 0:06f32e106c93 53 int main()
noonsiee2 0:06f32e106c93 54 {
noonsiee2 0:06f32e106c93 55 pc.baud(9600);
noonsiee2 0:06f32e106c93 56 pc.format(8, SerialBase::None, 1);
noonsiee2 0:06f32e106c93 57
noonsiee2 0:06f32e106c93 58 TS_StateTypeDef TS_State;
noonsiee2 0:06f32e106c93 59
noonsiee2 0:06f32e106c93 60 char str[50];
noonsiee2 0:06f32e106c93 61
noonsiee2 0:06f32e106c93 62 TU1.attach(&PL1, 0.5);
noonsiee2 0:06f32e106c93 63 TU1.detach();
noonsiee2 0:06f32e106c93 64
noonsiee2 0:06f32e106c93 65 lcd.Clear(LCD_COLOR_GRAY);
noonsiee2 0:06f32e106c93 66 lcd.SetBackColor (LCD_COLOR_GRAY);
noonsiee2 0:06f32e106c93 67 lcd.SetTextColor (LCD_COLOR_BLACK);
noonsiee2 0:06f32e106c93 68 lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"Sequencer", CENTER_MODE);
noonsiee2 0:06f32e106c93 69
noonsiee2 0:06f32e106c93 70 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 71 lcd.DrawRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 72 lcd.FillRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 73 lcd.DrawRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 74 lcd.FillRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 75 lcd.DrawRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 76 lcd.FillRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 77 lcd.DrawRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 78 lcd.FillRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 79 lcd.DrawRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 80 lcd.FillRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 81 lcd.DrawRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 82 lcd.FillRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 83 lcd.DrawRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 84 lcd.FillRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 85
noonsiee2 0:06f32e106c93 86 LOOP:while(1){
noonsiee2 0:06f32e106c93 87 Af = Ain.read();
noonsiee2 0:06f32e106c93 88 for(int i=0; i<MAXRead-1; i++){
noonsiee2 0:06f32e106c93 89 Af += Ain.read();
noonsiee2 0:06f32e106c93 90 }
noonsiee2 0:06f32e106c93 91 Af /= MAXRead;
noonsiee2 0:06f32e106c93 92
noonsiee2 0:06f32e106c93 93 ts.GetState(&TS_State);
noonsiee2 0:06f32e106c93 94
noonsiee2 0:06f32e106c93 95 sprintf(str, "Up %.f Down",tempo);
noonsiee2 0:06f32e106c93 96 lcd.DisplayStringAt(0, LINE(10), (uint8_t *)str, LEFT_MODE);
noonsiee2 0:06f32e106c93 97
noonsiee2 0:06f32e106c93 98 lcd.SetTextColor (LCD_COLOR_DARKGREEN);
noonsiee2 0:06f32e106c93 99 lcd.DisplayStringAt(0, LINE(10), (uint8_t *)" PAUSE PLAY ", RIGHT_MODE);
noonsiee2 0:06f32e106c93 100
noonsiee2 0:06f32e106c93 101 if (Xtap == 0){
noonsiee2 0:06f32e106c93 102 lcd.SetTextColor (LCD_COLOR_BLUE);
noonsiee2 0:06f32e106c93 103 lcd.DrawRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 104 lcd.FillRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 105 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 106 lcd.DrawRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 107 lcd.FillRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 108 lcd.DrawRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 109 lcd.FillRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 110 lcd.DrawRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 111 lcd.FillRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 112 lcd.DrawRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 113 lcd.FillRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 114 lcd.DrawRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 115 lcd.FillRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 116 lcd.DrawRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 117 lcd.FillRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 118 }
noonsiee2 0:06f32e106c93 119 if (Xtap == 1){
noonsiee2 0:06f32e106c93 120 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 121 lcd.DrawRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 122 lcd.FillRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 123 lcd.SetTextColor (LCD_COLOR_BLUE);
noonsiee2 0:06f32e106c93 124 lcd.DrawRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 125 lcd.FillRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 126 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 127 lcd.DrawRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 128 lcd.FillRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 129 lcd.DrawRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 130 lcd.FillRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 131 lcd.DrawRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 132 lcd.FillRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 133 lcd.DrawRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 134 lcd.FillRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 135 lcd.DrawRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 136 lcd.FillRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 137 }
noonsiee2 0:06f32e106c93 138 if (Xtap == 2){
noonsiee2 0:06f32e106c93 139 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 140 lcd.DrawRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 141 lcd.FillRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 142 lcd.DrawRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 143 lcd.FillRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 144 lcd.SetTextColor (LCD_COLOR_BLUE);
noonsiee2 0:06f32e106c93 145 lcd.DrawRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 146 lcd.FillRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 147 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 148 lcd.DrawRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 149 lcd.FillRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 150 lcd.DrawRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 151 lcd.FillRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 152 lcd.DrawRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 153 lcd.FillRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 154 lcd.DrawRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 155 lcd.FillRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 156 }
noonsiee2 0:06f32e106c93 157 if (Xtap == 3){
noonsiee2 0:06f32e106c93 158 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 159 lcd.DrawRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 160 lcd.FillRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 161 lcd.DrawRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 162 lcd.FillRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 163 lcd.DrawRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 164 lcd.FillRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 165 lcd.SetTextColor (LCD_COLOR_BLUE);
noonsiee2 0:06f32e106c93 166 lcd.DrawRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 167 lcd.FillRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 168 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 169 lcd.DrawRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 170 lcd.FillRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 171 lcd.DrawRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 172 lcd.FillRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 173 lcd.DrawRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 174 lcd.FillRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 175 }
noonsiee2 0:06f32e106c93 176 if (Xtap == 4){
noonsiee2 0:06f32e106c93 177 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 178 lcd.DrawRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 179 lcd.FillRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 180 lcd.DrawRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 181 lcd.FillRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 182 lcd.DrawRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 183 lcd.FillRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 184 lcd.DrawRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 185 lcd.FillRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 186 lcd.SetTextColor (LCD_COLOR_BLUE);
noonsiee2 0:06f32e106c93 187 lcd.DrawRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 188 lcd.FillRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 189 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 190 lcd.DrawRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 191 lcd.FillRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 192 lcd.DrawRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 193 lcd.FillRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 194 }
noonsiee2 0:06f32e106c93 195 if (Xtap == 5){
noonsiee2 0:06f32e106c93 196 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 197 lcd.DrawRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 198 lcd.FillRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 199 lcd.DrawRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 200 lcd.FillRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 201 lcd.DrawRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 202 lcd.FillRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 203 lcd.DrawRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 204 lcd.FillRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 205 lcd.DrawRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 206 lcd.FillRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 207 lcd.SetTextColor (LCD_COLOR_BLUE);
noonsiee2 0:06f32e106c93 208 lcd.DrawRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 209 lcd.FillRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 210 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 211 lcd.DrawRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 212 lcd.FillRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 213 }
noonsiee2 0:06f32e106c93 214 if (Xtap == 6){
noonsiee2 0:06f32e106c93 215 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 216 lcd.DrawRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 217 lcd.FillRect( 30, 80, 50, 120);
noonsiee2 0:06f32e106c93 218 lcd.DrawRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 219 lcd.FillRect( 90, 80, 50, 120);
noonsiee2 0:06f32e106c93 220 lcd.DrawRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 221 lcd.FillRect( 150, 80, 50, 120);
noonsiee2 0:06f32e106c93 222 lcd.DrawRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 223 lcd.FillRect( 210, 80, 50, 120);
noonsiee2 0:06f32e106c93 224 lcd.DrawRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 225 lcd.FillRect( 270, 80, 50, 120);
noonsiee2 0:06f32e106c93 226 lcd.DrawRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 227 lcd.FillRect( 330, 80, 50, 120);
noonsiee2 0:06f32e106c93 228 lcd.SetTextColor (LCD_COLOR_BLUE);
noonsiee2 0:06f32e106c93 229 lcd.DrawRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 230 lcd.FillRect( 390, 80, 50, 120);
noonsiee2 0:06f32e106c93 231 lcd.SetTextColor (LCD_COLOR_DARKGRAY);
noonsiee2 0:06f32e106c93 232 }
noonsiee2 0:06f32e106c93 233
noonsiee2 0:06f32e106c93 234 if (I0 == 1) {
noonsiee2 0:06f32e106c93 235 }
noonsiee2 0:06f32e106c93 236 if (I0 == 0) {
noonsiee2 0:06f32e106c93 237 if (XA[Xtap] == 0){
noonsiee2 0:06f32e106c93 238 XA[Xtap] = 1;
noonsiee2 0:06f32e106c93 239 }
noonsiee2 0:06f32e106c93 240 else {
noonsiee2 0:06f32e106c93 241 XA[Xtap] = 0;
noonsiee2 0:06f32e106c93 242 }
noonsiee2 0:06f32e106c93 243 wait_ms(300);
noonsiee2 0:06f32e106c93 244 }
noonsiee2 0:06f32e106c93 245 if (I1 == 1) {
noonsiee2 0:06f32e106c93 246 }
noonsiee2 0:06f32e106c93 247 if (I1 == 0) {
noonsiee2 0:06f32e106c93 248 if (XB[Xtap] == 0){
noonsiee2 0:06f32e106c93 249 XB[Xtap] = 1;
noonsiee2 0:06f32e106c93 250 }
noonsiee2 0:06f32e106c93 251 else {
noonsiee2 0:06f32e106c93 252 XB[Xtap] = 0;
noonsiee2 0:06f32e106c93 253 }
noonsiee2 0:06f32e106c93 254 wait_ms(300);
noonsiee2 0:06f32e106c93 255 }
noonsiee2 0:06f32e106c93 256 if (I2 == 1) {
noonsiee2 0:06f32e106c93 257 }
noonsiee2 0:06f32e106c93 258 if (I2 == 0) {
noonsiee2 0:06f32e106c93 259 if (XC[Xtap] == 0){
noonsiee2 0:06f32e106c93 260 XC[Xtap] = 1;
noonsiee2 0:06f32e106c93 261 }
noonsiee2 0:06f32e106c93 262 else {
noonsiee2 0:06f32e106c93 263 XC[Xtap] = 0;
noonsiee2 0:06f32e106c93 264 }
noonsiee2 0:06f32e106c93 265 wait_ms(300);
noonsiee2 0:06f32e106c93 266 }
noonsiee2 0:06f32e106c93 267 if (I3 == 1) {
noonsiee2 0:06f32e106c93 268 }
noonsiee2 0:06f32e106c93 269 if (I3 == 0) {
noonsiee2 0:06f32e106c93 270 if (XD[Xtap] == 0){
noonsiee2 0:06f32e106c93 271 XD[Xtap] = 1;
noonsiee2 0:06f32e106c93 272 }
noonsiee2 0:06f32e106c93 273 else {
noonsiee2 0:06f32e106c93 274 XD[Xtap] = 0;
noonsiee2 0:06f32e106c93 275 }
noonsiee2 0:06f32e106c93 276 wait_ms(300);
noonsiee2 0:06f32e106c93 277 }
noonsiee2 0:06f32e106c93 278 if (I4 == 1) {
noonsiee2 0:06f32e106c93 279 }
noonsiee2 0:06f32e106c93 280 if (I4 == 0) {
noonsiee2 0:06f32e106c93 281 if (XE[Xtap] == 0){
noonsiee2 0:06f32e106c93 282 XE[Xtap] = 1;
noonsiee2 0:06f32e106c93 283 }
noonsiee2 0:06f32e106c93 284 else {
noonsiee2 0:06f32e106c93 285 XE[Xtap] = 0;
noonsiee2 0:06f32e106c93 286 }
noonsiee2 0:06f32e106c93 287 wait_ms(300);
noonsiee2 0:06f32e106c93 288 }
noonsiee2 0:06f32e106c93 289 if (I5 == 1) {
noonsiee2 0:06f32e106c93 290 }
noonsiee2 0:06f32e106c93 291 if (I5 == 0) {
noonsiee2 0:06f32e106c93 292 if (XF[Xtap] == 0){
noonsiee2 0:06f32e106c93 293 XF[Xtap] = 1;
noonsiee2 0:06f32e106c93 294 }
noonsiee2 0:06f32e106c93 295 else {
noonsiee2 0:06f32e106c93 296 XF[Xtap] = 0;
noonsiee2 0:06f32e106c93 297 }
noonsiee2 0:06f32e106c93 298 wait_ms(300);
noonsiee2 0:06f32e106c93 299 }
noonsiee2 0:06f32e106c93 300 if (I6 == 1) {
noonsiee2 0:06f32e106c93 301 }
noonsiee2 0:06f32e106c93 302 if (I6 == 0) {
noonsiee2 0:06f32e106c93 303 if (XG[Xtap] == 0){
noonsiee2 0:06f32e106c93 304 XG[Xtap] = 1;
noonsiee2 0:06f32e106c93 305 }
noonsiee2 0:06f32e106c93 306 else {
noonsiee2 0:06f32e106c93 307 XG[Xtap] = 0;
noonsiee2 0:06f32e106c93 308 }
noonsiee2 0:06f32e106c93 309 wait_ms(300);
noonsiee2 0:06f32e106c93 310 }
noonsiee2 0:06f32e106c93 311 if (I7 == 1) {
noonsiee2 0:06f32e106c93 312 }
noonsiee2 0:06f32e106c93 313 if (I7 == 0) {
noonsiee2 0:06f32e106c93 314 if (XH[Xtap] == 0){
noonsiee2 0:06f32e106c93 315 XH[Xtap] = 1;
noonsiee2 0:06f32e106c93 316 }
noonsiee2 0:06f32e106c93 317 else {
noonsiee2 0:06f32e106c93 318 XH[Xtap] = 0;
noonsiee2 0:06f32e106c93 319 }
noonsiee2 0:06f32e106c93 320 wait_ms(300);
noonsiee2 0:06f32e106c93 321 }
noonsiee2 0:06f32e106c93 322
noonsiee2 0:06f32e106c93 323 if (XA[Xtap]==0){
noonsiee2 0:06f32e106c93 324 L8 = 0;
noonsiee2 0:06f32e106c93 325 }
noonsiee2 0:06f32e106c93 326 if (XA[Xtap]==1){
noonsiee2 0:06f32e106c93 327 L8 = 1;
noonsiee2 0:06f32e106c93 328 }
noonsiee2 0:06f32e106c93 329 if (XB[Xtap]==0){
noonsiee2 0:06f32e106c93 330 L9 = 0;
noonsiee2 0:06f32e106c93 331 }
noonsiee2 0:06f32e106c93 332 if (XB[Xtap]==1){
noonsiee2 0:06f32e106c93 333 L9 = 1;
noonsiee2 0:06f32e106c93 334 }
noonsiee2 0:06f32e106c93 335 if (XC[Xtap]==0){
noonsiee2 0:06f32e106c93 336 L10 = 0;
noonsiee2 0:06f32e106c93 337 }
noonsiee2 0:06f32e106c93 338 if (XC[Xtap]==1){
noonsiee2 0:06f32e106c93 339 L10 = 1;
noonsiee2 0:06f32e106c93 340 }
noonsiee2 0:06f32e106c93 341 if (XD[Xtap]==0){
noonsiee2 0:06f32e106c93 342 L11 = 0;
noonsiee2 0:06f32e106c93 343 }
noonsiee2 0:06f32e106c93 344 if (XD[Xtap]==1){
noonsiee2 0:06f32e106c93 345 L11 = 1;
noonsiee2 0:06f32e106c93 346 }
noonsiee2 0:06f32e106c93 347 if (XE[Xtap]==0){
noonsiee2 0:06f32e106c93 348 L12 = 0;
noonsiee2 0:06f32e106c93 349 }
noonsiee2 0:06f32e106c93 350 if (XE[Xtap]==1){
noonsiee2 0:06f32e106c93 351 L12 = 1;
noonsiee2 0:06f32e106c93 352 }
noonsiee2 0:06f32e106c93 353 if (XF[Xtap]==0){
noonsiee2 0:06f32e106c93 354 L13 = 0;
noonsiee2 0:06f32e106c93 355 }
noonsiee2 0:06f32e106c93 356 if (XF[Xtap]==1){
noonsiee2 0:06f32e106c93 357 L13 = 1;
noonsiee2 0:06f32e106c93 358 }
noonsiee2 0:06f32e106c93 359 if (XG[Xtap]==0){
noonsiee2 0:06f32e106c93 360 L14 = 0;
noonsiee2 0:06f32e106c93 361 }
noonsiee2 0:06f32e106c93 362 if (XG[Xtap]==1){
noonsiee2 0:06f32e106c93 363 L14 = 1;
noonsiee2 0:06f32e106c93 364 }
noonsiee2 0:06f32e106c93 365 if (XH[Xtap]==0){
noonsiee2 0:06f32e106c93 366 L15 = 0;
noonsiee2 0:06f32e106c93 367 }
noonsiee2 0:06f32e106c93 368 if (XH[Xtap]==1){
noonsiee2 0:06f32e106c93 369 L15 = 1;
noonsiee2 0:06f32e106c93 370 }
noonsiee2 0:06f32e106c93 371
noonsiee2 0:06f32e106c93 372 if((TS_State.touchDetected))
noonsiee2 0:06f32e106c93 373 {
noonsiee2 0:06f32e106c93 374 if(TS_State.touchX[0]>=30&&TS_State.touchX[0]<=80&&TS_State.touchY[0]>=80&&TS_State.touchY[0]<=200)
noonsiee2 0:06f32e106c93 375 {
noonsiee2 0:06f32e106c93 376 Xtap = 0;
noonsiee2 0:06f32e106c93 377 }
noonsiee2 0:06f32e106c93 378 else if(TS_State.touchX[0]>=90&&TS_State.touchX[0]<=140&&TS_State.touchY[0]>=80&&TS_State.touchY[0]<=200)
noonsiee2 0:06f32e106c93 379 {
noonsiee2 0:06f32e106c93 380 Xtap = 1;
noonsiee2 0:06f32e106c93 381 }
noonsiee2 0:06f32e106c93 382 else if(TS_State.touchX[0]>=150&&TS_State.touchX[0]<=200&&TS_State.touchY[0]>=80&&TS_State.touchY[0]<=200)
noonsiee2 0:06f32e106c93 383 {
noonsiee2 0:06f32e106c93 384 Xtap = 2;
noonsiee2 0:06f32e106c93 385 }
noonsiee2 0:06f32e106c93 386 else if(TS_State.touchX[0]>=210&&TS_State.touchX[0]<=260&&TS_State.touchY[0]>=80&&TS_State.touchY[0]<=200)
noonsiee2 0:06f32e106c93 387 {
noonsiee2 0:06f32e106c93 388 Xtap = 3;
noonsiee2 0:06f32e106c93 389 }
noonsiee2 0:06f32e106c93 390 else if(TS_State.touchX[0]>=270&&TS_State.touchX[0]<=320&&TS_State.touchY[0]>=80&&TS_State.touchY[0]<=200)
noonsiee2 0:06f32e106c93 391 {
noonsiee2 0:06f32e106c93 392 Xtap = 4;
noonsiee2 0:06f32e106c93 393 }else if(TS_State.touchX[0]>=330&&TS_State.touchX[0]<=380&&TS_State.touchY[0]>=80&&TS_State.touchY[0]<=200)
noonsiee2 0:06f32e106c93 394 {
noonsiee2 0:06f32e106c93 395 Xtap = 5;
noonsiee2 0:06f32e106c93 396 }else if(TS_State.touchX[0]>=390&&TS_State.touchX[0]<=440&&TS_State.touchY[0]>=80&&TS_State.touchY[0]<=200)
noonsiee2 0:06f32e106c93 397 {
noonsiee2 0:06f32e106c93 398 Xtap = 6;
noonsiee2 0:06f32e106c93 399 }
noonsiee2 0:06f32e106c93 400 else if(TS_State.touchX[0]>=1&&TS_State.touchX[0]<=40&&TS_State.touchY[0]>=230&&TS_State.touchY[0]<=270)
noonsiee2 0:06f32e106c93 401 {
noonsiee2 0:06f32e106c93 402 tempo++;
noonsiee2 0:06f32e106c93 403 }
noonsiee2 0:06f32e106c93 404 else if(TS_State.touchX[0]>=130&&TS_State.touchX[0]<=210&&TS_State.touchY[0]>=230&&TS_State.touchY[0]<=270)
noonsiee2 0:06f32e106c93 405 {
noonsiee2 0:06f32e106c93 406 tempo--;
noonsiee2 0:06f32e106c93 407 }
noonsiee2 0:06f32e106c93 408 else if(TS_State.touchX[0]>=340&&TS_State.touchX[0]<=440&&TS_State.touchY[0]>=230&&TS_State.touchY[0]<=270)
noonsiee2 0:06f32e106c93 409 {
noonsiee2 0:06f32e106c93 410 goto LOOP2;
noonsiee2 0:06f32e106c93 411 }
noonsiee2 0:06f32e106c93 412 wait_ms(400);
noonsiee2 0:06f32e106c93 413 }
noonsiee2 0:06f32e106c93 414 }
noonsiee2 0:06f32e106c93 415 LOOP2:while (1){
noonsiee2 0:06f32e106c93 416 Af = Ain.read();
noonsiee2 0:06f32e106c93 417 for(int i=0; i<MAXRead-1; i++){
noonsiee2 0:06f32e106c93 418 Af += Ain.read();
noonsiee2 0:06f32e106c93 419 }
noonsiee2 0:06f32e106c93 420 Af /= MAXRead;
noonsiee2 0:06f32e106c93 421
noonsiee2 0:06f32e106c93 422 ts.GetState(&TS_State);
noonsiee2 0:06f32e106c93 423
noonsiee2 0:06f32e106c93 424 lcd.SetTextColor (LCD_COLOR_DARKRED);
noonsiee2 0:06f32e106c93 425 lcd.DisplayStringAt(0, LINE(10), (uint8_t *)" PAUSE PLAY ", RIGHT_MODE);
noonsiee2 0:06f32e106c93 426
noonsiee2 0:06f32e106c93 427 if((TS_State.touchDetected))
noonsiee2 0:06f32e106c93 428 {
noonsiee2 0:06f32e106c93 429 if(TS_State.touchX[0]>=260&&TS_State.touchX[0]<=330&&TS_State.touchY[0]>=230&&TS_State.touchY[0]<=270)
noonsiee2 0:06f32e106c93 430 {
noonsiee2 0:06f32e106c93 431 goto LOOP;
noonsiee2 0:06f32e106c93 432 }
noonsiee2 0:06f32e106c93 433 }
noonsiee2 0:06f32e106c93 434 else{}
noonsiee2 0:06f32e106c93 435
noonsiee2 0:06f32e106c93 436 midi.write(MIDIMessage::AllNotesOff(0));
noonsiee2 0:06f32e106c93 437 if (XA[0] == 1){
noonsiee2 0:06f32e106c93 438 midi.write(MIDIMessage::NoteOn(36,127*Af));
noonsiee2 0:06f32e106c93 439 }
noonsiee2 0:06f32e106c93 440 else{}
noonsiee2 0:06f32e106c93 441
noonsiee2 0:06f32e106c93 442 if (XA[1] == 1){
noonsiee2 0:06f32e106c93 443 midi.write(MIDIMessage::NoteOn(38,127*Af));
noonsiee2 0:06f32e106c93 444 }
noonsiee2 0:06f32e106c93 445 else{}
noonsiee2 0:06f32e106c93 446
noonsiee2 0:06f32e106c93 447 if (XA[2] == 1){
noonsiee2 0:06f32e106c93 448 midi.write(MIDIMessage::NoteOn(39,127*Af));
noonsiee2 0:06f32e106c93 449 }
noonsiee2 0:06f32e106c93 450 else{}
noonsiee2 0:06f32e106c93 451
noonsiee2 0:06f32e106c93 452 if (XA[3] == 1){
noonsiee2 0:06f32e106c93 453 midi.write(MIDIMessage::NoteOn(44,127*Af));
noonsiee2 0:06f32e106c93 454 }
noonsiee2 0:06f32e106c93 455
noonsiee2 0:06f32e106c93 456 else{}
noonsiee2 0:06f32e106c93 457 if (XA[4] == 1){
noonsiee2 0:06f32e106c93 458 midi.write(MIDIMessage::NoteOn(46,127*Af));
noonsiee2 0:06f32e106c93 459 }
noonsiee2 0:06f32e106c93 460 else{}
noonsiee2 0:06f32e106c93 461
noonsiee2 0:06f32e106c93 462 if (XA[5] == 1){
noonsiee2 0:06f32e106c93 463 midi.write(MIDIMessage::NoteOn(50,127*Af));
noonsiee2 0:06f32e106c93 464 }
noonsiee2 0:06f32e106c93 465 else{}
noonsiee2 0:06f32e106c93 466
noonsiee2 0:06f32e106c93 467 if (XA[6] == 1){
noonsiee2 0:06f32e106c93 468 midi.write(MIDIMessage::NoteOn(52,127*Af));
noonsiee2 0:06f32e106c93 469 }
noonsiee2 0:06f32e106c93 470 else{}
noonsiee2 0:06f32e106c93 471
noonsiee2 0:06f32e106c93 472 wait(30/tempo);
noonsiee2 0:06f32e106c93 473 midi.write(MIDIMessage::AllNotesOff(0));
noonsiee2 0:06f32e106c93 474
noonsiee2 0:06f32e106c93 475 if((TS_State.touchDetected))
noonsiee2 0:06f32e106c93 476 {
noonsiee2 0:06f32e106c93 477 if(TS_State.touchX[0]>=260&&TS_State.touchX[0]<=330&&TS_State.touchY[0]>=230&&TS_State.touchY[0]<=270)
noonsiee2 0:06f32e106c93 478 {
noonsiee2 0:06f32e106c93 479 goto LOOP;
noonsiee2 0:06f32e106c93 480 }
noonsiee2 0:06f32e106c93 481 }
noonsiee2 0:06f32e106c93 482 else{}
noonsiee2 0:06f32e106c93 483
noonsiee2 0:06f32e106c93 484 if (XB[0] == 1){
noonsiee2 0:06f32e106c93 485 midi.write(MIDIMessage::NoteOn(36));
noonsiee2 0:06f32e106c93 486 }
noonsiee2 0:06f32e106c93 487 else{}
noonsiee2 0:06f32e106c93 488
noonsiee2 0:06f32e106c93 489 if (XB[1] == 1){
noonsiee2 0:06f32e106c93 490 midi.write(MIDIMessage::NoteOn(38,127*Af));
noonsiee2 0:06f32e106c93 491 }
noonsiee2 0:06f32e106c93 492 else{}
noonsiee2 0:06f32e106c93 493
noonsiee2 0:06f32e106c93 494 if (XB[2] == 1){
noonsiee2 0:06f32e106c93 495 midi.write(MIDIMessage::NoteOn(39,127*Af));
noonsiee2 0:06f32e106c93 496 }
noonsiee2 0:06f32e106c93 497 else{}
noonsiee2 0:06f32e106c93 498
noonsiee2 0:06f32e106c93 499 if (XB[3] == 1){
noonsiee2 0:06f32e106c93 500 midi.write(MIDIMessage::NoteOn(44,127*Af));
noonsiee2 0:06f32e106c93 501 }
noonsiee2 0:06f32e106c93 502 else{}
noonsiee2 0:06f32e106c93 503
noonsiee2 0:06f32e106c93 504 if (XB[4] == 1){
noonsiee2 0:06f32e106c93 505 midi.write(MIDIMessage::NoteOn(46,127*Af));
noonsiee2 0:06f32e106c93 506 }
noonsiee2 0:06f32e106c93 507 else{}
noonsiee2 0:06f32e106c93 508
noonsiee2 0:06f32e106c93 509 if (XB[5] == 1){
noonsiee2 0:06f32e106c93 510 midi.write(MIDIMessage::NoteOn(50,127*Af));
noonsiee2 0:06f32e106c93 511 }
noonsiee2 0:06f32e106c93 512 else{}
noonsiee2 0:06f32e106c93 513
noonsiee2 0:06f32e106c93 514 if (XB[6] == 1){
noonsiee2 0:06f32e106c93 515 midi.write(MIDIMessage::NoteOn(52,127*Af));
noonsiee2 0:06f32e106c93 516 }
noonsiee2 0:06f32e106c93 517 else{}
noonsiee2 0:06f32e106c93 518
noonsiee2 0:06f32e106c93 519 wait(30/tempo);
noonsiee2 0:06f32e106c93 520 midi.write(MIDIMessage::AllNotesOff(0));
noonsiee2 0:06f32e106c93 521
noonsiee2 0:06f32e106c93 522 if((TS_State.touchDetected))
noonsiee2 0:06f32e106c93 523 {
noonsiee2 0:06f32e106c93 524 if(TS_State.touchX[0]>=260&&TS_State.touchX[0]<=330&&TS_State.touchY[0]>=230&&TS_State.touchY[0]<=270)
noonsiee2 0:06f32e106c93 525 {
noonsiee2 0:06f32e106c93 526 goto LOOP;
noonsiee2 0:06f32e106c93 527 }
noonsiee2 0:06f32e106c93 528 }
noonsiee2 0:06f32e106c93 529 else{}
noonsiee2 0:06f32e106c93 530
noonsiee2 0:06f32e106c93 531 if (XC[0] == 1){
noonsiee2 0:06f32e106c93 532 midi.write(MIDIMessage::NoteOn(36,127*Af));
noonsiee2 0:06f32e106c93 533 }
noonsiee2 0:06f32e106c93 534 else{}
noonsiee2 0:06f32e106c93 535
noonsiee2 0:06f32e106c93 536 if (XC[1] == 1){
noonsiee2 0:06f32e106c93 537 midi.write(MIDIMessage::NoteOn(38,127*Af));
noonsiee2 0:06f32e106c93 538 }
noonsiee2 0:06f32e106c93 539 else{}
noonsiee2 0:06f32e106c93 540
noonsiee2 0:06f32e106c93 541 if (XC[2] == 1){
noonsiee2 0:06f32e106c93 542 midi.write(MIDIMessage::NoteOn(39,127*Af));
noonsiee2 0:06f32e106c93 543 }
noonsiee2 0:06f32e106c93 544 else{}
noonsiee2 0:06f32e106c93 545
noonsiee2 0:06f32e106c93 546 if (XC[3] == 1){
noonsiee2 0:06f32e106c93 547 midi.write(MIDIMessage::NoteOn(44,127*Af));
noonsiee2 0:06f32e106c93 548 }
noonsiee2 0:06f32e106c93 549 else{}
noonsiee2 0:06f32e106c93 550
noonsiee2 0:06f32e106c93 551 if (XC[4] == 1){
noonsiee2 0:06f32e106c93 552 midi.write(MIDIMessage::NoteOn(46,127*Af));
noonsiee2 0:06f32e106c93 553 }
noonsiee2 0:06f32e106c93 554 else{}
noonsiee2 0:06f32e106c93 555
noonsiee2 0:06f32e106c93 556 if (XC[5] == 1){
noonsiee2 0:06f32e106c93 557 midi.write(MIDIMessage::NoteOn(50,127*Af));
noonsiee2 0:06f32e106c93 558 }
noonsiee2 0:06f32e106c93 559 else{}
noonsiee2 0:06f32e106c93 560
noonsiee2 0:06f32e106c93 561 if (XC[6] == 1){
noonsiee2 0:06f32e106c93 562 midi.write(MIDIMessage::NoteOn(52,127*Af));
noonsiee2 0:06f32e106c93 563 }
noonsiee2 0:06f32e106c93 564 else{}
noonsiee2 0:06f32e106c93 565
noonsiee2 0:06f32e106c93 566 wait(30/tempo);
noonsiee2 0:06f32e106c93 567 midi.write(MIDIMessage::AllNotesOff(0));
noonsiee2 0:06f32e106c93 568
noonsiee2 0:06f32e106c93 569 if((TS_State.touchDetected))
noonsiee2 0:06f32e106c93 570 {
noonsiee2 0:06f32e106c93 571 if(TS_State.touchX[0]>=260&&TS_State.touchX[0]<=330&&TS_State.touchY[0]>=230&&TS_State.touchY[0]<=270)
noonsiee2 0:06f32e106c93 572 {
noonsiee2 0:06f32e106c93 573 goto LOOP;
noonsiee2 0:06f32e106c93 574 }
noonsiee2 0:06f32e106c93 575 }
noonsiee2 0:06f32e106c93 576 else{}
noonsiee2 0:06f32e106c93 577
noonsiee2 0:06f32e106c93 578 if (XD[0] == 1){
noonsiee2 0:06f32e106c93 579 midi.write(MIDIMessage::NoteOn(36,127*Af));
noonsiee2 0:06f32e106c93 580 }
noonsiee2 0:06f32e106c93 581 else{}
noonsiee2 0:06f32e106c93 582
noonsiee2 0:06f32e106c93 583 if (XD[1] == 1){
noonsiee2 0:06f32e106c93 584 midi.write(MIDIMessage::NoteOn(38,127*Af));
noonsiee2 0:06f32e106c93 585 }
noonsiee2 0:06f32e106c93 586 else{}
noonsiee2 0:06f32e106c93 587
noonsiee2 0:06f32e106c93 588 if (XD[2] == 1){
noonsiee2 0:06f32e106c93 589 midi.write(MIDIMessage::NoteOn(39,127*Af));
noonsiee2 0:06f32e106c93 590 }
noonsiee2 0:06f32e106c93 591 else{}
noonsiee2 0:06f32e106c93 592
noonsiee2 0:06f32e106c93 593 if (XD[3] == 1){
noonsiee2 0:06f32e106c93 594 midi.write(MIDIMessage::NoteOn(44,127*Af));
noonsiee2 0:06f32e106c93 595 }
noonsiee2 0:06f32e106c93 596 else{}
noonsiee2 0:06f32e106c93 597
noonsiee2 0:06f32e106c93 598 if (XD[4] == 1){
noonsiee2 0:06f32e106c93 599 midi.write(MIDIMessage::NoteOn(46,127*Af));
noonsiee2 0:06f32e106c93 600 }
noonsiee2 0:06f32e106c93 601 else{}
noonsiee2 0:06f32e106c93 602
noonsiee2 0:06f32e106c93 603 if (XD[5] == 1){
noonsiee2 0:06f32e106c93 604 midi.write(MIDIMessage::NoteOn(50,127*Af));
noonsiee2 0:06f32e106c93 605 }
noonsiee2 0:06f32e106c93 606 else{}
noonsiee2 0:06f32e106c93 607
noonsiee2 0:06f32e106c93 608 if (XD[6] == 1){
noonsiee2 0:06f32e106c93 609 midi.write(MIDIMessage::NoteOn(52,127*Af));
noonsiee2 0:06f32e106c93 610 }
noonsiee2 0:06f32e106c93 611 else{}
noonsiee2 0:06f32e106c93 612
noonsiee2 0:06f32e106c93 613 wait(30/tempo);
noonsiee2 0:06f32e106c93 614 midi.write(MIDIMessage::AllNotesOff(0));
noonsiee2 0:06f32e106c93 615
noonsiee2 0:06f32e106c93 616 if((TS_State.touchDetected))
noonsiee2 0:06f32e106c93 617 {
noonsiee2 0:06f32e106c93 618 if(TS_State.touchX[0]>=260&&TS_State.touchX[0]<=330&&TS_State.touchY[0]>=230&&TS_State.touchY[0]<=270)
noonsiee2 0:06f32e106c93 619 {
noonsiee2 0:06f32e106c93 620 goto LOOP;
noonsiee2 0:06f32e106c93 621 }
noonsiee2 0:06f32e106c93 622 }
noonsiee2 0:06f32e106c93 623 else{}
noonsiee2 0:06f32e106c93 624
noonsiee2 0:06f32e106c93 625 if (XE[0] == 1){
noonsiee2 0:06f32e106c93 626 midi.write(MIDIMessage::NoteOn(36,127*Af));
noonsiee2 0:06f32e106c93 627 }
noonsiee2 0:06f32e106c93 628 else{}
noonsiee2 0:06f32e106c93 629
noonsiee2 0:06f32e106c93 630 if (XE[1] == 1){
noonsiee2 0:06f32e106c93 631 midi.write(MIDIMessage::NoteOn(38,127*Af));
noonsiee2 0:06f32e106c93 632 }
noonsiee2 0:06f32e106c93 633 else{}
noonsiee2 0:06f32e106c93 634
noonsiee2 0:06f32e106c93 635 if (XE[2] == 1){
noonsiee2 0:06f32e106c93 636 midi.write(MIDIMessage::NoteOn(39,127*Af));
noonsiee2 0:06f32e106c93 637 }
noonsiee2 0:06f32e106c93 638 else{}
noonsiee2 0:06f32e106c93 639
noonsiee2 0:06f32e106c93 640 if (XE[3] == 1){
noonsiee2 0:06f32e106c93 641 midi.write(MIDIMessage::NoteOn(44,127*Af));
noonsiee2 0:06f32e106c93 642 }
noonsiee2 0:06f32e106c93 643 else{}
noonsiee2 0:06f32e106c93 644
noonsiee2 0:06f32e106c93 645 if (XE[4] == 1){
noonsiee2 0:06f32e106c93 646 midi.write(MIDIMessage::NoteOn(46,127*Af));
noonsiee2 0:06f32e106c93 647 }
noonsiee2 0:06f32e106c93 648 else{}
noonsiee2 0:06f32e106c93 649
noonsiee2 0:06f32e106c93 650 if (XE[5] == 1){
noonsiee2 0:06f32e106c93 651 midi.write(MIDIMessage::NoteOn(50,127*Af));
noonsiee2 0:06f32e106c93 652 }
noonsiee2 0:06f32e106c93 653 else{}
noonsiee2 0:06f32e106c93 654
noonsiee2 0:06f32e106c93 655 if (XE[6] == 1){
noonsiee2 0:06f32e106c93 656 midi.write(MIDIMessage::NoteOn(52,127*Af));
noonsiee2 0:06f32e106c93 657 }
noonsiee2 0:06f32e106c93 658 else{}
noonsiee2 0:06f32e106c93 659
noonsiee2 0:06f32e106c93 660 wait(30/tempo);
noonsiee2 0:06f32e106c93 661 midi.write(MIDIMessage::AllNotesOff(0));
noonsiee2 0:06f32e106c93 662
noonsiee2 0:06f32e106c93 663 if((TS_State.touchDetected))
noonsiee2 0:06f32e106c93 664 {
noonsiee2 0:06f32e106c93 665 if(TS_State.touchX[0]>=260&&TS_State.touchX[0]<=330&&TS_State.touchY[0]>=230&&TS_State.touchY[0]<=270)
noonsiee2 0:06f32e106c93 666 {
noonsiee2 0:06f32e106c93 667 goto LOOP;
noonsiee2 0:06f32e106c93 668 }
noonsiee2 0:06f32e106c93 669 }
noonsiee2 0:06f32e106c93 670 else{}
noonsiee2 0:06f32e106c93 671
noonsiee2 0:06f32e106c93 672 if (XF[0] == 1){
noonsiee2 0:06f32e106c93 673 midi.write(MIDIMessage::NoteOn(36,127*Af));
noonsiee2 0:06f32e106c93 674 }
noonsiee2 0:06f32e106c93 675 else{}
noonsiee2 0:06f32e106c93 676
noonsiee2 0:06f32e106c93 677 if (XF[1] == 1){
noonsiee2 0:06f32e106c93 678 midi.write(MIDIMessage::NoteOn(38,127*Af));
noonsiee2 0:06f32e106c93 679 }
noonsiee2 0:06f32e106c93 680 else{}
noonsiee2 0:06f32e106c93 681
noonsiee2 0:06f32e106c93 682 if (XF[2] == 1){
noonsiee2 0:06f32e106c93 683 midi.write(MIDIMessage::NoteOn(39,127*Af));
noonsiee2 0:06f32e106c93 684 }
noonsiee2 0:06f32e106c93 685 else{}
noonsiee2 0:06f32e106c93 686
noonsiee2 0:06f32e106c93 687 if (XF[3] == 1){
noonsiee2 0:06f32e106c93 688 midi.write(MIDIMessage::NoteOn(44,127*Af));
noonsiee2 0:06f32e106c93 689 }
noonsiee2 0:06f32e106c93 690 else{}
noonsiee2 0:06f32e106c93 691
noonsiee2 0:06f32e106c93 692 if (XF[4] == 1){
noonsiee2 0:06f32e106c93 693 midi.write(MIDIMessage::NoteOn(46,127*Af));
noonsiee2 0:06f32e106c93 694 }
noonsiee2 0:06f32e106c93 695 else{}
noonsiee2 0:06f32e106c93 696
noonsiee2 0:06f32e106c93 697 if (XF[5] == 1){
noonsiee2 0:06f32e106c93 698 midi.write(MIDIMessage::NoteOn(50,127*Af));
noonsiee2 0:06f32e106c93 699 }
noonsiee2 0:06f32e106c93 700 else{}
noonsiee2 0:06f32e106c93 701
noonsiee2 0:06f32e106c93 702 if (XF[6] == 1){
noonsiee2 0:06f32e106c93 703 midi.write(MIDIMessage::NoteOn(52,127*Af));
noonsiee2 0:06f32e106c93 704 }
noonsiee2 0:06f32e106c93 705 else{}
noonsiee2 0:06f32e106c93 706
noonsiee2 0:06f32e106c93 707 wait(30/tempo);
noonsiee2 0:06f32e106c93 708 midi.write(MIDIMessage::AllNotesOff(0));
noonsiee2 0:06f32e106c93 709
noonsiee2 0:06f32e106c93 710 if((TS_State.touchDetected))
noonsiee2 0:06f32e106c93 711 {
noonsiee2 0:06f32e106c93 712 if(TS_State.touchX[0]>=260&&TS_State.touchX[0]<=330&&TS_State.touchY[0]>=230&&TS_State.touchY[0]<=270)
noonsiee2 0:06f32e106c93 713 {
noonsiee2 0:06f32e106c93 714 goto LOOP;
noonsiee2 0:06f32e106c93 715 }
noonsiee2 0:06f32e106c93 716 }
noonsiee2 0:06f32e106c93 717 else{}
noonsiee2 0:06f32e106c93 718
noonsiee2 0:06f32e106c93 719 if (XG[0] == 1){
noonsiee2 0:06f32e106c93 720 midi.write(MIDIMessage::NoteOn(36,127*Af));
noonsiee2 0:06f32e106c93 721 }
noonsiee2 0:06f32e106c93 722 else{}
noonsiee2 0:06f32e106c93 723
noonsiee2 0:06f32e106c93 724 if (XG[1] == 1){
noonsiee2 0:06f32e106c93 725 midi.write(MIDIMessage::NoteOn(38,127*Af));
noonsiee2 0:06f32e106c93 726 }
noonsiee2 0:06f32e106c93 727 else{}
noonsiee2 0:06f32e106c93 728
noonsiee2 0:06f32e106c93 729 if (XG[2] == 1){
noonsiee2 0:06f32e106c93 730 midi.write(MIDIMessage::NoteOn(39,127*Af));
noonsiee2 0:06f32e106c93 731 }
noonsiee2 0:06f32e106c93 732 else{}
noonsiee2 0:06f32e106c93 733
noonsiee2 0:06f32e106c93 734 if (XG[3] == 1){
noonsiee2 0:06f32e106c93 735 midi.write(MIDIMessage::NoteOn(44,127*Af));
noonsiee2 0:06f32e106c93 736 }
noonsiee2 0:06f32e106c93 737 else{}
noonsiee2 0:06f32e106c93 738
noonsiee2 0:06f32e106c93 739 if (XG[4] == 1){
noonsiee2 0:06f32e106c93 740 midi.write(MIDIMessage::NoteOn(46,127*Af));
noonsiee2 0:06f32e106c93 741 }
noonsiee2 0:06f32e106c93 742 else{}
noonsiee2 0:06f32e106c93 743
noonsiee2 0:06f32e106c93 744 if (XG[5] == 1){
noonsiee2 0:06f32e106c93 745 midi.write(MIDIMessage::NoteOn(50,127*Af));
noonsiee2 0:06f32e106c93 746 }
noonsiee2 0:06f32e106c93 747 else{}
noonsiee2 0:06f32e106c93 748
noonsiee2 0:06f32e106c93 749 if (XG[6] == 1){
noonsiee2 0:06f32e106c93 750 midi.write(MIDIMessage::NoteOn(52,127*Af));
noonsiee2 0:06f32e106c93 751 }
noonsiee2 0:06f32e106c93 752 else{}
noonsiee2 0:06f32e106c93 753
noonsiee2 0:06f32e106c93 754 wait(30/tempo);
noonsiee2 0:06f32e106c93 755 midi.write(MIDIMessage::AllNotesOff(0));
noonsiee2 0:06f32e106c93 756
noonsiee2 0:06f32e106c93 757 if((TS_State.touchDetected))
noonsiee2 0:06f32e106c93 758 {
noonsiee2 0:06f32e106c93 759 if(TS_State.touchX[0]>=260&&TS_State.touchX[0]<=330&&TS_State.touchY[0]>=230&&TS_State.touchY[0]<=270)
noonsiee2 0:06f32e106c93 760 {
noonsiee2 0:06f32e106c93 761 goto LOOP;
noonsiee2 0:06f32e106c93 762 }
noonsiee2 0:06f32e106c93 763 }
noonsiee2 0:06f32e106c93 764 else{}
noonsiee2 0:06f32e106c93 765
noonsiee2 0:06f32e106c93 766 if (XH[0] == 1){
noonsiee2 0:06f32e106c93 767 midi.write(MIDIMessage::NoteOn(36,127*Af));
noonsiee2 0:06f32e106c93 768 }
noonsiee2 0:06f32e106c93 769 else{}
noonsiee2 0:06f32e106c93 770
noonsiee2 0:06f32e106c93 771 if (XH[1] == 1){
noonsiee2 0:06f32e106c93 772 midi.write(MIDIMessage::NoteOn(38,127*Af));
noonsiee2 0:06f32e106c93 773 }
noonsiee2 0:06f32e106c93 774 else{}
noonsiee2 0:06f32e106c93 775
noonsiee2 0:06f32e106c93 776 if (XH[2] == 1){
noonsiee2 0:06f32e106c93 777 midi.write(MIDIMessage::NoteOn(39,127*Af));
noonsiee2 0:06f32e106c93 778 }
noonsiee2 0:06f32e106c93 779 else{}
noonsiee2 0:06f32e106c93 780
noonsiee2 0:06f32e106c93 781 if (XH[3] == 1){
noonsiee2 0:06f32e106c93 782 midi.write(MIDIMessage::NoteOn(44,127*Af));
noonsiee2 0:06f32e106c93 783 }
noonsiee2 0:06f32e106c93 784 else{}
noonsiee2 0:06f32e106c93 785
noonsiee2 0:06f32e106c93 786 if (XH[4] == 1){
noonsiee2 0:06f32e106c93 787 midi.write(MIDIMessage::NoteOn(46,127*Af));
noonsiee2 0:06f32e106c93 788 }
noonsiee2 0:06f32e106c93 789 else{}
noonsiee2 0:06f32e106c93 790
noonsiee2 0:06f32e106c93 791 if (XH[5] == 1){
noonsiee2 0:06f32e106c93 792 midi.write(MIDIMessage::NoteOn(50,127*Af));
noonsiee2 0:06f32e106c93 793 }
noonsiee2 0:06f32e106c93 794 else{}
noonsiee2 0:06f32e106c93 795
noonsiee2 0:06f32e106c93 796 if (XH[6] == 1){
noonsiee2 0:06f32e106c93 797 midi.write(MIDIMessage::NoteOn(52,127*Af));
noonsiee2 0:06f32e106c93 798 }
noonsiee2 0:06f32e106c93 799 else{}
noonsiee2 0:06f32e106c93 800
noonsiee2 0:06f32e106c93 801 wait(30/tempo);
noonsiee2 0:06f32e106c93 802 midi.write(MIDIMessage::AllNotesOff(0));
noonsiee2 0:06f32e106c93 803
noonsiee2 0:06f32e106c93 804 if((TS_State.touchDetected))
noonsiee2 0:06f32e106c93 805 {
noonsiee2 0:06f32e106c93 806 if(TS_State.touchX[0]>=260&&TS_State.touchX[0]<=330&&TS_State.touchY[0]>=230&&TS_State.touchY[0]<=270)
noonsiee2 0:06f32e106c93 807 {
noonsiee2 0:06f32e106c93 808 goto LOOP;
noonsiee2 0:06f32e106c93 809 }
noonsiee2 0:06f32e106c93 810 }
noonsiee2 0:06f32e106c93 811 else{}
noonsiee2 0:06f32e106c93 812 }
noonsiee2 0:06f32e106c93 813 }
noonsiee2 0:06f32e106c93 814
noonsiee2 0:06f32e106c93 815 void PL1(){
noonsiee2 0:06f32e106c93 816 for (int i=0; i<8; i++){
noonsiee2 0:06f32e106c93 817 XA[i] = 0;
noonsiee2 0:06f32e106c93 818 XB[i] = 0;
noonsiee2 0:06f32e106c93 819 XC[i] = 0;
noonsiee2 0:06f32e106c93 820 XD[i] = 0;
noonsiee2 0:06f32e106c93 821 XE[i] = 0;
noonsiee2 0:06f32e106c93 822 XF[i] = 0;
noonsiee2 0:06f32e106c93 823 XG[i] = 0;
noonsiee2 0:06f32e106c93 824 }
noonsiee2 0:06f32e106c93 825 }