Sensorian  1.0
C API Reference Guide Library
Barometer, Altimeter, Temperature sensor

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 sampleRate)
 Configures the output sample rate.The higher the oversample rate the greater the time between data samples. More...
 
void MPL3115A2_SetAcquisitionTimeStep (unsigned char ST_Value)
 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_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...
 
void MPL3115A2_ClearInterrupts (void)
 Clear any existing interrupts. More...
 

Detailed Description

These functions let you communicate with the MPL3115A2 Barometer/Altimeter/Temperature sensor

Function Documentation

void MPL3115A2_ActiveMode ( void  )

Puts the sensor in active mode, needed is the sensor is in standby mode.

Returns
none

Definition at line 82 of file MPL3115A2.c.

void MPL3115A2_AltimeterMode ( void  )

Sets the mode to Altimeter.

Returns
none

Definition at line 93 of file MPL3115A2.c.

void MPL3115A2_BarometerMode ( void  )

Configure the sensor in Barometer mode.

Returns
none

Definition at line 135 of file MPL3115A2.c.

void MPL3115A2_ClearInterrupts ( void  )

Clear any existing interrupts.

Returns
none

Definition at line 450 of file MPL3115A2.c.

void MPL3115A2_ConfigureAltitudeInterrupt ( void  )

Configure altitude interrupt pin.

Returns
none

Definition at line 441 of file MPL3115A2.c.

void MPL3115A2_ConfigureInterruptPin ( unsigned char  intrrpt,
unsigned char  pin 
)

Configure Interrupt pins.

Parameters
intrrptRegister to read value form
pinOne of the two pins.
Returns
none

Definition at line 423 of file MPL3115A2.c.

void MPL3115A2_ConfigurePressureInterrupt ( void  )

Configure Pressure Interrupt.

Returns
none

Definition at line 432 of file MPL3115A2.c.

void MPL3115A2_EnableEventFlags ( void  )

Enables the pressure and temp measurement event flags so that we can test against them. This is recommended during setup.

Returns
none

Definition at line 398 of file MPL3115A2.c.

float MPL3115A2_GetMaximumPressure ( void  )

Get maximum stored pressure.

Returns
pressure Maximum stored pressure during active measurement mode

Definition at line 178 of file MPL3115A2.c.

float MPL3115A2_GetMaximumTemperature ( void  )

Get maximum recorded temperature reading.

Returns
temp Maximum temperature as a floating point number

Definition at line 312 of file MPL3115A2.c.

float MPL3115A2_GetMinimumPressure ( void  )

Get minimum stored pressure.

Returns
pressure Minimum stored pressure during active measurement mode

Definition at line 162 of file MPL3115A2.c.

float MPL3115A2_GetMinimumTemperature ( void  )

Get minimum recorded temperature reading.

Returns
temp Maximum temperature as a floating point number

Definition at line 297 of file MPL3115A2.c.

unsigned char MPL3115A2_GetMode ( void  )

Return a bool value indicating wheather the sensor is in Active or Standby mode.

Returns
status True if in Active mode, False otherwise

Definition at line 61 of file MPL3115A2.c.

unsigned char MPL3115A2_ID ( void  )

Returns the Factory Chip ID.

Returns
ID Chip ID as byte

Definition at line 51 of file MPL3115A2.c.

void MPL3115A2_Initialize ( void  )

Initialize the sensor and enable interrupts.

Returns
none

Definition at line 40 of file MPL3115A2.c.

void MPL3115A2_OutputSampleRate ( unsigned char  sampleRate)

Configures the output sample rate.The higher the oversample rate the greater the time between data samples.

Parameters
sampleRateConstant that determines the sample rate
Returns
none

Definition at line 361 of file MPL3115A2.c.

float MPL3115A2_ReadAltitude ( void  )

Returns the number of meters above sea level,Returns -1 if no new data is available.

Returns
altitude Altitude from sea-level in meters

Definition at line 107 of file MPL3115A2.c.

unsigned int MPL3115A2_ReadBarometicPressureInput ( void  )

Returns barometric pressure input used for calculating altitude.

Returns
pressure Equivalent sea level pressure

Definition at line 193 of file MPL3115A2.c.

float MPL3115A2_ReadBarometricPressure ( void  )

Reads the current pressure in Pa.

Returns
Pressure Pressure in Pa

Definition at line 205 of file MPL3115A2.c.

float MPL3115A2_ReadPressure ( unitsType  units)

Get a barometric pressure reading.

Parameters
unitsOne of the unitsType
Returns
Pressure Pressure in units

Definition at line 230 of file MPL3115A2.c.

float MPL3115A2_ReadTemperature ( void  )

Get a temperature reading from the sensor.

Returns
Temperature as a floating point number

Definition at line 282 of file MPL3115A2.c.

void MPL3115A2_SetAcquisitionTimeStep ( unsigned char  ST_Value)

Set the acquisition time step in seconds.

Parameters
ST_ValuetimeStep is set from 0x1 - 0xF corresponding steps 1 - 32,768 seconds.
Returns
none

Definition at line 380 of file MPL3115A2.c.

void MPL3115A2_SetAltimeterOffset ( unsigned char  H_Offset)

Set the altimeter offset correction.

Parameters
H_OffsetAltitude in meters ,range varies from -128 to +127 meters
Returns
none

Definition at line 123 of file MPL3115A2.c.

void MPL3115A2_SetPressureAlarmThreshold ( unsigned int  thresh)

Configure alarm threshold.

Parameters
threshreister to read value form
Returns
none

Definition at line 251 of file MPL3115A2.c.

void MPL3115A2_SetPressureOffset ( unsigned char  P_Offset)

Set the pressure offset correction.

Parameters
P_OffsetOffset varies from -128 to +128 Pa, 4 Pa per LSB
Returns
none

Definition at line 150 of file MPL3115A2.c.

void MPL3115A2_SetPressureTargetWindow ( unsigned int  target,
unsigned int  window 
)

Configure alarm target and window.

Parameters
targetContents of target register.
windowContents of window register that activates the interrupt
Returns
none

Definition at line 265 of file MPL3115A2.c.

void MPL3115A2_SetTemperatureThreshold ( unsigned char  thresh)

Configure the temeperature threshold.

Parameters
threshTemperature threshold.
Returns
none

Definition at line 340 of file MPL3115A2.c.

void MPL3115A2_SetTempOffset ( char  T_Offset)

Used to correct the measured sensor temeperature by a particular offset.

Parameters
T_OffsetThe temperature offset as a two's complement number.
Returns
none

Definition at line 351 of file MPL3115A2.c.

void MPL3115A2_SetTempTargetWindow ( unsigned int  target,
unsigned int  window 
)

Configures the temperature target and window for the interrupts.

Parameters
targetThe target temeprature
windowTemperature window around the target.
Returns

Definition at line 329 of file MPL3115A2.c.

void MPL3115A2_StandbyMode ( void  )

Puts the sensor in standby mode, the user must do this in order to modify the major control registers.

Returns
none

Definition at line 71 of file MPL3115A2.c.

void MPL3115A2_ToggleOneShot ( void  )

Causes the sensor to immediately take another reading , needed to sample faster than 1Hz.

Returns
none

Definition at line 407 of file MPL3115A2.c.