Driver for 4D Systems LCD screen with Picaso processor. Ported from 4D Systems Picaso Serial Linux Library

Dependencies:   MODSERIAL

Dependents:   Lab4_Demo_Game 4180_Final_Project

Fork of uLCD_4D_Picaso by Andrew McRae

Committer:
shorwich
Date:
Thu Oct 27 23:42:13 2016 +0000
Revision:
9:72f00cef468b
Moved graphics command functions to separate file for clarity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shorwich 9:72f00cef468b 1 /**
shorwich 9:72f00cef468b 2 * This is a class to drive 4D systems screens with Picaso graphics processors
shorwich 9:72f00cef468b 3 *
shorwich 9:72f00cef468b 4 * This is a port of the 4D systems Picaso Serial Linux Library
shorwich 9:72f00cef468b 5 * Copyright (c) 2014 4D Systems PTY Ltd, Sydney, Australia
shorwich 9:72f00cef468b 6 * From https://github.com/4dsystems/Picaso-Serial-Linux-Library, retrieved March 5, 2015
shorwich 9:72f00cef468b 7 *
shorwich 9:72f00cef468b 8 * Graphics Command Functions. Updated October, 27, 2016.
shorwich 9:72f00cef468b 9 *
shorwich 9:72f00cef468b 10 * All software in this library is provided without warranty; use at your own risk.
shorwich 9:72f00cef468b 11 */
shorwich 9:72f00cef468b 12 #include "mbed.h"
shorwich 9:72f00cef468b 13 #include "Picaso_enums.h"
shorwich 9:72f00cef468b 14 #include "uLCD_4D_Picaso.h"
shorwich 9:72f00cef468b 15
shorwich 9:72f00cef468b 16
shorwich 9:72f00cef468b 17 uint16_t uLCD_4D_Picaso::gfx_BevelShadow(uint16_t Value)
shorwich 9:72f00cef468b 18 {
shorwich 9:72f00cef468b 19 char towrite[4] ;
shorwich 9:72f00cef468b 20 towrite[0]= F_gfx_BevelShadow >> 8 ;
shorwich 9:72f00cef468b 21 towrite[1]= F_gfx_BevelShadow ;
shorwich 9:72f00cef468b 22 towrite[2]= Value >> 8 ;
shorwich 9:72f00cef468b 23 towrite[3]= Value ;
shorwich 9:72f00cef468b 24 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 25 return GetAckResp() ;
shorwich 9:72f00cef468b 26 }
shorwich 9:72f00cef468b 27
shorwich 9:72f00cef468b 28 uint16_t uLCD_4D_Picaso::gfx_BevelWidth(uint16_t Value)
shorwich 9:72f00cef468b 29 {
shorwich 9:72f00cef468b 30 char towrite[4] ;
shorwich 9:72f00cef468b 31 towrite[0]= F_gfx_BevelWidth >> 8 ;
shorwich 9:72f00cef468b 32 towrite[1]= F_gfx_BevelWidth ;
shorwich 9:72f00cef468b 33 towrite[2]= Value >> 8 ;
shorwich 9:72f00cef468b 34 towrite[3]= Value ;
shorwich 9:72f00cef468b 35 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 36 return GetAckResp() ;
shorwich 9:72f00cef468b 37 }
shorwich 9:72f00cef468b 38
shorwich 9:72f00cef468b 39 Picaso::Color uLCD_4D_Picaso::gfx_BGcolour(Picaso::Color Color)
shorwich 9:72f00cef468b 40 {
shorwich 9:72f00cef468b 41 char towrite[4] ;
shorwich 9:72f00cef468b 42 towrite[0]= F_gfx_BGcolour >> 8 ;
shorwich 9:72f00cef468b 43 towrite[1]= F_gfx_BGcolour ;
shorwich 9:72f00cef468b 44 towrite[2]= Color >> 8 ;
shorwich 9:72f00cef468b 45 towrite[3]= Color ;
shorwich 9:72f00cef468b 46 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 47 return (Picaso::Color) GetAckResp() ;
shorwich 9:72f00cef468b 48 }
shorwich 9:72f00cef468b 49
shorwich 9:72f00cef468b 50 void uLCD_4D_Picaso::gfx_Button(Picaso::ButtonState Up, uint16_t x, uint16_t y, Picaso::Color buttonColour, Picaso::Color txtColour, Picaso::Font font, uint16_t txtWidth, uint16_t txtHeight, char * text)
shorwich 9:72f00cef468b 51 {
shorwich 9:72f00cef468b 52 char towrite[18] ;
shorwich 9:72f00cef468b 53 towrite[0]= F_gfx_Button >> 8 ;
shorwich 9:72f00cef468b 54 towrite[1]= F_gfx_Button ;
shorwich 9:72f00cef468b 55 towrite[2]= Up >> 8 ;
shorwich 9:72f00cef468b 56 towrite[3]= Up ;
shorwich 9:72f00cef468b 57 towrite[4]= x >> 8 ;
shorwich 9:72f00cef468b 58 towrite[5]= x ;
shorwich 9:72f00cef468b 59 towrite[6]= y >> 8 ;
shorwich 9:72f00cef468b 60 towrite[7]= y ;
shorwich 9:72f00cef468b 61 towrite[8]= buttonColour >> 8 ;
shorwich 9:72f00cef468b 62 towrite[9]= buttonColour ;
shorwich 9:72f00cef468b 63 towrite[10]= txtColour >> 8 ;
shorwich 9:72f00cef468b 64 towrite[11]= txtColour ;
shorwich 9:72f00cef468b 65 towrite[12]= font >> 8 ;
shorwich 9:72f00cef468b 66 towrite[13]= font ;
shorwich 9:72f00cef468b 67 towrite[14]= txtWidth >> 8 ;
shorwich 9:72f00cef468b 68 towrite[15]= txtWidth ;
shorwich 9:72f00cef468b 69 towrite[16]= txtHeight >> 8 ;
shorwich 9:72f00cef468b 70 towrite[17]= txtHeight ;
shorwich 9:72f00cef468b 71 WriteBytes(towrite, 18) ;
shorwich 9:72f00cef468b 72 WriteChars( text) ;
shorwich 9:72f00cef468b 73 GetAck() ;
shorwich 9:72f00cef468b 74 }
shorwich 9:72f00cef468b 75
shorwich 9:72f00cef468b 76 void uLCD_4D_Picaso::gfx_ChangeColour(uint16_t OldColor, uint16_t NewColor)
shorwich 9:72f00cef468b 77 {
shorwich 9:72f00cef468b 78 char towrite[6] ;
shorwich 9:72f00cef468b 79
shorwich 9:72f00cef468b 80 towrite[0]= F_gfx_ChangeColour >> 8 ;
shorwich 9:72f00cef468b 81 towrite[1]= F_gfx_ChangeColour ;
shorwich 9:72f00cef468b 82 towrite[2]= OldColor >> 8 ;
shorwich 9:72f00cef468b 83 towrite[3]= OldColor ;
shorwich 9:72f00cef468b 84 towrite[4]= NewColor >> 8 ;
shorwich 9:72f00cef468b 85 towrite[5]= NewColor ;
shorwich 9:72f00cef468b 86 WriteBytes(towrite, 6) ;
shorwich 9:72f00cef468b 87 GetAck() ;
shorwich 9:72f00cef468b 88 }
shorwich 9:72f00cef468b 89
shorwich 9:72f00cef468b 90 void uLCD_4D_Picaso::gfx_Circle(uint16_t X, uint16_t Y, uint16_t Radius, Picaso::Color Color)
shorwich 9:72f00cef468b 91 {
shorwich 9:72f00cef468b 92 char towrite[10] ;
shorwich 9:72f00cef468b 93
shorwich 9:72f00cef468b 94 towrite[0]= F_gfx_Circle >> 8 ;
shorwich 9:72f00cef468b 95 towrite[1]= F_gfx_Circle ;
shorwich 9:72f00cef468b 96 towrite[2]= X >> 8 ;
shorwich 9:72f00cef468b 97 towrite[3]= X ;
shorwich 9:72f00cef468b 98 towrite[4]= Y >> 8 ;
shorwich 9:72f00cef468b 99 towrite[5]= Y ;
shorwich 9:72f00cef468b 100 towrite[6]= Radius >> 8 ;
shorwich 9:72f00cef468b 101 towrite[7]= Radius ;
shorwich 9:72f00cef468b 102 towrite[8]= Color >> 8 ;
shorwich 9:72f00cef468b 103 towrite[9]= Color ;
shorwich 9:72f00cef468b 104 WriteBytes(towrite, 10) ;
shorwich 9:72f00cef468b 105 GetAck() ;
shorwich 9:72f00cef468b 106 }
shorwich 9:72f00cef468b 107
shorwich 9:72f00cef468b 108 void uLCD_4D_Picaso::gfx_CircleFilled(uint16_t X, uint16_t Y, uint16_t Radius, Picaso::Color Color)
shorwich 9:72f00cef468b 109 {
shorwich 9:72f00cef468b 110 char towrite[10] ;
shorwich 9:72f00cef468b 111
shorwich 9:72f00cef468b 112 towrite[0]= F_gfx_CircleFilled >> 8 ;
shorwich 9:72f00cef468b 113 towrite[1]= F_gfx_CircleFilled ;
shorwich 9:72f00cef468b 114 towrite[2]= X >> 8 ;
shorwich 9:72f00cef468b 115 towrite[3]= X ;
shorwich 9:72f00cef468b 116 towrite[4]= Y >> 8 ;
shorwich 9:72f00cef468b 117 towrite[5]= Y ;
shorwich 9:72f00cef468b 118 towrite[6]= Radius >> 8 ;
shorwich 9:72f00cef468b 119 towrite[7]= Radius ;
shorwich 9:72f00cef468b 120 towrite[8]= Color >> 8 ;
shorwich 9:72f00cef468b 121 towrite[9]= Color ;
shorwich 9:72f00cef468b 122 WriteBytes(towrite, 10) ;
shorwich 9:72f00cef468b 123 GetAck() ;
shorwich 9:72f00cef468b 124 }
shorwich 9:72f00cef468b 125
shorwich 9:72f00cef468b 126 void uLCD_4D_Picaso::gfx_Clipping(uint16_t OnOff)
shorwich 9:72f00cef468b 127 {
shorwich 9:72f00cef468b 128 char towrite[4] ;
shorwich 9:72f00cef468b 129
shorwich 9:72f00cef468b 130 towrite[0]= F_gfx_Clipping >> 8 ;
shorwich 9:72f00cef468b 131 towrite[1]= F_gfx_Clipping ;
shorwich 9:72f00cef468b 132 towrite[2]= OnOff >> 8 ;
shorwich 9:72f00cef468b 133 towrite[3]= OnOff ;
shorwich 9:72f00cef468b 134 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 135 GetAck() ;
shorwich 9:72f00cef468b 136 }
shorwich 9:72f00cef468b 137
shorwich 9:72f00cef468b 138 void uLCD_4D_Picaso::gfx_ClipWindow(uint16_t X1, uint16_t Y1, uint16_t X2, uint16_t Y2)
shorwich 9:72f00cef468b 139 {
shorwich 9:72f00cef468b 140 char towrite[10] ;
shorwich 9:72f00cef468b 141
shorwich 9:72f00cef468b 142 towrite[0]= F_gfx_ClipWindow >> 8 ;
shorwich 9:72f00cef468b 143 towrite[1]= F_gfx_ClipWindow ;
shorwich 9:72f00cef468b 144 towrite[2]= X1 >> 8 ;
shorwich 9:72f00cef468b 145 towrite[3]= X1 ;
shorwich 9:72f00cef468b 146 towrite[4]= Y1 >> 8 ;
shorwich 9:72f00cef468b 147 towrite[5]= Y1 ;
shorwich 9:72f00cef468b 148 towrite[6]= X2 >> 8 ;
shorwich 9:72f00cef468b 149 towrite[7]= X2 ;
shorwich 9:72f00cef468b 150 towrite[8]= Y2 >> 8 ;
shorwich 9:72f00cef468b 151 towrite[9]= Y2 ;
shorwich 9:72f00cef468b 152 WriteBytes(towrite, 10) ;
shorwich 9:72f00cef468b 153 GetAck() ;
shorwich 9:72f00cef468b 154 }
shorwich 9:72f00cef468b 155
shorwich 9:72f00cef468b 156 void uLCD_4D_Picaso::gfx_Cls()
shorwich 9:72f00cef468b 157 {
shorwich 9:72f00cef468b 158 char towrite[2] ;
shorwich 9:72f00cef468b 159 towrite[0]= F_gfx_Cls >> 8 ;
shorwich 9:72f00cef468b 160 towrite[1]= F_gfx_Cls ;
shorwich 9:72f00cef468b 161 WriteBytes(towrite, 2);
shorwich 9:72f00cef468b 162 GetAck();
shorwich 9:72f00cef468b 163 }
shorwich 9:72f00cef468b 164
shorwich 9:72f00cef468b 165 uint16_t uLCD_4D_Picaso::gfx_Contrast(uint16_t Contrast)
shorwich 9:72f00cef468b 166 {
shorwich 9:72f00cef468b 167 char towrite[4] ;
shorwich 9:72f00cef468b 168 towrite[0]= F_gfx_Contrast >> 8 ;
shorwich 9:72f00cef468b 169 towrite[1]= F_gfx_Contrast ;
shorwich 9:72f00cef468b 170 towrite[2]= Contrast >> 8 ;
shorwich 9:72f00cef468b 171 towrite[3]= Contrast ;
shorwich 9:72f00cef468b 172 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 173 return GetAckResp() ;
shorwich 9:72f00cef468b 174 }
shorwich 9:72f00cef468b 175
shorwich 9:72f00cef468b 176 void uLCD_4D_Picaso::gfx_Ellipse(uint16_t X, uint16_t Y, uint16_t Xrad, uint16_t Yrad, Picaso::Color Color)
shorwich 9:72f00cef468b 177 {
shorwich 9:72f00cef468b 178 char towrite[12] ;
shorwich 9:72f00cef468b 179 towrite[0]= F_gfx_Ellipse >> 8 ;
shorwich 9:72f00cef468b 180 towrite[1]= F_gfx_Ellipse ;
shorwich 9:72f00cef468b 181 towrite[2]= X >> 8 ;
shorwich 9:72f00cef468b 182 towrite[3]= X ;
shorwich 9:72f00cef468b 183 towrite[4]= Y >> 8 ;
shorwich 9:72f00cef468b 184 towrite[5]= Y ;
shorwich 9:72f00cef468b 185 towrite[6]= Xrad >> 8 ;
shorwich 9:72f00cef468b 186 towrite[7]= Xrad ;
shorwich 9:72f00cef468b 187 towrite[8]= Yrad >> 8 ;
shorwich 9:72f00cef468b 188 towrite[9]= Yrad ;
shorwich 9:72f00cef468b 189 towrite[10]= Color >> 8 ;
shorwich 9:72f00cef468b 190 towrite[11]= Color ;
shorwich 9:72f00cef468b 191 WriteBytes(towrite, 12) ;
shorwich 9:72f00cef468b 192 GetAck() ;
shorwich 9:72f00cef468b 193 }
shorwich 9:72f00cef468b 194
shorwich 9:72f00cef468b 195 void uLCD_4D_Picaso::gfx_EllipseFilled(uint16_t X, uint16_t Y, uint16_t Xrad, uint16_t Yrad, Picaso::Color Color)
shorwich 9:72f00cef468b 196 {
shorwich 9:72f00cef468b 197 char towrite[12] ;
shorwich 9:72f00cef468b 198 towrite[0]= F_gfx_EllipseFilled >> 8 ;
shorwich 9:72f00cef468b 199 towrite[1]= F_gfx_EllipseFilled ;
shorwich 9:72f00cef468b 200 towrite[2]= X >> 8 ;
shorwich 9:72f00cef468b 201 towrite[3]= X ;
shorwich 9:72f00cef468b 202 towrite[4]= Y >> 8 ;
shorwich 9:72f00cef468b 203 towrite[5]= Y ;
shorwich 9:72f00cef468b 204 towrite[6]= Xrad >> 8 ;
shorwich 9:72f00cef468b 205 towrite[7]= Xrad ;
shorwich 9:72f00cef468b 206 towrite[8]= Yrad >> 8 ;
shorwich 9:72f00cef468b 207 towrite[9]= Yrad ;
shorwich 9:72f00cef468b 208 towrite[10]= Color >> 8 ;
shorwich 9:72f00cef468b 209 towrite[11]= Color ;
shorwich 9:72f00cef468b 210 WriteBytes(towrite, 12) ;
shorwich 9:72f00cef468b 211 GetAck() ;
shorwich 9:72f00cef468b 212 }
shorwich 9:72f00cef468b 213
shorwich 9:72f00cef468b 214 uint16_t uLCD_4D_Picaso::gfx_FrameDelay(uint16_t Msec)
shorwich 9:72f00cef468b 215 {
shorwich 9:72f00cef468b 216 char towrite[4] ;
shorwich 9:72f00cef468b 217 towrite[0]= F_gfx_FrameDelay >> 8 ;
shorwich 9:72f00cef468b 218 towrite[1]= F_gfx_FrameDelay ;
shorwich 9:72f00cef468b 219 towrite[2]= Msec >> 8 ;
shorwich 9:72f00cef468b 220 towrite[3]= Msec ;
shorwich 9:72f00cef468b 221 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 222 return GetAckResp() ;
shorwich 9:72f00cef468b 223 }
shorwich 9:72f00cef468b 224
shorwich 9:72f00cef468b 225 uint16_t uLCD_4D_Picaso::gfx_Get(Picaso::GFXGetMode Mode)
shorwich 9:72f00cef468b 226 {
shorwich 9:72f00cef468b 227 char towrite[4] ;
shorwich 9:72f00cef468b 228 towrite[0]= F_gfx_Get >> 8 ;
shorwich 9:72f00cef468b 229 towrite[1]= F_gfx_Get ;
shorwich 9:72f00cef468b 230 towrite[2]= Mode >> 8 ;
shorwich 9:72f00cef468b 231 towrite[3]= Mode ;
shorwich 9:72f00cef468b 232 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 233 return GetAckResp() ;
shorwich 9:72f00cef468b 234 }
shorwich 9:72f00cef468b 235
shorwich 9:72f00cef468b 236 Picaso::Color uLCD_4D_Picaso::gfx_GetPixel(uint16_t X, uint16_t Y)
shorwich 9:72f00cef468b 237 {
shorwich 9:72f00cef468b 238 char towrite[6] ;
shorwich 9:72f00cef468b 239 towrite[0]= F_gfx_GetPixel >> 8 ;
shorwich 9:72f00cef468b 240 towrite[1]= F_gfx_GetPixel ;
shorwich 9:72f00cef468b 241 towrite[2]= X >> 8 ;
shorwich 9:72f00cef468b 242 towrite[3]= X ;
shorwich 9:72f00cef468b 243 towrite[4]= Y >> 8 ;
shorwich 9:72f00cef468b 244 towrite[5]= Y ;
shorwich 9:72f00cef468b 245 WriteBytes(towrite, 6) ;
shorwich 9:72f00cef468b 246 return (Picaso::Color) GetAckResp() ;
shorwich 9:72f00cef468b 247 }
shorwich 9:72f00cef468b 248
shorwich 9:72f00cef468b 249 void uLCD_4D_Picaso::gfx_Line(uint16_t X1, uint16_t Y1, uint16_t X2, uint16_t Y2, Picaso::Color Color)
shorwich 9:72f00cef468b 250 {
shorwich 9:72f00cef468b 251 char towrite[12] ;
shorwich 9:72f00cef468b 252 towrite[0]= F_gfx_Line >> 8 ;
shorwich 9:72f00cef468b 253 towrite[1]= F_gfx_Line ;
shorwich 9:72f00cef468b 254 towrite[2]= X1 >> 8 ;
shorwich 9:72f00cef468b 255 towrite[3]= X1 ;
shorwich 9:72f00cef468b 256 towrite[4]= Y1 >> 8 ;
shorwich 9:72f00cef468b 257 towrite[5]= Y1 ;
shorwich 9:72f00cef468b 258 towrite[6]= X2 >> 8 ;
shorwich 9:72f00cef468b 259 towrite[7]= X2 ;
shorwich 9:72f00cef468b 260 towrite[8]= Y2 >> 8 ;
shorwich 9:72f00cef468b 261 towrite[9]= Y2 ;
shorwich 9:72f00cef468b 262 towrite[10]= Color >> 8 ;
shorwich 9:72f00cef468b 263 towrite[11]= Color ;
shorwich 9:72f00cef468b 264 WriteBytes(towrite, 12) ;
shorwich 9:72f00cef468b 265 GetAck() ;
shorwich 9:72f00cef468b 266 }
shorwich 9:72f00cef468b 267
shorwich 9:72f00cef468b 268 uint16_t uLCD_4D_Picaso::gfx_LinePattern(uint16_t Pattern)
shorwich 9:72f00cef468b 269 {
shorwich 9:72f00cef468b 270 char towrite[4] ;
shorwich 9:72f00cef468b 271 towrite[0]= F_gfx_LinePattern >> 8 ;
shorwich 9:72f00cef468b 272 towrite[1]= F_gfx_LinePattern ;
shorwich 9:72f00cef468b 273 towrite[2]= Pattern >> 8 ;
shorwich 9:72f00cef468b 274 towrite[3]= Pattern ;
shorwich 9:72f00cef468b 275 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 276 return GetAckResp() ;
shorwich 9:72f00cef468b 277 }
shorwich 9:72f00cef468b 278
shorwich 9:72f00cef468b 279 void uLCD_4D_Picaso::gfx_LineTo(uint16_t X, uint16_t Y)
shorwich 9:72f00cef468b 280 {
shorwich 9:72f00cef468b 281 char towrite[6] ;
shorwich 9:72f00cef468b 282 towrite[0]= F_gfx_LineTo >> 8 ;
shorwich 9:72f00cef468b 283 towrite[1]= F_gfx_LineTo ;
shorwich 9:72f00cef468b 284 towrite[2]= X >> 8 ;
shorwich 9:72f00cef468b 285 towrite[3]= X ;
shorwich 9:72f00cef468b 286 towrite[4]= Y >> 8 ;
shorwich 9:72f00cef468b 287 towrite[5]= Y ;
shorwich 9:72f00cef468b 288 WriteBytes(towrite, 6) ;
shorwich 9:72f00cef468b 289 GetAck() ;
shorwich 9:72f00cef468b 290 }
shorwich 9:72f00cef468b 291
shorwich 9:72f00cef468b 292 void uLCD_4D_Picaso::gfx_MoveTo(uint16_t X, uint16_t Y)
shorwich 9:72f00cef468b 293 {
shorwich 9:72f00cef468b 294 char towrite[6] ;
shorwich 9:72f00cef468b 295 towrite[0]= F_gfx_MoveTo >> 8 ;
shorwich 9:72f00cef468b 296 towrite[1]= F_gfx_MoveTo ;
shorwich 9:72f00cef468b 297 towrite[2]= X >> 8 ;
shorwich 9:72f00cef468b 298 towrite[3]= X ;
shorwich 9:72f00cef468b 299 towrite[4]= Y >> 8 ;
shorwich 9:72f00cef468b 300 towrite[5]= Y ;
shorwich 9:72f00cef468b 301 WriteBytes(towrite, 6) ;
shorwich 9:72f00cef468b 302 GetAck() ;
shorwich 9:72f00cef468b 303 }
shorwich 9:72f00cef468b 304
shorwich 9:72f00cef468b 305 uint16_t uLCD_4D_Picaso::gfx_Orbit(uint16_t Angle, uint16_t Distance, uint16_t * Xdest, uint16_t * Ydest)
shorwich 9:72f00cef468b 306 {
shorwich 9:72f00cef468b 307 char towrite[6] ;
shorwich 9:72f00cef468b 308 towrite[0]= F_gfx_Orbit >> 8 ;
shorwich 9:72f00cef468b 309 towrite[1]= F_gfx_Orbit ;
shorwich 9:72f00cef468b 310 towrite[2]= Angle >> 8 ;
shorwich 9:72f00cef468b 311 towrite[3]= Angle ;
shorwich 9:72f00cef468b 312 towrite[4]= Distance >> 8 ;
shorwich 9:72f00cef468b 313 towrite[5]= Distance ;
shorwich 9:72f00cef468b 314 WriteBytes(towrite, 6) ;
shorwich 9:72f00cef468b 315 GetAck2Words(Xdest,Ydest) ;
shorwich 9:72f00cef468b 316 return 0 ;
shorwich 9:72f00cef468b 317 }
shorwich 9:72f00cef468b 318
shorwich 9:72f00cef468b 319 Picaso::Color uLCD_4D_Picaso::gfx_OutlineColour(Picaso::Color Color) {
shorwich 9:72f00cef468b 320 char towrite[4] ;
shorwich 9:72f00cef468b 321 towrite[0]= F_gfx_OutlineColour >> 8 ;
shorwich 9:72f00cef468b 322 towrite[1]= F_gfx_OutlineColour ;
shorwich 9:72f00cef468b 323 towrite[2]= Color >> 8 ;
shorwich 9:72f00cef468b 324 towrite[3]= Color ;
shorwich 9:72f00cef468b 325 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 326 return (Picaso::Color) GetAckResp() ;
shorwich 9:72f00cef468b 327 }
shorwich 9:72f00cef468b 328
shorwich 9:72f00cef468b 329 void uLCD_4D_Picaso::gfx_Panel(Picaso::PanelState Raised, uint16_t X, uint16_t Y, uint16_t Width, uint16_t Height, Picaso::Color Color)
shorwich 9:72f00cef468b 330 {
shorwich 9:72f00cef468b 331 char towrite[14] ;
shorwich 9:72f00cef468b 332 towrite[0]= F_gfx_Panel >> 8 ;
shorwich 9:72f00cef468b 333 towrite[1]= F_gfx_Panel ;
shorwich 9:72f00cef468b 334 towrite[2]= Raised >> 8 ;
shorwich 9:72f00cef468b 335 towrite[3]= Raised ;
shorwich 9:72f00cef468b 336 towrite[4]= X >> 8 ;
shorwich 9:72f00cef468b 337 towrite[5]= X ;
shorwich 9:72f00cef468b 338 towrite[6]= Y >> 8 ;
shorwich 9:72f00cef468b 339 towrite[7]= Y ;
shorwich 9:72f00cef468b 340 towrite[8]= Width >> 8 ;
shorwich 9:72f00cef468b 341 towrite[9]= Width ;
shorwich 9:72f00cef468b 342 towrite[10]= Height >> 8 ;
shorwich 9:72f00cef468b 343 towrite[11]= Height ;
shorwich 9:72f00cef468b 344 towrite[12]= Color >> 8 ;
shorwich 9:72f00cef468b 345 towrite[13]= Color ;
shorwich 9:72f00cef468b 346 WriteBytes(towrite, 14) ;
shorwich 9:72f00cef468b 347 GetAck() ;
shorwich 9:72f00cef468b 348 }
shorwich 9:72f00cef468b 349
shorwich 9:72f00cef468b 350 void uLCD_4D_Picaso::gfx_Polygon(uint16_t n, uint16_t* Xvalues, uint16_t* Yvalues, Picaso::Color Color)
shorwich 9:72f00cef468b 351 {
shorwich 9:72f00cef468b 352 char towrite[4] ;
shorwich 9:72f00cef468b 353 towrite[0]= F_gfx_Polygon >> 8 ;
shorwich 9:72f00cef468b 354 towrite[1]= F_gfx_Polygon ;
shorwich 9:72f00cef468b 355 towrite[2]= n >> 8 ;
shorwich 9:72f00cef468b 356 towrite[3]= n ;
shorwich 9:72f00cef468b 357 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 358 WriteWords(Xvalues, n) ;
shorwich 9:72f00cef468b 359 WriteWords(Yvalues, n) ;
shorwich 9:72f00cef468b 360 towrite[0]= Color >> 8 ;
shorwich 9:72f00cef468b 361 towrite[1]= Color ;
shorwich 9:72f00cef468b 362 WriteBytes(towrite, 2) ;
shorwich 9:72f00cef468b 363 GetAck() ;
shorwich 9:72f00cef468b 364 }
shorwich 9:72f00cef468b 365
shorwich 9:72f00cef468b 366 void uLCD_4D_Picaso::gfx_PolygonFilled(uint16_t n, uint16_t* Xvalues, uint16_t* Yvalues, Picaso::Color Color)
shorwich 9:72f00cef468b 367 {
shorwich 9:72f00cef468b 368 char towrite[4] ;
shorwich 9:72f00cef468b 369 towrite[0]= F_gfx_PolygonFilled >> 8 ;
shorwich 9:72f00cef468b 370 towrite[1]= F_gfx_PolygonFilled ;
shorwich 9:72f00cef468b 371 towrite[2]= n >> 8 ;
shorwich 9:72f00cef468b 372 towrite[3]= n ;
shorwich 9:72f00cef468b 373 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 374 WriteWords(Xvalues, n) ;
shorwich 9:72f00cef468b 375 WriteWords(Yvalues, n) ;
shorwich 9:72f00cef468b 376 towrite[0]= Color >> 8 ;
shorwich 9:72f00cef468b 377 towrite[1]= Color ;
shorwich 9:72f00cef468b 378 WriteBytes(towrite, 2) ;
shorwich 9:72f00cef468b 379 GetAck() ;
shorwich 9:72f00cef468b 380 }
shorwich 9:72f00cef468b 381
shorwich 9:72f00cef468b 382 void uLCD_4D_Picaso::gfx_Polyline(uint16_t n, uint16_t* Xvalues, uint16_t* Yvalues, Picaso::Color Color)
shorwich 9:72f00cef468b 383 {
shorwich 9:72f00cef468b 384 char towrite[4] ;
shorwich 9:72f00cef468b 385 towrite[0]= F_gfx_Polyline >> 8 ;
shorwich 9:72f00cef468b 386 towrite[1]= F_gfx_Polyline ;
shorwich 9:72f00cef468b 387 towrite[2]= n >> 8 ;
shorwich 9:72f00cef468b 388 towrite[3]= n ;
shorwich 9:72f00cef468b 389 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 390 WriteWords(Xvalues, n) ;
shorwich 9:72f00cef468b 391 WriteWords(Yvalues, n) ;
shorwich 9:72f00cef468b 392 towrite[0]= Color >> 8 ;
shorwich 9:72f00cef468b 393 towrite[1]= Color ;
shorwich 9:72f00cef468b 394 WriteBytes(towrite, 2) ;
shorwich 9:72f00cef468b 395 GetAck() ;
shorwich 9:72f00cef468b 396 }
shorwich 9:72f00cef468b 397
shorwich 9:72f00cef468b 398 void uLCD_4D_Picaso::gfx_PutPixel(uint16_t X, uint16_t Y, Picaso::Color Color)
shorwich 9:72f00cef468b 399 {
shorwich 9:72f00cef468b 400 char towrite[8] ;
shorwich 9:72f00cef468b 401 towrite[0]= F_gfx_PutPixel >> 8 ;
shorwich 9:72f00cef468b 402 towrite[1]= F_gfx_PutPixel ;
shorwich 9:72f00cef468b 403 towrite[2]= X >> 8 ;
shorwich 9:72f00cef468b 404 towrite[3]= X ;
shorwich 9:72f00cef468b 405 towrite[4]= Y >> 8 ;
shorwich 9:72f00cef468b 406 towrite[5]= Y ;
shorwich 9:72f00cef468b 407 towrite[6]= Color >> 8 ;
shorwich 9:72f00cef468b 408 towrite[7]= Color ;
shorwich 9:72f00cef468b 409 WriteBytes(towrite, 8) ;
shorwich 9:72f00cef468b 410 GetAck() ;
shorwich 9:72f00cef468b 411 }
shorwich 9:72f00cef468b 412
shorwich 9:72f00cef468b 413 void uLCD_4D_Picaso::gfx_Rectangle(uint16_t X1, uint16_t Y1, uint16_t X2, uint16_t Y2, Picaso::Color Color)
shorwich 9:72f00cef468b 414 {
shorwich 9:72f00cef468b 415 char towrite[12] ;
shorwich 9:72f00cef468b 416 towrite[0]= F_gfx_Rectangle >> 8 ;
shorwich 9:72f00cef468b 417 towrite[1]= F_gfx_Rectangle ;
shorwich 9:72f00cef468b 418 towrite[2]= X1 >> 8 ;
shorwich 9:72f00cef468b 419 towrite[3]= X1 ;
shorwich 9:72f00cef468b 420 towrite[4]= Y1 >> 8 ;
shorwich 9:72f00cef468b 421 towrite[5]= Y1 ;
shorwich 9:72f00cef468b 422 towrite[6]= X2 >> 8 ;
shorwich 9:72f00cef468b 423 towrite[7]= X2 ;
shorwich 9:72f00cef468b 424 towrite[8]= Y2 >> 8 ;
shorwich 9:72f00cef468b 425 towrite[9]= Y2 ;
shorwich 9:72f00cef468b 426 towrite[10]= Color >> 8 ;
shorwich 9:72f00cef468b 427 towrite[11]= Color ;
shorwich 9:72f00cef468b 428 WriteBytes(towrite, 12) ;
shorwich 9:72f00cef468b 429 GetAck() ;
shorwich 9:72f00cef468b 430 }
shorwich 9:72f00cef468b 431
shorwich 9:72f00cef468b 432 void uLCD_4D_Picaso::gfx_RectangleFilled(uint16_t X1, uint16_t Y1, uint16_t X2, uint16_t Y2, Picaso::Color Color)
shorwich 9:72f00cef468b 433 {
shorwich 9:72f00cef468b 434 char towrite[12] ;
shorwich 9:72f00cef468b 435 towrite[0]= F_gfx_RectangleFilled >> 8 ;
shorwich 9:72f00cef468b 436 towrite[1]= F_gfx_RectangleFilled ;
shorwich 9:72f00cef468b 437 towrite[2]= X1 >> 8 ;
shorwich 9:72f00cef468b 438 towrite[3]= X1 ;
shorwich 9:72f00cef468b 439 towrite[4]= Y1 >> 8 ;
shorwich 9:72f00cef468b 440 towrite[5]= Y1 ;
shorwich 9:72f00cef468b 441 towrite[6]= X2 >> 8 ;
shorwich 9:72f00cef468b 442 towrite[7]= X2 ;
shorwich 9:72f00cef468b 443 towrite[8]= Y2 >> 8 ;
shorwich 9:72f00cef468b 444 towrite[9]= Y2 ;
shorwich 9:72f00cef468b 445 towrite[10]= Color >> 8 ;
shorwich 9:72f00cef468b 446 towrite[11]= Color ;
shorwich 9:72f00cef468b 447 WriteBytes(towrite, 12) ;
shorwich 9:72f00cef468b 448 GetAck() ;
shorwich 9:72f00cef468b 449 }
shorwich 9:72f00cef468b 450
shorwich 9:72f00cef468b 451 void uLCD_4D_Picaso::gfx_ScreenCopyPaste(uint16_t Xs, uint16_t Ys, uint16_t Xd, uint16_t Yd, uint16_t Width, uint16_t Height)
shorwich 9:72f00cef468b 452 {
shorwich 9:72f00cef468b 453 char towrite[14] ;
shorwich 9:72f00cef468b 454 towrite[0]= F_gfx_ScreenCopyPaste >> 8 ;
shorwich 9:72f00cef468b 455 towrite[1]= F_gfx_ScreenCopyPaste ;
shorwich 9:72f00cef468b 456 towrite[2]= Xs >> 8 ;
shorwich 9:72f00cef468b 457 towrite[3]= Xs ;
shorwich 9:72f00cef468b 458 towrite[4]= Ys >> 8 ;
shorwich 9:72f00cef468b 459 towrite[5]= Ys ;
shorwich 9:72f00cef468b 460 towrite[6]= Xd >> 8 ;
shorwich 9:72f00cef468b 461 towrite[7]= Xd ;
shorwich 9:72f00cef468b 462 towrite[8]= Yd >> 8 ;
shorwich 9:72f00cef468b 463 towrite[9]= Yd ;
shorwich 9:72f00cef468b 464 towrite[10]= Width >> 8 ;
shorwich 9:72f00cef468b 465 towrite[11]= Width ;
shorwich 9:72f00cef468b 466 towrite[12]= Height >> 8 ;
shorwich 9:72f00cef468b 467 towrite[13]= Height ;
shorwich 9:72f00cef468b 468 WriteBytes(towrite, 14) ;
shorwich 9:72f00cef468b 469 GetAck() ;
shorwich 9:72f00cef468b 470 }
shorwich 9:72f00cef468b 471
shorwich 9:72f00cef468b 472 Picaso::ScreenMode uLCD_4D_Picaso::gfx_ScreenMode(Picaso::ScreenMode ScreenMode)
shorwich 9:72f00cef468b 473 {
shorwich 9:72f00cef468b 474 char towrite[4] ;
shorwich 9:72f00cef468b 475
shorwich 9:72f00cef468b 476 towrite[0]= F_gfx_ScreenMode >> 8 ;
shorwich 9:72f00cef468b 477 towrite[1]= F_gfx_ScreenMode ;
shorwich 9:72f00cef468b 478 towrite[2]= ScreenMode >> 8 ;
shorwich 9:72f00cef468b 479 towrite[3]= ScreenMode ;
shorwich 9:72f00cef468b 480 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 481 return (Picaso::ScreenMode) GetAckResp() ;
shorwich 9:72f00cef468b 482 }
shorwich 9:72f00cef468b 483
shorwich 9:72f00cef468b 484 void uLCD_4D_Picaso::gfx_Set(Picaso::GFXSetFunc Func, uint16_t Value)
shorwich 9:72f00cef468b 485 {
shorwich 9:72f00cef468b 486 char towrite[6] ;
shorwich 9:72f00cef468b 487
shorwich 9:72f00cef468b 488 towrite[0]= F_gfx_Set >> 8 ;
shorwich 9:72f00cef468b 489 towrite[1]= F_gfx_Set ;
shorwich 9:72f00cef468b 490 towrite[2]= Func >> 8 ;
shorwich 9:72f00cef468b 491 towrite[3]= Func ;
shorwich 9:72f00cef468b 492 towrite[4]= Value >> 8 ;
shorwich 9:72f00cef468b 493 towrite[5]= Value ;
shorwich 9:72f00cef468b 494 WriteBytes(towrite, 6) ;
shorwich 9:72f00cef468b 495 GetAck() ;
shorwich 9:72f00cef468b 496 }
shorwich 9:72f00cef468b 497
shorwich 9:72f00cef468b 498 void uLCD_4D_Picaso::gfx_SetClipRegion()
shorwich 9:72f00cef468b 499 {
shorwich 9:72f00cef468b 500 char towrite[2] ;
shorwich 9:72f00cef468b 501
shorwich 9:72f00cef468b 502 towrite[0]= F_gfx_SetClipRegion >> 8 ;
shorwich 9:72f00cef468b 503 towrite[1]= F_gfx_SetClipRegion ;
shorwich 9:72f00cef468b 504 WriteBytes(towrite, 2) ;
shorwich 9:72f00cef468b 505 GetAck() ;
shorwich 9:72f00cef468b 506 }
shorwich 9:72f00cef468b 507
shorwich 9:72f00cef468b 508 uint16_t uLCD_4D_Picaso::gfx_Slider(Picaso::SliderState Mode, uint16_t X1, uint16_t Y1, uint16_t X2, uint16_t Y2, Picaso::Color Color, uint16_t Scale, uint16_t Value)
shorwich 9:72f00cef468b 509 {
shorwich 9:72f00cef468b 510 char towrite[18] ;
shorwich 9:72f00cef468b 511
shorwich 9:72f00cef468b 512 towrite[0]= F_gfx_Slider >> 8 ;
shorwich 9:72f00cef468b 513 towrite[1]= F_gfx_Slider ;
shorwich 9:72f00cef468b 514 towrite[2]= Mode >> 8 ;
shorwich 9:72f00cef468b 515 towrite[3]= Mode ;
shorwich 9:72f00cef468b 516 towrite[4]= X1 >> 8 ;
shorwich 9:72f00cef468b 517 towrite[5]= X1 ;
shorwich 9:72f00cef468b 518 towrite[6]= Y1 >> 8 ;
shorwich 9:72f00cef468b 519 towrite[7]= Y1 ;
shorwich 9:72f00cef468b 520 towrite[8]= X2 >> 8 ;
shorwich 9:72f00cef468b 521 towrite[9]= X2 ;
shorwich 9:72f00cef468b 522 towrite[10]= Y2 >> 8 ;
shorwich 9:72f00cef468b 523 towrite[11]= Y2 ;
shorwich 9:72f00cef468b 524 towrite[12]= Color >> 8 ;
shorwich 9:72f00cef468b 525 towrite[13]= Color ;
shorwich 9:72f00cef468b 526 towrite[14]= Scale >> 8 ;
shorwich 9:72f00cef468b 527 towrite[15]= Scale ;
shorwich 9:72f00cef468b 528 towrite[16]= Value >> 8 ;
shorwich 9:72f00cef468b 529 towrite[17]= Value ;
shorwich 9:72f00cef468b 530 WriteBytes(towrite, 18) ;
shorwich 9:72f00cef468b 531 return GetAckResp() ;
shorwich 9:72f00cef468b 532 }
shorwich 9:72f00cef468b 533
shorwich 9:72f00cef468b 534 uint16_t uLCD_4D_Picaso::gfx_Transparency(uint16_t OnOff)
shorwich 9:72f00cef468b 535 {
shorwich 9:72f00cef468b 536 char towrite[4] ;
shorwich 9:72f00cef468b 537
shorwich 9:72f00cef468b 538 towrite[0]= F_gfx_Transparency >> 8 ;
shorwich 9:72f00cef468b 539 towrite[1]= F_gfx_Transparency ;
shorwich 9:72f00cef468b 540 towrite[2]= OnOff >> 8 ;
shorwich 9:72f00cef468b 541 towrite[3]= OnOff ;
shorwich 9:72f00cef468b 542 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 543 return GetAckResp() ;
shorwich 9:72f00cef468b 544 }
shorwich 9:72f00cef468b 545
shorwich 9:72f00cef468b 546 Picaso::Color uLCD_4D_Picaso::gfx_TransparentColour(Picaso::Color Color)
shorwich 9:72f00cef468b 547 {
shorwich 9:72f00cef468b 548 char towrite[4] ;
shorwich 9:72f00cef468b 549
shorwich 9:72f00cef468b 550 towrite[0]= F_gfx_TransparentColour >> 8 ;
shorwich 9:72f00cef468b 551 towrite[1]= F_gfx_TransparentColour ;
shorwich 9:72f00cef468b 552 towrite[2]= Color >> 8 ;
shorwich 9:72f00cef468b 553 towrite[3]= Color ;
shorwich 9:72f00cef468b 554 WriteBytes(towrite, 4) ;
shorwich 9:72f00cef468b 555 return (Picaso::Color) GetAckResp() ;
shorwich 9:72f00cef468b 556 }
shorwich 9:72f00cef468b 557
shorwich 9:72f00cef468b 558 void uLCD_4D_Picaso::gfx_Triangle(uint16_t X1, uint16_t Y1, uint16_t X2, uint16_t Y2, uint16_t X3, uint16_t Y3, Picaso::Color Color)
shorwich 9:72f00cef468b 559 {
shorwich 9:72f00cef468b 560 char towrite[16] ;
shorwich 9:72f00cef468b 561
shorwich 9:72f00cef468b 562 towrite[0]= F_gfx_Triangle >> 8 ;
shorwich 9:72f00cef468b 563 towrite[1]= F_gfx_Triangle ;
shorwich 9:72f00cef468b 564 towrite[2]= X1 >> 8 ;
shorwich 9:72f00cef468b 565 towrite[3]= X1 ;
shorwich 9:72f00cef468b 566 towrite[4]= Y1 >> 8 ;
shorwich 9:72f00cef468b 567 towrite[5]= Y1 ;
shorwich 9:72f00cef468b 568 towrite[6]= X2 >> 8 ;
shorwich 9:72f00cef468b 569 towrite[7]= X2 ;
shorwich 9:72f00cef468b 570 towrite[8]= Y2 >> 8 ;
shorwich 9:72f00cef468b 571 towrite[9]= Y2 ;
shorwich 9:72f00cef468b 572 towrite[10]= X3 >> 8 ;
shorwich 9:72f00cef468b 573 towrite[11]= X3 ;
shorwich 9:72f00cef468b 574 towrite[12]= Y3 >> 8 ;
shorwich 9:72f00cef468b 575 towrite[13]= Y3 ;
shorwich 9:72f00cef468b 576 towrite[14]= Color >> 8 ;
shorwich 9:72f00cef468b 577 towrite[15]= Color ;
shorwich 9:72f00cef468b 578 WriteBytes(towrite, 16) ;
shorwich 9:72f00cef468b 579 GetAck() ;
shorwich 9:72f00cef468b 580 }
shorwich 9:72f00cef468b 581
shorwich 9:72f00cef468b 582 void uLCD_4D_Picaso::gfx_TriangleFilled(uint16_t X1, uint16_t Y1, uint16_t X2, uint16_t Y2, uint16_t X3, uint16_t Y3, Picaso::Color Color)
shorwich 9:72f00cef468b 583 {
shorwich 9:72f00cef468b 584 char towrite[16] ;
shorwich 9:72f00cef468b 585 towrite[0]= F_gfx_TriangleFilled >> 8 ;
shorwich 9:72f00cef468b 586 towrite[1]= F_gfx_TriangleFilled ;
shorwich 9:72f00cef468b 587 towrite[2]= X1 >> 8 ;
shorwich 9:72f00cef468b 588 towrite[3]= X1 ;
shorwich 9:72f00cef468b 589 towrite[4]= Y1 >> 8 ;
shorwich 9:72f00cef468b 590 towrite[5]= Y1 ;
shorwich 9:72f00cef468b 591 towrite[6]= X2 >> 8 ;
shorwich 9:72f00cef468b 592 towrite[7]= X2 ;
shorwich 9:72f00cef468b 593 towrite[8]= Y2 >> 8 ;
shorwich 9:72f00cef468b 594 towrite[9]= Y2 ;
shorwich 9:72f00cef468b 595 towrite[10]= X3 >> 8 ;
shorwich 9:72f00cef468b 596 towrite[11]= X3 ;
shorwich 9:72f00cef468b 597 towrite[12]= Y3 >> 8 ;
shorwich 9:72f00cef468b 598 towrite[13]= Y3 ;
shorwich 9:72f00cef468b 599 towrite[14]= Color >> 8 ;
shorwich 9:72f00cef468b 600 towrite[15]= Color ;
shorwich 9:72f00cef468b 601 WriteBytes(towrite, 16) ;
shorwich 9:72f00cef468b 602 GetAck() ;
shorwich 9:72f00cef468b 603 }