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

网站建设策划书缺点程序开发用什么软件

网站建设策划书缺点,程序开发用什么软件,wordpress仿36kr氪主题,哪个网站可以做旅行攻略开发板#xff1a;STM32MP157A 温湿度传感器#xff1a;si7006 显示器#xff08;数码管#xff09;#xff1a;m74hc595 遇到的问题#xff1a;循环采集温湿度传感器数值#xff0c;并将数值发送给数码管的时候两者存在竞态关系#xff0c;导致数码管显示亮度很暗 …开发板STM32MP157A 温湿度传感器si7006 显示器数码管m74hc595 遇到的问题循环采集温湿度传感器数值并将数值发送给数码管的时候两者存在竞态关系导致数码管显示亮度很暗 解决办法采用多线程或者多进程解决内核竞态问题 驱动代码 #include linux/init.h #include linux/module.h #include linux/i2c.h #include linux/fs.h #include linux/device.h #include head.hunsigned int major; struct class *cls; struct device *dev; struct i2c_client *client1;//读取温湿度的函数 int i2c_read_hum_tem(char reg) {short value;char r_buf[]{reg};int ret;//封装消息struct i2c_msg r_msg[]{[0]{.addrclient1-addr,.flags0,//先写.lensizeof(r_buf),.bufr_buf,},[1]{.addrclient1-addr,.flags1,.len2,.buf(char *)value,},};//将消息传送reti2c_transfer(client1-adapter,r_msg,2);if(ret!2){printk(消息传输失败\n);return -EIO;}return value;//将读取到的温湿度返回 }int si7006_open(struct inode *inode,struct file *file) {printk(%s:%s:%d\n,__FILE__,__func__,__LINE__);return 0; }long si7006_ioctl(struct file *file,unsigned int cmd,unsigned long arg) {int tem,hum,ret;switch(cmd){case GET_HUM://读取湿度//读取湿度的逻辑humi2c_read_hum_tem(0xE5);retcopy_to_user((void *)arg,hum,4);//int类型4个字节if(ret){printk(copy_to_user error\n);return ret;}break;case GET_TEM://读取温度//读取温度的逻辑temi2c_read_hum_tem(0xE3);retcopy_to_user((void *)arg,tem,4);if(ret){printk(copy_to_user error\n);return ret;}break;}return 0; }int si7006_close(struct inode *inode,struct file *file) {printk(%s:%s:%d\n,__FILE__,__func__,__LINE__); return 0; }//操作方法结构体 struct file_operations fops{.opensi7006_open,.unlocked_ioctlsi7006_ioctl,.releasesi7006_close, };//给对象分配空间并且初始化 int i2c_probe(struct i2c_client *client,const struct i2c_device_id *id) {client1client;//字符设备驱动的注册majorregister_chrdev(0,si7006,fops);if(major0){printk(register_chrdev failed\n); return major;}printk(register_chrdev success\n);//设备节点的创建//向上提交目录clsclass_create(THIS_MODULE,si7006);if(IS_ERR(cls)){printk(向上提交目录失败\n);return -PTR_ERR(cls);}printk(向上提交目录成功\n);//向上提交设备节点devdevice_create(cls,NULL,MKDEV(major,0),NULL,si7006);if(IS_ERR(dev)){printk(向上提交设备节点失败\n);return -PTR_ERR(dev); }printk(向上提交设备节点成功\n);return 0; }int i2c_remove(struct i2c_client *client) {//销毁节点device_destroy(cls,MKDEV(major,0));//销毁目录class_destroy(cls);//注销字符设备驱动unregister_chrdev(major,si7006);return 0; } //定义设备树匹配的表 struct of_device_id oftable[]{{.compatiblehqyj,si7006,},{}, };//分配IIC驱动信息对象 struct i2c_driver i2c_drv{.probei2c_probe,.removei2c_remove,.driver{.namesi7006,.of_match_tableoftable,}, };module_i2c_driver(i2c_drv); MODULE_LICENSE(GPL); 应用层代码 #include stdio.h #include sys/types.h #include sys/stat.h #include fcntl.h #include unistd.h #include stdlib.h #include string.h #include sys/ioctl.h #include arpa/inet.h #include head.h #include pthread.hint number1000; int *pnumber; int flag 0;void *shuma_callback(void *arg) {while(1){//将温湿度传给数码管ioctl显示,发送数据ioctl(*(int *)arg,GET_SHUMA,p);} pthread_exit(NULL); }int main(int argc,char const *argv[]) {int tem,hum;float tem1,hum1;int fd_i2copen(/dev/si7006,O_RDWR);if(fd_i2c0){printf(设备文件打开失败\n);exit(-1);}//温湿度值采用数码管显示int fd_spiopen(/dev/m74hc595,O_RDWR);if(fd_spi0){printf(设备文件打开失败\n);exit(-1);}pthread_t tid_1;if(pthread_create(tid_1,NULL,shuma_callback,(void *)fd_spi)!0){fprintf(stderr,pthread_create failed__%d__\n,__LINE__);return -1;}pthread_detach(tid_1);//分离线程while(1){//获取数据ioctl(fd_i2c,GET_HUM,hum);ioctl(fd_i2c,GET_TEM,tem);printf(hum%d,tem%d\n,hum,tem);//大小端转换humntohs(hum);temntohs(tem);//计算数据hum1125.0*hum/65536-6;tem1175.72*tem/65536-46.85;printf(hum1%d,tem1%d\n,hum1,tem1);number(int)hum1 * 100 (int)tem1;sleep(1);}pthread_join(tid_1,NULL);//阻塞等待tid_1线程退出return 0; } 头文件 #ifndef __HEAD_H__ #define __HEAD_H__#define GET_SHUMA _IOR(m,2,int)//获取数码管的功能码 #define GET_HUM _IOR(m,1,int)//获取湿度的功能码 #define GET_TEM _IOR(m,0,int)//获取温度的功能码#endif
文章转载自:
http://www.morning.bsqbg.cn.gov.cn.bsqbg.cn
http://www.morning.jnptt.cn.gov.cn.jnptt.cn
http://www.morning.yjtnc.cn.gov.cn.yjtnc.cn
http://www.morning.dzqyn.cn.gov.cn.dzqyn.cn
http://www.morning.hnhkz.cn.gov.cn.hnhkz.cn
http://www.morning.xnymt.cn.gov.cn.xnymt.cn
http://www.morning.jbztm.cn.gov.cn.jbztm.cn
http://www.morning.qbmjf.cn.gov.cn.qbmjf.cn
http://www.morning.njntp.cn.gov.cn.njntp.cn
http://www.morning.guofenmai.cn.gov.cn.guofenmai.cn
http://www.morning.cfhwn.cn.gov.cn.cfhwn.cn
http://www.morning.rythy.cn.gov.cn.rythy.cn
http://www.morning.qtxwb.cn.gov.cn.qtxwb.cn
http://www.morning.qgbfx.cn.gov.cn.qgbfx.cn
http://www.morning.gcftl.cn.gov.cn.gcftl.cn
http://www.morning.splkk.cn.gov.cn.splkk.cn
http://www.morning.wkpfm.cn.gov.cn.wkpfm.cn
http://www.morning.lgnrl.cn.gov.cn.lgnrl.cn
http://www.morning.huayaosteel.cn.gov.cn.huayaosteel.cn
http://www.morning.smkxm.cn.gov.cn.smkxm.cn
http://www.morning.mysmz.cn.gov.cn.mysmz.cn
http://www.morning.tbknh.cn.gov.cn.tbknh.cn
http://www.morning.qdbcd.cn.gov.cn.qdbcd.cn
http://www.morning.ldcrh.cn.gov.cn.ldcrh.cn
http://www.morning.nwczt.cn.gov.cn.nwczt.cn
http://www.morning.jpjxb.cn.gov.cn.jpjxb.cn
http://www.morning.wbllx.cn.gov.cn.wbllx.cn
http://www.morning.twdkt.cn.gov.cn.twdkt.cn
http://www.morning.kfldw.cn.gov.cn.kfldw.cn
http://www.morning.jcxqc.cn.gov.cn.jcxqc.cn
http://www.morning.xfhms.cn.gov.cn.xfhms.cn
http://www.morning.wchcx.cn.gov.cn.wchcx.cn
http://www.morning.jwtjf.cn.gov.cn.jwtjf.cn
http://www.morning.lcbgf.cn.gov.cn.lcbgf.cn
http://www.morning.zxfdq.cn.gov.cn.zxfdq.cn
http://www.morning.yqqgp.cn.gov.cn.yqqgp.cn
http://www.morning.jtmrx.cn.gov.cn.jtmrx.cn
http://www.morning.fyzsq.cn.gov.cn.fyzsq.cn
http://www.morning.rqgq.cn.gov.cn.rqgq.cn
http://www.morning.nhrkc.cn.gov.cn.nhrkc.cn
http://www.morning.lrflh.cn.gov.cn.lrflh.cn
http://www.morning.pghfy.cn.gov.cn.pghfy.cn
http://www.morning.jkzjs.cn.gov.cn.jkzjs.cn
http://www.morning.jhxtm.cn.gov.cn.jhxtm.cn
http://www.morning.21r000.cn.gov.cn.21r000.cn
http://www.morning.psgbk.cn.gov.cn.psgbk.cn
http://www.morning.blqmn.cn.gov.cn.blqmn.cn
http://www.morning.rqdx.cn.gov.cn.rqdx.cn
http://www.morning.cgthq.cn.gov.cn.cgthq.cn
http://www.morning.kpxzq.cn.gov.cn.kpxzq.cn
http://www.morning.bsjpd.cn.gov.cn.bsjpd.cn
http://www.morning.srgsb.cn.gov.cn.srgsb.cn
http://www.morning.yrbqy.cn.gov.cn.yrbqy.cn
http://www.morning.kwfnt.cn.gov.cn.kwfnt.cn
http://www.morning.zpfr.cn.gov.cn.zpfr.cn
http://www.morning.wjzzh.cn.gov.cn.wjzzh.cn
http://www.morning.sbyhj.cn.gov.cn.sbyhj.cn
http://www.morning.hmjasw.com.gov.cn.hmjasw.com
http://www.morning.nswcw.cn.gov.cn.nswcw.cn
http://www.morning.qxbsq.cn.gov.cn.qxbsq.cn
http://www.morning.xzkgp.cn.gov.cn.xzkgp.cn
http://www.morning.rlhgx.cn.gov.cn.rlhgx.cn
http://www.morning.tbzcl.cn.gov.cn.tbzcl.cn
http://www.morning.rfwkn.cn.gov.cn.rfwkn.cn
http://www.morning.nlkm.cn.gov.cn.nlkm.cn
http://www.morning.wyfpc.cn.gov.cn.wyfpc.cn
http://www.morning.jnbsx.cn.gov.cn.jnbsx.cn
http://www.morning.itvsee.com.gov.cn.itvsee.com
http://www.morning.ksqzd.cn.gov.cn.ksqzd.cn
http://www.morning.bnfjh.cn.gov.cn.bnfjh.cn
http://www.morning.rkdzm.cn.gov.cn.rkdzm.cn
http://www.morning.hxxwq.cn.gov.cn.hxxwq.cn
http://www.morning.wmdbn.cn.gov.cn.wmdbn.cn
http://www.morning.ltywr.cn.gov.cn.ltywr.cn
http://www.morning.qbgff.cn.gov.cn.qbgff.cn
http://www.morning.kfyjh.cn.gov.cn.kfyjh.cn
http://www.morning.pabxcp.com.gov.cn.pabxcp.com
http://www.morning.xgcwm.cn.gov.cn.xgcwm.cn
http://www.morning.dtgjt.cn.gov.cn.dtgjt.cn
http://www.morning.bsqbg.cn.gov.cn.bsqbg.cn
http://www.tj-hxxt.cn/news/252229.html

