[bsp][stm32][l475] add lcd_fill_array()
This commit is contained in:
parent
9fe546b0d8
commit
655d8dc768
|
@ -8,17 +8,17 @@
|
|||
* 2018-08-14 flybreak the first version
|
||||
* 2018-09-18 balanceTWK add sleep mode function
|
||||
* 2018-09-27 ZYLX optimized display speed
|
||||
* 2021-10-17 Meco Man add lcd_fill_array()
|
||||
*/
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include "drv_spi.h"
|
||||
#include "drv_lcd.h"
|
||||
#include <drv_lcd.h>
|
||||
#include "drv_lcd_font.h"
|
||||
#include "drv_gpio.h"
|
||||
#include <drv_gpio.h>
|
||||
|
||||
#define DBG_SECTION_NAME "LCD"
|
||||
#define DBG_COLOR
|
||||
#define DBG_LEVEL DBG_LOG
|
||||
#define DBG_TAG "drv.lcd"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
#define LCD_PWR_PIN GET_PIN(B, 7)
|
||||
|
@ -375,7 +375,7 @@ void lcd_fill(rt_uint16_t x_start, rt_uint16_t y_start, rt_uint16_t x_end, rt_ui
|
|||
rt_uint32_t size = 0, size_remain = 0;
|
||||
rt_uint8_t *fill_buf = RT_NULL;
|
||||
|
||||
size = (x_end - x_start) * (y_end - y_start) * 2;
|
||||
size = (x_end - x_start + 1) * (y_end - y_start + 1) * 2;
|
||||
|
||||
if (size > LCD_CLEAR_SEND_NUMBER)
|
||||
{
|
||||
|
@ -426,6 +426,55 @@ void lcd_fill(rt_uint16_t x_start, rt_uint16_t y_start, rt_uint16_t x_end, rt_ui
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* full color array on the lcd.
|
||||
*
|
||||
* @param x_start start of x position
|
||||
* @param y_start start of y position
|
||||
* @param x_end end of x position
|
||||
* @param y_end end of y position
|
||||
* @param color Fill color array's pointer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
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)
|
||||
{
|
||||
rt_uint32_t size = 0, size_remain = 0;
|
||||
|
||||
size = (x_end - x_start + 1) * (y_end - y_start + 1) * 2;
|
||||
|
||||
if (size > LCD_CLEAR_SEND_NUMBER)
|
||||
{
|
||||
/* the number of remaining to be filled */
|
||||
size_remain = size - LCD_CLEAR_SEND_NUMBER;
|
||||
size = LCD_CLEAR_SEND_NUMBER;
|
||||
}
|
||||
|
||||
lcd_address_set(x_start, y_start, x_end, y_end);
|
||||
|
||||
/* fast fill */
|
||||
while (1)
|
||||
{
|
||||
rt_pin_write(LCD_DC_PIN, PIN_HIGH);
|
||||
rt_spi_send(spi_dev_lcd, pcolor, size);
|
||||
|
||||
/* Fill completed */
|
||||
if (size_remain == 0)
|
||||
break;
|
||||
|
||||
/* calculate the number of fill next time */
|
||||
if (size_remain > LCD_CLEAR_SEND_NUMBER)
|
||||
{
|
||||
size_remain = size_remain - LCD_CLEAR_SEND_NUMBER;
|
||||
}
|
||||
else
|
||||
{
|
||||
size = size_remain;
|
||||
size_remain = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* display a line on the lcd.
|
||||
*
|
||||
|
|
|
@ -50,7 +50,7 @@ void lcd_draw_circle(rt_uint16_t x0, rt_uint16_t y0, rt_uint8_t r);
|
|||
void lcd_draw_line(rt_uint16_t x1, rt_uint16_t y1, rt_uint16_t x2, rt_uint16_t y2);
|
||||
void lcd_draw_rectangle(rt_uint16_t x1, rt_uint16_t y1, rt_uint16_t x2, rt_uint16_t y2);
|
||||
void lcd_fill(rt_uint16_t x_start, rt_uint16_t y_start, rt_uint16_t x_end, rt_uint16_t y_end, rt_uint16_t color);
|
||||
|
||||
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);
|
||||
void lcd_show_num(rt_uint16_t x, rt_uint16_t y, rt_uint32_t num, rt_uint8_t len, rt_uint32_t size);
|
||||
rt_err_t lcd_show_string(rt_uint16_t x, rt_uint16_t y, rt_uint32_t size, const char *fmt, ...);
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue