summaryrefslogtreecommitdiff
path: root/bsp/stm32
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2022-05-09 13:31:31 -0400
committerguo <[email protected]>2022-05-10 10:12:45 +0800
commitc14dbe8a2eda81ef0da10bb6c2a725b328cd431a (patch)
treea0fa0cd00ecced8c532ae692937f585abc9a06e1 /bsp/stm32
parent0d2b96d7cc8c1cf52a6a86a4004777baada6794f (diff)
[lvgl] beautify code
Diffstat (limited to 'bsp/stm32')
-rw-r--r--bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.c6
-rw-r--r--bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.h4
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/applications/lvgl/lv_port_indev.c5
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/applications/lvgl/lv_port_indev.h4
4 files changed, 5 insertions, 14 deletions
diff --git a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.c b/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.c
index 50022c4edb..8014b183e4 100644
--- a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.c
+++ b/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.c
@@ -17,6 +17,8 @@ static lv_indev_state_t last_state = LV_INDEV_STATE_REL;
static rt_int16_t last_x = 0;
static rt_int16_t last_y = 0;
+lv_indev_t * touch_indev;
+
static void input_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data)
{
data->point.x = last_x;
@@ -31,8 +33,6 @@ void lv_port_indev_input(rt_int16_t x, rt_int16_t y, lv_indev_state_t state)
last_y = LCD_HEIGHT - y;
}
-lv_indev_t * button_indev;
-
void lv_port_indev_init(void)
{
static lv_indev_drv_t indev_drv;
@@ -42,5 +42,5 @@ void lv_port_indev_init(void)
indev_drv.read_cb = input_read;
/*Register the driver in LVGL and save the created input device object*/
- button_indev = lv_indev_drv_register(&indev_drv);
+ touch_indev = lv_indev_drv_register(&indev_drv);
}
diff --git a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.h b/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.h
index d15f0e5cfa..3fa1766800 100644
--- a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.h
+++ b/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.h
@@ -14,10 +14,6 @@
extern "C" {
#endif
-#include <lv_hal_indev.h>
-
-extern lv_indev_t * button_indev;
-
void lv_port_indev_init(void);
void lv_port_indev_input(rt_int16_t x, rt_int16_t y, lv_indev_state_t state);
diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/lvgl/lv_port_indev.c b/bsp/stm32/stm32l475-atk-pandora/applications/lvgl/lv_port_indev.c
index 2f24642b8a..26f509efaf 100644
--- a/bsp/stm32/stm32l475-atk-pandora/applications/lvgl/lv_port_indev.c
+++ b/bsp/stm32/stm32l475-atk-pandora/applications/lvgl/lv_port_indev.c
@@ -17,6 +17,8 @@
#define BUTTON2_PIN GET_PIN(D, 8)
#define BUTTON_WKUP_PIN GET_PIN(C, 13)
+lv_indev_t * button_indev;
+
/*Test if `id` button is pressed or not*/
static bool button_is_pressed(uint8_t id)
{
@@ -78,9 +80,6 @@ void button_read(lv_indev_drv_t * drv, lv_indev_data_t*data)
data->btn_id = last_btn; /*Save the last button*/
}
-
-lv_indev_t * button_indev;
-
void lv_port_indev_init(void)
{
static lv_indev_drv_t indev_drv;
diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/lvgl/lv_port_indev.h b/bsp/stm32/stm32l475-atk-pandora/applications/lvgl/lv_port_indev.h
index f604e3c5b1..7599bb899d 100644
--- a/bsp/stm32/stm32l475-atk-pandora/applications/lvgl/lv_port_indev.h
+++ b/bsp/stm32/stm32l475-atk-pandora/applications/lvgl/lv_port_indev.h
@@ -14,10 +14,6 @@
extern "C" {
#endif
-#include <lv_hal_indev.h>
-
-extern lv_indev_t * button_indev;
-
void lv_port_indev_init(void);
#ifdef __cplusplus