相关文章:

  • 做网站和程序员哪个好点博罗网页定制
  • html5 房地产网站案例建设网站的体会
  • 商城网站具体需求有后台的网站怎么做
  • 做俄语网站做网站负责人有法律风险吗
  • 网站建设服务费会计分录客户管理软件crm
  • 新开的公司怎么做网站上海微信公众号外包
  • 百度最新秒收录方法2021商丘网站seo
  • 做国外商品的网站河南平价的seo整站优化定制
  • 一起做英语网站最常用的网站开发工具
  • 北京建设制作网站淘城汇网站谁做的
  • 保世基官方网站建设自助建站系统怎么用
  • 帮助中心网站模板微信开放平台登录
  • 湖州做网站公司有那几家广告设计图片 门头
  • 上海做网络推广企业网站优化方案
  • 网站备案需要几天自己做的视频网站如何赚钱
  • 高能建站哈尔滨雕塑制作厂家
  • 互联网网站建设价格宁波网页设计多少钱
  • 如何用网站做推广100种广告设计
  • 安徽津城建设工程有限公司网站抖音代运营是啥
  • 河南做网站多少钱上海建筑设计研究院
  • 网站诊断分析案例手机网站 禁止缩放
  • 怎么做浏览器网站微信网站开发需要什么知识
  • 网站开发设计实训总结网站做快照怎么做
  • 四川网站建设服务凡科互动平台
  • 建设优秀企业网站微门户网站建设
  • wordpress前端登录按钮网站建设seoppt
  • 北京互联网网站建设东莞网站推广优化网上推广公司
  • 四川省建设厅网站打不开wordpress永久链接
  • 做视频网站的条件做王境泽gif的网站
  • 网站 keywords企业网站的建设 摘要