pressure
Fork of MPL3115A2 by
Diff: MPL3115A2.cpp
- Revision:
- 8:89ed6aeb5dbb
- Parent:
- 7:59e9ba115d0a
- Child:
- 9:75a5960adf5c
diff -r 59e9ba115d0a -r 89ed6aeb5dbb MPL3115A2.cpp --- a/MPL3115A2.cpp Sun Aug 25 21:48:05 2013 +0000 +++ b/MPL3115A2.cpp Sun Sep 22 07:04:14 2013 +0000 @@ -47,6 +47,8 @@ MPL3115A2_usr2_fptr = NULL; MPL3115A2_Int1.fall( NULL); MPL3115A2_Int2.fall( NULL); + + Reset(); } void MPL3115A2::Reset( void) @@ -452,6 +454,36 @@ return 0; } +void MPL3115A2::SetPressureOffset( char offset) +{ + unsigned char data [2] = {0x2b, offset}; + + Standby(); + writeRegs(data,2); + + Active(); +} + +void MPL3115A2::SetTemperatureOffset( char offset) +{ + unsigned char data [2] = {0x2c, offset}; + + Standby(); + writeRegs(data,2); + + Active(); +} + +void MPL3115A2::SetAltitudeOffset( char offset) +{ + unsigned char data [2] = {0x2d, offset}; + + Standby(); + writeRegs(data,2); + + Active(); +} + void MPL3115A2::readRegs(int addr, uint8_t * data, int len) { char t[1] = {addr}; m_i2c.write(m_addr, t, 1, true);