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.
Dependents: sensor AerCloud_MutliTech_Socket_Modem_Example Freescale_Multi-Sensor_Shield 2lemetry_Sensor_Example ... more
Fork of MPL3115A2 by
Revision 11:8c90a97b1036, committed 2014-07-25
- Comitter:
- screamer
- Date:
- Fri Jul 25 11:34:09 2014 +0000
- Parent:
- 10:82ac06669316
- Commit message:
- Change the constructor to accept Int1 and Int2 interrupts as params and removed dependency on Freescale specific pin naming
Changed in this revision
| MPL3115A2.cpp | Show annotated file Show diff for this revision Revisions of this file |
| MPL3115A2.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 82ac06669316 -r 8c90a97b1036 MPL3115A2.cpp
--- a/MPL3115A2.cpp Tue Sep 24 20:22:25 2013 +0000
+++ b/MPL3115A2.cpp Fri Jul 25 11:34:09 2014 +0000
@@ -33,28 +33,14 @@
#define PDR_STATUS 0x02 // Pressure and Altitude data ready
#define TDR_STATUS 0x01 // Temperature data ready
-/** Interrupt schema
-*
-* :: The Altitude Trigger use the IRQ1.
-*
-* Altitude Trigger -- MPL3115A2_Int1.fall --- AltitudeTrg_IRQ --- MPL3115A2_usr1_fptr
-*
-*
-* :: The Data ready use the IRQ2.
-*
-* Data Ready -- MPL3115A2_Int2.fall --- DataReady_IRQ --- MPL3115A2_usr2_fptr
-*
-*/
+
void (*MPL3115A2_usr2_fptr)(void); // Pointers to user function called after
void (*MPL3115A2_usr1_fptr)(void); // IRQ assertion.
-//
-InterruptIn MPL3115A2_Int1( PTD4); // INT1
-InterruptIn MPL3115A2_Int2( PTA12); // INT2
-MPL3115A2::MPL3115A2(PinName sda, PinName scl, int addr) : m_i2c(sda, scl), m_addr(addr) {
+MPL3115A2::MPL3115A2(PinName sda, PinName scl, int addr, PinName int1, PinName int2) : m_i2c(sda, scl), m_addr(addr), MPL3115A2_Int1(int1), MPL3115A2_Int2(int2) {
unsigned char data[6];
-
+
MPL3115A2_mode = BAROMETRIC_MODE;
MPL3115A2_oversampling = OVERSAMPLE_RATIO_1;
//
diff -r 82ac06669316 -r 8c90a97b1036 MPL3115A2.h
--- a/MPL3115A2.h Tue Sep 24 20:22:25 2013 +0000
+++ b/MPL3115A2.h Fri Jul 25 11:34:09 2014 +0000
@@ -56,13 +56,21 @@
{
public:
/**
- * MPL3115A2 constructor
- *
- * @param sda SDA pin
- * @param sdl SCL pin
- * @param addr addr of the I2C peripheral
- */
- MPL3115A2(PinName sda, PinName scl, int addr);
+ * MPL3115A2 constructor
+ *
+ * @param sda SDA pin
+ * @param sdl SCL pin
+ * @param addr addr of the I2C peripheral
+ * @param int1 InterruptIn
+ * @param int2 InterruptIn
+ *
+ * Interrupt schema:
+ *
+ * * The Altitude Trigger use the IRQ1 - Altitude Trigger -> MPL3115A2_Int1.fall -> AltitudeTrg_IRQ -> MPL3115A2_usr1_fptr
+ *
+ * * The Data ready use the IRQ2 - Data Ready -> MPL3115A2_Int2.fall -> DataReady_IRQ -> MPL3115A2_usr2_fptr
+ */
+ MPL3115A2(PinName sda, PinName scl, int addr, PinName int1, PinName int2);
/**
* Get the value of the WHO_AM_I register
@@ -256,6 +264,9 @@
private:
I2C m_i2c;
int m_addr;
+ InterruptIn MPL3115A2_Int1;
+ InterruptIn MPL3115A2_Int2;
+
unsigned char MPL3115A2_mode;
unsigned char MPL3115A2_oversampling;
void DataReady_IRQ( void);
