1.把AIN0上电路的可调电阻去掉
2.修改驱动,用AIN1或AIN2来读取
PS:吐槽一下为啥驱动里面不做通道选择,不难吧……
static ssize_t s3c2410_adc_write(struct file *filp, const char *buffer, size_t count, loff_t *ppos)
{
unsigned long data;
/*
if(count!=sizeof(data)) {
printk(KERN_INFO"the size of input data must be %d\n", sizeof(data));
return 0;
}
// */
copy_from_user(&data, buffer, count);
adcdev.channel = ADC_WRITE_GETCH(data);
adcdev.prescale = ADC_WRITE_GETPRE(data);
//DPRINTK("set adc channel=%d, prescale=0x%x\n", adcdev.channel, adcdev.prescale);
printk("set adc channel=%d, prescale=0x%x\n", adcdev.channel, adcdev.prescale);
return count;
}
打开adc设备的时候记得用O_RDWR,可以通道选择,分频设置
PS2:DPRINTK宏定义有问题,开了DEBUG之后不能编译通过?