2 \defgroup vio_interface_gr VIO
3 \brief API for Virtual I/O (VIO) (%cmsis_vio.h)
6 The VIO software component is a virtual I/O abstraction for peripherals that are typically used in example projects.
10 The following header file defines the Application Programming Interface (API) for VIO:
11 - \b %cmsis_vio.h : API for VIO
13 <b>VIO User Code Templates</b>
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.
20 Both templates come with an SCVD file that is used to display the VIO signals in Component Viewer:
22 \image html vioComponentViewer.png
28 \defgroup cvDefines_gr Defines and Structs
29 \ingroup vio_interface_gr
30 \brief Documents the defines and structs of the VIO API.
37 \defgroup cvSignals_gr Signals
39 \brief Signal related defines.
66 \defgroup cvValues_gr Values
68 \brief Value related defines.
79 Structure holding three-dimensional values for gyroscopes, accelerometers, etc.
84 ***************************************************************************************************************************/
89 \defgroup cvIDs_gr IDs
91 \brief ID related defines.
100 \def cvMotionAccelero
106 \defgroup cvPrintLevels_gr Print Levels
107 \ingroup cvDefines_gr
108 \brief Print level related defines.
119 \defgroup cvIPAddr_gr IP Addresses
120 \ingroup cvDefines_gr
121 \brief IP address related structs.
126 Structure holding IPv4 addresses.
128 <b>Parameter for:</b>
134 Structure holding IPv6 addresses.
136 <b>Parameter for:</b>
145 // end group cvDefines_gr
149 void cvInit (void) {};
151 \fn void cvInit (void)
153 The function \b cvInit initializes the VIO interface. Use it to initialize any connected hardware that is used to
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);
166 ***************************************************************************************************************************/
168 int32_t cvPrint (uint32_t level, const char *format, ...) {
172 \fn int32_t cvPrint (uint32_t level, const char *format, ...)
174 The function \b cvPrint prints a formatted string to a test terminal. Formatting of the output follows the rulse od standard
177 Refer to \ref cvPrintLevels_gr for information about the possible \a levels.
181 int32_t cvPrint (uint32_t level, const char *format, ...) {
185 if (level > cvLevelError) {
189 if (level > CV_PRINTMEM_NUM) {
193 va_start(args, format);
195 ret = vsnprintf((char *)cvPrintMem[level], sizeof(cvPrintMem[level]), format, args);
199 GUI_SetFont(&Font12);
200 GUI_SetTextColor(GUI_COLOR_WHITE);
201 displayString (level, (char *)cvPrintMem[level]);
204 GUI_SetFont(&Font16);
205 GUI_SetTextColor(GUI_COLOR_GREEN);
206 displayString (level, (char *)cvPrintMem[level]);
209 GUI_SetFont(&Font12);
210 GUI_SetTextColor(GUI_COLOR_BLUE);
211 displayString (level, (char *)cvPrintMem[level]);
214 GUI_SetFont(&Font12);
215 GUI_SetTextColor(GUI_COLOR_RED);
216 displayString (level, (char *)cvPrintMem[level]);
219 GUI_SetFont(&Font12);
220 GUI_SetTextColor(GUI_COLOR_DARKBLUE);
227 ***************************************************************************************************************************/
229 int32_t cvGetChar (void) {
233 \fn int32_t cvGetChar (void)
235 The function \b cvGetChar retrieves a charater from the test terminal. Use this function to get data for further processing
242 ***************************************************************************************************************************/
244 void cvSetSignal (uint32_t mask, uint32_t signal) {};
246 \fn void cvSetSignal (uint32_t mask, uint32_t signal)
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.
251 Refer to \ref cvSignals_gr for information about the possible \a mask and \a signal values.
255 void cvSetSignal (uint32_t mask, uint32_t signal) {
256 cvSignalOut &= ~mask;
257 cvSignalOut |= mask & signal;
260 if (signal & cvLED0) {
263 BSP_LED_Off(LED_RED);
268 if (signal & cvLED1) {
269 BSP_LED_On(LED_GREEN);
271 BSP_LED_Off(LED_GREEN);
276 if (signal & cvLED2) {
277 BSP_LED_On(LED_BLUE);
279 BSP_LED_Off(LED_BLUE);
285 ***************************************************************************************************************************/
287 uint32_t cvGetSignal (uint32_t mask) {
291 \fn uint32_t cvGetSignal (uint32_t mask)
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.
296 Refer to \ref cvSignals_gr for information about the possible \a mask values.
302 ***************************************************************************************************************************/
304 void cvSetValue (uint32_t id, int32_t value) {};
306 \fn void cvSetValue (uint32_t id, int32_t value)
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
311 Refer to \ref cvValues_gr for information about \a value and \ref cvIDs_gr for \a id.
317 ***************************************************************************************************************************/
319 int32_t cvGetValue (uint32_t id) {
323 \fn int32_t cvGetValue (uint32_t id)
325 The function \b cvGetValue retrieves a value from the input identified by \a id. Use this function to read data from inputs.
327 Refer to \ref cvIDs_gr for information about \a id.
333 ***************************************************************************************************************************/
335 void cvSetXYZ (uint32_t id, cvValueXYZ_t valueXYZ) {
339 \fn void cvSetXYZ (uint32_t id, cvValueXYZ_t valueXYZ)
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.
344 Refer to \ref cvValues_gr for information about the \a valueXYZ and \ref cvIDs_gr for \a id.
350 ***************************************************************************************************************************/
352 cvValueXYZ_t cvGetXYZ (uint32_t id) {
356 \fn cvValueXYZ_t cvGetXYZ (uint32_t id)
358 The function \b cvGetXYZ retrieves a three-dimensional value from the input identified by \a id. Use this function to get a
361 Refer to \ref cvIDs_gr for information about \a id.
365 cvValueXYZ_t cvGetXYZ (uint32_t id) {
367 cvValueXYZ_t valueXYZ = {0, 0, 0};
368 BSP_MOTION_SENSOR_Axes_t axes;
371 if (index >= CV_VALUE_NUM) {
372 return valueXYZ; /* return default in case of out-of-range index */
376 if (BSP_MOTION_SENSOR_GetAxes(0, MOTION_ACCELERO, &axes) == BSP_ERROR_NONE)
378 cvValueXYZ[index].X = axes.x;
379 cvValueXYZ[index].Y = axes.y;
380 cvValueXYZ[index].Z = axes.z;
385 if (BSP_MOTION_SENSOR_GetAxes(0, MOTION_GYRO, &axes) == BSP_ERROR_NONE)
387 cvValueXYZ[index].X = axes.x;
388 cvValueXYZ[index].Y = axes.y;
389 cvValueXYZ[index].Z = axes.z;
393 valueXYZ = cvValueXYZ[index];
398 ***************************************************************************************************************************/
400 void cvSetIPv4 (uint32_t id, cvAddrIPv4_t addrIPv4) {};
402 \fn void cvSetIPv4 (uint32_t id, cvAddrIPv4_t addrIPv4)
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.
407 Refer to \ref cvIDs_gr for information about \a id and \ref cvIPAddr_gr for \a addrIPv4.
413 ***************************************************************************************************************************/
415 cvAddrIPv4_t cvGetIPv4 (uint32_t id) {
419 \fn cvAddrIPv4_t cvGetIPv4 (uint32_t id)
421 The function \b cvGetIPv4 retrieves the IPv4 addrIPv4 from an interface identified by \a id. Use this function to read an
424 Refer to \ref cvIDs_gr for information about \a id.
430 ***************************************************************************************************************************/
432 void cvSetIPv6 (uint32_t id, cvAddrIPv6_t addrIPv6) {};
434 \fn void cvSetIPv6 (uint32_t id, cvAddrIPv6_t addrIPv6)
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.
439 Refer to \ref cvIDs_gr for information about \a id and \ref cvIPAddr_gr for \a addrIPv6.
445 ***************************************************************************************************************************/
447 cvAddrIPv6_t cvGetIPv6 (uint32_t id) {
451 \fn cvAddrIPv6_t cvGetIPv6 (uint32_t id)
453 The function \b cvGetIPv6 retrieves the IPv6 addrIPv6 from an interface identified by \a id. Use this function to read an
456 Refer to \ref cvIDs_gr for information about \a id.
462 ***************************************************************************************************************************/