TM STM32F4xx Libraries  v1.0.0
Libraries for STM32F4xx devices from Tilen Majerle
tm_stm32f4_ili9341_ltdc.h
1 
30 #ifndef TM_ILI9341_LTDC_H
31 #define TM_ILI9341_LTDC_H 140
32 
33 /* C++ detection */
34 #ifdef __cplusplus
35 extern C {
36 #endif
37 
99 #include "stm32f4xx.h"
100 #include "stm32f4xx_rcc.h"
101 #include "stm32f4xx_gpio.h"
102 #include "stm32f4xx_ltdc.h"
103 #include "defines.h"
104 #include "tm_stm32f4_spi.h"
105 #include "tm_stm32f4_fonts.h"
106 #include "tm_stm32f4_sdram.h"
107 #include "tm_stm32f4_gpio.h"
108 
118 #ifndef ILI9341_SPI
119 #define ILI9341_SPI SPI5
120 #define ILI9341_SPI_PINS TM_SPI_PinsPack_1
121 #endif
122 
126 #ifndef ILI9341_CS_PIN
127 #define ILI9341_CS_PORT GPIOC
128 #define ILI9341_CS_PIN GPIO_PIN_2
129 #endif
130 
134 #ifndef ILI9341_WRX_PIN
135 #define ILI9341_WRX_PORT GPIOD
136 #define ILI9341_WRX_PIN GPIO_PIN_13
137 #endif
138 
142 #define ILI9341_COLOR_WHITE 0xFFFF
143 #define ILI9341_COLOR_BLACK 0x0000
144 #define ILI9341_COLOR_RED 0xF800
145 #define ILI9341_COLOR_GREEN 0x07E0
146 #define ILI9341_COLOR_GREEN2 0xB723
147 #define ILI9341_COLOR_BLUE 0x001F
148 #define ILI9341_COLOR_BLUE2 0x051D
149 #define ILI9341_COLOR_YELLOW 0xFFE0
150 #define ILI9341_COLOR_ORANGE 0xFBE4
151 #define ILI9341_COLOR_CYAN 0x07FF
152 #define ILI9341_COLOR_MAGENTA 0xA254
153 #define ILI9341_COLOR_GRAY 0x7BEF
154 #define ILI9341_COLOR_BROWN 0xBBCA
155 
161 #define ILI9341_TRANSPARENT 0x80000000
162 
176 typedef enum {
182 
198 void TM_ILI9341_Init(void);
199 
207 void TM_ILI9341_DrawPixel(uint16_t x, uint16_t y, uint32_t color);
208 
214 void TM_ILI9341_Fill(uint32_t color);
215 
222 
233 void TM_ILI9341_Putc(uint16_t x, uint16_t y, char c, TM_FontDef_t* font, uint32_t foreground, uint32_t background);
234 
245 void TM_ILI9341_Puts(uint16_t x, uint16_t y, char* str, TM_FontDef_t *font, uint32_t foreground, uint32_t background);
246 
255 void TM_ILI9341_GetStringSize(char* str, TM_FontDef_t* font, uint16_t* width, uint16_t* height);
256 
266 void TM_ILI9341_DrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t color);
267 
277 void TM_ILI9341_DrawRectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t color);
278 
288 void TM_ILI9341_DrawFilledRectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t color);
289 
300 void TM_ILI9341_DrawRoundedRectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t r, uint32_t color);
301 
312 void TM_ILI9341_DrawFilledRoundedRectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t r, uint32_t color);
313 
322 void TM_ILI9341_DrawCircle(int16_t x0, int16_t y0, int16_t r, uint32_t color);
323 
332 void TM_ILI9341_DrawFilledCircle(int16_t x0, int16_t y0, int16_t r, uint32_t color);
333 
339 void TM_ILI9341_SetLayer1(void);
340 
346 void TM_ILI9341_SetLayer2(void);
347 
353 void TM_ILI9341_SetLayer1Opacity(uint8_t opacity);
354 
360 void TM_ILI9341_SetLayer2Opacity(uint8_t opacity);
361 
369 void TM_ILI9341_ChangeLayers(void);
370 
376 void TM_ILI9341_Layer2To1(void);
377 
383 void TM_ILI9341_Layer1To2(void);
384 
391 void TM_ILI9341_DisplayOn(void);
392 
398 void TM_ILI9341_DisplayOff(void);
399 
412 /* C++ detection */
413 #ifdef __cplusplus
414 }
415 #endif
416 
417 #endif
void TM_ILI9341_DrawFilledCircle(int16_t x0, int16_t y0, int16_t r, uint32_t color)
Draws filled circle on LCD.
void TM_ILI9341_DrawFilledRectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t color)
Draws filled rectangle on LCD.
TM_ILI9341_Orientation_t
Possible orientations for LCD.
Definition: tm_stm32f4_ili9341_ltdc.h:176
void TM_ILI9341_GetStringSize(char *str, TM_FontDef_t *font, uint16_t *width, uint16_t *height)
Gets width and height of box with text.
void TM_ILI9341_Fill(uint32_t color)
Fills entire LCD with color.
void TM_ILI9341_DrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t color)
Draws line to LCD.
TM_ILI9341_Orientation_t
Possible orientations for LCD.
Definition: tm_stm32f4_ili9341.h:211
void TM_ILI9341_Rotate(TM_ILI9341_Orientation_t orientation)
Rotates LCD to specific orientation.
void TM_ILI9341_DrawRoundedRectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t r, uint32_t color)
Draws rounded rectangle on LCD.
void TM_ILI9341_SetLayer2(void)
Sets layer 2 to currently active layer.
void TM_ILI9341_Layer1To2(void)
Copies content of layer 1 to layer 2.
void TM_ILI9341_DrawFilledRoundedRectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t r, uint32_t color)
Draws filled rounded rectangle on LCD.
Definition: tm_stm32f4_ili9341_ltdc.h:178
void TM_ILI9341_Layer2To1(void)
Copies content of layer 2 to layer 1.
void TM_ILI9341_DrawCircle(int16_t x0, int16_t y0, int16_t r, uint32_t color)
Draws circle on LCD.
void TM_ILI9341_SetLayer1(void)
Sets layer 2 to currently active layer.
void TM_ILI9341_Puts(uint16_t x, uint16_t y, char *str, TM_FontDef_t *font, uint32_t foreground, uint32_t background)
Puts string to LCD.
Definition: tm_stm32f4_ili9341_ltdc.h:177
void TM_ILI9341_DisplayOff(void)
Disables display.
void TM_ILI9341_SetLayer1Opacity(uint8_t opacity)
Sets layer 1 opacity.
void TM_ILI9341_DrawPixel(uint16_t x, uint16_t y, uint32_t color)
Draws single pixel to LCD.
void TM_ILI9341_DisplayOn(void)
Enables display.
Definition: tm_stm32f4_ili9341_ltdc.h:179
void TM_ILI9341_SetLayer2Opacity(uint8_t opacity)
Sets layer 2 opacity.
void TM_ILI9341_DrawRectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t color)
Draws rectangle on LCD.
void TM_ILI9341_Putc(uint16_t x, uint16_t y, char c, TM_FontDef_t *font, uint32_t foreground, uint32_t background)
Puts single character to LCD.
void TM_ILI9341_ChangeLayers(void)
This changes current active layer It sets transparency to 0 and 255 depends on which layer is selecte...
Definition: tm_stm32f4_ili9341_ltdc.h:180
void TM_ILI9341_Init(void)
Initializes ILI9341 LCD with LTDC peripheral It also initializes external SDRAM.
Font structure used on my LCD libraries.
Definition: tm_stm32f4_fonts.h:89