Compiling (on Omega+) AD7999 driver fails
- 
					
					
					
					
 Hi, Added the ability to compile on the Omega+ following the blog posts from a while ago. The code is from: https://github.com/ControlEverythingCommunity/AD7999/blob/master/C/AD7999_4Channel.c The compile fails with: gcc AD7999_4Channel.c -o AD7999 
 AD7999_4Channel.c: In function 'main':
 AD7999_4Channel.c:30:2: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
 write(file, config, 1);
 ^
 AD7999_4Channel.c:31:2: warning: implicit declaration of function 'sleep' [-Wimplicit-function-declaration]
 sleep(1);
 ^
 AD7999_4Channel.c:36:5: warning: implicit declaration of function 'read' [-Wimplicit-function-declaration]
 if(read(file, data, 2) != 2)
 ^
 AD7999_4Channel.c:51:7: error: redefinition of 'config'
 char config[1] = {0x20};
 ^
 AD7999_4Channel.c:29:7: note: previous definition of 'config' was here
 char config[1] = {0x10};
 ^
 AD7999_4Channel.c:57:7: error: redefinition of 'data'
 char data[2]={0};
 ^
 AD7999_4Channel.c:35:7: note: previous definition of 'data' was here
 char data[2]={0};
 ^
 AD7999_4Channel.c:73:7: error: redefinition of 'config'
 char config[1] = {0x40};
 ^
 AD7999_4Channel.c:51:7: note: previous definition of 'config' was here
 char config[1] = {0x20};
 ^
 AD7999_4Channel.c:79:7: error: redefinition of 'data'
 char data[2]={0};
 ^
 AD7999_4Channel.c:57:7: note: previous definition of 'data' was here
 char data[2]={0};
 ^
 AD7999_4Channel.c:95:7: error: redefinition of 'config'
 char config[1] = {0x80};
 ^
 AD7999_4Channel.c:73:7: note: previous definition of 'config' was here
 char config[1] = {0x40};
 ^
 AD7999_4Channel.c:101:7: error: redefinition of 'data'
 char data[2]={0};
 ^
 AD7999_4Channel.c:79:7: note: previous definition of 'data' was here
 char data[2]={0};No experience at all with C, so no clue what is happening there. Any hints/tips welcome Bas 
 
- 
					
					
					
					
 The given C code is for the Beaglebone black, not the Omega2. For the Omega2, they provide a python script. See https://github.com/ControlEverythingCommunity/AD7999#onion-omega for details. Also, I corrected the errors in the C program so that it should compile (untested): https://pastebin.com/JbRsABaa 
 Basically it was redefining lots of already existant variables, which is nonsense. I just modified them to alter the existing memory / clear old buffers. Successful compilation doesn't ofcourse mean that it works -- this program was still written for the Beaglonebone Black.The main problem of course is that you attempt to compile a C program without knowing C, so you're pretty helpless when a compile error occurs. As I said, there's also a python script, so you should try that first. 
 
- 
					
					
					
					
 Hi Maximillian, There is an issue with the Python code that causes reads to not return correct results (http://community.onion.io/topic/2347/issues-with-controleverything-ad7999/6). ControlEverything recommended to try the C code. I'll give your fix'ed up code a try tonight! Tx 
 Bas