女人被爽到高潮视频免cn费95,久久99精品久久久久久久不卡,内射人妻骚骚骚,久久精品一区二区三区四区啪啪 ,美女视频黄频a美女大全

  • 正文
  • 附件下載
  • 推薦器件
  • 相關(guān)推薦
申請(qǐng)入駐 產(chǎn)業(yè)圖譜

基于LPC55S69學(xué)習(xí)GUI-Guider軟件分享三——lvgl輸入設(shè)備模擬

2024/05/14
4661
加入交流群
掃碼加入
獲取工程師必備禮包
參與熱點(diǎn)資訊討論

繼上次移植了GUI-Guider生成的GUI界面后,顯示沒(méi)什么問(wèn)題了。但是只有顯示,不能操作,看起來(lái)還是不完整。這次就分享如何移植輸入設(shè)備,可以點(diǎn)擊和移動(dòng)操作。

輸入設(shè)備移植文件主要是這個(gè)。如圖,可以看到lvgl支持觸摸指針設(shè)備,鼠標(biāo),鍵盤(pán),encoder,button。

本次是通過(guò)串口方式發(fā)送數(shù)據(jù)模擬觸摸指針設(shè)備。下面是主要修改步驟。

串口接收6個(gè)字節(jié),定義結(jié)構(gòu)體變量映射6個(gè)字節(jié)。代碼如下。

主要是初始化,獲取點(diǎn)擊狀態(tài),獲取x,y坐標(biāo)這3個(gè)函數(shù)。

extern union Indev_uart_data
{
struct
{
uint8_t flag;
uint8_t press;
uint16_t x;
uint16_t y;
}touch;
uint8_t buff[6];
}g_input;

/*------------------
* Touchpad
* -----------------*/

/*Initialize your touchpad*/
static void touchpad_init(void)
{
/*Your code comes here*/
memset(g_input.buff, 0, sizeof(g_input.buff));
}

/* Will be called by the library to read the touchpad */
static bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static lv_coord_t last_x = 0;
static lv_coord_t last_y = 0;

/*Save the pressed coordinates and the state*/
if(touchpad_is_pressed()) {
touchpad_get_xy(&last_x, &last_y);
data->state = LV_INDEV_STATE_PR;
} else {
data->state = LV_INDEV_STATE_REL;
}

/*Set the last pressed coordinates*/
data->point.x = last_x;
data->point.y = last_y;

/*Return `false` because we are not buffering and no more data to read*/
return false;
}

/*Return true is the touchpad is pressed*/
static bool touchpad_is_pressed(void)
{
/*Your code comes here*/
if((g_input.touch.flag == 'T')&&(g_input.touch.press))
{
return true;
}
return false;
}

/*Get the x and y coordinates if the touchpad is pressed*/
static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y)
{
/*Your code comes here*/
if(g_input.touch.flag == 'T')
{
(*x) = g_input.touch.x;
(*y) = g_input.touch.y;
}
}

然后就是主函數(shù)中調(diào)用輸入設(shè)備初始化。

主循環(huán)通過(guò)串口接收數(shù)據(jù),模擬觸摸指針設(shè)備。注意串口接收使用非阻塞方式。

下面是通過(guò)串口助手發(fā)送數(shù)據(jù)效果,可以看到指針位置。

具體參考如下代碼:lpc55s69_lcd.rar (7.49 MB, 點(diǎn)擊下方附件下載)

  • lpc55s69_lcd.rar
    下載

推薦器件

更多器件
器件型號(hào) 數(shù)量 器件廠(chǎng)商 器件描述 數(shù)據(jù)手冊(cè) ECAD模型 風(fēng)險(xiǎn)等級(jí) 參考價(jià)格 更多信息
ASEM1-16.000MHZ-LC-T 1 Abracon Corporation MEMS OSC XO 16.0000MHZ CMOS SMD
$1.63 查看
ABS07W-32.768KHZ-J-1-T 1 Abracon Corporation CRYSTAL 32.7680KHZ 3PF SMD

ECAD模型

下載ECAD模型
$13.52 查看
24LC64T-I/SN 1 Microchip Technology Inc 8K X 8 I2C/2-WIRE SERIAL EEPROM, PDSO8, 3.90 MM, ROHS COMPLIANT, PLASTIC, SOIC-8

ECAD模型

下載ECAD模型
$0.9 查看

相關(guān)推薦

  • esp32結(jié)合LVGL,天氣,日歷氣象站制作
    方案
    2295
    2024/09/03
  • 在LPC55S69上實(shí)現(xiàn)的秘鑰系統(tǒng)
    方案
    1806
    2024/07/25
  • 基于單片機(jī)proteus仿真的設(shè)計(jì)作業(yè)3個(gè)實(shí)驗(yàn)串口、并口、定時(shí)器(仿真圖、源代碼)
    方案
    1014
    2024/07/25