Subversion Repositories svnkaklik

Compare Revisions

Regard whitespace Rev 374 → Rev 376

/roboti/Robotour/SW/i2c/main.cpp
107,7 → 107,7
 
if (argc<2)
{
printf("Use:\n%s OldAddress NewAddress - for change address\nOR\n%s Address - for echo\n\r",argv[0],argv[0]);
printf("Use:\n%s OldAddress NewAddress - for change address\nOR\n%s Address - for echo\n\n\r",argv[0],argv[0]);
return 0;
}
 
117,8 → 117,7
 
if (argc==2)
{
echo(OldAddress);
printf("Vzdalenost: %d\n", echo(NewAddress));
printf("Vzdalenost: %d\n", echo(OldAddress>>1));
close(file);
return 0;
}
127,21 → 126,29
 
printf("Old: %x New: %x\n", OldAddress, NewAddress);
 
echo(OldAddress);
printf("Vzdalenost: %d\n", echo(NewAddress));
printf("Vzdalenost: %d\n", echo(OldAddress>>1));
 
I2C_addr(OldAddress);
I2C_addr(OldAddress>>1);
Buf[0]=0x0;
Buf[1]=0xA0;
Buf[2]=0xAA;
Buf[3]=0xA5;
Buf[4]=(unsigned char)NewAddress;
write(file, Buf, 5);
write(file, Buf, 2);
I2C_addr(OldAddress>>1);
Buf[0]=0x0;
Buf[1]=0xAA;
write(file, Buf, 2);
I2C_addr(OldAddress>>1);
Buf[0]=0x0;
Buf[1]=0xA5;
write(file, Buf, 2);
I2C_addr(OldAddress>>1);
Buf[0]=0x0;
Buf[1]=NewAddress;
write(file, Buf, 2);
 
 
usleep(100000);
 
echo(NewAddress);
printf("Vzdalenost: %d\n", echo(NewAddress));
printf("Vzdalenost: %d\n", echo(NewAddress>>1));
 
close(file);
return 0;