![]() |
Sensorian
1.0
C API Reference Guide Library
|
MPL3115A2 driver header. More...
#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | TRUE 1 |
| #define | FALSE 0 |
| #define | MPL3115A2_ADDRESS 0x60 |
| The I2C address of the MPL3115A2 barometer altimeter sensor. More... | |
| #define | STATUS 0x00 |
| #define | OUT_P_MSB 0x01 |
| #define | OUT_P_CSB 0x02 |
| #define | OUT_P_LSB 0x03 |
| #define | OUT_T_MSB 0x04 |
| #define | OUT_T_LSB 0x05 |
| #define | DR_STATUS 0x06 |
| #define | OUT_P_DELTA_MSB 0x07 |
| #define | OUT_P_DELTA_CSB 0x08 |
| #define | OUT_P_DELTA_LSB 0x09 |
| #define | OUT_T_DELTA_MSB 0x0A |
| #define | OUT_T_DELTA_LSB 0x0B |
| #define | WHO_AM_I 0x0C |
| #define | F_STATUS 0x0D |
| #define | F_DATA 0x0E |
| #define | F_SETUP 0x0F |
| #define | TIME_DLY 0x10 |
| #define | SYSMOD 0x11 |
| #define | INT_SOURCE 0x12 |
| #define | PT_DATA_CFG 0x13 |
| #define | BAR_IN_MSB 0x14 |
| #define | BAR_IN_LSB 0x15 |
| #define | P_TGT_MSB 0x16 |
| #define | P_TGT_LSB 0x17 |
| #define | T_TGT 0x18 |
| #define | P_WND_MSB 0x19 |
| #define | P_WND_LSB 0x1A |
| #define | T_WND 0x1B |
| #define | P_MIN_MSB 0x1C |
| #define | P_MIN_CSB 0x1D |
| #define | P_MIN_LSB 0x1E |
| #define | T_MIN_MSB 0x1F |
| #define | T_MIN_LSB 0x20 |
| #define | P_MAX_MSB 0x21 |
| #define | P_MAX_CSB 0x22 |
| #define | P_MAX_LSB 0x23 |
| #define | T_MAX_MSB 0x24 |
| #define | T_MAX_LSB 0x25 |
| #define | CTRL_REG1 0x26 |
| #define | CTRL_REG2 0x27 |
| #define | CTRL_REG3 0x28 |
| #define | CTRL_REG4 0x29 |
| #define | CTRL_REG5 0x2A |
| #define | OFF_P 0x2B |
| #define | OFF_T 0x2C |
| #define | OFF_H 0x2D |
| #define | PTOW 0x80 |
| #define | POW 0x40 |
| #define | TOW 0x20 |
| #define | PTDR 0x08 |
| #define | PDR 0x04 |
| #define | TDR 0x02 |
| #define | ALT 0x80 |
| #define | RAW 0x40 |
| #define | OS2 0x20 |
| #define | OS1 0x10 |
| #define | OS0 0x08 |
| #define | RST 0x04 |
| #define | OST 0x02 |
| #define | SBYB 0x01 |
| #define | OS_1 0x00 |
| #define | OS_2 OS0 |
| #define | OS_4 OS1 |
| #define | OS_8 OS1 | OS0 |
| #define | OS_16 OS2 |
| #define | OS_32 OS2 | OS0 |
| #define | OS_64 OS2 | OS1 |
| #define | OS_128 OS2 | OS1 | OS0 |
| #define | BAR_MASK 0x80 |
| #define | ALT_MASK 0xEF |
| #define | ACTIVE_MASK 0xF1 |
| #define | STANDBY_MASK 0xFE |
| #define | ALARM_SEL 0x20 |
| #define | LOAD_OUTPUT 0x10 |
| #define | ST3 0x08 |
| #define | ST2 0x04 |
| #define | ST1 0x02 |
| #define | ST0 0x01 |
| #define | CLEAR_ST 0xF0 |
| #define | IPOL1 0x10 |
| #define | PP_OD1 0x08 |
| #define | IPOL2 0x02 |
| #define | PP_OD2 0x01 |
| #define | INT_EN_DRDY 0x80 |
| #define | INT_EN_FIFO 0x40 |
| #define | INT_EN_PW 0x20 |
| #define | INT_EN_TW 0x10 |
| #define | INT_EN_PTH 0x08 |
| #define | INT_EN_TTH 0x04 |
| #define | INT_EN_PCHG 0x02 |
| #define | INT_EN_TCHG 0x01 |
| #define | INT_EN_CLEAR 0x00 |
| #define | INT_CFG_DRDY 0x80 |
| #define | INT_CFG_FIFO 0x40 |
| #define | INT_CFG_PW 0x20 |
| #define | INT_CFG_TW 0x10 |
| #define | INT_CFG_PTH 0x08 |
| #define | INT_CFG_TTH 0x04 |
| #define | INT_CFG_PCHG 0x02 |
| #define | INT_CFG_TCHG 0x01 |
| #define | INT_CFG_CLEAR 0x00 |
| #define | INT2 0 |
| #define | INT1 1 |
| #define | DISABLED 0x00 |
| #define | CIRCULAR 0x40 |
| #define | FULL_STOP 0x80 |
| #define | F_MODE DISABLED |
| #define | DREM 0x04 |
| #define | PDEFE 0x02 |
| #define | TDEFE 0x01 |
| #define | SRC_DRDY 0x80 |
| #define | SRC_FIFO 0x40 |
| #define | SRC_PW 0x20 |
| #define | SRC_TW 0x10 |
| #define | SRC_PTH 0x08 |
| #define | SRC_TTH 0x04 |
| #define | SRC_PCHG 0x02 |
| #define | SRC_TCHG 0x01 |
Enumerations | |
| enum | unitsType { PSI, INHG, MMHG, PSI, INHG, MMHG, PSI, INHG, MMHG } |
| enum | OverSample_t { SR1 = OS_1, SR2 = OS_2, SR3 = OS_4, SR4 = OS_8, SR5 = OS_16, SR6 = OS_32, SR7 = OS_64, SR8 = OS_128, SR1 = OS_1, SR2 = OS_2, SR3 = OS_4, SR4 = OS_8, SR5 = OS_16, SR6 = OS_32, SR7 = OS_64, SR8 = OS_128, SR1 = OS_1, SR2 = OS_2, SR3 = OS_4, SR4 = OS_8, SR5 = OS_16, SR6 = OS_32, SR7 = OS_64, SR8 = OS_128 } |
Functions | |
| void | MPL3115A2_Initialize (void) |
| Initialize the sensor and enable interrupts. More... | |
| unsigned char | MPL3115A2_ID (void) |
| Returns the Factory Chip ID. More... | |
| unsigned char | MPL3115A2_GetMode (void) |
| Return a bool value indicating wheather the sensor is in Active or Standby mode. More... | |
| void | MPL3115A2_StandbyMode (void) |
| Puts the sensor in standby mode, the user must do this in order to modify the major control registers. More... | |
| void | MPL3115A2_ActiveMode (void) |
| Puts the sensor in active mode, needed is the sensor is in standby mode. More... | |
| void | MPL3115A2_AltimeterMode (void) |
| Sets the mode to Altimeter. More... | |
| float | MPL3115A2_ReadAltitude (void) |
| Returns the number of meters above sea level,Returns -1 if no new data is available. More... | |
| void | MPL3115A2_SetAltimeterOffset (unsigned char H_Offset) |
| Set the altimeter offset correction. More... | |
| void | MPL3115A2_BarometerMode (void) |
| Configure the sensor in Barometer mode. More... | |
| void | MPL3115A2_SetPressureOffset (unsigned char P_Offset) |
| Set the pressure offset correction. More... | |
| float | MPL3115A2_GetMinimumPressure (void) |
| Get minimum stored pressure. More... | |
| float | MPL3115A2_GetMaximumPressure (void) |
| Get maximum stored pressure. More... | |
| unsigned int | MPL3115A2_ReadBarometicPressureInput (void) |
| Returns barometric pressure input used for calculating altitude. More... | |
| float | MPL3115A2_ReadBarometricPressure (void) |
| Reads the current pressure in Pa. More... | |
| float | MPL3115A2_ReadPressure (unitsType units) |
| Get a barometric pressure reading. More... | |
| void | MPL3115A2_SetPressureAlarmThreshold (unsigned int thresh) |
| Configure alarm threshold. More... | |
| void | MPL3115A2_SetPressureTargetWindow (unsigned int target, unsigned int window) |
| Configure alarm target and window. More... | |
| float | MPL3115A2_ReadTemperature (void) |
| Get a temperature reading from the sensor. More... | |
| float | MPL3115A2_GetMinimumTemperature (void) |
| Get minimum recorded temperature reading. More... | |
| float | MPL3115A2_GetMaximumTemperature (void) |
| Get maximum recorded temperature reading. More... | |
| void | MPL3115A2_SetTempTargetWindow (unsigned int target, unsigned int window) |
| Configures the temperature target and window for the interrupts. More... | |
| void | MPL3115A2_SetTemperatureThreshold (unsigned char thresh) |
| Configure the temeperature threshold. More... | |
| void | MPL3115A2_SetTempOffset (char T_Offset) |
| Used to correct the measured sensor temeperature by a particular offset. More... | |
| void | MPL3115A2_OutputSampleRate (unsigned char) |
| Configures the output sample rate.The higher the oversample rate the greater the time between data samples. More... | |
| void | MPL3115A2_SetAcquisitionTimeStep (unsigned char) |
| Set the acquisition time step in seconds. More... | |
| void | MPL3115A2_EnableEventFlags (void) |
| Enables the pressure and temp measurement event flags so that we can test against them. This is recommended during setup. More... | |
| void | MPL3115A2_ToggleOneShot (void) |
| Causes the sensor to immediately take another reading , needed to sample faster than 1Hz. More... | |
| void | MPL3115A2_ClearInterrupts (void) |
| Clear any existing interrupts. More... | |
| void | MPL3115A2_ConfigureInterruptPin (unsigned char intrrpt, unsigned char pin) |
| Configure Interrupt pins. More... | |
| void | MPL3115A2_ConfigurePressureInterrupt (void) |
| Configure Pressure Interrupt. More... | |
| void | MPL3115A2_ConfigureAltitudeInterrupt (void) |
| Configure altitude interrupt pin. More... | |
| unsigned char | MPL3115A2_ReadByte (char reg) |
| Read byte value from register. More... | |
| void | MPL3115A2_ReadByteArray (char reg, char *buffer, unsigned int length) |
| Read byte value from register. More... | |
| void | MPL3115A2_WriteByte (char reg, char value) |
| Write a single byte to the register. More... | |
| void | MPL3115A2_WriteByteArray (char reg, char *buffer, unsigned int length) |
| Writes an array of bytes to the sensor. More... | |
| #define ACTIVE_MASK 0xF1 |
Definition at line 120 of file MPL3115A2.h.
| #define ALARM_SEL 0x20 |
Definition at line 124 of file MPL3115A2.h.
| #define ALT 0x80 |
Definition at line 99 of file MPL3115A2.h.
| #define ALT_MASK 0xEF |
Definition at line 119 of file MPL3115A2.h.
| #define BAR_IN_LSB 0x15 |
Definition at line 63 of file MPL3115A2.h.
| #define BAR_IN_MSB 0x14 |
Definition at line 62 of file MPL3115A2.h.
| #define BAR_MASK 0x80 |
Definition at line 118 of file MPL3115A2.h.
| #define CIRCULAR 0x40 |
Definition at line 167 of file MPL3115A2.h.
| #define CLEAR_ST 0xF0 |
Definition at line 130 of file MPL3115A2.h.
| #define CTRL_REG1 0x26 |
Definition at line 80 of file MPL3115A2.h.
| #define CTRL_REG2 0x27 |
Definition at line 81 of file MPL3115A2.h.
| #define CTRL_REG3 0x28 |
Definition at line 82 of file MPL3115A2.h.
| #define CTRL_REG4 0x29 |
Definition at line 83 of file MPL3115A2.h.
| #define CTRL_REG5 0x2A |
Definition at line 84 of file MPL3115A2.h.
| #define DISABLED 0x00 |
Definition at line 166 of file MPL3115A2.h.
| #define DR_STATUS 0x06 |
Definition at line 48 of file MPL3115A2.h.
| #define DREM 0x04 |
Definition at line 171 of file MPL3115A2.h.
| #define F_DATA 0x0E |
Definition at line 56 of file MPL3115A2.h.
| #define F_MODE DISABLED |
Definition at line 169 of file MPL3115A2.h.
| #define F_SETUP 0x0F |
Definition at line 57 of file MPL3115A2.h.
| #define F_STATUS 0x0D |
Definition at line 55 of file MPL3115A2.h.
| #define FALSE 0 |
Definition at line 35 of file MPL3115A2.h.
| #define FULL_STOP 0x80 |
Definition at line 168 of file MPL3115A2.h.
| #define INT1 1 |
Definition at line 163 of file MPL3115A2.h.
| #define INT2 0 |
Definition at line 162 of file MPL3115A2.h.
| #define INT_CFG_CLEAR 0x00 |
Definition at line 160 of file MPL3115A2.h.
| #define INT_CFG_DRDY 0x80 |
Definition at line 151 of file MPL3115A2.h.
| #define INT_CFG_FIFO 0x40 |
Definition at line 152 of file MPL3115A2.h.
| #define INT_CFG_PCHG 0x02 |
Definition at line 157 of file MPL3115A2.h.
| #define INT_CFG_PTH 0x08 |
Definition at line 155 of file MPL3115A2.h.
| #define INT_CFG_PW 0x20 |
Definition at line 153 of file MPL3115A2.h.
| #define INT_CFG_TCHG 0x01 |
Definition at line 158 of file MPL3115A2.h.
| #define INT_CFG_TTH 0x04 |
Definition at line 156 of file MPL3115A2.h.
| #define INT_CFG_TW 0x10 |
Definition at line 154 of file MPL3115A2.h.
| #define INT_EN_CLEAR 0x00 |
Definition at line 147 of file MPL3115A2.h.
| #define INT_EN_DRDY 0x80 |
Definition at line 139 of file MPL3115A2.h.
| #define INT_EN_FIFO 0x40 |
Definition at line 140 of file MPL3115A2.h.
| #define INT_EN_PCHG 0x02 |
Definition at line 145 of file MPL3115A2.h.
| #define INT_EN_PTH 0x08 |
Definition at line 143 of file MPL3115A2.h.
| #define INT_EN_PW 0x20 |
Definition at line 141 of file MPL3115A2.h.
| #define INT_EN_TCHG 0x01 |
Definition at line 146 of file MPL3115A2.h.
| #define INT_EN_TTH 0x04 |
Definition at line 144 of file MPL3115A2.h.
| #define INT_EN_TW 0x10 |
Definition at line 142 of file MPL3115A2.h.
| #define INT_SOURCE 0x12 |
Definition at line 60 of file MPL3115A2.h.
| #define IPOL1 0x10 |
Definition at line 133 of file MPL3115A2.h.
| #define IPOL2 0x02 |
Definition at line 135 of file MPL3115A2.h.
| #define LOAD_OUTPUT 0x10 |
Definition at line 125 of file MPL3115A2.h.
| #define MPL3115A2_ADDRESS 0x60 |
The I2C address of the MPL3115A2 barometer altimeter sensor.
Definition at line 40 of file MPL3115A2.h.
| #define OFF_H 0x2D |
Definition at line 87 of file MPL3115A2.h.
| #define OFF_P 0x2B |
Definition at line 85 of file MPL3115A2.h.
| #define OFF_T 0x2C |
Definition at line 86 of file MPL3115A2.h.
| #define OS0 0x08 |
Definition at line 103 of file MPL3115A2.h.
| #define OS1 0x10 |
Definition at line 102 of file MPL3115A2.h.
| #define OS2 0x20 |
Definition at line 101 of file MPL3115A2.h.
| #define OS_1 0x00 |
Definition at line 109 of file MPL3115A2.h.
Definition at line 116 of file MPL3115A2.h.
| #define OS_16 OS2 |
Definition at line 113 of file MPL3115A2.h.
| #define OS_2 OS0 |
Definition at line 110 of file MPL3115A2.h.
Definition at line 114 of file MPL3115A2.h.
| #define OS_4 OS1 |
Definition at line 111 of file MPL3115A2.h.
Definition at line 115 of file MPL3115A2.h.
Definition at line 112 of file MPL3115A2.h.
| #define OST 0x02 |
Definition at line 105 of file MPL3115A2.h.
| #define OUT_P_CSB 0x02 |
Definition at line 44 of file MPL3115A2.h.
| #define OUT_P_DELTA_CSB 0x08 |
Definition at line 50 of file MPL3115A2.h.
| #define OUT_P_DELTA_LSB 0x09 |
Definition at line 51 of file MPL3115A2.h.
| #define OUT_P_DELTA_MSB 0x07 |
Definition at line 49 of file MPL3115A2.h.
| #define OUT_P_LSB 0x03 |
Definition at line 45 of file MPL3115A2.h.
| #define OUT_P_MSB 0x01 |
Definition at line 43 of file MPL3115A2.h.
| #define OUT_T_DELTA_LSB 0x0B |
Definition at line 53 of file MPL3115A2.h.
| #define OUT_T_DELTA_MSB 0x0A |
Definition at line 52 of file MPL3115A2.h.
| #define OUT_T_LSB 0x05 |
Definition at line 47 of file MPL3115A2.h.
| #define OUT_T_MSB 0x04 |
Definition at line 46 of file MPL3115A2.h.
| #define P_MAX_CSB 0x22 |
Definition at line 76 of file MPL3115A2.h.
| #define P_MAX_LSB 0x23 |
Definition at line 77 of file MPL3115A2.h.
| #define P_MAX_MSB 0x21 |
Definition at line 75 of file MPL3115A2.h.
| #define P_MIN_CSB 0x1D |
Definition at line 71 of file MPL3115A2.h.
| #define P_MIN_LSB 0x1E |
Definition at line 72 of file MPL3115A2.h.
| #define P_MIN_MSB 0x1C |
Definition at line 70 of file MPL3115A2.h.
| #define P_TGT_LSB 0x17 |
Definition at line 65 of file MPL3115A2.h.
| #define P_TGT_MSB 0x16 |
Definition at line 64 of file MPL3115A2.h.
| #define P_WND_LSB 0x1A |
Definition at line 68 of file MPL3115A2.h.
| #define P_WND_MSB 0x19 |
Definition at line 67 of file MPL3115A2.h.
| #define PDEFE 0x02 |
Definition at line 172 of file MPL3115A2.h.
| #define PDR 0x04 |
Definition at line 94 of file MPL3115A2.h.
| #define POW 0x40 |
Definition at line 91 of file MPL3115A2.h.
| #define PP_OD1 0x08 |
Definition at line 134 of file MPL3115A2.h.
| #define PP_OD2 0x01 |
Definition at line 136 of file MPL3115A2.h.
| #define PT_DATA_CFG 0x13 |
Definition at line 61 of file MPL3115A2.h.
| #define PTDR 0x08 |
Definition at line 93 of file MPL3115A2.h.
| #define PTOW 0x80 |
Definition at line 90 of file MPL3115A2.h.
| #define RAW 0x40 |
Definition at line 100 of file MPL3115A2.h.
| #define RST 0x04 |
Definition at line 104 of file MPL3115A2.h.
| #define SBYB 0x01 |
Definition at line 106 of file MPL3115A2.h.
| #define SRC_DRDY 0x80 |
Definition at line 177 of file MPL3115A2.h.
| #define SRC_FIFO 0x40 |
Definition at line 178 of file MPL3115A2.h.
| #define SRC_PCHG 0x02 |
Definition at line 183 of file MPL3115A2.h.
| #define SRC_PTH 0x08 |
Definition at line 181 of file MPL3115A2.h.
| #define SRC_PW 0x20 |
Definition at line 179 of file MPL3115A2.h.
| #define SRC_TCHG 0x01 |
Definition at line 184 of file MPL3115A2.h.
| #define SRC_TTH 0x04 |
Definition at line 182 of file MPL3115A2.h.
| #define SRC_TW 0x10 |
Definition at line 180 of file MPL3115A2.h.
| #define ST0 0x01 |
Definition at line 129 of file MPL3115A2.h.
| #define ST1 0x02 |
Definition at line 128 of file MPL3115A2.h.
| #define ST2 0x04 |
Definition at line 127 of file MPL3115A2.h.
| #define ST3 0x08 |
Definition at line 126 of file MPL3115A2.h.
| #define STANDBY_MASK 0xFE |
Definition at line 121 of file MPL3115A2.h.
| #define STATUS 0x00 |
Definition at line 42 of file MPL3115A2.h.
| #define SYSMOD 0x11 |
Definition at line 59 of file MPL3115A2.h.
| #define T_MAX_LSB 0x25 |
Definition at line 79 of file MPL3115A2.h.
| #define T_MAX_MSB 0x24 |
Definition at line 78 of file MPL3115A2.h.
| #define T_MIN_LSB 0x20 |
Definition at line 74 of file MPL3115A2.h.
| #define T_MIN_MSB 0x1F |
Definition at line 73 of file MPL3115A2.h.
| #define T_TGT 0x18 |
Definition at line 66 of file MPL3115A2.h.
| #define T_WND 0x1B |
Definition at line 69 of file MPL3115A2.h.
| #define TDEFE 0x01 |
Definition at line 173 of file MPL3115A2.h.
| #define TDR 0x02 |
Definition at line 95 of file MPL3115A2.h.
| #define TIME_DLY 0x10 |
Definition at line 58 of file MPL3115A2.h.
| #define TOW 0x20 |
Definition at line 92 of file MPL3115A2.h.
| #define TRUE 1 |
Definition at line 34 of file MPL3115A2.h.
| #define WHO_AM_I 0x0C |
Definition at line 54 of file MPL3115A2.h.
| enum OverSample_t |
| Enumerator | |
|---|---|
| SR1 | |
| SR2 | |
| SR3 | |
| SR4 | |
| SR5 | |
| SR6 | |
| SR7 | |
| SR8 | |
| SR1 | |
| SR2 | |
| SR3 | |
| SR4 | |
| SR5 | |
| SR6 | |
| SR7 | |
| SR8 | |
| SR1 | |
| SR2 | |
| SR3 | |
| SR4 | |
| SR5 | |
| SR6 | |
| SR7 | |
| SR8 | |
Definition at line 192 of file MPL3115A2.h.
| enum unitsType |
| Enumerator | |
|---|---|
| PSI | |
| INHG | |
| MMHG | |
| PSI | |
| INHG | |
| MMHG | |
| PSI | |
| INHG | |
| MMHG | |
Definition at line 188 of file MPL3115A2.h.
| unsigned char MPL3115A2_ReadByte | ( | char | reg | ) |
Read byte value from register.
| reg | Register to read value form |
Definition at line 467 of file MPL3115A2.c.
| void MPL3115A2_ReadByteArray | ( | char | reg, |
| char * | buffer, | ||
| unsigned int | length | ||
| ) |
Read byte value from register.
| reg | Register to read value form |
| *buffer | Array buffer to be written |
| length | Length of buffer array |
Definition at line 479 of file MPL3115A2.c.
| void MPL3115A2_WriteByte | ( | char | reg, |
| char | value | ||
| ) |
Write a single byte to the register.
| reg | register address |
| value | value to write onto register |
Definition at line 490 of file MPL3115A2.c.
| void MPL3115A2_WriteByteArray | ( | char | reg, |
| char * | buffer, | ||
| unsigned int | length | ||
| ) |
Writes an array of bytes to the sensor.
| reg | Register to read value form |
| *buffer | Array buffer to be written |
| length | Length of buffer array |
Definition at line 502 of file MPL3115A2.c.