Library for 3.2'' uLcd Picaso Display4D system Picaso Serial Environment Command Set web: http://www.4dsystems.com.au/product/20/67/Processors_Graphics/PICASO/
PicasoSerial.h@0:65fd8b1cbf86, 2014-07-06 (annotated)
- Committer:
- adelino
- Date:
- Sun Jul 06 10:36:27 2014 +0000
- Revision:
- 0:65fd8b1cbf86
- Child:
- 1:a74e42cf52b2
Library to communicate and draw on an LCD
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adelino | 0:65fd8b1cbf86 | 1 | #ifndef PICASO_SERIAL_H |
adelino | 0:65fd8b1cbf86 | 2 | #define PICASO_SERIAL_H |
adelino | 0:65fd8b1cbf86 | 3 | |
adelino | 0:65fd8b1cbf86 | 4 | #include "mbed.h" |
adelino | 0:65fd8b1cbf86 | 5 | #include <string> |
adelino | 0:65fd8b1cbf86 | 6 | |
adelino | 0:65fd8b1cbf86 | 7 | /** |
adelino | 0:65fd8b1cbf86 | 8 | * Library for 3.2'' uLcd Picaso Display |
adelino | 0:65fd8b1cbf86 | 9 | * 4D system |
adelino | 0:65fd8b1cbf86 | 10 | * Picaso Serial Environment Command Set |
adelino | 0:65fd8b1cbf86 | 11 | * http://www.4dsystems.com.au/product/20/67/Processors_Graphics/PICASO/ |
adelino | 0:65fd8b1cbf86 | 12 | * @autor A.Decarvalho |
adelino | 0:65fd8b1cbf86 | 13 | * |
adelino | 0:65fd8b1cbf86 | 14 | *17/04/ 2014 |
adelino | 0:65fd8b1cbf86 | 15 | */ |
adelino | 0:65fd8b1cbf86 | 16 | |
adelino | 0:65fd8b1cbf86 | 17 | //-------------------- |
adelino | 0:65fd8b1cbf86 | 18 | // display Gfx |
adelino | 0:65fd8b1cbf86 | 19 | //-------------------- |
adelino | 0:65fd8b1cbf86 | 20 | #define CMD_TOUCH_SET 0xFF38 |
adelino | 0:65fd8b1cbf86 | 21 | #define CMD_TOUCH_GET 0xFF37 |
adelino | 0:65fd8b1cbf86 | 22 | #define CMD_TOUCH_DETECT_REGION 0xFF39 |
adelino | 0:65fd8b1cbf86 | 23 | |
adelino | 0:65fd8b1cbf86 | 24 | #define CMD_BAUD_RATE 0x0026 |
adelino | 0:65fd8b1cbf86 | 25 | #define CMD_CLEAR_SCREEN 0xFFCD |
adelino | 0:65fd8b1cbf86 | 26 | #define CMD_BACKGROUND_COLOR 0xFFA4 |
adelino | 0:65fd8b1cbf86 | 27 | |
adelino | 0:65fd8b1cbf86 | 28 | #define CMD_FILLED_RECT 0xFFC4 |
adelino | 0:65fd8b1cbf86 | 29 | #define CMD_RECT 0xFFC5 |
adelino | 0:65fd8b1cbf86 | 30 | |
adelino | 0:65fd8b1cbf86 | 31 | #define CMD_CIRCLE 0xFFC3 |
adelino | 0:65fd8b1cbf86 | 32 | #define CMD_FILLED_CIRCLE 0xFFC2 |
adelino | 0:65fd8b1cbf86 | 33 | |
adelino | 0:65fd8b1cbf86 | 34 | #define CMD_LINE 0xFFC8 |
adelino | 0:65fd8b1cbf86 | 35 | |
adelino | 0:65fd8b1cbf86 | 36 | #define CMD_TRIANGLE 0xFFBF |
adelino | 0:65fd8b1cbf86 | 37 | #define CMD_FILLED_TRIANGLE 0xFFA9 |
adelino | 0:65fd8b1cbf86 | 38 | |
adelino | 0:65fd8b1cbf86 | 39 | #define CMD_PIXEL 0xFFC1 |
adelino | 0:65fd8b1cbf86 | 40 | |
adelino | 0:65fd8b1cbf86 | 41 | #define CMD_PANEL 0xFFAF |
adelino | 0:65fd8b1cbf86 | 42 | |
adelino | 0:65fd8b1cbf86 | 43 | #define CMD_BUTTON 0x0011 |
adelino | 0:65fd8b1cbf86 | 44 | #define BUTTON_RAISED 0x0001 |
adelino | 0:65fd8b1cbf86 | 45 | #define BUTTON_DEPRESSED 0x0000 |
adelino | 0:65fd8b1cbf86 | 46 | |
adelino | 0:65fd8b1cbf86 | 47 | #define CMD_SLIDER 0xFFAE |
adelino | 0:65fd8b1cbf86 | 48 | #define SLIDER_INTENTED 0x0000 |
adelino | 0:65fd8b1cbf86 | 49 | #define SLIDER_RAISED 0x0001 |
adelino | 0:65fd8b1cbf86 | 50 | #define SLIDER_HIDDEN 0x0002 |
adelino | 0:65fd8b1cbf86 | 51 | |
adelino | 0:65fd8b1cbf86 | 52 | #define CMD_PUT_STRING 0x0018 |
adelino | 0:65fd8b1cbf86 | 53 | #define CMD_MOVE_ORIGIN 0xFFCC |
adelino | 0:65fd8b1cbf86 | 54 | #define CMD_TEXT_FOREGROUND 0xFFE7 |
adelino | 0:65fd8b1cbf86 | 55 | #define CMD_TEXT_BACKROUND 0xFFE6 |
adelino | 0:65fd8b1cbf86 | 56 | #define CMD_TEXT_SET_FONT 0xFFE5 |
adelino | 0:65fd8b1cbf86 | 57 | |
adelino | 0:65fd8b1cbf86 | 58 | #define CMD_POLYGON 0x0013 |
adelino | 0:65fd8b1cbf86 | 59 | #define CMD_FILLED_POLYGON 0x0014 |
adelino | 0:65fd8b1cbf86 | 60 | #define CMD_ELLIPSE 0xFFB2 |
adelino | 0:65fd8b1cbf86 | 61 | #define CMD_FILLED_ELLIPSE 0xFFB1 |
adelino | 0:65fd8b1cbf86 | 62 | |
adelino | 0:65fd8b1cbf86 | 63 | #define GFX_ACK 0x06 |
adelino | 0:65fd8b1cbf86 | 64 | #define GFX_NAK 0x00 |
adelino | 0:65fd8b1cbf86 | 65 | |
adelino | 0:65fd8b1cbf86 | 66 | //speed baud |
adelino | 0:65fd8b1cbf86 | 67 | #define GFX_BAUD_9600 0x0006 |
adelino | 0:65fd8b1cbf86 | 68 | #define GFX_BAUD_19200 0x0008 |
adelino | 0:65fd8b1cbf86 | 69 | #define GFX_BAUD_56000 11 |
adelino | 0:65fd8b1cbf86 | 70 | #define GFX_BAUD_115200 0x000D |
adelino | 0:65fd8b1cbf86 | 71 | |
adelino | 0:65fd8b1cbf86 | 72 | //----------------- |
adelino | 0:65fd8b1cbf86 | 73 | typedef char* XCHAR; |
adelino | 0:65fd8b1cbf86 | 74 | typedef unsigned short UINT16; |
adelino | 0:65fd8b1cbf86 | 75 | typedef unsigned char UINT8; |
adelino | 0:65fd8b1cbf86 | 76 | typedef short INT16; |
adelino | 0:65fd8b1cbf86 | 77 | |
adelino | 0:65fd8b1cbf86 | 78 | //-------------------- |
adelino | 0:65fd8b1cbf86 | 79 | // The States |
adelino | 0:65fd8b1cbf86 | 80 | //-------------------- |
adelino | 0:65fd8b1cbf86 | 81 | typedef enum State State; |
adelino | 0:65fd8b1cbf86 | 82 | enum State{ |
adelino | 0:65fd8b1cbf86 | 83 | BUTTON_STATE_PRESSED = 0, |
adelino | 0:65fd8b1cbf86 | 84 | BUTTON_STATE_RELEASED=1, |
adelino | 0:65fd8b1cbf86 | 85 | // |
adelino | 0:65fd8b1cbf86 | 86 | LED_STATE_ON, |
adelino | 0:65fd8b1cbf86 | 87 | LED_STATE_OFF, |
adelino | 0:65fd8b1cbf86 | 88 | // |
adelino | 0:65fd8b1cbf86 | 89 | SWITCH_STATE_ON, |
adelino | 0:65fd8b1cbf86 | 90 | SWITCH_STATE_OFF, |
adelino | 0:65fd8b1cbf86 | 91 | // |
adelino | 0:65fd8b1cbf86 | 92 | SLIDER_STATE_MOVE, |
adelino | 0:65fd8b1cbf86 | 93 | SLIDER_STATE_RELEASED, |
adelino | 0:65fd8b1cbf86 | 94 | // |
adelino | 0:65fd8b1cbf86 | 95 | INPUT_STATE_PRESSED_UP, |
adelino | 0:65fd8b1cbf86 | 96 | INPUT_STATE_PRESSED_DOWN, |
adelino | 0:65fd8b1cbf86 | 97 | INPUT_STATE_RELEASED, |
adelino | 0:65fd8b1cbf86 | 98 | // |
adelino | 0:65fd8b1cbf86 | 99 | LABEL_STATE_ON, |
adelino | 0:65fd8b1cbf86 | 100 | // |
adelino | 0:65fd8b1cbf86 | 101 | DIGIT_LED_STATE_ON, |
adelino | 0:65fd8b1cbf86 | 102 | // |
adelino | 0:65fd8b1cbf86 | 103 | STATE_ON, |
adelino | 0:65fd8b1cbf86 | 104 | STATE_OFF, |
adelino | 0:65fd8b1cbf86 | 105 | BUMP_LEFT, |
adelino | 0:65fd8b1cbf86 | 106 | BUMP_RIGHT, |
adelino | 0:65fd8b1cbf86 | 107 | BUMP_DOWN, |
adelino | 0:65fd8b1cbf86 | 108 | BUMP_UP, |
adelino | 0:65fd8b1cbf86 | 109 | STATE_ROTATE |
adelino | 0:65fd8b1cbf86 | 110 | }; |
adelino | 0:65fd8b1cbf86 | 111 | //------------ |
adelino | 0:65fd8b1cbf86 | 112 | // fonts uLCD |
adelino | 0:65fd8b1cbf86 | 113 | //------------ |
adelino | 0:65fd8b1cbf86 | 114 | typedef enum Font Font; |
adelino | 0:65fd8b1cbf86 | 115 | // |
adelino | 0:65fd8b1cbf86 | 116 | enum Font { |
adelino | 0:65fd8b1cbf86 | 117 | FONT_1 = 0x0000, |
adelino | 0:65fd8b1cbf86 | 118 | FONT_2 = 0x0001, |
adelino | 0:65fd8b1cbf86 | 119 | FONT_3 = 0x0002 |
adelino | 0:65fd8b1cbf86 | 120 | }; |
adelino | 0:65fd8b1cbf86 | 121 | //----------------- |
adelino | 0:65fd8b1cbf86 | 122 | // Colors for Obj |
adelino | 0:65fd8b1cbf86 | 123 | //----------------- |
adelino | 0:65fd8b1cbf86 | 124 | typedef enum Color Color; |
adelino | 0:65fd8b1cbf86 | 125 | // |
adelino | 0:65fd8b1cbf86 | 126 | enum Color { |
adelino | 0:65fd8b1cbf86 | 127 | ALICEBLUE = 0xF7DF,ANTIQUEWHITE = 0xFF5A,AQUA = 0x07FF, |
adelino | 0:65fd8b1cbf86 | 128 | AQUAMARINE = 0x7FFA,AZURE = 0xF7FF,BEIGE = 0xF7BB, |
adelino | 0:65fd8b1cbf86 | 129 | BISQUE = 0xFF38,BLACK = 0x0000,BLANCHEDALMOND = 0xFF59, |
adelino | 0:65fd8b1cbf86 | 130 | BLUE = 0x001F,BLUEVIOLET = 0x895C,BROWN = 0xA145, |
adelino | 0:65fd8b1cbf86 | 131 | BURLYWOOD = 0xDDD0,CADETBLUE = 0x5CF4,CHARTREUSE = 0x7FE0, |
adelino | 0:65fd8b1cbf86 | 132 | CHOCOLATE = 0xD343,CORAL = 0xFBEA,CORNFLOWERBLUE = 0x64BD, |
adelino | 0:65fd8b1cbf86 | 133 | CORNSILK = 0xFFDB,CRIMSON = 0xD8A7,CYAN = 0x07FF, |
adelino | 0:65fd8b1cbf86 | 134 | DARKBLUE = 0x0011,DARKCYAN = 0x0451,DARKGOLDENROD = 0xBC21, |
adelino | 0:65fd8b1cbf86 | 135 | DARKGRAY = 0xAD55,DARKGREEN = 0x0320,DARKKHAKI = 0xBDAD, |
adelino | 0:65fd8b1cbf86 | 136 | DARKMAGENTA = 0x8811,DARKOLIVEGREEN = 0x5345,DARKORANGE = 0xFC60, |
adelino | 0:65fd8b1cbf86 | 137 | DARKORCHID = 0x9999,DARKRED = 0x8800,DARKSALMON = 0xECAF, |
adelino | 0:65fd8b1cbf86 | 138 | DARKSEAGREEN = 0x8DF1,DARKSLATEBLUE = 0x49F1,DARKSLATEGRAY = 0x2A69, |
adelino | 0:65fd8b1cbf86 | 139 | DARKTURQUOISE = 0x067A,DARKVIOLET = 0x901A,DEEPPINK = 0xF8B2, |
adelino | 0:65fd8b1cbf86 | 140 | DEEPSKYBLUE = 0x05FF,DIMGRAY = 0x6B4D,DODGERBLUE = 0x1C9F, |
adelino | 0:65fd8b1cbf86 | 141 | FIREBRICK = 0xB104,FLORALWHITE = 0xFFDE,FORESTGREEN = 0x2444, |
adelino | 0:65fd8b1cbf86 | 142 | FUCHSIA = 0xF81F,GAINSBORO = 0xDEFB,GHOSTWHITE = 0xFFDF, |
adelino | 0:65fd8b1cbf86 | 143 | GOLD = 0xFEA0,GOLDENROD = 0xDD24,GRAY = 0x8410, |
adelino | 0:65fd8b1cbf86 | 144 | GREEN = 0x0400,GREENYELLOW = 0xAFE5,HONEYDEW = 0xF7FE, |
adelino | 0:65fd8b1cbf86 | 145 | HOTPINK = 0xFB56,INDIANRED = 0xCAEB,INDIGO = 0x4810, |
adelino | 0:65fd8b1cbf86 | 146 | IVORY = 0xFFFE,KHAKI = 0xF731,LAVENDER = 0xE73F, |
adelino | 0:65fd8b1cbf86 | 147 | LAVENDERBLUSH = 0xFF9E,LAWNGREEN = 0x7FE0,LEMONCHIFFON = 0xFFD9, |
adelino | 0:65fd8b1cbf86 | 148 | LIGHTBLUE = 0xAEDC,LIGHTCORAL = 0xF410,LIGHTCYAN = 0xE7FF, |
adelino | 0:65fd8b1cbf86 | 149 | LIGHTGOLD = 0xFFDA,LIGHTGREEN = 0x9772,LIGHTGREY = 0xD69A, |
adelino | 0:65fd8b1cbf86 | 150 | LIGHTPINK = 0xFDB8,LIGHTSALMON = 0xFD0F,LIGHTSEAGREEN = 0x2595, |
adelino | 0:65fd8b1cbf86 | 151 | LIGHTSKYBLUE = 0x867F,LIGHTSLATEGRAY = 0x7453,LIGHTSTEELBLUE = 0xB63B, |
adelino | 0:65fd8b1cbf86 | 152 | LIGHTYELLOW = 0xFFFC,LIME = 0x07E0,LIMEGREEN = 0x3666, |
adelino | 0:65fd8b1cbf86 | 153 | LINEN = 0xFF9C,MAGENTA = 0xF81F,MAROON = 0x8000, |
adelino | 0:65fd8b1cbf86 | 154 | MEDIUMAQUAMARINE = 0x6675,MEDIUMBLUE = 0x0019,MEDIUMORCHID = 0xBABA, |
adelino | 0:65fd8b1cbf86 | 155 | MEDIUMPURPLE = 0x939B,MEDIUMSEAGREEN = 0x3D8E,MEDIUMSLATEBLUE = 0x7B5D, |
adelino | 0:65fd8b1cbf86 | 156 | MEDIUMSPRINGGREEN = 0x07D3,MEDIUMTURQUOISE = 0x4E99,MEDIUMVIOLETRED = 0xC0B0, |
adelino | 0:65fd8b1cbf86 | 157 | MIDNIGHTBLUE = 0x18CE,MINTCREAM = 0xF7FF,MISTYROSE = 0xFF3C, |
adelino | 0:65fd8b1cbf86 | 158 | MOCCASIN = 0xFF36,NAVAJOWHITE = 0xFEF5,NAVY = 0x0010, |
adelino | 0:65fd8b1cbf86 | 159 | OLDLACE = 0xFFBC,OLIVE = 0x8400,OLIVEDRAB = 0x6C64, |
adelino | 0:65fd8b1cbf86 | 160 | ORANGE = 0xFD20,ORANGERED = 0xFA20,ORCHID = 0xDB9A, |
adelino | 0:65fd8b1cbf86 | 161 | PALEGOLDENROD = 0xEF55,PALEGREEN = 0x9FD3,PALETURQUOISE = 0xAF7D, |
adelino | 0:65fd8b1cbf86 | 162 | PALEVIOLETRED = 0xDB92,PAPAYAWHIP = 0xFF7A,PEACHPUFF = 0xFED7, |
adelino | 0:65fd8b1cbf86 | 163 | PERU = 0xCC27,PINK = 0xFE19,PLUM = 0xDD1B, |
adelino | 0:65fd8b1cbf86 | 164 | POWDERBLUE = 0xB71C,PURPLE = 0x8010,RED = 0xF800, |
adelino | 0:65fd8b1cbf86 | 165 | ROSYBROWN = 0xBC71,ROYALBLUE = 0x435C,SADDLEBROWN = 0x8A22, |
adelino | 0:65fd8b1cbf86 | 166 | SALMON = 0xFC0E,SANDYBROWN = 0xF52C,SEAGREEN = 0x2C4A, |
adelino | 0:65fd8b1cbf86 | 167 | SEASHELL = 0xFFBD,SIENNA = 0xA285,SILVER = 0xC618, |
adelino | 0:65fd8b1cbf86 | 168 | SKYBLUE = 0x867D,SLATEBLUE = 0x6AD9,SLATEGRAY = 0x7412, |
adelino | 0:65fd8b1cbf86 | 169 | SNOW = 0xFFDF,SPRINGGREEN = 0x07EF,STEELBLUE = 0x4416, |
adelino | 0:65fd8b1cbf86 | 170 | TAN = 0xD5B1,TEAL = 0x0410,THISTLE = 0xDDFB,TOMATO = 0xFB08, |
adelino | 0:65fd8b1cbf86 | 171 | TURQUOISE = 0x471A,VIOLET = 0xEC1D,WHEAT = 0xF6F6, |
adelino | 0:65fd8b1cbf86 | 172 | WHITE = 0xFFFF,WHITESMOKE = 0xF7BE,YELLOW = 0xFFE0, |
adelino | 0:65fd8b1cbf86 | 173 | YELLOWGREEN = 0x9E66 |
adelino | 0:65fd8b1cbf86 | 174 | }; |
adelino | 0:65fd8b1cbf86 | 175 | //------------------------------------------------------ |
adelino | 0:65fd8b1cbf86 | 176 | typedef enum TouchEvent TouchEvent; |
adelino | 0:65fd8b1cbf86 | 177 | |
adelino | 0:65fd8b1cbf86 | 178 | enum TouchEvent { |
adelino | 0:65fd8b1cbf86 | 179 | EVENT_NO_ACTIVITY = 0x0000, |
adelino | 0:65fd8b1cbf86 | 180 | EVENT_PRESS = 0x0001, |
adelino | 0:65fd8b1cbf86 | 181 | EVENT_RELEASE = 0x0002, |
adelino | 0:65fd8b1cbf86 | 182 | EVENT_MOVE = 0x0003 |
adelino | 0:65fd8b1cbf86 | 183 | }; |
adelino | 0:65fd8b1cbf86 | 184 | //------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 185 | enum GRAPHIC_OBJ_TYPE { |
adelino | 0:65fd8b1cbf86 | 186 | OBJ_BUTTON=1, |
adelino | 0:65fd8b1cbf86 | 187 | OBJ_LED, |
adelino | 0:65fd8b1cbf86 | 188 | OBJ_LABEL, |
adelino | 0:65fd8b1cbf86 | 189 | OBJ_INPUT, |
adelino | 0:65fd8b1cbf86 | 190 | OBJ_SLIDER, |
adelino | 0:65fd8b1cbf86 | 191 | OBJ_SWITCH, |
adelino | 0:65fd8b1cbf86 | 192 | OBJ_DIGIT_LED, |
adelino | 0:65fd8b1cbf86 | 193 | OBJ_DIGITAL_3_LED, |
adelino | 0:65fd8b1cbf86 | 194 | |
adelino | 0:65fd8b1cbf86 | 195 | OBJ_RECTANGLE, |
adelino | 0:65fd8b1cbf86 | 196 | OBJ_CIRCLE, |
adelino | 0:65fd8b1cbf86 | 197 | OBJ_TRIANGLE, |
adelino | 0:65fd8b1cbf86 | 198 | OBJ_ELLIPSE, |
adelino | 0:65fd8b1cbf86 | 199 | OBJ_DIAMOND, |
adelino | 0:65fd8b1cbf86 | 200 | OBJ_ISOCELE, |
adelino | 0:65fd8b1cbf86 | 201 | OBJ_UNKNOW |
adelino | 0:65fd8b1cbf86 | 202 | }; |
adelino | 0:65fd8b1cbf86 | 203 | //------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 204 | typedef struct GraphicMessage GraphicMessage; |
adelino | 0:65fd8b1cbf86 | 205 | |
adelino | 0:65fd8b1cbf86 | 206 | struct GraphicMessage { |
adelino | 0:65fd8b1cbf86 | 207 | TouchEvent event; |
adelino | 0:65fd8b1cbf86 | 208 | UINT16 objId; |
adelino | 0:65fd8b1cbf86 | 209 | int posiX; |
adelino | 0:65fd8b1cbf86 | 210 | int posiY; |
adelino | 0:65fd8b1cbf86 | 211 | }; |
adelino | 0:65fd8b1cbf86 | 212 | //-------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 213 | class PicasoSerial:public Serial |
adelino | 0:65fd8b1cbf86 | 214 | { |
adelino | 0:65fd8b1cbf86 | 215 | public: |
adelino | 0:65fd8b1cbf86 | 216 | /** Construct a PicasoSerial object. |
adelino | 0:65fd8b1cbf86 | 217 | * |
adelino | 0:65fd8b1cbf86 | 218 | * @param _pinTx the Serial Mbed pin Tx |
adelino | 0:65fd8b1cbf86 | 219 | * @param _pinRx the Serial Mbed pin Rx |
adelino | 0:65fd8b1cbf86 | 220 | * @param _pinReset the LCD reset pin |
adelino | 0:65fd8b1cbf86 | 221 | */ |
adelino | 0:65fd8b1cbf86 | 222 | PicasoSerial(PinName _pinTx,PinName _pinRx,PinName _pinReset); |
adelino | 0:65fd8b1cbf86 | 223 | |
adelino | 0:65fd8b1cbf86 | 224 | //------------------------------ |
adelino | 0:65fd8b1cbf86 | 225 | /** @returns the touch status |
adelino | 0:65fd8b1cbf86 | 226 | * EVENT_NO_ACTIVITY, |
adelino | 0:65fd8b1cbf86 | 227 | * EVENT_PRESS, |
adelino | 0:65fd8b1cbf86 | 228 | * EVENT_RELEASE, |
adelino | 0:65fd8b1cbf86 | 229 | * EVENT_MOVE |
adelino | 0:65fd8b1cbf86 | 230 | */ |
adelino | 0:65fd8b1cbf86 | 231 | TouchEvent touch_get_status(); |
adelino | 0:65fd8b1cbf86 | 232 | //------------------------------ |
adelino | 0:65fd8b1cbf86 | 233 | //! @returns the touch X position |
adelino | 0:65fd8b1cbf86 | 234 | UINT16 touch_get_x(); |
adelino | 0:65fd8b1cbf86 | 235 | //------------------------------ |
adelino | 0:65fd8b1cbf86 | 236 | //! @returns the touch Y position |
adelino | 0:65fd8b1cbf86 | 237 | UINT16 touch_get_y(); |
adelino | 0:65fd8b1cbf86 | 238 | //----------------------------- |
adelino | 0:65fd8b1cbf86 | 239 | //! reset the screen |
adelino | 0:65fd8b1cbf86 | 240 | void gfx_reset(); |
adelino | 0:65fd8b1cbf86 | 241 | //----------------------------- |
adelino | 0:65fd8b1cbf86 | 242 | //! The first function is called, initialization of the display with the transmission baud |
adelino | 0:65fd8b1cbf86 | 243 | void setup(int baud); |
adelino | 0:65fd8b1cbf86 | 244 | //----------------------------- |
adelino | 0:65fd8b1cbf86 | 245 | //----------------------------- |
adelino | 0:65fd8b1cbf86 | 246 | //! @param speed the baud rate |
adelino | 0:65fd8b1cbf86 | 247 | void gfx_set_UartSpeed(int baud); |
adelino | 0:65fd8b1cbf86 | 248 | //----------------------------- |
adelino | 0:65fd8b1cbf86 | 249 | //! clear the screen |
adelino | 0:65fd8b1cbf86 | 250 | void gfx_clearScreen(); |
adelino | 0:65fd8b1cbf86 | 251 | //----------------------------- |
adelino | 0:65fd8b1cbf86 | 252 | //!@params color define the background color with RGB format |
adelino | 0:65fd8b1cbf86 | 253 | void gfx_set_BackGroundColor(Color color); |
adelino | 0:65fd8b1cbf86 | 254 | //--------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 255 | //! create a color |
adelino | 0:65fd8b1cbf86 | 256 | //! @params red |
adelino | 0:65fd8b1cbf86 | 257 | //! @param green |
adelino | 0:65fd8b1cbf86 | 258 | //! @param blue |
adelino | 0:65fd8b1cbf86 | 259 | unsigned short gfx_set_RGB565(unsigned char red, |
adelino | 0:65fd8b1cbf86 | 260 | unsigned char green, unsigned char blue); |
adelino | 0:65fd8b1cbf86 | 261 | //------------------------------------------------------------------------ |
adelino | 0:65fd8b1cbf86 | 262 | /** Draw a circle |
adelino | 0:65fd8b1cbf86 | 263 | * @params x center position |
adelino | 0:65fd8b1cbf86 | 264 | * @params y center position |
adelino | 0:65fd8b1cbf86 | 265 | * @params radius |
adelino | 0:65fd8b1cbf86 | 266 | * @params color |
adelino | 0:65fd8b1cbf86 | 267 | */ |
adelino | 0:65fd8b1cbf86 | 268 | void draw_circle(UINT16 x, UINT16 y, UINT16 radius,Color color); |
adelino | 0:65fd8b1cbf86 | 269 | //------------------------------------------------------------------ |
adelino | 0:65fd8b1cbf86 | 270 | /** Draw a filled circle |
adelino | 0:65fd8b1cbf86 | 271 | * @params x center position |
adelino | 0:65fd8b1cbf86 | 272 | * @params y center position |
adelino | 0:65fd8b1cbf86 | 273 | * @params radius |
adelino | 0:65fd8b1cbf86 | 274 | * @params color |
adelino | 0:65fd8b1cbf86 | 275 | */ |
adelino | 0:65fd8b1cbf86 | 276 | void draw_filled_circle(UINT16 x, UINT16 y, UINT16 radius,Color color); |
adelino | 0:65fd8b1cbf86 | 277 | //--------------------------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 278 | /** Draw a Line [x1,y1] to [x2,y2] |
adelino | 0:65fd8b1cbf86 | 279 | * @params x1 |
adelino | 0:65fd8b1cbf86 | 280 | * @params y1 |
adelino | 0:65fd8b1cbf86 | 281 | * @params x2 |
adelino | 0:65fd8b1cbf86 | 282 | * @params y2 |
adelino | 0:65fd8b1cbf86 | 283 | * @params color |
adelino | 0:65fd8b1cbf86 | 284 | */ |
adelino | 0:65fd8b1cbf86 | 285 | void draw_line(UINT16 x1, UINT16 y1, UINT16 x2, UINT16 y2,Color color); |
adelino | 0:65fd8b1cbf86 | 286 | //--------------------------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 287 | //! Draw a triangle [x1,y1],[x2,y2],[x3,y3] |
adelino | 0:65fd8b1cbf86 | 288 | |
adelino | 0:65fd8b1cbf86 | 289 | void draw_triangle(UINT16 x1, UINT16 y1, UINT16 x2, |
adelino | 0:65fd8b1cbf86 | 290 | UINT16 y2, UINT16 x3, UINT16 y3,Color color); |
adelino | 0:65fd8b1cbf86 | 291 | //--------------------------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 292 | //! Draw a filled triangle [x1,y1],[x2,y2],[x3,y3] |
adelino | 0:65fd8b1cbf86 | 293 | |
adelino | 0:65fd8b1cbf86 | 294 | void draw_filled_triangle(UINT16 x1, UINT16 y1, UINT16 x2, |
adelino | 0:65fd8b1cbf86 | 295 | UINT16 y2, UINT16 x3, UINT16 y3,Color color); |
adelino | 0:65fd8b1cbf86 | 296 | //--------------------------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 297 | /** Draw a filled rectangle |
adelino | 0:65fd8b1cbf86 | 298 | * @params x1 up left |
adelino | 0:65fd8b1cbf86 | 299 | * @params y1 up left |
adelino | 0:65fd8b1cbf86 | 300 | * @params x2 low right |
adelino | 0:65fd8b1cbf86 | 301 | * @params y2 low right |
adelino | 0:65fd8b1cbf86 | 302 | * @params color |
adelino | 0:65fd8b1cbf86 | 303 | */ |
adelino | 0:65fd8b1cbf86 | 304 | |
adelino | 0:65fd8b1cbf86 | 305 | void draw_filled_rectangle(UINT16 x1, UINT16 y1, UINT16 x2, |
adelino | 0:65fd8b1cbf86 | 306 | UINT16 y2,Color color); |
adelino | 0:65fd8b1cbf86 | 307 | //--------------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 308 | /** Draw a rectangle |
adelino | 0:65fd8b1cbf86 | 309 | * @params x1 up left |
adelino | 0:65fd8b1cbf86 | 310 | * @params y1 up left |
adelino | 0:65fd8b1cbf86 | 311 | * @params x2 low right |
adelino | 0:65fd8b1cbf86 | 312 | * @params y2 low right |
adelino | 0:65fd8b1cbf86 | 313 | * @params color |
adelino | 0:65fd8b1cbf86 | 314 | */ |
adelino | 0:65fd8b1cbf86 | 315 | void draw_rectangle(UINT16 x1, UINT16 y1, UINT16 x2, |
adelino | 0:65fd8b1cbf86 | 316 | UINT16 y2,Color color); |
adelino | 0:65fd8b1cbf86 | 317 | //------------------------------------------------------------------ |
adelino | 0:65fd8b1cbf86 | 318 | /** Draw a panel |
adelino | 0:65fd8b1cbf86 | 319 | * @params state |
adelino | 0:65fd8b1cbf86 | 320 | * @params x1 up left |
adelino | 0:65fd8b1cbf86 | 321 | * @params y1 up left |
adelino | 0:65fd8b1cbf86 | 322 | * @params x2 low right |
adelino | 0:65fd8b1cbf86 | 323 | * @params y2 low right |
adelino | 0:65fd8b1cbf86 | 324 | * @params color |
adelino | 0:65fd8b1cbf86 | 325 | */ |
adelino | 0:65fd8b1cbf86 | 326 | void draw_panel(UINT16 state, UINT16 x1, UINT16 y1, UINT16 width, |
adelino | 0:65fd8b1cbf86 | 327 | UINT16 height,Color color); |
adelino | 0:65fd8b1cbf86 | 328 | //------------------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 329 | /** Draw a color pixel |
adelino | 0:65fd8b1cbf86 | 330 | * @params x1 |
adelino | 0:65fd8b1cbf86 | 331 | * @params y1 |
adelino | 0:65fd8b1cbf86 | 332 | * @params color |
adelino | 0:65fd8b1cbf86 | 333 | */ |
adelino | 0:65fd8b1cbf86 | 334 | void draw_pixel(UINT16 x1, UINT16 y1,Color color); |
adelino | 0:65fd8b1cbf86 | 335 | //-------------------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 336 | /** Draw a button |
adelino | 0:65fd8b1cbf86 | 337 | * @params *s the text button |
adelino | 0:65fd8b1cbf86 | 338 | * @params x1 up left |
adelino | 0:65fd8b1cbf86 | 339 | * @params y1 up left |
adelino | 0:65fd8b1cbf86 | 340 | * @params font |
adelino | 0:65fd8b1cbf86 | 341 | * @params etat BUTTON_RAISED or BUTTON_DEPRESSED |
adelino | 0:65fd8b1cbf86 | 342 | * @params button_color the Bkg color |
adelino | 0:65fd8b1cbf86 | 343 | * @params text_color |
adelino | 0:65fd8b1cbf86 | 344 | */ |
adelino | 0:65fd8b1cbf86 | 345 | void draw_button(string str, UINT16 x1, UINT16 y1, |
adelino | 0:65fd8b1cbf86 | 346 | Font font,State state,Color button_color,Color text_color); |
adelino | 0:65fd8b1cbf86 | 347 | //------------------------------------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 348 | /** Draw a slider |
adelino | 0:65fd8b1cbf86 | 349 | * @params mode |
adelino | 0:65fd8b1cbf86 | 350 | * @params x1 up left |
adelino | 0:65fd8b1cbf86 | 351 | * @params y1 up left |
adelino | 0:65fd8b1cbf86 | 352 | * @params x2 low right |
adelino | 0:65fd8b1cbf86 | 353 | * @params y2 low right |
adelino | 0:65fd8b1cbf86 | 354 | * @params color the bkg color |
adelino | 0:65fd8b1cbf86 | 355 | * @params scale the max value |
adelino | 0:65fd8b1cbf86 | 356 | * @params value |
adelino | 0:65fd8b1cbf86 | 357 | */ |
adelino | 0:65fd8b1cbf86 | 358 | void draw_slider(UINT16 mode, UINT16 x1, UINT16 y1, UINT16 x2, UINT16 y2, |
adelino | 0:65fd8b1cbf86 | 359 | Color color, UINT16 scale, UINT16 value); |
adelino | 0:65fd8b1cbf86 | 360 | //----------------------------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 361 | void text_foreground(Color color); |
adelino | 0:65fd8b1cbf86 | 362 | //------------------------------- |
adelino | 0:65fd8b1cbf86 | 363 | void text_backround(Color color); |
adelino | 0:65fd8b1cbf86 | 364 | //------------------------------ |
adelino | 0:65fd8b1cbf86 | 365 | void text_putstring(string str); |
adelino | 0:65fd8b1cbf86 | 366 | |
adelino | 0:65fd8b1cbf86 | 367 | //------------------------------- |
adelino | 0:65fd8b1cbf86 | 368 | void text_setFont(Font _font); |
adelino | 0:65fd8b1cbf86 | 369 | //--------------------------------- |
adelino | 0:65fd8b1cbf86 | 370 | void gfx_move_to(UINT16 x1, UINT16 y1); |
adelino | 0:65fd8b1cbf86 | 371 | //----------------------------------------- |
adelino | 0:65fd8b1cbf86 | 372 | /** Draw a string |
adelino | 0:65fd8b1cbf86 | 373 | * @params *s the text |
adelino | 0:65fd8b1cbf86 | 374 | * @params x up left |
adelino | 0:65fd8b1cbf86 | 375 | * @params y up left |
adelino | 0:65fd8b1cbf86 | 376 | * @params _font |
adelino | 0:65fd8b1cbf86 | 377 | * @params text_color |
adelino | 0:65fd8b1cbf86 | 378 | * @params color_bckg the background color |
adelino | 0:65fd8b1cbf86 | 379 | */ |
adelino | 0:65fd8b1cbf86 | 380 | void draw_string(string str, UINT16 x, UINT16 y,Font _font,Color text_color,Color color_bckg); |
adelino | 0:65fd8b1cbf86 | 381 | |
adelino | 0:65fd8b1cbf86 | 382 | //--------------------------------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 383 | //! Draw a diamond [x1,y1],[x2,y2],[x3,y3],[x4,y4] |
adelino | 0:65fd8b1cbf86 | 384 | |
adelino | 0:65fd8b1cbf86 | 385 | void draw_diamond(UINT16 x1, UINT16 y1, UINT16 x2,UINT16 y2,UINT16 x3,UINT16 y3, |
adelino | 0:65fd8b1cbf86 | 386 | UINT16 x4,UINT16 y4,Color color); |
adelino | 0:65fd8b1cbf86 | 387 | //---------------------------------------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 388 | //! Draw a filled diamond [x1,y1],[x2,y2],[x3,y3],[x4,y4] |
adelino | 0:65fd8b1cbf86 | 389 | void draw_filled_diamond(UINT16 x1, UINT16 y1, UINT16 x2,UINT16 y2,UINT16 x3,UINT16 y3, |
adelino | 0:65fd8b1cbf86 | 390 | UINT16 x4,UINT16 y4,Color color); |
adelino | 0:65fd8b1cbf86 | 391 | //------------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 392 | //! Draw a ellipse |
adelino | 0:65fd8b1cbf86 | 393 | void draw_ellipse(UINT16 xc, UINT16 yc, UINT16 xrad,UINT16 yrad,Color color); |
adelino | 0:65fd8b1cbf86 | 394 | //-------------------------------------------------------------------------------- |
adelino | 0:65fd8b1cbf86 | 395 | //! Draw a filled ellipse |
adelino | 0:65fd8b1cbf86 | 396 | void draw_filled_ellipse(UINT16 xc, UINT16 yc, UINT16 xrad,UINT16 yrad,Color color); |
adelino | 0:65fd8b1cbf86 | 397 | |
adelino | 0:65fd8b1cbf86 | 398 | protected: |
adelino | 0:65fd8b1cbf86 | 399 | |
adelino | 0:65fd8b1cbf86 | 400 | DigitalOut myPinReset; |
adelino | 0:65fd8b1cbf86 | 401 | |
adelino | 0:65fd8b1cbf86 | 402 | |
adelino | 0:65fd8b1cbf86 | 403 | void touch_set(UINT16 mode); |
adelino | 0:65fd8b1cbf86 | 404 | void touch_detect_region(UINT16 x1, UINT16 y1, UINT16 x2, UINT16 y2); |
adelino | 0:65fd8b1cbf86 | 405 | void put_gfx_char(unsigned char data); |
adelino | 0:65fd8b1cbf86 | 406 | void wait_gfx_ack(); |
adelino | 0:65fd8b1cbf86 | 407 | UINT8 get_gfx_char(void); |
adelino | 0:65fd8b1cbf86 | 408 | void put_gfx_Commande(unsigned char* commande, int nombre); |
adelino | 0:65fd8b1cbf86 | 409 | |
adelino | 0:65fd8b1cbf86 | 410 | }; |
adelino | 0:65fd8b1cbf86 | 411 | |
adelino | 0:65fd8b1cbf86 | 412 | #endif |
adelino | 0:65fd8b1cbf86 | 413 |