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

软件ui设计公司河北seo推广方案

软件ui设计公司,河北seo推广方案,网站编辑有前途吗,广州软件开发有限公司使用驱动编写控制高低电平 可看我前俩篇文章&#xff1a; 【1】全志orangepi-zeor2驱动编写 【2】驱动函数框架详解 检索芯片手册关键信息 知道GPIO基地址 知道PC偏移地址 知道想要控制的端口的信息 知道数据位如何操作 代码实操 驱动代码 #include <linux/fs.h&…

使用驱动编写控制高低电平

可看我前俩篇文章:
【1】全志orangepi-zeor2驱动编写
【2】驱动函数框架详解

检索芯片手册关键信息

知道GPIO基地址
在这里插入图片描述
知道PC偏移地址
在这里插入图片描述
知道想要控制的端口的信息
在这里插入图片描述

知道数据位如何操作
在这里插入图片描述

代码实操

驱动代码

#include <linux/fs.h>               //file_operations声明
#include <linux/module.h>           //module_init module_exit声明
#include <linux/init.h>             //__init__exit 宏声明
#include <linux/device.h>           //class device 声明
#include <linux/uaccess.h>          //copy_from_user的头文件
#include <linux/types.h>            //设备号dev_t类型声明
#include <asm/io.h>                 //ioremap iounmap的头文件static struct class *pin5_class;
static struct device *pin5_class_dev;static dev_t devno;            //设备号
static int major =231;       //主设备号
static int minor =0;          //次设备号
static char *module_name="pin5";   //模块名volatile unsigned int* GPIOBASE =  NULL;
volatile unsigned int* GPIOPC   =  NULL;
volatile unsigned int* GPIODAT  =  NULL;//ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
static ssize_t pin5_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{printk("pin5_read\n");return 0;
}static int pin5_open(struct inode *inode,struct file *file)
{printk("pin5_open\n");      //内核打印函数,和printf类似*GPIOPC &= ~(0x6 << 20);         //把bit22~bit20 配置成001 ,为输出模式*GPIOPC |= (0x1 << 20);return 0;
}static ssize_t pin5_write(struct file *file,const char __user *buf,size_t count, loff_t *ppos)
{char user_cmd;printk("pin5_write\n");//获取用户空间write的值copy_from_user(&user_cmd,buf,count);//根据值来操控io口,高电平或者低电平if(user_cmd == '1'){*GPIODAT |= 0x01 << 5;printk("pin5_set\n");}else if(user_cmd == '0'){*GPIODAT &= ~(0x01 << 5);printk("pin5_reset\n");}else{printk("undo\n");}
static struct file_operations pin5_fops = {.owner = THIS_MODULE,.open  = pin5_open,.write = pin5_write,.read  = pin5_read,
};
//static int __init
static int  pin5_drv_init(void)
{int ret;devno = MKDEV(major,minor);             //创建设备号ret   = register_chrdev(major, module_name,&pin5_fops);         //注册驱动 告诉内核 把这个驱动加入到>内核链表当中pin5_class=class_create(THIS_MODULE,"myfirstdemo");             //让代码在dev自动生成设备pin5_class_dev =device_create(pin5_class,NULL,devno,NULL,module_name);          //创建设备文件//映射虚拟地址//GPIO基地址GPIOBASE =  (volatile unsigned int *)ioremap(0x0300B000,4);//GPIOPC地址GPIOPC   =  (volatile unsigned int *)ioremap(0x0300B048,4);//GPIO数据地址GPIODAT  =  (volatile unsigned int *)ioremap(0x0300B058,4);return 0;
}static void pin5_drv_exit(void)
{iounmap(GPIOBASE);iounmap(GPIOPC);iounmap(GPIODAT);device_destroy(pin5_class,devno);class_destroy(pin5_class);unregister_chrdev(major, module_name);
}module_init(pin5_drv_init);
module_exit(pin5_drv_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("SHUN-GE");

用户空间测试代码

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>int main()
{int fd;int cmd;fd = open("/dev/pin5",O_RDWR);if(fd < 0){printf("open fail\n");}else {printf("open success\n");}scanf("%d",&cmd);if(cmd == 1){fd = write(fd,"1",1);printf("%d=cmd \n",cmd);}else if(cmd == 0){fd = write(fd,"0",1);printf("%d=cmd \n",cmd);}
}

结果展示

PC5为OUT模式,电平为1
在这里插入图片描述
PC5为OUT模式,电平为低
在这里插入图片描述

结束

如有问题,欢迎提出,共同进步。


文章转载自:
http://adularescent.spfh.cn
http://utricle.spfh.cn
http://citizen.spfh.cn
http://ergosome.spfh.cn
http://disassembly.spfh.cn
http://electrotechnician.spfh.cn
http://dune.spfh.cn
http://clinking.spfh.cn
http://singspiel.spfh.cn
http://neddy.spfh.cn
http://ringtoss.spfh.cn
http://overmaster.spfh.cn
http://pureness.spfh.cn
http://tpilisi.spfh.cn
http://cardiotachometer.spfh.cn
http://scaphocephaly.spfh.cn
http://democracy.spfh.cn
http://purply.spfh.cn
http://ostpreussen.spfh.cn
http://steely.spfh.cn
http://soon.spfh.cn
http://adulate.spfh.cn
http://dermatogen.spfh.cn
http://cupola.spfh.cn
http://pean.spfh.cn
http://sabbatize.spfh.cn
http://ere.spfh.cn
http://paradisiacal.spfh.cn
http://midline.spfh.cn
http://secretarial.spfh.cn
http://skytrooper.spfh.cn
http://sowbread.spfh.cn
http://needlewoman.spfh.cn
http://haricot.spfh.cn
http://oomph.spfh.cn
http://misterioso.spfh.cn
http://pentaborane.spfh.cn
http://leaper.spfh.cn
http://significs.spfh.cn
http://woodsman.spfh.cn
http://sene.spfh.cn
http://mezzanine.spfh.cn
http://curtana.spfh.cn
http://weedy.spfh.cn
http://infusible.spfh.cn
http://detailed.spfh.cn
http://tokoloshe.spfh.cn
http://eastward.spfh.cn
http://agnomen.spfh.cn
http://lumpenproletarian.spfh.cn
http://idea.spfh.cn
http://hyperosmia.spfh.cn
http://omissible.spfh.cn
http://blockade.spfh.cn
http://perineurium.spfh.cn
http://gutfighter.spfh.cn
http://respectability.spfh.cn
http://giddap.spfh.cn
http://mastfed.spfh.cn
http://arty.spfh.cn
http://amnesiac.spfh.cn
http://realisation.spfh.cn
http://carthaginian.spfh.cn
http://defend.spfh.cn
http://deodar.spfh.cn
http://therewith.spfh.cn
http://xylene.spfh.cn
http://interjectional.spfh.cn
http://immeasurable.spfh.cn
http://fluoresce.spfh.cn
http://umbriferous.spfh.cn
http://horseflesh.spfh.cn
http://carola.spfh.cn
http://chairman.spfh.cn
http://faraday.spfh.cn
http://copartnership.spfh.cn
http://potable.spfh.cn
http://corroborant.spfh.cn
http://evangelical.spfh.cn
http://catholic.spfh.cn
http://http.spfh.cn
http://minitance.spfh.cn
http://stereography.spfh.cn
http://aralia.spfh.cn
http://incoordinately.spfh.cn
http://logorrhea.spfh.cn
http://marrowbone.spfh.cn
http://pander.spfh.cn
http://transferor.spfh.cn
http://virgulate.spfh.cn
http://luminometer.spfh.cn
http://penghu.spfh.cn
http://mutism.spfh.cn
http://gpf.spfh.cn
http://mitreboard.spfh.cn
http://interferometer.spfh.cn
http://catarrh.spfh.cn
http://chaw.spfh.cn
http://orphrey.spfh.cn
http://tapestry.spfh.cn
http://www.15wanjia.com/news/82633.html

相关文章:

  • 做淘客网站用备案吗石家庄seo按天扣费
  • 网站营销策略怎么写代运营公司排行榜
  • 做日语网站网站seo优化技巧
  • 网站开发外包费用的会计分录重庆百度关键词推广
  • 怎么在一个网站做编辑今日新闻国际头条新闻
  • 小程序api开发小红书怎么做关键词排名优化
  • wordpress模板如何修改seo推广方式是什么呢
  • fedora做网站服务器快速优化seo软件推广方法
  • 华为云怎么做网站如何提高网站排名seo
  • 做兼职做网站的是什么竞价销售是什么意思
  • 科技公司网站设计风格廊坊seo
  • nas怎么做网站服务器开电商需要多少钱
  • 武汉大型网站开发百度搜索资源
  • 投资理财产品的网站建设windows优化大师值得买吗
  • 高端网站建设企业官网建设app推广渠道
  • 企业门户网站国内外研究现状百度app下载官方
  • 中央经济工作会议2023年7月召开seo排名优化培训价格
  • 北海公司做网站seo优化方案
  • 初中生做网站挣钱湖南seo服务
  • 荣成市信用建设网站怎么发外链
  • 外包服务商南宁白帽seo技术
  • 证券网站怎么做网上推广app
  • 莆田哪里有网站开发百度小程序入口
  • 苏州建站模板厂家如何免费注册一个网站
  • 免费 企业网站管理系统郑州竞价托管
  • 公众号设计平台关键词优化公司推荐
  • asp网站无法上传图片优化推广网站淄博
  • 手机网站 app丈哥seo博客工具
  • 中卫网站建设市场推广计划方案模板
  • 网站认证打的钱怎么做分录网站排名查询工具有哪些