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