Sensorian  1.0
C API Reference Guide Library
MPL3115A2.c File Reference

MPL3115A2 driver. More...

#include "MPL3115A2.h"
#include "i2c.h"

Go to the source code of this file.

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...
 
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...
 

Detailed Description

MPL3115A2 driver.

Author
D.Qendri
Date
30 April 2015

Definition in file MPL3115A2.c.

Function Documentation

unsigned char MPL3115A2_ReadByte ( char  reg)

Read byte value from register.

Parameters
regRegister to read value form
Returns
value Register value

Definition at line 467 of file MPL3115A2.c.

void MPL3115A2_ReadByteArray ( char  reg,
char *  buffer,
unsigned int  length 
)

Read byte value from register.

Parameters
regRegister to read value form
*bufferArray buffer to be written
lengthLength of buffer array
Returns
value Register value

Definition at line 479 of file MPL3115A2.c.

void MPL3115A2_WriteByte ( char  reg,
char  value 
)

Write a single byte to the register.

Parameters
regregister address
valuevalue to write onto register
Returns
none

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.

Parameters
regRegister to read value form
*bufferArray buffer to be written
lengthLength of buffer array
Returns
none

Definition at line 502 of file MPL3115A2.c.