![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Basic calculator example to show the LPC4088 Experiment Base Board with a touch LCD from DisplayModule
Dependencies: DmTftLibrary mbed
Fork of dm_calc by
main.cpp@6:2063744e0512, 2014-10-01 (annotated)
- Committer:
- embeddedartists
- Date:
- Wed Oct 01 11:22:41 2014 +0000
- Revision:
- 6:2063744e0512
- Parent:
- 5:d2802a0c5af2
Updated used libraries
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
displaymodule | 0:3713b01e72fe | 1 | /********************************************************************************************** |
displaymodule | 0:3713b01e72fe | 2 | Copyright (c) 2014 DisplayModule. All rights reserved. |
displaymodule | 0:3713b01e72fe | 3 | |
displaymodule | 0:3713b01e72fe | 4 | Redistribution and use of this source code, part of this source code or any compiled binary |
displaymodule | 0:3713b01e72fe | 5 | based on this source code is permitted as long as the above copyright notice and following |
displaymodule | 0:3713b01e72fe | 6 | disclaimer is retained. |
displaymodule | 0:3713b01e72fe | 7 | |
displaymodule | 0:3713b01e72fe | 8 | DISCLAIMER: |
displaymodule | 0:3713b01e72fe | 9 | THIS SOFTWARE IS SUPPLIED "AS IS" WITHOUT ANY WARRANTIES AND SUPPORT. DISPLAYMODULE ASSUMES |
displaymodule | 0:3713b01e72fe | 10 | NO RESPONSIBILITY OR LIABILITY FOR THE USE OF THE SOFTWARE. |
displaymodule | 0:3713b01e72fe | 11 | ********************************************************************************************/ |
displaymodule | 0:3713b01e72fe | 12 | |
displaymodule | 0:3713b01e72fe | 13 | /****************************************************************************** |
displaymodule | 0:3713b01e72fe | 14 | * Includes |
displaymodule | 0:3713b01e72fe | 15 | *****************************************************************************/ |
displaymodule | 0:3713b01e72fe | 16 | |
displaymodule | 0:3713b01e72fe | 17 | #include "mbed.h" |
displaymodule | 0:3713b01e72fe | 18 | |
displaymodule | 0:3713b01e72fe | 19 | #include "DmTftHX8353C.h" |
displaymodule | 0:3713b01e72fe | 20 | #include "DmTftS6D0164.h" |
displaymodule | 0:3713b01e72fe | 21 | #include "DmTftIli9325.h" |
displaymodule | 0:3713b01e72fe | 22 | #include "DmTftIli9341.h" |
displaymodule | 0:3713b01e72fe | 23 | #include "DmTftSsd2119.h" |
displaymodule | 0:3713b01e72fe | 24 | #include "DmTouch.h" |
displaymodule | 0:3713b01e72fe | 25 | |
displaymodule | 0:3713b01e72fe | 26 | #include "Button.h" |
displaymodule | 0:3713b01e72fe | 27 | |
displaymodule | 0:3713b01e72fe | 28 | /****************************************************************************** |
displaymodule | 0:3713b01e72fe | 29 | * Typedefs and defines |
displaymodule | 0:3713b01e72fe | 30 | *****************************************************************************/ |
displaymodule | 0:3713b01e72fe | 31 | |
displaymodule | 0:3713b01e72fe | 32 | typedef enum { |
displaymodule | 0:3713b01e72fe | 33 | MODE_WANT_ARG1, |
displaymodule | 0:3713b01e72fe | 34 | MODE_WANT_ARG1_OR_OP, |
displaymodule | 0:3713b01e72fe | 35 | MODE_WANT_ARG2, |
displaymodule | 0:3713b01e72fe | 36 | MODE_WANT_ARG2_OR_OP, |
displaymodule | 0:3713b01e72fe | 37 | } calc_mode_t; |
displaymodule | 0:3713b01e72fe | 38 | |
displaymodule | 0:3713b01e72fe | 39 | #define MARGIN 5 |
displaymodule | 0:3713b01e72fe | 40 | |
displaymodule | 0:3713b01e72fe | 41 | #define RESULT_MARGIN_X (MARGIN*3) |
displaymodule | 0:3713b01e72fe | 42 | #define RESULT_MARGIN_Y (MARGIN*3) |
displaymodule | 0:3713b01e72fe | 43 | |
displaymodule | 0:3713b01e72fe | 44 | #define NUM_BUTTONS (sizeof(captions)/sizeof(captions[0])) |
displaymodule | 0:3713b01e72fe | 45 | |
embeddedartists | 5:d2802a0c5af2 | 46 | #define NUM_CHARS_IN_DISPLAY 20 |
embeddedartists | 5:d2802a0c5af2 | 47 | |
embeddedartists | 4:71588a1e3618 | 48 | #if 0 |
embeddedartists | 4:71588a1e3618 | 49 | /* Displays without adapter (DM_TFT28_105 & DM_TFT35_107) */ |
displaymodule | 1:9a3ae682a75e | 50 | #define DM_PIN_CS_TOUCH D4 |
displaymodule | 1:9a3ae682a75e | 51 | #define DM_PIN_CS_TFT D10 |
displaymodule | 1:9a3ae682a75e | 52 | #define DM_PIN_CS_SDCARD D8 |
displaymodule | 1:9a3ae682a75e | 53 | #define DM_PIN_CS_FLASH D6 |
displaymodule | 1:9a3ae682a75e | 54 | #else |
embeddedartists | 4:71588a1e3618 | 55 | /* Displays with adapter (all other displays) */ |
embeddedartists | 4:71588a1e3618 | 56 | #define DM_PIN_CS_TFT D4 |
displaymodule | 1:9a3ae682a75e | 57 | #define DM_PIN_CS_SDCARD D10 |
displaymodule | 1:9a3ae682a75e | 58 | #endif |
displaymodule | 0:3713b01e72fe | 59 | |
displaymodule | 1:9a3ae682a75e | 60 | //#define LANDSCAPE |
displaymodule | 0:3713b01e72fe | 61 | |
displaymodule | 0:3713b01e72fe | 62 | /****************************************************************************** |
displaymodule | 0:3713b01e72fe | 63 | * Local variables |
displaymodule | 0:3713b01e72fe | 64 | *****************************************************************************/ |
displaymodule | 0:3713b01e72fe | 65 | |
embeddedartists | 4:71588a1e3618 | 66 | DmTftIli9325 tft; /* DM_TFT28_103 and DM_TFT24_104 with adapter in arduino J1 contact */ |
embeddedartists | 4:71588a1e3618 | 67 | //DmTftIli9341 tft; /* DM_TFT28_105 directly in arduino J1 contact (no adapter) */ |
embeddedartists | 4:71588a1e3618 | 68 | //DmTftSsd2119 tft; /* DM_TFT35_107 directly in arduino J1 contact (no adapter) */ |
displaymodule | 0:3713b01e72fe | 69 | |
embeddedartists | 4:71588a1e3618 | 70 | //DmTouch touch(DmTouch::DM_TFT28_103, DmTouch::Software); |
embeddedartists | 4:71588a1e3618 | 71 | DmTouch touch(DmTouch::DM_TFT24_104, DmTouch::Software); |
embeddedartists | 4:71588a1e3618 | 72 | //DmTouch touch(DmTouch::DM_TFT28_105); |
displaymodule | 0:3713b01e72fe | 73 | //DmTouch touch(DmTouch::DM_TFT35_107); |
displaymodule | 0:3713b01e72fe | 74 | |
embeddedartists | 4:71588a1e3618 | 75 | #ifdef DM_PIN_CS_TOUCH |
embeddedartists | 4:71588a1e3618 | 76 | DigitalInOut csTouch(DM_PIN_CS_TOUCH, PIN_OUTPUT, PullUp, 1); |
embeddedartists | 4:71588a1e3618 | 77 | #endif |
displaymodule | 0:3713b01e72fe | 78 | DigitalInOut csDisplay(DM_PIN_CS_TFT, PIN_OUTPUT, PullUp, 1); |
displaymodule | 0:3713b01e72fe | 79 | DigitalInOut csSDCard(DM_PIN_CS_SDCARD, PIN_OUTPUT, PullUp, 1); |
displaymodule | 0:3713b01e72fe | 80 | #ifdef DM_PIN_CS_FLASH |
displaymodule | 0:3713b01e72fe | 81 | DigitalInOut csFlash(DM_PIN_CS_FLASH, PIN_OUTPUT, PullUp, 1); |
displaymodule | 0:3713b01e72fe | 82 | #endif |
displaymodule | 0:3713b01e72fe | 83 | |
displaymodule | 1:9a3ae682a75e | 84 | #ifdef LANDSCAPE |
displaymodule | 1:9a3ae682a75e | 85 | #define BUTTONS_PER_LINE 6 |
displaymodule | 1:9a3ae682a75e | 86 | #define BUTTONS_NUM_LINES 3 |
displaymodule | 1:9a3ae682a75e | 87 | /* |
displaymodule | 1:9a3ae682a75e | 88 | * 1 2 3 4 5 + |
displaymodule | 1:9a3ae682a75e | 89 | * 6 7 8 9 0 - |
displaymodule | 1:9a3ae682a75e | 90 | * * / = clr |
displaymodule | 1:9a3ae682a75e | 91 | */ |
displaymodule | 1:9a3ae682a75e | 92 | const char* captions[] = { |
displaymodule | 1:9a3ae682a75e | 93 | "1","2","3","4","5","+", |
displaymodule | 1:9a3ae682a75e | 94 | "6","7","8","9","0","-", |
displaymodule | 1:9a3ae682a75e | 95 | "*","/","=","clr", |
displaymodule | 1:9a3ae682a75e | 96 | }; |
displaymodule | 1:9a3ae682a75e | 97 | #else |
displaymodule | 1:9a3ae682a75e | 98 | #define BUTTONS_PER_LINE 4 |
displaymodule | 1:9a3ae682a75e | 99 | #define BUTTONS_NUM_LINES 4 |
displaymodule | 1:9a3ae682a75e | 100 | /* |
displaymodule | 1:9a3ae682a75e | 101 | * 1 2 3 + |
displaymodule | 1:9a3ae682a75e | 102 | * 4 5 6 - |
displaymodule | 1:9a3ae682a75e | 103 | * 7 8 9 * |
displaymodule | 1:9a3ae682a75e | 104 | * 0 = clr / |
displaymodule | 1:9a3ae682a75e | 105 | */ |
displaymodule | 1:9a3ae682a75e | 106 | const char* captions[] = { |
displaymodule | 1:9a3ae682a75e | 107 | "1","2","3","+", |
displaymodule | 1:9a3ae682a75e | 108 | "4","5","6","-", |
displaymodule | 1:9a3ae682a75e | 109 | "7","8","9","*", |
displaymodule | 1:9a3ae682a75e | 110 | "0","=","clr","/", |
displaymodule | 1:9a3ae682a75e | 111 | }; |
displaymodule | 1:9a3ae682a75e | 112 | #endif |
displaymodule | 1:9a3ae682a75e | 113 | |
displaymodule | 0:3713b01e72fe | 114 | Button* buttons[NUM_BUTTONS]; |
displaymodule | 0:3713b01e72fe | 115 | |
embeddedartists | 5:d2802a0c5af2 | 116 | static char buff[NUM_CHARS_IN_DISPLAY + 1] = {0}; |
displaymodule | 0:3713b01e72fe | 117 | static bool redrawResult = true; |
displaymodule | 0:3713b01e72fe | 118 | static bool clearResult = true; |
displaymodule | 0:3713b01e72fe | 119 | |
displaymodule | 0:3713b01e72fe | 120 | /****************************************************************************** |
displaymodule | 0:3713b01e72fe | 121 | * Global variables |
displaymodule | 0:3713b01e72fe | 122 | *****************************************************************************/ |
displaymodule | 0:3713b01e72fe | 123 | |
displaymodule | 0:3713b01e72fe | 124 | |
displaymodule | 0:3713b01e72fe | 125 | /****************************************************************************** |
displaymodule | 0:3713b01e72fe | 126 | * Local functions |
displaymodule | 0:3713b01e72fe | 127 | *****************************************************************************/ |
displaymodule | 0:3713b01e72fe | 128 | |
displaymodule | 0:3713b01e72fe | 129 | void handleClick(uint32_t arg) |
displaymodule | 0:3713b01e72fe | 130 | { |
displaymodule | 0:3713b01e72fe | 131 | static int val1 = 0; |
displaymodule | 0:3713b01e72fe | 132 | static int val2 = 0; |
displaymodule | 0:3713b01e72fe | 133 | static int op = 0; |
displaymodule | 0:3713b01e72fe | 134 | static calc_mode_t mode = MODE_WANT_ARG1; |
displaymodule | 0:3713b01e72fe | 135 | static int strpos = 0; |
displaymodule | 0:3713b01e72fe | 136 | |
embeddedartists | 5:d2802a0c5af2 | 137 | if (strpos == NUM_CHARS_IN_DISPLAY) { |
embeddedartists | 5:d2802a0c5af2 | 138 | // only accept 'clr' and '=' to prevent overflow |
embeddedartists | 5:d2802a0c5af2 | 139 | if ((arg != 'c') && (arg != '=')) { |
embeddedartists | 5:d2802a0c5af2 | 140 | return; |
embeddedartists | 5:d2802a0c5af2 | 141 | } |
embeddedartists | 5:d2802a0c5af2 | 142 | } |
embeddedartists | 5:d2802a0c5af2 | 143 | |
displaymodule | 0:3713b01e72fe | 144 | switch (arg) |
displaymodule | 0:3713b01e72fe | 145 | { |
displaymodule | 0:3713b01e72fe | 146 | case '0': |
displaymodule | 0:3713b01e72fe | 147 | case '1': |
displaymodule | 0:3713b01e72fe | 148 | case '2': |
displaymodule | 0:3713b01e72fe | 149 | case '3': |
displaymodule | 0:3713b01e72fe | 150 | case '4': |
displaymodule | 0:3713b01e72fe | 151 | case '5': |
displaymodule | 0:3713b01e72fe | 152 | case '6': |
displaymodule | 0:3713b01e72fe | 153 | case '7': |
displaymodule | 0:3713b01e72fe | 154 | case '8': |
displaymodule | 0:3713b01e72fe | 155 | case '9': |
displaymodule | 0:3713b01e72fe | 156 | if ((mode == MODE_WANT_ARG1) || (mode == MODE_WANT_ARG1_OR_OP)) { |
displaymodule | 0:3713b01e72fe | 157 | val1 = val1*10 + (arg - '0'); |
displaymodule | 0:3713b01e72fe | 158 | mode = MODE_WANT_ARG1_OR_OP; |
displaymodule | 0:3713b01e72fe | 159 | buff[strpos++] = arg; |
displaymodule | 0:3713b01e72fe | 160 | } else if ((mode == MODE_WANT_ARG2) || (mode == MODE_WANT_ARG2_OR_OP)) { |
displaymodule | 0:3713b01e72fe | 161 | val2 = val2*10 + (arg - '0'); |
displaymodule | 0:3713b01e72fe | 162 | mode = MODE_WANT_ARG2_OR_OP; |
displaymodule | 0:3713b01e72fe | 163 | buff[strpos++] = arg; |
displaymodule | 0:3713b01e72fe | 164 | } |
displaymodule | 0:3713b01e72fe | 165 | break; |
displaymodule | 0:3713b01e72fe | 166 | case '+': |
displaymodule | 0:3713b01e72fe | 167 | case '-': |
displaymodule | 0:3713b01e72fe | 168 | case '*': |
displaymodule | 0:3713b01e72fe | 169 | case '/': |
displaymodule | 0:3713b01e72fe | 170 | if (mode == MODE_WANT_ARG1_OR_OP) { |
displaymodule | 0:3713b01e72fe | 171 | op = arg; |
displaymodule | 0:3713b01e72fe | 172 | mode = MODE_WANT_ARG2; |
displaymodule | 0:3713b01e72fe | 173 | buff[strpos++] = arg; |
displaymodule | 0:3713b01e72fe | 174 | } else if (mode == MODE_WANT_ARG2_OR_OP) { |
displaymodule | 0:3713b01e72fe | 175 | // already have "a op b", calculate it and go to "c op" |
displaymodule | 0:3713b01e72fe | 176 | switch (op) { |
displaymodule | 0:3713b01e72fe | 177 | case '+': val1 = val1 + val2; break; |
displaymodule | 0:3713b01e72fe | 178 | case '-': val1 = val1 - val2; break; |
displaymodule | 0:3713b01e72fe | 179 | case '*': val1 = val1 * val2; break; |
displaymodule | 0:3713b01e72fe | 180 | case '/': val1 = val1 / val2; break; |
displaymodule | 0:3713b01e72fe | 181 | } |
displaymodule | 0:3713b01e72fe | 182 | op = arg; |
displaymodule | 0:3713b01e72fe | 183 | val2 = 0; |
displaymodule | 0:3713b01e72fe | 184 | mode = MODE_WANT_ARG2; |
displaymodule | 0:3713b01e72fe | 185 | strpos = sprintf(buff, "%d%c", val1, op); |
displaymodule | 0:3713b01e72fe | 186 | clearResult = true; |
displaymodule | 0:3713b01e72fe | 187 | } |
displaymodule | 0:3713b01e72fe | 188 | break; |
displaymodule | 0:3713b01e72fe | 189 | case 'c': |
displaymodule | 0:3713b01e72fe | 190 | val1 = val2 = op = 0; |
displaymodule | 0:3713b01e72fe | 191 | mode = MODE_WANT_ARG1; |
displaymodule | 0:3713b01e72fe | 192 | strpos = 0; |
displaymodule | 0:3713b01e72fe | 193 | clearResult = true; |
displaymodule | 0:3713b01e72fe | 194 | break; |
displaymodule | 0:3713b01e72fe | 195 | case '=': |
displaymodule | 0:3713b01e72fe | 196 | default: |
displaymodule | 0:3713b01e72fe | 197 | if (mode == MODE_WANT_ARG2_OR_OP) { |
displaymodule | 0:3713b01e72fe | 198 | // already have "a op b", calculate it and go to "c" |
displaymodule | 0:3713b01e72fe | 199 | switch (op) { |
displaymodule | 0:3713b01e72fe | 200 | case '+': val1 = val1 + val2; break; |
displaymodule | 0:3713b01e72fe | 201 | case '-': val1 = val1 - val2; break; |
displaymodule | 0:3713b01e72fe | 202 | case '*': val1 = val1 * val2; break; |
displaymodule | 0:3713b01e72fe | 203 | case '/': val1 = val1 / val2; break; |
displaymodule | 0:3713b01e72fe | 204 | } |
displaymodule | 0:3713b01e72fe | 205 | mode = MODE_WANT_ARG1_OR_OP; |
displaymodule | 0:3713b01e72fe | 206 | val2 = 0; |
displaymodule | 0:3713b01e72fe | 207 | strpos = sprintf(buff, "%d", val1); |
displaymodule | 0:3713b01e72fe | 208 | clearResult = true; |
displaymodule | 0:3713b01e72fe | 209 | } |
displaymodule | 0:3713b01e72fe | 210 | break; |
displaymodule | 0:3713b01e72fe | 211 | } |
displaymodule | 0:3713b01e72fe | 212 | buff[strpos] = '\0'; |
displaymodule | 0:3713b01e72fe | 213 | redrawResult = true; |
displaymodule | 0:3713b01e72fe | 214 | } |
displaymodule | 0:3713b01e72fe | 215 | |
displaymodule | 0:3713b01e72fe | 216 | /****************************************************************************** |
displaymodule | 0:3713b01e72fe | 217 | * Main |
displaymodule | 0:3713b01e72fe | 218 | *****************************************************************************/ |
displaymodule | 0:3713b01e72fe | 219 | |
embeddedartists | 4:71588a1e3618 | 220 | /* |
embeddedartists | 4:71588a1e3618 | 221 | Hardware Setup: |
embeddedartists | 4:71588a1e3618 | 222 | |
embeddedartists | 4:71588a1e3618 | 223 | - Jumpers JP1..JP6 should be in position 1-2 |
embeddedartists | 4:71588a1e3618 | 224 | - Jumpers in J14 should NOT be inserted |
embeddedartists | 4:71588a1e3618 | 225 | - Jumper J7 should be inserted |
embeddedartists | 4:71588a1e3618 | 226 | - Display in arduino socket J1 depending on display |
embeddedartists | 4:71588a1e3618 | 227 | */ |
embeddedartists | 4:71588a1e3618 | 228 | |
embeddedartists | 4:71588a1e3618 | 229 | /* |
embeddedartists | 4:71588a1e3618 | 230 | Test Comments: |
embeddedartists | 4:71588a1e3618 | 231 | |
embeddedartists | 4:71588a1e3618 | 232 | - This example cannot be used with the DM-TFT18-101 or DM-TFT22-102 displays |
embeddedartists | 4:71588a1e3618 | 233 | as they don't have touch support. |
embeddedartists | 4:71588a1e3618 | 234 | - The DM-TFT22-102, DM-TFT28-103 and DM-TFT24-104 must all be used on top |
embeddedartists | 4:71588a1e3618 | 235 | of the DM-ADTAU-001 board in the arduino J1 socket. |
embeddedartists | 4:71588a1e3618 | 236 | - The DM-TFT28-105 and DM-TFT35-107 displays have direct arduino pinning and |
embeddedartists | 4:71588a1e3618 | 237 | can be inserted directly in the J1 socket. |
embeddedartists | 4:71588a1e3618 | 238 | */ |
embeddedartists | 4:71588a1e3618 | 239 | |
displaymodule | 0:3713b01e72fe | 240 | int main() { |
displaymodule | 0:3713b01e72fe | 241 | uint16_t x = 0; |
displaymodule | 0:3713b01e72fe | 242 | uint16_t y = 0; |
displaymodule | 0:3713b01e72fe | 243 | uint16_t w = tft.width(); |
displaymodule | 0:3713b01e72fe | 244 | uint16_t h = tft.height(); |
displaymodule | 1:9a3ae682a75e | 245 | uint16_t size = (w - (BUTTONS_PER_LINE + 1)*MARGIN)/BUTTONS_PER_LINE; |
displaymodule | 1:9a3ae682a75e | 246 | uint16_t yoff = h - (size + MARGIN)*BUTTONS_NUM_LINES; |
displaymodule | 0:3713b01e72fe | 247 | bool down = false; |
displaymodule | 0:3713b01e72fe | 248 | |
displaymodule | 0:3713b01e72fe | 249 | for (int i = 0; i < NUM_BUTTONS;i++) { |
displaymodule | 1:9a3ae682a75e | 250 | x = MARGIN + (size + MARGIN) * (i % BUTTONS_PER_LINE); |
displaymodule | 1:9a3ae682a75e | 251 | y = yoff + (size + MARGIN) * (i / BUTTONS_PER_LINE); |
displaymodule | 0:3713b01e72fe | 252 | buttons[i] = new Button(captions[i], x, y, size, size); |
displaymodule | 0:3713b01e72fe | 253 | buttons[i]->setAction(handleClick, captions[i][0]); |
displaymodule | 0:3713b01e72fe | 254 | } |
displaymodule | 0:3713b01e72fe | 255 | |
displaymodule | 0:3713b01e72fe | 256 | tft.init(); |
displaymodule | 0:3713b01e72fe | 257 | tft.clearScreen(BRIGHT_RED); |
displaymodule | 0:3713b01e72fe | 258 | tft.fillRectangle(RESULT_MARGIN_X, RESULT_MARGIN_Y, w-RESULT_MARGIN_X, yoff-RESULT_MARGIN_Y, BLACK); |
displaymodule | 0:3713b01e72fe | 259 | touch.init(); |
displaymodule | 0:3713b01e72fe | 260 | |
displaymodule | 0:3713b01e72fe | 261 | for (int i = 0; i < NUM_BUTTONS; i++) { |
displaymodule | 0:3713b01e72fe | 262 | buttons[i]->draw(&tft); |
displaymodule | 0:3713b01e72fe | 263 | } |
displaymodule | 0:3713b01e72fe | 264 | |
displaymodule | 0:3713b01e72fe | 265 | while(true) { |
displaymodule | 0:3713b01e72fe | 266 | touch.readTouchData(x, y, down); |
displaymodule | 0:3713b01e72fe | 267 | |
displaymodule | 0:3713b01e72fe | 268 | for (int i = 0; i < NUM_BUTTONS; i++) { |
displaymodule | 0:3713b01e72fe | 269 | if (buttons[i]->handle(x, y, down)) { |
displaymodule | 0:3713b01e72fe | 270 | buttons[i]->draw(&tft); |
displaymodule | 0:3713b01e72fe | 271 | } |
displaymodule | 0:3713b01e72fe | 272 | } |
displaymodule | 0:3713b01e72fe | 273 | if (clearResult) { |
displaymodule | 0:3713b01e72fe | 274 | clearResult = false; |
displaymodule | 0:3713b01e72fe | 275 | tft.fillRectangle(RESULT_MARGIN_X, RESULT_MARGIN_Y, w-RESULT_MARGIN_X, yoff-RESULT_MARGIN_Y, BLACK); |
displaymodule | 0:3713b01e72fe | 276 | } |
displaymodule | 0:3713b01e72fe | 277 | if (redrawResult) { |
displaymodule | 0:3713b01e72fe | 278 | redrawResult = false; |
displaymodule | 0:3713b01e72fe | 279 | tft.drawStringCentered(RESULT_MARGIN_X, RESULT_MARGIN_Y, w-RESULT_MARGIN_X, yoff-RESULT_MARGIN_Y, &buff[0]); |
displaymodule | 0:3713b01e72fe | 280 | } |
displaymodule | 0:3713b01e72fe | 281 | wait(0.02); |
displaymodule | 0:3713b01e72fe | 282 | } |
displaymodule | 0:3713b01e72fe | 283 | } |