中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

做IT的會做網(wǎng)站嗎權重查詢愛站網(wǎng)

做IT的會做網(wǎng)站嗎,權重查詢愛站網(wǎng),高端網(wǎng)站設計建設,科技有限公司是干什么的目錄 1.8080通信的電阻屏LCD設備1.1 構造流程1.2 使用2.i2c和spi通信的電阻屏LCD 電阻屏LCD通信接口有支持I2c、SPI和8080通信接口的。 1.8080通信的電阻屏LCD設備 lcd這塊不像其他設備類,rtt沒有實現(xiàn)的設備驅動框架層,那么是在驅動層直接實現(xiàn)的。 以…

目錄

    • 1.8080通信的電阻屏LCD設備
      • 1.1 構造流程
      • 1.2 使用
        • 2.i2c和spi通信的電阻屏LCD

電阻屏LCD通信接口有支持I2c、SPI和8080通信接口的。

1.8080通信的電阻屏LCD設備

lcd這塊不像其他設備類,rtt沒有實現(xiàn)的設備驅動框架層,那么是在驅動層直接實現(xiàn)的。

以stm32f407-atk-explorer為例,該bsp支持電阻觸摸屏LCD,在/bsp / stm32 / stm32f407-atk-explorer / board / ports /drv_lcd.c中定義了該設備類:

struct drv_lcd_device
{struct rt_device parent;struct rt_device_graphic_info lcd_info;
};

其中struct rt_device_graphic_info是在/ components / drivers / include / drivers /classes/graphic.h定義的:

struct rt_device_graphic_info
{rt_uint8_t  pixel_format;                           /**< graphic format */rt_uint8_t  bits_per_pixel;                         /**< bits per pixel */rt_uint16_t pitch;                                  /**< bytes per line */rt_uint16_t width;                                  /**< width of graphic device */rt_uint16_t height;                                 /**< height of graphic device */rt_uint8_t *framebuffer;                            /**< frame buffer */rt_uint32_t smem_len;                               /**< allocated frame buffer size */
};

然后實例化了該設備類

static struct drv_lcd_device _lcd;

1.1 構造流程

并實現(xiàn)了其構造函數(shù)drv_lcd_hw_init:

int drv_lcd_hw_init(void)
{rt_err_t result = RT_EOK;struct rt_device *device = &_lcd.parent;/* memset _lcd to zero */memset(&_lcd, 0x00, sizeof(_lcd));_lcd.lcd_info.bits_per_pixel = 16;_lcd.lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565;device->type = RT_Device_Class_Graphic;
#ifdef RT_USING_DEVICE_OPSdevice->ops = &lcd_ops;
#elsedevice->init = drv_lcd_init;device->control = drv_lcd_control;
#endifdevice->user_data = &fsmc_lcd_ops;/* register lcd device */rt_device_register(device, "lcd", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STANDALONE);return result;
}
INIT_DEVICE_EXPORT(drv_lcd_hw_init);

可以看到其重寫了父類——設備基類的方法——但是只是重寫了init方法和control方法。
其對象圖如下
請?zhí)砑訄D片描述
然后它就調用設備基類的構造函數(shù)rt_device_register,將電阻屏LCD設備對象放到對象容器里管理。

詳細參見io設備管理層。
https://blog.csdn.net/yhb1206/article/details/136440373

1.2 使用

在/bsp / stm32 / stm32f407-atk-explorer / board / ports / touch /drv_xpt2046_init.c中,

static int touch_xpt2046_init(void)
{xpt2046_init_hw();rt_thread_t tid = rt_thread_create("xpt2046", xpt2046_entry, RT_NULL, 1024, 8, 20);RT_ASSERT(tid != RT_NULL);rt_thread_startup(tid);return RT_EOK;
}
INIT_COMPONENT_EXPORT(touch_xpt2046_init);

void xpt2046_init_hw(void)
{……lcd = rt_device_find("lcd");rt_device_init(lcd);
}

在rtt的io設備框架面向對象學習-touch設備中說過,因為此bsp的LCD是電阻觸摸LCD屏,所以在xpt2046_init_hw中初始化觸摸設備,最后也初始化了LCD。

在xpt2046_entry線程中,讀取到觸摸坐標點,若開啟了lvgl繪圖,則通知lvgl繪圖,否則直接調用rt_graphix_ops(lcd)->set_pixel在LCD上繪制點的軌跡。

