HAND
Revision 1:a9cc51956082, committed 2021-11-03
- Comitter:
- condato_mbed
- Date:
- Wed Nov 03 15:59:01 2021 +0000
- Parent:
- 0:010b908e2187
- Commit message:
- HAND
Changed in this revision
MAX30100.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 010b908e2187 -r a9cc51956082 MAX30100.cpp --- a/MAX30100.cpp Fri Nov 25 00:52:54 2016 +0000 +++ b/MAX30100.cpp Wed Nov 03 15:59:01 2021 +0000 @@ -15,7 +15,8 @@ #include "MAX30100.h" -I2C Wire(I2C_SDA , I2C_SCL ); +extern I2C i2c; +//I2C Wire(P3_4 , P3_5 ); MAX30100::MAX30100() { @@ -27,7 +28,7 @@ // Wire.begin(); // Wire.setClock(I2C_BUS_SPEED); - Wire.frequency(I2C_BUS_SPEED); + //Wire.frequency(I2C_BUS_SPEED); if(!setMode(DEFAULT_MODE)) return false; @@ -138,9 +139,9 @@ { char ch_i2c_data; ch_i2c_data=uch_addr; - if(Wire.write(I2C_WRITE_ADDR, &ch_i2c_data, 1, true)!=0) + if(i2c.write(I2C_WRITE_ADDR, &ch_i2c_data, 1, true)!=0) return false; - if(Wire.read(I2C_READ_ADDR, &ch_i2c_data, 1, false)==0) + if(i2c.read(I2C_READ_ADDR, &ch_i2c_data, 1, false)==0) { *puch_data=(uint8_t) ch_i2c_data; return true; @@ -175,7 +176,7 @@ ach_i2c_data[0]=uch_addr; ach_i2c_data[1]=uch_data; - if(Wire.write(I2C_WRITE_ADDR, ach_i2c_data, 2, false)==0) + if(i2c.write(I2C_WRITE_ADDR, ach_i2c_data, 2, false)==0) return true; else return false; @@ -186,9 +187,9 @@ char ach_i2c_data[4]; ach_i2c_data[0]=MAX30100_REG_FIFO_DATA; - if(Wire.write(I2C_WRITE_ADDR, ach_i2c_data, 1, true)!=0) + if(i2c.write(I2C_WRITE_ADDR, ach_i2c_data, 1, true)!=0) return false; - if(Wire.read(I2C_READ_ADDR, ach_i2c_data, 4, false)!=0) + if(i2c.read(I2C_READ_ADDR, ach_i2c_data, 4, false)!=0) return false; // Warning: the values are always left-aligned