We are just documenting standard Linux interfaces. These methods have existed for years but the popular fruit Pi libraries promote other non-standard interfaces.
I have an array of AML-S905X-CC-V1.0-A “Le Potato” systems deployed remotely using BUSTER. We’d like to use the SARADC0 pin but after a few thousand file opens to read the system file, the system runs out of resources (sockets, etc) and only recovers when rebooted. Any help would be appreciated. A sample program demonstrates.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
FILE *saradc_file = NULL;
char string[80];
int reg_value;
int counter = 0;
while(1)
{
counter++;
saradc_file = fopen("/sys/bus//iio/devices/iio:device0/in_voltage0_raw","r");
if(saradc_file==NULL)
printf("Failed to open SARADC system file for read. counter:%d\n",counter);
if(fgets(string,80,saradc_file))
{ reg_value = atoi(string);
printf("%d Val: %d\n",counter,reg_value);
}
else printf("NO DATA TO READ\n");
fclose(saradc_file);
}
}