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
Parent:
7:7754ce600ca6
Moved graphics command functions to separate file for clarity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
admcrae 0:e314f3b805ed 1 /**
admcrae 0:e314f3b805ed 2 * This is a class to drive 4D systems screens with Picaso graphics processors
admcrae 0:e314f3b805ed 3 *
admcrae 0:e314f3b805ed 4 * This is a port of the 4D systems Picaso Serial Linux Library
admcrae 0:e314f3b805ed 5 * Copyright (c) 2014 4D Systems PTY Ltd, Sydney, Australia
admcrae 0:e314f3b805ed 6 * From https://github.com/4dsystems/Picaso-Serial-Linux-Library, retrieved March 5, 2015
admcrae 0:e314f3b805ed 7 *
admcrae 0:e314f3b805ed 8 * All software in this library is provided without warranty; use at your own risk.
admcrae 0:e314f3b805ed 9 */
admcrae 0:e314f3b805ed 10
admcrae 0:e314f3b805ed 11 #include "mbed.h"
admcrae 0:e314f3b805ed 12 #include <string.h>
admcrae 0:e314f3b805ed 13 #include <math.h>
admcrae 0:e314f3b805ed 14 #include <ctype.h>
admcrae 0:e314f3b805ed 15
admcrae 2:ebe7029e2825 16 #include "Picaso_enums.h"
admcrae 0:e314f3b805ed 17 #include "uLCD_4D_Picaso.h"
admcrae 0:e314f3b805ed 18
admcrae 0:e314f3b805ed 19 //Error types
admcrae 0:e314f3b805ed 20 #define Err4D_OK 0
admcrae 0:e314f3b805ed 21 #define Err4D_Timeout 1
admcrae 0:e314f3b805ed 22 #define Err4D_NAK 2
admcrae 0:e314f3b805ed 23
admcrae 0:e314f3b805ed 24
admcrae 0:e314f3b805ed 25 //Default wait time (in ms) for Serial acknowledgement
admcrae 0:e314f3b805ed 26 #define RX_MAX_WAIT_DEFAULT 2000
admcrae 0:e314f3b805ed 27
admcrae 0:e314f3b805ed 28 #if LCD_USING_MODSERIAL
admcrae 0:e314f3b805ed 29 //Serial port buffer sizes
admcrae 0:e314f3b805ed 30 #define TX_BUF_SIZE 256
admcrae 0:e314f3b805ed 31 #define RX_BUF_SIZE 2048
admcrae 0:e314f3b805ed 32 #endif
admcrae 0:e314f3b805ed 33
admcrae 4:30010dda3b34 34
admcrae 4:30010dda3b34 35
admcrae 0:e314f3b805ed 36 /*
admcrae 0:e314f3b805ed 37 * Start of 4D Intrinsic Routines
admcrae 0:e314f3b805ed 38 */
admcrae 0:e314f3b805ed 39 uLCD_4D_Picaso::uLCD_4D_Picaso(PinName tx, PinName rx, PinName reset) :
admcrae 0:e314f3b805ed 40 #if LCD_USING_MODSERIAL
admcrae 0:e314f3b805ed 41 serial(tx, rx, TX_BUF_SIZE, RX_BUF_SIZE),
admcrae 0:e314f3b805ed 42 #else
admcrae 0:e314f3b805ed 43 serial(tx, rx),
admcrae 0:e314f3b805ed 44 #endif
admcrae 0:e314f3b805ed 45 rst(reset)
admcrae 0:e314f3b805ed 46 {
admcrae 0:e314f3b805ed 47 TimeLimit4D = RX_MAX_WAIT_DEFAULT;
admcrae 0:e314f3b805ed 48 serial.baud(9600);
admcrae 0:e314f3b805ed 49 LCD_reset();
admcrae 0:e314f3b805ed 50 gfx_Cls();
admcrae 0:e314f3b805ed 51 }
admcrae 0:e314f3b805ed 52
admcrae 0:e314f3b805ed 53 void uLCD_4D_Picaso::LCD_reset() {
admcrae 0:e314f3b805ed 54 rst = 0;
admcrae 0:e314f3b805ed 55 LCD_wait_ms(1);
admcrae 0:e314f3b805ed 56 rst = 1;
admcrae 0:e314f3b805ed 57 LCD_wait_ms(3000);
admcrae 0:e314f3b805ed 58 rxFlush();
admcrae 0:e314f3b805ed 59 }
admcrae 0:e314f3b805ed 60
admcrae 0:e314f3b805ed 61 void uLCD_4D_Picaso::LCD_wait_ms(int ms) {
admcrae 0:e314f3b805ed 62 timer.reset();
admcrae 0:e314f3b805ed 63 timer.start();
admcrae 0:e314f3b805ed 64 while (timer.read_ms() < ms);
admcrae 0:e314f3b805ed 65 timer.stop();
admcrae 0:e314f3b805ed 66 return;
admcrae 0:e314f3b805ed 67 }
admcrae 0:e314f3b805ed 68
admcrae 0:e314f3b805ed 69 void uLCD_4D_Picaso::rxFlush() {
admcrae 0:e314f3b805ed 70 while (serial.readable()) {
admcrae 0:e314f3b805ed 71 serial.getc();
admcrae 0:e314f3b805ed 72 }
admcrae 0:e314f3b805ed 73 }
admcrae 0:e314f3b805ed 74
admcrae 0:e314f3b805ed 75 void uLCD_4D_Picaso::WriteBytes(char *psOutput, int nCount) {
admcrae 0:e314f3b805ed 76 int i;
admcrae 0:e314f3b805ed 77 rxFlush();
admcrae 0:e314f3b805ed 78 for (i = 0; i < nCount; ++i) {
admcrae 0:e314f3b805ed 79 while (!serial.writeable());
admcrae 0:e314f3b805ed 80 serial.putc(psOutput[i]);
admcrae 0:e314f3b805ed 81 }
admcrae 0:e314f3b805ed 82 }
admcrae 0:e314f3b805ed 83
admcrae 0:e314f3b805ed 84 void uLCD_4D_Picaso::WriteChars(char *psOutput) {
admcrae 0:e314f3b805ed 85 // Include NULL in output
admcrae 0:e314f3b805ed 86 WriteBytes(psOutput, strlen((char *)psOutput) + 1);
admcrae 0:e314f3b805ed 87 return;
admcrae 0:e314f3b805ed 88 }
admcrae 0:e314f3b805ed 89
admcrae 2:ebe7029e2825 90 void uLCD_4D_Picaso::WriteWords(uint16_t * Source, int Size) {
admcrae 2:ebe7029e2825 91 uint16_t wk ;
admcrae 0:e314f3b805ed 92 int i ;
admcrae 0:e314f3b805ed 93 for (i = 0; i < Size; i++)
admcrae 0:e314f3b805ed 94 {
admcrae 0:e314f3b805ed 95 wk = *Source++ ;
admcrae 0:e314f3b805ed 96 wk = (wk >> 8) + (wk << 8) ;
admcrae 0:e314f3b805ed 97 WriteBytes((char *)&wk, 2);
admcrae 0:e314f3b805ed 98 }
admcrae 0:e314f3b805ed 99 }
admcrae 0:e314f3b805ed 100
admcrae 0:e314f3b805ed 101 // read string from the serial port
admcrae 0:e314f3b805ed 102 // return code:
admcrae 0:e314f3b805ed 103 // >= 0 = number of characters read
admcrae 0:e314f3b805ed 104 // -1 = read failed
admcrae 0:e314f3b805ed 105 int uLCD_4D_Picaso::ReadSerPort(char *psData, int iMax) {
admcrae 0:e314f3b805ed 106 int i;
admcrae 0:e314f3b805ed 107 Error4D = Err4D_OK;
admcrae 0:e314f3b805ed 108
admcrae 0:e314f3b805ed 109 timer.reset();
admcrae 0:e314f3b805ed 110 timer.start();
admcrae 0:e314f3b805ed 111
admcrae 0:e314f3b805ed 112 for (i = 0; i < iMax; ++i) {
admcrae 0:e314f3b805ed 113 while (!serial.readable()) {
admcrae 0:e314f3b805ed 114 if (timer.read_ms() >= TimeLimit4D) {
admcrae 0:e314f3b805ed 115 Error4D = Err4D_Timeout;
admcrae 0:e314f3b805ed 116 timer.stop();
admcrae 0:e314f3b805ed 117 return -1;
admcrae 0:e314f3b805ed 118 }
admcrae 0:e314f3b805ed 119 }
admcrae 0:e314f3b805ed 120 psData[i] = serial.getc();
admcrae 0:e314f3b805ed 121 }
admcrae 0:e314f3b805ed 122
admcrae 0:e314f3b805ed 123 timer.stop();
admcrae 0:e314f3b805ed 124 return iMax;
admcrae 0:e314f3b805ed 125 }
admcrae 0:e314f3b805ed 126
admcrae 0:e314f3b805ed 127 void uLCD_4D_Picaso::getbytes(char *data, int size) {
admcrae 0:e314f3b805ed 128 int readc;
admcrae 0:e314f3b805ed 129 readc = ReadSerPort(data, size);
admcrae 0:e314f3b805ed 130 if (readc != size) {
admcrae 0:e314f3b805ed 131 printf("LCD serial: read timeout\r\n");
admcrae 0:e314f3b805ed 132 }
admcrae 0:e314f3b805ed 133 }
admcrae 0:e314f3b805ed 134
admcrae 0:e314f3b805ed 135 void uLCD_4D_Picaso::GetAck(void) {
admcrae 0:e314f3b805ed 136 char readx;
admcrae 0:e314f3b805ed 137 getbytes(&readx, 1);
admcrae 0:e314f3b805ed 138
admcrae 0:e314f3b805ed 139 if (readx != 6) {
admcrae 0:e314f3b805ed 140 Error4D = Err4D_NAK;
admcrae 0:e314f3b805ed 141 printf("LCD serial: no ACK received\r\n");
admcrae 0:e314f3b805ed 142 }
admcrae 0:e314f3b805ed 143 return;
admcrae 0:e314f3b805ed 144 }
admcrae 0:e314f3b805ed 145
admcrae 0:e314f3b805ed 146
admcrae 2:ebe7029e2825 147 uint16_t uLCD_4D_Picaso::GetWord(void) {
admcrae 0:e314f3b805ed 148 char readx[2];
admcrae 0:e314f3b805ed 149 getbytes(readx, 2);
admcrae 0:e314f3b805ed 150 return readx[0] << 8 | readx[1];
admcrae 0:e314f3b805ed 151 }
admcrae 0:e314f3b805ed 152
admcrae 0:e314f3b805ed 153 void uLCD_4D_Picaso::getString(char *outStr, int strLen) {
admcrae 0:e314f3b805ed 154 getbytes(outStr, strLen);
admcrae 0:e314f3b805ed 155
admcrae 0:e314f3b805ed 156 // Append EOS
admcrae 0:e314f3b805ed 157 outStr[strLen] = '\0';
admcrae 0:e314f3b805ed 158
admcrae 0:e314f3b805ed 159 return;
admcrae 0:e314f3b805ed 160 }
admcrae 0:e314f3b805ed 161
admcrae 2:ebe7029e2825 162 uint16_t uLCD_4D_Picaso::GetAckResp(void) {
admcrae 0:e314f3b805ed 163 GetAck();
admcrae 0:e314f3b805ed 164 return GetWord();
admcrae 0:e314f3b805ed 165 }
admcrae 0:e314f3b805ed 166
admcrae 2:ebe7029e2825 167 uint16_t uLCD_4D_Picaso::WaitForAck(void) {
admcrae 0:e314f3b805ed 168 int saveTimeout = TimeLimit4D;
admcrae 0:e314f3b805ed 169
admcrae 0:e314f3b805ed 170 // check once per minute
admcrae 0:e314f3b805ed 171 TimeLimit4D = 60 * 1000;
admcrae 0:e314f3b805ed 172 do {
admcrae 0:e314f3b805ed 173 GetAck();
admcrae 0:e314f3b805ed 174 } while (Error4D != Err4D_OK);
admcrae 0:e314f3b805ed 175
admcrae 0:e314f3b805ed 176 // Restore callback/timeout saves
admcrae 0:e314f3b805ed 177 TimeLimit4D = saveTimeout;
admcrae 0:e314f3b805ed 178
admcrae 0:e314f3b805ed 179 return GetWord();
admcrae 0:e314f3b805ed 180 }
admcrae 0:e314f3b805ed 181
admcrae 2:ebe7029e2825 182 uint16_t uLCD_4D_Picaso::GetAckRes2Words(uint16_t * word1, uint16_t * word2) {
admcrae 0:e314f3b805ed 183 int Result;
admcrae 0:e314f3b805ed 184 GetAck();
admcrae 0:e314f3b805ed 185 Result = GetWord();
admcrae 0:e314f3b805ed 186 *word1 = GetWord();
admcrae 0:e314f3b805ed 187 *word2 = GetWord();
admcrae 0:e314f3b805ed 188 return Result;
admcrae 0:e314f3b805ed 189 }
admcrae 0:e314f3b805ed 190
admcrae 2:ebe7029e2825 191 void uLCD_4D_Picaso::GetAck2Words(uint16_t * word1, uint16_t * word2) {
admcrae 0:e314f3b805ed 192 GetAck();
admcrae 0:e314f3b805ed 193 *word1 = GetWord();
admcrae 0:e314f3b805ed 194 *word2 = GetWord();
admcrae 0:e314f3b805ed 195 }
admcrae 0:e314f3b805ed 196
admcrae 2:ebe7029e2825 197 uint16_t uLCD_4D_Picaso::GetAckResSector(char* Sector) {
admcrae 0:e314f3b805ed 198 int Result;
admcrae 0:e314f3b805ed 199 GetAck();
admcrae 0:e314f3b805ed 200 Result = GetWord();
admcrae 0:e314f3b805ed 201 getbytes(Sector, 512);
admcrae 0:e314f3b805ed 202 return Result;
admcrae 0:e314f3b805ed 203 }
admcrae 0:e314f3b805ed 204
admcrae 2:ebe7029e2825 205 uint16_t uLCD_4D_Picaso::GetAckResStr(char * OutStr) {
admcrae 0:e314f3b805ed 206 int Result;
admcrae 0:e314f3b805ed 207 GetAck();
admcrae 0:e314f3b805ed 208 Result = GetWord();
admcrae 0:e314f3b805ed 209 getString(OutStr, Result);
admcrae 0:e314f3b805ed 210 return Result;
admcrae 0:e314f3b805ed 211 }
admcrae 0:e314f3b805ed 212
admcrae 2:ebe7029e2825 213 uint16_t uLCD_4D_Picaso::GetAckResData(char* OutData, uint16_t size) {
admcrae 0:e314f3b805ed 214 int Result;
admcrae 0:e314f3b805ed 215 GetAck();
admcrae 0:e314f3b805ed 216 Result = GetWord();
admcrae 0:e314f3b805ed 217 getbytes(OutData, size);
admcrae 0:e314f3b805ed 218 return Result;
admcrae 0:e314f3b805ed 219 }
admcrae 0:e314f3b805ed 220
admcrae 0:e314f3b805ed 221
admcrae 2:ebe7029e2825 222 void uLCD_4D_Picaso::SetThisBaudrate(Picaso::BaudRate Newrate) {
admcrae 0:e314f3b805ed 223 int nBaud;
admcrae 0:e314f3b805ed 224
admcrae 0:e314f3b805ed 225 switch (Newrate) {
admcrae 2:ebe7029e2825 226 case Picaso::BAUD_110: nBaud = 110; break;
admcrae 2:ebe7029e2825 227 case Picaso::BAUD_300: nBaud = 300; break;
admcrae 2:ebe7029e2825 228 case Picaso::BAUD_600: nBaud = 600; break;
admcrae 2:ebe7029e2825 229 case Picaso::BAUD_1200: nBaud = 1200; break;
admcrae 2:ebe7029e2825 230 case Picaso::BAUD_2400: nBaud = 2400; break;
admcrae 2:ebe7029e2825 231 case Picaso::BAUD_4800: nBaud = 4800; break;
admcrae 2:ebe7029e2825 232 case Picaso::BAUD_9600: nBaud = 9600; break;
admcrae 2:ebe7029e2825 233 case Picaso::BAUD_14400: nBaud = 14400; break;
admcrae 2:ebe7029e2825 234 case Picaso::BAUD_19200: nBaud = 19200; break;
admcrae 2:ebe7029e2825 235 case Picaso::BAUD_31250: nBaud = 31250; break;
admcrae 2:ebe7029e2825 236 case Picaso::BAUD_38400: nBaud = 38400; break;
admcrae 2:ebe7029e2825 237 case Picaso::BAUD_56000: nBaud = 56000; break;
admcrae 2:ebe7029e2825 238 case Picaso::BAUD_57600: nBaud = 57600; break;
admcrae 2:ebe7029e2825 239 case Picaso::BAUD_115200: nBaud = 115200; break;
admcrae 2:ebe7029e2825 240 case Picaso::BAUD_128000: nBaud = 133929; break;
admcrae 2:ebe7029e2825 241 case Picaso::BAUD_256000: nBaud = 281250; break;
admcrae 2:ebe7029e2825 242 case Picaso::BAUD_300000: nBaud = 312500; break;
admcrae 2:ebe7029e2825 243 case Picaso::BAUD_375000: nBaud = 401786; break;
admcrae 2:ebe7029e2825 244 case Picaso::BAUD_500000: nBaud = 562500; break;
admcrae 2:ebe7029e2825 245 case Picaso::BAUD_600000: nBaud = 703125; break;
admcrae 0:e314f3b805ed 246
admcrae 0:e314f3b805ed 247 default:
admcrae 0:e314f3b805ed 248 nBaud = 9600 ;
admcrae 0:e314f3b805ed 249 }
admcrae 0:e314f3b805ed 250
admcrae 0:e314f3b805ed 251 //Need to wait for the previous command to get out before setting new baud rate.
admcrae 0:e314f3b805ed 252 //10 ms seems to work for 9600, 40 ms for 2400
admcrae 0:e314f3b805ed 253 //Even using MODSERIAL's txIsBusy() doesn't seem to replace the need for this
admcrae 0:e314f3b805ed 254 LCD_wait_ms(40);
admcrae 0:e314f3b805ed 255 serial.baud(nBaud);
admcrae 0:e314f3b805ed 256
admcrae 0:e314f3b805ed 257 //Wait 100ms, as specified in serial command manual
admcrae 0:e314f3b805ed 258 LCD_wait_ms(100);
admcrae 0:e314f3b805ed 259
admcrae 0:e314f3b805ed 260 return;
admcrae 0:e314f3b805ed 261 }
admcrae 0:e314f3b805ed 262
admcrae 0:e314f3b805ed 263 /*
admcrae 0:e314f3b805ed 264 * End Of Intrinsic 4DRoutines here
admcrae 0:e314f3b805ed 265 */
admcrae 0:e314f3b805ed 266
admcrae 0:e314f3b805ed 267 /*
admcrae 0:e314f3b805ed 268 * Starts of 4D Compound Routines
admcrae 0:e314f3b805ed 269 */
admcrae 0:e314f3b805ed 270
admcrae 2:ebe7029e2825 271 uint16_t uLCD_4D_Picaso::bus_In()
admcrae 0:e314f3b805ed 272 {
admcrae 0:e314f3b805ed 273 char towrite[2] ;
admcrae 0:e314f3b805ed 274
admcrae 0:e314f3b805ed 275 towrite[0]= F_bus_In >> 8 ;
admcrae 0:e314f3b805ed 276 towrite[1]= F_bus_In ;
admcrae 0:e314f3b805ed 277 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 278 return GetAckResp() ;
admcrae 0:e314f3b805ed 279 }
admcrae 0:e314f3b805ed 280
admcrae 2:ebe7029e2825 281 void uLCD_4D_Picaso::bus_Out(uint16_t Bits)
admcrae 0:e314f3b805ed 282 {
admcrae 0:e314f3b805ed 283 char towrite[4] ;
admcrae 0:e314f3b805ed 284
admcrae 0:e314f3b805ed 285 towrite[0]= F_bus_Out >> 8 ;
admcrae 0:e314f3b805ed 286 towrite[1]= F_bus_Out ;
admcrae 0:e314f3b805ed 287 towrite[2]= Bits >> 8 ;
admcrae 0:e314f3b805ed 288 towrite[3]= Bits ;
admcrae 0:e314f3b805ed 289 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 290 GetAck() ;
admcrae 0:e314f3b805ed 291 }
admcrae 0:e314f3b805ed 292
admcrae 2:ebe7029e2825 293 uint16_t uLCD_4D_Picaso::bus_Read()
admcrae 0:e314f3b805ed 294 {
admcrae 0:e314f3b805ed 295 char towrite[2] ;
admcrae 0:e314f3b805ed 296
admcrae 0:e314f3b805ed 297 towrite[0]= F_bus_Read >> 8 ;
admcrae 0:e314f3b805ed 298 towrite[1]= F_bus_Read ;
admcrae 0:e314f3b805ed 299 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 300 return GetAckResp() ;
admcrae 0:e314f3b805ed 301 }
admcrae 0:e314f3b805ed 302
admcrae 2:ebe7029e2825 303 void uLCD_4D_Picaso::bus_Set(uint16_t IOMap)
admcrae 0:e314f3b805ed 304 {
admcrae 0:e314f3b805ed 305 char towrite[4] ;
admcrae 0:e314f3b805ed 306
admcrae 0:e314f3b805ed 307 towrite[0]= F_bus_Set >> 8 ;
admcrae 0:e314f3b805ed 308 towrite[1]= F_bus_Set ;
admcrae 0:e314f3b805ed 309 towrite[2]= IOMap >> 8 ;
admcrae 0:e314f3b805ed 310 towrite[3]= IOMap ;
admcrae 0:e314f3b805ed 311 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 312 GetAck() ;
admcrae 0:e314f3b805ed 313 }
admcrae 0:e314f3b805ed 314
admcrae 2:ebe7029e2825 315 void uLCD_4D_Picaso::bus_Write(uint16_t Bits)
admcrae 0:e314f3b805ed 316 {
admcrae 0:e314f3b805ed 317 char towrite[4] ;
admcrae 0:e314f3b805ed 318
admcrae 0:e314f3b805ed 319 towrite[0]= F_bus_Write >> 8 ;
admcrae 0:e314f3b805ed 320 towrite[1]= F_bus_Write ;
admcrae 0:e314f3b805ed 321 towrite[2]= Bits >> 8 ;
admcrae 0:e314f3b805ed 322 towrite[3]= Bits ;
admcrae 0:e314f3b805ed 323 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 324 GetAck() ;
admcrae 0:e314f3b805ed 325 }
admcrae 0:e314f3b805ed 326
admcrae 2:ebe7029e2825 327 uint16_t uLCD_4D_Picaso::charheight(char TestChar)
admcrae 0:e314f3b805ed 328 {
admcrae 0:e314f3b805ed 329 char towrite[3] ;
admcrae 0:e314f3b805ed 330
admcrae 0:e314f3b805ed 331 towrite[0]= F_charheight >> 8 ;
admcrae 0:e314f3b805ed 332 towrite[1]= F_charheight ;
admcrae 0:e314f3b805ed 333 towrite[2]= TestChar;
admcrae 0:e314f3b805ed 334 WriteBytes(towrite, 3) ;
admcrae 0:e314f3b805ed 335 return GetAckResp() ;
admcrae 0:e314f3b805ed 336 }
admcrae 0:e314f3b805ed 337
admcrae 2:ebe7029e2825 338 uint16_t uLCD_4D_Picaso::charwidth(char TestChar)
admcrae 0:e314f3b805ed 339 {
admcrae 0:e314f3b805ed 340 char towrite[3] ;
admcrae 0:e314f3b805ed 341
admcrae 0:e314f3b805ed 342 towrite[0]= F_charwidth >> 8 ;
admcrae 0:e314f3b805ed 343 towrite[1]= F_charwidth ;
admcrae 0:e314f3b805ed 344 towrite[2]= TestChar;
admcrae 0:e314f3b805ed 345 WriteBytes(towrite, 3) ;
admcrae 0:e314f3b805ed 346 return GetAckResp() ;
admcrae 0:e314f3b805ed 347 }
admcrae 0:e314f3b805ed 348
admcrae 2:ebe7029e2825 349 uint16_t uLCD_4D_Picaso::file_Close(uint16_t Handle)
admcrae 0:e314f3b805ed 350 {
admcrae 0:e314f3b805ed 351 char towrite[4] ;
admcrae 0:e314f3b805ed 352
admcrae 0:e314f3b805ed 353 towrite[0]= F_file_Close >> 8 ;
admcrae 0:e314f3b805ed 354 towrite[1]= F_file_Close & 0xFF;
admcrae 0:e314f3b805ed 355 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 356 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 357 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 358 return GetAckResp() ;
admcrae 0:e314f3b805ed 359 }
admcrae 0:e314f3b805ed 360
admcrae 2:ebe7029e2825 361 uint16_t uLCD_4D_Picaso::file_Count(char* Filename)
admcrae 0:e314f3b805ed 362 {
admcrae 0:e314f3b805ed 363 char towrite[2] ;
admcrae 0:e314f3b805ed 364
admcrae 0:e314f3b805ed 365 towrite[0]= F_file_Count >> 8 ;
admcrae 0:e314f3b805ed 366 towrite[1]= F_file_Count ;
admcrae 0:e314f3b805ed 367 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 368 WriteChars(Filename) ;
admcrae 0:e314f3b805ed 369 return GetAckResp() ;
admcrae 0:e314f3b805ed 370 }
admcrae 0:e314f3b805ed 371
admcrae 2:ebe7029e2825 372 uint16_t uLCD_4D_Picaso::file_Dir(char* Filename)
admcrae 0:e314f3b805ed 373 {
admcrae 0:e314f3b805ed 374 char towrite[2] ;
admcrae 0:e314f3b805ed 375
admcrae 0:e314f3b805ed 376 towrite[0]= F_file_Dir >> 8 ;
admcrae 0:e314f3b805ed 377 towrite[1]= F_file_Dir ;
admcrae 0:e314f3b805ed 378 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 379 WriteChars(Filename) ;
admcrae 0:e314f3b805ed 380 return GetAckResp() ;
admcrae 0:e314f3b805ed 381 }
admcrae 0:e314f3b805ed 382
admcrae 2:ebe7029e2825 383 uint16_t uLCD_4D_Picaso::file_Erase(char* Filename)
admcrae 0:e314f3b805ed 384 {
admcrae 0:e314f3b805ed 385 char towrite[2] ;
admcrae 0:e314f3b805ed 386
admcrae 0:e314f3b805ed 387 towrite[0]= F_file_Erase >> 8 ;
admcrae 0:e314f3b805ed 388 towrite[1]= F_file_Erase & 0xFF;
admcrae 0:e314f3b805ed 389 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 390 WriteChars(Filename) ;
admcrae 0:e314f3b805ed 391 return GetAckResp() ;
admcrae 0:e314f3b805ed 392 }
admcrae 0:e314f3b805ed 393
admcrae 2:ebe7029e2825 394 Picaso::FileError uLCD_4D_Picaso::file_Error()
admcrae 0:e314f3b805ed 395 {
admcrae 0:e314f3b805ed 396 char towrite[2] ;
admcrae 0:e314f3b805ed 397
admcrae 0:e314f3b805ed 398 towrite[0]= F_file_Error >> 8 ;
admcrae 0:e314f3b805ed 399 towrite[1]= F_file_Error & 0xFF;
admcrae 2:ebe7029e2825 400 WriteBytes(towrite, 2);
admcrae 2:ebe7029e2825 401 return (Picaso::FileError) GetAckResp();
admcrae 0:e314f3b805ed 402 }
admcrae 0:e314f3b805ed 403
admcrae 2:ebe7029e2825 404 uint16_t uLCD_4D_Picaso::file_Exec(char* Filename, uint16_t ArgCount, uint16_t* Args)
admcrae 0:e314f3b805ed 405 {
admcrae 0:e314f3b805ed 406 char towrite[2] ;
admcrae 0:e314f3b805ed 407
admcrae 0:e314f3b805ed 408 towrite[0]= F_file_Exec >> 8 ;
admcrae 0:e314f3b805ed 409 towrite[1]= F_file_Exec & 0xFF;
admcrae 0:e314f3b805ed 410 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 411 WriteChars(Filename) ;
admcrae 0:e314f3b805ed 412 towrite[0]= ArgCount >> 8 ;
admcrae 0:e314f3b805ed 413 towrite[1]= ArgCount ;
admcrae 0:e314f3b805ed 414 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 415 WriteWords(Args, ArgCount) ;
admcrae 0:e314f3b805ed 416 return WaitForAck() ;
admcrae 0:e314f3b805ed 417 }
admcrae 0:e314f3b805ed 418
admcrae 2:ebe7029e2825 419 uint16_t uLCD_4D_Picaso::file_Exists(char* Filename)
admcrae 0:e314f3b805ed 420 {
admcrae 0:e314f3b805ed 421 char towrite[2] ;
admcrae 0:e314f3b805ed 422
admcrae 0:e314f3b805ed 423 towrite[0]= F_file_Exists >> 8 ;
admcrae 0:e314f3b805ed 424 towrite[1]= F_file_Exists & 0xFF;
admcrae 0:e314f3b805ed 425 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 426 WriteChars(Filename) ;
admcrae 0:e314f3b805ed 427 return GetAckResp() ;
admcrae 0:e314f3b805ed 428 }
admcrae 0:e314f3b805ed 429
admcrae 2:ebe7029e2825 430 uint16_t uLCD_4D_Picaso::file_FindFirst(char* Filename)
admcrae 0:e314f3b805ed 431 {
admcrae 0:e314f3b805ed 432 char towrite[2] ;
admcrae 0:e314f3b805ed 433
admcrae 0:e314f3b805ed 434 towrite[0]= F_file_FindFirst >> 8 ;
admcrae 0:e314f3b805ed 435 towrite[1]= F_file_FindFirst & 0xFF;
admcrae 0:e314f3b805ed 436 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 437 WriteChars(Filename) ;
admcrae 0:e314f3b805ed 438 return GetAckResp() ;
admcrae 0:e314f3b805ed 439 }
admcrae 0:e314f3b805ed 440
admcrae 2:ebe7029e2825 441 uint16_t uLCD_4D_Picaso::file_FindNext()
admcrae 0:e314f3b805ed 442 {
admcrae 0:e314f3b805ed 443 char towrite[2] ;
admcrae 0:e314f3b805ed 444 towrite[0]= F_file_FindNext >> 8 ;
admcrae 0:e314f3b805ed 445 towrite[1]= F_file_FindNext & 0xFF;
admcrae 0:e314f3b805ed 446 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 447 return GetAckResp() ;
admcrae 0:e314f3b805ed 448 }
admcrae 0:e314f3b805ed 449
admcrae 2:ebe7029e2825 450 char uLCD_4D_Picaso::file_GetC(uint16_t Handle)
admcrae 0:e314f3b805ed 451 {
admcrae 0:e314f3b805ed 452 char towrite[4] ;
admcrae 0:e314f3b805ed 453 towrite[0]= F_file_GetC >> 8 ;
admcrae 0:e314f3b805ed 454 towrite[1]= F_file_GetC & 0xFF;
admcrae 0:e314f3b805ed 455 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 456 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 457 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 458 return GetAckResp() ;
admcrae 0:e314f3b805ed 459 }
admcrae 0:e314f3b805ed 460
admcrae 2:ebe7029e2825 461 uint16_t uLCD_4D_Picaso::file_GetS(char* StringIn, uint16_t Size, uint16_t Handle)
admcrae 0:e314f3b805ed 462 {
admcrae 0:e314f3b805ed 463 char towrite[6] ;
admcrae 0:e314f3b805ed 464 towrite[0]= F_file_GetS >> 8 ;
admcrae 0:e314f3b805ed 465 towrite[1]= F_file_GetS & 0xFF;
admcrae 0:e314f3b805ed 466 towrite[2]= Size >> 8 ;
admcrae 0:e314f3b805ed 467 towrite[3]= Size ;
admcrae 0:e314f3b805ed 468 towrite[4]= Handle >> 8 ;
admcrae 0:e314f3b805ed 469 towrite[5]= Handle ;
admcrae 0:e314f3b805ed 470 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 471 return GetAckResStr(StringIn) ;
admcrae 0:e314f3b805ed 472 }
admcrae 0:e314f3b805ed 473
admcrae 2:ebe7029e2825 474 uint16_t uLCD_4D_Picaso::file_GetW(uint16_t Handle)
admcrae 0:e314f3b805ed 475 {
admcrae 0:e314f3b805ed 476 char towrite[4] ;
admcrae 0:e314f3b805ed 477 towrite[0]= F_file_GetW >> 8 ;
admcrae 0:e314f3b805ed 478 towrite[1]= F_file_GetW & 0xFF;
admcrae 0:e314f3b805ed 479 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 480 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 481 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 482 return GetAckResp() ;
admcrae 0:e314f3b805ed 483 }
admcrae 0:e314f3b805ed 484
admcrae 2:ebe7029e2825 485 uint16_t uLCD_4D_Picaso::file_Image(uint16_t X, uint16_t Y, uint16_t Handle)
admcrae 0:e314f3b805ed 486 {
admcrae 0:e314f3b805ed 487 char towrite[8] ;
admcrae 0:e314f3b805ed 488 towrite[0]= F_file_Image >> 8 ;
admcrae 0:e314f3b805ed 489 towrite[1]= F_file_Image & 0xFF;
admcrae 0:e314f3b805ed 490 towrite[2]= X >> 8 ;
admcrae 0:e314f3b805ed 491 towrite[3]= X ;
admcrae 0:e314f3b805ed 492 towrite[4]= Y >> 8 ;
admcrae 0:e314f3b805ed 493 towrite[5]= Y ;
admcrae 0:e314f3b805ed 494 towrite[6]= Handle >> 8 ;
admcrae 0:e314f3b805ed 495 towrite[7]= Handle ;
admcrae 0:e314f3b805ed 496 WriteBytes(towrite, 8) ;
admcrae 0:e314f3b805ed 497 return GetAckResp() ;
admcrae 0:e314f3b805ed 498 }
admcrae 0:e314f3b805ed 499
admcrae 2:ebe7029e2825 500 uint16_t uLCD_4D_Picaso::file_Index(uint16_t Handle, uint16_t HiSize, uint16_t LoSize, uint16_t Recordnum)
admcrae 0:e314f3b805ed 501 {
admcrae 0:e314f3b805ed 502 char towrite[10] ;
admcrae 0:e314f3b805ed 503 towrite[0]= F_file_Index >> 8 ;
admcrae 0:e314f3b805ed 504 towrite[1]= F_file_Index & 0xFF;
admcrae 0:e314f3b805ed 505 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 506 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 507 towrite[4]= HiSize >> 8 ;
admcrae 0:e314f3b805ed 508 towrite[5]= HiSize ;
admcrae 0:e314f3b805ed 509 towrite[6]= LoSize >> 8 ;
admcrae 0:e314f3b805ed 510 towrite[7]= LoSize ;
admcrae 0:e314f3b805ed 511 towrite[8]= Recordnum >> 8 ;
admcrae 0:e314f3b805ed 512 towrite[9]= Recordnum ;
admcrae 0:e314f3b805ed 513 WriteBytes(towrite, 10) ;
admcrae 0:e314f3b805ed 514 return GetAckResp() ;
admcrae 0:e314f3b805ed 515 }
admcrae 0:e314f3b805ed 516
admcrae 2:ebe7029e2825 517 uint16_t uLCD_4D_Picaso::file_LoadFunction(char* Filename)
admcrae 0:e314f3b805ed 518 {
admcrae 0:e314f3b805ed 519 char towrite[2] ;
admcrae 0:e314f3b805ed 520 towrite[0]= F_file_LoadFunction >> 8 ;
admcrae 0:e314f3b805ed 521 towrite[1]= F_file_LoadFunction ;
admcrae 0:e314f3b805ed 522 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 523 WriteChars(Filename) ;
admcrae 0:e314f3b805ed 524 return GetAckResp() ;
admcrae 0:e314f3b805ed 525 }
admcrae 0:e314f3b805ed 526
admcrae 2:ebe7029e2825 527 uint16_t uLCD_4D_Picaso::file_LoadImageControl(char* Datname, char* GCIName, uint16_t Mode)
admcrae 0:e314f3b805ed 528 {
admcrae 0:e314f3b805ed 529 char towrite[2] ;
admcrae 0:e314f3b805ed 530 towrite[0]= F_file_LoadImageControl >> 8 ;
admcrae 0:e314f3b805ed 531 towrite[1]= F_file_LoadImageControl ;
admcrae 0:e314f3b805ed 532 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 533 WriteChars(Datname) ;
admcrae 0:e314f3b805ed 534 WriteChars(GCIName) ;
admcrae 0:e314f3b805ed 535 towrite[0]= Mode >> 8 ;
admcrae 0:e314f3b805ed 536 towrite[1]= Mode ;
admcrae 0:e314f3b805ed 537 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 538 return GetAckResp() ;
admcrae 0:e314f3b805ed 539 }
admcrae 0:e314f3b805ed 540
admcrae 2:ebe7029e2825 541 uint16_t uLCD_4D_Picaso::file_Mount()
admcrae 0:e314f3b805ed 542 {
admcrae 0:e314f3b805ed 543 char towrite[2] ;
admcrae 0:e314f3b805ed 544 towrite[0]= F_file_Mount >> 8 ;
admcrae 0:e314f3b805ed 545 towrite[1]= F_file_Mount & 0xFF;
admcrae 0:e314f3b805ed 546 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 547 return GetAckResp() ;
admcrae 0:e314f3b805ed 548 }
admcrae 0:e314f3b805ed 549
admcrae 2:ebe7029e2825 550 uint16_t uLCD_4D_Picaso::file_Open(char* Filename, char Mode)
admcrae 0:e314f3b805ed 551 {
admcrae 0:e314f3b805ed 552 char towrite[2] ;
admcrae 0:e314f3b805ed 553 towrite[0]= F_file_Open >> 8 ;
admcrae 0:e314f3b805ed 554 towrite[1]= F_file_Open & 0xFF;
admcrae 0:e314f3b805ed 555 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 556 WriteChars(Filename) ;
admcrae 0:e314f3b805ed 557 towrite[0]= Mode;
admcrae 0:e314f3b805ed 558 WriteBytes(towrite, 1) ;
admcrae 0:e314f3b805ed 559 return GetAckResp() ;
admcrae 0:e314f3b805ed 560 }
admcrae 0:e314f3b805ed 561
admcrae 2:ebe7029e2825 562 uint16_t uLCD_4D_Picaso::file_PlayWAV(char* Filename)
admcrae 0:e314f3b805ed 563 {
admcrae 0:e314f3b805ed 564 char towrite[2] ;
admcrae 0:e314f3b805ed 565 towrite[0]= F_file_PlayWAV >> 8 ;
admcrae 0:e314f3b805ed 566 towrite[1]= F_file_PlayWAV & 0xFF;
admcrae 0:e314f3b805ed 567 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 568 WriteChars(Filename) ;
admcrae 0:e314f3b805ed 569 return GetAckResp() ;
admcrae 0:e314f3b805ed 570 }
admcrae 0:e314f3b805ed 571
admcrae 2:ebe7029e2825 572 uint16_t uLCD_4D_Picaso::file_PutC(char Character, uint16_t Handle)
admcrae 0:e314f3b805ed 573 {
admcrae 0:e314f3b805ed 574 char towrite[5] ;
admcrae 0:e314f3b805ed 575 towrite[0]= F_file_PutC >> 8 ;
admcrae 0:e314f3b805ed 576 towrite[1]= F_file_PutC ;
admcrae 0:e314f3b805ed 577 towrite[2]= Character;
admcrae 0:e314f3b805ed 578 towrite[3]= Handle >> 8 ;
admcrae 0:e314f3b805ed 579 towrite[4]= Handle ;
admcrae 0:e314f3b805ed 580 WriteBytes(towrite, 5) ;
admcrae 0:e314f3b805ed 581 return GetAckResp() ;
admcrae 0:e314f3b805ed 582 }
admcrae 0:e314f3b805ed 583
admcrae 2:ebe7029e2825 584 uint16_t uLCD_4D_Picaso::file_PutS(char * StringOut, uint16_t Handle)
admcrae 0:e314f3b805ed 585 {
admcrae 0:e314f3b805ed 586 char towrite[2] ;
admcrae 0:e314f3b805ed 587 towrite[0]= F_file_PutS >> 8 ;
admcrae 0:e314f3b805ed 588 towrite[1]= F_file_PutS & 0xFF;
admcrae 0:e314f3b805ed 589 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 590 WriteChars(StringOut) ;
admcrae 0:e314f3b805ed 591 towrite[0]= Handle >> 8 ;
admcrae 0:e314f3b805ed 592 towrite[1]= Handle ;
admcrae 0:e314f3b805ed 593 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 594 return GetAckResp() ;
admcrae 0:e314f3b805ed 595 }
admcrae 0:e314f3b805ed 596
admcrae 2:ebe7029e2825 597 uint16_t uLCD_4D_Picaso::file_PutW(uint16_t Word, uint16_t Handle)
admcrae 0:e314f3b805ed 598 {
admcrae 0:e314f3b805ed 599 char towrite[6] ;
admcrae 0:e314f3b805ed 600 towrite[0]= F_file_PutW >> 8 ;
admcrae 0:e314f3b805ed 601 towrite[1]= F_file_PutW & 0xFF;
admcrae 0:e314f3b805ed 602 towrite[2]= Word >> 8 ;
admcrae 0:e314f3b805ed 603 towrite[3]= Word ;
admcrae 0:e314f3b805ed 604 towrite[4]= Handle >> 8 ;
admcrae 0:e314f3b805ed 605 towrite[5]= Handle ;
admcrae 0:e314f3b805ed 606 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 607 return GetAckResp() ;
admcrae 0:e314f3b805ed 608 }
admcrae 0:e314f3b805ed 609
admcrae 2:ebe7029e2825 610 uint16_t uLCD_4D_Picaso::file_Read(char* Data, uint16_t Size, uint16_t Handle)
admcrae 0:e314f3b805ed 611 {
admcrae 0:e314f3b805ed 612 char towrite[6] ;
admcrae 0:e314f3b805ed 613 towrite[0]= F_file_Read >> 8 ;
admcrae 0:e314f3b805ed 614 towrite[1]= F_file_Read & 0xFF;
admcrae 0:e314f3b805ed 615 towrite[2]= Size >> 8 ;
admcrae 0:e314f3b805ed 616 towrite[3]= Size ;
admcrae 0:e314f3b805ed 617 towrite[4]= Handle >> 8 ;
admcrae 0:e314f3b805ed 618 towrite[5]= Handle ;
admcrae 0:e314f3b805ed 619 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 620 return GetAckResData(Data,Size) ;
admcrae 0:e314f3b805ed 621 }
admcrae 0:e314f3b805ed 622
admcrae 2:ebe7029e2825 623 uint16_t uLCD_4D_Picaso::file_Rewind(uint16_t Handle)
admcrae 0:e314f3b805ed 624 {
admcrae 0:e314f3b805ed 625 char towrite[4] ;
admcrae 0:e314f3b805ed 626 towrite[0]= F_file_Rewind >> 8 ;
admcrae 0:e314f3b805ed 627 towrite[1]= F_file_Rewind & 0xFF;
admcrae 0:e314f3b805ed 628 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 629 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 630 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 631 return GetAckResp() ;
admcrae 0:e314f3b805ed 632 }
admcrae 0:e314f3b805ed 633
admcrae 2:ebe7029e2825 634 uint16_t uLCD_4D_Picaso::file_Run(char * Filename, uint16_t ArgCount, uint16_t* Args)
admcrae 0:e314f3b805ed 635 {
admcrae 0:e314f3b805ed 636 char towrite[2] ;
admcrae 0:e314f3b805ed 637 towrite[0]= F_file_Run >> 8 ;
admcrae 0:e314f3b805ed 638 towrite[1]= F_file_Run & 0xFF;
admcrae 0:e314f3b805ed 639 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 640 WriteChars(Filename) ;
admcrae 0:e314f3b805ed 641 towrite[0]= ArgCount >> 8 ;
admcrae 0:e314f3b805ed 642 towrite[1]= ArgCount ;
admcrae 0:e314f3b805ed 643 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 644 WriteWords(Args, ArgCount) ;
admcrae 0:e314f3b805ed 645 return WaitForAck() ;
admcrae 0:e314f3b805ed 646 }
admcrae 0:e314f3b805ed 647
admcrae 2:ebe7029e2825 648 uint16_t uLCD_4D_Picaso::file_ScreenCapture(uint16_t X, uint16_t Y, uint16_t Width, uint16_t Height, uint16_t Handle)
admcrae 0:e314f3b805ed 649 {
admcrae 0:e314f3b805ed 650 char towrite[12] ;
admcrae 0:e314f3b805ed 651 towrite[0]= F_file_ScreenCapture >> 8 ;
admcrae 0:e314f3b805ed 652 towrite[1]= F_file_ScreenCapture & 0xFF;
admcrae 0:e314f3b805ed 653 towrite[2]= X >> 8 ;
admcrae 0:e314f3b805ed 654 towrite[3]= X ;
admcrae 0:e314f3b805ed 655 towrite[4]= Y >> 8 ;
admcrae 0:e314f3b805ed 656 towrite[5]= Y ;
admcrae 0:e314f3b805ed 657 towrite[6]= Width >> 8 ;
admcrae 0:e314f3b805ed 658 towrite[7]= Width ;
admcrae 0:e314f3b805ed 659 towrite[8]= Height >> 8 ;
admcrae 0:e314f3b805ed 660 towrite[9]= Height ;
admcrae 0:e314f3b805ed 661 towrite[10]= Handle >> 8 ;
admcrae 0:e314f3b805ed 662 towrite[11]= Handle ;
admcrae 0:e314f3b805ed 663 WriteBytes(towrite, 12) ;
admcrae 0:e314f3b805ed 664 return GetAckResp() ;
admcrae 0:e314f3b805ed 665 }
admcrae 0:e314f3b805ed 666
admcrae 2:ebe7029e2825 667 uint16_t uLCD_4D_Picaso::file_Seek(uint16_t Handle, uint16_t HiWord, uint16_t LoWord)
admcrae 0:e314f3b805ed 668 {
admcrae 0:e314f3b805ed 669 char towrite[8] ;
admcrae 0:e314f3b805ed 670 towrite[0]= F_file_Seek >> 8 ;
admcrae 0:e314f3b805ed 671 towrite[1]= F_file_Seek & 0xFF;
admcrae 0:e314f3b805ed 672 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 673 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 674 towrite[4]= HiWord >> 8 ;
admcrae 0:e314f3b805ed 675 towrite[5]= HiWord ;
admcrae 0:e314f3b805ed 676 towrite[6]= LoWord >> 8 ;
admcrae 0:e314f3b805ed 677 towrite[7]= LoWord ;
admcrae 0:e314f3b805ed 678 WriteBytes(towrite, 8) ;
admcrae 0:e314f3b805ed 679 return GetAckResp() ;
admcrae 0:e314f3b805ed 680 }
admcrae 0:e314f3b805ed 681
admcrae 2:ebe7029e2825 682 uint16_t uLCD_4D_Picaso::file_Size(uint16_t Handle, uint16_t * HiWord, uint16_t * LoWord)
admcrae 0:e314f3b805ed 683 {
admcrae 0:e314f3b805ed 684 char towrite[4] ;
admcrae 0:e314f3b805ed 685 towrite[0]= F_file_Size >> 8 ;
admcrae 0:e314f3b805ed 686 towrite[1]= F_file_Size ;
admcrae 0:e314f3b805ed 687 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 688 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 689 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 690 return GetAckRes2Words(HiWord,LoWord) ;
admcrae 0:e314f3b805ed 691 }
admcrae 0:e314f3b805ed 692
admcrae 2:ebe7029e2825 693 uint16_t uLCD_4D_Picaso::file_Tell(uint16_t Handle, uint16_t * HiWord, uint16_t * LoWord)
admcrae 0:e314f3b805ed 694 {
admcrae 0:e314f3b805ed 695 char towrite[4] ;
admcrae 0:e314f3b805ed 696 towrite[0]= F_file_Tell >> 8 ;
admcrae 0:e314f3b805ed 697 towrite[1]= F_file_Tell ;
admcrae 0:e314f3b805ed 698 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 699 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 700 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 701 return GetAckRes2Words(HiWord,LoWord) ;
admcrae 0:e314f3b805ed 702 }
admcrae 0:e314f3b805ed 703
admcrae 0:e314f3b805ed 704 void uLCD_4D_Picaso::file_Unmount()
admcrae 0:e314f3b805ed 705 {
admcrae 0:e314f3b805ed 706 char towrite[2] ;
admcrae 0:e314f3b805ed 707
admcrae 0:e314f3b805ed 708 towrite[0]= F_file_Unmount >> 8 ;
admcrae 0:e314f3b805ed 709 towrite[1]= F_file_Unmount & 0xFF;
admcrae 0:e314f3b805ed 710 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 711 GetAck() ;
admcrae 0:e314f3b805ed 712 }
admcrae 0:e314f3b805ed 713
admcrae 2:ebe7029e2825 714 uint16_t uLCD_4D_Picaso::file_Write(uint16_t Size, char* Source, uint16_t Handle)
admcrae 0:e314f3b805ed 715 {
admcrae 0:e314f3b805ed 716 char towrite[4] ;
admcrae 0:e314f3b805ed 717 towrite[0]= F_file_Write >> 8 ;
admcrae 0:e314f3b805ed 718 towrite[1]= F_file_Write ;
admcrae 0:e314f3b805ed 719 towrite[2]= Size >> 8 ;
admcrae 0:e314f3b805ed 720 towrite[3]= Size ;
admcrae 0:e314f3b805ed 721 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 722 WriteBytes(Source, Size) ;
admcrae 0:e314f3b805ed 723 towrite[0]= Handle >> 8 ;
admcrae 0:e314f3b805ed 724 towrite[1]= Handle ;
admcrae 0:e314f3b805ed 725 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 726 return GetAckResp() ;
admcrae 0:e314f3b805ed 727 }
admcrae 0:e314f3b805ed 728
admcrae 2:ebe7029e2825 729 uint16_t uLCD_4D_Picaso::img_ClearAttributes(uint16_t Handle, uint16_t Index, Picaso::ImageAttribute Value)
admcrae 0:e314f3b805ed 730 {
admcrae 0:e314f3b805ed 731 char towrite[8] ;
admcrae 0:e314f3b805ed 732 towrite[0]= F_img_ClearAttributes >> 8 ;
admcrae 0:e314f3b805ed 733 towrite[1]= F_img_ClearAttributes & 0xFF;
admcrae 0:e314f3b805ed 734 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 735 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 736 towrite[4]= Index >> 8 ;
admcrae 0:e314f3b805ed 737 towrite[5]= Index ;
admcrae 0:e314f3b805ed 738 towrite[6]= Value >> 8 ;
admcrae 0:e314f3b805ed 739 towrite[7]= Value ;
admcrae 0:e314f3b805ed 740 WriteBytes(towrite, 8) ;
admcrae 0:e314f3b805ed 741 return GetAckResp() ;
admcrae 0:e314f3b805ed 742 }
admcrae 0:e314f3b805ed 743
admcrae 2:ebe7029e2825 744 uint16_t uLCD_4D_Picaso::img_Darken(uint16_t Handle, uint16_t Index)
admcrae 0:e314f3b805ed 745 {
admcrae 0:e314f3b805ed 746 char towrite[6] ;
admcrae 0:e314f3b805ed 747 towrite[0]= F_img_Darken >> 8 ;
admcrae 0:e314f3b805ed 748 towrite[1]= F_img_Darken & 0xFF;
admcrae 0:e314f3b805ed 749 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 750 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 751 towrite[4]= Index >> 8 ;
admcrae 0:e314f3b805ed 752 towrite[5]= Index ;
admcrae 0:e314f3b805ed 753 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 754 return GetAckResp() ;
admcrae 0:e314f3b805ed 755 }
admcrae 0:e314f3b805ed 756
admcrae 2:ebe7029e2825 757 uint16_t uLCD_4D_Picaso::img_Disable(uint16_t Handle, uint16_t Index)
admcrae 0:e314f3b805ed 758 {
admcrae 0:e314f3b805ed 759 char towrite[6] ;
admcrae 0:e314f3b805ed 760 towrite[0]= F_img_Disable >> 8 ;
admcrae 0:e314f3b805ed 761 towrite[1]= F_img_Disable & 0xFF;
admcrae 0:e314f3b805ed 762 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 763 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 764 towrite[4]= Index >> 8 ;
admcrae 0:e314f3b805ed 765 towrite[5]= Index ;
admcrae 0:e314f3b805ed 766 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 767 return GetAckResp() ;
admcrae 0:e314f3b805ed 768 }
admcrae 0:e314f3b805ed 769
admcrae 2:ebe7029e2825 770 uint16_t uLCD_4D_Picaso::img_Enable(uint16_t Handle, uint16_t Index)
admcrae 0:e314f3b805ed 771 {
admcrae 0:e314f3b805ed 772 char towrite[6] ;
admcrae 0:e314f3b805ed 773 towrite[0]= F_img_Enable >> 8 ;
admcrae 0:e314f3b805ed 774 towrite[1]= F_img_Enable & 0xFF;
admcrae 0:e314f3b805ed 775 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 776 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 777 towrite[4]= Index >> 8 ;
admcrae 0:e314f3b805ed 778 towrite[5]= Index ;
admcrae 0:e314f3b805ed 779 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 780 return GetAckResp() ;
admcrae 0:e314f3b805ed 781 }
admcrae 0:e314f3b805ed 782
admcrae 2:ebe7029e2825 783 uint16_t uLCD_4D_Picaso::img_GetWord(uint16_t Handle, uint16_t Index, Picaso::ImageControlOffset Offset )
admcrae 0:e314f3b805ed 784 {
admcrae 0:e314f3b805ed 785 char towrite[8] ;
admcrae 0:e314f3b805ed 786 towrite[0]= F_img_GetWord >> 8 ;
admcrae 0:e314f3b805ed 787 towrite[1]= F_img_GetWord & 0xFF;
admcrae 0:e314f3b805ed 788 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 789 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 790 towrite[4]= Index >> 8 ;
admcrae 0:e314f3b805ed 791 towrite[5]= Index ;
admcrae 0:e314f3b805ed 792 towrite[6]= Offset >> 8 ;
admcrae 0:e314f3b805ed 793 towrite[7]= Offset ;
admcrae 0:e314f3b805ed 794 WriteBytes(towrite, 8) ;
admcrae 0:e314f3b805ed 795 return GetAckResp() ;
admcrae 0:e314f3b805ed 796 }
admcrae 0:e314f3b805ed 797
admcrae 2:ebe7029e2825 798 uint16_t uLCD_4D_Picaso::img_Lighten(uint16_t Handle, uint16_t Index)
admcrae 0:e314f3b805ed 799 {
admcrae 0:e314f3b805ed 800 char towrite[6] ;
admcrae 0:e314f3b805ed 801 towrite[0]= F_img_Lighten >> 8 ;
admcrae 0:e314f3b805ed 802 towrite[1]= F_img_Lighten & 0xFF;
admcrae 0:e314f3b805ed 803 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 804 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 805 towrite[4]= Index >> 8 ;
admcrae 0:e314f3b805ed 806 towrite[5]= Index ;
admcrae 0:e314f3b805ed 807 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 808 return GetAckResp() ;
admcrae 0:e314f3b805ed 809 }
admcrae 0:e314f3b805ed 810
admcrae 2:ebe7029e2825 811 uint16_t uLCD_4D_Picaso::img_SetAttributes(uint16_t Handle, uint16_t Index, Picaso::ImageAttribute Value)
admcrae 0:e314f3b805ed 812 {
admcrae 0:e314f3b805ed 813 char towrite[8] ;
admcrae 0:e314f3b805ed 814
admcrae 0:e314f3b805ed 815 towrite[0]= F_img_SetAttributes >> 8 ;
admcrae 0:e314f3b805ed 816 towrite[1]= F_img_SetAttributes & 0xFF;
admcrae 0:e314f3b805ed 817 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 818 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 819 towrite[4]= Index >> 8 ;
admcrae 0:e314f3b805ed 820 towrite[5]= Index ;
admcrae 0:e314f3b805ed 821 towrite[6]= Value >> 8 ;
admcrae 0:e314f3b805ed 822 towrite[7]= Value ;
admcrae 0:e314f3b805ed 823 WriteBytes(towrite, 8) ;
admcrae 0:e314f3b805ed 824 return GetAckResp() ;
admcrae 0:e314f3b805ed 825 }
admcrae 0:e314f3b805ed 826
admcrae 2:ebe7029e2825 827 uint16_t uLCD_4D_Picaso::img_SetPosition(uint16_t Handle, uint16_t Index, uint16_t Xpos, uint16_t Ypos)
admcrae 0:e314f3b805ed 828 {
admcrae 0:e314f3b805ed 829 char towrite[10] ;
admcrae 0:e314f3b805ed 830
admcrae 0:e314f3b805ed 831 towrite[0]= F_img_SetPosition >> 8 ;
admcrae 0:e314f3b805ed 832 towrite[1]= F_img_SetPosition & 0xFF;
admcrae 0:e314f3b805ed 833 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 834 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 835 towrite[4]= Index >> 8 ;
admcrae 0:e314f3b805ed 836 towrite[5]= Index ;
admcrae 0:e314f3b805ed 837 towrite[6]= Xpos >> 8 ;
admcrae 0:e314f3b805ed 838 towrite[7]= Xpos ;
admcrae 0:e314f3b805ed 839 towrite[8]= Ypos >> 8 ;
admcrae 0:e314f3b805ed 840 towrite[9]= Ypos ;
admcrae 0:e314f3b805ed 841 WriteBytes(towrite, 10) ;
admcrae 0:e314f3b805ed 842 return GetAckResp() ;
admcrae 0:e314f3b805ed 843 }
admcrae 0:e314f3b805ed 844
admcrae 2:ebe7029e2825 845 uint16_t uLCD_4D_Picaso::img_SetWord(uint16_t Handle, uint16_t Index, Picaso::ImageControlOffset Offset , uint16_t Word)
admcrae 0:e314f3b805ed 846 {
admcrae 0:e314f3b805ed 847 char towrite[10] ;
admcrae 0:e314f3b805ed 848
admcrae 0:e314f3b805ed 849 towrite[0]= F_img_SetWord >> 8 ;
admcrae 0:e314f3b805ed 850 towrite[1]= F_img_SetWord & 0xFF;
admcrae 0:e314f3b805ed 851 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 852 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 853 towrite[4]= Index >> 8 ;
admcrae 0:e314f3b805ed 854 towrite[5]= Index ;
admcrae 0:e314f3b805ed 855 towrite[6]= Offset >> 8 ;
admcrae 0:e314f3b805ed 856 towrite[7]= Offset ;
admcrae 0:e314f3b805ed 857 towrite[8]= Word >> 8 ;
admcrae 0:e314f3b805ed 858 towrite[9]= Word ;
admcrae 0:e314f3b805ed 859 WriteBytes(towrite, 10) ;
admcrae 0:e314f3b805ed 860 return GetAckResp() ;
admcrae 0:e314f3b805ed 861 }
admcrae 0:e314f3b805ed 862
admcrae 2:ebe7029e2825 863 uint16_t uLCD_4D_Picaso::img_Show(uint16_t Handle, uint16_t Index)
admcrae 0:e314f3b805ed 864 {
admcrae 0:e314f3b805ed 865 char towrite[6] ;
admcrae 0:e314f3b805ed 866 towrite[0]= F_img_Show >> 8 ;
admcrae 0:e314f3b805ed 867 towrite[1]= F_img_Show & 0xFF;
admcrae 0:e314f3b805ed 868 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 869 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 870 towrite[4]= Index >> 8 ;
admcrae 0:e314f3b805ed 871 towrite[5]= Index ;
admcrae 0:e314f3b805ed 872 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 873 return GetAckResp() ;
admcrae 0:e314f3b805ed 874 }
admcrae 0:e314f3b805ed 875
admcrae 2:ebe7029e2825 876 uint16_t uLCD_4D_Picaso::img_Touched(uint16_t Handle, uint16_t Index)
admcrae 0:e314f3b805ed 877 {
admcrae 0:e314f3b805ed 878 char towrite[6] ;
admcrae 0:e314f3b805ed 879 towrite[0]= F_img_Touched >> 8 ;
admcrae 0:e314f3b805ed 880 towrite[1]= F_img_Touched & 0xFF;
admcrae 0:e314f3b805ed 881 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 882 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 883 towrite[4]= Index >> 8 ;
admcrae 0:e314f3b805ed 884 towrite[5]= Index ;
admcrae 0:e314f3b805ed 885 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 886 return GetAckResp() ;
admcrae 0:e314f3b805ed 887 }
admcrae 0:e314f3b805ed 888
admcrae 2:ebe7029e2825 889 uint16_t uLCD_4D_Picaso::media_Flush()
admcrae 0:e314f3b805ed 890 {
admcrae 0:e314f3b805ed 891 char towrite[2] ;
admcrae 0:e314f3b805ed 892 towrite[0]= F_media_Flush >> 8 ;
admcrae 0:e314f3b805ed 893 towrite[1]= F_media_Flush ;
admcrae 0:e314f3b805ed 894 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 895 return GetAckResp() ;
admcrae 0:e314f3b805ed 896 }
admcrae 0:e314f3b805ed 897
admcrae 2:ebe7029e2825 898 void uLCD_4D_Picaso::media_Image(uint16_t X, uint16_t Y)
admcrae 0:e314f3b805ed 899 {
admcrae 0:e314f3b805ed 900 char towrite[6] ;
admcrae 0:e314f3b805ed 901
admcrae 0:e314f3b805ed 902 towrite[0]= F_media_Image >> 8 ;
admcrae 0:e314f3b805ed 903 towrite[1]= F_media_Image ;
admcrae 0:e314f3b805ed 904 towrite[2]= X >> 8 ;
admcrae 0:e314f3b805ed 905 towrite[3]= X ;
admcrae 0:e314f3b805ed 906 towrite[4]= Y >> 8 ;
admcrae 0:e314f3b805ed 907 towrite[5]= Y ;
admcrae 0:e314f3b805ed 908 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 909 GetAck() ;
admcrae 0:e314f3b805ed 910 }
admcrae 0:e314f3b805ed 911
admcrae 2:ebe7029e2825 912 uint16_t uLCD_4D_Picaso::media_Init()
admcrae 0:e314f3b805ed 913 {
admcrae 0:e314f3b805ed 914 char towrite[2] ;
admcrae 0:e314f3b805ed 915
admcrae 0:e314f3b805ed 916 towrite[0]= F_media_Init >> 8 ;
admcrae 0:e314f3b805ed 917 towrite[1]= F_media_Init ;
admcrae 0:e314f3b805ed 918 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 919 return GetAckResp() ;
admcrae 0:e314f3b805ed 920 }
admcrae 0:e314f3b805ed 921
admcrae 2:ebe7029e2825 922 uint16_t uLCD_4D_Picaso::media_RdSector(char* SectorIn)
admcrae 0:e314f3b805ed 923 {
admcrae 0:e314f3b805ed 924 char towrite[2] ;
admcrae 0:e314f3b805ed 925
admcrae 0:e314f3b805ed 926 towrite[0]= F_media_RdSector >> 8 ;
admcrae 0:e314f3b805ed 927 towrite[1]= F_media_RdSector ;
admcrae 0:e314f3b805ed 928 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 929 return GetAckResSector(SectorIn) ;
admcrae 0:e314f3b805ed 930 }
admcrae 0:e314f3b805ed 931
admcrae 2:ebe7029e2825 932 uint16_t uLCD_4D_Picaso::media_ReadByte()
admcrae 0:e314f3b805ed 933 {
admcrae 0:e314f3b805ed 934 char towrite[2] ;
admcrae 0:e314f3b805ed 935 towrite[0]= F_media_ReadByte >> 8 ;
admcrae 0:e314f3b805ed 936 towrite[1]= F_media_ReadByte ;
admcrae 0:e314f3b805ed 937 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 938 return GetAckResp() ;
admcrae 0:e314f3b805ed 939 }
admcrae 0:e314f3b805ed 940
admcrae 2:ebe7029e2825 941 uint16_t uLCD_4D_Picaso::media_ReadWord()
admcrae 0:e314f3b805ed 942 {
admcrae 0:e314f3b805ed 943 char towrite[2] ;
admcrae 0:e314f3b805ed 944 towrite[0]= F_media_ReadWord >> 8 ;
admcrae 0:e314f3b805ed 945 towrite[1]= F_media_ReadWord ;
admcrae 0:e314f3b805ed 946 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 947 return GetAckResp() ;
admcrae 0:e314f3b805ed 948 }
admcrae 0:e314f3b805ed 949
admcrae 2:ebe7029e2825 950 void uLCD_4D_Picaso::media_SetAdd(uint16_t HiWord, uint16_t LoWord)
admcrae 0:e314f3b805ed 951 {
admcrae 0:e314f3b805ed 952 char towrite[6] ;
admcrae 0:e314f3b805ed 953
admcrae 0:e314f3b805ed 954 towrite[0]= F_media_SetAdd >> 8 ;
admcrae 0:e314f3b805ed 955 towrite[1]= F_media_SetAdd ;
admcrae 0:e314f3b805ed 956 towrite[2]= HiWord >> 8 ;
admcrae 0:e314f3b805ed 957 towrite[3]= HiWord ;
admcrae 0:e314f3b805ed 958 towrite[4]= LoWord >> 8 ;
admcrae 0:e314f3b805ed 959 towrite[5]= LoWord ;
admcrae 0:e314f3b805ed 960 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 961 GetAck() ;
admcrae 0:e314f3b805ed 962 }
admcrae 0:e314f3b805ed 963
admcrae 2:ebe7029e2825 964 void uLCD_4D_Picaso::media_SetSector(uint16_t HiWord, uint16_t LoWord)
admcrae 0:e314f3b805ed 965 {
admcrae 0:e314f3b805ed 966 char towrite[6] ;
admcrae 0:e314f3b805ed 967
admcrae 0:e314f3b805ed 968 towrite[0]= F_media_SetSector >> 8 ;
admcrae 0:e314f3b805ed 969 towrite[1]= F_media_SetSector ;
admcrae 0:e314f3b805ed 970 towrite[2]= HiWord >> 8 ;
admcrae 0:e314f3b805ed 971 towrite[3]= HiWord ;
admcrae 0:e314f3b805ed 972 towrite[4]= LoWord >> 8 ;
admcrae 0:e314f3b805ed 973 towrite[5]= LoWord ;
admcrae 0:e314f3b805ed 974 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 975 GetAck() ;
admcrae 0:e314f3b805ed 976 }
admcrae 0:e314f3b805ed 977
admcrae 2:ebe7029e2825 978 void uLCD_4D_Picaso::media_Video(uint16_t X, uint16_t Y)
admcrae 0:e314f3b805ed 979 {
admcrae 0:e314f3b805ed 980 char towrite[6] ;
admcrae 0:e314f3b805ed 981
admcrae 0:e314f3b805ed 982 towrite[0]= F_media_Video >> 8 ;
admcrae 0:e314f3b805ed 983 towrite[1]= F_media_Video ;
admcrae 0:e314f3b805ed 984 towrite[2]= X >> 8 ;
admcrae 0:e314f3b805ed 985 towrite[3]= X ;
admcrae 0:e314f3b805ed 986 towrite[4]= Y >> 8 ;
admcrae 0:e314f3b805ed 987 towrite[5]= Y ;
admcrae 0:e314f3b805ed 988 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 989 GetAck() ;
admcrae 0:e314f3b805ed 990 }
admcrae 0:e314f3b805ed 991
admcrae 2:ebe7029e2825 992 void uLCD_4D_Picaso::media_VideoFrame(uint16_t X, uint16_t Y, uint16_t Framenumber)
admcrae 0:e314f3b805ed 993 {
admcrae 0:e314f3b805ed 994 char towrite[8] ;
admcrae 0:e314f3b805ed 995
admcrae 0:e314f3b805ed 996 towrite[0]= F_media_VideoFrame >> 8 ;
admcrae 0:e314f3b805ed 997 towrite[1]= F_media_VideoFrame ;
admcrae 0:e314f3b805ed 998 towrite[2]= X >> 8 ;
admcrae 0:e314f3b805ed 999 towrite[3]= X ;
admcrae 0:e314f3b805ed 1000 towrite[4]= Y >> 8 ;
admcrae 0:e314f3b805ed 1001 towrite[5]= Y ;
admcrae 0:e314f3b805ed 1002 towrite[6]= Framenumber >> 8 ;
admcrae 0:e314f3b805ed 1003 towrite[7]= Framenumber ;
admcrae 0:e314f3b805ed 1004 WriteBytes(towrite, 8) ;
admcrae 0:e314f3b805ed 1005 GetAck() ;
admcrae 0:e314f3b805ed 1006 }
admcrae 0:e314f3b805ed 1007
admcrae 2:ebe7029e2825 1008 uint16_t uLCD_4D_Picaso::media_WriteByte(uint16_t Byte)
admcrae 0:e314f3b805ed 1009 {
admcrae 0:e314f3b805ed 1010 char towrite[4] ;
admcrae 0:e314f3b805ed 1011
admcrae 0:e314f3b805ed 1012 towrite[0]= F_media_WriteByte >> 8 ;
admcrae 0:e314f3b805ed 1013 towrite[1]= F_media_WriteByte ;
admcrae 0:e314f3b805ed 1014 towrite[2]= Byte >> 8 ;
admcrae 0:e314f3b805ed 1015 towrite[3]= Byte ;
admcrae 0:e314f3b805ed 1016 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1017 return GetAckResp() ;
admcrae 0:e314f3b805ed 1018 }
admcrae 0:e314f3b805ed 1019
admcrae 2:ebe7029e2825 1020 uint16_t uLCD_4D_Picaso::media_WriteWord(uint16_t Word)
admcrae 0:e314f3b805ed 1021 {
admcrae 0:e314f3b805ed 1022 char towrite[4] ;
admcrae 0:e314f3b805ed 1023
admcrae 0:e314f3b805ed 1024 towrite[0]= F_media_WriteWord >> 8 ;
admcrae 0:e314f3b805ed 1025 towrite[1]= F_media_WriteWord ;
admcrae 0:e314f3b805ed 1026 towrite[2]= Word >> 8 ;
admcrae 0:e314f3b805ed 1027 towrite[3]= Word ;
admcrae 0:e314f3b805ed 1028 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1029 return GetAckResp() ;
admcrae 0:e314f3b805ed 1030 }
admcrae 0:e314f3b805ed 1031
admcrae 2:ebe7029e2825 1032 uint16_t uLCD_4D_Picaso::media_WrSector(char* SectorOut)
admcrae 0:e314f3b805ed 1033 {
admcrae 0:e314f3b805ed 1034 char towrite[2] ;
admcrae 0:e314f3b805ed 1035
admcrae 0:e314f3b805ed 1036 towrite[0]= F_media_WrSector >> 8 ;
admcrae 0:e314f3b805ed 1037 towrite[1]= F_media_WrSector ;
admcrae 0:e314f3b805ed 1038 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 1039 WriteBytes(SectorOut, 512) ;
admcrae 0:e314f3b805ed 1040 return GetAckResp() ;
admcrae 0:e314f3b805ed 1041 }
admcrae 0:e314f3b805ed 1042
admcrae 2:ebe7029e2825 1043 uint16_t uLCD_4D_Picaso::mem_Free(uint16_t Handle)
admcrae 0:e314f3b805ed 1044 {
admcrae 0:e314f3b805ed 1045 char towrite[4] ;
admcrae 0:e314f3b805ed 1046
admcrae 0:e314f3b805ed 1047 towrite[0]= F_mem_Free >> 8 ;
admcrae 0:e314f3b805ed 1048 towrite[1]= F_mem_Free & 0xFF;
admcrae 0:e314f3b805ed 1049 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 1050 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 1051 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1052 return GetAckResp() ;
admcrae 0:e314f3b805ed 1053 }
admcrae 0:e314f3b805ed 1054
admcrae 2:ebe7029e2825 1055 uint16_t uLCD_4D_Picaso::mem_Heap()
admcrae 0:e314f3b805ed 1056 {
admcrae 0:e314f3b805ed 1057 char towrite[2] ;
admcrae 0:e314f3b805ed 1058
admcrae 0:e314f3b805ed 1059 towrite[0]= F_mem_Heap >> 8 ;
admcrae 0:e314f3b805ed 1060 towrite[1]= F_mem_Heap & 0xFF;
admcrae 0:e314f3b805ed 1061 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 1062 return GetAckResp() ;
admcrae 0:e314f3b805ed 1063 }
admcrae 0:e314f3b805ed 1064
admcrae 2:ebe7029e2825 1065 uint16_t uLCD_4D_Picaso::peekM(uint16_t Address)
admcrae 0:e314f3b805ed 1066 {
admcrae 0:e314f3b805ed 1067 char towrite[4] ;
admcrae 0:e314f3b805ed 1068
admcrae 0:e314f3b805ed 1069 towrite[0]= F_peekM >> 8 ;
admcrae 0:e314f3b805ed 1070 towrite[1]= F_peekM ;
admcrae 0:e314f3b805ed 1071 towrite[2]= Address >> 8 ;
admcrae 0:e314f3b805ed 1072 towrite[3]= Address ;
admcrae 0:e314f3b805ed 1073 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1074 return GetAckResp() ;
admcrae 0:e314f3b805ed 1075 }
admcrae 0:e314f3b805ed 1076
admcrae 2:ebe7029e2825 1077 uint16_t uLCD_4D_Picaso::pin_HI(Picaso::Pin Pin)
admcrae 0:e314f3b805ed 1078 {
admcrae 0:e314f3b805ed 1079 char towrite[4] ;
admcrae 0:e314f3b805ed 1080
admcrae 0:e314f3b805ed 1081 towrite[0]= F_pin_HI >> 8 ;
admcrae 0:e314f3b805ed 1082 towrite[1]= F_pin_HI ;
admcrae 0:e314f3b805ed 1083 towrite[2]= Pin >> 8 ;
admcrae 0:e314f3b805ed 1084 towrite[3]= Pin ;
admcrae 0:e314f3b805ed 1085 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1086 return GetAckResp() ;
admcrae 0:e314f3b805ed 1087 }
admcrae 0:e314f3b805ed 1088
admcrae 2:ebe7029e2825 1089 uint16_t uLCD_4D_Picaso::pin_LO(Picaso::Pin Pin)
admcrae 0:e314f3b805ed 1090 {
admcrae 0:e314f3b805ed 1091 char towrite[4] ;
admcrae 0:e314f3b805ed 1092
admcrae 0:e314f3b805ed 1093 towrite[0]= F_pin_LO >> 8 ;
admcrae 0:e314f3b805ed 1094 towrite[1]= F_pin_LO ;
admcrae 0:e314f3b805ed 1095 towrite[2]= Pin >> 8 ;
admcrae 0:e314f3b805ed 1096 towrite[3]= Pin ;
admcrae 0:e314f3b805ed 1097 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1098 return GetAckResp() ;
admcrae 0:e314f3b805ed 1099 }
admcrae 0:e314f3b805ed 1100
admcrae 2:ebe7029e2825 1101 uint16_t uLCD_4D_Picaso::pin_Read(Picaso::Pin Pin)
admcrae 0:e314f3b805ed 1102 {
admcrae 0:e314f3b805ed 1103 char towrite[4] ;
admcrae 0:e314f3b805ed 1104
admcrae 0:e314f3b805ed 1105 towrite[0]= F_pin_Read >> 8 ;
admcrae 0:e314f3b805ed 1106 towrite[1]= F_pin_Read ;
admcrae 0:e314f3b805ed 1107 towrite[2]= Pin >> 8 ;
admcrae 0:e314f3b805ed 1108 towrite[3]= Pin ;
admcrae 0:e314f3b805ed 1109 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1110 return GetAckResp() ;
admcrae 0:e314f3b805ed 1111 }
admcrae 0:e314f3b805ed 1112
admcrae 2:ebe7029e2825 1113 uint16_t uLCD_4D_Picaso::pin_Set(uint16_t Mode, Picaso::Pin Pin)
admcrae 0:e314f3b805ed 1114 {
admcrae 0:e314f3b805ed 1115 char towrite[6] ;
admcrae 0:e314f3b805ed 1116
admcrae 0:e314f3b805ed 1117 towrite[0]= F_pin_Set >> 8 ;
admcrae 0:e314f3b805ed 1118 towrite[1]= F_pin_Set ;
admcrae 0:e314f3b805ed 1119 towrite[2]= Mode >> 8 ;
admcrae 0:e314f3b805ed 1120 towrite[3]= Mode ;
admcrae 0:e314f3b805ed 1121 towrite[4]= Pin >> 8 ;
admcrae 0:e314f3b805ed 1122 towrite[5]= Pin ;
admcrae 0:e314f3b805ed 1123 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 1124 return GetAckResp() ;
admcrae 0:e314f3b805ed 1125 }
admcrae 0:e314f3b805ed 1126
admcrae 2:ebe7029e2825 1127 void uLCD_4D_Picaso::pokeM(uint16_t Address, uint16_t WordValue)
admcrae 0:e314f3b805ed 1128 {
admcrae 0:e314f3b805ed 1129 char towrite[6] ;
admcrae 0:e314f3b805ed 1130
admcrae 0:e314f3b805ed 1131 towrite[0]= F_pokeM >> 8 ;
admcrae 0:e314f3b805ed 1132 towrite[1]= F_pokeM ;
admcrae 0:e314f3b805ed 1133 towrite[2]= Address >> 8 ;
admcrae 0:e314f3b805ed 1134 towrite[3]= Address ;
admcrae 0:e314f3b805ed 1135 towrite[4]= WordValue >> 8 ;
admcrae 0:e314f3b805ed 1136 towrite[5]= WordValue ;
admcrae 0:e314f3b805ed 1137 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 1138 GetAck() ;
admcrae 0:e314f3b805ed 1139 }
admcrae 0:e314f3b805ed 1140
admcrae 2:ebe7029e2825 1141 void uLCD_4D_Picaso::putCH(uint16_t WordChar)
admcrae 0:e314f3b805ed 1142 {
admcrae 0:e314f3b805ed 1143 char towrite[4] ;
admcrae 0:e314f3b805ed 1144
admcrae 0:e314f3b805ed 1145 towrite[0]= F_putCH >> 8 ;
admcrae 0:e314f3b805ed 1146 towrite[1]= F_putCH ;
admcrae 0:e314f3b805ed 1147 towrite[2]= WordChar >> 8 ;
admcrae 0:e314f3b805ed 1148 towrite[3]= WordChar ;
admcrae 0:e314f3b805ed 1149 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1150 GetAck() ;
admcrae 0:e314f3b805ed 1151 }
admcrae 0:e314f3b805ed 1152
admcrae 2:ebe7029e2825 1153 uint16_t uLCD_4D_Picaso::putStr(char * InString)
admcrae 0:e314f3b805ed 1154 {
admcrae 0:e314f3b805ed 1155 char towrite[2] ;
admcrae 0:e314f3b805ed 1156
admcrae 0:e314f3b805ed 1157 towrite[0]= F_putstr >> 8 ;
admcrae 0:e314f3b805ed 1158 towrite[1]= F_putstr ;
admcrae 0:e314f3b805ed 1159 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 1160 WriteChars(InString) ;
admcrae 0:e314f3b805ed 1161 return GetAckResp() ;
admcrae 0:e314f3b805ed 1162 }
admcrae 0:e314f3b805ed 1163
admcrae 2:ebe7029e2825 1164 void uLCD_4D_Picaso::snd_BufSize(uint16_t Bufsize)
admcrae 0:e314f3b805ed 1165 {
admcrae 0:e314f3b805ed 1166 char towrite[4] ;
admcrae 0:e314f3b805ed 1167
admcrae 0:e314f3b805ed 1168 towrite[0]= F_snd_BufSize >> 8 ;
admcrae 0:e314f3b805ed 1169 towrite[1]= F_snd_BufSize & 0xFF;
admcrae 0:e314f3b805ed 1170 towrite[2]= Bufsize >> 8 ;
admcrae 0:e314f3b805ed 1171 towrite[3]= Bufsize ;
admcrae 0:e314f3b805ed 1172 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1173 GetAck() ;
admcrae 0:e314f3b805ed 1174 }
admcrae 0:e314f3b805ed 1175
admcrae 0:e314f3b805ed 1176 void uLCD_4D_Picaso::snd_Continue()
admcrae 0:e314f3b805ed 1177 {
admcrae 0:e314f3b805ed 1178 char towrite[2] ;
admcrae 0:e314f3b805ed 1179
admcrae 0:e314f3b805ed 1180 towrite[0]= F_snd_Continue >> 8 ;
admcrae 0:e314f3b805ed 1181 towrite[1]= F_snd_Continue & 0xFF;
admcrae 0:e314f3b805ed 1182 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 1183 GetAck() ;
admcrae 0:e314f3b805ed 1184 }
admcrae 0:e314f3b805ed 1185
admcrae 0:e314f3b805ed 1186 void uLCD_4D_Picaso::snd_Pause()
admcrae 0:e314f3b805ed 1187 {
admcrae 0:e314f3b805ed 1188 char towrite[2] ;
admcrae 0:e314f3b805ed 1189
admcrae 0:e314f3b805ed 1190 towrite[0]= F_snd_Pause >> 8 ;
admcrae 0:e314f3b805ed 1191 towrite[1]= F_snd_Pause & 0xFF;
admcrae 0:e314f3b805ed 1192 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 1193 GetAck() ;
admcrae 0:e314f3b805ed 1194 }
admcrae 0:e314f3b805ed 1195
admcrae 2:ebe7029e2825 1196 uint16_t uLCD_4D_Picaso::snd_Pitch(uint16_t Pitch)
admcrae 0:e314f3b805ed 1197 {
admcrae 0:e314f3b805ed 1198 char towrite[4] ;
admcrae 0:e314f3b805ed 1199
admcrae 0:e314f3b805ed 1200 towrite[0]= F_snd_Pitch >> 8 ;
admcrae 0:e314f3b805ed 1201 towrite[1]= F_snd_Pitch & 0xFF;
admcrae 0:e314f3b805ed 1202 towrite[2]= Pitch >> 8 ;
admcrae 0:e314f3b805ed 1203 towrite[3]= Pitch ;
admcrae 0:e314f3b805ed 1204 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1205 return GetAckResp() ;
admcrae 0:e314f3b805ed 1206 }
admcrae 0:e314f3b805ed 1207
admcrae 2:ebe7029e2825 1208 uint16_t uLCD_4D_Picaso::snd_Playing()
admcrae 0:e314f3b805ed 1209 {
admcrae 0:e314f3b805ed 1210 char towrite[2] ;
admcrae 0:e314f3b805ed 1211
admcrae 0:e314f3b805ed 1212 towrite[0]= F_snd_Playing >> 8 ;
admcrae 0:e314f3b805ed 1213 towrite[1]= F_snd_Playing & 0xFF;
admcrae 0:e314f3b805ed 1214 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 1215 return GetAckResp() ;
admcrae 0:e314f3b805ed 1216 }
admcrae 0:e314f3b805ed 1217
admcrae 0:e314f3b805ed 1218 void uLCD_4D_Picaso::snd_Stop()
admcrae 0:e314f3b805ed 1219 {
admcrae 0:e314f3b805ed 1220 char towrite[2] ;
admcrae 0:e314f3b805ed 1221
admcrae 0:e314f3b805ed 1222 towrite[0]= F_snd_Stop >> 8 ;
admcrae 0:e314f3b805ed 1223 towrite[1]= F_snd_Stop & 0xFF;
admcrae 0:e314f3b805ed 1224 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 1225 GetAck() ;
admcrae 0:e314f3b805ed 1226 }
admcrae 0:e314f3b805ed 1227
admcrae 2:ebe7029e2825 1228 void uLCD_4D_Picaso::snd_Volume(uint16_t Volume)
admcrae 0:e314f3b805ed 1229 {
admcrae 0:e314f3b805ed 1230 char towrite[4] ;
admcrae 0:e314f3b805ed 1231
admcrae 0:e314f3b805ed 1232 towrite[0]= F_snd_Volume >> 8 ;
admcrae 0:e314f3b805ed 1233 towrite[1]= F_snd_Volume & 0xFF;
admcrae 0:e314f3b805ed 1234 towrite[2]= Volume >> 8 ;
admcrae 0:e314f3b805ed 1235 towrite[3]= Volume ;
admcrae 0:e314f3b805ed 1236 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1237 GetAck() ;
admcrae 0:e314f3b805ed 1238 }
admcrae 0:e314f3b805ed 1239
admcrae 2:ebe7029e2825 1240 uint16_t uLCD_4D_Picaso::sys_Sleep(uint16_t Units)
admcrae 0:e314f3b805ed 1241 {
admcrae 0:e314f3b805ed 1242 char towrite[4] ;
admcrae 0:e314f3b805ed 1243
admcrae 0:e314f3b805ed 1244 towrite[0]= F_sys_Sleep >> 8 ;
admcrae 0:e314f3b805ed 1245 towrite[1]= F_sys_Sleep & 0xFF;
admcrae 0:e314f3b805ed 1246 towrite[2]= Units >> 8 ;
admcrae 0:e314f3b805ed 1247 towrite[3]= Units ;
admcrae 0:e314f3b805ed 1248 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1249 return GetAckResp() ;
admcrae 0:e314f3b805ed 1250 }
admcrae 0:e314f3b805ed 1251
admcrae 2:ebe7029e2825 1252 void uLCD_4D_Picaso::touch_DetectRegion(uint16_t X1, uint16_t Y1, uint16_t X2, uint16_t Y2)
admcrae 0:e314f3b805ed 1253 {
admcrae 0:e314f3b805ed 1254 char towrite[10] ;
admcrae 0:e314f3b805ed 1255
admcrae 0:e314f3b805ed 1256 towrite[0]= F_touch_DetectRegion >> 8 ;
admcrae 0:e314f3b805ed 1257 towrite[1]= F_touch_DetectRegion & 0xFF;
admcrae 0:e314f3b805ed 1258 towrite[2]= X1 >> 8 ;
admcrae 0:e314f3b805ed 1259 towrite[3]= X1 ;
admcrae 0:e314f3b805ed 1260 towrite[4]= Y1 >> 8 ;
admcrae 0:e314f3b805ed 1261 towrite[5]= Y1 ;
admcrae 0:e314f3b805ed 1262 towrite[6]= X2 >> 8 ;
admcrae 0:e314f3b805ed 1263 towrite[7]= X2 ;
admcrae 0:e314f3b805ed 1264 towrite[8]= Y2 >> 8 ;
admcrae 0:e314f3b805ed 1265 towrite[9]= Y2 ;
admcrae 0:e314f3b805ed 1266 WriteBytes(towrite, 10) ;
admcrae 0:e314f3b805ed 1267 GetAck() ;
admcrae 0:e314f3b805ed 1268 }
admcrae 0:e314f3b805ed 1269
admcrae 2:ebe7029e2825 1270 uint16_t uLCD_4D_Picaso::touch_Get(uint16_t Mode)
admcrae 0:e314f3b805ed 1271 {
admcrae 0:e314f3b805ed 1272 char towrite[4] ;
admcrae 0:e314f3b805ed 1273
admcrae 0:e314f3b805ed 1274 towrite[0]= F_touch_Get >> 8 ;
admcrae 0:e314f3b805ed 1275 towrite[1]= F_touch_Get & 0xFF;
admcrae 0:e314f3b805ed 1276 towrite[2]= Mode >> 8 ;
admcrae 0:e314f3b805ed 1277 towrite[3]= Mode ;
admcrae 0:e314f3b805ed 1278 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1279 return GetAckResp() ;
admcrae 0:e314f3b805ed 1280 }
admcrae 0:e314f3b805ed 1281
admcrae 2:ebe7029e2825 1282 void uLCD_4D_Picaso::touch_Set(uint16_t Mode)
admcrae 0:e314f3b805ed 1283 {
admcrae 0:e314f3b805ed 1284 char towrite[4] ;
admcrae 0:e314f3b805ed 1285
admcrae 0:e314f3b805ed 1286 towrite[0]= F_touch_Set >> 8 ;
admcrae 0:e314f3b805ed 1287 towrite[1]= F_touch_Set & 0xFF;
admcrae 0:e314f3b805ed 1288 towrite[2]= Mode >> 8 ;
admcrae 0:e314f3b805ed 1289 towrite[3]= Mode ;
admcrae 0:e314f3b805ed 1290 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1291 GetAck() ;
admcrae 0:e314f3b805ed 1292 }
admcrae 0:e314f3b805ed 1293
admcrae 2:ebe7029e2825 1294 Picaso::TextAttribute uLCD_4D_Picaso::txt_Attributes(Picaso::TextAttribute Attribs)
admcrae 0:e314f3b805ed 1295 {
admcrae 0:e314f3b805ed 1296 char towrite[4] ;
admcrae 0:e314f3b805ed 1297
admcrae 0:e314f3b805ed 1298 towrite[0]= F_txt_Attributes >> 8 ;
admcrae 0:e314f3b805ed 1299 towrite[1]= F_txt_Attributes ;
admcrae 0:e314f3b805ed 1300 towrite[2]= Attribs >> 8 ;
admcrae 0:e314f3b805ed 1301 towrite[3]= Attribs ;
admcrae 0:e314f3b805ed 1302 WriteBytes(towrite, 4) ;
admcrae 2:ebe7029e2825 1303 return (Picaso::TextAttribute) GetAckResp() ;
admcrae 0:e314f3b805ed 1304 }
admcrae 0:e314f3b805ed 1305
admcrae 2:ebe7029e2825 1306 Picaso::Color uLCD_4D_Picaso::txt_BGcolour(Picaso::Color Color)
admcrae 0:e314f3b805ed 1307 {
admcrae 0:e314f3b805ed 1308 char towrite[4] ;
admcrae 0:e314f3b805ed 1309
admcrae 0:e314f3b805ed 1310 towrite[0]= F_txt_BGcolour >> 8 ;
admcrae 0:e314f3b805ed 1311 towrite[1]= F_txt_BGcolour ;
admcrae 0:e314f3b805ed 1312 towrite[2]= Color >> 8 ;
admcrae 0:e314f3b805ed 1313 towrite[3]= Color ;
admcrae 0:e314f3b805ed 1314 WriteBytes(towrite, 4) ;
admcrae 2:ebe7029e2825 1315 return (Picaso::Color) GetAckResp() ;
admcrae 0:e314f3b805ed 1316 }
admcrae 0:e314f3b805ed 1317
admcrae 2:ebe7029e2825 1318 uint16_t uLCD_4D_Picaso::txt_Bold(uint16_t Bold)
admcrae 0:e314f3b805ed 1319 {
admcrae 0:e314f3b805ed 1320 char towrite[4] ;
admcrae 0:e314f3b805ed 1321
admcrae 0:e314f3b805ed 1322 towrite[0]= F_txt_Bold >> 8 ;
admcrae 0:e314f3b805ed 1323 towrite[1]= F_txt_Bold ;
admcrae 0:e314f3b805ed 1324 towrite[2]= Bold >> 8 ;
admcrae 0:e314f3b805ed 1325 towrite[3]= Bold ;
admcrae 0:e314f3b805ed 1326 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1327 return GetAckResp() ;
admcrae 0:e314f3b805ed 1328 }
admcrae 0:e314f3b805ed 1329
admcrae 2:ebe7029e2825 1330 Picaso::Color uLCD_4D_Picaso::txt_FGcolour(Picaso::Color Color)
admcrae 0:e314f3b805ed 1331 {
admcrae 0:e314f3b805ed 1332 char towrite[4] ;
admcrae 0:e314f3b805ed 1333
admcrae 0:e314f3b805ed 1334 towrite[0]= F_txt_FGcolour >> 8 ;
admcrae 0:e314f3b805ed 1335 towrite[1]= F_txt_FGcolour ;
admcrae 0:e314f3b805ed 1336 towrite[2]= Color >> 8 ;
admcrae 0:e314f3b805ed 1337 towrite[3]= Color ;
admcrae 0:e314f3b805ed 1338 WriteBytes(towrite, 4) ;
admcrae 2:ebe7029e2825 1339 return (Picaso::Color) GetAckResp() ;
admcrae 0:e314f3b805ed 1340 }
admcrae 0:e314f3b805ed 1341
admcrae 2:ebe7029e2825 1342 Picaso::Font uLCD_4D_Picaso::txt_FontID(Picaso::Font FontNumber)
admcrae 0:e314f3b805ed 1343 {
admcrae 0:e314f3b805ed 1344 char towrite[4] ;
admcrae 0:e314f3b805ed 1345
admcrae 0:e314f3b805ed 1346 towrite[0]= F_txt_FontID >> 8 ;
admcrae 0:e314f3b805ed 1347 towrite[1]= F_txt_FontID ;
admcrae 0:e314f3b805ed 1348 towrite[2]= FontNumber >> 8 ;
admcrae 0:e314f3b805ed 1349 towrite[3]= FontNumber ;
admcrae 0:e314f3b805ed 1350 WriteBytes(towrite, 4) ;
admcrae 2:ebe7029e2825 1351 return (Picaso::Font) GetAckResp() ;
admcrae 0:e314f3b805ed 1352 }
admcrae 0:e314f3b805ed 1353
admcrae 2:ebe7029e2825 1354 uint16_t uLCD_4D_Picaso::txt_Height(uint16_t Multiplier)
admcrae 0:e314f3b805ed 1355 {
admcrae 0:e314f3b805ed 1356 char towrite[4] ;
admcrae 0:e314f3b805ed 1357
admcrae 0:e314f3b805ed 1358 towrite[0]= F_txt_Height >> 8 ;
admcrae 0:e314f3b805ed 1359 towrite[1]= F_txt_Height ;
admcrae 0:e314f3b805ed 1360 towrite[2]= Multiplier >> 8 ;
admcrae 0:e314f3b805ed 1361 towrite[3]= Multiplier ;
admcrae 0:e314f3b805ed 1362 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1363 return GetAckResp() ;
admcrae 0:e314f3b805ed 1364 }
admcrae 0:e314f3b805ed 1365
admcrae 2:ebe7029e2825 1366 uint16_t uLCD_4D_Picaso::txt_Inverse(uint16_t Inverse)
admcrae 0:e314f3b805ed 1367 {
admcrae 0:e314f3b805ed 1368 char towrite[4] ;
admcrae 0:e314f3b805ed 1369
admcrae 0:e314f3b805ed 1370 towrite[0]= F_txt_Inverse >> 8 ;
admcrae 0:e314f3b805ed 1371 towrite[1]= F_txt_Inverse ;
admcrae 0:e314f3b805ed 1372 towrite[2]= Inverse >> 8 ;
admcrae 0:e314f3b805ed 1373 towrite[3]= Inverse ;
admcrae 0:e314f3b805ed 1374 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1375 return GetAckResp() ;
admcrae 0:e314f3b805ed 1376 }
admcrae 0:e314f3b805ed 1377
admcrae 2:ebe7029e2825 1378 uint16_t uLCD_4D_Picaso::txt_Italic(uint16_t Italic)
admcrae 0:e314f3b805ed 1379 {
admcrae 0:e314f3b805ed 1380 char towrite[4] ;
admcrae 0:e314f3b805ed 1381
admcrae 0:e314f3b805ed 1382 towrite[0]= F_txt_Italic >> 8 ;
admcrae 0:e314f3b805ed 1383 towrite[1]= F_txt_Italic ;
admcrae 0:e314f3b805ed 1384 towrite[2]= Italic >> 8 ;
admcrae 0:e314f3b805ed 1385 towrite[3]= Italic ;
admcrae 0:e314f3b805ed 1386 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1387 return GetAckResp() ;
admcrae 0:e314f3b805ed 1388 }
admcrae 0:e314f3b805ed 1389
admcrae 2:ebe7029e2825 1390 void uLCD_4D_Picaso::txt_MoveCursor(uint16_t Line, uint16_t Column)
admcrae 0:e314f3b805ed 1391 {
admcrae 0:e314f3b805ed 1392 char towrite[6] ;
admcrae 0:e314f3b805ed 1393
admcrae 0:e314f3b805ed 1394 towrite[0]= F_txt_MoveCursor >> 8 ;
admcrae 0:e314f3b805ed 1395 towrite[1]= F_txt_MoveCursor ;
admcrae 0:e314f3b805ed 1396 towrite[2]= Line >> 8 ;
admcrae 0:e314f3b805ed 1397 towrite[3]= Line ;
admcrae 0:e314f3b805ed 1398 towrite[4]= Column >> 8 ;
admcrae 0:e314f3b805ed 1399 towrite[5]= Column ;
admcrae 0:e314f3b805ed 1400 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 1401 GetAck() ;
admcrae 0:e314f3b805ed 1402 }
admcrae 0:e314f3b805ed 1403
admcrae 2:ebe7029e2825 1404 Picaso::TextOpacity uLCD_4D_Picaso::txt_Opacity(Picaso::TextOpacity TransparentOpaque)
admcrae 0:e314f3b805ed 1405 {
admcrae 0:e314f3b805ed 1406 char towrite[4] ;
admcrae 0:e314f3b805ed 1407
admcrae 0:e314f3b805ed 1408 towrite[0]= F_txt_Opacity >> 8 ;
admcrae 0:e314f3b805ed 1409 towrite[1]= F_txt_Opacity ;
admcrae 0:e314f3b805ed 1410 towrite[2]= TransparentOpaque >> 8 ;
admcrae 0:e314f3b805ed 1411 towrite[3]= TransparentOpaque ;
admcrae 0:e314f3b805ed 1412 WriteBytes(towrite, 4) ;
admcrae 2:ebe7029e2825 1413 return (Picaso::TextOpacity) GetAckResp() ;
admcrae 0:e314f3b805ed 1414 }
admcrae 0:e314f3b805ed 1415
admcrae 2:ebe7029e2825 1416 void uLCD_4D_Picaso::txt_Set(Picaso::TextSetFunc Func, uint16_t Value)
admcrae 0:e314f3b805ed 1417 {
admcrae 0:e314f3b805ed 1418 char towrite[6] ;
admcrae 0:e314f3b805ed 1419
admcrae 0:e314f3b805ed 1420 towrite[0]= F_txt_Set >> 8 ;
admcrae 0:e314f3b805ed 1421 towrite[1]= F_txt_Set ;
admcrae 0:e314f3b805ed 1422 towrite[2]= Func >> 8 ;
admcrae 0:e314f3b805ed 1423 towrite[3]= Func ;
admcrae 0:e314f3b805ed 1424 towrite[4]= Value >> 8 ;
admcrae 0:e314f3b805ed 1425 towrite[5]= Value ;
admcrae 0:e314f3b805ed 1426 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 1427 GetAck() ;
admcrae 0:e314f3b805ed 1428 }
admcrae 0:e314f3b805ed 1429
admcrae 2:ebe7029e2825 1430 uint16_t uLCD_4D_Picaso::txt_Underline(uint16_t Underline)
admcrae 0:e314f3b805ed 1431 {
admcrae 0:e314f3b805ed 1432 char towrite[4] ;
admcrae 0:e314f3b805ed 1433
admcrae 0:e314f3b805ed 1434 towrite[0]= F_txt_Underline >> 8 ;
admcrae 0:e314f3b805ed 1435 towrite[1]= F_txt_Underline ;
admcrae 0:e314f3b805ed 1436 towrite[2]= Underline >> 8 ;
admcrae 0:e314f3b805ed 1437 towrite[3]= Underline ;
admcrae 0:e314f3b805ed 1438 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1439 return GetAckResp() ;
admcrae 0:e314f3b805ed 1440 }
admcrae 0:e314f3b805ed 1441
admcrae 2:ebe7029e2825 1442 uint16_t uLCD_4D_Picaso::txt_Width(uint16_t Multiplier)
admcrae 0:e314f3b805ed 1443 {
admcrae 0:e314f3b805ed 1444 char towrite[4] ;
admcrae 0:e314f3b805ed 1445
admcrae 0:e314f3b805ed 1446 towrite[0]= F_txt_Width >> 8 ;
admcrae 0:e314f3b805ed 1447 towrite[1]= F_txt_Width ;
admcrae 0:e314f3b805ed 1448 towrite[2]= Multiplier >> 8 ;
admcrae 0:e314f3b805ed 1449 towrite[3]= Multiplier ;
admcrae 0:e314f3b805ed 1450 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1451 return GetAckResp() ;
admcrae 0:e314f3b805ed 1452 }
admcrae 0:e314f3b805ed 1453
admcrae 2:ebe7029e2825 1454 uint16_t uLCD_4D_Picaso::txt_Wrap(uint16_t Position)
admcrae 0:e314f3b805ed 1455 {
admcrae 0:e314f3b805ed 1456 char towrite[4] ;
admcrae 0:e314f3b805ed 1457
admcrae 0:e314f3b805ed 1458 towrite[0]= F_txt_Wrap >> 8 ;
admcrae 0:e314f3b805ed 1459 towrite[1]= F_txt_Wrap ;
admcrae 0:e314f3b805ed 1460 towrite[2]= Position >> 8 ;
admcrae 0:e314f3b805ed 1461 towrite[3]= Position ;
admcrae 0:e314f3b805ed 1462 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1463 return GetAckResp() ;
admcrae 0:e314f3b805ed 1464 }
admcrae 0:e314f3b805ed 1465
admcrae 2:ebe7029e2825 1466 uint16_t uLCD_4D_Picaso::txt_Xgap(uint16_t Pixels)
admcrae 0:e314f3b805ed 1467 {
admcrae 0:e314f3b805ed 1468 char towrite[4] ;
admcrae 0:e314f3b805ed 1469
admcrae 0:e314f3b805ed 1470 towrite[0]= F_txt_Xgap >> 8 ;
admcrae 0:e314f3b805ed 1471 towrite[1]= F_txt_Xgap ;
admcrae 0:e314f3b805ed 1472 towrite[2]= Pixels >> 8 ;
admcrae 0:e314f3b805ed 1473 towrite[3]= Pixels ;
admcrae 0:e314f3b805ed 1474 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1475 return GetAckResp() ;
admcrae 0:e314f3b805ed 1476 }
admcrae 0:e314f3b805ed 1477
admcrae 2:ebe7029e2825 1478 uint16_t uLCD_4D_Picaso::txt_Ygap(uint16_t Pixels)
admcrae 0:e314f3b805ed 1479 {
admcrae 0:e314f3b805ed 1480 char towrite[4] ;
admcrae 0:e314f3b805ed 1481
admcrae 0:e314f3b805ed 1482 towrite[0]= F_txt_Ygap >> 8 ;
admcrae 0:e314f3b805ed 1483 towrite[1]= F_txt_Ygap ;
admcrae 0:e314f3b805ed 1484 towrite[2]= Pixels >> 8 ;
admcrae 0:e314f3b805ed 1485 towrite[3]= Pixels ;
admcrae 0:e314f3b805ed 1486 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1487 return GetAckResp() ;
admcrae 0:e314f3b805ed 1488 }
admcrae 0:e314f3b805ed 1489
admcrae 2:ebe7029e2825 1490 uint16_t uLCD_4D_Picaso::file_CallFunction(uint16_t Handle, uint16_t ArgCount, uint16_t* Args)
admcrae 0:e314f3b805ed 1491 {
admcrae 0:e314f3b805ed 1492 char towrite[6] ;
admcrae 0:e314f3b805ed 1493
admcrae 0:e314f3b805ed 1494 towrite[0]= F_file_CallFunction >> 8 ;
admcrae 0:e314f3b805ed 1495 towrite[1]= F_file_CallFunction ;
admcrae 0:e314f3b805ed 1496 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 1497 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 1498 towrite[4]= ArgCount >> 8 ;
admcrae 0:e314f3b805ed 1499 towrite[5]= ArgCount ;
admcrae 0:e314f3b805ed 1500 WriteBytes(towrite, 6) ;
admcrae 0:e314f3b805ed 1501 WriteWords(Args, ArgCount) ;
admcrae 0:e314f3b805ed 1502 return WaitForAck() ;
admcrae 0:e314f3b805ed 1503 }
admcrae 0:e314f3b805ed 1504
admcrae 2:ebe7029e2825 1505 uint16_t uLCD_4D_Picaso::sys_GetModel(char * ModelStr)
admcrae 0:e314f3b805ed 1506 {
admcrae 0:e314f3b805ed 1507 char towrite[2] ;
admcrae 0:e314f3b805ed 1508
admcrae 0:e314f3b805ed 1509 towrite[0]= F_sys_GetModel >> 8 ;
admcrae 0:e314f3b805ed 1510 towrite[1]= F_sys_GetModel ;
admcrae 0:e314f3b805ed 1511 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 1512 return GetAckResStr(ModelStr) ;
admcrae 0:e314f3b805ed 1513 }
admcrae 0:e314f3b805ed 1514
admcrae 2:ebe7029e2825 1515 uint16_t uLCD_4D_Picaso::sys_GetVersion()
admcrae 0:e314f3b805ed 1516 {
admcrae 0:e314f3b805ed 1517 char towrite[2] ;
admcrae 0:e314f3b805ed 1518
admcrae 0:e314f3b805ed 1519 towrite[0]= F_sys_GetVersion >> 8 ;
admcrae 0:e314f3b805ed 1520 towrite[1]= F_sys_GetVersion ;
admcrae 0:e314f3b805ed 1521 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 1522 return GetAckResp() ;
admcrae 0:e314f3b805ed 1523 }
admcrae 0:e314f3b805ed 1524
admcrae 2:ebe7029e2825 1525 uint16_t uLCD_4D_Picaso::sys_GetPmmC()
admcrae 0:e314f3b805ed 1526 {
admcrae 0:e314f3b805ed 1527 char towrite[2] ;
admcrae 0:e314f3b805ed 1528
admcrae 0:e314f3b805ed 1529 towrite[0]= F_sys_GetPmmC >> 8 ;
admcrae 0:e314f3b805ed 1530 towrite[1]= F_sys_GetPmmC ;
admcrae 0:e314f3b805ed 1531 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 1532 return GetAckResp() ;
admcrae 0:e314f3b805ed 1533 }
admcrae 0:e314f3b805ed 1534
admcrae 2:ebe7029e2825 1535 uint16_t uLCD_4D_Picaso::writeString(uint16_t Handle, char * StringOut)
admcrae 0:e314f3b805ed 1536 {
admcrae 0:e314f3b805ed 1537 char towrite[4] ;
admcrae 0:e314f3b805ed 1538
admcrae 0:e314f3b805ed 1539 towrite[0]= F_writeString >> 8 ;
admcrae 0:e314f3b805ed 1540 towrite[1]= F_writeString ;
admcrae 0:e314f3b805ed 1541 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 1542 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 1543 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1544 WriteChars(StringOut) ;
admcrae 0:e314f3b805ed 1545 return GetAckResp() ;
admcrae 0:e314f3b805ed 1546 }
admcrae 0:e314f3b805ed 1547
admcrae 2:ebe7029e2825 1548 uint16_t uLCD_4D_Picaso::readString(uint16_t Handle, char * StringIn)
admcrae 0:e314f3b805ed 1549 {
admcrae 0:e314f3b805ed 1550 char towrite[4] ;
admcrae 0:e314f3b805ed 1551
admcrae 0:e314f3b805ed 1552 towrite[0]= F_readString >> 8 ;
admcrae 0:e314f3b805ed 1553 towrite[1]= F_readString ;
admcrae 0:e314f3b805ed 1554 towrite[2]= Handle >> 8 ;
admcrae 0:e314f3b805ed 1555 towrite[3]= Handle ;
admcrae 0:e314f3b805ed 1556 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1557 return GetAckResStr(StringIn) ;
admcrae 0:e314f3b805ed 1558 }
admcrae 0:e314f3b805ed 1559
admcrae 2:ebe7029e2825 1560 void uLCD_4D_Picaso::blitComtoDisplay(uint16_t X, uint16_t Y, uint16_t Width, uint16_t Height, char* Pixels)
admcrae 0:e314f3b805ed 1561 {
admcrae 0:e314f3b805ed 1562 char towrite[10] ;
admcrae 0:e314f3b805ed 1563
admcrae 0:e314f3b805ed 1564 towrite[0]= F_blitComtoDisplay >> 8 ;
admcrae 0:e314f3b805ed 1565 towrite[1]= F_blitComtoDisplay ;
admcrae 0:e314f3b805ed 1566 towrite[2]= X >> 8 ;
admcrae 0:e314f3b805ed 1567 towrite[3]= X ;
admcrae 0:e314f3b805ed 1568 towrite[4]= Y >> 8 ;
admcrae 0:e314f3b805ed 1569 towrite[5]= Y ;
admcrae 0:e314f3b805ed 1570 towrite[6]= Width >> 8 ;
admcrae 0:e314f3b805ed 1571 towrite[7]= Width ;
admcrae 0:e314f3b805ed 1572 towrite[8]= Height >> 8 ;
admcrae 0:e314f3b805ed 1573 towrite[9]= Height ;
admcrae 0:e314f3b805ed 1574 WriteBytes(towrite, 10) ;
admcrae 0:e314f3b805ed 1575 WriteBytes(Pixels, Width*Height*2) ;
admcrae 0:e314f3b805ed 1576 GetAck() ;
admcrae 0:e314f3b805ed 1577 }
admcrae 0:e314f3b805ed 1578
admcrae 2:ebe7029e2825 1579 uint16_t uLCD_4D_Picaso::file_FindFirstRet(char * Filename, char * StringIn)
admcrae 0:e314f3b805ed 1580 {
admcrae 0:e314f3b805ed 1581 char towrite[2] ;
admcrae 0:e314f3b805ed 1582
admcrae 0:e314f3b805ed 1583 towrite[0]= F_file_FindFirstRet >> 8 ;
admcrae 0:e314f3b805ed 1584 towrite[1]= F_file_FindFirstRet ;
admcrae 0:e314f3b805ed 1585 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 1586 WriteChars(Filename) ;
admcrae 0:e314f3b805ed 1587 return GetAckResStr(StringIn) ;
admcrae 0:e314f3b805ed 1588 }
admcrae 0:e314f3b805ed 1589
admcrae 2:ebe7029e2825 1590 uint16_t uLCD_4D_Picaso::file_FindNextRet(char * StringIn)
admcrae 0:e314f3b805ed 1591 {
admcrae 0:e314f3b805ed 1592 char towrite[2] ;
admcrae 0:e314f3b805ed 1593
admcrae 0:e314f3b805ed 1594 towrite[0]= F_file_FindNextRet >> 8 ;
admcrae 0:e314f3b805ed 1595 towrite[1]= F_file_FindNextRet ;
admcrae 0:e314f3b805ed 1596 WriteBytes(towrite, 2) ;
admcrae 0:e314f3b805ed 1597 return GetAckResStr(StringIn) ;
admcrae 0:e314f3b805ed 1598 }
admcrae 0:e314f3b805ed 1599
admcrae 2:ebe7029e2825 1600 void uLCD_4D_Picaso::setbaudWait(Picaso::BaudRate Newrate)
admcrae 0:e314f3b805ed 1601 {
admcrae 0:e314f3b805ed 1602 char towrite[4] ;
admcrae 0:e314f3b805ed 1603
admcrae 0:e314f3b805ed 1604 towrite[0]= F_setbaudWait >> 8 ;
admcrae 0:e314f3b805ed 1605 towrite[1]= F_setbaudWait ;
admcrae 0:e314f3b805ed 1606 towrite[2]= Newrate >> 8 ;
admcrae 0:e314f3b805ed 1607 towrite[3]= Newrate ;
admcrae 0:e314f3b805ed 1608 WriteBytes(towrite, 4) ;
admcrae 0:e314f3b805ed 1609 //printf("Baud command: %2x%2x%2x%2x\r\n", towrite[0], towrite[1], towrite[2], towrite[3]);
admcrae 0:e314f3b805ed 1610 SetThisBaudrate(Newrate) ; // change this systems baud rate to match new display rate, ACK is 100ms away
admcrae 0:e314f3b805ed 1611 GetAck() ;
admcrae 0:e314f3b805ed 1612 }
admcrae 0:e314f3b805ed 1613
shorwich 7:7754ce600ca6 1614 int uLCD_4D_Picaso::_putc(int c)
shorwich 7:7754ce600ca6 1615 {
shorwich 7:7754ce600ca6 1616 putCH(c); //your new LCD put to print an ASCII character on LCD
shorwich 7:7754ce600ca6 1617 return 0;
shorwich 7:7754ce600ca6 1618 }
shorwich 7:7754ce600ca6 1619 int uLCD_4D_Picaso::_getc()
shorwich 7:7754ce600ca6 1620 {
shorwich 7:7754ce600ca6 1621 return -1;
shorwich 7:7754ce600ca6 1622 }
shorwich 7:7754ce600ca6 1623
admcrae 0:e314f3b805ed 1624 /*
admcrae 0:e314f3b805ed 1625 * Conpound 4D Routines Ends here
admcrae 0:e314f3b805ed 1626 */
admcrae 0:e314f3b805ed 1627