Curtis Mattull
/
PANEL_GUI_hello_world
basic functional test of FT810 LCD via SPI
main.cpp@17:f98333612db8, 2016-07-21 (annotated)
- Committer:
- cpm219
- Date:
- Thu Jul 21 14:27:30 2016 +0000
- Revision:
- 17:f98333612db8
- Parent:
- 16:19ade236df07
- Child:
- 18:d1566d9b6ea1
datalogger gui
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cratliff | 5:e2e04cb5eada | 1 | /* |
cratliff | 5:e2e04cb5eada | 2 | Title Block |
cpm219 | 16:19ade236df07 | 3 | ** Project : data logger: lcd power levels |
cpm219 | 16:19ade236df07 | 4 | ** Engineers : Curtis Mattull |
cratliff | 6:f698d8ba4cd6 | 5 | ** Processor : MK20 |
cratliff | 5:e2e04cb5eada | 6 | ** Version : 1.0 |
cratliff | 5:e2e04cb5eada | 7 | ** Compiler : mbed |
cpm219 | 17:f98333612db8 | 8 | ** Date/Time : 7/18/2016 |
cpm219 | 17:f98333612db8 | 9 | ** Abstract : This program functions as a simple data logger. |
cpm219 | 16:19ade236df07 | 10 | This program also serves as a learning experience with using touch screen LCDs. |
cpm219 | 16:19ade236df07 | 11 | |
cpm219 | 17:f98333612db8 | 12 | modes of operation: (mcu never sleeps) |
cpm219 | 17:f98333612db8 | 13 | |
cpm219 | 17:f98333612db8 | 14 | |
cpm219 | 17:f98333612db8 | 15 | NOTE: comment line 12 of FT_LCD_TYPE.h unless using beyondtek display! |
cratliff | 5:e2e04cb5eada | 16 | */ |
cpm219 | 17:f98333612db8 | 17 | |
cpm219 | 17:f98333612db8 | 18 | |
cpm219 | 17:f98333612db8 | 19 | #include "mbed.h" |
cratliff | 0:aa55c6eb6867 | 20 | #include "FT_Platform.h" |
cratliff | 0:aa55c6eb6867 | 21 | #include "stdio.h" |
montgojj | 4:a48fc7a3bda9 | 22 | #include "float.h" |
montgojj | 4:a48fc7a3bda9 | 23 | #include "SDFileSystem.h" |
cpm219 | 17:f98333612db8 | 24 | |
cpm219 | 17:f98333612db8 | 25 | /************************ |
cpm219 | 17:f98333612db8 | 26 | global |
cpm219 | 17:f98333612db8 | 27 | *************************/ |
cpm219 | 17:f98333612db8 | 28 | |
cpm219 | 17:f98333612db8 | 29 | |
cpm219 | 17:f98333612db8 | 30 | //comment out for standard display |
cpm219 | 17:f98333612db8 | 31 | #define beyondtek |
cpm219 | 17:f98333612db8 | 32 | |
cpm219 | 17:f98333612db8 | 33 | |
cpm219 | 17:f98333612db8 | 34 | #define mask_present_state 0x38 |
cpm219 | 17:f98333612db8 | 35 | #define mask_tag_input 0x7 |
cpm219 | 17:f98333612db8 | 36 | #define mask_reg_tracker_tag 0xF |
cpm219 | 17:f98333612db8 | 37 | |
cpm219 | 17:f98333612db8 | 38 | #define font_title 0x1F |
cpm219 | 17:f98333612db8 | 39 | #define font_button 0x1D |
cpm219 | 17:f98333612db8 | 40 | #define font_author 0x15 |
cpm219 | 17:f98333612db8 | 41 | |
cpm219 | 17:f98333612db8 | 42 | // create object for the LCD, handles all of the data passing and slave select commands (SPI) |
cpm219 | 17:f98333612db8 | 43 | FT800 TFT( D11, //mosi |
cpm219 | 17:f98333612db8 | 44 | D12, //miso |
cpm219 | 17:f98333612db8 | 45 | D13, //sclk |
cpm219 | 17:f98333612db8 | 46 | D9, //ss |
cpm219 | 17:f98333612db8 | 47 | D8, //intr |
cpm219 | 17:f98333612db8 | 48 | D14 ); // pd |
cpm219 | 17:f98333612db8 | 49 | |
cpm219 | 17:f98333612db8 | 50 | DigitalIn card_present(D7); // digital in pin connected to the SD card detect pin input |
cpm219 | 17:f98333612db8 | 51 | AnalogIn analog_in9(A9); // analog 9 pin connected to the PSE input 4 |
cpm219 | 17:f98333612db8 | 52 | AnalogIn analog_in8(A8); // analog 9 pin connected to the PFW input 5 |
cpm219 | 17:f98333612db8 | 53 | AnalogIn analog_in3(A3); // analog 9 pin connected to the ITV1 input 10 |
cpm219 | 17:f98333612db8 | 54 | AnalogIn analog_in2(A2); // analog 9 pin connected to the ITV2 input 11 from usb, starting at 1 |
cpm219 | 17:f98333612db8 | 55 | |
cpm219 | 17:f98333612db8 | 56 | |
cpm219 | 17:f98333612db8 | 57 | /************************ |
cpm219 | 17:f98333612db8 | 58 | function prototypes |
cpm219 | 17:f98333612db8 | 59 | *************************/ |
cpm219 | 17:f98333612db8 | 60 | |
cpm219 | 17:f98333612db8 | 61 | void Start_Screen(ft_char8_t *str); |
cpm219 | 17:f98333612db8 | 62 | |
cpm219 | 17:f98333612db8 | 63 | |
cpm219 | 17:f98333612db8 | 64 | int16_t collect_data(void); |
cpm219 | 17:f98333612db8 | 65 | void plot_data(); |
cpm219 | 17:f98333612db8 | 66 | |
cpm219 | 17:f98333612db8 | 67 | //for gui state machine |
cpm219 | 17:f98333612db8 | 68 | void main_menu(uint8_t tag); // main menu 0 |
cpm219 | 17:f98333612db8 | 69 | void mode_a(uint8_t tag); // mode A 1 |
cpm219 | 17:f98333612db8 | 70 | void mode_b(uint8_t tag); // mode B 2 |
cpm219 | 17:f98333612db8 | 71 | void mode_c(uint8_t tag); // mode C 3 |
cpm219 | 17:f98333612db8 | 72 | |
cpm219 | 17:f98333612db8 | 73 | //for plot state machine |
cpm219 | 17:f98333612db8 | 74 | void plot_nothing(void); |
cpm219 | 17:f98333612db8 | 75 | void plot_square(void); |
cpm219 | 17:f98333612db8 | 76 | void plot_triangle(void); |
cpm219 | 17:f98333612db8 | 77 | void plot_sine(void); |
cpm219 | 17:f98333612db8 | 78 | |
cpm219 | 17:f98333612db8 | 79 | |
cpm219 | 17:f98333612db8 | 80 | /************************ |
cpm219 | 17:f98333612db8 | 81 | function pointers |
cpm219 | 17:f98333612db8 | 82 | *************************/ |
cpm219 | 17:f98333612db8 | 83 | |
cpm219 | 17:f98333612db8 | 84 | void (*draw_screen[4])(uint8_t tag) = { main_menu, // 0 |
cpm219 | 17:f98333612db8 | 85 | mode_a, // 1 |
cpm219 | 17:f98333612db8 | 86 | mode_b, // 2 |
cpm219 | 17:f98333612db8 | 87 | mode_c }; // 3 |
cpm219 | 17:f98333612db8 | 88 | |
cpm219 | 17:f98333612db8 | 89 | void (*plot[4])(void) = { plot_nothing, // 0 |
cpm219 | 17:f98333612db8 | 90 | plot_square, // 1 |
cpm219 | 17:f98333612db8 | 91 | plot_triangle, // 2 |
cpm219 | 17:f98333612db8 | 92 | plot_sine }; // 3 |
cratliff | 0:aa55c6eb6867 | 93 | |
cpm219 | 17:f98333612db8 | 94 | |
cpm219 | 17:f98333612db8 | 95 | |
cpm219 | 17:f98333612db8 | 96 | /************************ |
cpm219 | 17:f98333612db8 | 97 | lookup tables |
cpm219 | 17:f98333612db8 | 98 | *************************/ |
cpm219 | 17:f98333612db8 | 99 | |
cpm219 | 17:f98333612db8 | 100 | //gui menu state table |
cpm219 | 17:f98333612db8 | 101 | static const uint8_t state_lookup[32] = {0x0, 0x1, 0x2, 0x3, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x0, 0x1, 0x1, 0x1, |
cpm219 | 17:f98333612db8 | 102 | 0x2, 0x2, 0x2, 0x2, 0x0, 0x2, 0x2, 0x2, 0x3, 0x3, 0x3, 0x3, 0x0, 0x3, 0x3, 0x3,}; |
cpm219 | 17:f98333612db8 | 103 | // |
cpm219 | 17:f98333612db8 | 104 | ///* array index values: { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
cpm219 | 17:f98333612db8 | 105 | // 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31}; |
cpm219 | 17:f98333612db8 | 106 | // */ |
cpm219 | 17:f98333612db8 | 107 | |
cpm219 | 17:f98333612db8 | 108 | static const uint8_t plot_lookup[32] = {0x0, 0x0, 0x2, 0x3, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x2, 0x3, 0x1, 0x0, 0x1, 0x1, |
cpm219 | 17:f98333612db8 | 109 | 0x2, 0x2, 0x2, 0x3, 0x2, 0x0, 0x1, 0x2, 0x3, 0x3, 0x2, 0x3, 0x3, 0x0, 0x1, 0x3,}; |
cpm219 | 17:f98333612db8 | 110 | // |
cpm219 | 17:f98333612db8 | 111 | ///* array index values: { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
cpm219 | 17:f98333612db8 | 112 | // 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31}; |
cpm219 | 17:f98333612db8 | 113 | |
cpm219 | 17:f98333612db8 | 114 | |
cpm219 | 17:f98333612db8 | 115 | //// //fallback gui menu state table |
cpm219 | 17:f98333612db8 | 116 | //static const uint8_t state_lookup[32] = {0x0, 0x1, 0x2, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, |
cpm219 | 17:f98333612db8 | 117 | // 0x2, 0x2, 0x2, 0x2, 0x0, 0x0, 0x2, 0x2, 0x3, 0x3, 0x3, 0x3, 0x0, 0x3, 0x3, 0x3}; |
cpm219 | 17:f98333612db8 | 118 | |
cpm219 | 17:f98333612db8 | 119 | ///* array index values: { 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
cpm219 | 17:f98333612db8 | 120 | // 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31}; |
cpm219 | 17:f98333612db8 | 121 | // */ |
cpm219 | 17:f98333612db8 | 122 | |
cpm219 | 17:f98333612db8 | 123 | |
cpm219 | 17:f98333612db8 | 124 | static const int16_t square_wave_lookup[40] = { -100,-100,-100,-100,-100, 100,100,100,100,100, |
cpm219 | 17:f98333612db8 | 125 | -100,-100,-100,-100,-100, 100,100,100,100,100, |
cpm219 | 17:f98333612db8 | 126 | -100,-100,-100,-100,-100, 100,100,100,100,100, |
cpm219 | 17:f98333612db8 | 127 | -100,-100,-100,-100,-100, 100,100,100,100,100}; |
cpm219 | 17:f98333612db8 | 128 | |
cpm219 | 17:f98333612db8 | 129 | static const int16_t tri_wave_lookup[40] = { 100,0,-100,0, 100,0,-100,0, |
cpm219 | 17:f98333612db8 | 130 | 100,0,-100,0, 100,0,-100,0, |
cpm219 | 17:f98333612db8 | 131 | 100,0,-100,0, 100,0,-100,0, |
cpm219 | 17:f98333612db8 | 132 | 100,0,-100,0, 100,0,-100,0, |
cpm219 | 17:f98333612db8 | 133 | 100,0,-100,0, 100,0,-100,0}; |
cpm219 | 17:f98333612db8 | 134 | |
cpm219 | 17:f98333612db8 | 135 | static const int16_t sine_wave_lookup[40] = { 0, 16, 31, 45, 59, 71, 81, 89, 95, 99, |
cpm219 | 17:f98333612db8 | 136 | 100, 99, 95, 89, 81, 71, 59, 45, 31, 16, |
cpm219 | 17:f98333612db8 | 137 | -0, -16, -31, -45, -59, -71, -81, -89, -95, -99, |
cpm219 | 17:f98333612db8 | 138 | -100, -99, -95, -89, -81, -71, -59, -45, -31, -16, }; |
cpm219 | 17:f98333612db8 | 139 | |
cpm219 | 17:f98333612db8 | 140 | /************************ |
cpm219 | 17:f98333612db8 | 141 | global variables |
cpm219 | 17:f98333612db8 | 142 | *************************/ |
cpm219 | 17:f98333612db8 | 143 | |
cpm219 | 17:f98333612db8 | 144 | |
cpm219 | 17:f98333612db8 | 145 | int16_t i =0; |
cpm219 | 17:f98333612db8 | 146 | uint8_t present_states = 0x0, |
cpm219 | 17:f98333612db8 | 147 | tags = 0x0, |
cpm219 | 17:f98333612db8 | 148 | combo_inputs = 0x0; |
cpm219 | 17:f98333612db8 | 149 | |
cpm219 | 17:f98333612db8 | 150 | // data sample from ADC |
cpm219 | 17:f98333612db8 | 151 | int16_t data1[40] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; |
cpm219 | 17:f98333612db8 | 152 | |
cpm219 | 17:f98333612db8 | 153 | //pointer to data1 array |
cpm219 | 17:f98333612db8 | 154 | //int16_t *p = data1; |
cpm219 | 17:f98333612db8 | 155 | |
cpm219 | 17:f98333612db8 | 156 | static const ft_char8_t text_menu[32]= {"Main Menu\0"}; |
cpm219 | 17:f98333612db8 | 157 | static const ft_char8_t text_a[32]= {"Mode A\0"}; |
cpm219 | 17:f98333612db8 | 158 | static const ft_char8_t text_b[32]= {"Mode B\0"}; |
cpm219 | 17:f98333612db8 | 159 | static const ft_char8_t text_c[32]= {"Mode C\0"}; |
cpm219 | 17:f98333612db8 | 160 | static const ft_char8_t text_back[32]= {"Back\0"}; |
cpm219 | 17:f98333612db8 | 161 | static const ft_char8_t text_author[32]= {"by Curtis Mattull\0"}; |
cpm219 | 17:f98333612db8 | 162 | |
cpm219 | 17:f98333612db8 | 163 | |
cratliff | 0:aa55c6eb6867 | 164 | |
cpm219 | 17:f98333612db8 | 165 | |
cpm219 | 17:f98333612db8 | 166 | |
cpm219 | 17:f98333612db8 | 167 | |
cpm219 | 17:f98333612db8 | 168 | |
cpm219 | 17:f98333612db8 | 169 | /************************ |
cpm219 | 17:f98333612db8 | 170 | main function: |
cpm219 | 17:f98333612db8 | 171 | -calibrate touch screen |
cpm219 | 17:f98333612db8 | 172 | -display welcome screen |
cpm219 | 17:f98333612db8 | 173 | -manages touch screen input, system states, and calls draw_screen functions |
cpm219 | 17:f98333612db8 | 174 | *************************/ |
cpm219 | 17:f98333612db8 | 175 | int main() |
cpm219 | 17:f98333612db8 | 176 | { |
cpm219 | 17:f98333612db8 | 177 | uint8_t present_state = 0x0, |
cpm219 | 17:f98333612db8 | 178 | tag = 0x0, |
cpm219 | 17:f98333612db8 | 179 | combo_input = 0x0; |
cpm219 | 17:f98333612db8 | 180 | |
cpm219 | 17:f98333612db8 | 181 | TFT.Calibrate(); |
cpm219 | 17:f98333612db8 | 182 | TFT.Flush_Co_Buffer(); // Download the command list into fifo |
cpm219 | 17:f98333612db8 | 183 | TFT.WaitCmdfifo_empty(); // Wait till coprocessor completes the operation |
cpm219 | 17:f98333612db8 | 184 | // Start_Screen("gui by\0"); |
cpm219 | 17:f98333612db8 | 185 | main_menu(0x0); |
cpm219 | 17:f98333612db8 | 186 | |
cpm219 | 17:f98333612db8 | 187 | /* gui manager: -handles touch screen input -updates system state -calls draw screen function */ |
cpm219 | 17:f98333612db8 | 188 | while(1) |
cpm219 | 17:f98333612db8 | 189 | { |
cpm219 | 17:f98333612db8 | 190 | tag = 0x0; |
cpm219 | 17:f98333612db8 | 191 | while(0x0 == tag) |
cpm219 | 17:f98333612db8 | 192 | { |
cpm219 | 17:f98333612db8 | 193 | tag = ((TFT.Rd32(REG_TRACKER)) & mask_reg_tracker_tag); //read tag register, update tag variable |
cpm219 | 17:f98333612db8 | 194 | } |
cpm219 | 17:f98333612db8 | 195 | combo_input = ( present_state << 3) + tag; // concatenate present_state with tag to form combo input |
cpm219 | 17:f98333612db8 | 196 | present_state = state_lookup[combo_input]; // based on present state and touch input, update present state |
cpm219 | 17:f98333612db8 | 197 | (*draw_screen[present_state])(tag); // use present_state as operand to draw screen function |
cpm219 | 17:f98333612db8 | 198 | TFT.Sleep(10); // wait 10ms for next check |
cpm219 | 17:f98333612db8 | 199 | } |
cpm219 | 17:f98333612db8 | 200 | |
cpm219 | 17:f98333612db8 | 201 | return 0; |
cpm219 | 17:f98333612db8 | 202 | } |
cpm219 | 17:f98333612db8 | 203 | // end of main() |
cpm219 | 17:f98333612db8 | 204 | |
cpm219 | 17:f98333612db8 | 205 | |
cpm219 | 17:f98333612db8 | 206 | /************************ |
cpm219 | 17:f98333612db8 | 207 | function: collect_data |
cpm219 | 17:f98333612db8 | 208 | description: store ADC samples |
cpm219 | 17:f98333612db8 | 209 | *************************/ |
cpm219 | 17:f98333612db8 | 210 | void collect_data(int16_t *p) |
cpm219 | 17:f98333612db8 | 211 | { |
cpm219 | 17:f98333612db8 | 212 | for(i=0;i<400;i++) |
cpm219 | 17:f98333612db8 | 213 | { |
cpm219 | 17:f98333612db8 | 214 | //p points to data1 array |
cpm219 | 17:f98333612db8 | 215 | *(p +i) = square_wave_lookup[i]; |
cpm219 | 17:f98333612db8 | 216 | } |
cpm219 | 17:f98333612db8 | 217 | } |
cpm219 | 17:f98333612db8 | 218 | |
montgojj | 4:a48fc7a3bda9 | 219 | |
cpm219 | 17:f98333612db8 | 220 | /************************ |
cpm219 | 17:f98333612db8 | 221 | function: main menu |
cpm219 | 17:f98333612db8 | 222 | description: draw main menu screen |
cpm219 | 17:f98333612db8 | 223 | *************************/ |
cpm219 | 17:f98333612db8 | 224 | void main_menu(uint8_t tag) |
cpm219 | 17:f98333612db8 | 225 | { |
cpm219 | 17:f98333612db8 | 226 | TFT.Wr16(REG_PWM_DUTY, 100); |
cpm219 | 17:f98333612db8 | 227 | |
cpm219 | 17:f98333612db8 | 228 | //start new display list |
cpm219 | 17:f98333612db8 | 229 | TFT.DLstart(); // start a new display command list |
cpm219 | 17:f98333612db8 | 230 | TFT.DL(CLEAR_COLOR_RGB(255,255,255)); // set the clear color to white |
cpm219 | 17:f98333612db8 | 231 | TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer |
cpm219 | 17:f98333612db8 | 232 | |
cpm219 | 17:f98333612db8 | 233 | //buttons |
cpm219 | 17:f98333612db8 | 234 | TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 235 | //button A |
cpm219 | 17:f98333612db8 | 236 | TFT.Track( 50, 165, 200, 150, 1); // track aree of button A |
cpm219 | 17:f98333612db8 | 237 | TFT.DL(TAG(1)); // assign TAG value 1 to "mode A" button |
cpm219 | 17:f98333612db8 | 238 | TFT.Button(50, 165, 200, 150, font_button, 0, text_a); |
cpm219 | 17:f98333612db8 | 239 | |
cpm219 | 17:f98333612db8 | 240 | //button B |
cpm219 | 17:f98333612db8 | 241 | TFT.Track( 300, 165, 200, 150, 2); // track aree of button B |
cpm219 | 17:f98333612db8 | 242 | TFT.DL(TAG(2)); // assign TAG value 2 to "mode B" button |
cpm219 | 17:f98333612db8 | 243 | TFT.Button(300, 165, 200, 150, font_button, 0, text_b); |
cpm219 | 17:f98333612db8 | 244 | |
cpm219 | 17:f98333612db8 | 245 | //button C |
cpm219 | 17:f98333612db8 | 246 | TFT.Track( 550, 165, 200, 150, 3); // track aree of button C |
cpm219 | 17:f98333612db8 | 247 | TFT.DL(TAG(3)); // assign TAG value 3 to "mode C" button |
cpm219 | 17:f98333612db8 | 248 | TFT.Button(550, 165, 200, 150, font_button, 0, text_c); |
cpm219 | 17:f98333612db8 | 249 | |
cpm219 | 17:f98333612db8 | 250 | TFT.DL(TAG(0)); // assign TAG value 0 to everything else |
cpm219 | 17:f98333612db8 | 251 | |
cpm219 | 17:f98333612db8 | 252 | //title text |
cpm219 | 17:f98333612db8 | 253 | TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 254 | TFT.Text((TFT.DispWidth/2), TFT.DispHeight/8, font_title, OPT_CENTERX, text_menu); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 255 | |
cpm219 | 17:f98333612db8 | 256 | //author text |
cpm219 | 17:f98333612db8 | 257 | TFT.DL(COLOR_RGB(0x00, 0x00, 0x00)); |
cpm219 | 17:f98333612db8 | 258 | TFT.Text((TFT.DispWidth*15/16)-5, 460, font_author, OPT_CENTERX, text_author); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 259 | |
cpm219 | 17:f98333612db8 | 260 | //display the screen |
cpm219 | 17:f98333612db8 | 261 | TFT.DL(DISPLAY()); // display the image |
cpm219 | 17:f98333612db8 | 262 | TFT.Swap(); // swap the current display list |
cpm219 | 17:f98333612db8 | 263 | TFT.Flush_Co_Buffer(); // download the command list into fifo |
cpm219 | 17:f98333612db8 | 264 | TFT.WaitCmdfifo_empty(); // wait till coprocessor completes the operation |
cpm219 | 17:f98333612db8 | 265 | |
cpm219 | 17:f98333612db8 | 266 | } |
cpm219 | 17:f98333612db8 | 267 | |
cpm219 | 17:f98333612db8 | 268 | |
cpm219 | 17:f98333612db8 | 269 | //fallback mode_a |
cpm219 | 17:f98333612db8 | 270 | ///************************ |
cpm219 | 17:f98333612db8 | 271 | // function: mode_a |
cpm219 | 17:f98333612db8 | 272 | // description: draws mode a screen |
cpm219 | 17:f98333612db8 | 273 | //*************************/ |
cpm219 | 17:f98333612db8 | 274 | //void mode_a(void) |
cpm219 | 17:f98333612db8 | 275 | //{ |
cpm219 | 17:f98333612db8 | 276 | // TFT.Track( 50, 355, 100, 75, 4); // track aree of button back |
cpm219 | 17:f98333612db8 | 277 | // |
cpm219 | 17:f98333612db8 | 278 | // //start new display list |
cpm219 | 17:f98333612db8 | 279 | // TFT.DLstart(); // start a new display command list |
cpm219 | 17:f98333612db8 | 280 | // TFT.DL(CLEAR_COLOR_RGB(255,255,255)); // set the clear color to white |
cpm219 | 17:f98333612db8 | 281 | // TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer |
cpm219 | 17:f98333612db8 | 282 | // |
cpm219 | 17:f98333612db8 | 283 | // //back button |
cpm219 | 17:f98333612db8 | 284 | // TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 285 | // TFT.DL(TAG(4)); |
cpm219 | 17:f98333612db8 | 286 | // TFT.Button(50, 355, 100, 75, font_button, 0, text_back); // assign TAG value 4 to text_back button |
cpm219 | 17:f98333612db8 | 287 | // |
cpm219 | 17:f98333612db8 | 288 | // TFT.DL(TAG(0)); // assign TAG value 0 to everything else |
cpm219 | 17:f98333612db8 | 289 | // |
cpm219 | 17:f98333612db8 | 290 | // //title text |
cpm219 | 17:f98333612db8 | 291 | // TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 292 | // TFT.Text((TFT.DispWidth/2), TFT.DispHeight/8, font_title, OPT_CENTERX, text_a); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 293 | // |
cpm219 | 17:f98333612db8 | 294 | // //author text |
cpm219 | 17:f98333612db8 | 295 | // TFT.DL(COLOR_RGB(0x00, 0x00, 0x00)); |
cpm219 | 17:f98333612db8 | 296 | // TFT.Text((TFT.DispWidth*15/16), 460, font_author, OPT_CENTERX, text_author); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 297 | // |
cpm219 | 17:f98333612db8 | 298 | // //display the screen |
cpm219 | 17:f98333612db8 | 299 | // TFT.DL(DISPLAY()); // display the image |
cpm219 | 17:f98333612db8 | 300 | // TFT.Swap(); // swap the current display list |
cpm219 | 17:f98333612db8 | 301 | // TFT.Flush_Co_Buffer(); // download the command list into fifo |
cpm219 | 17:f98333612db8 | 302 | // TFT.WaitCmdfifo_empty(); // wait till coprocessor completes the operation |
cpm219 | 17:f98333612db8 | 303 | // |
cpm219 | 17:f98333612db8 | 304 | //} |
cpm219 | 17:f98333612db8 | 305 | |
cratliff | 0:aa55c6eb6867 | 306 | |
cpm219 | 17:f98333612db8 | 307 | /************************ |
cpm219 | 17:f98333612db8 | 308 | function: mode_a |
cpm219 | 17:f98333612db8 | 309 | description: draws mode a screen |
cpm219 | 17:f98333612db8 | 310 | *************************/ |
cpm219 | 17:f98333612db8 | 311 | void mode_a(uint8_t tag) |
cpm219 | 17:f98333612db8 | 312 | { |
cpm219 | 17:f98333612db8 | 313 | // collect_data(p); |
cpm219 | 17:f98333612db8 | 314 | |
cpm219 | 17:f98333612db8 | 315 | combo_inputs = ( present_states << 3) + tag; // concatenate present_state with tag to form combo input |
cpm219 | 17:f98333612db8 | 316 | present_states = plot_lookup[combo_inputs]; // based on present state and touch input, update present state |
cpm219 | 17:f98333612db8 | 317 | |
cpm219 | 17:f98333612db8 | 318 | //start new display list |
cpm219 | 17:f98333612db8 | 319 | TFT.DLstart(); // start a new display command list |
cpm219 | 17:f98333612db8 | 320 | TFT.DL(CLEAR_COLOR_RGB(255,255,255)); // set the clear color to white |
cpm219 | 17:f98333612db8 | 321 | TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer |
cpm219 | 17:f98333612db8 | 322 | TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 323 | |
cpm219 | 17:f98333612db8 | 324 | //back button |
cpm219 | 17:f98333612db8 | 325 | TFT.Track( 50, 355, 100, 75, 4); // track aree of button back |
cpm219 | 17:f98333612db8 | 326 | TFT.DL(TAG(4)); |
cpm219 | 17:f98333612db8 | 327 | TFT.Button(50, 355, 100, 75, font_button, 4, text_back); // assign TAG value 4 to text_back button |
cpm219 | 17:f98333612db8 | 328 | |
cpm219 | 17:f98333612db8 | 329 | //plot square button |
cpm219 | 17:f98333612db8 | 330 | TFT.Track( 200, 355, 100, 75, 6); // track aree of button square |
cpm219 | 17:f98333612db8 | 331 | TFT.DL(TAG(6)); |
cpm219 | 17:f98333612db8 | 332 | TFT.Button(200, 355, 100, 75, font_button, 6, "square"); // assign TAG value 1 to text_back button//back button |
cpm219 | 17:f98333612db8 | 333 | |
cpm219 | 17:f98333612db8 | 334 | //plot triangle button |
cpm219 | 17:f98333612db8 | 335 | TFT.Track( 350, 355, 100, 75, 2); // track aree of button triangle |
cpm219 | 17:f98333612db8 | 336 | TFT.DL(TAG(2)); |
cpm219 | 17:f98333612db8 | 337 | TFT.Button(350, 355, 100, 75, font_button, 2, "triangle"); // assign TAG value 2 to text_back button//back button |
cpm219 | 17:f98333612db8 | 338 | |
cpm219 | 17:f98333612db8 | 339 | //plot sine button |
cpm219 | 17:f98333612db8 | 340 | TFT.Track( 500, 355, 100, 75, 3); // track aree of button sine |
cpm219 | 17:f98333612db8 | 341 | TFT.DL(TAG(3)); |
cpm219 | 17:f98333612db8 | 342 | TFT.Button(500, 355, 100, 75, font_button, 3, "sine"); // assign TAG value 3 to text_back button//back button |
cpm219 | 17:f98333612db8 | 343 | |
cpm219 | 17:f98333612db8 | 344 | //plot nothing button |
cpm219 | 17:f98333612db8 | 345 | TFT.Track( 650, 355, 100, 75, 5); // track aree of button square |
cpm219 | 17:f98333612db8 | 346 | TFT.DL(TAG(5)); |
cpm219 | 17:f98333612db8 | 347 | TFT.Button(650, 355, 100, 75, font_button, 5, "clear"); // assign TAG value 1 to text_back button//back button |
cpm219 | 17:f98333612db8 | 348 | |
cpm219 | 17:f98333612db8 | 349 | |
cpm219 | 17:f98333612db8 | 350 | TFT.DL(TAG(0)); // assign TAG value 0 to everything else |
cpm219 | 17:f98333612db8 | 351 | |
cpm219 | 17:f98333612db8 | 352 | //border for plot |
cpm219 | 17:f98333612db8 | 353 | TFT.DL(COLOR_RGB(0x00,0x00,0x00)); |
cpm219 | 17:f98333612db8 | 354 | TFT.DL(BEGIN(LINES)); |
cpm219 | 17:f98333612db8 | 355 | TFT.DL(LINE_WIDTH(3 * 16)); |
cpm219 | 17:f98333612db8 | 356 | |
cpm219 | 17:f98333612db8 | 357 | TFT.DL(VERTEX2F(50*16,150*16)); |
cpm219 | 17:f98333612db8 | 358 | TFT.DL(VERTEX2F(50*16,350*16)); |
cpm219 | 17:f98333612db8 | 359 | |
cpm219 | 17:f98333612db8 | 360 | TFT.DL(VERTEX2F(50*16,350*16)); |
cpm219 | 17:f98333612db8 | 361 | TFT.DL(VERTEX2F(750*16,350*16)); |
cpm219 | 17:f98333612db8 | 362 | |
cpm219 | 17:f98333612db8 | 363 | TFT.DL(VERTEX2F(750*16,350*16)); |
cpm219 | 17:f98333612db8 | 364 | TFT.DL(VERTEX2F(750*16,150*16)); |
cpm219 | 17:f98333612db8 | 365 | |
cpm219 | 17:f98333612db8 | 366 | TFT.DL(VERTEX2F(750*16,150*16)); |
cpm219 | 17:f98333612db8 | 367 | TFT.DL(VERTEX2F(50*16,150*16)); |
cpm219 | 17:f98333612db8 | 368 | |
cpm219 | 17:f98333612db8 | 369 | TFT.DL(END()); |
cpm219 | 17:f98333612db8 | 370 | |
cpm219 | 17:f98333612db8 | 371 | |
cpm219 | 17:f98333612db8 | 372 | //plot algorithm |
cpm219 | 17:f98333612db8 | 373 | TFT.DL( BEGIN(LINE_STRIP) ); |
cpm219 | 17:f98333612db8 | 374 | TFT.DL(LINE_WIDTH(3 * 16)); |
cpm219 | 17:f98333612db8 | 375 | (*plot[present_states])(); // use present_state as operand to draw screen function |
cpm219 | 17:f98333612db8 | 376 | |
cpm219 | 17:f98333612db8 | 377 | //title text |
cpm219 | 17:f98333612db8 | 378 | TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 379 | TFT.Text((TFT.DispWidth/2), TFT.DispHeight/8, font_title, OPT_CENTERX, text_a); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 380 | |
cpm219 | 17:f98333612db8 | 381 | //author text |
cpm219 | 17:f98333612db8 | 382 | TFT.DL(COLOR_RGB(0x00, 0x00, 0x00)); |
cpm219 | 17:f98333612db8 | 383 | TFT.Text((TFT.DispWidth*15/16)-5, 460, font_author, OPT_CENTERX, text_author); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 384 | |
cpm219 | 17:f98333612db8 | 385 | //display the screen |
cpm219 | 17:f98333612db8 | 386 | TFT.DL(DISPLAY()); // display the image |
cpm219 | 17:f98333612db8 | 387 | TFT.Swap(); // swap the current display list |
cpm219 | 17:f98333612db8 | 388 | TFT.Flush_Co_Buffer(); // download the command list into fifo |
cpm219 | 17:f98333612db8 | 389 | TFT.WaitCmdfifo_empty(); // wait till coprocessor completes the operation |
cpm219 | 17:f98333612db8 | 390 | } |
cpm219 | 17:f98333612db8 | 391 | |
cpm219 | 17:f98333612db8 | 392 | |
cpm219 | 17:f98333612db8 | 393 | //fallback mode_b |
cpm219 | 17:f98333612db8 | 394 | ///************************ |
cpm219 | 17:f98333612db8 | 395 | // function: mode b |
cpm219 | 17:f98333612db8 | 396 | // description: draws mode b screen. |
cpm219 | 17:f98333612db8 | 397 | //*************************/ |
cpm219 | 17:f98333612db8 | 398 | //void mode_b(void) |
cpm219 | 17:f98333612db8 | 399 | //{ |
cpm219 | 17:f98333612db8 | 400 | // |
cpm219 | 17:f98333612db8 | 401 | // TFT.Track( 50, 355, 100, 75, 4); // track aree of button back |
cpm219 | 17:f98333612db8 | 402 | // |
cpm219 | 17:f98333612db8 | 403 | // //start new display list |
cpm219 | 17:f98333612db8 | 404 | // TFT.DLstart(); // start a new display command list |
cpm219 | 17:f98333612db8 | 405 | // TFT.DL(CLEAR_COLOR_RGB(255,255,255)); // set the clear color to white |
cpm219 | 17:f98333612db8 | 406 | // TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer |
cpm219 | 17:f98333612db8 | 407 | // |
cpm219 | 17:f98333612db8 | 408 | // //buttons |
cpm219 | 17:f98333612db8 | 409 | // TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 410 | // |
cpm219 | 17:f98333612db8 | 411 | // TFT.DL(TAG(4)); |
cpm219 | 17:f98333612db8 | 412 | // TFT.Button(50, 355, 100, 75, font_button, 0, text_back); // assign TAG value 4 to text_back button |
cpm219 | 17:f98333612db8 | 413 | // |
cpm219 | 17:f98333612db8 | 414 | // TFT.DL(TAG(0)); // assign TAG value 0 to everything else |
cpm219 | 17:f98333612db8 | 415 | // |
cpm219 | 17:f98333612db8 | 416 | // |
cpm219 | 17:f98333612db8 | 417 | // //title text |
cpm219 | 17:f98333612db8 | 418 | // TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 419 | // TFT.Text((TFT.DispWidth/2), TFT.DispHeight/8, font_title, OPT_CENTERX, text_b); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 420 | // |
cpm219 | 17:f98333612db8 | 421 | // //author text |
cpm219 | 17:f98333612db8 | 422 | // TFT.DL(COLOR_RGB(0x00, 0x00, 0x00)); |
cpm219 | 17:f98333612db8 | 423 | // TFT.Text((TFT.DispWidth*15/16), 460, font_author, OPT_CENTERX, text_author); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 424 | // |
cpm219 | 17:f98333612db8 | 425 | // //display the screen |
cpm219 | 17:f98333612db8 | 426 | // TFT.DL(DISPLAY()); // display the image |
cpm219 | 17:f98333612db8 | 427 | // TFT.Swap(); // swap the current display list |
cpm219 | 17:f98333612db8 | 428 | // TFT.Flush_Co_Buffer(); // download the command list into fifo |
cpm219 | 17:f98333612db8 | 429 | // TFT.WaitCmdfifo_empty(); // wait till coprocessor completes the operation |
cpm219 | 17:f98333612db8 | 430 | //} |
cpm219 | 17:f98333612db8 | 431 | |
cratliff | 5:e2e04cb5eada | 432 | |
cpm219 | 17:f98333612db8 | 433 | /************************ |
cpm219 | 17:f98333612db8 | 434 | function: mode b |
cpm219 | 17:f98333612db8 | 435 | description: draws mode b screen. |
cpm219 | 17:f98333612db8 | 436 | *************************/ |
cpm219 | 17:f98333612db8 | 437 | void mode_b(uint8_t tag) |
cpm219 | 17:f98333612db8 | 438 | { |
cpm219 | 17:f98333612db8 | 439 | |
cpm219 | 17:f98333612db8 | 440 | |
cpm219 | 17:f98333612db8 | 441 | //start new display list |
cpm219 | 17:f98333612db8 | 442 | TFT.DLstart(); // start a new display command list |
cpm219 | 17:f98333612db8 | 443 | TFT.DL(CLEAR_COLOR_RGB(255,255,255)); // set the clear color to white |
cpm219 | 17:f98333612db8 | 444 | TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer |
cpm219 | 17:f98333612db8 | 445 | |
cpm219 | 17:f98333612db8 | 446 | TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 447 | |
cpm219 | 17:f98333612db8 | 448 | //back button |
cpm219 | 17:f98333612db8 | 449 | TFT.Track( 50, 355, 100, 75, 4); // track aree of button back |
cpm219 | 17:f98333612db8 | 450 | TFT.DL(TAG(4)); |
cpm219 | 17:f98333612db8 | 451 | TFT.Button(50, 355, 100, 75, font_button, 0, text_back); // assign TAG value 4 to text_back button |
cpm219 | 17:f98333612db8 | 452 | |
cpm219 | 17:f98333612db8 | 453 | TFT.DL(TAG(0)); // assign TAG value 0 to everything else |
cpm219 | 17:f98333612db8 | 454 | |
cpm219 | 17:f98333612db8 | 455 | //title text |
cpm219 | 17:f98333612db8 | 456 | TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 457 | TFT.Text((TFT.DispWidth/2), TFT.DispHeight/8, font_title, OPT_CENTERX, text_b); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 458 | |
cpm219 | 17:f98333612db8 | 459 | //author text |
cpm219 | 17:f98333612db8 | 460 | TFT.DL(COLOR_RGB(0x00, 0x00, 0x00)); |
cpm219 | 17:f98333612db8 | 461 | TFT.Text((TFT.DispWidth*15/16)-5, 460, font_author, OPT_CENTERX, text_author); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 462 | |
cpm219 | 17:f98333612db8 | 463 | //display the screen |
cpm219 | 17:f98333612db8 | 464 | TFT.DL(DISPLAY()); // display the image |
cpm219 | 17:f98333612db8 | 465 | TFT.Swap(); // swap the current display list |
cpm219 | 17:f98333612db8 | 466 | TFT.Flush_Co_Buffer(); // download the command list into fifo |
cpm219 | 17:f98333612db8 | 467 | TFT.WaitCmdfifo_empty(); // wait till coprocessor completes the operation |
cpm219 | 17:f98333612db8 | 468 | } |
cpm219 | 17:f98333612db8 | 469 | |
cpm219 | 17:f98333612db8 | 470 | |
cpm219 | 17:f98333612db8 | 471 | // fallback mode_c |
cpm219 | 17:f98333612db8 | 472 | ///************************ |
cpm219 | 17:f98333612db8 | 473 | // function: mode_c |
cpm219 | 17:f98333612db8 | 474 | // description: draws mode C screen |
cpm219 | 17:f98333612db8 | 475 | //*************************/ |
cpm219 | 17:f98333612db8 | 476 | //void mode_c(void) |
cpm219 | 17:f98333612db8 | 477 | //{ |
cpm219 | 17:f98333612db8 | 478 | // |
cpm219 | 17:f98333612db8 | 479 | // //start new display list |
cpm219 | 17:f98333612db8 | 480 | // TFT.DLstart(); // start a new display command list |
cpm219 | 17:f98333612db8 | 481 | // TFT.DL(CLEAR_COLOR_RGB(255,255,255)); // set the clear color to white |
cpm219 | 17:f98333612db8 | 482 | // TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer |
cpm219 | 17:f98333612db8 | 483 | // |
cpm219 | 17:f98333612db8 | 484 | // //buttons |
cpm219 | 17:f98333612db8 | 485 | // TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 486 | // |
cpm219 | 17:f98333612db8 | 487 | // TFT.Track( 50, 355, 100, 75, 4); // track aree of button back |
cpm219 | 17:f98333612db8 | 488 | // TFT.DL(TAG(4)); |
cpm219 | 17:f98333612db8 | 489 | // TFT.Button(50, 355, 100, 75, font_button, 0, text_back); // assign TAG value 4 to text_back button |
cpm219 | 17:f98333612db8 | 490 | // |
cpm219 | 17:f98333612db8 | 491 | // TFT.DL(TAG(0)); // assign TAG value 0 to everything else |
cpm219 | 17:f98333612db8 | 492 | // |
cpm219 | 17:f98333612db8 | 493 | // |
cpm219 | 17:f98333612db8 | 494 | // //title text |
cpm219 | 17:f98333612db8 | 495 | // TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 496 | // TFT.Text((TFT.DispWidth/2), TFT.DispHeight/8, font_title, OPT_CENTERX, text_c); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 497 | // |
cpm219 | 17:f98333612db8 | 498 | // //author text |
cpm219 | 17:f98333612db8 | 499 | // TFT.DL(COLOR_RGB(0x00, 0x00, 0x00)); |
cpm219 | 17:f98333612db8 | 500 | // TFT.Text((TFT.DispWidth*15/16), 460, font_author, OPT_CENTERX, text_author); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 501 | // |
cpm219 | 17:f98333612db8 | 502 | // //display the screen |
cpm219 | 17:f98333612db8 | 503 | // TFT.DL(DISPLAY()); // display the image |
cpm219 | 17:f98333612db8 | 504 | // TFT.Swap(); // swap the current display list |
cpm219 | 17:f98333612db8 | 505 | // TFT.Flush_Co_Buffer(); // download the command list into fifo |
cpm219 | 17:f98333612db8 | 506 | // TFT.WaitCmdfifo_empty(); // wait till coprocessor completes the operation |
cpm219 | 17:f98333612db8 | 507 | //} |
cpm219 | 17:f98333612db8 | 508 | |
cpm219 | 17:f98333612db8 | 509 | |
cpm219 | 17:f98333612db8 | 510 | /************************ |
cpm219 | 17:f98333612db8 | 511 | function: mode_c |
cpm219 | 17:f98333612db8 | 512 | description: draws mode C screen |
cpm219 | 17:f98333612db8 | 513 | *************************/ |
cpm219 | 17:f98333612db8 | 514 | void mode_c(uint8_t tag) |
cpm219 | 17:f98333612db8 | 515 | { |
cpm219 | 17:f98333612db8 | 516 | //start new display list |
cpm219 | 17:f98333612db8 | 517 | TFT.DLstart(); // start a new display command list |
cpm219 | 17:f98333612db8 | 518 | TFT.DL(CLEAR_COLOR_RGB(255,255,255)); // set the clear color to white |
cpm219 | 17:f98333612db8 | 519 | TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer |
cpm219 | 17:f98333612db8 | 520 | |
cpm219 | 17:f98333612db8 | 521 | //back button |
cpm219 | 17:f98333612db8 | 522 | TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 523 | |
cpm219 | 17:f98333612db8 | 524 | TFT.Track( 50, 355, 100, 75, 4); // track aree of button back |
cpm219 | 17:f98333612db8 | 525 | TFT.DL(TAG(4)); |
cpm219 | 17:f98333612db8 | 526 | TFT.Button(50, 355, 100, 75, font_button, 0, text_back); // assign TAG value 4 to text_back button |
cpm219 | 17:f98333612db8 | 527 | |
cpm219 | 17:f98333612db8 | 528 | TFT.DL(TAG(0)); // assign TAG value 0 to everything else |
cpm219 | 17:f98333612db8 | 529 | |
cpm219 | 17:f98333612db8 | 530 | //title text |
cpm219 | 17:f98333612db8 | 531 | TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); |
cpm219 | 17:f98333612db8 | 532 | TFT.Text((TFT.DispWidth/2), TFT.DispHeight/8, font_title, OPT_CENTERX, text_c); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 533 | |
cpm219 | 17:f98333612db8 | 534 | //author text |
cpm219 | 17:f98333612db8 | 535 | TFT.DL(COLOR_RGB(0x00, 0x00, 0x00)); |
cpm219 | 17:f98333612db8 | 536 | TFT.Text((TFT.DispWidth*15/16)-5, 460, font_author, OPT_CENTERX, text_author); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 537 | |
cpm219 | 17:f98333612db8 | 538 | //display the screen |
cpm219 | 17:f98333612db8 | 539 | TFT.DL(DISPLAY()); // display the image |
cpm219 | 17:f98333612db8 | 540 | TFT.Swap(); // swap the current display list |
cpm219 | 17:f98333612db8 | 541 | TFT.Flush_Co_Buffer(); // download the command list into fifo |
cpm219 | 17:f98333612db8 | 542 | TFT.WaitCmdfifo_empty(); // wait till coprocessor completes the operation |
cpm219 | 17:f98333612db8 | 543 | } |
cpm219 | 17:f98333612db8 | 544 | |
cpm219 | 17:f98333612db8 | 545 | |
cpm219 | 17:f98333612db8 | 546 | /************************ |
cpm219 | 17:f98333612db8 | 547 | function: plot_nothing |
cpm219 | 17:f98333612db8 | 548 | description: clears plot area |
cpm219 | 17:f98333612db8 | 549 | *************************/ |
cpm219 | 17:f98333612db8 | 550 | void plot_nothing(void) |
cpm219 | 17:f98333612db8 | 551 | { |
cpm219 | 17:f98333612db8 | 552 | TFT.DL(COLOR_RGB(0x00, 0x00, 0x00)); |
cpm219 | 17:f98333612db8 | 553 | |
cpm219 | 17:f98333612db8 | 554 | } |
cpm219 | 17:f98333612db8 | 555 | |
cpm219 | 17:f98333612db8 | 556 | |
cpm219 | 17:f98333612db8 | 557 | /************************ |
cpm219 | 17:f98333612db8 | 558 | function: plot_square |
cpm219 | 17:f98333612db8 | 559 | description: plots square wave |
cpm219 | 17:f98333612db8 | 560 | *************************/ |
cpm219 | 17:f98333612db8 | 561 | void plot_square(void) |
cpm219 | 17:f98333612db8 | 562 | { |
cpm219 | 17:f98333612db8 | 563 | TFT.DL(COLOR_RGB(0xFF, 0x00, 0x00)); |
cpm219 | 17:f98333612db8 | 564 | for(i = 0;i<40;i++) |
cpm219 | 17:f98333612db8 | 565 | { |
cpm219 | 17:f98333612db8 | 566 | TFT.DL( VERTEX2F(50*16 +18*i*16, 250*16 + (square_wave_lookup[i])*16) ); |
cpm219 | 17:f98333612db8 | 567 | } |
cpm219 | 17:f98333612db8 | 568 | } |
cpm219 | 17:f98333612db8 | 569 | |
cpm219 | 17:f98333612db8 | 570 | |
cpm219 | 17:f98333612db8 | 571 | /************************ |
cpm219 | 17:f98333612db8 | 572 | function: plot_triangle |
cpm219 | 17:f98333612db8 | 573 | description: plots triangle wave |
cpm219 | 17:f98333612db8 | 574 | *************************/ |
cpm219 | 17:f98333612db8 | 575 | void plot_triangle(void) |
cpm219 | 17:f98333612db8 | 576 | { |
cpm219 | 17:f98333612db8 | 577 | TFT.DL(COLOR_RGB(0x00, 0xFF, 0x00)); |
cpm219 | 17:f98333612db8 | 578 | for(i = 0;i<40;i++) |
cpm219 | 17:f98333612db8 | 579 | { |
cpm219 | 17:f98333612db8 | 580 | TFT.DL( VERTEX2F(50*16 +18*i*16, 250*16 + (tri_wave_lookup[i])*16) ); |
cpm219 | 17:f98333612db8 | 581 | } |
cpm219 | 17:f98333612db8 | 582 | } |
cpm219 | 17:f98333612db8 | 583 | |
cpm219 | 17:f98333612db8 | 584 | |
cpm219 | 17:f98333612db8 | 585 | /************************ |
cpm219 | 17:f98333612db8 | 586 | function: plot_sine |
cpm219 | 17:f98333612db8 | 587 | description: plots sine wave |
cpm219 | 17:f98333612db8 | 588 | *************************/ |
cpm219 | 17:f98333612db8 | 589 | void plot_sine(void) |
cpm219 | 17:f98333612db8 | 590 | { |
cpm219 | 17:f98333612db8 | 591 | TFT.DL(COLOR_RGB(0xFF, 0x00, 0xFF)); |
cpm219 | 17:f98333612db8 | 592 | for(i = 0;i<40;i++) |
cpm219 | 17:f98333612db8 | 593 | { |
cpm219 | 17:f98333612db8 | 594 | TFT.DL( VERTEX2F(50*16 +18*i*16, 250*16 + (sine_wave_lookup[i])*16) ); |
cpm219 | 17:f98333612db8 | 595 | } |
cpm219 | 17:f98333612db8 | 596 | } |
cpm219 | 17:f98333612db8 | 597 | |
cpm219 | 17:f98333612db8 | 598 | /************************ |
cpm219 | 17:f98333612db8 | 599 | function: Start_Screen |
cpm219 | 17:f98333612db8 | 600 | description: draws boot up screen as images are loaded from the sd card |
cpm219 | 17:f98333612db8 | 601 | *************************/ |
cratliff | 0:aa55c6eb6867 | 602 | ft_void_t Start_Screen(ft_char8_t *str) |
cratliff | 0:aa55c6eb6867 | 603 | { |
montgojj | 11:f6a146b62579 | 604 | TFT.DLstart(); // start a new display command list |
montgojj | 11:f6a146b62579 | 605 | TFT.DL(CLEAR_COLOR_RGB(255,255,255)); // set the clear color to white |
montgojj | 11:f6a146b62579 | 606 | TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer |
cpm219 | 17:f98333612db8 | 607 | |
cpm219 | 17:f98333612db8 | 608 | TFT.DL(COLOR_RGB(0x00, 0x7C, 0xC4)); // generate border in SMC blue, all functions are in 1/16 pixel format |
montgojj | 4:a48fc7a3bda9 | 609 | TFT.DL(BEGIN(LINES)); |
montgojj | 4:a48fc7a3bda9 | 610 | TFT.DL(LINE_WIDTH(8 * 16)); |
montgojj | 4:a48fc7a3bda9 | 611 | TFT.DL(VERTEX2F(0*16,0*16)); |
montgojj | 4:a48fc7a3bda9 | 612 | TFT.DL(VERTEX2F(799*16,0*16)); |
montgojj | 4:a48fc7a3bda9 | 613 | TFT.DL(VERTEX2F(799*16,0*16)); |
montgojj | 4:a48fc7a3bda9 | 614 | TFT.DL(VERTEX2F(799*16,479*16)); |
montgojj | 4:a48fc7a3bda9 | 615 | TFT.DL(VERTEX2F(799*16,479*16)); |
montgojj | 4:a48fc7a3bda9 | 616 | TFT.DL(VERTEX2F(0*16,479*16)); |
montgojj | 4:a48fc7a3bda9 | 617 | TFT.DL(VERTEX2F(0*16,479*16)); |
cratliff | 5:e2e04cb5eada | 618 | TFT.DL(VERTEX2F(0*16,0*16)); |
montgojj | 4:a48fc7a3bda9 | 619 | TFT.DL(END()); |
cpm219 | 17:f98333612db8 | 620 | |
cpm219 | 17:f98333612db8 | 621 | TFT.Text((TFT.DispWidth/2), TFT.DispHeight/2, 31, OPT_CENTERX, str); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 622 | TFT.Text((TFT.DispWidth/2), 350, 31, OPT_CENTERX, text_author); // draw Text with font 31 |
cpm219 | 17:f98333612db8 | 623 | TFT.Spinner((TFT.DispWidth/2),TFT.DispHeight/4, 0,0); // draw a animated spinner |
montgojj | 15:25cbc8345067 | 624 | |
cpm219 | 17:f98333612db8 | 625 | TFT.DL(DISPLAY()); // Display the image |
cpm219 | 17:f98333612db8 | 626 | TFT.Swap(); // Swap the current display list |
cpm219 | 17:f98333612db8 | 627 | TFT.Flush_Co_Buffer(); // Download the command list into fifo |
cpm219 | 17:f98333612db8 | 628 | TFT.WaitCmdfifo_empty(); // Wait till coprocessor completes the operation |
cpm219 | 17:f98333612db8 | 629 | TFT.Sleep(1000); // Wait 1s to show |
montgojj | 8:886908a6127c | 630 | } |