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: MPL3115A2.cpp
- Revision:
- 11:85da7a1b7954
- Parent:
- 10:82ac06669316
- Child:
- 12:e7122a94e812
--- a/MPL3115A2.cpp Tue Sep 24 20:22:25 2013 +0000
+++ b/MPL3115A2.cpp Sun Nov 10 01:46:07 2019 +0000
@@ -76,9 +76,10 @@
// soft reset...
readRegs( REG_CTRL_REG_1, &t, 1);
- unsigned char data[2] = { REG_CTRL_REG_1, t|0x04};
+ t |= 0x04;
+ unsigned char data[2] = {REG_CTRL_REG_1, t};
writeRegs(data, 2);
- wait( 0.1);
+ thread_sleep_for(100);
}
@@ -275,7 +276,8 @@
// Activate the peripheral
readRegs(REG_CTRL_REG_1, &t, 1);
- unsigned char data[2] = {REG_CTRL_REG_1, t|0x01};
+ t |= 0x01;
+ unsigned char data[2] = {REG_CTRL_REG_1, t};
writeRegs(data, 2);
}
@@ -285,7 +287,8 @@
// Standby
readRegs(REG_CTRL_REG_1, &t, 1);
- unsigned char data[2] = {REG_CTRL_REG_1, t&0xFE};
+ t &= 0xFE;
+ unsigned char data[2] = {REG_CTRL_REG_1, t};
writeRegs(data, 2);
}
@@ -582,7 +585,7 @@
}
void MPL3115A2::readRegs(int addr, uint8_t * data, int len) {
- char t[1] = {addr};
+ char t[1] = {(char)addr};
m_i2c.write(m_addr, t, 1, true);
m_i2c.read(m_addr, (char *)data, len);
}