That did the trick! Have you hacked up your EVM yet to see if it works as an 'IN' yet? Im considering my options for adding a button!
Andrew On Wed, 2006-10-11 at 14:26 +0200, Lorenzo Lutti wrote: > From: "Andrew Armstrong" <[EMAIL PROTECTED]> > > > I am trying to compile a pretty simple program that > > supposedly will > > flash some of the EVM's LEDS (Basic I2C interfacing). > > > > When I try to compile this on either the EMV or via the > > crosscompiler on > > my host machine I get a several screenfuls of complaints. > > The complaints come from <linux/i2c.h>, probably the correct user library > uses other headers. You can skip any user library by accessing the device > directly; try the following code: > > #include <stdio.h> > #include <sys/types.h> > #include <sys/stat.h> > #include <fcntl.h> > #include <stdlib.h> > #include <unistd.h> > #include <string.h> > #include <sys/ioctl.h> > #include <errno.h> > #include <signal.h> > > #define I2C_DEVICE "/dev/i2c/0" > #define I2C_DEV_ADDR 0x38 > #define I2C_SLAVE 0x0703 > > int main( int argc, char *argv[]) > { > int i2c_fd; > unsigned char val = 0xFE; > int ret; > struct timespec req = { > .tv_sec = 0, > .tv_nsec = 100000000, > }; > > if( (i2c_fd = open( I2C_DEVICE, O_RDWR)) < 0) > { > printf( "Unable to open the i2c port!\n"); > return 100; > } > if( ioctl( i2c_fd, I2C_SLAVE, I2C_DEV_ADDR) == -1) > { > close( i2c_fd); > printf( "Unable to setup the i2c port!\n"); > return 101; > } > > do > { > val <<= 1; > val |= 0x01; > if( val == 0xFF) > { > val = 0xFE; > } > write( i2c_fd, &val, 1); > } while( !nanosleep( &req, NULL)); > > close( i2c_fd); > printf( "End.\n"); > return 0; > } > > > Cheers, Lorenzo > > _______________________________________________ > Davinci-linux-open-source mailing list > Davinci-linux-open-source@linux.davincidsp.com > http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source _______________________________________________ Davinci-linux-open-source mailing list Davinci-linux-open-source@linux.davincidsp.com http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source