当前位置: 首页 > news >正文

做网站什么硬盘好微网站制作公司

做网站什么硬盘好,微网站制作公司,免费做试卷的网站,企信查官网屏幕介绍 本文以中景园1.69寸LCD#xff0c;驱动芯片ST7789V2该款屏幕示例#xff0c;屏幕的分辨率为240*280 屏幕引脚说明 NanoPi NEO IO介绍 屏幕与板子的IO连接关系 屏幕NanoPi NEOGNDGNDVCC3.3VSCLPC2SDAPC0RESPG11DCPA1CSPC3BLKPA0 下载交叉编译器和linux内核源码并按教…屏幕介绍 本文以中景园1.69寸LCD驱动芯片ST7789V2该款屏幕示例屏幕的分辨率为240*280 屏幕引脚说明 NanoPi NEO IO介绍 屏幕与板子的IO连接关系 屏幕NanoPi NEOGNDGNDVCC3.3VSCLPC2SDAPC0RESPG11DCPA1CSPC3BLKPA0 下载交叉编译器和linux内核源码并按教程配置好开发环境 参考友善官方链接Building U-boot and Linux for H5/H3/H2/zh 修改设备树 需要修改的设备树文件路径 linux/arch/arm/boot/dts/sun8i-h3-nanopi.dtsi找到其中spi0节点修改为如下: spi0 {/* needed to avoid dtc warning */#address-cells 1;#size-cells 0;status okay;pinctrl-names default;pinctrl-0 spi0_pins spi0_cs_pins;cs-gpios pio 2 3 GPIO_ACTIVE_HIGH, pio 0 6 GPIO_ACTIVE_HIGH;spidev0: spi0 {compatible nanopi,spidev;reg 0;status disabled;spi-max-frequency 10000000;};spiflash: spiflash0 {#address-cells 1;#size-cells 1;compatible mxicy,mx25l12805d;reg 0;status disabled;spi-max-frequency 50000000;mode 0;partition0 {reg 0x0 0x1000000;label spi-flash;};};pitft: pitft0{compatible sitronix,st7789v;reg 0;status okay; /* 使能 */spi-max-frequency 96000000; /* 修改了默认速度 */rotate 90;/* 初始默认旋转了90度 横屏 */fps 33;buswidth 8;dc-gpios pio 0 1 GPIO_ACTIVE_HIGH; /* PA1 */reset-gpios pio 6 11 GPIO_ACTIVE_HIGH; /* PG11 */led-gpios pio 0 0 GPIO_ACTIVE_LOW; /* PA0 */debug 0x0;};pitft_ts: pitft-ts1 {compatible ti,ads7846;reg 1;status disabled;spi-max-frequency 2000000;interrupt-parent pio;interrupts 6 9 IRQ_TYPE_EDGE_FALLING; /* PG9 / EINT9 */pendown-gpio pio 6 9 GPIO_ACTIVE_LOW;ti,swap-xy;ti,vref-delay-usecs 1000;ti,x-min /bits/ 16 100;ti,x-max /bits/ 16 0xfff;ti,y-min /bits/ 16 100;ti,y-max /bits/ 16 0xfff;ti,vref-mv 3300;ti,x-plate-ohms /bits/ 16 256;ti,penirq-recheck-delay-usecs 10;ti,settle-delay-usec /bits/ 16 100;ti,keep-vref-on 1;ti,pressure-max /bits/ 16 0xfff;ti,debounce-max 10;ti,debounce-tol 30;ti,debounce-rep 1;}; }; 找到pio节点添加屏幕其它控制引脚的io pio {leds_npi: led_pins {pins PA10;function gpio_out;};lcd_reset_pins: lcd_reset_pins {pins PG11;function gpio_out;};lcd_dc_pins: lcd_dc_pins {pins PA1;function gpio_out;};lcd_led_pins: lcd_led_pins {pins PA0;function gpio_out;};spi0_cs_pins: spi0_cs_pins {pins PC3, PA6;function gpio_out;}; };禁用hdmi音频视频输出否则屏幕不显示 hdmi {#status okay;status disabled; };hdmi_out {hdmi_out_con: endpoint {remote-endpoint hdmi_con_in;}; };sound_hdmi {#status okay;status disabled; };修改驱动文件 linux/drivers/staging/fbtft/路径下找到fb_st7789v.c根据自己屏幕情况修改相关参数本人移植时出现屏幕颜色不对坐标偏移等情况根据中景园提供的驱动程序对该文件进行了一定修改本人用途屏幕旋转90度横屏使用只做了横屏坐标校准其它旋转角度下坐标不准只需要修改set_addr_win函数内的坐标偏移即可至此代码修改内容全部完成 /** FB driver for the ST7789V LCD Controller** Copyright (C) 2015 Dennis Menschel** This program is free software; you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation; either version 2 of the License, or* (at your option) any later version.** This program is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* GNU General Public License for more details.*/#include linux/bitops.h #include linux/delay.h #include linux/init.h #include linux/kernel.h #include linux/module.h #include video/mipi_display.h #include linux/gpio.h#include fbtft.h#define DRVNAME fb_st7789v#define DEFAULT_GAMMA \70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25\n \70 2C 2E 15 10 09 48 33 53 0B 19 18 20 25/*** enum st7789v_command - ST7789V display controller commands** PORCTRL: porch setting* GCTRL: gate control* VCOMS: VCOM setting* VDVVRHEN: VDV and VRH command enable* VRHS: VRH set* VDVS: VDV set* VCMOFSET: VCOM offset set* PWCTRL1: power control 1* PVGAMCTRL: positive voltage gamma control* NVGAMCTRL: negative voltage gamma control** The command names are the same as those found in the datasheet to ease* looking up their semantics and usage.** Note that the ST7789V display controller offers quite a few more commands* which have been omitted from this list as they are not used at the moment.* Furthermore, commands that are compliant with the MIPI DCS have been left* out as well to avoid duplicate entries.*/ enum st7789v_command {PORCTRL 0xB2,GCTRL 0xB7,VCOMS 0xBB,VDVVRHEN 0xC2,VRHS 0xC3,VDVS 0xC4,VCMOFSET 0xC5,PWCTRL1 0xD0,PVGAMCTRL 0xE0,NVGAMCTRL 0xE1, };#define MADCTL_BGR BIT(3) /* bitmask for RGB/BGR order */ #define MADCTL_MV BIT(5) /* bitmask for page/column order */ #define MADCTL_MX BIT(6) /* bitmask for column address order */ #define MADCTL_MY BIT(7) /* bitmask for page address order *//*** init_display() - initialize the display controller** par: FBTFT parameter object** Most of the commands in this init function set their parameters to the* same default values which are already in place after the display has been* powered up. (The main exception to this rule is the pixel format which* would default to 18 instead of 16 bit per pixel.)* Nonetheless, this sequence can be used as a template for concrete* displays which usually need some adjustments.** Return: 0 on success, 0 if error occurred.*/ static int init_display(struct fbtft_par *par) {/* turn off sleep mode */write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);mdelay(120); #if 0/* set pixel format to RGB-565 */write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT);write_reg(par, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22);/** VGH 13.26V* VGL -10.43V*/write_reg(par, GCTRL, 0x35);/** VDV and VRH register values come from command write* (instead of NVM)*/write_reg(par, VDVVRHEN, 0x01, 0xFF);/** VAP 4.1V (VCOM VCOM offset 0.5 * VDV)* VAN -4.1V (VCOM VCOM offset 0.5 * VDV)*/write_reg(par, VRHS, 0x0B);/* VDV 0V */write_reg(par, VDVS, 0x20);/* VCOM 0.9V */write_reg(par, VCOMS, 0x20);/* VCOM offset 0V */write_reg(par, VCMOFSET, 0x20);/** AVDD 6.8V* AVCL -4.8V* VDS 2.3V*/write_reg(par, PWCTRL1, 0xA4, 0xA1);write_reg(par, MIPI_DCS_SET_DISPLAY_ON);#endifwrite_reg(par, 0x3A,0x05);write_reg(par, 0xB2,0x0C,0x0C,0x00,0x33,0x33);write_reg(par, 0xB7,0x35);write_reg(par, 0xBB,0x32); write_reg(par, 0xC2,0x01); write_reg(par, 0xC3,0x15); write_reg(par, 0xC4,0x20);write_reg(par, 0xC6,0x0F);write_reg(par, 0xD0,0xA4,0xA1);write_reg(par,PVGAMCTRL,0xD0,0x08,0x0E,0x09,0x09,0x05,0x31,0x33,0x48,0x17,0x14,0x15,0x31,0x34);write_reg(par,NVGAMCTRL, 0xD0,0x08,0x0E,0x09,0x09,0x15,0x31,0x33,0x48,0x17,0x14,0x15,0x31,0x34);write_reg(par,0x21); write_reg(par,0x29);return 0; }/*** set_var() - apply LCD properties like rotation and BGR mode** par: FBTFT parameter object** Return: 0 on success, 0 if error occurred.*/ static int set_var(struct fbtft_par *par) {u8 madctl_par 0;if (par-bgr)madctl_par | MADCTL_BGR;switch (par-info-var.rotate) {case 0:break;case 90: madctl_par | (MADCTL_MV | MADCTL_MY);break;case 180:madctl_par | (MADCTL_MX | MADCTL_MY);break;case 270:madctl_par | (MADCTL_MV | MADCTL_MX);break;default:return -EINVAL;}write_reg(par, MIPI_DCS_SET_ADDRESS_MODE, madctl_par);return 0; }/*** set_gamma() - set gamma curves** par: FBTFT parameter object* curves: gamma curves** Before the gamma curves are applied, they are preprocessed with a bitmask* to ensure syntactically correct input for the display controller.* This implies that the curves input parameter might be changed by this* function and that illegal gamma values are auto-corrected and not* reported as errors.** Return: 0 on success, 0 if error occurred.*/ static int set_gamma(struct fbtft_par *par, u32 *curves) {int i;int j;int c; /* curve index offset *//** Bitmasks for gamma curve command parameters.* The masks are the same for both positive and negative voltage* gamma curves.*/static const u8 gamma_par_mask[] {0xFF, /* V63[3:0], V0[3:0]*/0x3F, /* V1[5:0] */0x3F, /* V2[5:0] */0x1F, /* V4[4:0] */0x1F, /* V6[4:0] */0x3F, /* J0[1:0], V13[3:0] */0x7F, /* V20[6:0] */0x77, /* V36[2:0], V27[2:0] */0x7F, /* V43[6:0] */0x3F, /* J1[1:0], V50[3:0] */0x1F, /* V57[4:0] */0x1F, /* V59[4:0] */0x3F, /* V61[5:0] */0x3F, /* V62[5:0] */};for (i 0; i par-gamma.num_curves; i) {c i * par-gamma.num_values;for (j 0; j par-gamma.num_values; j)curves[c j] gamma_par_mask[j];write_reg(par, PVGAMCTRL i,curves[c 0], curves[c 1], curves[c 2],curves[c 3], curves[c 4], curves[c 5],curves[c 6], curves[c 7], curves[c 8],curves[c 9], curves[c 10], curves[c 11],curves[c 12], curves[c 13]);}return 0; } static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) {switch(par-info-var.rotate){case 0: xs0;xe0;ys0;ye0;break;case 90: xs20;xe20;ys0;ye0;break;case 180: xs0;xe0;ys80;ye80;break;case 270: xs0;xe0;ys53;ye53;break;default :break;}write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,xs 8, xs 0xFF, xe 8, xe 0xFF);write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,ys 8, ys 0xFF, ye 8, ye 0xFF);write_reg(par, MIPI_DCS_WRITE_MEMORY_START); }/*** blank() - blank the display** par: FBTFT parameter object* on: whether to enable or disable blanking the display** Return: 0 on success, 0 if error occurred.*/ static int blank(struct fbtft_par *par, bool on) {if (on)write_reg(par, MIPI_DCS_SET_DISPLAY_OFF);elsewrite_reg(par, MIPI_DCS_SET_DISPLAY_ON);return 0; }static struct fbtft_display display {.regwidth 8,.width 240,.height 280,.gamma_num 2,.gamma_len 14,.gamma DEFAULT_GAMMA,.fbtftops {.init_display init_display,.set_var set_var,.set_addr_win set_addr_win,.set_gamma set_gamma,.blank blank,}, };FBTFT_REGISTER_DRIVER(DRVNAME, sitronix,st7789v, display);MODULE_ALIAS(spi: DRVNAME); MODULE_ALIAS(platform: DRVNAME); MODULE_ALIAS(spi:st7789v); MODULE_ALIAS(platform:st7789v);MODULE_DESCRIPTION(FB driver for the ST7789V LCD Controller); MODULE_AUTHOR(Dennis Menschel); MODULE_LICENSE(GPL);使用menuconfig使能该驱动 在linux源码根目录下执行 make menuconfig ARCHarm CROSS_COMPILEarm-linux-Device Drivers ---  [*] Staging drivers ---  * Support for small TFT LCD display modules ---* FB driver for the ST7789V LCD Controller编译内核设备树 # 编译内核、设备树、模块 make zImage dtbs modules ARCHarm CROSS_COMPILEarm-linux- 更新板子内核和设备树文件 将arch/arm/boot/zImage内核镜像文件和arch/arm/boot/dts/sun8i-h3-nanopi-neo.dtb 设备树文件拷贝到板子的/boot目录下使用内存卡拷贝或者网络传输都可以这里以网络更新为例 scp arch/arm/boot/zImage root192.168.31.88:/boot scp arch/arm/boot/dts/sun8i-h3-nanopi-neo.dtb root192.168.31.88:/boot重启板子后屏幕可以出现内核启动和linux终端画面 这里开机logo已经修改原系统是三只linux企鹅图标 后期玩法 画一张带屏幕的接口板与板子组合成一体可以移植lvgl或者QT真正变成一个小电脑 参考链接:NanoPi NEO Air使用十二使用自带的fbtft驱动点亮SPI接口TFT屏幕ST7789V
http://www.w-s-a.com/news/713465/

