Class library for a serial lcd implemented on a DISCO-F469NI Development board running specific firmware for this purpose.

Dependencies:   BufferedSerial

Committer:
grantphillips
Date:
Sun Feb 18 19:50:02 2018 +0000
Revision:
1:6fec01e0ac0f
Parent:
0:3f62b3c0ec9a
Child:
2:b4877019c16a
v1.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
grantphillips 0:3f62b3c0ec9a 1 /* DISCOF469SerialLCD Library v1.0
grantphillips 0:3f62b3c0ec9a 2 * Copyright (c) 2018 Grant Phillips
grantphillips 0:3f62b3c0ec9a 3 * grant.phillips@mandela.ac.za
grantphillips 0:3f62b3c0ec9a 4 *
grantphillips 0:3f62b3c0ec9a 5 *
grantphillips 0:3f62b3c0ec9a 6 * Permission is hereby granted, free of charge, to any person obtaining a copy
grantphillips 0:3f62b3c0ec9a 7 * of this software and associated documentation files (the "Software"), to deal
grantphillips 0:3f62b3c0ec9a 8 * in the Software without restriction, including without limitation the rights
grantphillips 0:3f62b3c0ec9a 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
grantphillips 0:3f62b3c0ec9a 10 * copies of the Software, and to permit persons to whom the Software is
grantphillips 0:3f62b3c0ec9a 11 * furnished to do so, subject to the following conditions:
grantphillips 0:3f62b3c0ec9a 12 *
grantphillips 0:3f62b3c0ec9a 13 * The above copyright notice and this permission notice shall be included in
grantphillips 0:3f62b3c0ec9a 14 * all copies or substantial portions of the Software.
grantphillips 0:3f62b3c0ec9a 15 *
grantphillips 0:3f62b3c0ec9a 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
grantphillips 0:3f62b3c0ec9a 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
grantphillips 0:3f62b3c0ec9a 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
grantphillips 0:3f62b3c0ec9a 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
grantphillips 0:3f62b3c0ec9a 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
grantphillips 0:3f62b3c0ec9a 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
grantphillips 0:3f62b3c0ec9a 22 * THE SOFTWARE.
grantphillips 0:3f62b3c0ec9a 23 */
grantphillips 0:3f62b3c0ec9a 24
grantphillips 0:3f62b3c0ec9a 25 #ifndef DISCOF469SerialLCD_H
grantphillips 0:3f62b3c0ec9a 26 #define DISCOF469SerialLCD_H
grantphillips 0:3f62b3c0ec9a 27
grantphillips 0:3f62b3c0ec9a 28 #include "mbed.h"
grantphillips 0:3f62b3c0ec9a 29 #include "BufferedSerial.h"
grantphillips 0:3f62b3c0ec9a 30
grantphillips 0:3f62b3c0ec9a 31 #define LCD_WHITE 0xffffffff
grantphillips 0:3f62b3c0ec9a 32 #define LCD_SILVER 0xffC0C0C0
grantphillips 0:3f62b3c0ec9a 33 #define LCD_GRAY 0xff808080
grantphillips 0:3f62b3c0ec9a 34 #define LCD_BLACK 0xff000000
grantphillips 0:3f62b3c0ec9a 35 #define LCD_RED 0xffff0000
grantphillips 0:3f62b3c0ec9a 36 #define LCD_MAROON 0xff800000
grantphillips 0:3f62b3c0ec9a 37 #define LCD_YELLOW 0xffffff00
grantphillips 0:3f62b3c0ec9a 38 #define LCD_OLIVE 0xff808000
grantphillips 0:3f62b3c0ec9a 39 #define LCD_LIME 0xff00ff00
grantphillips 0:3f62b3c0ec9a 40 #define LCD_GREEN 0xff008000
grantphillips 0:3f62b3c0ec9a 41 #define LCD_AQUA 0xff00ffff
grantphillips 0:3f62b3c0ec9a 42 #define LCD_TEAL 0xff008080
grantphillips 0:3f62b3c0ec9a 43 #define LCD_BLUE 0xff0000ff
grantphillips 0:3f62b3c0ec9a 44 #define LCD_NAVY 0xff000080
grantphillips 0:3f62b3c0ec9a 45 #define LCD_FUCHSIA 0xffff00ff
grantphillips 0:3f62b3c0ec9a 46 #define LCD_PURPLE 0xff800080
grantphillips 0:3f62b3c0ec9a 47
grantphillips 0:3f62b3c0ec9a 48 /** Class library for a serial lcd implemented on a DISCO-F469NI Development board running
grantphillips 0:3f62b3c0ec9a 49 * specific firmware for this purpose.
grantphillips 0:3f62b3c0ec9a 50 *
grantphillips 0:3f62b3c0ec9a 51 * Example:
grantphillips 0:3f62b3c0ec9a 52 * @code
grantphillips 0:3f62b3c0ec9a 53 * #include "mbed.h"
grantphillips 0:3f62b3c0ec9a 54 * #include "DISCOF469SerialLCD.h"
grantphillips 0:3f62b3c0ec9a 55 *
grantphillips 0:3f62b3c0ec9a 56 * DISCOF469SerialLCD lcd(PA_0, PA_1); //tx, rx
grantphillips 0:3f62b3c0ec9a 57 *
grantphillips 0:3f62b3c0ec9a 58 * void DisplayPattern(void);
grantphillips 0:3f62b3c0ec9a 59 *
grantphillips 0:3f62b3c0ec9a 60 * int main() {
grantphillips 0:3f62b3c0ec9a 61 * char buf[40];
grantphillips 0:3f62b3c0ec9a 62 * int numtouches;
grantphillips 0:3f62b3c0ec9a 63 * bool cleared = false;
grantphillips 0:3f62b3c0ec9a 64 * uint16_t x1, y1, x2, y2;
grantphillips 0:3f62b3c0ec9a 65 *
grantphillips 0:3f62b3c0ec9a 66 * DisplayPattern();
grantphillips 0:3f62b3c0ec9a 67 * lcd.LED1(1);
grantphillips 0:3f62b3c0ec9a 68 * wait(1.0);
grantphillips 0:3f62b3c0ec9a 69 * lcd.LED2(1);
grantphillips 0:3f62b3c0ec9a 70 * wait(1.0);
grantphillips 0:3f62b3c0ec9a 71 * lcd.LED3(1);
grantphillips 0:3f62b3c0ec9a 72 * wait(1.0);
grantphillips 0:3f62b3c0ec9a 73 * lcd.LED4(1);
grantphillips 0:3f62b3c0ec9a 74 * wait(1.0);
grantphillips 0:3f62b3c0ec9a 75 * lcd.Clear(LCD_WHITE);
grantphillips 0:3f62b3c0ec9a 76 * lcd.LED1(0);
grantphillips 0:3f62b3c0ec9a 77 * lcd.LED2(0);
grantphillips 0:3f62b3c0ec9a 78 * lcd.LED3(0);
grantphillips 0:3f62b3c0ec9a 79 * lcd.LED4(0);
grantphillips 0:3f62b3c0ec9a 80 *
grantphillips 0:3f62b3c0ec9a 81 * while(1)
grantphillips 0:3f62b3c0ec9a 82 * {
grantphillips 0:3f62b3c0ec9a 83 * numtouches = lcd.Touches(); //read if the screen is touched
grantphillips 0:3f62b3c0ec9a 84 * if(numtouches > 0) //has the screen been touched?
grantphillips 0:3f62b3c0ec9a 85 * {
grantphillips 0:3f62b3c0ec9a 86 * cleared = false; //reset clear flag
grantphillips 0:3f62b3c0ec9a 87 * if(numtouches == 1) //if one finger is on the screen
grantphillips 0:3f62b3c0ec9a 88 * {
grantphillips 0:3f62b3c0ec9a 89 * lcd.GetTouch1(&x1, &y1);
grantphillips 0:3f62b3c0ec9a 90 * sprintf(buf, "Touch 1: x=%3u y=%3u", x1, y1);
grantphillips 0:3f62b3c0ec9a 91 * lcd.DrawStringAtLine(0,4,LCD_BLUE, LCD_WHITE, 0, buf);
grantphillips 0:3f62b3c0ec9a 92 * lcd.FillCircle(x1, y1, 50, LCD_RED);
grantphillips 0:3f62b3c0ec9a 93 * }
grantphillips 0:3f62b3c0ec9a 94 * else if(numtouches == 2) //if two fingers are on the screen
grantphillips 0:3f62b3c0ec9a 95 * {
grantphillips 0:3f62b3c0ec9a 96 * lcd.GetTouch1(&x1, &y1);
grantphillips 0:3f62b3c0ec9a 97 * lcd.GetTouch2(&x2, &y2);
grantphillips 0:3f62b3c0ec9a 98 * sprintf(buf, "Touch 1: x=%3u y=%3u", x1, y1);
grantphillips 0:3f62b3c0ec9a 99 * lcd.DrawStringAtLine(0,4,LCD_BLUE, LCD_WHITE, 0, buf);
grantphillips 0:3f62b3c0ec9a 100 * sprintf(buf, "Touch 2: x=%3u y=%3u", x2, y2);
grantphillips 0:3f62b3c0ec9a 101 * lcd.DrawStringAtLine(1,4,LCD_BLUE, LCD_WHITE, 0, buf);
grantphillips 0:3f62b3c0ec9a 102 * lcd.FillCircle(x1, y1, 50, LCD_RED);
grantphillips 0:3f62b3c0ec9a 103 * lcd.FillCircle(x2, y2, 50, LCD_BLUE);
grantphillips 0:3f62b3c0ec9a 104 * }
grantphillips 0:3f62b3c0ec9a 105 * }
grantphillips 0:3f62b3c0ec9a 106 * else
grantphillips 0:3f62b3c0ec9a 107 * {
grantphillips 0:3f62b3c0ec9a 108 * if(!cleared) //if the screen hasn't been cleared
grantphillips 0:3f62b3c0ec9a 109 * {
grantphillips 0:3f62b3c0ec9a 110 * lcd.Clear(LCD_WHITE); //clear the screen after fingers left screen
grantphillips 0:3f62b3c0ec9a 111 * cleared = true;
grantphillips 0:3f62b3c0ec9a 112 * }
grantphillips 0:3f62b3c0ec9a 113 * }
grantphillips 0:3f62b3c0ec9a 114 * }
grantphillips 0:3f62b3c0ec9a 115 * }
grantphillips 0:3f62b3c0ec9a 116 *
grantphillips 0:3f62b3c0ec9a 117 * void DisplayPattern(void)
grantphillips 0:3f62b3c0ec9a 118 * {
grantphillips 0:3f62b3c0ec9a 119 * lcd.FillRectangle(0, 0, 50, 479,LCD_WHITE);
grantphillips 0:3f62b3c0ec9a 120 * lcd.FillRectangle(50, 0, 50, 479,LCD_SILVER);
grantphillips 0:3f62b3c0ec9a 121 * lcd.FillRectangle(100, 0, 50, 479,LCD_GRAY);
grantphillips 0:3f62b3c0ec9a 122 * lcd.FillRectangle(150, 0, 50, 479,LCD_BLACK);
grantphillips 0:3f62b3c0ec9a 123 * lcd.FillRectangle(200, 0, 50, 479,LCD_RED);
grantphillips 0:3f62b3c0ec9a 124 * lcd.FillRectangle(250, 0, 50, 479,LCD_MAROON);
grantphillips 0:3f62b3c0ec9a 125 * lcd.FillRectangle(300, 0, 50, 479,LCD_YELLOW);
grantphillips 0:3f62b3c0ec9a 126 * lcd.FillRectangle(350, 0, 50, 479,LCD_OLIVE);
grantphillips 0:3f62b3c0ec9a 127 * lcd.FillRectangle(400, 0, 50, 479,LCD_LIME);
grantphillips 0:3f62b3c0ec9a 128 * lcd.FillRectangle(450, 0, 50, 479,LCD_GREEN);
grantphillips 0:3f62b3c0ec9a 129 * lcd.FillRectangle(500, 0, 50, 479,LCD_AQUA);
grantphillips 0:3f62b3c0ec9a 130 * lcd.FillRectangle(550, 0, 50, 479,LCD_TEAL);
grantphillips 0:3f62b3c0ec9a 131 * lcd.FillRectangle(600, 0, 50, 479,LCD_BLUE);
grantphillips 0:3f62b3c0ec9a 132 * lcd.FillRectangle(650, 0, 50, 479,LCD_NAVY);
grantphillips 0:3f62b3c0ec9a 133 * lcd.FillRectangle(700, 0, 50, 479,LCD_FUCHSIA);
grantphillips 0:3f62b3c0ec9a 134 * lcd.FillRectangle(750, 0, 50, 479,LCD_PURPLE);
grantphillips 0:3f62b3c0ec9a 135 * lcd.DrawStringAtXY(0, 0, 1, LCD_WHITE, LCD_BLACK, "White");
grantphillips 0:3f62b3c0ec9a 136 * lcd.DrawStringAtXY(50, 0, 1, LCD_WHITE, LCD_BLACK, "Silver");
grantphillips 0:3f62b3c0ec9a 137 * lcd.DrawStringAtXY(100, 0, 1, LCD_WHITE, LCD_BLACK, "Gray");
grantphillips 0:3f62b3c0ec9a 138 * lcd.DrawStringAtXY(150, 0, 1, LCD_WHITE, LCD_BLACK, "Black");
grantphillips 0:3f62b3c0ec9a 139 * lcd.DrawStringAtXY(200, 0, 1, LCD_WHITE, LCD_BLACK, "Red");
grantphillips 0:3f62b3c0ec9a 140 * lcd.DrawStringAtXY(250, 0, 1, LCD_WHITE, LCD_BLACK, "Maroon");
grantphillips 0:3f62b3c0ec9a 141 * lcd.DrawStringAtXY(300, 0, 1, LCD_WHITE, LCD_BLACK, "Yellow");
grantphillips 0:3f62b3c0ec9a 142 * lcd.DrawStringAtXY(350, 0, 1, LCD_WHITE, LCD_BLACK, "Olive");
grantphillips 0:3f62b3c0ec9a 143 * lcd.DrawStringAtXY(400, 0, 1, LCD_WHITE, LCD_BLACK, "Lime");
grantphillips 0:3f62b3c0ec9a 144 * lcd.DrawStringAtXY(450, 0, 1, LCD_WHITE, LCD_BLACK, "Green");
grantphillips 0:3f62b3c0ec9a 145 * lcd.DrawStringAtXY(500, 0, 1, LCD_WHITE, LCD_BLACK, "Aqua");
grantphillips 0:3f62b3c0ec9a 146 * lcd.DrawStringAtXY(550, 0, 1, LCD_WHITE, LCD_BLACK, "Teal");
grantphillips 0:3f62b3c0ec9a 147 * lcd.DrawStringAtXY(600, 0, 1, LCD_WHITE, LCD_BLACK, "Blue");
grantphillips 0:3f62b3c0ec9a 148 * lcd.DrawStringAtXY(650, 0, 1, LCD_WHITE, LCD_BLACK, "Navy");
grantphillips 0:3f62b3c0ec9a 149 * lcd.DrawStringAtXY(700, 0, 1, LCD_WHITE, LCD_BLACK, "Fuchsia");
grantphillips 0:3f62b3c0ec9a 150 * lcd.DrawStringAtXY(750, 0, 1, LCD_WHITE, LCD_BLACK, "Purple");
grantphillips 0:3f62b3c0ec9a 151 * }
grantphillips 0:3f62b3c0ec9a 152 * @endcode
grantphillips 0:3f62b3c0ec9a 153 */
grantphillips 0:3f62b3c0ec9a 154
grantphillips 0:3f62b3c0ec9a 155 class DISCOF469SerialLCD {
grantphillips 0:3f62b3c0ec9a 156 public:
grantphillips 0:3f62b3c0ec9a 157 /** Create a DISCOF469SerialLCD object for a graphics LCD connected to the specified pins.
grantphillips 0:3f62b3c0ec9a 158 * @param Tx USART TX pin used to connect to Nextion LCD's RX pin
grantphillips 0:3f62b3c0ec9a 159 * @param Rx USART RX pin used to connect to Nextion LCD's TX pin
grantphillips 0:3f62b3c0ec9a 160 */
grantphillips 0:3f62b3c0ec9a 161 DISCOF469SerialLCD(PinName Tx, PinName Rx);
grantphillips 0:3f62b3c0ec9a 162
grantphillips 0:3f62b3c0ec9a 163 /**
grantphillips 0:3f62b3c0ec9a 164 * @brief Clears the LCD by filling it with the specified color pixels.
grantphillips 0:3f62b3c0ec9a 165 * @param Color: Color to fill the screen with - represented in ARGB8888 color space format.
grantphillips 0:3f62b3c0ec9a 166 */
grantphillips 0:3f62b3c0ec9a 167 void Clear(uint32_t Color);
grantphillips 0:3f62b3c0ec9a 168
grantphillips 0:3f62b3c0ec9a 169 /**
grantphillips 0:3f62b3c0ec9a 170 * @brief Draws a pixel on the LCD.
grantphillips 1:6fec01e0ac0f 171 * @param
grantphillips 1:6fec01e0ac0f 172 * Xpos X position
grantphillips 1:6fec01e0ac0f 173 * Ypos Y position
grantphillips 0:3f62b3c0ec9a 174 * @param Xpos: X position
grantphillips 0:3f62b3c0ec9a 175 * @param Ypos: Y position
grantphillips 0:3f62b3c0ec9a 176 * @param Color: Pixel color in ARGB mode (8-8-8-8)
grantphillips 0:3f62b3c0ec9a 177 */
grantphillips 0:3f62b3c0ec9a 178 void DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t Color);
grantphillips 0:3f62b3c0ec9a 179
grantphillips 0:3f62b3c0ec9a 180 /**
grantphillips 0:3f62b3c0ec9a 181 * @brief Reads the color of an LCD pixel.
grantphillips 0:3f62b3c0ec9a 182 * @param Xpos: X position
grantphillips 0:3f62b3c0ec9a 183 * @param Ypos: Y position
grantphillips 0:3f62b3c0ec9a 184 * @retval Pixel color in ARGB mode (8-8-8-8)
grantphillips 0:3f62b3c0ec9a 185 */
grantphillips 0:3f62b3c0ec9a 186 uint32_t ReadPixel(uint16_t Xpos, uint16_t Ypos);
grantphillips 0:3f62b3c0ec9a 187
grantphillips 0:3f62b3c0ec9a 188 /**
grantphillips 0:3f62b3c0ec9a 189 * @brief Draws a line on the LCD.
grantphillips 0:3f62b3c0ec9a 190 * @param x1: Point 1 X position
grantphillips 0:3f62b3c0ec9a 191 * @param y1: Point 1 Y position
grantphillips 0:3f62b3c0ec9a 192 * @param x2: Point 2 X position
grantphillips 0:3f62b3c0ec9a 193 * @param y2: Point 2 Y position
grantphillips 0:3f62b3c0ec9a 194 * @param Color: Line color in ARGB mode (8-8-8-8)
grantphillips 0:3f62b3c0ec9a 195 */
grantphillips 0:3f62b3c0ec9a 196 void DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint32_t Color);
grantphillips 0:3f62b3c0ec9a 197
grantphillips 0:3f62b3c0ec9a 198 /**
grantphillips 0:3f62b3c0ec9a 199 * @brief Draws a rectangle on the LCD.
grantphillips 0:3f62b3c0ec9a 200 * @param Xpos: X position
grantphillips 0:3f62b3c0ec9a 201 * @param Ypos: Y position
grantphillips 0:3f62b3c0ec9a 202 * @param Width: Rectangle width
grantphillips 0:3f62b3c0ec9a 203 * @param Height: Rectangle height
grantphillips 0:3f62b3c0ec9a 204 * @param Color: Rectangle color in ARGB mode (8-8-8-8)
grantphillips 0:3f62b3c0ec9a 205 */
grantphillips 0:3f62b3c0ec9a 206 void DrawRectangle(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height, uint32_t Color);
grantphillips 0:3f62b3c0ec9a 207
grantphillips 0:3f62b3c0ec9a 208 /**
grantphillips 0:3f62b3c0ec9a 209 * @brief Draws a filled rectangle on the LCD.
grantphillips 0:3f62b3c0ec9a 210 * @param Xpos: X position
grantphillips 0:3f62b3c0ec9a 211 * @param Ypos: Y position
grantphillips 0:3f62b3c0ec9a 212 * @param Width: Rectangle width
grantphillips 0:3f62b3c0ec9a 213 * @param Height: Rectangle height
grantphillips 0:3f62b3c0ec9a 214 * @param Color: Rectangle color in ARGB mode (8-8-8-8)
grantphillips 0:3f62b3c0ec9a 215 */
grantphillips 0:3f62b3c0ec9a 216 void FillRectangle(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height, uint32_t Color);
grantphillips 0:3f62b3c0ec9a 217
grantphillips 0:3f62b3c0ec9a 218 /**
grantphillips 0:3f62b3c0ec9a 219 * @brief Draws a circle on the LCD.
grantphillips 0:3f62b3c0ec9a 220 * @param Xpos: X position
grantphillips 0:3f62b3c0ec9a 221 * @param Ypos: Y position
grantphillips 0:3f62b3c0ec9a 222 * @param Radius: Circle radius
grantphillips 0:3f62b3c0ec9a 223 * @param Color: Circle color in ARGB mode (8-8-8-8)
grantphillips 0:3f62b3c0ec9a 224 */
grantphillips 0:3f62b3c0ec9a 225 void DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius, uint32_t Color);
grantphillips 0:3f62b3c0ec9a 226
grantphillips 0:3f62b3c0ec9a 227 /**
grantphillips 0:3f62b3c0ec9a 228 * @brief Draws a filled circle on the LCD.
grantphillips 0:3f62b3c0ec9a 229 * @param Xpos: X position
grantphillips 0:3f62b3c0ec9a 230 * @param Ypos: Y position
grantphillips 0:3f62b3c0ec9a 231 * @param Radius: Circle radius
grantphillips 0:3f62b3c0ec9a 232 * @param Color: Circle color in ARGB mode (8-8-8-8)
grantphillips 0:3f62b3c0ec9a 233 */
grantphillips 0:3f62b3c0ec9a 234 void FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius, uint32_t Color);
grantphillips 0:3f62b3c0ec9a 235
grantphillips 0:3f62b3c0ec9a 236 /**
grantphillips 0:3f62b3c0ec9a 237 * @brief Draws an ellipse on the LCD.
grantphillips 0:3f62b3c0ec9a 238 * @param Xpos: X position
grantphillips 0:3f62b3c0ec9a 239 * @param Ypos: Y position
grantphillips 0:3f62b3c0ec9a 240 * @param XRadius: Ellipse X radius
grantphillips 0:3f62b3c0ec9a 241 * @param YRadius: Ellipse Y radius
grantphillips 0:3f62b3c0ec9a 242 * @param Color: Ellipse color in ARGB mode (8-8-8-8)
grantphillips 0:3f62b3c0ec9a 243 */
grantphillips 0:3f62b3c0ec9a 244 void DrawEllipse(uint16_t Xpos, uint16_t Ypos, uint16_t XRadius, uint16_t YRadius, uint32_t Color);
grantphillips 0:3f62b3c0ec9a 245
grantphillips 0:3f62b3c0ec9a 246 /**
grantphillips 0:3f62b3c0ec9a 247 * @brief Draws a filled ellipse on the LCD.
grantphillips 0:3f62b3c0ec9a 248 * @param Xpos: X position
grantphillips 0:3f62b3c0ec9a 249 * @param Ypos: Y position
grantphillips 0:3f62b3c0ec9a 250 * @param XRadius: Ellipse X radius
grantphillips 0:3f62b3c0ec9a 251 * @param YRadius: Ellipse Y radius
grantphillips 0:3f62b3c0ec9a 252 * @param Color: Ellipse color in ARGB mode (8-8-8-8)
grantphillips 0:3f62b3c0ec9a 253 */
grantphillips 0:3f62b3c0ec9a 254 void FillEllipse(uint16_t Xpos, uint16_t Ypos, uint16_t XRadius, uint16_t YRadius, uint32_t Color);
grantphillips 0:3f62b3c0ec9a 255
grantphillips 0:3f62b3c0ec9a 256 /**
grantphillips 0:3f62b3c0ec9a 257 * @brief Displays a string on the LCD at Xpos,Ypos.
grantphillips 0:3f62b3c0ec9a 258 * @param Xpos: X position (in pixel)
grantphillips 0:3f62b3c0ec9a 259 * @param Ypos: Y position (in pixel)
grantphillips 0:3f62b3c0ec9a 260 * @param FontSize: The size of the text (0 - 4)
grantphillips 0:3f62b3c0ec9a 261 * @param TextColor: The text foreground color
grantphillips 0:3f62b3c0ec9a 262 * @param BackColor: The text background color
grantphillips 0:3f62b3c0ec9a 263 * @param Text: String to display on LCD
grantphillips 0:3f62b3c0ec9a 264 */
grantphillips 0:3f62b3c0ec9a 265 void DrawStringAtXY(uint16_t Xpos, uint16_t Ypos, uint8_t FontSize, uint32_t TextColor, uint32_t BackColor, char *Text);
grantphillips 0:3f62b3c0ec9a 266
grantphillips 0:3f62b3c0ec9a 267 /**
grantphillips 0:3f62b3c0ec9a 268 * @brief Displays a string on the LCD at a certain line based on the font size.
grantphillips 0:3f62b3c0ec9a 269 * @param Line: Line where to display the string
grantphillips 0:3f62b3c0ec9a 270 * @param FontSize: The size of the text (0 - 4)
grantphillips 0:3f62b3c0ec9a 271 * @param TextColor: The text foreground color
grantphillips 0:3f62b3c0ec9a 272 * @param BackColor: The text background color
grantphillips 0:3f62b3c0ec9a 273 * @param Mode: Display mode (0=LEFT mode; 1=CENTER mode; 2=RIGHT mode)
grantphillips 0:3f62b3c0ec9a 274 * @param Text: String to display on LCD
grantphillips 0:3f62b3c0ec9a 275 */
grantphillips 0:3f62b3c0ec9a 276 void DrawStringAtLine(uint16_t Line, uint8_t FontSize, uint32_t TextColor, uint32_t BackColor, uint8_t Mode, char *Text);
grantphillips 0:3f62b3c0ec9a 277
grantphillips 0:3f62b3c0ec9a 278 /** Determines if the touchscreen is being touched or not.
grantphillips 0:3f62b3c0ec9a 279 *
grantphillips 0:3f62b3c0ec9a 280 * @retval Number of simulantanous touches on screen. 0 = not touched.
grantphillips 0:3f62b3c0ec9a 281 */
grantphillips 0:3f62b3c0ec9a 282 uint8_t Touches(void);
grantphillips 0:3f62b3c0ec9a 283
grantphillips 0:3f62b3c0ec9a 284 /**
grantphillips 0:3f62b3c0ec9a 285 * @brief Gets the x and y coordinates of the first touch on the touchscreen.
grantphillips 0:3f62b3c0ec9a 286 * @param x: Pointer to the x coordinate
grantphillips 0:3f62b3c0ec9a 287 * @param y: Pointer to the y coordinate
grantphillips 0:3f62b3c0ec9a 288 */
grantphillips 0:3f62b3c0ec9a 289 void GetTouch1(uint16_t *x, uint16_t *y);
grantphillips 0:3f62b3c0ec9a 290
grantphillips 0:3f62b3c0ec9a 291 /**
grantphillips 0:3f62b3c0ec9a 292 * @brief Gets the x and y coordinates of the second touch on the touchscreen.
grantphillips 0:3f62b3c0ec9a 293 * @param x: Pointer to the x coordinate
grantphillips 0:3f62b3c0ec9a 294 * @param y: Pointer to the y coordinate
grantphillips 0:3f62b3c0ec9a 295 */
grantphillips 0:3f62b3c0ec9a 296 void GetTouch2(uint16_t *x, uint16_t *y);
grantphillips 0:3f62b3c0ec9a 297
grantphillips 0:3f62b3c0ec9a 298 /**
grantphillips 0:3f62b3c0ec9a 299 * @brief Writes to the LCD's LED1.
grantphillips 0:3f62b3c0ec9a 300 * @param OnOff: 1 = On; 0 = Off
grantphillips 0:3f62b3c0ec9a 301 */
grantphillips 0:3f62b3c0ec9a 302 void LED1(uint8_t OnOff);
grantphillips 0:3f62b3c0ec9a 303
grantphillips 0:3f62b3c0ec9a 304 /**
grantphillips 0:3f62b3c0ec9a 305 * @brief Writes to the LCD's LED1.
grantphillips 0:3f62b3c0ec9a 306 * @param OnOff: 1 = On; 0 = Off
grantphillips 0:3f62b3c0ec9a 307 */
grantphillips 0:3f62b3c0ec9a 308 void LED2(uint8_t OnOff);
grantphillips 0:3f62b3c0ec9a 309
grantphillips 0:3f62b3c0ec9a 310 /**
grantphillips 0:3f62b3c0ec9a 311 * @brief Writes to the LCD's LED1.
grantphillips 0:3f62b3c0ec9a 312 * @param OnOff: 1 = On; 0 = Off
grantphillips 0:3f62b3c0ec9a 313 */
grantphillips 0:3f62b3c0ec9a 314 void LED3(uint8_t OnOff);
grantphillips 0:3f62b3c0ec9a 315
grantphillips 0:3f62b3c0ec9a 316 /**
grantphillips 0:3f62b3c0ec9a 317 * @brief Writes to the LCD's LED1.
grantphillips 0:3f62b3c0ec9a 318 * @param OnOff: 1 = On; 0 = Off
grantphillips 0:3f62b3c0ec9a 319 */
grantphillips 0:3f62b3c0ec9a 320 void LED4(uint8_t OnOff);
grantphillips 0:3f62b3c0ec9a 321
grantphillips 0:3f62b3c0ec9a 322
grantphillips 0:3f62b3c0ec9a 323
grantphillips 0:3f62b3c0ec9a 324 private:
grantphillips 0:3f62b3c0ec9a 325
grantphillips 0:3f62b3c0ec9a 326
grantphillips 0:3f62b3c0ec9a 327 BufferedSerial lcd; //Serial object for connecting to LCD
grantphillips 0:3f62b3c0ec9a 328 //Serial pc;
grantphillips 0:3f62b3c0ec9a 329 uint8_t mTouches;
grantphillips 0:3f62b3c0ec9a 330 uint16_t mTouch1X, mTouch1Y,mTouch2X, mTouch2Y;
grantphillips 0:3f62b3c0ec9a 331 uint32_t mReadPixelColor;
grantphillips 0:3f62b3c0ec9a 332 int mcnt;
grantphillips 0:3f62b3c0ec9a 333
grantphillips 0:3f62b3c0ec9a 334 char mRxMsg[40];
grantphillips 0:3f62b3c0ec9a 335 int mRxIdx;
grantphillips 0:3f62b3c0ec9a 336 char cmd[5];
grantphillips 0:3f62b3c0ec9a 337 uint32_t data32_0;
grantphillips 0:3f62b3c0ec9a 338 uint16_t data16_0, data16_1;
grantphillips 0:3f62b3c0ec9a 339 uint8_t data8_0;
grantphillips 0:3f62b3c0ec9a 340 void ServiceSerialRX(void); //Rx Interrupt
grantphillips 0:3f62b3c0ec9a 341 };
grantphillips 0:3f62b3c0ec9a 342
grantphillips 0:3f62b3c0ec9a 343 #endif