MSPM0_ValvanoWare  1.0
ECE445L starter code
LCD.h
Go to the documentation of this file.
1 
51 // J1 J3 J4 J2
52 // [ 1] [21] [40] [20]
53 // [ 2] [22] [39] [19]
54 // [ 3] [23] [38] [18]
55 // [ 4] [24] [37] [17]
56 // [ 5] [25] [36] [16]
57 // [ 6] [26] [35] [15]
58 // [ 7] [27] [34] [14]
59 // [ 8] [28] [33] [13]
60 // [ 9] [29] [32] [12]
61 // [10] [30] [31] [11]
62 
63 // Connected pins in physical order
64 // J1.1 +3.3V (power)
65 // J1.2 joystick horizontal (X) (analog) {TM4C123 PB5/AIN11, MSP432 P6.0}
66 // J1.3 UART from Bluetooth to LaunchPad (UART) {TM4C123 PB0, MSP432 P3.2}
67 // J1.4 UART from LaunchPad to Bluetooth (UART) {TM4C123 PB1, MSP432 P3.3}
68 // J1.5 joystick Select button (digital) {TM4C123 PE4, MSP432 P4.1}
69 // J1.6 microphone (analog) {TM4C123 PE5/AIN8, MSP432 P4.3}
70 // J1.7 LCD SPI clock (SPI) {TM4C123 PB4, MSP432 P1.5}
71 // J1.8 ambient light (OPT3001) interrupt (digital) {TM4C123 PA5, MSP432 P4.6}
72 // J1.9 ambient light (OPT3001) and temperature sensor (TMP006) I2C SCL (I2C) {TM4C123 PA6, MSP432 P6.5}
73 // J1.10 ambient light (OPT3001) and temperature sensor (TMP006) I2C SDA (I2C) {TM4C123 PA7, MSP432 P6.4}
74 //--------------------------------------------------
75 // J2.11 temperature sensor (TMP006) interrupt (digital) {TM4C123 PA2, MSP432 P3.6}
76 // J2.12 nothing {TM4C123 PA3, MSP432 P5.2}
77 // J2.13 LCD SPI CS (SPI) {TM4C123 PA4, MSP432 P5.0}
78 // J2.14 nothing {TM4C123 PB6, MSP432 P1.7}
79 // J2.15 LCD SPI data (SPI) {TM4C123 PB7, MSP432 P1.6}
80 // J2.16 nothing (reset)
81 // J2.17 LCD !RST (digital) {TM4C123 PF0, MSP432 P5.7}
82 // J2.18 Profile 4 {TM4C123 PE0, MSP432 P3.0}
83 // J2.19 servo PWM {TM4C123 PB2, MSP432 P2.5}
84 // J2.20 GND (ground)
85 //--------------------------------------------------
86 // J3.21 +5V (power)
87 // J3.22 GND (ground)
88 // J3.23 accelerometer X (analog) {TM4C123 PD0/AIN7, MSP432 P6.1}
89 // J3.24 accelerometer Y (analog) {TM4C123 PD1/AIN6, MSP432 P4.0}
90 // J3.25 accelerometer Z (analog) {TM4C123 PD2/AIN5, MSP432 P4.2}
91 // J3.26 joystick vertical (Y) (analog) {TM4C123 PD3/AIN4, MSP432 P4.4}
92 // J3.27 Profile 0 {TM4C123 PE1, MSP432 P4.5}
93 // J3.28 Profile 1 {TM4C123 PE2, MSP432 P4.7}
94 // J3.29 Profile 2 {TM4C123 PE3, MSP432 P5.4}
95 // J3.30 Profile 3 {TM4C123 PF1, MSP432 P5.5}
96 //--------------------------------------------------
97 // J4.31 LCD RS (digital) {TM4C123 PF4, MSP432 P3.7}
98 // J4.32 user Button2 (bottom) (digital) {TM4C123 PD7, MSP432 P3.5}
99 // J4.33 user Button1 (top) (digital) {TM4C123 PD6, MSP432 P5,1}
100 // J4.34 Profile 6/gator hole switch {TM4C123 PC7, MSP432 P2.3}
101 // J4.35 nothing {TM4C123 PC6, MSP432 P6.7}
102 // J4.36 Profile 5 {TM4C123 PC5, MSP432 P6.6}
103 // J4.37 RGB LED blue (PWM) {TM4C123 PC4, MSP432 P5.6}
104 // J4.38 RGB LED green (PWM) {TM4C123 PB3, MSP432 P2.4}
105 // J4.39 RGB LED red (jumper up) or LCD backlight (jumper down) (PWM) {TM4C123 PF3, MSP432 P2.6}
106 // J4.40 buzzer (PWM) {TM4C123 PF2, MSP432 P2.7}
107 //--------------------------------------------------
108 // Connected pins in logic order
109 // power and reset
110 // J1.1 +3.3V (power)
111 // J3.21 +5V (power)
112 // J3.22 GND (ground)
113 // J2.20 GND (ground)
114 // J2.16 nothing (reset)
115 //--------------------------------------------------
116 // LCD graphics
117 // J1.7 LCD SPI clock (SPI) {TM4C123 PB4, MSP432 P1.5}
118 // J2.13 LCD SPI CS (SPI) {TM4C123 PA4, MSP432 P5.0}
119 // J2.15 LCD SPI data (SPI) {TM4C123 PB7, MSP432 P1.6}
120 // J2.17 LCD !RST (digital) {TM4C123 PF0, MSP432 P5.7}
121 // J4.31 LCD RS (digital) {TM4C123 PF4, MSP432 P3.7}
122 //--------------------------------------------------
123 // 3-color LED
124 // J4.37 RGB LED blue (PWM) {TM4C123 PC4, MSP432 P5.6}
125 // J4.38 RGB LED green (PWM) {TM4C123 PB3, MSP432 P2.4}
126 // J4.39 RGB LED red (jumper up) or LCD backlight (jumper down) (PWM) {TM4C123 PF3, MSP432 P2.6}
127 //--------------------------------------------------
128 // user buttons
129 // J4.32 user Button2 (bottom) (digital) {TM4C123 PD7, MSP432 P3.5}
130 // J4.33 user Button1 (top) (digital) {TM4C123 PD6, MSP432 P5.1}
131 //--------------------------------------------------
132 // buzzer output
133 // J4.40 buzzer (PWM) {TM4C123 PF2, MSP432 P2.7}
134 //--------------------------------------------------
135 // Joystick
136 // J1.5 joystick Select button (digital) {TM4C123 PE4, MSP432 P4.1}
137 // J1.2 joystick horizontal (X) (analog) {TM4C123 PB5/AIN11, MSP432 P6.0}
138 // J3.26 joystick vertical (Y) (analog) {TM4C123 PD3/AIN4, MSP432 P4.4}
139 //--------------------------------------------------
140 // accelerometer
141 // J3.23 accelerometer X (analog) {TM4C123 PD0/AIN7, MSP432 P6.1}
142 // J3.24 accelerometer Y (analog) {TM4C123 PD1/AIN6, MSP432 P4.0}
143 // J3.25 accelerometer Z (analog) {TM4C123 PD2/AIN5, MSP432 P4.2}
144 //--------------------------------------------------
145 // microphone
146 // J1.6 microphone (analog) {TM4C123 PE5/AIN8, MSP432 P4.3}
147 //--------------------------------------------------
148 // light and temperature sensors (I2C)
149 // J1.8 ambient light (OPT3001) interrupt (digital) {TM4C123 PA5, MSP432 P4.6}
150 // J1.9 ambient light (OPT3001) and temperature sensor (TMP006) I2C SCL (I2C) {TM4C123 PA6, MSP432 P6.5}
151 // J1.10 ambient light (OPT3001) and temperature sensor (TMP006) I2C SDA (I2C) {TM4C123 PA7, MSP432 P6.4}
152 // J2.11 temperature sensor (TMP006) interrupt (digital) {TM4C123 PA2, MSP432 P3.6}
153 //--------------------------------------------------
154 // Bluetooth booster
155 // J1.3 UART from Bluetooth to LaunchPad (UART) {TM4C123 PB0, MSP432 P3.2}
156 // J1.4 UART from LaunchPad to Bluetooth (UART) {TM4C123 PB1, MSP432 P3.3}
157 //--------------------------------------------------
158 // profile pins
159 // J3.27 Profile 0 {TM4C123 PE1, MSP432 P4.5}
160 // J3.28 Profile 1 {TM4C123 PE2, MSP432 P4.7}
161 // J3.29 Profile 2 {TM4C123 PE3, MSP432 P5.4}
162 // J3.30 Profile 3 {TM4C123 PF1, MSP432 P5.5}
163 // J2.18 Profile 4 {TM4C123 PE0, MSP432 P3.0}
164 // J4.36 Profile 5 {TM4C123 PC5, MSP432 P6.6}
165 // J4.34 Profile 6 {TM4C123 PC7, MSP432 P2.3}
166 //--------------------------------------------------
167 // unconnected pins
168 // J2.12 nothing {TM4C123 PA3, MSP432 P5.2}
169 // J2.14 nothing {TM4C123 PB6, MSP432 P1.7}
170 // J2.19 servo PWM {TM4C123 PB2, MSP432 P2.5}
171 // J4.35 nothing {TM4C123 PC6, MSP432 P6.7}
172 #ifndef __LCD_H__
173 #define __LCD_H__
177 //color constants red grn blu
178 #define LCD_BLACK 0x0000 // 0, 0, 0
179 #define LCD_BLUE 0x001F // 0, 0, 255
180 #define LCD_DARKBLUE 0x34BF // 50, 150, 255
181 #define LCD_RED 0xF800 // 255, 0, 0
182 #define LCD_GREEN 0x07E0 // 0, 255, 0
183 #define LCD_LIGHTGREEN 0x07EF // 0, 255, 120
184 #define LCD_ORANGE 0xFD60 // 255, 175, 0
185 #define LCD_CYAN 0x07FF // 0, 255, 255
186 #define LCD_MAGENTA 0xF81F // 255, 0, 255
187 #define LCD_YELLOW 0xFFE0 // 255, 255, 0
188 #define LCD_WHITE 0xFFFF // 255, 255, 255
189 #define LCD_GREY 0x8410 // 128, 128, 128
193 #define STANDARD_GALACTIC_ALPHABET 0
194 
195 
209 void LCD_Init(void);
210 
211 
225 void LCD_DrawPixel(int16_t x, int16_t y, uint16_t color);
226 
227 
239 void LCD_DrawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
240 
241 
253 void LCD_DrawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
254 
255 
263 void LCD_FillScreen(uint16_t color);
264 
265 
277 void LCD_FillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
278 
279 
288 uint16_t LCD_Color565(uint8_t r, uint8_t g, uint8_t b);
289 
290 
298 uint16_t LCD_SwapColor(uint16_t x);
299 
300 
322 void LCD_DrawBitmap(int16_t x, int16_t y, const uint16_t *image, int16_t w, int16_t h);
323 
324 
342 void LCD_DrawCharS(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size);
343 
344 
360 void LCD_DrawChar(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size);
361 
362 
375 uint32_t LCD_DrawString(uint16_t x, uint16_t y, char *pt, int16_t textColor);
376 
377 
388 void LCD_SetCursor(uint32_t newX, uint32_t newY);
389 
399 void LCD_OutUDec(uint32_t n, int16_t textColor);
400 
411 void LCD_OutUDec4(uint32_t n, int16_t textColor);
412 
422 void LCD_OutUDec5(uint32_t n, int16_t textColor);
423 
434 void LCD_OutUFix2_1(uint32_t n, int16_t textColor);
435 
446 void LCD_OutUHex2(uint32_t n, int16_t textColor);
447 
456 void LCD_OutChar(char ch);
457 
467 void LCD_OutString(char *ptr);
468 
476 void LCD_SetTextColor(uint16_t color);
477 
497 void LCD_Drawaxes(uint16_t axisColor, uint16_t bgColor, char *xLabel,
498  char *yLabel1, uint16_t label1Color, char *yLabel2, uint16_t label2Color,
499  int32_t ymax, int32_t ymin);
500 
501 
514 void LCD_PlotPoint(int32_t data1, uint16_t color1);
515 
516 
526 void LCD_PlotIncrement(void);
527 
528 #endif
void LCD_DrawPixel(int16_t x, int16_t y, uint16_t color)
Color one pixel.
void LCD_PlotPoint(int32_t data1, uint16_t color1)
Plot one point.
void LCD_FillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Draw a filled rectangle.
void LCD_SetTextColor(uint16_t color)
sets the text color
void LCD_DrawBitmap(int16_t x, int16_t y, const uint16_t *image, int16_t w, int16_t h)
Displays a BMP image.
void LCD_OutUFix2_1(uint32_t n, int16_t textColor)
Output a 2-digit fixed-point decimal.
void LCD_DrawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Draw a vertical line.
void LCD_OutChar(char ch)
Output a character.
void LCD_SetCursor(uint32_t newX, uint32_t newY)
Move the cursor.
void LCD_OutUHex2(uint32_t n, int16_t textColor)
Output a 2-digit hexadecimal number.
void LCD_DrawCharS(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size)
Draw a character.
void LCD_Drawaxes(uint16_t axisColor, uint16_t bgColor, char *xLabel, char *yLabel1, uint16_t label1Color, char *yLabel2, uint16_t label2Color, int32_t ymax, int32_t ymin)
Initializes a plot.
void LCD_OutUDec4(uint32_t n, int16_t textColor)
Output a 4-digit unsigned decimal.
void LCD_OutUDec(uint32_t n, int16_t textColor)
Output an unsigned decimal.
void LCD_OutString(char *ptr)
Output a string.
uint16_t LCD_SwapColor(uint16_t x)
Swaps red and blue.
void LCD_Init(void)
Initialize MKII LCD.
void LCD_DrawChar(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size)
Draw a character.
void LCD_DrawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Draw a horizontal line.
uint16_t LCD_Color565(uint8_t r, uint8_t g, uint8_t b)
RGB to color creation.
void LCD_OutUDec5(uint32_t n, int16_t textColor)
Output a 5-digit unsigned decimal.
void LCD_PlotIncrement(void)
Moves the plot cursor in time.
void LCD_FillScreen(uint16_t color)
Fill the screen.
uint32_t LCD_DrawString(uint16_t x, uint16_t y, char *pt, int16_t textColor)
Draw a string.