summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2021-11-21 15:24:09 -0500
committerMeco Man <[email protected]>2021-11-21 16:06:41 -0500
commit364109708c50f1832f3da95a2d5bceeb84e99e1e (patch)
tree646f67b7700914ce7441088fca1748c513807b34
parent5f2f862ed9f315c63f4fee9a491f55fe40292adc (diff)
[stm32l475] update lcd driver
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/SConscript6
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c16
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.h18
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.c2
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.h2
5 files changed, 27 insertions, 17 deletions
diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/SConscript b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/SConscript
index 61fd579405..bf4c2fb282 100644
--- a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/SConscript
+++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/SConscript
@@ -2,14 +2,14 @@ from building import *
import os
cwd = GetCurrentDir()
-src = Glob('*.c')
+src = ['drv_lcd.c']
CPPPATH = [cwd]
if GetDepend(['BSP_USING_LCD_QRCODE']):
- src = src + Glob('lcd_qrcode.c')
+ src = src + ['lcd_qrcode.c']
if GetDepend(['BSP_USING_LCD_SAMPLE']):
- src = src + Glob('demo/lcd_sample.c')
+ src = src + ['demo/lcd_sample.c']
group = DefineGroup('Drivers', src, depend = ['BSP_USING_SPI_LCD'], CPPPATH = CPPPATH)
diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c
index d08b9754c7..8df8a79a36 100644
--- a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c
+++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c
@@ -16,7 +16,9 @@
#include <drv_gpio.h>
#include <drv_spi.h>
#include "drv_lcd.h"
+#ifndef BSP_USING_LVGL
#include "drv_lcd_font.h"
+#endif /* BSP_USING_LVGL */
#define DBG_TAG "drv.lcd"
#define DBG_LVL DBG_INFO
@@ -25,9 +27,11 @@
#define LCD_PWR_PIN GET_PIN(B, 7)
#define LCD_DC_PIN GET_PIN(B, 4)
#define LCD_RES_PIN GET_PIN(B, 6)
-#define LCD_CLEAR_SEND_NUMBER 5760 /* 240*240/10 */
+#ifndef BSP_USING_LVGL
+#define LCD_CLEAR_SEND_NUMBER 5760 /* 240*240/10 */
rt_uint16_t BACK_COLOR = WHITE, FORE_COLOR = BLACK;
+#endif /* BSP_USING_LVGL */
static struct rt_spi_device *spi_dev_lcd;
@@ -86,6 +90,7 @@ static rt_err_t lcd_write_data(const rt_uint8_t data)
}
}
+#ifndef BSP_USING_LVGL
static rt_err_t lcd_write_half_word(const rt_uint16_t da)
{
rt_size_t len;
@@ -106,6 +111,7 @@ static rt_err_t lcd_write_half_word(const rt_uint16_t da)
return RT_EOK;
}
}
+#endif /* BSP_USING_LVGL */
static void lcd_gpio_init(void)
{
@@ -214,6 +220,7 @@ static int rt_hw_lcd_init(void)
}
INIT_DEVICE_EXPORT(rt_hw_lcd_init);
+#ifndef BSP_USING_LVGL
/**
* Set background color and foreground color
*
@@ -227,6 +234,7 @@ void lcd_set_color(rt_uint16_t back, rt_uint16_t fore)
BACK_COLOR = back;
FORE_COLOR = fore;
}
+#endif /* BSP_USING_LVGL */
void lcd_display_on(void)
{
@@ -281,6 +289,7 @@ void lcd_address_set(rt_uint16_t x1, rt_uint16_t y1, rt_uint16_t x2, rt_uint16_t
lcd_write_cmd(0x2C);
}
+#ifndef BSP_USING_LVGL
/**
* clear the lcd.
*
@@ -424,6 +433,8 @@ void lcd_fill(rt_uint16_t x_start, rt_uint16_t y_start, rt_uint16_t x_end, rt_ui
}
}
}
+#endif /* BSP_USING_LVGL */
+
/**
* full color array on the lcd.
@@ -446,6 +457,7 @@ void lcd_fill_array(rt_uint16_t x_start, rt_uint16_t y_start, rt_uint16_t x_end,
rt_spi_send(spi_dev_lcd, pcolor, size);
}
+#ifndef BSP_USING_LVGL
/**
* display a line on the lcd.
*
@@ -856,3 +868,5 @@ rt_err_t lcd_show_image(rt_uint16_t x, rt_uint16_t y, rt_uint16_t length, rt_uin
return RT_EOK;
}
+
+#endif /* BSP_USING_LVGL */
diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.h b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.h
index 225c3f42cb..af76319e87 100644
--- a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.h
+++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.h
@@ -5,8 +5,8 @@
*
* Change Logs:
* Date Author Notes
- * 2018-08-14 flybreak the first version
- * 2018-09-18 balanceTWK add sleep mode function
+ * 2018-08-14 flybreak the first version
+ * 2018-09-18 balanceTWK add sleep mode function
*/
#ifndef __DRV_LCD_H__
@@ -14,14 +14,10 @@
#include <rtthread.h>
-#ifdef PKG_USING_QRCODE
-#include <qrcode.h>
-#endif
-
#define LCD_W 240
#define LCD_H 240
-//POINT_COLOR
+#ifndef BSP_USING_LVGL
#define WHITE 0xFFFF
#define BLACK 0x0000
#define BLUE 0x001F
@@ -42,25 +38,25 @@
#define GRAY240 0XF79E
extern rt_uint16_t BACK_COLOR, FORE_COLOR;
-
void lcd_clear(rt_uint16_t color);
-void lcd_address_set(rt_uint16_t x1, rt_uint16_t y1, rt_uint16_t x2, rt_uint16_t y2);
void lcd_set_color(rt_uint16_t back, rt_uint16_t fore);
-
void lcd_draw_point(rt_uint16_t x, rt_uint16_t y);
void lcd_draw_point_color(rt_uint16_t x, rt_uint16_t y, rt_uint16_t color);
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);
+#endif /* BSP_USING_LVGL */
void lcd_enter_sleep(void);
void lcd_exit_sleep(void);
void lcd_display_on(void);
void lcd_display_off(void);
+void lcd_address_set(rt_uint16_t x1, rt_uint16_t y1, rt_uint16_t x2, rt_uint16_t y2);
+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);
+
#endif
diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.c
index a03eba27ca..2f58bbe966 100644
--- a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.c
+++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.c
@@ -186,4 +186,4 @@ __exit:
return result;
}
-#endif
+#endif /* BSP_USING_LCD_QRCODE */
diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.h b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.h
index f9a5193404..320cbb8aa6 100644
--- a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.h
+++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.h
@@ -3,7 +3,7 @@
#include <rtconfig.h>
-#ifdef PKG_USING_QRCODE
+#ifdef BSP_USING_LCD_QRCODE
#include <rtdef.h>
rt_err_t lcd_show_qrcode(rt_uint16_t x, rt_uint16_t y, rt_uint8_t version, rt_uint8_t ecc, const char *data, rt_uint8_t enlargement);
#endif