drum hero

Dependencies:   4DGL mbed

Fork of uVGAII_demo by jim hamblen

Committer:
ykuris3
Date:
Wed Apr 26 19:43:51 2017 +0000
Revision:
2:5daa4d35a676
Parent:
1:38ef731c7bdf
test2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
4180_1 0:cfcf73272647 1 //
4180_1 0:cfcf73272647 2 // TFT_4DGL is a class to drive 4D Systems TFT touch screens
4180_1 0:cfcf73272647 3 //
4180_1 0:cfcf73272647 4 // Copyright (C) <2010> Stephane ROCHON <stephane.rochon at free.fr>
4180_1 0:cfcf73272647 5 //
4180_1 0:cfcf73272647 6 // TFT_4DGL is free software: you can redistribute it and/or modify
4180_1 0:cfcf73272647 7 // it under the terms of the GNU General Public License as published by
4180_1 0:cfcf73272647 8 // the Free Software Foundation, either version 3 of the License, or
4180_1 0:cfcf73272647 9 // (at your option) any later version.
4180_1 0:cfcf73272647 10 //
4180_1 0:cfcf73272647 11 // TFT_4DGL is distributed in the hope that it will be useful,
4180_1 0:cfcf73272647 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
4180_1 0:cfcf73272647 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4180_1 0:cfcf73272647 14 // GNU General Public License for more details.
4180_1 0:cfcf73272647 15 //
4180_1 0:cfcf73272647 16 // You should have received a copy of the GNU General Public License
4180_1 0:cfcf73272647 17 // along with TFT_4DGL. If not, see <http://www.gnu.org/licenses/>.
4180_1 0:cfcf73272647 18
4180_1 0:cfcf73272647 19 #include "mbed.h"
4180_1 0:cfcf73272647 20 #include "TFT_4DGL.h"
4180_1 0:cfcf73272647 21
4180_1 1:38ef731c7bdf 22 // overwrite 4DGL library screen size settings in TFT_4DGL.h
4180_1 1:38ef731c7bdf 23 #define SIZE_X 479
4180_1 1:38ef731c7bdf 24 #define SIZE_Y 639
4180_1 1:38ef731c7bdf 25 //
4180_1 1:38ef731c7bdf 26
4180_1 0:cfcf73272647 27 TFT_4DGL ecran(p9,p10,p11); // serial tx, serial rx, reset pin;
ykuris3 2:5daa4d35a676 28 Timer t;
4180_1 0:cfcf73272647 29
4180_1 0:cfcf73272647 30 int main() {
4180_1 1:38ef731c7bdf 31 // char s[500];
4180_1 1:38ef731c7bdf 32 // int x = 0, y = 0, status, xc = 0, yc = 0;
4180_1 1:38ef731c7bdf 33
ykuris3 2:5daa4d35a676 34 ecran.baudrate(128000);
4180_1 1:38ef731c7bdf 35 // added - Set Display to 640 by 480 mode
4180_1 1:38ef731c7bdf 36 ecran.display_control(0x0c, 0x01);
ykuris3 2:5daa4d35a676 37
ykuris3 2:5daa4d35a676 38 // ecran.background_color(DGREY);
ykuris3 2:5daa4d35a676 39
ykuris3 2:5daa4d35a676 40 ecran.rectangle(192, 120, 447, 450, 0xD38A41);
ykuris3 2:5daa4d35a676 41 ecran.line(256, 120, 192, 450, 0x96411F);
ykuris3 2:5daa4d35a676 42 ecran.line(296, 120, 277, 450, 0x96411F);
ykuris3 2:5daa4d35a676 43 ecran.line(332, 120, 362, 450, 0x96411F);
ykuris3 2:5daa4d35a676 44 ecran.line(372, 120, 447, 450, 0x96411F);
ykuris3 2:5daa4d35a676 45 ecran.triangle(192, 120, 192, 450, 256, 120, 0x000000);
ykuris3 2:5daa4d35a676 46 ecran.triangle(372, 120, 447, 450, 447, 120, 0x000000);
ykuris3 2:5daa4d35a676 47 ecran.rectangle(447, 120, 450, 450, 0x000000);
ykuris3 2:5daa4d35a676 48
ykuris3 2:5daa4d35a676 49 ecran.ellipse(314, 132, 12, 8, 0xFF0000);
ykuris3 2:5daa4d35a676 50 ecran.ellipse(276, 132, 12, 8, 0x0000FF);
ykuris3 2:5daa4d35a676 51 ecran.ellipse(352, 132, 12, 8, 0x00FF00);
ykuris3 2:5daa4d35a676 52
ykuris3 2:5daa4d35a676 53 int i = 0;
ykuris3 2:5daa4d35a676 54 double x = 276;
ykuris3 2:5daa4d35a676 55 double x3 = 352;
ykuris3 2:5daa4d35a676 56 int y = 132;
ykuris3 2:5daa4d35a676 57 int x2 = 314;
ykuris3 2:5daa4d35a676 58 int y2 = 132;
ykuris3 2:5daa4d35a676 59 int y3 = 132;
ykuris3 2:5daa4d35a676 60 int x_len = 12;
ykuris3 2:5daa4d35a676 61 int y_len = 8;
ykuris3 2:5daa4d35a676 62 while(i < 70) {
ykuris3 2:5daa4d35a676 63 i += 1;
ykuris3 2:5daa4d35a676 64 if (i % 8 == 0) {
ykuris3 2:5daa4d35a676 65 x_len += 1;
ykuris3 2:5daa4d35a676 66 y_len += 1;
ykuris3 2:5daa4d35a676 67 }
ykuris3 2:5daa4d35a676 68 y2 += 4;
ykuris3 2:5daa4d35a676 69 y3 += 4;
ykuris3 2:5daa4d35a676 70 y += 4;
ykuris3 2:5daa4d35a676 71 x -= 0.5091;
ykuris3 2:5daa4d35a676 72 x3 += 0.5091;
ykuris3 2:5daa4d35a676 73 ecran.ellipse(x2, y2, x_len, y_len, 0xFF0000);
ykuris3 2:5daa4d35a676 74 ecran.ellipse(x, y, x_len, y_len, 0x0000FF);
ykuris3 2:5daa4d35a676 75 ecran.ellipse(x3, y3, x_len, y_len, 0x00FF00);
ykuris3 2:5daa4d35a676 76 wait(0.1);
ykuris3 2:5daa4d35a676 77 ecran.ellipse(x2, y2, x_len, y_len, 0xD38A41);
ykuris3 2:5daa4d35a676 78 ecran.ellipse(x, y, x_len, y_len, 0xD38A41);
ykuris3 2:5daa4d35a676 79 ecran.ellipse(x3, y3, x_len, y_len, 0xD38A41);
ykuris3 2:5daa4d35a676 80 }
ykuris3 2:5daa4d35a676 81
4180_1 1:38ef731c7bdf 82 //
ykuris3 2:5daa4d35a676 83 //ecran.background_color(DGREY);
ykuris3 2:5daa4d35a676 84 // ecran.circle(120, 160, 80, 0xFF00FF);
ykuris3 2:5daa4d35a676 85 // ecran.triangle(120, 100, 40, 300, 200, 270, 0x0000FF);
ykuris3 2:5daa4d35a676 86 // ecran.line(0, 0, 239, 319, 0xFF0000);
ykuris3 2:5daa4d35a676 87 // ecran.rectangle(50, 50, 200, 90, 0x00FF00);
ykuris3 2:5daa4d35a676 88 // ecran.ellipse(100, 250, 80, 30, 0xFFFF00);
ykuris3 2:5daa4d35a676 89 // ecran.pixel(120, 160, BLACK);
ykuris3 2:5daa4d35a676 90 // ecran.read_pixel(120, 170);
ykuris3 2:5daa4d35a676 91 // ecran.screen_copy(50, 50, 200, 200, 100, 100);
ykuris3 2:5daa4d35a676 92 // ecran.pen_size(WIREFRAME);
ykuris3 2:5daa4d35a676 93 // ecran.circle(120, 160, 60, BLACK);
ykuris3 2:5daa4d35a676 94 // ecran.set_font(FONT_8X8);
ykuris3 2:5daa4d35a676 95 // ecran.text_mode(TRANSPARENT);
ykuris3 2:5daa4d35a676 96 // ecran.text_char('B', 9, 8, BLACK);
ykuris3 2:5daa4d35a676 97 // ecran.text_char('I',10, 8, BLACK);
ykuris3 2:5daa4d35a676 98 // ecran.text_char('G',11, 8, BLACK);
ykuris3 2:5daa4d35a676 99 // ecran.graphic_char('G', 120, 120, BLACK, 4, 4);
ykuris3 2:5daa4d35a676 100 // ecran.text_string("This is a test of string", 2, 12, FONT_8X8, WHITE);
ykuris3 2:5daa4d35a676 101 // ecran.graphic_string("This is a test of graphic string", 20, 200, FONT_8X8, WHITE, 2, 2);
ykuris3 2:5daa4d35a676 102 // ecran.text_button("OK", UP, 40, 260, 0xFF0000, FONT_8X8, BLACK, 2, 2);
ykuris3 2:5daa4d35a676 103 //
ykuris3 2:5daa4d35a676 104 // // delete touch screen demo - no touch on uVGA II
ykuris3 2:5daa4d35a676 105 // ecran.cls();
ykuris3 2:5daa4d35a676 106 // int x = -54;
ykuris3 2:5daa4d35a676 107 // int y = -54;
ykuris3 2:5daa4d35a676 108 // ecran.background_color(BLACK);
ykuris3 2:5daa4d35a676 109 // ecran.circle(x, y, 60, 0xD6A34F);
ykuris3 2:5daa4d35a676 110 // while(1) {
ykuris3 2:5daa4d35a676 111 // ecran.circle(x, y, 60, 0xD6A34F);
ykuris3 2:5daa4d35a676 112 // x = x + 10;
ykuris3 2:5daa4d35a676 113 // y = y + 10;
ykuris3 2:5daa4d35a676 114 // ecran.circle(x, y, 60, 0xD6A34F);
ykuris3 2:5daa4d35a676 115 // }
ykuris3 2:5daa4d35a676 116 //
4180_1 0:cfcf73272647 117 }