41,18 → 41,8 |
#define M2 0x51 // 0xA2 in fact |
|
|
char vystup[50]; |
pthread_t thread_1, thread_2, thread_3; |
FILE *pRouraO,*pRouraI; |
unsigned int vzdalenost; |
char command,ble; |
int param; |
int file; |
double nord, east; |
int done; // vlajka, ze se neco udelalo |
int last_cross; // posledni krizovatka |
|
|
void I2C_addr (int Addr) |
{ |
if (ioctl(file, I2C_SLAVE, Addr) == -1) |
113,17 → 103,26 |
unsigned int OldAddress, NewAddress; |
char Buf[10]; |
|
fprintf(stdout, "\n **** Changing I2C Address **** \n \r"); |
fprintf(stdout, "\n **** Change I2C Address **** \n \r"); |
|
if (argc<2) |
{ |
printf("Use:\n%s OldAddress NewAddress - for change address\nOR\n%s Address - for echo\n\r",argv[0],argv[0]); |
return 0; |
} |
|
i2c_init(); |
|
if ( argc < 3 ) |
sscanf(argv[1],"%x",&OldAddress); |
|
if (argc==2) |
{ |
printf("Use:\n%s OldAddress NewAddress\n",argv[0]); |
echo(OldAddress); |
printf("Vzdalenost: %d\n", echo(NewAddress)); |
close(file); |
return 0; |
} |
|
sscanf(argv[1],"%x",&OldAddress); |
sscanf(argv[2],"%x",&NewAddress); |
|
printf("Old: %x New: %x\n", OldAddress, NewAddress); |