Application Layer vs Module Driver Layer Function Correspondence Table¶
The following table shows the operations at various application layers (here, the application layer refers to the rt_device layer calls) and the corresponding events occurring in the underlying driver:
Application layer operations for the screen and their corresponding low-level function calls¶
Process of opening the screen call¶
应用层调用函数:
rt_device_open(lcd_device, RT_DEVICE_OFLAG_RDWR); //打开屏幕
顺序 |
驱动层调用函数 |
函数在文件路径 |
描述 |
---|---|---|---|
1 |
BSP_LCD_PowerUp(void); |
bsp_lcd_tp.c |
Power up the screen |
2 |
LCD_Init(hlcdc) |
nv3051f1.c |
Screen driver initialization function |
3 |
LCD_ReadID(hlcdc) |
nv3051f1.c |
Screen presence detection(开机检测1次) |
Process of closing the screen call¶
应用层调用函数:
rt_device_close(lcd_device); //关闭屏幕
顺序 |
驱动层调用函数 |
函数在文件路径 |
描述 |
---|---|---|---|
1 |
LCD_DisplayOff(hlcdc) |
nv3051f1.c |
Turn off the LCD |
2 |
LCD_SetBrightness(hlcdc, br) |
nv3051f1.c |
Set backlight brightness to 0 |
3 |
BSP_LCD_PowerDown(void); |
bsp_lcd_tp.c |
Power down the screen |
Set the screen data receiving area¶
应用层调用函数:
rt_graphix_ops(lcd_device)->set_window(0,0,239,319); //设置起始坐标为{0,0},高宽为240x320的接收区域
顺序 |
驱动层调用函数 |
函数在文件路径 |
描述 |
---|---|---|---|
1 |
LCD_SetRegion(hlcdc, Xpos0, Ypos0, Xpos1, Ypos1) |
nv3051f1.c |
Set the screen reception area |
Push Framebuffer to the screen¶
应用层调用函数:
uint8_t framebuffer[240*320];
rt_graphix_ops(lcd_device)->draw_rect_async((const char *)&frambuffer, 0,0,239,319); //推送起始坐标为{0,0},高宽为240x320的Framebuffer到屏幕
顺序 |
驱动层调用函数 |
函数在文件路径 |
描述 |
---|---|---|---|
1 |
LCD_WriteMultiplePixels(hlcdc, const uint8_t *RGBCode, Xpos0, Ypos0, Xpos1, Ypos1) |
nv3051f1.c |
Push Framebuffer to the screen |
Set screen brightness¶
应用层调用函数:
uint8_t brightness = 100;//背光亮度百分比值
rt_device_control(lcd_device, RTGRAPHIC_CTRL_SET_BRIGHTNESS, &brightness); //Set backlight brightness
顺序 |
驱动层调用函数 |
函数在文件路径 |
描述 |
---|---|---|---|
1 |
LCD_SetBrightness(hlcdc, br) |
nv3051f1.c |
Set backlight brightness |
2 |
LCD_DisplayOn(hlcdc) |
nv3051f1.c |
Turn on the LCD screen |
Application layer operations for TP and their corresponding low-level function calls¶
Open the TP device¶
rt_device_open(touch_device, RT_DEVICE_FLAG_RDONLY); //Open the TP device
顺序 |
驱动层调用函数 |
函数在文件路径 |
描述 |
---|---|---|---|
1 |
BSP_TP_PowerUp |
bsp_lcd_tp.c |
Touch power up |
2 |
rt_bool_t probe(void) |
gt911.c |
Touch presence detection(只做1次) |
3 |
rt_err_t init(void) |
gt911.c |
Touch initialization |
Close the TP device¶
rt_device_close(touch_device); //Close the TP device
顺序 |
驱动层调用函数 |
函数在文件路径 |
描述 |
---|---|---|---|
1 |
rt_err_t deinit(void) |
gt911.c |
Touch deinitialization |
2 |
BSP_TP_PowerUp |
bsp_lcd_tp.c |
Touch power up |
Read TP data points¶
struct touch_message touch_data;
rt_device_read(touch_device, 0, &touch_data, 1); //Read TP data points
顺序 |
驱动层调用函数 |
函数在文件路径 |
描述 |
---|---|---|---|
1 |
rt_err_t read_point(touch_msg_t p_msg) |
gt911.c |
Touch read data point |