SimpleLink MCU SDK Driver APIs  tidrivers_msp43x_3_01_01_03
Display.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
187 #ifndef ti_display_Display__include
188 #define ti_display_Display__include
189 
190 #ifdef __cplusplus
191 extern "C" {
192 #endif
193 
194 #include <stdint.h>
195 #include <stdarg.h>
196 
197 /* -----------------------------------------------------------------------------
198  * Constants
199  * ------------------------------------------------------------------------------
200  */
209 #define Display_Type_ANY 0xFFFFFFFF
210 #define Display_Type_INVALID 0x00000000
211 #define Display_Type_LCD 0x80000000
212 #define Display_Type_UART 0x40000000
213 #define Display_Type_LOG 0x20000000
214 #define Display_Type_ITM 0x10000000
215 #define Display_Type_HOST 0x08000000
216 #define Display_Type_ANSI 0x04000000
217 #define Display_Type_GRLIB 0x00100000
221 #define Display_MAXINDEX 15
222 
240 #define DISPLAY_CMD_RESERVED 32
241 
254 #define DISPLAY_STATUS_RESERVED -32
255 
269 #define DISPLAY_STATUS_SUCCESS 0
270 
277 #define DISPLAY_STATUS_ERROR -1
278 
286 #define DISPLAY_STATUS_UNDEFINEDCMD -2
287 
307 #define DISPLAY_CMD_TRANSPORT_CLOSE 0
308 
317 #define DISPLAY_CMD_TRANSPORT_OPEN 1
318 
322 /* -----------------------------------------------------------------------------
323  * Macros
324  * ------------------------------------------------------------------------------
325  */
326 #define Display_clearLine(handle, n) Display_clearLines(handle, n, 0)
327 #define Display_isIndex(i) (i <= Display_MAXINDEX)
328 #define Display_isMetaType(i) (i > Display_MAXINDEX)
329 
330 #if !defined(Display_DISABLE_ALL) || (!Display_DISABLE_ALL)
331 
333 # define Display_init() \
334  Display_doInit()
335 
337 # define Display_open(id, params) \
338  Display_doOpen(id, params)
339 
341 # define Display_Params_init(params) \
342  Display_doParamsInit(params)
343 
345 # define Display_clear(handle) \
346  Display_doClear(handle)
347 
349 # define Display_clearLines(handle, fromLine, toLine) \
350  Display_doClearLines(handle, fromLine, toLine)
351 
353 # define Display_printf Display_doPrintf
354 
356 # define Display_print0(handle, line, col, fmt) \
357  Display_printf(handle, line, col, fmt)
358 
360 # define Display_print1(handle, line, col, fmt, a0) \
361  Display_printf(handle, line, col, fmt, a0)
362 
364 # define Display_print2(handle, line, col, fmt, a0, a1) \
365  Display_printf(handle, line, col, fmt, a0, a1)
366 
368 # define Display_print3(handle, line, col, fmt, a0, a1, a2) \
369  Display_printf(handle, line, col, fmt, a0, a1, a2)
370 
372 # define Display_print4(handle, line, col, fmt, a0, a1, a2, a3) \
373  Display_printf(handle, line, col, fmt, a0, a1, a2, a3)
374 
376 # define Display_print5(handle, line, col, fmt, a0, a1, a2, a3, a4) \
377  Display_printf(handle, line, col, fmt, a0, a1, a2, a3, a4)
378 
380 # define Display_getType(handle) \
381  Display_doGetType(handle)
382 
384 # define Display_control(handle, cmd, arg) \
385  Display_doControl(handle, cmd, arg)
386 
388 # define Display_close(handle) \
389  Display_doClose(handle)
390 #else
391 # define Display_init()
392 # define Display_open(id, params) NULL
393 # define Display_Params_init(params)
394 # define Display_clear(handle)
395 # define Display_clearLines(handle, fromLine, toLine)
396 # define Display_printf(handle, line, col, fmt, ...)
397 # define Display_print0(handle, line, col, fmt)
398 # define Display_print1(handle, line, col, fmt, a0)
399 # define Display_print2(handle, line, col, fmt, a0, a1)
400 # define Display_print3(handle, line, col, fmt, a0, a1, a2)
401 # define Display_print4(handle, line, col, fmt, a0, a1, a2, a3)
402 # define Display_print5(handle, line, col, fmt, a0, a1, a2, a3, a4)
403 # define Display_getType(handle) Display_Type_INVALID
404 # define Display_control(handle, cmd, arg) NULL
405 # define Display_close(handle)
406 #endif
407 
408 /* -----------------------------------------------------------------------------
409  * Typedefs
410  * ------------------------------------------------------------------------------
411  */
416 
421 typedef void (*Display_initFxn)(Display_Handle handle);
422 
427 {
433 
442 typedef struct Display_Params
443 {
444  Display_LineClearMode lineClearMode; /* Default clear entire line */
446 
451 typedef Display_Handle (*Display_openFxn)(Display_Handle handle,
452  Display_Params *params);
457 typedef void (*Display_clearFxn)(Display_Handle handle);
458 
463 typedef void (*Display_clearLinesFxn)(Display_Handle handle,
464  uint8_t fromLine,
465  uint8_t toLine);
466 
471 typedef void (*Display_vprintfFxn)(Display_Handle handle,
472  uint8_t line,
473  uint8_t column,
474  char *fmt,
475  va_list va);
476 
482 
487 typedef int (*Display_controlFxn)(Display_Handle handle,
488  unsigned int cmd,
489  void *arg);
494 typedef unsigned int (*Display_getTypeFxn)(void);
495 
501 typedef struct Display_FxnTable
502 {
512 
524 typedef struct Display_Config
525 {
528 
530  void *object;
531 
533  void const *hwAttrs;
535 
536 
537 /* -----------------------------------------------------------------------------
538  * Functions
539  * ------------------------------------------------------------------------------
540  */
571 Display_Handle Display_doOpen(uint32_t id, Display_Params *params);
572 
581 
589 void Display_doClear(Display_Handle handle);
590 
600 void Display_doClearLines(Display_Handle handle, uint8_t fromLine, uint8_t toLine);
601 
613 void Display_doPrintf(Display_Handle handle, uint8_t line, uint8_t column,
614  char *fmt, ...);
615 
621 void Display_doClose(Display_Handle handle);
622 
629 uint32_t Display_doGetType(Display_Handle handle);
630 
666 void Display_doControl(Display_Handle handle, unsigned int cmd, void *arg);
667 
675 void Display_doInit(void);
676 
677 #ifdef __cplusplus
678 }
679 #endif
680 
681 #endif //ti_display_Display__include
void Display_doClose(Display_Handle handle)
Closes selected Display implementations.
Display_vprintfFxn vprintfFxn
Definition: Display.h:507
struct Display_Config * Display_Handle
A handle for specific Display implementations.
Definition: Display.h:415
struct Display_Config Display_Config
Display Global configuration.
void(* Display_clearLinesFxn)(Display_Handle handle, uint8_t fromLine, uint8_t toLine)
A function pointer to a specific implementation of Display_clearLines().
Definition: Display.h:463
void Display_doParamsInit(Display_Params *params)
Initializes parameter structure with default parameters.
void * object
Definition: Display.h:530
void Display_doInit(void)
Function to initializes the Display driver.
Display_Handle(* Display_openFxn)(Display_Handle handle, Display_Params *params)
A function pointer to a specific implementation of Display_open().
Definition: Display.h:451
unsigned int(* Display_getTypeFxn)(void)
A function pointer to a specific implementation of Display_getType().
Definition: Display.h:494
void Display_doClear(Display_Handle handle)
Calls the clear fxn of all opened Display implementations.
Display Parameters.
Definition: Display.h:442
void const * hwAttrs
Definition: Display.h:533
uint32_t Display_doGetType(Display_Handle handle)
Gets the type of display for the handle.
Definition: Display.h:428
void Display_doControl(Display_Handle handle, unsigned int cmd, void *arg)
Function performs implementation specific features on a given Display_Handle.
Display_clearFxn clearFxn
Definition: Display.h:505
Display_controlFxn controlFxn
Definition: Display.h:509
void(* Display_vprintfFxn)(Display_Handle handle, uint8_t line, uint8_t column, char *fmt, va_list va)
A function pointer to a specific implementation of Display_vprintf().
Definition: Display.h:471
void Display_doPrintf(Display_Handle handle, uint8_t line, uint8_t column, char *fmt,...)
Calls the output function of all opened Display implementations.
void(* Display_clearFxn)(Display_Handle handle)
A function pointer to a specific implementation of Display_clear().
Definition: Display.h:457
Display_initFxn initFxn
Definition: Display.h:503
Definition: Display.h:430
The definition of a Display function table that contains the required set of functions to control a s...
Definition: Display.h:501
Display_openFxn openFxn
Definition: Display.h:504
void(* Display_initFxn)(Display_Handle handle)
A function pointer to a specific implementation of Display_initFxn().
Definition: Display.h:421
Definition: Display.h:429
Display_getTypeFxn getTypeFxn
Definition: Display.h:510
void Display_doClearLines(Display_Handle handle, uint8_t fromLine, uint8_t toLine)
Calls the clearLines fxn of all opened Display implementations.
struct Display_FxnTable Display_FxnTable
The definition of a Display function table that contains the required set of functions to control a s...
Display_LineClearMode lineClearMode
Definition: Display.h:444
Display_Handle Display_doOpen(uint32_t id, Display_Params *params)
Initialize all the selected Display implementations.
Display Global configuration.
Definition: Display.h:524
struct Display_Params Display_Params
Display Parameters.
Display_FxnTable const * fxnTablePtr
Definition: Display.h:527
int(* Display_controlFxn)(Display_Handle handle, unsigned int cmd, void *arg)
A function pointer to a driver specific implementation of Display_control().
Definition: Display.h:487
Display_closeFxn closeFxn
Definition: Display.h:508
Display_LineClearMode
How to treat existing elements on a line when writing text.
Definition: Display.h:426
Definition: Display.h:431
Display_clearLinesFxn clearLinesFxn
Definition: Display.h:506
void(* Display_closeFxn)(Display_Handle)
A function pointer to a specific implementation of Display_close().
Definition: Display.h:481
Copyright 2016, Texas Instruments Incorporated