All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
vexlcd.h
Go to the documentation of this file.
1 /*-----------------------------------------------------------------------------*/
2 /* */
3 /* Copyright (c) James Pearman */
4 /* 2013 */
5 /* All Rights Reserved */
6 /* */
7 /*-----------------------------------------------------------------------------*/
8 /* */
9 /* Module: vexlcd.h */
10 /* Author: James Pearman */
11 /* Created: 7 May 2013 */
12 /* */
13 /* Revisions: */
14 /* V1.00 4 July 2013 - Initial release */
15 /* */
16 /*-----------------------------------------------------------------------------*/
17 /* */
18 /* This file is part of ConVEX. */
19 /* */
20 /* The author is supplying this software for use with the VEX cortex */
21 /* control system. ConVEX is free software; you can redistribute it */
22 /* and/or modify it under the terms of the GNU General Public License */
23 /* as published by the Free Software Foundation; either version 3 of */
24 /* the License, or (at your option) any later version. */
25 /* */
26 /* ConVEX is distributed in the hope that it will be useful, */
27 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
28 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
29 /* GNU General Public License for more details. */
30 /* */
31 /* You should have received a copy of the GNU General Public License */
32 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
33 /* */
34 /* A special exception to the GPL can be applied should you wish to */
35 /* distribute a combined work that includes ConVEX, without being obliged */
36 /* to provide the source code for any proprietary components. */
37 /* See the file exception.txt for full details of how and when the */
38 /* exception can be applied. */
39 /* */
40 /* The author can be contacted on the vex forums as jpearman */
41 /* or electronic mail using jbpearman_at_mac_dot_com */
42 /* Mentor for team 8888 RoboLancers, Pasadena CA. */
43 /* */
44 /*-----------------------------------------------------------------------------*/
45 
46 #ifndef __VEXLCD__
47 #define __VEXLCD__
48 
49 /*-----------------------------------------------------------------------------*/
50 /** @file vexlcd.h
51  * @brief LCD driver macros and prototypes
52 *//*---------------------------------------------------------------------------*/
53 
54 #define VEX_LCD_BACKLIGHT 0x01 ///< bit for turning backlight on
55 
56 
57 #define VEX_LCD_DISPLAY_1 0 ///< LCD display on UART1
58 #define VEX_LCD_DISPLAY_2 1 ///< LCD display on UART2
59 
60 #define VEX_LCD_LINE_1 0 ///< Upper LCD display line
61 #define VEX_LCD_LINE_2 1 ///< Lower LCD display line
62 #define VEX_LCD_LINE_T 0 ///< Upper LCD display line
63 #define VEX_LCD_LINE_B 1 ///< Lower LCD display line
64 
65 /*-----------------------------------------------------------------------------*/
66 /** @brief Holds all data for a single LCD display */
67 /*-----------------------------------------------------------------------------*/
68 typedef struct _LcdData {
69  SerialDriver *sdp;
70  short enabled;
71  unsigned char flags;
72  unsigned char buttons;
73  char line1[20];
74  char line2[20];
75  char txbuf[32];
76  char rxbuf[16];
77 } LcdData;
78 
79 typedef enum _vexLcdButton {
88 } vexLcdButton;
89 
90 #ifdef __cplusplus
91 extern "C" {
92 #endif
93 
94 // LCD interface
95 void vexLcdInit( int16_t display, SerialDriver *sdp );
96 void vexLcdSet( int16_t display, int16_t line, char *buf );
97 void vexLcdSetAt( int16_t display, int16_t line, int16_t col, char *buf );
98 void vexLcdPrintf( int16_t display, int16_t line, char *fmt, ... );
99 void vexLcdPrintfAt( int16_t display, int16_t line, int16_t col, char *fmt, ... );
100 
101 void vexLcdClearLine( int16_t display, int16_t line );
102 void vexLcdBacklight( int16_t display, int16_t value );
103 
104 vexLcdButton vexLcdButtonGet( int16_t display );
105 
106 // private
108 void vexLcdSendMessage( LcdData *lcd, int16_t line );
109 void vexLcdDebug(vexStream *chp, int argc, char *argv[]);
110 
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif // __VEXLCD__