1 /* 2 * Copyright (c) 2006-2023, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2023-03-24 spaceman the first version 9 */ 10 11 #ifndef __DRV_LCD_SPI_H__ 12 #define __DRV_LCD_SPI_H__ 13 14 #include <rtthread.h> 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 #define LCD_DEVICE(dev) (struct drv_lcd_device*)(dev) 21 22 struct drv_lcd_device 23 { 24 struct rt_device parent; 25 rt_device_t lcd_spi_dev; 26 27 struct rt_device_graphic_info lcd_info; 28 29 struct rt_semaphore lcd_lock; 30 31 /* 0:front_buf is being used 1: back_buf is being used*/ 32 rt_uint8_t cur_buf; 33 rt_uint8_t *front_buf; 34 rt_uint8_t *back_buf; 35 }; 36 37 38 39 void lcd_writebuff(uint16_t *databuff, uint16_t datasize); 40 41 void lcd_setaddress(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); 42 43 void lcd_clear(uint32_t color); 44 void lcd_clearrect(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint32_t color); 45 void lcd_copybuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t *databuff); 46 47 void lcd_drawpoint(uint16_t x, uint16_t y, uint32_t color); 48 49 void lcd_drawline(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint32_t color); 50 void lcd_drawline_v(uint16_t x, uint16_t y, uint16_t height, uint32_t color); 51 void lcd_drawline_h(uint16_t x, uint16_t y, uint16_t width, uint32_t color); 52 53 #ifdef __cplusplus 54 } 55 #endif 56 57 #endif /* __DRV_LCD_SPI_H__ */ 58