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

Files at this revision

API Documentation at this revision

Comitter:
shorwich
Date:
Thu Oct 27 23:42:13 2016 +0000
Parent:
8:25147173a168
Commit message:
Moved graphics command functions to separate file for clarity.

Changed in this revision

uLCD_4D_Picaso.cpp Show annotated file Show diff for this revision Revisions of this file
uLCD_4D_Picaso.h Show annotated file Show diff for this revision Revisions of this file
uLCD_4D_Picaso_Graphics.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/uLCD_4D_Picaso.cpp	Thu Oct 27 15:58:03 2016 +0000
+++ b/uLCD_4D_Picaso.cpp	Thu Oct 27 23:42:13 2016 +0000
@@ -32,155 +32,6 @@
 #endif
 
 
-//Constant 4D Serial Commands
-// function call index definitions, generated by build of serial
-#define F_charheight 29
-#define F_charwidth 30
-#define F_bus_In -45
-#define F_bus_Out -46
-#define F_bus_Read -49
-#define F_bus_Set -47
-#define F_bus_Write -48
-#define F_file_Close -232
-#define F_file_Count 1
-#define F_file_Dir 2
-#define F_file_Erase 3
-#define F_file_Error -225
-#define F_file_Exec 4
-#define F_file_Exists 5
-#define F_file_FindFirst 6
-#define F_file_FindNext -229
-#define F_file_GetC -242
-#define F_file_GetS 7
-#define F_file_GetW -244
-#define F_file_Image -239
-#define F_file_Index -235
-#define F_file_LoadFunction 8
-#define F_file_LoadImageControl 9
-#define F_file_Mount -253
-#define F_file_Open 10
-#define F_file_PlayWAV 11
-#define F_file_PutC 31
-#define F_file_PutS 32
-#define F_file_PutW -243
-#define F_file_Read 12
-#define F_file_Rewind -248
-#define F_file_Run 13
-#define F_file_ScreenCapture -240
-#define F_file_Seek -234
-#define F_file_Size 14
-#define F_file_Tell 15
-#define F_file_Unmount -254
-#define F_file_Write 16
-#define F_gfx_BevelShadow -104
-#define F_gfx_BevelWidth -103
-#define F_gfx_BGcolour -92
-#define F_gfx_Button 17
-#define F_gfx_ChangeColour -76
-#define F_gfx_Circle -61
-#define F_gfx_CircleFilled -62
-#define F_gfx_Clipping -94
-#define F_gfx_ClipWindow -75
-#define F_gfx_Cls -51
-#define F_gfx_Contrast -100
-#define F_gfx_Ellipse -78
-#define F_gfx_EllipseFilled -79
-#define F_gfx_FrameDelay -97
-#define F_gfx_Get -90
-#define F_gfx_GetPixel -64
-#define F_gfx_Line -56
-#define F_gfx_LinePattern -101
-#define F_gfx_LineTo -54
-#define F_gfx_MoveTo -52
-#define F_gfx_Orbit 18
-#define F_gfx_OutlineColour -99
-#define F_gfx_Panel -81
-#define F_gfx_Polygon 19
-#define F_gfx_PolygonFilled 20
-#define F_gfx_Polyline 21
-#define F_gfx_PutPixel -63
-#define F_gfx_Rectangle -59
-#define F_gfx_RectangleFilled -60
-#define F_gfx_ScreenCopyPaste -83
-#define F_gfx_ScreenMode -98
-#define F_gfx_Set -50
-#define F_gfx_SetClipRegion -77
-#define F_gfx_Slider -82
-#define F_gfx_Transparency -96
-#define F_gfx_TransparentColour -95
-#define F_gfx_Triangle -65
-#define F_gfx_TriangleFilled -87
-#define F_img_ClearAttributes -187
-#define F_img_Darken -181
-#define F_img_Disable -180
-#define F_img_Enable -179
-#define F_img_GetWord -184
-#define F_img_Lighten -182
-#define F_img_SetAttributes -186
-#define F_img_SetPosition -178
-#define F_img_SetWord -183
-#define F_img_Show -185
-#define F_img_Touched -188
-#define F_media_Flush -118
-#define F_media_Image -117
-#define F_media_Init -119
-#define F_media_RdSector 22
-#define F_media_ReadByte -113
-#define F_media_ReadWord -114
-#define F_media_SetAdd -109
-#define F_media_SetSector -110
-#define F_media_Video -107
-#define F_media_VideoFrame -108
-#define F_media_WriteByte -115
-#define F_media_WriteWord -116
-#define F_media_WrSector 23
-#define F_mem_Free -220
-#define F_mem_Heap -221
-#define F_peekM 39
-#define F_pin_HI -42
-#define F_pin_LO -43
-#define F_pin_Read -44
-#define F_pin_Set -41
-#define F_pokeM 40
-#define F_putCH -2
-#define F_putstr 24
-#define F_snd_BufSize -258
-#define F_snd_Continue -261
-#define F_snd_Pause -260
-#define F_snd_Pitch -257
-#define F_snd_Playing -262
-#define F_snd_Stop -259
-#define F_snd_Volume -256
-#define F_sys_Sleep -197
-#define F_touch_DetectRegion -199
-#define F_touch_Get -201
-#define F_touch_Set -200
-#define F_txt_Attributes -38
-#define F_txt_BGcolour -26
-#define F_txt_Bold -34
-#define F_txt_FGcolour -25
-#define F_txt_FontID -27
-#define F_txt_Height -29
-#define F_txt_Inverse -36
-#define F_txt_Italic -35
-#define F_txt_MoveCursor -23
-#define F_txt_Opacity -33
-#define F_txt_Set -24
-#define F_txt_Underline -37
-#define F_txt_Width -28
-#define F_txt_Wrap -39
-#define F_txt_Xgap -30
-#define F_txt_Ygap -31
-#define F_file_CallFunction 25
-#define F_sys_GetModel 26
-#define F_sys_GetVersion 27
-#define F_sys_GetPmmC 28
-#define F_writeString 33
-#define F_readString 34
-#define F_blitComtoDisplay 35
-#define F_file_FindFirstRet 36
-#define F_file_FindNextRet 37
-#define F_setbaudWait 38
 
 /*
  * Start of 4D Intrinsic Routines
@@ -875,594 +726,6 @@
   return GetAckResp() ;
 }
 
-uint16_t uLCD_4D_Picaso::gfx_BevelShadow(uint16_t  Value)
-{
-  char  towrite[4] ;
-  towrite[0]= F_gfx_BevelShadow >> 8 ;
-  towrite[1]= F_gfx_BevelShadow ;
-  towrite[2]= Value >> 8 ;
-  towrite[3]= Value ;
-  WriteBytes(towrite, 4) ;
-  return GetAckResp() ;
-}
-
-uint16_t uLCD_4D_Picaso::gfx_BevelWidth(uint16_t  Value)
-{
-  char  towrite[4] ;
-  towrite[0]= F_gfx_BevelWidth >> 8 ;
-  towrite[1]= F_gfx_BevelWidth ;
-  towrite[2]= Value >> 8 ;
-  towrite[3]= Value ;
-  WriteBytes(towrite, 4) ;
-  return GetAckResp() ;
-}
-
-Picaso::Color uLCD_4D_Picaso::gfx_BGcolour(Picaso::Color Color)
-{
-  char  towrite[4] ;
-  towrite[0]= F_gfx_BGcolour >> 8 ;
-  towrite[1]= F_gfx_BGcolour ;
-  towrite[2]= Color >> 8 ;
-  towrite[3]= Color ;
-  WriteBytes(towrite, 4) ;
-  return (Picaso::Color) GetAckResp() ;
-}
-
-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)
-{
-  char  towrite[18] ;
-  towrite[0]= F_gfx_Button >> 8 ;
-  towrite[1]= F_gfx_Button ;
-  towrite[2]= Up >> 8 ;
-  towrite[3]= Up ;
-  towrite[4]= x >> 8 ;
-  towrite[5]= x ;
-  towrite[6]= y >> 8 ;
-  towrite[7]= y ;
-  towrite[8]= buttonColour >> 8 ;
-  towrite[9]= buttonColour ;
-  towrite[10]= txtColour >> 8 ;
-  towrite[11]= txtColour ;
-  towrite[12]= font >> 8 ;
-  towrite[13]= font ;
-  towrite[14]= txtWidth >> 8 ;
-  towrite[15]= txtWidth ;
-  towrite[16]= txtHeight >> 8 ;
-  towrite[17]= txtHeight ;
-  WriteBytes(towrite, 18) ;
-  WriteChars( text) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_ChangeColour(uint16_t  OldColor, uint16_t  NewColor)
-{
-  char  towrite[6] ;
-
-  towrite[0]= F_gfx_ChangeColour >> 8 ;
-  towrite[1]= F_gfx_ChangeColour ;
-  towrite[2]= OldColor >> 8 ;
-  towrite[3]= OldColor ;
-  towrite[4]= NewColor >> 8 ;
-  towrite[5]= NewColor ;
-  WriteBytes(towrite, 6) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_Circle(uint16_t  X, uint16_t  Y, uint16_t  Radius, Picaso::Color Color)
-{
-  char  towrite[10] ;
-
-  towrite[0]= F_gfx_Circle >> 8 ;
-  towrite[1]= F_gfx_Circle ;
-  towrite[2]= X >> 8 ;
-  towrite[3]= X ;
-  towrite[4]= Y >> 8 ;
-  towrite[5]= Y ;
-  towrite[6]= Radius >> 8 ;
-  towrite[7]= Radius ;
-  towrite[8]= Color >> 8 ;
-  towrite[9]= Color ;
-  WriteBytes(towrite, 10) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_CircleFilled(uint16_t  X, uint16_t  Y, uint16_t  Radius, Picaso::Color Color)
-{
-  char  towrite[10] ;
-
-  towrite[0]= F_gfx_CircleFilled >> 8 ;
-  towrite[1]= F_gfx_CircleFilled ;
-  towrite[2]= X >> 8 ;
-  towrite[3]= X ;
-  towrite[4]= Y >> 8 ;
-  towrite[5]= Y ;
-  towrite[6]= Radius >> 8 ;
-  towrite[7]= Radius ;
-  towrite[8]= Color >> 8 ;
-  towrite[9]= Color ;
-  WriteBytes(towrite, 10) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_Clipping(uint16_t  OnOff)
-{
-  char  towrite[4] ;
-
-  towrite[0]= F_gfx_Clipping >> 8 ;
-  towrite[1]= F_gfx_Clipping ;
-  towrite[2]= OnOff >> 8 ;
-  towrite[3]= OnOff ;
-  WriteBytes(towrite, 4) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_ClipWindow(uint16_t  X1, uint16_t  Y1, uint16_t  X2, uint16_t  Y2)
-{
-  char  towrite[10] ;
-
-  towrite[0]= F_gfx_ClipWindow >> 8 ;
-  towrite[1]= F_gfx_ClipWindow ;
-  towrite[2]= X1 >> 8 ;
-  towrite[3]= X1 ;
-  towrite[4]= Y1 >> 8 ;
-  towrite[5]= Y1 ;
-  towrite[6]= X2 >> 8 ;
-  towrite[7]= X2 ;
-  towrite[8]= Y2 >> 8 ;
-  towrite[9]= Y2 ;
-  WriteBytes(towrite, 10) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_Cls()
-{
-  char  towrite[2] ;
-  towrite[0]= F_gfx_Cls >> 8 ;
-  towrite[1]= F_gfx_Cls ;
-  WriteBytes(towrite, 2);
-  GetAck();
-}
-
-uint16_t uLCD_4D_Picaso::gfx_Contrast(uint16_t  Contrast)
-{
-  char  towrite[4] ;
-  towrite[0]= F_gfx_Contrast >> 8 ;
-  towrite[1]= F_gfx_Contrast ;
-  towrite[2]= Contrast >> 8 ;
-  towrite[3]= Contrast ;
-  WriteBytes(towrite, 4) ;
-  return GetAckResp() ;
-}
-
-void uLCD_4D_Picaso::gfx_Ellipse(uint16_t  X, uint16_t  Y, uint16_t  Xrad, uint16_t  Yrad, Picaso::Color Color)
-{
-  char  towrite[12] ;
-  towrite[0]= F_gfx_Ellipse >> 8 ;
-  towrite[1]= F_gfx_Ellipse ;
-  towrite[2]= X >> 8 ;
-  towrite[3]= X ;
-  towrite[4]= Y >> 8 ;
-  towrite[5]= Y ;
-  towrite[6]= Xrad >> 8 ;
-  towrite[7]= Xrad ;
-  towrite[8]= Yrad >> 8 ;
-  towrite[9]= Yrad ;
-  towrite[10]= Color >> 8 ;
-  towrite[11]= Color ;
-  WriteBytes(towrite, 12) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_EllipseFilled(uint16_t  X, uint16_t  Y, uint16_t  Xrad, uint16_t  Yrad, Picaso::Color Color)
-{
-  char  towrite[12] ;
-  towrite[0]= F_gfx_EllipseFilled >> 8 ;
-  towrite[1]= F_gfx_EllipseFilled ;
-  towrite[2]= X >> 8 ;
-  towrite[3]= X ;
-  towrite[4]= Y >> 8 ;
-  towrite[5]= Y ;
-  towrite[6]= Xrad >> 8 ;
-  towrite[7]= Xrad ;
-  towrite[8]= Yrad >> 8 ;
-  towrite[9]= Yrad ;
-  towrite[10]= Color >> 8 ;
-  towrite[11]= Color ;
-  WriteBytes(towrite, 12) ;
-  GetAck() ;
-}
-
-uint16_t uLCD_4D_Picaso::gfx_FrameDelay(uint16_t  Msec)
-{
-  char  towrite[4] ;
-  towrite[0]= F_gfx_FrameDelay >> 8 ;
-  towrite[1]= F_gfx_FrameDelay ;
-  towrite[2]= Msec >> 8 ;
-  towrite[3]= Msec ;
-  WriteBytes(towrite, 4) ;
-  return GetAckResp() ;
-}
-
-uint16_t uLCD_4D_Picaso::gfx_Get(Picaso::GFXGetMode  Mode)
-{
-  char  towrite[4] ;
-  towrite[0]= F_gfx_Get >> 8 ;
-  towrite[1]= F_gfx_Get ;
-  towrite[2]= Mode >> 8 ;
-  towrite[3]= Mode ;
-  WriteBytes(towrite, 4) ;
-  return GetAckResp() ;
-}
-
-Picaso::Color uLCD_4D_Picaso::gfx_GetPixel(uint16_t  X, uint16_t  Y)
-{
-  char  towrite[6] ;
-  towrite[0]= F_gfx_GetPixel >> 8 ;
-  towrite[1]= F_gfx_GetPixel ;
-  towrite[2]= X >> 8 ;
-  towrite[3]= X ;
-  towrite[4]= Y >> 8 ;
-  towrite[5]= Y ;
-  WriteBytes(towrite, 6) ;
-  return (Picaso::Color) GetAckResp() ;
-}
-
-void uLCD_4D_Picaso::gfx_Line(uint16_t  X1, uint16_t  Y1, uint16_t  X2, uint16_t  Y2, Picaso::Color Color)
-{
-  char  towrite[12] ;
-  towrite[0]= F_gfx_Line >> 8 ;
-  towrite[1]= F_gfx_Line ;
-  towrite[2]= X1 >> 8 ;
-  towrite[3]= X1 ;
-  towrite[4]= Y1 >> 8 ;
-  towrite[5]= Y1 ;
-  towrite[6]= X2 >> 8 ;
-  towrite[7]= X2 ;
-  towrite[8]= Y2 >> 8 ;
-  towrite[9]= Y2 ;
-  towrite[10]= Color >> 8 ;
-  towrite[11]= Color ;
-  WriteBytes(towrite, 12) ;
-  GetAck() ;
-}
-
-uint16_t uLCD_4D_Picaso::gfx_LinePattern(uint16_t  Pattern)
-{
-  char  towrite[4] ;
-  towrite[0]= F_gfx_LinePattern >> 8 ;
-  towrite[1]= F_gfx_LinePattern ;
-  towrite[2]= Pattern >> 8 ;
-  towrite[3]= Pattern ;
-  WriteBytes(towrite, 4) ;
-  return GetAckResp() ;
-}
-
-void uLCD_4D_Picaso::gfx_LineTo(uint16_t  X, uint16_t  Y)
-{
-  char  towrite[6] ;
-  towrite[0]= F_gfx_LineTo >> 8 ;
-  towrite[1]= F_gfx_LineTo ;
-  towrite[2]= X >> 8 ;
-  towrite[3]= X ;
-  towrite[4]= Y >> 8 ;
-  towrite[5]= Y ;
-  WriteBytes(towrite, 6) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_MoveTo(uint16_t  X, uint16_t  Y)
-{
-  char  towrite[6] ;
-  towrite[0]= F_gfx_MoveTo >> 8 ;
-  towrite[1]= F_gfx_MoveTo ;
-  towrite[2]= X >> 8 ;
-  towrite[3]= X ;
-  towrite[4]= Y >> 8 ;
-  towrite[5]= Y ;
-  WriteBytes(towrite, 6) ;
-  GetAck() ;
-}
-
-uint16_t uLCD_4D_Picaso::gfx_Orbit(uint16_t  Angle, uint16_t  Distance, uint16_t *  Xdest, uint16_t *  Ydest)
-{
-  char  towrite[6] ;
-  towrite[0]= F_gfx_Orbit >> 8 ;
-  towrite[1]= F_gfx_Orbit ;
-  towrite[2]= Angle >> 8 ;
-  towrite[3]= Angle ;
-  towrite[4]= Distance >> 8 ;
-  towrite[5]= Distance ;
-  WriteBytes(towrite, 6) ;
-  GetAck2Words(Xdest,Ydest) ;
-  return 0 ;
-}
-
-Picaso::Color uLCD_4D_Picaso::gfx_OutlineColour(Picaso::Color Color) {
-  char  towrite[4] ;
-  towrite[0]= F_gfx_OutlineColour >> 8 ;
-  towrite[1]= F_gfx_OutlineColour ;
-  towrite[2]= Color >> 8 ;
-  towrite[3]= Color ;
-  WriteBytes(towrite, 4) ;
-  return (Picaso::Color) GetAckResp() ;
-}
-
-void uLCD_4D_Picaso::gfx_Panel(Picaso::PanelState Raised, uint16_t  X, uint16_t  Y, uint16_t  Width, uint16_t  Height, Picaso::Color Color)
-{
-  char  towrite[14] ;
-  towrite[0]= F_gfx_Panel >> 8 ;
-  towrite[1]= F_gfx_Panel ;
-  towrite[2]= Raised >> 8 ;
-  towrite[3]= Raised ;
-  towrite[4]= X >> 8 ;
-  towrite[5]= X ;
-  towrite[6]= Y >> 8 ;
-  towrite[7]= Y ;
-  towrite[8]= Width >> 8 ;
-  towrite[9]= Width ;
-  towrite[10]= Height >> 8 ;
-  towrite[11]= Height ;
-  towrite[12]= Color >> 8 ;
-  towrite[13]= Color ;
-  WriteBytes(towrite, 14) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_Polygon(uint16_t  n, uint16_t*  Xvalues, uint16_t*  Yvalues, Picaso::Color Color)
-{
-  char  towrite[4] ;
-  towrite[0]= F_gfx_Polygon >> 8 ;
-  towrite[1]= F_gfx_Polygon ;
-  towrite[2]= n >> 8 ;
-  towrite[3]= n ;
-  WriteBytes(towrite, 4) ;
-  WriteWords(Xvalues, n) ;
-  WriteWords(Yvalues, n) ;
-  towrite[0]= Color >> 8 ;
-  towrite[1]= Color ;
-  WriteBytes(towrite, 2) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_PolygonFilled(uint16_t  n, uint16_t*  Xvalues, uint16_t*  Yvalues, Picaso::Color Color)
-{
-  char  towrite[4] ;
-  towrite[0]= F_gfx_PolygonFilled >> 8 ;
-  towrite[1]= F_gfx_PolygonFilled ;
-  towrite[2]= n >> 8 ;
-  towrite[3]= n ;
-  WriteBytes(towrite, 4) ;
-  WriteWords(Xvalues, n) ;
-  WriteWords(Yvalues, n) ;
-  towrite[0]= Color >> 8 ;
-  towrite[1]= Color ;
-  WriteBytes(towrite, 2) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_Polyline(uint16_t  n, uint16_t*  Xvalues, uint16_t*  Yvalues, Picaso::Color Color)
-{
-  char  towrite[4] ;
-  towrite[0]= F_gfx_Polyline >> 8 ;
-  towrite[1]= F_gfx_Polyline ;
-  towrite[2]= n >> 8 ;
-  towrite[3]= n ;
-  WriteBytes(towrite, 4) ;
-  WriteWords(Xvalues, n) ;
-  WriteWords(Yvalues, n) ;
-  towrite[0]= Color >> 8 ;
-  towrite[1]= Color ;
-  WriteBytes(towrite, 2) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_PutPixel(uint16_t  X, uint16_t  Y, Picaso::Color Color)
-{
-  char  towrite[8] ;
-  towrite[0]= F_gfx_PutPixel >> 8 ;
-  towrite[1]= F_gfx_PutPixel ;
-  towrite[2]= X >> 8 ;
-  towrite[3]= X ;
-  towrite[4]= Y >> 8 ;
-  towrite[5]= Y ;
-  towrite[6]= Color >> 8 ;
-  towrite[7]= Color ;
-  WriteBytes(towrite, 8) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_Rectangle(uint16_t  X1, uint16_t  Y1, uint16_t  X2, uint16_t  Y2, Picaso::Color Color)
-{
-  char  towrite[12] ;
-  towrite[0]= F_gfx_Rectangle >> 8 ;
-  towrite[1]= F_gfx_Rectangle ;
-  towrite[2]= X1 >> 8 ;
-  towrite[3]= X1 ;
-  towrite[4]= Y1 >> 8 ;
-  towrite[5]= Y1 ;
-  towrite[6]= X2 >> 8 ;
-  towrite[7]= X2 ;
-  towrite[8]= Y2 >> 8 ;
-  towrite[9]= Y2 ;
-  towrite[10]= Color >> 8 ;
-  towrite[11]= Color ;
-  WriteBytes(towrite, 12) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_RectangleFilled(uint16_t  X1, uint16_t  Y1, uint16_t  X2, uint16_t  Y2, Picaso::Color Color)
-{
-  char  towrite[12] ;
-  towrite[0]= F_gfx_RectangleFilled >> 8 ;
-  towrite[1]= F_gfx_RectangleFilled ;
-  towrite[2]= X1 >> 8 ;
-  towrite[3]= X1 ;
-  towrite[4]= Y1 >> 8 ;
-  towrite[5]= Y1 ;
-  towrite[6]= X2 >> 8 ;
-  towrite[7]= X2 ;
-  towrite[8]= Y2 >> 8 ;
-  towrite[9]= Y2 ;
-  towrite[10]= Color >> 8 ;
-  towrite[11]= Color ;
-  WriteBytes(towrite, 12) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_ScreenCopyPaste(uint16_t  Xs, uint16_t  Ys, uint16_t  Xd, uint16_t  Yd, uint16_t  Width, uint16_t  Height)
-{
-  char  towrite[14] ;
-  towrite[0]= F_gfx_ScreenCopyPaste >> 8 ;
-  towrite[1]= F_gfx_ScreenCopyPaste ;
-  towrite[2]= Xs >> 8 ;
-  towrite[3]= Xs ;
-  towrite[4]= Ys >> 8 ;
-  towrite[5]= Ys ;
-  towrite[6]= Xd >> 8 ;
-  towrite[7]= Xd ;
-  towrite[8]= Yd >> 8 ;
-  towrite[9]= Yd ;
-  towrite[10]= Width >> 8 ;
-  towrite[11]= Width ;
-  towrite[12]= Height >> 8 ;
-  towrite[13]= Height ;
-  WriteBytes(towrite, 14) ;
-  GetAck() ;
-}
-
-Picaso::ScreenMode uLCD_4D_Picaso::gfx_ScreenMode(Picaso::ScreenMode ScreenMode)
-{
-  char  towrite[4] ;
-
-  towrite[0]= F_gfx_ScreenMode >> 8 ;
-  towrite[1]= F_gfx_ScreenMode ;
-  towrite[2]= ScreenMode >> 8 ;
-  towrite[3]= ScreenMode ;
-  WriteBytes(towrite, 4) ;
-  return (Picaso::ScreenMode) GetAckResp() ;
-}
-
-void uLCD_4D_Picaso::gfx_Set(Picaso::GFXSetFunc Func, uint16_t  Value)
-{
-  char  towrite[6] ;
-
-  towrite[0]= F_gfx_Set >> 8 ;
-  towrite[1]= F_gfx_Set ;
-  towrite[2]= Func >> 8 ;
-  towrite[3]= Func ;
-  towrite[4]= Value >> 8 ;
-  towrite[5]= Value ;
-  WriteBytes(towrite, 6) ;
-  GetAck() ;
-}
-
-void uLCD_4D_Picaso::gfx_SetClipRegion()
-{
-  char  towrite[2] ;
-
-  towrite[0]= F_gfx_SetClipRegion >> 8 ;
-  towrite[1]= F_gfx_SetClipRegion ;
-  WriteBytes(towrite, 2) ;
-  GetAck() ;
-}
-
-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)
-{
-  char  towrite[18] ;
-
-  towrite[0]= F_gfx_Slider >> 8 ;
-  towrite[1]= F_gfx_Slider ;
-  towrite[2]= Mode >> 8 ;
-  towrite[3]= Mode ;
-  towrite[4]= X1 >> 8 ;
-  towrite[5]= X1 ;
-  towrite[6]= Y1 >> 8 ;
-  towrite[7]= Y1 ;
-  towrite[8]= X2 >> 8 ;
-  towrite[9]= X2 ;
-  towrite[10]= Y2 >> 8 ;
-  towrite[11]= Y2 ;
-  towrite[12]= Color >> 8 ;
-  towrite[13]= Color ;
-  towrite[14]= Scale >> 8 ;
-  towrite[15]= Scale ;
-  towrite[16]= Value >> 8 ;
-  towrite[17]= Value ;
-  WriteBytes(towrite, 18) ;
-  return GetAckResp() ;
-}
-
-uint16_t uLCD_4D_Picaso::gfx_Transparency(uint16_t  OnOff)
-{
-  char  towrite[4] ;
-
-  towrite[0]= F_gfx_Transparency >> 8 ;
-  towrite[1]= F_gfx_Transparency ;
-  towrite[2]= OnOff >> 8 ;
-  towrite[3]= OnOff ;
-  WriteBytes(towrite, 4) ;
-  return GetAckResp() ;
-}
-
-Picaso::Color uLCD_4D_Picaso::gfx_TransparentColour(Picaso::Color Color)
-{
-  char  towrite[4] ;
-
-  towrite[0]= F_gfx_TransparentColour >> 8 ;
-  towrite[1]= F_gfx_TransparentColour ;
-  towrite[2]= Color >> 8 ;
-  towrite[3]= Color ;
-  WriteBytes(towrite, 4) ;
-  return (Picaso::Color) GetAckResp() ;
-}
-
-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)
-{
-  char  towrite[16] ;
-
-  towrite[0]= F_gfx_Triangle >> 8 ;
-  towrite[1]= F_gfx_Triangle ;
-  towrite[2]= X1 >> 8 ;
-  towrite[3]= X1 ;
-  towrite[4]= Y1 >> 8 ;
-  towrite[5]= Y1 ;
-  towrite[6]= X2 >> 8 ;
-  towrite[7]= X2 ;
-  towrite[8]= Y2 >> 8 ;
-  towrite[9]= Y2 ;
-  towrite[10]= X3 >> 8 ;
-  towrite[11]= X3 ;
-  towrite[12]= Y3 >> 8 ;
-  towrite[13]= Y3 ;
-  towrite[14]= Color >> 8 ;
-  towrite[15]= Color ;
-  WriteBytes(towrite, 16) ;
-  GetAck() ;
-}
-
-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)
-{
-  char  towrite[16] ;
-  towrite[0]= F_gfx_TriangleFilled >> 8 ;
-  towrite[1]= F_gfx_TriangleFilled ;
-  towrite[2]= X1 >> 8 ;
-  towrite[3]= X1 ;
-  towrite[4]= Y1 >> 8 ;
-  towrite[5]= Y1 ;
-  towrite[6]= X2 >> 8 ;
-  towrite[7]= X2 ;
-  towrite[8]= Y2 >> 8 ;
-  towrite[9]= Y2 ;
-  towrite[10]= X3 >> 8 ;
-  towrite[11]= X3 ;
-  towrite[12]= Y3 >> 8 ;
-  towrite[13]= Y3 ;
-  towrite[14]= Color >> 8 ;
-  towrite[15]= Color ;
-  WriteBytes(towrite, 16) ;
-  GetAck() ;
-}
-
 uint16_t uLCD_4D_Picaso::img_ClearAttributes(uint16_t  Handle, uint16_t  Index, Picaso::ImageAttribute Value)
 {
   char  towrite[8] ;
--- a/uLCD_4D_Picaso.h	Thu Oct 27 15:58:03 2016 +0000
+++ b/uLCD_4D_Picaso.h	Thu Oct 27 23:42:13 2016 +0000
@@ -30,6 +30,155 @@
 #include "MODSERIAL.h"
 #endif
 
+//Constant 4D Serial Commands
+// function call index definitions, generated by build of serial
+#define F_charheight 29
+#define F_charwidth 30
+#define F_bus_In -45
+#define F_bus_Out -46
+#define F_bus_Read -49
+#define F_bus_Set -47
+#define F_bus_Write -48
+#define F_file_Close -232
+#define F_file_Count 1
+#define F_file_Dir 2
+#define F_file_Erase 3
+#define F_file_Error -225
+#define F_file_Exec 4
+#define F_file_Exists 5
+#define F_file_FindFirst 6
+#define F_file_FindNext -229
+#define F_file_GetC -242
+#define F_file_GetS 7
+#define F_file_GetW -244
+#define F_file_Image -239
+#define F_file_Index -235
+#define F_file_LoadFunction 8
+#define F_file_LoadImageControl 9
+#define F_file_Mount -253
+#define F_file_Open 10
+#define F_file_PlayWAV 11
+#define F_file_PutC 31
+#define F_file_PutS 32
+#define F_file_PutW -243
+#define F_file_Read 12
+#define F_file_Rewind -248
+#define F_file_Run 13
+#define F_file_ScreenCapture -240
+#define F_file_Seek -234
+#define F_file_Size 14
+#define F_file_Tell 15
+#define F_file_Unmount -254
+#define F_file_Write 16
+#define F_gfx_BevelShadow -104
+#define F_gfx_BevelWidth -103
+#define F_gfx_BGcolour -92
+#define F_gfx_Button 17
+#define F_gfx_ChangeColour -76
+#define F_gfx_Circle -61
+#define F_gfx_CircleFilled -62
+#define F_gfx_Clipping -94
+#define F_gfx_ClipWindow -75
+#define F_gfx_Cls -51
+#define F_gfx_Contrast -100
+#define F_gfx_Ellipse -78
+#define F_gfx_EllipseFilled -79
+#define F_gfx_FrameDelay -97
+#define F_gfx_Get -90
+#define F_gfx_GetPixel -64
+#define F_gfx_Line -56
+#define F_gfx_LinePattern -101
+#define F_gfx_LineTo -54
+#define F_gfx_MoveTo -52
+#define F_gfx_Orbit 18
+#define F_gfx_OutlineColour -99
+#define F_gfx_Panel -81
+#define F_gfx_Polygon 19
+#define F_gfx_PolygonFilled 20
+#define F_gfx_Polyline 21
+#define F_gfx_PutPixel -63
+#define F_gfx_Rectangle -59
+#define F_gfx_RectangleFilled -60
+#define F_gfx_ScreenCopyPaste -83
+#define F_gfx_ScreenMode -98
+#define F_gfx_Set -50
+#define F_gfx_SetClipRegion -77
+#define F_gfx_Slider -82
+#define F_gfx_Transparency -96
+#define F_gfx_TransparentColour -95
+#define F_gfx_Triangle -65
+#define F_gfx_TriangleFilled -87
+#define F_img_ClearAttributes -187
+#define F_img_Darken -181
+#define F_img_Disable -180
+#define F_img_Enable -179
+#define F_img_GetWord -184
+#define F_img_Lighten -182
+#define F_img_SetAttributes -186
+#define F_img_SetPosition -178
+#define F_img_SetWord -183
+#define F_img_Show -185
+#define F_img_Touched -188
+#define F_media_Flush -118
+#define F_media_Image -117
+#define F_media_Init -119
+#define F_media_RdSector 22
+#define F_media_ReadByte -113
+#define F_media_ReadWord -114
+#define F_media_SetAdd -109
+#define F_media_SetSector -110
+#define F_media_Video -107
+#define F_media_VideoFrame -108
+#define F_media_WriteByte -115
+#define F_media_WriteWord -116
+#define F_media_WrSector 23
+#define F_mem_Free -220
+#define F_mem_Heap -221
+#define F_peekM 39
+#define F_pin_HI -42
+#define F_pin_LO -43
+#define F_pin_Read -44
+#define F_pin_Set -41
+#define F_pokeM 40
+#define F_putCH -2
+#define F_putstr 24
+#define F_snd_BufSize -258
+#define F_snd_Continue -261
+#define F_snd_Pause -260
+#define F_snd_Pitch -257
+#define F_snd_Playing -262
+#define F_snd_Stop -259
+#define F_snd_Volume -256
+#define F_sys_Sleep -197
+#define F_touch_DetectRegion -199
+#define F_touch_Get -201
+#define F_touch_Set -200
+#define F_txt_Attributes -38
+#define F_txt_BGcolour -26
+#define F_txt_Bold -34
+#define F_txt_FGcolour -25
+#define F_txt_FontID -27
+#define F_txt_Height -29
+#define F_txt_Inverse -36
+#define F_txt_Italic -35
+#define F_txt_MoveCursor -23
+#define F_txt_Opacity -33
+#define F_txt_Set -24
+#define F_txt_Underline -37
+#define F_txt_Width -28
+#define F_txt_Wrap -39
+#define F_txt_Xgap -30
+#define F_txt_Ygap -31
+#define F_file_CallFunction 25
+#define F_sys_GetModel 26
+#define F_sys_GetVersion 27
+#define F_sys_GetPmmC 28
+#define F_writeString 33
+#define F_readString 34
+#define F_blitComtoDisplay 35
+#define F_file_FindFirstRet 36
+#define F_file_FindNextRet 37
+#define F_setbaudWait 38
 
 
 /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uLCD_4D_Picaso_Graphics.cpp	Thu Oct 27 23:42:13 2016 +0000
@@ -0,0 +1,603 @@
+/**
+ * This is a class to drive 4D systems screens with Picaso graphics processors
+ * 
+ * This is a port of the 4D systems Picaso Serial Linux Library
+ * Copyright (c) 2014 4D Systems PTY Ltd, Sydney, Australia
+ * From https://github.com/4dsystems/Picaso-Serial-Linux-Library, retrieved March 5, 2015
+ * 
+ * Graphics Command Functions. Updated October, 27, 2016.
+ *
+ * All software in this library is provided without warranty; use at your own risk.
+ */
+#include "mbed.h"
+#include "Picaso_enums.h"
+#include "uLCD_4D_Picaso.h"
+
+
+uint16_t uLCD_4D_Picaso::gfx_BevelShadow(uint16_t  Value)
+{
+  char  towrite[4] ;
+  towrite[0]= F_gfx_BevelShadow >> 8 ;
+  towrite[1]= F_gfx_BevelShadow ;
+  towrite[2]= Value >> 8 ;
+  towrite[3]= Value ;
+  WriteBytes(towrite, 4) ;
+  return GetAckResp() ;
+}
+
+uint16_t uLCD_4D_Picaso::gfx_BevelWidth(uint16_t  Value)
+{
+  char  towrite[4] ;
+  towrite[0]= F_gfx_BevelWidth >> 8 ;
+  towrite[1]= F_gfx_BevelWidth ;
+  towrite[2]= Value >> 8 ;
+  towrite[3]= Value ;
+  WriteBytes(towrite, 4) ;
+  return GetAckResp() ;
+}
+
+Picaso::Color uLCD_4D_Picaso::gfx_BGcolour(Picaso::Color Color)
+{
+  char  towrite[4] ;
+  towrite[0]= F_gfx_BGcolour >> 8 ;
+  towrite[1]= F_gfx_BGcolour ;
+  towrite[2]= Color >> 8 ;
+  towrite[3]= Color ;
+  WriteBytes(towrite, 4) ;
+  return (Picaso::Color) GetAckResp() ;
+}
+
+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)
+{
+  char  towrite[18] ;
+  towrite[0]= F_gfx_Button >> 8 ;
+  towrite[1]= F_gfx_Button ;
+  towrite[2]= Up >> 8 ;
+  towrite[3]= Up ;
+  towrite[4]= x >> 8 ;
+  towrite[5]= x ;
+  towrite[6]= y >> 8 ;
+  towrite[7]= y ;
+  towrite[8]= buttonColour >> 8 ;
+  towrite[9]= buttonColour ;
+  towrite[10]= txtColour >> 8 ;
+  towrite[11]= txtColour ;
+  towrite[12]= font >> 8 ;
+  towrite[13]= font ;
+  towrite[14]= txtWidth >> 8 ;
+  towrite[15]= txtWidth ;
+  towrite[16]= txtHeight >> 8 ;
+  towrite[17]= txtHeight ;
+  WriteBytes(towrite, 18) ;
+  WriteChars( text) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_ChangeColour(uint16_t  OldColor, uint16_t  NewColor)
+{
+  char  towrite[6] ;
+
+  towrite[0]= F_gfx_ChangeColour >> 8 ;
+  towrite[1]= F_gfx_ChangeColour ;
+  towrite[2]= OldColor >> 8 ;
+  towrite[3]= OldColor ;
+  towrite[4]= NewColor >> 8 ;
+  towrite[5]= NewColor ;
+  WriteBytes(towrite, 6) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_Circle(uint16_t  X, uint16_t  Y, uint16_t  Radius, Picaso::Color Color)
+{
+  char  towrite[10] ;
+
+  towrite[0]= F_gfx_Circle >> 8 ;
+  towrite[1]= F_gfx_Circle ;
+  towrite[2]= X >> 8 ;
+  towrite[3]= X ;
+  towrite[4]= Y >> 8 ;
+  towrite[5]= Y ;
+  towrite[6]= Radius >> 8 ;
+  towrite[7]= Radius ;
+  towrite[8]= Color >> 8 ;
+  towrite[9]= Color ;
+  WriteBytes(towrite, 10) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_CircleFilled(uint16_t  X, uint16_t  Y, uint16_t  Radius, Picaso::Color Color)
+{
+  char  towrite[10] ;
+
+  towrite[0]= F_gfx_CircleFilled >> 8 ;
+  towrite[1]= F_gfx_CircleFilled ;
+  towrite[2]= X >> 8 ;
+  towrite[3]= X ;
+  towrite[4]= Y >> 8 ;
+  towrite[5]= Y ;
+  towrite[6]= Radius >> 8 ;
+  towrite[7]= Radius ;
+  towrite[8]= Color >> 8 ;
+  towrite[9]= Color ;
+  WriteBytes(towrite, 10) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_Clipping(uint16_t  OnOff)
+{
+  char  towrite[4] ;
+
+  towrite[0]= F_gfx_Clipping >> 8 ;
+  towrite[1]= F_gfx_Clipping ;
+  towrite[2]= OnOff >> 8 ;
+  towrite[3]= OnOff ;
+  WriteBytes(towrite, 4) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_ClipWindow(uint16_t  X1, uint16_t  Y1, uint16_t  X2, uint16_t  Y2)
+{
+  char  towrite[10] ;
+
+  towrite[0]= F_gfx_ClipWindow >> 8 ;
+  towrite[1]= F_gfx_ClipWindow ;
+  towrite[2]= X1 >> 8 ;
+  towrite[3]= X1 ;
+  towrite[4]= Y1 >> 8 ;
+  towrite[5]= Y1 ;
+  towrite[6]= X2 >> 8 ;
+  towrite[7]= X2 ;
+  towrite[8]= Y2 >> 8 ;
+  towrite[9]= Y2 ;
+  WriteBytes(towrite, 10) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_Cls()
+{
+  char  towrite[2] ;
+  towrite[0]= F_gfx_Cls >> 8 ;
+  towrite[1]= F_gfx_Cls ;
+  WriteBytes(towrite, 2);
+  GetAck();
+}
+
+uint16_t uLCD_4D_Picaso::gfx_Contrast(uint16_t  Contrast)
+{
+  char  towrite[4] ;
+  towrite[0]= F_gfx_Contrast >> 8 ;
+  towrite[1]= F_gfx_Contrast ;
+  towrite[2]= Contrast >> 8 ;
+  towrite[3]= Contrast ;
+  WriteBytes(towrite, 4) ;
+  return GetAckResp() ;
+}
+
+void uLCD_4D_Picaso::gfx_Ellipse(uint16_t  X, uint16_t  Y, uint16_t  Xrad, uint16_t  Yrad, Picaso::Color Color)
+{
+  char  towrite[12] ;
+  towrite[0]= F_gfx_Ellipse >> 8 ;
+  towrite[1]= F_gfx_Ellipse ;
+  towrite[2]= X >> 8 ;
+  towrite[3]= X ;
+  towrite[4]= Y >> 8 ;
+  towrite[5]= Y ;
+  towrite[6]= Xrad >> 8 ;
+  towrite[7]= Xrad ;
+  towrite[8]= Yrad >> 8 ;
+  towrite[9]= Yrad ;
+  towrite[10]= Color >> 8 ;
+  towrite[11]= Color ;
+  WriteBytes(towrite, 12) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_EllipseFilled(uint16_t  X, uint16_t  Y, uint16_t  Xrad, uint16_t  Yrad, Picaso::Color Color)
+{
+  char  towrite[12] ;
+  towrite[0]= F_gfx_EllipseFilled >> 8 ;
+  towrite[1]= F_gfx_EllipseFilled ;
+  towrite[2]= X >> 8 ;
+  towrite[3]= X ;
+  towrite[4]= Y >> 8 ;
+  towrite[5]= Y ;
+  towrite[6]= Xrad >> 8 ;
+  towrite[7]= Xrad ;
+  towrite[8]= Yrad >> 8 ;
+  towrite[9]= Yrad ;
+  towrite[10]= Color >> 8 ;
+  towrite[11]= Color ;
+  WriteBytes(towrite, 12) ;
+  GetAck() ;
+}
+
+uint16_t uLCD_4D_Picaso::gfx_FrameDelay(uint16_t  Msec)
+{
+  char  towrite[4] ;
+  towrite[0]= F_gfx_FrameDelay >> 8 ;
+  towrite[1]= F_gfx_FrameDelay ;
+  towrite[2]= Msec >> 8 ;
+  towrite[3]= Msec ;
+  WriteBytes(towrite, 4) ;
+  return GetAckResp() ;
+}
+
+uint16_t uLCD_4D_Picaso::gfx_Get(Picaso::GFXGetMode  Mode)
+{
+  char  towrite[4] ;
+  towrite[0]= F_gfx_Get >> 8 ;
+  towrite[1]= F_gfx_Get ;
+  towrite[2]= Mode >> 8 ;
+  towrite[3]= Mode ;
+  WriteBytes(towrite, 4) ;
+  return GetAckResp() ;
+}
+
+Picaso::Color uLCD_4D_Picaso::gfx_GetPixel(uint16_t  X, uint16_t  Y)
+{
+  char  towrite[6] ;
+  towrite[0]= F_gfx_GetPixel >> 8 ;
+  towrite[1]= F_gfx_GetPixel ;
+  towrite[2]= X >> 8 ;
+  towrite[3]= X ;
+  towrite[4]= Y >> 8 ;
+  towrite[5]= Y ;
+  WriteBytes(towrite, 6) ;
+  return (Picaso::Color) GetAckResp() ;
+}
+
+void uLCD_4D_Picaso::gfx_Line(uint16_t  X1, uint16_t  Y1, uint16_t  X2, uint16_t  Y2, Picaso::Color Color)
+{
+  char  towrite[12] ;
+  towrite[0]= F_gfx_Line >> 8 ;
+  towrite[1]= F_gfx_Line ;
+  towrite[2]= X1 >> 8 ;
+  towrite[3]= X1 ;
+  towrite[4]= Y1 >> 8 ;
+  towrite[5]= Y1 ;
+  towrite[6]= X2 >> 8 ;
+  towrite[7]= X2 ;
+  towrite[8]= Y2 >> 8 ;
+  towrite[9]= Y2 ;
+  towrite[10]= Color >> 8 ;
+  towrite[11]= Color ;
+  WriteBytes(towrite, 12) ;
+  GetAck() ;
+}
+
+uint16_t uLCD_4D_Picaso::gfx_LinePattern(uint16_t  Pattern)
+{
+  char  towrite[4] ;
+  towrite[0]= F_gfx_LinePattern >> 8 ;
+  towrite[1]= F_gfx_LinePattern ;
+  towrite[2]= Pattern >> 8 ;
+  towrite[3]= Pattern ;
+  WriteBytes(towrite, 4) ;
+  return GetAckResp() ;
+}
+
+void uLCD_4D_Picaso::gfx_LineTo(uint16_t  X, uint16_t  Y)
+{
+  char  towrite[6] ;
+  towrite[0]= F_gfx_LineTo >> 8 ;
+  towrite[1]= F_gfx_LineTo ;
+  towrite[2]= X >> 8 ;
+  towrite[3]= X ;
+  towrite[4]= Y >> 8 ;
+  towrite[5]= Y ;
+  WriteBytes(towrite, 6) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_MoveTo(uint16_t  X, uint16_t  Y)
+{
+  char  towrite[6] ;
+  towrite[0]= F_gfx_MoveTo >> 8 ;
+  towrite[1]= F_gfx_MoveTo ;
+  towrite[2]= X >> 8 ;
+  towrite[3]= X ;
+  towrite[4]= Y >> 8 ;
+  towrite[5]= Y ;
+  WriteBytes(towrite, 6) ;
+  GetAck() ;
+}
+
+uint16_t uLCD_4D_Picaso::gfx_Orbit(uint16_t  Angle, uint16_t  Distance, uint16_t *  Xdest, uint16_t *  Ydest)
+{
+  char  towrite[6] ;
+  towrite[0]= F_gfx_Orbit >> 8 ;
+  towrite[1]= F_gfx_Orbit ;
+  towrite[2]= Angle >> 8 ;
+  towrite[3]= Angle ;
+  towrite[4]= Distance >> 8 ;
+  towrite[5]= Distance ;
+  WriteBytes(towrite, 6) ;
+  GetAck2Words(Xdest,Ydest) ;
+  return 0 ;
+}
+
+Picaso::Color uLCD_4D_Picaso::gfx_OutlineColour(Picaso::Color Color) {
+  char  towrite[4] ;
+  towrite[0]= F_gfx_OutlineColour >> 8 ;
+  towrite[1]= F_gfx_OutlineColour ;
+  towrite[2]= Color >> 8 ;
+  towrite[3]= Color ;
+  WriteBytes(towrite, 4) ;
+  return (Picaso::Color) GetAckResp() ;
+}
+
+void uLCD_4D_Picaso::gfx_Panel(Picaso::PanelState Raised, uint16_t  X, uint16_t  Y, uint16_t  Width, uint16_t  Height, Picaso::Color Color)
+{
+  char  towrite[14] ;
+  towrite[0]= F_gfx_Panel >> 8 ;
+  towrite[1]= F_gfx_Panel ;
+  towrite[2]= Raised >> 8 ;
+  towrite[3]= Raised ;
+  towrite[4]= X >> 8 ;
+  towrite[5]= X ;
+  towrite[6]= Y >> 8 ;
+  towrite[7]= Y ;
+  towrite[8]= Width >> 8 ;
+  towrite[9]= Width ;
+  towrite[10]= Height >> 8 ;
+  towrite[11]= Height ;
+  towrite[12]= Color >> 8 ;
+  towrite[13]= Color ;
+  WriteBytes(towrite, 14) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_Polygon(uint16_t  n, uint16_t*  Xvalues, uint16_t*  Yvalues, Picaso::Color Color)
+{
+  char  towrite[4] ;
+  towrite[0]= F_gfx_Polygon >> 8 ;
+  towrite[1]= F_gfx_Polygon ;
+  towrite[2]= n >> 8 ;
+  towrite[3]= n ;
+  WriteBytes(towrite, 4) ;
+  WriteWords(Xvalues, n) ;
+  WriteWords(Yvalues, n) ;
+  towrite[0]= Color >> 8 ;
+  towrite[1]= Color ;
+  WriteBytes(towrite, 2) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_PolygonFilled(uint16_t  n, uint16_t*  Xvalues, uint16_t*  Yvalues, Picaso::Color Color)
+{
+  char  towrite[4] ;
+  towrite[0]= F_gfx_PolygonFilled >> 8 ;
+  towrite[1]= F_gfx_PolygonFilled ;
+  towrite[2]= n >> 8 ;
+  towrite[3]= n ;
+  WriteBytes(towrite, 4) ;
+  WriteWords(Xvalues, n) ;
+  WriteWords(Yvalues, n) ;
+  towrite[0]= Color >> 8 ;
+  towrite[1]= Color ;
+  WriteBytes(towrite, 2) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_Polyline(uint16_t  n, uint16_t*  Xvalues, uint16_t*  Yvalues, Picaso::Color Color)
+{
+  char  towrite[4] ;
+  towrite[0]= F_gfx_Polyline >> 8 ;
+  towrite[1]= F_gfx_Polyline ;
+  towrite[2]= n >> 8 ;
+  towrite[3]= n ;
+  WriteBytes(towrite, 4) ;
+  WriteWords(Xvalues, n) ;
+  WriteWords(Yvalues, n) ;
+  towrite[0]= Color >> 8 ;
+  towrite[1]= Color ;
+  WriteBytes(towrite, 2) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_PutPixel(uint16_t  X, uint16_t  Y, Picaso::Color Color)
+{
+  char  towrite[8] ;
+  towrite[0]= F_gfx_PutPixel >> 8 ;
+  towrite[1]= F_gfx_PutPixel ;
+  towrite[2]= X >> 8 ;
+  towrite[3]= X ;
+  towrite[4]= Y >> 8 ;
+  towrite[5]= Y ;
+  towrite[6]= Color >> 8 ;
+  towrite[7]= Color ;
+  WriteBytes(towrite, 8) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_Rectangle(uint16_t  X1, uint16_t  Y1, uint16_t  X2, uint16_t  Y2, Picaso::Color Color)
+{
+  char  towrite[12] ;
+  towrite[0]= F_gfx_Rectangle >> 8 ;
+  towrite[1]= F_gfx_Rectangle ;
+  towrite[2]= X1 >> 8 ;
+  towrite[3]= X1 ;
+  towrite[4]= Y1 >> 8 ;
+  towrite[5]= Y1 ;
+  towrite[6]= X2 >> 8 ;
+  towrite[7]= X2 ;
+  towrite[8]= Y2 >> 8 ;
+  towrite[9]= Y2 ;
+  towrite[10]= Color >> 8 ;
+  towrite[11]= Color ;
+  WriteBytes(towrite, 12) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_RectangleFilled(uint16_t  X1, uint16_t  Y1, uint16_t  X2, uint16_t  Y2, Picaso::Color Color)
+{
+  char  towrite[12] ;
+  towrite[0]= F_gfx_RectangleFilled >> 8 ;
+  towrite[1]= F_gfx_RectangleFilled ;
+  towrite[2]= X1 >> 8 ;
+  towrite[3]= X1 ;
+  towrite[4]= Y1 >> 8 ;
+  towrite[5]= Y1 ;
+  towrite[6]= X2 >> 8 ;
+  towrite[7]= X2 ;
+  towrite[8]= Y2 >> 8 ;
+  towrite[9]= Y2 ;
+  towrite[10]= Color >> 8 ;
+  towrite[11]= Color ;
+  WriteBytes(towrite, 12) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_ScreenCopyPaste(uint16_t  Xs, uint16_t  Ys, uint16_t  Xd, uint16_t  Yd, uint16_t  Width, uint16_t  Height)
+{
+  char  towrite[14] ;
+  towrite[0]= F_gfx_ScreenCopyPaste >> 8 ;
+  towrite[1]= F_gfx_ScreenCopyPaste ;
+  towrite[2]= Xs >> 8 ;
+  towrite[3]= Xs ;
+  towrite[4]= Ys >> 8 ;
+  towrite[5]= Ys ;
+  towrite[6]= Xd >> 8 ;
+  towrite[7]= Xd ;
+  towrite[8]= Yd >> 8 ;
+  towrite[9]= Yd ;
+  towrite[10]= Width >> 8 ;
+  towrite[11]= Width ;
+  towrite[12]= Height >> 8 ;
+  towrite[13]= Height ;
+  WriteBytes(towrite, 14) ;
+  GetAck() ;
+}
+
+Picaso::ScreenMode uLCD_4D_Picaso::gfx_ScreenMode(Picaso::ScreenMode ScreenMode)
+{
+  char  towrite[4] ;
+
+  towrite[0]= F_gfx_ScreenMode >> 8 ;
+  towrite[1]= F_gfx_ScreenMode ;
+  towrite[2]= ScreenMode >> 8 ;
+  towrite[3]= ScreenMode ;
+  WriteBytes(towrite, 4) ;
+  return (Picaso::ScreenMode) GetAckResp() ;
+}
+
+void uLCD_4D_Picaso::gfx_Set(Picaso::GFXSetFunc Func, uint16_t  Value)
+{
+  char  towrite[6] ;
+
+  towrite[0]= F_gfx_Set >> 8 ;
+  towrite[1]= F_gfx_Set ;
+  towrite[2]= Func >> 8 ;
+  towrite[3]= Func ;
+  towrite[4]= Value >> 8 ;
+  towrite[5]= Value ;
+  WriteBytes(towrite, 6) ;
+  GetAck() ;
+}
+
+void uLCD_4D_Picaso::gfx_SetClipRegion()
+{
+  char  towrite[2] ;
+
+  towrite[0]= F_gfx_SetClipRegion >> 8 ;
+  towrite[1]= F_gfx_SetClipRegion ;
+  WriteBytes(towrite, 2) ;
+  GetAck() ;
+}
+
+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)
+{
+  char  towrite[18] ;
+
+  towrite[0]= F_gfx_Slider >> 8 ;
+  towrite[1]= F_gfx_Slider ;
+  towrite[2]= Mode >> 8 ;
+  towrite[3]= Mode ;
+  towrite[4]= X1 >> 8 ;
+  towrite[5]= X1 ;
+  towrite[6]= Y1 >> 8 ;
+  towrite[7]= Y1 ;
+  towrite[8]= X2 >> 8 ;
+  towrite[9]= X2 ;
+  towrite[10]= Y2 >> 8 ;
+  towrite[11]= Y2 ;
+  towrite[12]= Color >> 8 ;
+  towrite[13]= Color ;
+  towrite[14]= Scale >> 8 ;
+  towrite[15]= Scale ;
+  towrite[16]= Value >> 8 ;
+  towrite[17]= Value ;
+  WriteBytes(towrite, 18) ;
+  return GetAckResp() ;
+}
+
+uint16_t uLCD_4D_Picaso::gfx_Transparency(uint16_t  OnOff)
+{
+  char  towrite[4] ;
+
+  towrite[0]= F_gfx_Transparency >> 8 ;
+  towrite[1]= F_gfx_Transparency ;
+  towrite[2]= OnOff >> 8 ;
+  towrite[3]= OnOff ;
+  WriteBytes(towrite, 4) ;
+  return GetAckResp() ;
+}
+
+Picaso::Color uLCD_4D_Picaso::gfx_TransparentColour(Picaso::Color Color)
+{
+  char  towrite[4] ;
+
+  towrite[0]= F_gfx_TransparentColour >> 8 ;
+  towrite[1]= F_gfx_TransparentColour ;
+  towrite[2]= Color >> 8 ;
+  towrite[3]= Color ;
+  WriteBytes(towrite, 4) ;
+  return (Picaso::Color) GetAckResp() ;
+}
+
+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)
+{
+  char  towrite[16] ;
+
+  towrite[0]= F_gfx_Triangle >> 8 ;
+  towrite[1]= F_gfx_Triangle ;
+  towrite[2]= X1 >> 8 ;
+  towrite[3]= X1 ;
+  towrite[4]= Y1 >> 8 ;
+  towrite[5]= Y1 ;
+  towrite[6]= X2 >> 8 ;
+  towrite[7]= X2 ;
+  towrite[8]= Y2 >> 8 ;
+  towrite[9]= Y2 ;
+  towrite[10]= X3 >> 8 ;
+  towrite[11]= X3 ;
+  towrite[12]= Y3 >> 8 ;
+  towrite[13]= Y3 ;
+  towrite[14]= Color >> 8 ;
+  towrite[15]= Color ;
+  WriteBytes(towrite, 16) ;
+  GetAck() ;
+}
+
+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)
+{
+  char  towrite[16] ;
+  towrite[0]= F_gfx_TriangleFilled >> 8 ;
+  towrite[1]= F_gfx_TriangleFilled ;
+  towrite[2]= X1 >> 8 ;
+  towrite[3]= X1 ;
+  towrite[4]= Y1 >> 8 ;
+  towrite[5]= Y1 ;
+  towrite[6]= X2 >> 8 ;
+  towrite[7]= X2 ;
+  towrite[8]= Y2 >> 8 ;
+  towrite[9]= Y2 ;
+  towrite[10]= X3 >> 8 ;
+  towrite[11]= X3 ;
+  towrite[12]= Y3 >> 8 ;
+  towrite[13]= Y3 ;
+  towrite[14]= Color >> 8 ;
+  towrite[15]= Color ;
+  WriteBytes(towrite, 16) ;
+  GetAck() ;
+}