void xpt2046_entry(void *parameter)
{……  while (1){        ……  #ifdef PKG_USING_LVGL            lv_port_indev_input(read_data.x_coordinate, read_data.y_coordinate, ((read_data.event == RT_TOUCH_EVENT_DOWN) ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL));#else /* PKG_USING_LVGL */            const rt_uint32_t black = 0x0;            rt_graphix_ops(lcd)->set_pixel((const char *)(&black),                                        read_data.x_coordinate,                                         read_data.y_coordinate);#endif rt_thread_mdelay(1);     }        }

如上線程,若是lvgl讀到觸摸坐標則調用lv_port_indev_input通知lvgl事件,/bsp / stm32 / stm32f407-atk-explorer / board / ports/drv_lcd.c中的函數(shù)lcd_fill_array作為對接lvgl的繪圖回調函數(shù):

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)
{    
rt_uint16_t *pixel = RT_NULL;    
rt_uint16_t cycle_y, x_offset = 0;    
pixel = (rt_uint16_t *)pcolor;    
for(cycle_y = y_start; cycle_y <= y_end; )    {        
LCD_SetCursor(x_start, cycle_y);        LCD_WriteRAM_Prepare();        
for(x_offset = 0;x_start + x_offset <= x_end; x_offset++)        
{            
LCD->RAM = *pixel++;       }        cycle_y++;    }
}

可以看到通過繪點來實現(xiàn)顯示刷新。

但是如果沒有開啟lvgl,則直接調用rt_graphix_ops(lcd)->set_pixel,它是/ components / drivers / include / drivers /classes/graphic.h定義的lcd操作接口:

struct rt_device_graphic_ops
{void (*set_pixel) (const char *pixel, int x, int y);void (*get_pixel) (char *pixel, int x, int y);void (*draw_hline)(const char *pixel, int x1, int x2, int y);void (*draw_vline)(const char *pixel, int x, int y1, int y2);void (*blit_line) (const char *pixel, int x, int y, rt_size_t size);
};
#define rt_graphix_ops(device)          ((struct rt_device_graphic_ops *)(device->user_data))

而之前drv_lcd.c中實現(xiàn)了該接口:

struct rt_device_graphic_ops fsmc_lcd_ops ={LCD_Fast_DrawPoint,LCD_ReadPoint,LCD_HLine,LCD_VLine,LCD_BlitLine,
};

并在構造函數(shù)drv_lcd_hw_init中賦給了設備基類的user_data 成員

device->user_data = &fsmc_lcd_ops;

這樣就能直接操作lcd繪圖。

2.i2c和spi通信的電阻屏LCD

至于i2c和spi通信的電阻屏LCD是怎么操作的,通過查找,是沒有新的對象的,都是直接對i2c總線和spi設備關聯(lián),直接包裝發(fā)送數(shù)據(jù)即可,沒有上面8080通信口那樣子的新的設備框架對象。
spi的LCD屏可以參照官方開發(fā)板麻雀一號開發(fā)板。
i2c未找到參照物,但是應該是spi一樣。

http://www.risenshineclean.com/news/58871.html

相關文章:

  • linux打包網(wǎng)站做備份網(wǎng)絡營銷產品策略的內容
  • 深圳做網(wǎng)站建設比較好的公司濟南網(wǎng)站seo優(yōu)化
  • wordpress 自建網(wǎng)站seo百度快速排名
  • 九江做網(wǎng)站廈門網(wǎng)絡推廣外包多少錢
  • 邢臺網(wǎng)站建設包括哪些專業(yè)北京seo公司
  • 中企動力做的家具行業(yè)網(wǎng)站企業(yè)網(wǎng)絡營銷策劃書范文
  • 12免費建站網(wǎng)站百度關鍵詞搜索熱度查詢
  • 石城網(wǎng)站建設東莞有限公司seo
  • 長春火車站到吉大二院網(wǎng)絡營銷措施有哪些
  • 網(wǎng)站建設頁面頁腳怎么設置b站推廣2024mmm已更新
  • 阿里云服務器做電影網(wǎng)站嗎在線培訓管理系統(tǒng)
  • 招聘網(wǎng)站做沙龍如何在百度上做產品推廣
  • ipad 建網(wǎng)站免費搜索引擎入口
  • 庫爾勒網(wǎng)站建設哪家專業(yè)項目營銷策劃方案
  • 衡陽哪有做網(wǎng)站推廣的網(wǎng)站關鍵詞全國各地的排名情況
  • sm做任務的網(wǎng)站有哪些企業(yè)推廣是做什么的
  • 佛山市建設行政主管部門網(wǎng)站網(wǎng)絡優(yōu)化工作內容
  • 深圳設計網(wǎng)站今日足球賽事推薦
  • 網(wǎng)站開發(fā)外包知名品牌營銷案例100例
  • 用vs2015做網(wǎng)站企業(yè)網(wǎng)站seo優(yōu)化外包
  • 網(wǎng)站建設與規(guī)劃東莞seo培訓
  • 青島免費建網(wǎng)站外貿google推廣
  • 淄博網(wǎng)站制作高端網(wǎng)絡登錄百度app
  • 溫州做網(wǎng)站建設公司百度sem
  • 在線商城網(wǎng)站開發(fā)代碼windows優(yōu)化大師是病毒嗎
  • 建立網(wǎng)站平臺需要那些技術鎮(zhèn)江seo快速排名
  • 正能量網(wǎng)站ip網(wǎng)絡營銷推廣有哪些方法
  • 網(wǎng)站設計 聯(lián)系怎樣進行網(wǎng)絡推廣效果更好
  • 做網(wǎng)站需要網(wǎng)站負責人推動防控措施持續(xù)優(yōu)化
  • 提卡的網(wǎng)站怎么做查網(wǎng)站權重