相关文章:

  • 中小企业服务中心网站建设做考勤的网站
  • 大连网站建设报价wordpress实用功能
  • 学校网站建设自查报告电脑网站制作教程
  • 适合推广的网站世界搜索引擎公司排名
  • 合肥网站建设费用ppt在哪个软件制作
  • 湖南省住房和城乡建设厅门户网站网站建设课程性质
  • 如何设计公司网站公司网站空间要多大
  • 建筑公司网站排名5G网站建设要多少个
  • seo怎样新建网站弹簧东莞网站建设
  • 在线做爰直播网站石家庄房产
  • 建筑网站哪里找拓者设计吧首页
  • 广州网站的建设wordpress注册数学验证码
  • 装修平台自己做网站有几个黄页名录网站开发
  • php网站的安全优势平面设计师培训
  • 乐清市网站建设设计重庆沙坪坝区
  • 什么是seo站内优化开发网页的工具有哪些
  • 文化类网站是不是休闲娱乐类网站青州市建设局网站
  • 网站的中英文切换代码做现货黄金网站
  • 万江区网站建设公司前端如何根据ui设计写页面
  • 宿迁公司做网站手机免费创建网站的软件
  • 免费可商用素材网站山东威海网站开发
  • 建设网站什么语言比较合适柳州建设网经济适用房
  • 企业网站的主要功能板块平台推广是做什么的
  • 网页网站自做全搞定西安建设工程信息网诚信平台
  • 网站vip怎么做建网站外包公司
  • 胶州建网站域名不备案可以正常使用吗
  • 网站建设客户开发方案软件工程师行业分析
  • 沈阳网站建设黑酷科技微信小程序怎么一键删除
  • 做网站产品搜索展示实现西安百度推广服务公司
  • 建立网站接受投注是什么意思一般使用的分辨率的显示密度是多少