<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 點屏之SPI屏 ili9488 ili9488常用于480x320高清小屏應用。支持8080 8/16并行總線,3/4線SPI接口。 驅動手冊在此下載:https://pan.baidu.com/s/1pLZchuF 這里以4線SPI驅動講解。 ## 設備樹修改 ~~~ &spi0 { status = "okay"; ili9488@0 { compatible = "ilitek,ili9488"; reg = <0>; spi-max-frequency = <50000000>; rotate = <270>; fps = <30>; buswidth = <8>; regwidth = <8>; reset-gpios = <&pio 1 7 GPIO_ACTIVE_LOW>; dc-gpios = <&pio 1 5 GPIO_ACTIVE_LOW>; debug = <0>; }; }; ~~~ ## 代碼修改 因為ili9486手冊內容類似9488,所以拷貝一份命名為fb_ili9488.c,并在Kconfig和Makefile中增加對應項目。 編譯后下載,開機,發現全屏間隔顯示灰度條紋,且執行fbv命令顯示內容無任何改變。 ![](https://box.kancloud.cn/1088f9b941217b2544d6267fa8b513cc_766x1024.jpg) 這說明9488還是不兼容9486。 通過對初始化命令的調試發現,是0x3a指令的問題。 雖然寄存器列表中有16bit命令,但是實際上是不支持的。 切換到18bit指令: ![](https://box.kancloud.cn/8bc3e422513d93bfb5256e8e4d6c70e2_1920x1436.jpg) 可見可以看到圖像內容,且顯示區域只有2/3高度,推測是cpu端以16bit輸出,屏幕以18bit(補全后為3byte 24bit)解析導致。 查看fbtft-core.c代碼,發現確實只實現了16bit 565的方法。 所以我們需要增加666的顯示方法。 ### 新增666顯示 #### 初始化序列 ~~~ static const s16 default_init_sequence[] = { /* Interface Mode Control */ -1, 0xb0, 0x0, -1, MIPI_DCS_EXIT_SLEEP_MODE, -2, 250, /* Interface Pixel Format */ -1, MIPI_DCS_SET_PIXEL_FORMAT, 0x66, /* Power Control 3 */ -1, 0xC2, 0x44, /* VCOM Control 1 */ -1, 0xC5, 0x00, 0x00, 0x00, 0x00, -1, MIPI_DCS_EXIT_SLEEP_MODE, -1, MIPI_DCS_SET_DISPLAY_ON, /* end marker */ -3 }; ~~~ #### fbtft-core fbtft_framebuffer_alloc 這個函數只為RGB565編寫,所以需要修改 這里只考慮了bpp=8和16的情況 ~~~ vmem_size = display->width * display->height * bpp / 8; info->fix.line_length = width * bpp / 8; ~~~ 修改為 ~~~ int byteperpix = ( bpp + 7 ) / 8; vmem_size = display->width * display->height * byteperpix; info->fix.line_length = width * byteperpix; ~~~ 同時在9488的文件里也加上bpp信息為24bit。 (因為fb只支持8,16,24,32) 下面這段只考慮了565排序, ~~~ /* RGB565 */ info->var.red.offset = 11; info->var.red.length = 5; info->var.green.offset = 5; info->var.green.length = 6; info->var.blue.offset = 0; info->var.blue.length = 5; info->var.transp.offset = 0; info->var.transp.length = 0; ~~~ 幸好后面可以使用自己的驅動覆蓋: ~~~ fbtft_merge_fbtftops(&par->fbtftops, &display->fbtftops); ~~~ 所以在9488文件中修改set_var: 注意這里的var只影響mplayer等軟件的顏色。 fbv等軟件的顏色受dts里的bgr影響。 ~~~ par->info->var.red.offset = 16; par->info->var.red.length = 8; par->info->var.green.offset = 8; par->info->var.green.length = 8; par->info->var.blue.offset = 0; par->info->var.blue.length = 8; ~~~ #### 增加write_vmem方法 ~~~ /* 18/24 bit pixel over 8-bit databus */ int fbtft_write_vmem24_bus8(struct fbtft_par *par, size_t offset, size_t len) { u8 *vmem8; u8 *txbuf8 = par->txbuf.buf; size_t remain; size_t to_copy; size_t tx_array_size; int i; int ret = 0; size_t startbyte_size = 0; fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s(offset=%zu, len=%zu)\n", __func__, offset, len); remain = len / 3; vmem8 = (u8 *)(par->info->screen_buffer + offset); if (par->gpio.dc != -1) gpio_set_value(par->gpio.dc, 1); /* non buffered write */ if (!par->txbuf.buf) return par->fbtftops.write(par, vmem8, len); /* buffered write, /4*4 to faster */ tx_array_size = par->txbuf.len / 3 / 4 *4; if (par->startbyte) { txbuf8 = par->txbuf.buf + 1; tx_array_size -= 1; *(u8 *)(par->txbuf.buf) = par->startbyte | 0x2; startbyte_size = 1; } while (remain) { to_copy = min(tx_array_size, remain); dev_dbg(par->info->device, " to_copy=%zu, remain=%zu\n", to_copy, remain - to_copy); for (i = 0; i < to_copy/4; i++) { //faster copy *(u32*)(txbuf8+i*12) = *(u32*)(vmem8+i*12); *(u32*)(txbuf8+4+i*12) = *(u32*)(vmem8+4+i*12); *(u32*)(txbuf8+8+i*12) = *(u32*)(vmem8+8+i*12); } for(i = to_copy/4*4; i < to_copy; i++) { txbuf8[i*3] = vmem8[i*3]; txbuf8[i*3+1] = vmem8[i*3+1]; txbuf8[i*3+2] = vmem8[i*3+2]; } vmem8 = vmem8 + to_copy*3; ret = par->fbtftops.write(par, par->txbuf.buf, startbyte_size + to_copy * 3); if (ret < 0) return ret; remain -= to_copy; } return ret; } EXPORT_SYMBOL(fbtft_write_vmem24_bus8); ~~~ 然后在9488的文件里修改為: ~~~ static struct fbtft_display display = { .regwidth = 8, .width = WIDTH, .height = HEIGHT, .bpp = BPP, .init_sequence = default_init_sequence, .fbtftops = { .set_addr_win = set_addr_win, .set_var = set_var, .write_vmem = fbtft_write_vmem24_bus8, }, }; ~~~ ## 編譯運行 顯示效果如下: ![](https://box.kancloud.cn/b8d7b7ab59bc6b0bea9a06b29c27b048_1024x766.jpg) 播放視頻效果如下: http://v.youku.com/v_show/id_XMzM5OTAyNjY5Mg==.html 視頻中使用50MHz spi時鐘,會顯卡頓和撕裂。 實測60MHz以上時鐘可以流暢播放,但是由于杜邦線過長,會出現水波紋,如果在實際產品中使用較短走線和地包圍,應該沒有問題。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看