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
Diff: light_pressed.h
- Revision:
- 5:8e13103b41be
- Parent:
- 4:76c054f8b97e
- Child:
- 7:4aec4a6acac2
--- a/light_pressed.h Thu Feb 06 06:41:30 2014 +0000
+++ b/light_pressed.h Thu Feb 06 07:36:01 2014 +0000
@@ -3,33 +3,24 @@
int slider;
-int shift = 0;
+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 == 0) { // Shift Button
- tft.fillrect(3,20,63,80, color);
- }
-
-
- if (b == 1 && shift == 1) { // Piirra liukunappain jos shift paalla
+ if (b == 1) {
tft.fillrect(3,88,78,318,color);
- } else
- tft.fillrect(3,88,78,158,color);
- if (shift == 0) {
- if (b == 2) {
- tft.fillrect(83,88,158,158,color);
- }
- if (b == 3) {
- tft.fillrect(163,88,238,158,color);
- }
+ }
+ if (b == 2) {
+ tft.fillrect(83,88,158,158,color);
}
-
- if (b == 4 && shift == 0) { // Jos shift painettan, ei piirra mitaan
+ if (b == 3) {
+ tft.fillrect(163,88,238,158,color);
+ }
+ if (b == 4) {
tft.fillrect(3,163,78,238,color);
}
if (b == 5) {
@@ -39,7 +30,7 @@
tft.fillrect(163,163,238,238,color);
}
- if (b == 7 && shift == 0) { // Jos shift painettan, ei piirra mitaan
+ if (b == 7) {
tft.fillrect(3,243,78,318,color);
}
if (b == 8) {
@@ -50,20 +41,14 @@
}
}
-void light_pressed2(unsigned short color2, point p)
+void light_pressed(unsigned short color, point p)
{
- if (p.y >20 && p.y < 80) { // Shift Button
- if (p.x > 3 && p.x < 63) {
- buttons(0, color2);
- shift = 0;
- }
- }
- if (p.x > 3 && p.x < 78) { //Slider
- if (p.y > 88 && p.y < 111) { //button 1
+ 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
+ if (p.y > 111 && p.y < 134) { //button 2
slider = 90;
}
if (p.y > 134 && p.y < 157) { //button 3
@@ -75,7 +60,7 @@
if (p.y > 180 && p.y < 203) { //button 3
slider = 60;
}
- if (p.y > 203&& p.y < 226) { //button 3
+ if (p.y > 203&& p.y < 226) { //button 3
slider = 50;
}
if (p.y > 226 && p.y < 249) { //button 3
@@ -93,55 +78,6 @@
}
if (p.y > 163 && p.y < 238) { //ROW B
if (p.x > 83 && p.x < 158) { //button 5
- buttons(5, color2);
-
- }
- if (p.x > 163 && p.x < 238) { //button 6
- buttons(6, color2);
-
- }
- }
-
- if (p.y > 243 && p.y < 318) { //ROW C
- if (p.x > 83 && p.x < 158) { //button 8
- buttons(8, color2);
- }
- if (p.x > 163 && p.x < 238) { //button 9
- buttons(9, color2);
-
- }
- }
-}
-
-
-void light_pressed(unsigned short color, point p)
-{
- if (p.y >20 && p.y < 80) { // Shift Button
- if (p.x > 3 && p.x < 63) {
- buttons(0, color);
- shift = 1;
- }
- }
-
- if (p.y > 88 && p.y < 158) { //ROW A
- if (p.x > 3 && p.x < 78) { //button 1
- buttons(1, color);
- }
- if (p.x > 83 && p.x < 158) { //button 2
- buttons(2, color);
- }
- if (p.x > 163 && p.x < 238) { //button 3
- buttons(3, color);
-
- }
- }
-
- if (p.y > 163 && p.y < 238) { //ROW B
- if (p.x > 3 && p.x < 78) { //button 4
- buttons(4, color);
-
- }
- if (p.x > 83 && p.x < 158) { //button 5
buttons(5, color);
}
@@ -152,15 +88,14 @@
}
if (p.y > 243 && p.y < 318) { //ROW C
- if (p.x > 3 && p.x < 78) { //button 7
- buttons(7, color);
+ if (p.x > 83 && p.x < 158) { //Ocatave down
+ buttons(8, color);
+
}
- if (p.x > 83 && p.x < 158) { //button 8
- buttons(8, color);
- }
- if (p.x > 163 && p.x < 238) { //button 9
+ if (p.x > 163 && p.x < 238) { //Octave up
buttons(9, color);
+
}
}
}