/* @brief This is a simple application for testing IIC communication on a RedPitaya * @Author Luka Golinar * * (c) Red Pitaya http://www.redpitaya.com * * This part of code is written in C programming language. * Please visit http://en.wikipedia.org/wiki/C_(programming_language) * for more details on the language used herein. */ #include #include #include #include #include #include #include #include #include #include #include #define I2C_SLAVE_FORCE 0x0706 #define EXPANDER_ADDR 0x20 int main(int argc, char *argv[]) { //int main(){ //int k; //for (k=0;k<=5;k++) //{ sleep(3); //printf("%i\n", k ); int dat; int fd; int status; char str [1+2*11]; //parse input arguments dat = (int)strtol(argv[1], NULL, 0); dat = (1<> 0) & 0xff; // GPIOA str [1+0x13] = (dat >> 8) & 0xff; // GPIOB str [1+0x14] = (dat >> 0) & 0xff; // OLATA str [1+0x15] = (dat >> 8) & 0xff; // OLATB status = write(fd, str, 1+2*11); //printf("Resistor data write = 0x%04x.\n", dat); // if (status) printf("Resistor write => %.1f\n", powf(10.0,(float)k+1)); //else // printf("Error write\n"); close(fd); //} return 0; }