1 /*
2  * Copyright (c) 2006-2022, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author            Notes
8  * 2018-08-14     flybreak          the first version
9  * 2018-09-18     balanceTWK        add sleep mode function
10  * 2022-02-01     Rudy Lo           add lcd_fill_array function
11  */
12 
13 #ifndef __DRV_LCD_SPI_H__
14 #define __DRV_LCD_SPI_H__
15 
16 #include <rtthread.h>
17 
18 #define LCD_W 480
19 #define LCD_H 320
20 
21 //POINT_COLOR
22 #define WHITE            0xFFFFFF
23 #define BLACK            0x000000
24 #define BLUE             0x0000FF
25 //#define BRED             0XF81F
26 //#define GRED             0XFFE0
27 //#define GBLUE            0X07FF
28 #define RED              0xFF0000
29 //#define MAGENTA          0xF81F
30 #define GREEN            0x00FF00
31 //#define CYAN             0x7FFF
32 //#define YELLOW           0xFFE0
33 //#define BROWN            0XBC40
34 //#define BRRED            0XFC07
35 //#define GRAY             0X8430
36 //#define GRAY175          0XAD75
37 //#define GRAY151          0X94B2
38 //#define GRAY187          0XBDD7
39 //#define GRAY240          0XF79E
40 
41 int rt_hw_spi_lcd_init(void);
42 
43 void lcd_clear(rt_uint32_t color);
44 void lcd_address_set(rt_uint16_t x1, rt_uint16_t y1, rt_uint16_t x2, rt_uint16_t y2);
45 void lcd_set_color(rt_uint32_t back, rt_uint32_t fore);
46 
47 void lcd_draw_point(rt_uint16_t x, rt_uint16_t y);
48 void lcd_draw_point_color(rt_uint16_t x, rt_uint16_t y, rt_uint32_t color);
49 void lcd_draw_circle(rt_uint16_t x0, rt_uint16_t y0, rt_uint8_t r);
50 void lcd_draw_line(rt_uint16_t x1, rt_uint16_t y1, rt_uint16_t x2, rt_uint16_t y2);
51 void lcd_draw_rectangle(rt_uint16_t x1, rt_uint16_t y1, rt_uint16_t x2, rt_uint16_t y2);
52 void lcd_fill(rt_uint16_t x_start, rt_uint16_t y_start, rt_uint16_t x_end, rt_uint16_t y_end, rt_uint32_t color);
53 void lcd_fill_array(rt_uint16_t x_start, rt_uint16_t y_start, rt_uint16_t x_end, rt_uint16_t y_end, void *pcolor);
54 
55 void lcd_show_num(rt_uint16_t x, rt_uint16_t y, rt_uint32_t num, rt_uint8_t len, rt_uint32_t size);
56 rt_err_t lcd_show_string(rt_uint16_t x, rt_uint16_t y, rt_uint32_t size, const char *fmt, ...);
57 rt_err_t lcd_show_image(rt_uint16_t x, rt_uint16_t y, rt_uint16_t length, rt_uint16_t wide, const rt_uint8_t *p);
58 
59 void lcd_enter_sleep(void);
60 void lcd_exit_sleep(void);
61 void lcd_display_on(void);
62 void lcd_display_off(void);
63 
64 #endif /* __DRV_LCD_SPI_H__ */
65