ISSDK  1.7
IoT Sensing Software Development Kit
Macros | Functions | Variables
mpl3115_normal_interrupt.c File Reference

The mpl3115_normal_interrupt.c file implements the ISSDK MPL3115 sensor driver example demonstration with interrupt mode. More...

#include "board.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "fsl_debug_console.h"
#include "Driver_I2C.h"
#include "issdk_hal.h"
#include "gpio_driver.h"
#include "mpl3115_drv.h"
Include dependency graph for mpl3115_normal_interrupt.c:

Go to the source code of this file.

Macros

#define MPL3115_DATA_SIZE   (5) /* 3 byte Pressure/Altitude and 2 byte Temperature. */
 
#define MPL3115_SAMPLING_EXPONENT   (1) /* 2 seconds */
 

Functions

void mpl3115_int_data_ready_callback (void *pUserData)
 This is the Sensor Data Ready ISR implementation. More...
 
int main (void)
 This is the The main function implementation. More...
 

Variables

const registerwritelist_t cMpl3115ConfigNormal []
 Register settings for Interrupt (non buffered) mode. More...
 
const registerreadlist_t cMpl3115OutputNormal []
 Address and size of Raw Pressure+Temperature Data in Normal Mode. More...
 
volatile uint8_t gMpl3115DataReady
 

Detailed Description

The mpl3115_normal_interrupt.c file implements the ISSDK MPL3115 sensor driver example demonstration with interrupt mode.

Definition in file mpl3115_normal_interrupt.c.

Macro Definition Documentation

◆ MPL3115_DATA_SIZE

#define MPL3115_DATA_SIZE   (5) /* 3 byte Pressure/Altitude and 2 byte Temperature. */

Definition at line 64 of file mpl3115_normal_interrupt.c.

Referenced by main().

◆ MPL3115_SAMPLING_EXPONENT

#define MPL3115_SAMPLING_EXPONENT   (1) /* 2 seconds */

In MPL3115 the Auto Acquisition Time Step (ODR) can be set only in powers of 2 (i.e. 2^x, where x is the SAMPLING_EXPONENT). This gives a range of 1 second to 2^15 seconds (9 hours).

Definition at line 68 of file mpl3115_normal_interrupt.c.

Function Documentation

◆ main()

int main ( void  )

This is the The main function implementation.


This function invokes board initializes routines, then then brings up the sensor and finally enters an endless loop to continuously read available samples.

Parameters
[in]voidThis is no input parameter.
Returns
void There is no return value.
Constraints:
None

No

Initialize the MCU hardware.

Initialize MAG3110 pin used by FRDM board

Initialize RGB LED pin used by FRDM board

Initialize the I2C driver.

Set the I2C Power mode.

Set the I2C bus speed.

Initialize MPL3115 sensor driver.

Set the task to be executed while waiting for I2C transactions to complete.

Configure the MAG3110 sensor driver.

Clear the data ready flag, it will be set again by the ISR.

Read new raw sensor data from the MPL3115.

Process the sample and convert the raw sensor data to signed 16-bit container.

Definition at line 125 of file mpl3115_normal_interrupt.c.

References ASK_USER_TO_RESUME, BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), data, Driver_GPIO_KSDK, gMpl3115DataReady, GPIO_DIRECTION_IN, GPIO_DIRECTION_OUT, GREEN_LED, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, int32_t(), MPL3115_DATA_SIZE, MPL3115_I2C_ADDR, MPL3115_I2C_Configure(), MPL3115_I2C_Initialize(), MPL3115_I2C_ReadData(), MPL3115_I2C_SetIdleTask(), MPL3115_INT1, mpl3115_int_data_ready_callback(), MPL3115_PRESSURE_CONV_FACTOR, MPL3115_TEMPERATURE_CONV_FACTOR, MPL3115_WHOAMI_VALUE, pGpioDriver, GENERIC_DRIVER_GPIO::pin_init, mpl3115_pressuredata_t::pressure, rawData, SENSOR_ERROR_NONE, SMC, SMC_SetPowerModeWait(), status, mpl3115_pressuredata_t::temperature, and GENERIC_DRIVER_GPIO::toggle_pin.

Here is the call graph for this function:

◆ mpl3115_int_data_ready_callback()

void mpl3115_int_data_ready_callback ( void *  pUserData)

This is the Sensor Data Ready ISR implementation.


This function sets the flag which indicates if a new sample(s) is available for reading.

Parameters
[in]pUserDataThis is a void pointer to the instance of the user specific data structure for the ISR.
Returns
void There is no return value.
Constraints:
None

Yes

Set flag to indicate Sensor has signalled data ready.

Definition at line 111 of file mpl3115_normal_interrupt.c.

References gMpl3115DataReady.

Referenced by main().

Here is the caller graph for this function:

Variable Documentation

◆ cMpl3115ConfigNormal

const registerwritelist_t cMpl3115ConfigNormal[]
Initial value:
= {
#define __END_WRITE_DATA__
Definition: sensor_drv.h:71
#define MPL3115_CTRL_REG3_IPOL1_MASK
Definition: mpl3115.h:976
#define MPL3115_PT_DATA_CFG_PDEFE_ENABLED
Definition: mpl3115.h:567
#define MPL3115_CTRL_REG1_OS_OSR_128
Definition: mpl3115.h:884
#define MPL3115_PT_DATA_CFG_DREM_ENABLED
Definition: mpl3115.h:570
#define MPL3115_CTRL_REG1_OS_MASK
Definition: mpl3115.h:855
#define MPL3115_PT_DATA_CFG_PDEFE_MASK
Definition: mpl3115.h:553
#define MPL3115_SAMPLING_EXPONENT
#define MPL3115_PT_DATA_CFG_TDEFE_ENABLED
Definition: mpl3115.h:564
#define MPL3115_CTRL_REG4_INT_EN_DRDY_INTENABLED
Definition: mpl3115.h:1070
#define MPL3115_CTRL_REG2_ST_MASK
Definition: mpl3115.h:916
#define MPL3115_CTRL_REG4_INT_EN_DRDY_MASK
Definition: mpl3115.h:1048
#define MPL3115_PT_DATA_CFG_DREM_MASK
Definition: mpl3115.h:556
#define MPL3115_CTRL_REG5_INT_CFG_DRDY_MASK
Definition: mpl3115.h:1128
#define MPL3115_PT_DATA_CFG_TDEFE_MASK
Definition: mpl3115.h:550
#define MPL3115_CTRL_REG5_INT_CFG_DRDY_INT1
Definition: mpl3115.h:1150
#define MPL3115_CTRL_REG3_IPOL1_HIGH
Definition: mpl3115.h:990

Register settings for Interrupt (non buffered) mode.

Definition at line 74 of file mpl3115_normal_interrupt.c.

◆ cMpl3115OutputNormal

const registerreadlist_t cMpl3115OutputNormal[]
Initial value:
= {{.readFrom = MPL3115_OUT_P_MSB, .numBytes = MPL3115_DATA_SIZE},
#define __END_READ_DATA__
Definition: sensor_drv.h:77
#define MPL3115_DATA_SIZE

Address and size of Raw Pressure+Temperature Data in Normal Mode.

Definition at line 92 of file mpl3115_normal_interrupt.c.

◆ gMpl3115DataReady

volatile uint8_t gMpl3115DataReady

Definition at line 98 of file mpl3115_normal_interrupt.c.

Referenced by main(), and mpl3115_int_data_ready_callback().