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