4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-22 00:09:20 +08:00
Rbb666 e484ff5942
添加 imxrt1060-evk BSP (#5657)
* 添加 imxrt1060-evk BSP

* add LVGL

* add README.md

* Delete irrelevant files

* Modify the optimization level to O1

* Organize documents

* Source code formatting
2022-03-11 12:13:56 +08:00

45 lines
1.1 KiB
C

/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-10-18 Meco Man The first version
*/
#include <lvgl.h>
#include <stdbool.h>
#include <rtdevice.h>
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;
static void input_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data)
{
data->point.x = last_x;
data->point.y = last_y;
data->state = last_state;
}
void lv_port_indev_input(rt_int16_t x, rt_int16_t y, lv_indev_state_t state)
{
last_state = state;
last_x = x;
last_y = LV_HOR_RES_MAX - y;
}
lv_indev_t * button_indev;
void lv_port_indev_init(void)
{
static lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv); /*Basic initialization*/
indev_drv.type = LV_INDEV_TYPE_POINTER;
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);
}