Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: master_i2c.cpp
- Revision:
- 7:b98d752b7b95
- Parent:
- 4:fc56fa8aa794
--- a/master_i2c.cpp Tue Oct 02 01:16:03 2012 +0000
+++ b/master_i2c.cpp Tue Oct 02 23:53:32 2012 +0000
@@ -95,13 +95,13 @@
void master_read(int* ro_reading)
{
char* data_read;
- data_read = new char [64*5+12];
- for(int i=0; i<64*5+12; i++) {
+ data_read = new char [64*5+8];
+ for(int i=0; i<64*5+8; i++) {
data_read[i]=(char)47;
}
while(data_read[0]==47) {
- wait(18);
- master.read(SLAVEADDR|1, data_read, 64*5+12, true);
+ wait(10);
+ master.read(SLAVEADDR|1, data_read, 64*5+8, true);
}
for(int i=0; i<64; i++) {
int out = 0;
@@ -118,8 +118,6 @@
}
ro_reading[64] = data_read[64*5]+data_read[64*5+1]*0x100;
ro_reading[65] = data_read[64*5+2]+data_read[64*5+3]*0x100;
- ro_reading[66] = data_read[64*5+4]+data_read[64*5+5]*0x100; //RVTP
- ro_reading[67] = data_read[64*5+6]+data_read[64*5+7]*0x100; //HVTP
- ro_reading[68] = data_read[64*5+8]+data_read[64*5+9]*0x100; //RVTN
- ro_reading[69] = data_read[64*5+10]+data_read[64*5+11]*0x100; //HVTN
+ ro_reading[66] = data_read[64*5+4]+data_read[64*5+5]*0x100; //HVTP
+ ro_reading[67] = data_read[64*5+6]+data_read[64*5+7]*0x100; //HVTN
}