Re: BBB IIO ADC access not working

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 20, 2015 at 08:50:28AM -0700, Greg Wilson-Lindberg wrote:
>  
> 
> > -----Original Message-----
> > From: Michael Welling [mailto:mwelling79@xxxxxxxxx] On Behalf 
> > Of Michael Welling
> > Sent: Wednesday, August 19, 2015 2:43 PM
> > To: Greg Wilson-Lindberg
> > Cc: Daniel Baluta; linux-iio@xxxxxxxxxxxxxxx
> > Subject: Re: BBB IIO ADC access not working
> > 
> > On Wed, Aug 19, 2015 at 02:34:39PM -0700, Greg Wilson-Lindberg wrote:
> > > 
> > > So, in that case, can I just open it once and leave it open?
> > 
> > Yes.
> > 
> > > Is it reading from a buffer, or is it reading what is 
> > current in the ADC? 
> > 
> > It is the current reading.
> > 
> > > Can I just set up a timer to get readings to average then?
> > 
> > Sure.
> > 
> > Here are some helper functions:
> > 
> > int iio_adc_open_channel(int dev_num, int chan_num) {
> > 	char filename[255];
> > 
> > 	sprintf(filename, 
> > "/sys/bus/iio/devices/iio:device%d/in_voltage%d_raw",
> > 			dev_num, chan_num);
> > 
> > 	return open(filename, O_RDONLY);
> > }
> > 
> > int iio_adc_read_channel(int fd)
> > {
> > 	int count;
> > 	char buffer[255];
> > 	int value = -1;
> > 
> > 	lseek(fd,0,SEEK_SET);
> > 
> > 	count = read(fd, buffer, 255);
> > 
> > 	if (count > 0)
> > 		value = strtoul(buffer, NULL, 10);
> > 
> > 	return value;
> > }
> > 
> > Example usage:
> > 
> > int fd;
> > .
> > .
> > 
> > fd = iio_adc_open_channel(0, 4);
> > .
> > .
> > 
> > while (1)
> > {
> > 	printf("ADC = %x\n", iio_adc_read_channel(fd)); }
> > 
> > 
> 
> I converted to using this interface and left the system running overnight and 
> the touch screen was locked up this morning.

This is without any modifications to the kernel?

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux