1 |
jakw |
1 |
/*****************************************************************************
|
|
|
2 |
** TEXAS INSTRUMENTS PROPRIETARY INFORMATION
|
|
|
3 |
**
|
|
|
4 |
** (c) Copyright, Texas Instruments Incorporated, 2012-2013.
|
|
|
5 |
** All Rights Reserved.
|
|
|
6 |
**
|
|
|
7 |
** Property of Texas Instruments Incorporated. Restricted Rights -
|
|
|
8 |
** Use, duplication, or disclosure is subject to restrictions set
|
|
|
9 |
** forth in TI's program license agreement and associated documentation.
|
|
|
10 |
******************************************************************************/
|
|
|
11 |
/**
|
|
|
12 |
*
|
|
|
13 |
* @file lcr_cmd.c
|
|
|
14 |
*
|
|
|
15 |
* @brief This file contatins DM365 Command Interfaces implementation.
|
|
|
16 |
* As per the command definition the the command packets will be
|
|
|
17 |
* created.
|
|
|
18 |
**/
|
|
|
19 |
/*****************************************************************************/
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
#include "common.h"
|
|
|
23 |
#include "error.h"
|
|
|
24 |
#include "lcr_packetizer.h"
|
|
|
25 |
#include "lcr_cmd.h"
|
|
|
26 |
|
|
|
27 |
/* Connects to the DLP LightCrafter(TM) Hardware */
|
|
|
28 |
ErrorCode_t LCR_CMD_Open(void)
|
|
|
29 |
{
|
|
|
30 |
/* Open tcp connection with LCr */
|
|
|
31 |
return LCR_CMD_PKT_ConnectToLCR();
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
/*Close the TCP Connection*/
|
|
|
35 |
ErrorCode_t LCR_CMD_Close(void)
|
|
|
36 |
{
|
|
|
37 |
LCR_CMD_PKT_DisconnectLCR();
|
|
|
38 |
|
|
|
39 |
return SUCCESS;
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
/* Read revision of MSP430, DM365 and FPGA */
|
|
|
43 |
ErrorCode_t LCR_CMD_GetRevision(LCR_Revision_t Which, char *VersionStr)
|
|
|
44 |
{
|
|
|
45 |
//Frame the packet
|
|
|
46 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_READ, 0x0100);
|
|
|
47 |
if(Which != REV_DM365 && Which != REV_FPGA && Which != REV_MSP430)
|
|
|
48 |
{
|
|
|
49 |
return FAIL;
|
|
|
50 |
}
|
|
|
51 |
LCR_CMD_PKT_PutInt(Which,1);
|
|
|
52 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
53 |
return FAIL;
|
|
|
54 |
|
|
|
55 |
LCR_CMD_PKT_GetData((uint8*)VersionStr,LCR_CMD_VERSION_STR_LEN);
|
|
|
56 |
|
|
|
57 |
return SUCCESS;
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
/* Change the Display Mode */
|
|
|
61 |
ErrorCode_t LCR_CMD_SetDisplayMode(LCR_DisplayMode_t Mode)
|
|
|
62 |
{
|
|
|
63 |
|
|
|
64 |
if(Mode > DISP_MODE_PTN_SEQ)
|
|
|
65 |
return FAIL;
|
|
|
66 |
|
|
|
67 |
/* Generate packet */
|
|
|
68 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0101);
|
|
|
69 |
LCR_CMD_PKT_PutInt((int)Mode,1);
|
|
|
70 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
71 |
return FAIL;
|
|
|
72 |
|
|
|
73 |
return SUCCESS;
|
|
|
74 |
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
/* Returns the Display Mode */
|
|
|
78 |
LCR_DisplayMode_t LCR_CMD_GetDisplayMode(void)
|
|
|
79 |
{
|
|
|
80 |
uint8 data;
|
|
|
81 |
|
|
|
82 |
/* Read display mode */
|
|
|
83 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_READ, 0x0101);
|
|
|
84 |
LCR_CMD_PKT_SendCommand();
|
|
|
85 |
LCR_CMD_PKT_GetData((uint8*)&data,1);
|
|
|
86 |
|
|
|
87 |
return (LCR_DisplayMode_t)data;
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
/* Change the Power Mode from/to STANDBY or NORMAL */
|
|
|
91 |
ErrorCode_t LCR_CMD_SetPowerMode(LCR_PowerMode_t Mode)
|
|
|
92 |
{
|
|
|
93 |
//TBD
|
|
|
94 |
return SUCCESS;
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
/* Read the current system power mode */
|
|
|
98 |
LCR_PowerMode_t LCR_CMD_GetPowerMode(void)
|
|
|
99 |
{
|
|
|
100 |
uint8 data = 0;
|
|
|
101 |
//TBD
|
|
|
102 |
return (LCR_PowerMode_t) data;
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
/* Set the Tespattern as defined in LCR_TestPattern_t list */
|
|
|
106 |
ErrorCode_t LCR_CMD_SetTestPattern(LCR_TestPattern_t TestPtn)
|
|
|
107 |
{
|
|
|
108 |
if(TestPtn > TEST_PTN_ANXI_CHECKER)
|
|
|
109 |
return FAIL;
|
|
|
110 |
|
|
|
111 |
/* Generate packet */
|
|
|
112 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0103);
|
|
|
113 |
LCR_CMD_PKT_PutInt((int)TestPtn,1);
|
|
|
114 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
115 |
return FAIL;
|
|
|
116 |
|
|
|
117 |
return SUCCESS;
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
/* Returned set test pattern */
|
|
|
121 |
LCR_TestPattern_t LCR_CMD_GetTestPattern(void)
|
|
|
122 |
{
|
|
|
123 |
|
|
|
124 |
uint8 data;
|
|
|
125 |
|
|
|
126 |
/* Read Test Pattern set */
|
|
|
127 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_READ, 0x0103);
|
|
|
128 |
LCR_CMD_PKT_SendCommand();
|
|
|
129 |
LCR_CMD_PKT_GetData((uint8*)&data,1);
|
|
|
130 |
|
|
|
131 |
return (LCR_TestPattern_t)data;
|
|
|
132 |
}
|
|
|
133 |
|
|
|
134 |
/* Set the R,G,B LED current */
|
|
|
135 |
ErrorCode_t LCR_CMD_SetLEDCurrent(LCR_LEDCurrent_t *LEDSetting)
|
|
|
136 |
{
|
|
|
137 |
/* Write LED current */
|
|
|
138 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0104);
|
|
|
139 |
LCR_CMD_PKT_PutInt(LEDSetting->Red, 2);
|
|
|
140 |
LCR_CMD_PKT_PutInt(LEDSetting->Green, 2);
|
|
|
141 |
LCR_CMD_PKT_PutInt(LEDSetting->Blue, 2);
|
|
|
142 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
143 |
return FAIL;
|
|
|
144 |
|
|
|
145 |
return SUCCESS;
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
/* Read the R,G,B LED current */
|
|
|
149 |
ErrorCode_t LCR_CMD_GetLEDCurrent(LCR_LEDCurrent_t *LEDSetting)
|
|
|
150 |
{
|
|
|
151 |
/* Read LED current */
|
|
|
152 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_READ, 0x0104);
|
|
|
153 |
LCR_CMD_PKT_SendCommand();
|
|
|
154 |
|
|
|
155 |
LEDSetting->Red = LCR_CMD_PKT_GetInt(2);
|
|
|
156 |
LEDSetting->Green = LCR_CMD_PKT_GetInt(2);
|
|
|
157 |
LEDSetting->Blue = LCR_CMD_PKT_GetInt(2);
|
|
|
158 |
|
|
|
159 |
return SUCCESS;
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
/* Download a 24bpp .BMP image */
|
|
|
163 |
ErrorCode_t LCR_CMD_DisplayStaticImage(char const *fileNameWithPath)
|
|
|
164 |
{
|
|
|
165 |
/* Generate packet */
|
|
|
166 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0105);
|
|
|
167 |
|
|
|
168 |
/*TBD - Check for return error*/
|
|
|
169 |
LCR_CMD_PKT_PutFile(fileNameWithPath);
|
|
|
170 |
|
|
|
171 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
172 |
return FAIL;
|
|
|
173 |
|
|
|
174 |
return SUCCESS;
|
|
|
175 |
}
|
|
|
176 |
|
|
|
177 |
/* Displays solid filed color image */
|
|
|
178 |
ErrorCode_t LCR_CMD_DisplayStaticColor(uint32 Color)
|
|
|
179 |
{
|
|
|
180 |
/* Generate packet */
|
|
|
181 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0106);
|
|
|
182 |
LCR_CMD_PKT_PutInt((uint32)Color,4);
|
|
|
183 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
184 |
return FAIL;
|
|
|
185 |
|
|
|
186 |
return SUCCESS;
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
/* Configures the displayed image on the DMD*/
|
|
|
190 |
ErrorCode_t LCR_CMD_SetDisplaySetting(LCR_DisplaySetting_t const *Setting)
|
|
|
191 |
{
|
|
|
192 |
/* Generate packet */
|
|
|
193 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0107);
|
|
|
194 |
LCR_CMD_PKT_PutInt((int)Setting->LongAxisFlip,1);
|
|
|
195 |
LCR_CMD_PKT_PutInt((int)Setting->ShortAxisFlip,1);
|
|
|
196 |
LCR_CMD_PKT_PutInt((int)Setting->Rotate,1);
|
|
|
197 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
198 |
return FAIL;
|
|
|
199 |
|
|
|
200 |
return SUCCESS;
|
|
|
201 |
}
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
/* Returns the existing display settings */
|
|
|
205 |
ErrorCode_t LCR_CMD_GetDisplaySetting(LCR_DisplaySetting_t *Setting)
|
|
|
206 |
{
|
|
|
207 |
uint8 data;
|
|
|
208 |
|
|
|
209 |
/* Display Settings */
|
|
|
210 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_READ, 0x0107);
|
|
|
211 |
LCR_CMD_PKT_SendCommand();
|
|
|
212 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
213 |
Setting->LongAxisFlip = data;
|
|
|
214 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
215 |
Setting->ShortAxisFlip = data;
|
|
|
216 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
217 |
Setting->Rotate = data;
|
|
|
218 |
|
|
|
219 |
return SUCCESS;
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
/* Configures the input video source settings */
|
|
|
223 |
ErrorCode_t LCR_CMD_SetVideoSetting(LCR_VideoSetting_t const *Setting)
|
|
|
224 |
{
|
|
|
225 |
|
|
|
226 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0200);
|
|
|
227 |
LCR_CMD_PKT_PutInt(Setting->ResolutionX,2);
|
|
|
228 |
LCR_CMD_PKT_PutInt(Setting->ResolutionY,2);
|
|
|
229 |
LCR_CMD_PKT_PutInt(Setting->FirstPix,2);
|
|
|
230 |
LCR_CMD_PKT_PutInt(Setting->FirstLine,2);
|
|
|
231 |
LCR_CMD_PKT_PutInt(Setting->ActiveWidth,2);
|
|
|
232 |
LCR_CMD_PKT_PutInt(Setting->ActiveHeight,2);
|
|
|
233 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
234 |
return FAIL;
|
|
|
235 |
|
|
|
236 |
return SUCCESS;
|
|
|
237 |
}
|
|
|
238 |
|
|
|
239 |
/* Returns currently set video settings */
|
|
|
240 |
ErrorCode_t LCR_CMD_GetVideoSetting(LCR_VideoSetting_t *Setting)
|
|
|
241 |
{
|
|
|
242 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_READ, 0x0200);
|
|
|
243 |
LCR_CMD_PKT_SendCommand();
|
|
|
244 |
|
|
|
245 |
//Assign to the structures
|
|
|
246 |
Setting->ResolutionX = LCR_CMD_PKT_GetInt(2);
|
|
|
247 |
Setting->ResolutionY = LCR_CMD_PKT_GetInt(2);
|
|
|
248 |
Setting->FirstPix = LCR_CMD_PKT_GetInt(2);
|
|
|
249 |
Setting->FirstLine = LCR_CMD_PKT_GetInt(2);
|
|
|
250 |
Setting->ActiveWidth = LCR_CMD_PKT_GetInt(2);
|
|
|
251 |
Setting->ActiveHeight = LCR_CMD_PKT_GetInt(2);
|
|
|
252 |
|
|
|
253 |
return SUCCESS;
|
|
|
254 |
}
|
|
|
255 |
|
|
|
256 |
/* Set Video Mode */
|
|
|
257 |
ErrorCode_t LCR_CMD_SetVideoMode(LCR_VideoModeSetting_t *Setting)
|
|
|
258 |
{
|
|
|
259 |
/*Frame the packet*/
|
|
|
260 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0201);
|
|
|
261 |
LCR_CMD_PKT_PutInt((int)Setting->FrameRate,1);
|
|
|
262 |
LCR_CMD_PKT_PutInt((int)Setting->BitDepth,1);
|
|
|
263 |
LCR_CMD_PKT_PutInt((int)Setting->RGB,1);
|
|
|
264 |
|
|
|
265 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
266 |
return FAIL;
|
|
|
267 |
|
|
|
268 |
return SUCCESS;
|
|
|
269 |
}
|
|
|
270 |
|
|
|
271 |
|
|
|
272 |
/* Return current video mode settings */
|
|
|
273 |
ErrorCode_t LCR_CMD_GetVideoMode(LCR_VideoModeSetting_t *Setting)
|
|
|
274 |
{
|
|
|
275 |
uint8 data;
|
|
|
276 |
|
|
|
277 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_READ, 0x0201);
|
|
|
278 |
LCR_CMD_PKT_SendCommand();
|
|
|
279 |
|
|
|
280 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
281 |
Setting->FrameRate = data;
|
|
|
282 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
283 |
Setting->BitDepth = data;
|
|
|
284 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
285 |
Setting->RGB = data;
|
|
|
286 |
|
|
|
287 |
return SUCCESS;
|
|
|
288 |
}
|
|
|
289 |
|
|
|
290 |
/* Configures pattern interleaving */
|
|
|
291 |
ErrorCode_t LCR_CMD_SetInterleavePatternOrder(uint8 NumPatterns, uint8 const *PatternOrder)
|
|
|
292 |
{
|
|
|
293 |
/*TBD*/
|
|
|
294 |
return SUCCESS;
|
|
|
295 |
}
|
|
|
296 |
|
|
|
297 |
/* Returns pattern interleave order */
|
|
|
298 |
ErrorCode_t LCR_CMD_GetInterleavePatternOrder(uint8 *NumPatterns, uint8 *PatternOrder)
|
|
|
299 |
{
|
|
|
300 |
/*TBD*/
|
|
|
301 |
return SUCCESS;
|
|
|
302 |
}
|
|
|
303 |
|
|
|
304 |
/* Defines pattern sequence */
|
|
|
305 |
ErrorCode_t LCR_CMD_SetPatternSeqSetting(LCR_PatternSeqSetting_t const *Setting)
|
|
|
306 |
{
|
|
|
307 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0480); //The old cmd 0x0400 is kept for backward compatibility only use the new one
|
|
|
308 |
LCR_CMD_PKT_PutInt((int)Setting->BitDepth,1);
|
|
|
309 |
LCR_CMD_PKT_PutInt((int)Setting->NumPatterns,2);
|
|
|
310 |
LCR_CMD_PKT_PutInt((int)Setting->PatternType,1);
|
|
|
311 |
LCR_CMD_PKT_PutInt((int)Setting->InputTriggerType,1);
|
|
|
312 |
LCR_CMD_PKT_PutInt((uint32)Setting->InputTriggerDelay,4);
|
|
|
313 |
LCR_CMD_PKT_PutInt((uint32)Setting->AutoTriggerPeriod,4);
|
|
|
314 |
LCR_CMD_PKT_PutInt((uint32)Setting->ExposureTime,4);
|
|
|
315 |
LCR_CMD_PKT_PutInt((int)Setting->LEDSelect,1);
|
|
|
316 |
LCR_CMD_PKT_PutInt((int)Setting->Repeat,1);
|
|
|
317 |
|
|
|
318 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
319 |
return FAIL;
|
|
|
320 |
|
|
|
321 |
return SUCCESS;
|
|
|
322 |
}
|
|
|
323 |
|
|
|
324 |
|
|
|
325 |
/* Return currently set pattern sequence */
|
|
|
326 |
ErrorCode_t LCR_CMD_GetPatternSeqSetting(LCR_PatternSeqSetting_t *Setting)
|
|
|
327 |
{
|
|
|
328 |
uint8 data;
|
|
|
329 |
uint32 data32;
|
|
|
330 |
|
|
|
331 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_READ, 0x0480);
|
|
|
332 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
333 |
return FAIL;
|
|
|
334 |
|
|
|
335 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
336 |
Setting->BitDepth = data;
|
|
|
337 |
|
|
|
338 |
Setting->NumPatterns = LCR_CMD_PKT_GetInt(2);
|
|
|
339 |
|
|
|
340 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
341 |
Setting->PatternType = (LCR_PatternType_t) data;
|
|
|
342 |
|
|
|
343 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
344 |
Setting->InputTriggerType = (LCR_TriggerType_t)data;
|
|
|
345 |
|
|
|
346 |
LCR_CMD_PKT_GetData((uint8*)&data32,4);
|
|
|
347 |
Setting->InputTriggerDelay = data32;
|
|
|
348 |
|
|
|
349 |
LCR_CMD_PKT_GetData((uint8*)&data32,4);
|
|
|
350 |
Setting->AutoTriggerPeriod = data32;
|
|
|
351 |
|
|
|
352 |
LCR_CMD_PKT_GetData((uint8*)&data32,4);
|
|
|
353 |
Setting->ExposureTime = data32;
|
|
|
354 |
|
|
|
355 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
356 |
Setting->LEDSelect = (LCR_LEDSelect_t) data;
|
|
|
357 |
|
|
|
358 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
359 |
Setting->Repeat = data;
|
|
|
360 |
|
|
|
361 |
return SUCCESS;
|
|
|
362 |
}
|
|
|
363 |
|
|
|
364 |
/* Downloads a bmp file in pattern sequence mode */
|
|
|
365 |
ErrorCode_t LCR_CMD_DefinePatternBMP(LCR_PatternCount_t PatternNum, char const *fileNameWithPath)
|
|
|
366 |
{
|
|
|
367 |
/* Generate packet */
|
|
|
368 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0401);
|
|
|
369 |
LCR_CMD_PKT_PutInt((int)PatternNum, 1);
|
|
|
370 |
LCR_CMD_PKT_PutFile(fileNameWithPath);
|
|
|
371 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
372 |
return FAIL;
|
|
|
373 |
|
|
|
374 |
return SUCCESS;
|
|
|
375 |
}
|
|
|
376 |
|
|
|
377 |
/* Reads and stores a pattern from the DLP LightCrafter(TM) in the .bmp format with <file_name>*/
|
|
|
378 |
ErrorCode_t LCR_CMD_ReadPattern(LCR_PatternCount_t PatternNum, char *fileName)
|
|
|
379 |
{
|
|
|
380 |
unsigned long int numbytes;
|
|
|
381 |
|
|
|
382 |
//Determine the bit depth
|
|
|
383 |
LCR_PatternSeqSetting_t Setting;
|
|
|
384 |
LCR_CMD_GetPatternSeqSetting(&Setting);
|
|
|
385 |
switch(Setting.BitDepth)
|
|
|
386 |
{
|
|
|
387 |
case 1:
|
|
|
388 |
numbytes = ONE_BPP_PTN_SIZE;
|
|
|
389 |
break;
|
|
|
390 |
case 2:
|
|
|
391 |
numbytes = TWO_BPP_PTN_SIZE;
|
|
|
392 |
break;
|
|
|
393 |
case 3:
|
|
|
394 |
numbytes = THREE_BPP_PTN_SIZE;
|
|
|
395 |
break;
|
|
|
396 |
case 4:
|
|
|
397 |
numbytes = FOUR_BPP_PTN_SIZE;
|
|
|
398 |
break;
|
|
|
399 |
case 5:
|
|
|
400 |
numbytes = FIVE_BPP_PTN_SIZE;
|
|
|
401 |
break;
|
|
|
402 |
case 6:
|
|
|
403 |
numbytes = SIX_BPP_PTN_SIZE;
|
|
|
404 |
break;
|
|
|
405 |
case 7:
|
|
|
406 |
numbytes = SEVEN_BPP_PTN_SIZE;
|
|
|
407 |
break;
|
|
|
408 |
case 8:
|
|
|
409 |
numbytes = EIGHT_BPP_PTN_SIZE;
|
|
|
410 |
break;
|
|
|
411 |
default:
|
|
|
412 |
return FAIL;
|
|
|
413 |
}
|
|
|
414 |
|
|
|
415 |
/* Generate packet */
|
|
|
416 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_READ, 0x0401);
|
|
|
417 |
LCR_CMD_PKT_PutData((uint8*) &PatternNum, 1);
|
|
|
418 |
LCR_CMD_PKT_SendCommand();
|
|
|
419 |
LCR_CMD_PKT_GetFile(fileName,numbytes);
|
|
|
420 |
|
|
|
421 |
return SUCCESS;
|
|
|
422 |
}
|
|
|
423 |
|
|
|
424 |
/* Starts/Stop of pattern sequence */
|
|
|
425 |
ErrorCode_t LCR_CMD_StartPatternSeq(uint8 Start)
|
|
|
426 |
{
|
|
|
427 |
/* Generate packet */
|
|
|
428 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0402);
|
|
|
429 |
LCR_CMD_PKT_PutInt(Start,1);
|
|
|
430 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
431 |
return FAIL;
|
|
|
432 |
|
|
|
433 |
return SUCCESS;
|
|
|
434 |
}
|
|
|
435 |
|
|
|
436 |
/* Displays next pattern in pattern sequence applicable only if Input Trigger Type = Command Trigger (0x00) */
|
|
|
437 |
ErrorCode_t LCR_CMD_AdvancePatternSeq(void)
|
|
|
438 |
{
|
|
|
439 |
/* Generate packet */
|
|
|
440 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0403);
|
|
|
441 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
442 |
return FAIL;
|
|
|
443 |
|
|
|
444 |
return SUCCESS;
|
|
|
445 |
}
|
|
|
446 |
|
|
|
447 |
/* Returns the configuration of the CameraTrigger signal */
|
|
|
448 |
ErrorCode_t LCR_CMD_GetCamTriggerSetting(LCR_CamTriggerSetting_t *Setting)
|
|
|
449 |
{
|
|
|
450 |
uint8 data;
|
|
|
451 |
uint32 data32;
|
|
|
452 |
|
|
|
453 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_READ, 0x0404);
|
|
|
454 |
LCR_CMD_PKT_SendCommand();
|
|
|
455 |
|
|
|
456 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
457 |
Setting->Enable = data;
|
|
|
458 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
459 |
Setting->Source = data;
|
|
|
460 |
LCR_CMD_PKT_GetData(&data,1);
|
|
|
461 |
Setting->Polarity = data;
|
|
|
462 |
LCR_CMD_PKT_GetData((uint8*)&data32,4);
|
|
|
463 |
Setting->Delay = data32;
|
|
|
464 |
LCR_CMD_PKT_GetData((uint8*)&data32,4);
|
|
|
465 |
Setting->PulseWidth = data32;
|
|
|
466 |
|
|
|
467 |
return SUCCESS;
|
|
|
468 |
}
|
|
|
469 |
|
|
|
470 |
/* Updates the camera trigger configuration */
|
|
|
471 |
ErrorCode_t LCR_CMD_SetCamTriggerSetting(LCR_CamTriggerSetting_t *Setting)
|
|
|
472 |
{
|
|
|
473 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0404);
|
|
|
474 |
LCR_CMD_PKT_PutInt((int)Setting->Enable,1);
|
|
|
475 |
LCR_CMD_PKT_PutInt((int)Setting->Source,1);
|
|
|
476 |
LCR_CMD_PKT_PutInt((int)Setting->Polarity,1);
|
|
|
477 |
LCR_CMD_PKT_PutInt((uint32)Setting->Delay,4);
|
|
|
478 |
LCR_CMD_PKT_PutInt((uint32)Setting->PulseWidth,4);
|
|
|
479 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
480 |
return FAIL;
|
|
|
481 |
|
|
|
482 |
return SUCCESS;
|
|
|
483 |
}
|
|
|
484 |
|
|
|
485 |
/*Send the HW Pattern Sequence Definition information */
|
|
|
486 |
ErrorCode_t LCR_CMD_DefineHWPatSequence(LCR_HWPatternSeqDef_t *hwPatSeqDef)
|
|
|
487 |
{
|
|
|
488 |
int i;
|
|
|
489 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0406);
|
|
|
490 |
LCR_CMD_PKT_PutInt((int)hwPatSeqDef->index,1);
|
|
|
491 |
LCR_CMD_PKT_PutInt((int)hwPatSeqDef->numOfPatn,1);
|
|
|
492 |
for(i=0; i<hwPatSeqDef->numOfPatn;i++)
|
|
|
493 |
{
|
|
|
494 |
LCR_CMD_PKT_PutInt((int)hwPatSeqDef->hwPatArray[i].Number,1);
|
|
|
495 |
LCR_CMD_PKT_PutInt((int)hwPatSeqDef->hwPatArray[i].Invert,1);
|
|
|
496 |
}
|
|
|
497 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
498 |
return FAIL;
|
|
|
499 |
|
|
|
500 |
return SUCCESS;
|
|
|
501 |
}
|
|
|
502 |
|
|
|
503 |
/* Save current setting and Display mode as solution */
|
|
|
504 |
ErrorCode_t LCR_CMD_SaveSolution(char *SolutionName)
|
|
|
505 |
{
|
|
|
506 |
uint8 tempName[LCR_CMD_SOLUTION_NAME_LEN];
|
|
|
507 |
|
|
|
508 |
//copy the string into temporary buffer
|
|
|
509 |
strcpy((char*)&tempName[0],SolutionName);
|
|
|
510 |
|
|
|
511 |
//Frame the packet
|
|
|
512 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0600);
|
|
|
513 |
LCR_CMD_PKT_PutData((uint8*)&tempName[0],LCR_CMD_SOLUTION_NAME_LEN);
|
|
|
514 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
515 |
return FAIL;
|
|
|
516 |
|
|
|
517 |
return SUCCESS;
|
|
|
518 |
}
|
|
|
519 |
|
|
|
520 |
/* Retrieve the details of the solution stored */
|
|
|
521 |
ErrorCode_t LCR_CMD_GetSolutionNames(uint8 *Count, uint8 *DefaultSolution, char *SolutionName)
|
|
|
522 |
{
|
|
|
523 |
//Frame the packet
|
|
|
524 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_READ, 0x0600);
|
|
|
525 |
LCR_CMD_PKT_SendCommand();
|
|
|
526 |
|
|
|
527 |
LCR_CMD_PKT_GetData(Count,1);
|
|
|
528 |
LCR_CMD_PKT_GetData(DefaultSolution,1);
|
|
|
529 |
LCR_CMD_PKT_GetData((uint8*)SolutionName,((*Count)*LCR_CMD_SOLUTION_NAME_LEN));
|
|
|
530 |
|
|
|
531 |
return SUCCESS;
|
|
|
532 |
}
|
|
|
533 |
|
|
|
534 |
/* Allows Loading, Deleting and Setting an exisitng solution in the system */
|
|
|
535 |
ErrorCode_t LCR_CMD_ManageSolution(LCR_SolutionCommand_t Cmd, char *SolutionName)
|
|
|
536 |
{
|
|
|
537 |
uint8 tempName[LCR_CMD_SOLUTION_NAME_LEN];
|
|
|
538 |
|
|
|
539 |
//copy the string into temporary buffer
|
|
|
540 |
strcpy((char*)&tempName[0],SolutionName);
|
|
|
541 |
|
|
|
542 |
//Frame the packet
|
|
|
543 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0601);
|
|
|
544 |
LCR_CMD_PKT_PutData((uint8*)&Cmd,1);
|
|
|
545 |
LCR_CMD_PKT_PutData((uint8*)&tempName[0],LCR_CMD_SOLUTION_NAME_LEN);
|
|
|
546 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
547 |
return FAIL;
|
|
|
548 |
|
|
|
549 |
return SUCCESS;
|
|
|
550 |
}
|
|
|
551 |
|
|
|
552 |
/*Downloads the new Sequence LUT into the DLPC300 controller*/
|
|
|
553 |
ErrorCode_t LCR_CMD_LoadCustomSequence(char *seqBinFileName)
|
|
|
554 |
{
|
|
|
555 |
/* Generate packet */
|
|
|
556 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0A00);
|
|
|
557 |
|
|
|
558 |
/*TBD - Check for return error*/
|
|
|
559 |
LCR_CMD_PKT_PutFile(seqBinFileName);
|
|
|
560 |
|
|
|
561 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
562 |
return FAIL;
|
|
|
563 |
|
|
|
564 |
return SUCCESS;
|
|
|
565 |
}
|
|
|
566 |
|
|
|
567 |
/*Setup the vectors*/
|
|
|
568 |
ErrorCode_t LCR_CMD_SetupCustomSequencevectors(uint8 startVector, uint8 numOfvectors)
|
|
|
569 |
{
|
|
|
570 |
/* Generate packet */
|
|
|
571 |
LCR_CMD_PKT_CommandInit(LCR_CMD_PKT_TYPE_WRITE, 0x0A01);
|
|
|
572 |
LCR_CMD_PKT_PutData((uint8*)&startVector,1);
|
|
|
573 |
LCR_CMD_PKT_PutData((uint8*)&numOfvectors,1);
|
|
|
574 |
|
|
|
575 |
if(LCR_CMD_PKT_SendCommand())
|
|
|
576 |
return FAIL;
|
|
|
577 |
|
|
|
578 |
return SUCCESS;
|
|
|
579 |
}
|