ADC input

ANY
Hi,

 got my mini today. Nice board.

I need to use all 4 adc channel (under Linux Qtopia 2.2), if i use /dev/adc
i can get the first, but what about the other 3?
Any way to read? Any api in the kernel?

Thanks in advice ANY

davef
Have you got the factory DVD?

#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/fs.h>
#include <errno.h>
#include <string.h>

int main(void)
{
  fprintf(stderr, "press Ctrl-C to stop\n");
  int fd = open("/dev/adc", 0);
  if (fd < 0) {
    perror("open ADC device:");
    return 1;
  }
  for(;;) {
    char buffer[30];
    int len = read(fd, buffer, sizeof buffer -1);
    if (len > 0) {
      buffer[len] = '\0';
      int value = -1;
      sscanf(buffer, "%d", &value);
      printf("ADC Value: %d\n", value);
    } else {
      perror("read ADC device:");
      return 1;
    }
    usleep(500* 1000);
  }
  
  close(fd);
}

I'd try putting a 1, 2 or 3 into:

int fd = open("/dev/adc", 0);

If that doesn't do it, then I'd go and read:
http://lxr.linux.no/#linux+v2.6.32/arch/arm/plat-s3c24xx/adc.c#L75

Good luck!

ANY
That number is "how" to open the file, 0 mean read only. 
So I think i need to look at the source :)