Library to control serial LCDs from 4D systems based on their Goldelox processor. Ported from Adruino library but not fully tested.
This library facilitates serial communication with LCDs from 4D Systems based on their Goldelox processor. It was ported form an Arduino library published by 4D systems.
Documentation on the API can be found at: http://www.4dsystems.com.au/product/1/4/4D_Intelligent_Display_Modules/uLCD_144_G2/
Goldelox_Serial_4DLib.h@0:6987c004e123, 2013-10-05 (annotated)
- Committer:
- Sailing_Nut
- Date:
- Sat Oct 05 02:40:39 2013 +0000
- Revision:
- 0:6987c004e123
Initial version of 4D Systems Goldelox LCD library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sailing_Nut | 0:6987c004e123 | 1 | /* |
Sailing_Nut | 0:6987c004e123 | 2 | 4DSerial - Library for 4D Systems Serial Environment. |
Sailing_Nut | 0:6987c004e123 | 3 | Released into the public domain. |
Sailing_Nut | 0:6987c004e123 | 4 | */ |
Sailing_Nut | 0:6987c004e123 | 5 | |
Sailing_Nut | 0:6987c004e123 | 6 | #ifndef Goldelox_Serial_4DLib_h |
Sailing_Nut | 0:6987c004e123 | 7 | #define Goldelox_Serial_4DLib_h |
Sailing_Nut | 0:6987c004e123 | 8 | |
Sailing_Nut | 0:6987c004e123 | 9 | #include "mbed.h" |
Sailing_Nut | 0:6987c004e123 | 10 | |
Sailing_Nut | 0:6987c004e123 | 11 | #define Err4D_OK 0 |
Sailing_Nut | 0:6987c004e123 | 12 | #define Err4D_Timeout 1 |
Sailing_Nut | 0:6987c004e123 | 13 | #define Err4D_NAK 2 // other than ACK received |
Sailing_Nut | 0:6987c004e123 | 14 | |
Sailing_Nut | 0:6987c004e123 | 15 | #include "Goldelox_Types4D.h" // Defines for 4dgl constants, generated by conversion of 4DGL constants to target language |
Sailing_Nut | 0:6987c004e123 | 16 | #include "Goldelox_Const4DSerial.h" // Defines for 4dgl constants, generated by conversion of 4DGL constants to target language |
Sailing_Nut | 0:6987c004e123 | 17 | #include "Goldelox_Const4D.h" // Defines for 4dgl constants, generated by conversion of 4DGL constants to target language |
Sailing_Nut | 0:6987c004e123 | 18 | |
Sailing_Nut | 0:6987c004e123 | 19 | typedef void (*Tcallback4D)(int, unsigned char); |
Sailing_Nut | 0:6987c004e123 | 20 | |
Sailing_Nut | 0:6987c004e123 | 21 | class Goldelox_Serial_4DLib |
Sailing_Nut | 0:6987c004e123 | 22 | { |
Sailing_Nut | 0:6987c004e123 | 23 | public: |
Sailing_Nut | 0:6987c004e123 | 24 | Goldelox_Serial_4DLib(Serial * virtualPort); |
Sailing_Nut | 0:6987c004e123 | 25 | Tcallback4D Callback4D ; |
Sailing_Nut | 0:6987c004e123 | 26 | |
Sailing_Nut | 0:6987c004e123 | 27 | //Compound 4D Routines |
Sailing_Nut | 0:6987c004e123 | 28 | void blitComtoDisplay(short X, short Y, short Width, short Height, t4DByteArray Pixels) ; |
Sailing_Nut | 0:6987c004e123 | 29 | void gfx_BGcolour(short Color) ; |
Sailing_Nut | 0:6987c004e123 | 30 | void gfx_ChangeColour(short OldColor, short NewColor) ; |
Sailing_Nut | 0:6987c004e123 | 31 | void gfx_Circle(short X, short Y, short Radius, short Color) ; |
Sailing_Nut | 0:6987c004e123 | 32 | void gfx_CircleFilled(short X, short Y, short Radius, short Color) ; |
Sailing_Nut | 0:6987c004e123 | 33 | void gfx_Clipping(short OnOff) ; |
Sailing_Nut | 0:6987c004e123 | 34 | void gfx_ClipWindow(short X1, short Y1, short X2, short Y2) ; |
Sailing_Nut | 0:6987c004e123 | 35 | void gfx_Cls(void) ; |
Sailing_Nut | 0:6987c004e123 | 36 | void gfx_Contrast(short Contrast) ; |
Sailing_Nut | 0:6987c004e123 | 37 | void gfx_FrameDelay(short Msec) ; |
Sailing_Nut | 0:6987c004e123 | 38 | void gfx_Line(short X1, short Y1, short X2, short Y2, short Color) ; |
Sailing_Nut | 0:6987c004e123 | 39 | void gfx_LinePattern(short Pattern) ; |
Sailing_Nut | 0:6987c004e123 | 40 | void gfx_LineTo(short X, short Y) ; |
Sailing_Nut | 0:6987c004e123 | 41 | void gfx_MoveTo(short X, short Y) ; |
Sailing_Nut | 0:6987c004e123 | 42 | void gfx_OutlineColour(short Color) ; |
Sailing_Nut | 0:6987c004e123 | 43 | void gfx_Polygon(short n, t4DWordArray Xvalues, t4DWordArray Yvalues, short Color) ; |
Sailing_Nut | 0:6987c004e123 | 44 | void gfx_Polyline(short n, t4DWordArray Xvalues, t4DWordArray Yvalues, short Color) ; |
Sailing_Nut | 0:6987c004e123 | 45 | void gfx_PutPixel(short X, short Y, short Color) ; |
Sailing_Nut | 0:6987c004e123 | 46 | void gfx_Rectangle(short X1, short Y1, short X2, short Y2, short Color) ; |
Sailing_Nut | 0:6987c004e123 | 47 | void gfx_RectangleFilled(short X1, short Y1, short X2, short Y2, short Color) ; |
Sailing_Nut | 0:6987c004e123 | 48 | void gfx_ScreenMode(short ScreenMode) ; |
Sailing_Nut | 0:6987c004e123 | 49 | void gfx_Set(short Func, short Value) ; |
Sailing_Nut | 0:6987c004e123 | 50 | void gfx_Transparency(short OnOff) ; |
Sailing_Nut | 0:6987c004e123 | 51 | void gfx_TransparentColour(short Color) ; |
Sailing_Nut | 0:6987c004e123 | 52 | void gfx_Triangle(short X1, short Y1, short X2, short Y2, short X3, short Y3, short Color) ; |
Sailing_Nut | 0:6987c004e123 | 53 | void media_Image(short X, short Y) ; |
Sailing_Nut | 0:6987c004e123 | 54 | void media_SetAdd(short Hiword, short Loword) ; |
Sailing_Nut | 0:6987c004e123 | 55 | void media_SetSector(short Hiword, short Loword) ; |
Sailing_Nut | 0:6987c004e123 | 56 | void media_Video(short X, short Y) ; |
Sailing_Nut | 0:6987c004e123 | 57 | void media_VideoFrame(short X, short Y, short Framenumber) ; |
Sailing_Nut | 0:6987c004e123 | 58 | void pokeB(short Address, short ByteValue) ; |
Sailing_Nut | 0:6987c004e123 | 59 | void pokeW(short Address, short wordValue) ; |
Sailing_Nut | 0:6987c004e123 | 60 | void putCH(short wordChar) ; |
Sailing_Nut | 0:6987c004e123 | 61 | void setbaudWait(short Newrate) ; |
Sailing_Nut | 0:6987c004e123 | 62 | void SSMode(short Parm) ; |
Sailing_Nut | 0:6987c004e123 | 63 | void SSSpeed(short Speed) ; |
Sailing_Nut | 0:6987c004e123 | 64 | void SSTimeout(short Seconds) ; |
Sailing_Nut | 0:6987c004e123 | 65 | void txt_Attributes(short Attribs) ; |
Sailing_Nut | 0:6987c004e123 | 66 | void txt_BGcolour(short Color) ; |
Sailing_Nut | 0:6987c004e123 | 67 | void txt_Bold(short Bold) ; |
Sailing_Nut | 0:6987c004e123 | 68 | void txt_FGcolour(short Color) ; |
Sailing_Nut | 0:6987c004e123 | 69 | void txt_FontID(short FontNumber) ; |
Sailing_Nut | 0:6987c004e123 | 70 | void txt_Height(short Multiplier) ; |
Sailing_Nut | 0:6987c004e123 | 71 | void txt_Inverse(short Inverse) ; |
Sailing_Nut | 0:6987c004e123 | 72 | void txt_Italic(short Italic) ; |
Sailing_Nut | 0:6987c004e123 | 73 | void txt_MoveCursor(short Line, short Column) ; |
Sailing_Nut | 0:6987c004e123 | 74 | void txt_Opacity(short TransparentOpaque) ; |
Sailing_Nut | 0:6987c004e123 | 75 | void txt_Set(short Func, short Value) ; |
Sailing_Nut | 0:6987c004e123 | 76 | void txt_Underline(short Underline) ; |
Sailing_Nut | 0:6987c004e123 | 77 | void txt_Width(short Multiplier) ; |
Sailing_Nut | 0:6987c004e123 | 78 | void txt_Xgap(short Pixels) ; |
Sailing_Nut | 0:6987c004e123 | 79 | void txt_Ygap(short Pixels) ; |
Sailing_Nut | 0:6987c004e123 | 80 | void BeeP(short Note, short Duration) ; |
Sailing_Nut | 0:6987c004e123 | 81 | short charheight(char TestChar) ; |
Sailing_Nut | 0:6987c004e123 | 82 | short charwidth(char TestChar) ; |
Sailing_Nut | 0:6987c004e123 | 83 | short gfx_GetPixel(short X, short Y) ; |
Sailing_Nut | 0:6987c004e123 | 84 | short gfx_Orbit(short Angle, short Distance, short * Xdest, short * Ydest) ; |
Sailing_Nut | 0:6987c004e123 | 85 | void gfx_SetClipRegion(void) ; |
Sailing_Nut | 0:6987c004e123 | 86 | short joystick(void) ; |
Sailing_Nut | 0:6987c004e123 | 87 | short media_Flush(void) ; |
Sailing_Nut | 0:6987c004e123 | 88 | short media_Init(void) ; |
Sailing_Nut | 0:6987c004e123 | 89 | short media_ReadByte(void) ; |
Sailing_Nut | 0:6987c004e123 | 90 | short media_ReadWord(void) ; |
Sailing_Nut | 0:6987c004e123 | 91 | short media_WriteByte(short Byte) ; |
Sailing_Nut | 0:6987c004e123 | 92 | short media_WriteWord(short Word) ; |
Sailing_Nut | 0:6987c004e123 | 93 | short peekB(short Address) ; |
Sailing_Nut | 0:6987c004e123 | 94 | short peekW(short Address) ; |
Sailing_Nut | 0:6987c004e123 | 95 | void putstr(char * InString) ; |
Sailing_Nut | 0:6987c004e123 | 96 | short sys_GetModel(char * ModelStr) ; |
Sailing_Nut | 0:6987c004e123 | 97 | short sys_GetPmmC(void) ; |
Sailing_Nut | 0:6987c004e123 | 98 | short sys_GetVersion(void) ; |
Sailing_Nut | 0:6987c004e123 | 99 | |
Sailing_Nut | 0:6987c004e123 | 100 | void GetAck(void); |
Sailing_Nut | 0:6987c004e123 | 101 | |
Sailing_Nut | 0:6987c004e123 | 102 | //4D Global Variables Used |
Sailing_Nut | 0:6987c004e123 | 103 | int Error4D; // Error indicator, used and set by Intrinsic routines |
Sailing_Nut | 0:6987c004e123 | 104 | unsigned char Error4D_Inv; // Error byte returned from com port, onl set if error = Err_Invalid |
Sailing_Nut | 0:6987c004e123 | 105 | // int Error_Abort4D; // if true routines will abort when detecting an error |
Sailing_Nut | 0:6987c004e123 | 106 | unsigned long TimeLimit4D; // time limit in ms for total serial command duration, 2000 (2 seconds) should be adequate for most commands |
Sailing_Nut | 0:6987c004e123 | 107 | // assuming a reasonable baud rate AND low latency AND 0 for the Serial Delay Parameter |
Sailing_Nut | 0:6987c004e123 | 108 | // temporary increase might be required for very long (bitmap write, large image file opens) |
Sailing_Nut | 0:6987c004e123 | 109 | // or indeterminate (eg file_exec, file_run, file_callFunction) commands |
Sailing_Nut | 0:6987c004e123 | 110 | |
Sailing_Nut | 0:6987c004e123 | 111 | private: |
Sailing_Nut | 0:6987c004e123 | 112 | Serial * _virtualPort; |
Sailing_Nut | 0:6987c004e123 | 113 | |
Sailing_Nut | 0:6987c004e123 | 114 | //Intrinsic 4D Routines |
Sailing_Nut | 0:6987c004e123 | 115 | void WriteChars(char * charsout); |
Sailing_Nut | 0:6987c004e123 | 116 | void WriteBytes(char * Source, int Size); |
Sailing_Nut | 0:6987c004e123 | 117 | void WriteWords(short * Source, short Size); |
Sailing_Nut | 0:6987c004e123 | 118 | void getbytes(char * data, int size); |
Sailing_Nut | 0:6987c004e123 | 119 | short GetWord(void); |
Sailing_Nut | 0:6987c004e123 | 120 | void getString(char * outStr, int strLen); |
Sailing_Nut | 0:6987c004e123 | 121 | short GetAckResp(void); |
Sailing_Nut | 0:6987c004e123 | 122 | short GetAckRes2Words(short * word1, short * word2); |
Sailing_Nut | 0:6987c004e123 | 123 | void GetAck2Words(short * word1, short * word2); |
Sailing_Nut | 0:6987c004e123 | 124 | short GetAckResStr(char * OutStr); |
Sailing_Nut | 0:6987c004e123 | 125 | // short GetAckResData(t4DByteArray OutData, short size); |
Sailing_Nut | 0:6987c004e123 | 126 | void SetThisBaudrate(int Newrate); |
Sailing_Nut | 0:6987c004e123 | 127 | }; |
Sailing_Nut | 0:6987c004e123 | 128 | |
Sailing_Nut | 0:6987c004e123 | 129 | #endif |