91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2.49MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2023-09-04
  • 語言: 其他
  • 標簽: S3C2440??linu??

資源簡介

基于s3c2440的智能家居控制系統,包含手勢控制和語音控制(外接語音芯片),溫濕度,光照煙霧,OLED顯示等.

資源截圖

代碼片段和文件信息

/*****************************************************
*文件描述?:??煙霧傳感器.溫度傳感器?AD轉換
*引腳連接?:??煙霧傳感器(channel0)?AIN0
*????????????光照傳感器(channel1)?AIN1
*模塊說明?:??只是采集了電壓值?實際上的警報閾值還需要測量
******************************************************/

#include??
#include??
#include??
#include??
#include??
#include??
#include??
#include??
#include???
#include??
#include??
#include??
#include??
#include??“adc_h.h“

#define?ADCCON???0x58000000??//ADC?control
#define?ADCTSC???0x58000004???//ADC?touch?screen?contro
#define?ADCDAT0??0x5800000C?

unsigned?int??*adc_con;
unsigned?int??*adc_data;
unsigned?int??*adc_tsc;
unsigned?int??*gpb_con;
unsigned?int??*gpb_data;

#define?CDEV_NAME???“adc“


dev_t?dev?=?0;
struct?cdev?dev_c;
struct?class?*adc_class;

/*open*/
static?int?adc_open(struct?inode?*inode?struct?file?*fd)
{???
????unsigned?int?value=0;?
????
????/*映射地址初始化ADCCON和ADCTSC*/
????adc_con?=?ioremap(ADCCON?4);
????if(!adc_con)
????{
????????printk(KERN_WARNING“adc_con?ioremap?fail\n“);
????????goto?err;
????}
????/*設置adc時鐘頻率*/
????value?=?readl(adc_con);
????value?|=?(1<<14)?|?(49<<6);??//預分頻使能.并設定時鐘頻率
????value?&=?~(0x7<<3);????//通道選擇為AIN?0?
?????
????writel(value?adc_con);
????value?=?0;
????
????/*設置adc為普通ad轉換模式*/
????adc_tsc?=?ioremap(ADCTSC?4);
????if(!adc_tsc)
????{
????????printk(KERN_WARNING“adc_tsc?ioremap?fail\n“);
????????goto?err;
????}
????writel(0x0?adc_tsc);
????
????
????adc_data?=?ioremap(ADCDAT0?4);
????if(!adc_data)
????{
????????printk(KERN_WARNING“adc_data?ioremap?fail\n“);
????????goto?err;
????}
????
????fd->private_data?=?adc_con;?//嘗試性保存一個adc_con
????
? printk(KERN_DEBUG“ADC?is?initial!\n“);
????return?0;
????
????err:
????????return?-1;
}

/*write*/
static?ssize_t?adc_write(struct?file?*fd?const?char?__user?*buffer?size_t?count?loff_t?*f_pos)
{??
????unsigned?int?channel=0;
????unsigned?int?value=0;
????
????int?*register_addr?=?fd->private_data;
????
????if(copy_from_user(&channel?buffer?count))??//獲取通道
????{
????????printk(KERN_WARNING“write?from?user?fail!\n“); ??
????}
????/*先把通道清0*/
????value?=?readl(register_addr);?
????value?&=?~(0x7<<3);??????//清0
????value?|=?(channel<<3);???//通道選擇通道由應用程序決定
???????
????writel(value?register_addr);??
???
????return?count;
}


/*read*/
static?ssize_t?adc_read(struct?file?*fd?char?__user?*buf?size_t?count?loff_t?*f_pos)
{?
????unsigned?int?value=0;
????unsigned?short?ad_data=0;
????
????value?=?readl(adc_con);
????value?|=?0x1;?//開啟轉換
????writel(value?adc_con);
????
????while(readl(adc_con)?&?0x1);//等待傳輸開始
??
????while(!(readl(adc_con)?&?(1<<15)));?//等待傳輸結束
??
????ad_data?=?(readl(adc_data)?&?0x3ff);

????copy_to_user(buf?&ad_data?count);?
????
????return?count;??
}

/*close*/
static?int?adc_close(struct?inode?*inode?struct?file?*fd)?
{??
????s3c2410_gpio_setpin(S3C2410_GPB(0)0);
??

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-04-20?17:51??smart_house\
?????目錄???????????0??2018-04-20?17:51??smart_house\AD\
?????文件?????????251??2018-04-10?16:29??smart_house\AD\.adc.ko.cmd
?????文件???????15235??2018-04-09?21:12??smart_house\AD\.adc.mod.o.cmd
?????文件???????18744??2018-04-10?16:29??smart_house\AD\.adc.o.cmd
?????目錄???????????0??2018-04-20?17:51??smart_house\AD\.tmp_versions\
?????文件??????????73??2018-04-10?16:29??smart_house\AD\.tmp_versions\adc.mod
?????文件????????5704??2018-04-10?16:22??smart_house\AD\adc.c
?????文件????????5399??2018-04-10?16:29??smart_house\AD\adc.ko
?????文件?????????444??2018-04-09?21:12??smart_house\AD\adc.mod.c
?????文件????????1484??2018-04-09?21:12??smart_house\AD\adc.mod.o
?????文件????????4652??2018-04-10?16:29??smart_house\AD\adc.o
?????文件??????646728??2018-04-09?21:13??smart_house\AD\adc_app
?????文件????????3150??2018-04-01?21:25??smart_house\AD\adc_app.c
?????文件?????????425??2016-11-29?08:53??smart_house\AD\adc_h.h
?????文件?????????182??2018-04-01?21:12??smart_house\AD\Makefile
?????文件???????????0??2018-04-09?21:12??smart_house\AD\Module.symvers
?????文件??????????44??2018-04-10?16:29??smart_house\AD\modules.order
?????文件?????????480??2016-11-29?10:56??smart_house\AD\my_project_app.h
?????文件?????????427??2016-11-29?10:39??smart_house\AD\my_test.h
?????目錄???????????0??2018-04-20?17:51??smart_house\APDS_9960\
?????文件?????????287??2018-04-07?21:48??smart_house\APDS_9960\.apds9960_func.ko.cmd
?????文件???????15336??2018-04-07?21:48??smart_house\APDS_9960\.apds9960_func.mod.o.cmd
?????文件???????21567??2018-04-07?21:48??smart_house\APDS_9960\.apds9960_func.o.cmd
?????文件?????????303??2018-04-10?16:29??smart_house\APDS_9960\.apds_9960.ko.cmd
?????文件???????15364??2018-04-10?11:15??smart_house\APDS_9960\.apds_9960.mod.o.cmd
?????文件???????22905??2018-04-10?16:29??smart_house\APDS_9960\.apds_9960.o.cmd
?????目錄???????????0??2018-04-20?17:51??smart_house\APDS_9960\.tmp_versions\
?????文件??????????99??2018-04-10?16:29??smart_house\APDS_9960\.tmp_versions\apds_9960.mod
?????文件???????30564??2018-04-07?16:58??smart_house\APDS_9960\apds9960_func.c
?????文件???????35178??2018-04-10?16:25??smart_house\APDS_9960\apds_9960.c
............此處省略89個文件信息

評論

共有 條評論