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:
- 4:76c054f8b97e
- Child:
- 5:8e13103b41be
diff -r c8a476a218e3 -r 76c054f8b97e light_pressed.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/light_pressed.h Thu Feb 06 06:41:30 2014 +0000
@@ -0,0 +1,169 @@
+#include "touch_tft.h"
+#include "SPI_TFT_ILI9341.h"
+
+
+int slider;
+int shift = 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
+ 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 == 4 && shift == 0) { // Jos shift painettan, ei piirra mitaan
+ 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 && shift == 0) { // Jos shift painettan, ei piirra mitaan
+ 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_pressed2(unsigned short color2, 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
+ 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, 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);
+
+ }
+ if (p.x > 163 && p.x < 238) { //button 6
+ buttons(6, color);
+
+ }
+ }
+
+ 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) { //button 8
+ buttons(8, color);
+ }
+ if (p.x > 163 && p.x < 238) { //button 9
+ buttons(9, color);
+
+ }
+ }
+}
+
+
+
