]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/Driver/src/VIO.txt
VIO initial documentation added; more work on the header file for easy documentation.
[cmsis] / CMSIS / DoxyGen / Driver / src / VIO.txt
1 /**
2 \defgroup vio_interface_gr VIO
3 \brief API for Virtual I/O (VIO) (%cmsis_vio.h)
4 \details 
5
6 The VIO software component is a virtual I/O abstraction for peripherals that are typically used in example projects.
7
8 <b>VIO API</b>
9
10 The following header file defines the Application Programming Interface (API) for VIO:
11   - \b %cmsis_vio.h : API for VIO
12
13 <b>VIO User Code Templates</b>
14
15 The VIO software component contains two user code templates wit different purposes:
16   - VIO:Custom: This file is an empty stub with all functions that are defined in the header file that can be used to
17     implement the VIO layer for the hardware that is used in the application.
18   - VIO:Virtual:  This file uses a fixed memory location to emulate the VIO functionality and can be used off-the-shelf.
19
20 Both templates come with an SCVD file that is used to display the VIO signals in Component Viewer:
21
22 \image html vioComponentViewer.png
23
24 @{
25 */
26
27 /**
28 \defgroup cvDefines_gr  Defines and Structs
29 \ingroup vio_interface_gr
30 \brief Documents the defines and structs of the VIO API.
31 \details
32 @{
33     Test.
34 */
35
36 /**
37 \defgroup cvSignals_gr  Signals
38 \ingroup cvDefines_gr
39 \brief Signal related defines.
40 \details
41 @{
42 \def cvLED0
43 \def cvLED1
44 \def cvLED2
45 \def cvLED3
46 \def cvLED4
47 \def cvLED5
48 \def cvLED6
49 \def cvLED7
50 \def cvLEDon
51 \def cvLEDoff
52 \def cvBUTTON0  
53 \def cvBUTTON1  
54 \def cvBUTTON2  
55 \def cvBUTTON3  
56 \def cvJOYup    
57 \def cvJOYdown  
58 \def cvJOYleft  
59 \def cvJOYright 
60 \def cvJOYselect
61 \def cvJOYall   
62 @}
63 */
64
65 /**
66 \defgroup cvValues_gr  Values
67 \ingroup cvDefines_gr
68 \brief Value related defines.
69 \details
70 @{
71 \def cvAIN0 
72 \def cvAIN1 
73 \def cvAIN2 
74 \def cvAIN3 
75 \def cvAOUT0
76 /** 
77 \struct     cvValueXYZ_t
78 \details
79 Structure holding three-dimensional values for gyroscopes, accelerometers, etc.
80
81 <b>Parameter for:</b>
82   - \ref cvGetXYZ
83   - \ref cvSetXYZ
84 ***************************************************************************************************************************/
85 @}
86 */
87
88 /**
89 \defgroup cvIDs_gr  IDs
90 \ingroup cvDefines_gr
91 \brief ID related defines.
92 \details
93 @{
94 \def cvAIN0 
95 \def cvAIN1 
96 \def cvAIN2 
97 \def cvAIN3 
98 \def cvAOUT0
99 \def cvMotionGyro    
100 \def cvMotionAccelero
101 \def cvMotionMagneto 
102 @}
103 */
104
105 /**
106 \defgroup cvPrintLevels_gr  Print Levels
107 \ingroup cvDefines_gr
108 \brief Print level related defines.
109 \details
110 @{
111 \def cvLevelNone   
112 \def cvLevelHeading
113 \def cvLevelMessage
114 \def cvLevelError
115 @}
116 */
117
118 /**
119 \defgroup cvIPAddr_gr  IP Addresses
120 \ingroup cvDefines_gr
121 \brief IP address related structs.
122 \details
123 @{
124 \struct     cvAddrIPv4_t
125 \details
126 Structure holding IPv4 addresses.
127
128 <b>Parameter for:</b>
129   - \ref cvGetIPv4
130   - \ref cvSetIPv4
131
132 \struct     cvAddrIPv6_t
133 \details
134 Structure holding IPv6 addresses.
135
136 <b>Parameter for:</b>
137   - \ref cvGetIPv6
138   - \ref cvSetIPv6
139 @}
140 */
141
142 /**
143 @}
144 */
145 // end group cvDefines_gr
146
147
148
149 void cvInit (void) {};
150 /**
151 \fn void cvInit (void)
152 \details
153 The function \b cvInit initializes the VIO interface. Use it to initialize any connected hardware that is used to
154 map VIO signals. 
155
156 \b Code \b Example:
157 \code
158 void cvInit (void) {
159
160   BSP_LED_Init(LED_BLUE);
161   BSP_LED_Init(LED_RED);
162   BSP_LED_Init(LED_GREEN);
163   BSP_PB_Init(BUTTON_USER, BUTTON_MODE_GPIO);
164 }
165 \endcode
166 ***************************************************************************************************************************/
167
168 int32_t cvPrint (uint32_t level, const char *format, ...) {
169   return (0);
170 };
171 /**
172 \fn int32_t cvPrint (uint32_t level, const char *format, ...)
173 \details
174 The function \b cvPrint prints a formatted string to a test terminal. Formatting of the output follows the rulse od standard
175 C language printf().
176
177 Refer to \ref cvPrintLevels_gr for information about the possible \a levels.
178
179 \b Code \b Example:
180 \code
181 int32_t cvPrint (uint32_t level, const char *format, ...) {
182   va_list args;
183   int32_t ret = -1;
184  
185   if (level > cvLevelError) {
186     return (-1);
187   }
188  
189   if (level > CV_PRINTMEM_NUM) {
190     return (-1);
191   }
192  
193   va_start(args, format);
194  
195   ret = vsnprintf((char *)cvPrintMem[level], sizeof(cvPrintMem[level]), format, args);
196  
197   switch (level) {
198     case cvLevelNone:
199       GUI_SetFont(&Font12);
200       GUI_SetTextColor(GUI_COLOR_WHITE);
201       displayString (level, (char *)cvPrintMem[level]);
202       break;
203     case cvLevelHeading:
204       GUI_SetFont(&Font16);
205       GUI_SetTextColor(GUI_COLOR_GREEN);
206       displayString (level, (char *)cvPrintMem[level]);
207       break;
208     case cvLevelMessage:
209       GUI_SetFont(&Font12);
210       GUI_SetTextColor(GUI_COLOR_BLUE);
211       displayString (level, (char *)cvPrintMem[level]);
212       break;
213     case cvLevelError:
214       GUI_SetFont(&Font12);
215       GUI_SetTextColor(GUI_COLOR_RED);
216       displayString (level, (char *)cvPrintMem[level]);
217       break;
218   }
219       GUI_SetFont(&Font12);
220       GUI_SetTextColor(GUI_COLOR_DARKBLUE);
221  
222   va_end(args);
223  
224   return (ret);
225 }
226 \endcode
227 ***************************************************************************************************************************/
228
229 int32_t cvGetChar (void) {
230   return (0);
231 };
232 /**
233 \fn int32_t cvGetChar (void)
234 \details
235 The function \b cvGetChar retrieves a charater from the test terminal. Use this function to get data for further processing
236 in your application.
237
238 \b Code \b Example:
239 \code
240 // todo
241 \endcode
242 ***************************************************************************************************************************/
243
244 void cvSetSignal (uint32_t mask, uint32_t signal) {};
245 /**
246 \fn void cvSetSignal (uint32_t mask, uint32_t signal)
247 \details
248 The function \b cvSetSignal set a \a signal to an output specified by \a mask. Use this function to map VIOs to actual
249 hardware for displaying signals on a target board.
250
251 Refer to \ref cvSignals_gr for information about the possible \a mask and \a signal values.
252
253 \b Code \b Example:
254 \code
255 void cvSetSignal (uint32_t mask, uint32_t signal) {
256   cvSignalOut &= ~mask;
257   cvSignalOut |=  mask & signal;
258  
259   if (mask & cvLED0) {
260     if (signal & cvLED0) {
261       BSP_LED_On(LED_RED);
262     } else {
263       BSP_LED_Off(LED_RED);
264     }
265   }
266  
267   if (mask & cvLED1) {
268     if (signal & cvLED1) {
269       BSP_LED_On(LED_GREEN);
270     } else {
271       BSP_LED_Off(LED_GREEN);
272     }
273   }
274  
275   if (mask & cvLED2) {
276     if (signal & cvLED2) {
277       BSP_LED_On(LED_BLUE);
278     } else {
279       BSP_LED_Off(LED_BLUE);
280     }
281   }
282   return;
283 }
284 \endcode
285 ***************************************************************************************************************************/
286
287 uint32_t cvGetSignal (uint32_t mask) {
288   return (0);
289 };
290 /**
291 \fn uint32_t cvGetSignal (uint32_t mask)
292 \details
293 The function \b cvGetSignal retrieves a signal from an input identified by \a mask. Use this function to read data from any
294 input that is provided.
295
296 Refer to \ref cvSignals_gr for information about the possible \a mask values.
297
298 \b Code \b Example:
299 \code
300 // todo
301 \endcode
302 ***************************************************************************************************************************/
303
304 void cvSetValue (uint32_t id, int32_t value) {};
305 /**
306 \fn void cvSetValue (uint32_t id, int32_t value)
307 \details
308 The function \b cvSetValue set the \a value to the output identified by \a id. Use this function to set states of I/Os for
309 example.
310
311 Refer to \ref cvValues_gr for information about \a value and \ref cvIDs_gr for \a id.
312
313 \b Code \b Example:
314 \code
315 // todo
316 \endcode
317 ***************************************************************************************************************************/
318
319 int32_t cvGetValue (uint32_t id) {
320   return (0);
321 };
322 /**
323 \fn int32_t cvGetValue (uint32_t id)
324 \details
325 The function \b cvGetValue retrieves a value from the input identified by \a id. Use this function to read data from inputs.
326
327 Refer to \ref cvIDs_gr for information about \a id.
328
329 \b Code \b Example:
330 \code
331 // todo
332 \endcode
333 ***************************************************************************************************************************/
334
335 void cvSetXYZ (uint32_t id, cvValueXYZ_t valueXYZ) {
336   return (0);
337 };
338 /**
339 \fn void cvSetXYZ (uint32_t id, cvValueXYZ_t valueXYZ)
340 \details
341 The function \b cvSetXYZ sets a three-dimensional value \a valueXYZ to the output identified by \a id. Use this function to
342 apply a 3d value to an output.
343
344 Refer to \ref cvValues_gr for information about the \a valueXYZ and \ref cvIDs_gr for \a id.
345
346 \b Code \b Example:
347 \code
348 // todo
349 \endcode
350 ***************************************************************************************************************************/
351
352 cvValueXYZ_t cvGetXYZ (uint32_t id) {
353   return (0);
354 };
355 /**
356 \fn cvValueXYZ_t cvGetXYZ (uint32_t id)
357 \details
358 The function \b cvGetXYZ retrieves a three-dimensional value from the input identified by \a id. Use this function to get a
359 3d value.
360
361 Refer to \ref cvIDs_gr for information about \a id.
362
363 \b Code \b Example:
364 \code
365 cvValueXYZ_t cvGetXYZ (uint32_t id) {
366   uint32_t index;
367   cvValueXYZ_t valueXYZ = {0, 0, 0};
368   BSP_MOTION_SENSOR_Axes_t axes;
369  
370   index = id;
371   if (index >= CV_VALUE_NUM) {
372     return valueXYZ;                   /* return default in case of out-of-range index */
373   }
374  
375   if (index == 0U) {
376     if (BSP_MOTION_SENSOR_GetAxes(0, MOTION_ACCELERO, &axes) == BSP_ERROR_NONE)
377     {
378       cvValueXYZ[index].X = axes.x;
379       cvValueXYZ[index].Y = axes.y;
380       cvValueXYZ[index].Z = axes.z;
381     }
382   }
383  
384   if (index == 1U) {
385     if (BSP_MOTION_SENSOR_GetAxes(0, MOTION_GYRO, &axes) == BSP_ERROR_NONE)
386     {
387       cvValueXYZ[index].X = axes.x;
388       cvValueXYZ[index].Y = axes.y;
389       cvValueXYZ[index].Z = axes.z;
390     }
391   }
392  
393   valueXYZ = cvValueXYZ[index];
394  
395   return valueXYZ;
396 }
397 \endcode
398 ***************************************************************************************************************************/
399
400 void cvSetIPv4 (uint32_t id, cvAddrIPv4_t addrIPv4) {};
401 /**
402 \fn void cvSetIPv4 (uint32_t id, cvAddrIPv4_t addrIPv4)
403 \details
404 The function \b cvSetIPv4 sets an IPv4 address specified by \a addrIPv4 to an interface identified by \a id. Use this
405 function to assign an IPv4 address to an interface.
406
407 Refer to \ref cvIDs_gr for information about \a id and \ref cvIPAddr_gr for \a addrIPv4.
408
409 \b Code \b Example:
410 \code
411 // todo
412 \endcode
413 ***************************************************************************************************************************/
414
415 cvAddrIPv4_t cvGetIPv4 (uint32_t id) {
416   return (0);
417 };
418 /**
419 \fn cvAddrIPv4_t cvGetIPv4 (uint32_t id)
420 \details
421 The function \b cvGetIPv4 retrieves the IPv4 addrIPv4 from an interface identified by \a id. Use this function to read an
422 IPv4 address.
423
424 Refer to \ref cvIDs_gr for information about \a id.
425
426 \b Code \b Example:
427 \code
428 // todo
429 \endcode
430 ***************************************************************************************************************************/
431
432 void cvSetIPv6 (uint32_t id, cvAddrIPv6_t addrIPv6) {};
433 /**
434 \fn void cvSetIPv6 (uint32_t id, cvAddrIPv6_t addrIPv6)
435 \details
436 The function \b cvSetIPv6 sets an IPv6 address specified by \a addrIPv6 to an interface identified by \a id. Use this
437 function to assign an IPv6 address to an interface.
438
439 Refer to \ref cvIDs_gr for information about \a id and \ref cvIPAddr_gr for \a addrIPv6.
440
441 \b Code \b Example:
442 \code
443 // todo
444 \endcode
445 ***************************************************************************************************************************/
446
447 cvAddrIPv6_t cvGetIPv6 (uint32_t id) {
448   return (0);
449 };
450 /**
451 \fn cvAddrIPv6_t cvGetIPv6 (uint32_t id)
452 \details
453 The function \b cvGetIPv6 retrieves the IPv6 addrIPv6 from an interface identified by \a id. Use this function to read an
454 IPv6 address.
455
456 Refer to \ref cvIDs_gr for information about \a id.
457
458 \b Code \b Example:
459 \code
460 // todo
461 \endcode
462 ***************************************************************************************************************************/
463
464 /**
465 @}
466 */
467 // End VIO Interface