xref: /btstack/port/archive/msp-exp430f5438-cc2564b/firmware/hal_lcd.h (revision 1664436fd643daf66517dc309e6cc72448e8a86d)
1 /*******************************************************************************
2     Filename: hal_lcd.h
3 
4     Copyright 2008 Texas Instruments, Inc.
5 ***************************************************************************/
6 #ifndef HAL_LCD_H
7 #define HAL_LCD_H
8 
9 #ifndef MIN
10 #define MIN(n,m)   (((n) < (m)) ? (n) : (m))
11 #endif
12 
13 #ifndef MAX
14 #define MAX(n,m)   (((n) < (m)) ? (m) : (n))
15 #endif
16 
17 #ifndef ABS
18 #define ABS(n)     (((n) < 0) ? -(n) : (n))
19 #endif
20 
21 #define LCD_COMM_OUT        P8OUT
22 #define LCD_COMM_DIR        P8DIR
23 #define LCD_COMM_SEL        P8SEL
24 #define LCD_BACKLIGHT_PIN   BIT3
25 
26 #ifdef REV_02
27   #define LCD_CS_RST_DIR      LCD_COMM_DIR
28   #define LCD_CS_RST_OUT      LCD_COMM_OUT
29   #define LCD_CS_PIN          BIT1
30   #define LCD_RESET_PIN       BIT2
31 #else
32   #define LCD_CS_RST_DIR      P9DIR
33   #define LCD_CS_RST_OUT      P9OUT
34   #define LCD_CS_PIN          BIT6
35   #define LCD_RESET_PIN       BIT7
36 #endif
37 
38 #define LCD_ROW                 110
39 #define LCD_COL                 138
40 #define LCD_Size                3505
41 #define LCD_MEM_Size            110*17
42 #define LCD_Max_Column_Offset   0x10
43 
44 #define LCD_Last_Pixel          3505
45 
46 #define LCD_MEM_Row             0x11
47 #define LCD_Row                 0x20
48 
49 // Grayscale level definitions
50 #define PIXEL_OFF               0
51 #define PIXEL_LIGHT             1
52 #define PIXEL_DARK              2
53 #define PIXEL_ON                3
54 
55 #define INVERT_TEXT             BIT0
56 #define OVERWRITE_TEXT          BIT2
57 
58 /*-------------------------------------------------------------
59  *                  Function Prototypes
60  * ------------------------------------------------------------*/
61 void halLcdInit(void);
62 void halLcdShutDown(void);
63 void halLcdBackLightInit(void);
64 void halLcdSetBackLight(unsigned char BackLightLevel);
65 unsigned int halLcdGetBackLight(void);
66 void halLcdShutDownBackLight(void);
67 void halLcdSendCommand(unsigned char Data[]) ;
68 void halLcdSetContrast(unsigned char ContrastLevel);
69 unsigned char halLcdGetContrast(void);
70 void halLcdStandby(void);
71 void halLcdActive(void);
72 
73 //Move to specified LCD address
74 void halLcdSetAddress(int Address);
75 
76 //Draw at current segment location
77 void halLcdDrawCurrentBlock(unsigned int Value);
78 
79 //Draw at specified location by calling
80 //LCD_Set_Address(Address) & LCD_Draw_Current_Block( value )
81 void halLcdDrawBlock(unsigned int Address, unsigned int Value);
82 
83 //Read value from LCD CGRAM
84 int halLcdReadBlock(unsigned int Address);
85 
86 //Clear LCD Screen
87 void halLcdClearScreen(void);
88 
89 //Invert black to white and vice versa
90 void halLcdReverse(void);
91 
92 // Draw a Pixel @ (x,y) with GrayScale level
93 void halLcdPixel(  int x,  int y, unsigned char GrayScale);
94 //Draw Line from (x1,y1) to (x2,y2) with GrayScale level
95 void halLcdLine(  int x1,  int y1,  int x2,  int y2, unsigned char GrayScale);
96 
97 void halLcdCircle(int x, int y, int Radius, int GrayScale);
98 
99 void halLcdImage(const unsigned int Image[], int Columns, int Rows, int x, int y);
100 void halLcdClearImage(int Columns, int Rows,  int x, int y);
101 
102 //Print String of Length starting at current LCD location
103 void halLcdPrint( char String[], unsigned char TextStyle) ;
104 
105 //Print String of Length starting at (x,y)
106 void halLcdPrintXY(char String[], int x, int y, unsigned char TextStyle);
107 
108 //Print String of Length starting at (x,y)
109 void halLcdPrintLine(char String[], unsigned char Line, unsigned char TextStyle);
110 void halLcdPrintLineCol(char String[], unsigned char Line, unsigned char Col, unsigned char TextStyle);
111 
112 void halLcdCursor(void);
113 void halLcdCursorOff(void);
114 //Scroll a single row of pixels
115 void halLcdScrollRow(int y);
116 //Scroll a number of consecutive rows from yStart to yEnd
117 void halLcdHScroll(int yStart, int yEnd);
118 //Scroll a line of text
119 void halLcdScrollLine(int Line);
120 
121 #endif
122