1 /**************************************************************************//** 2 * 3 * @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved. 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 * 7 * Change Logs: 8 * Date Author Notes 9 * 2020-1-16 Wayne First version 10 * 11 ******************************************************************************/ 12 13 #ifndef __LCD_ILI9341_H__ 14 #define __LCD_ILI9341_H__ 15 16 #include <rtconfig.h> 17 #include <rtdevice.h> 18 19 #define SET_RS rt_pin_write(BOARD_USING_ILI9341_PIN_DC, 1) 20 #define CLR_RS rt_pin_write(BOARD_USING_ILI9341_PIN_DC, 0) 21 22 #define SET_RST rt_pin_write(BOARD_USING_ILI9341_PIN_RESET, 1) 23 #define CLR_RST rt_pin_write(BOARD_USING_ILI9341_PIN_RESET, 0) 24 25 #define SET_BACKLIGHT_ON rt_pin_write(BOARD_USING_ILI9341_PIN_BACKLIGHT, 1) 26 #define SET_BACKLIGHT_OFF rt_pin_write(BOARD_USING_ILI9341_PIN_BACKLIGHT, 0) 27 28 // 29 // Physical display size 30 // 31 #if defined(NU_PKG_ILI9341_HORIZONTAL) 32 #define XSIZE_PHYS 320 33 #define YSIZE_PHYS 240 34 #else 35 #define XSIZE_PHYS 240 36 #define YSIZE_PHYS 320 37 #endif 38 39 int rt_hw_lcd_ili9341_init(void); 40 void ili9341_send_cmd(rt_uint8_t cmd); 41 void ili9341_send_cmd_parameter(rt_uint8_t data); 42 void ili9341_set_column(rt_uint16_t StartCol, rt_uint16_t EndCol); 43 void ili9341_set_page(rt_uint16_t StartPage, rt_uint16_t EndPage); 44 void ili9341_send_pixel_data(rt_uint16_t color); 45 void ili9341_lcd_get_pixel(char *color, int x, int y); 46 void ili9341_send_pixels(rt_uint16_t *pixels, int len); 47 48 #if defined(NU_PKG_USING_ILI9341_SPI) 49 rt_err_t rt_hw_lcd_ili9341_spi_init(const char *spibusname, void *pvUserData); 50 #elif defined(NU_PKG_USING_ILI9341_EBI) 51 rt_err_t rt_hw_lcd_ili9341_ebi_init(rt_uint32_t ebi_base); 52 #endif 53 54 #endif /* __LCD_ILI9341_H__ */ 55