46 #include "clock_config.h" 47 #include "fsl_debug_console.h" 52 #include "Driver_I2C.h" 57 #include "issdk_hal.h" 58 #include "gpio_driver.h" 65 #define FIFO_WMRK_SIZE (8) 66 #define MPL3115_DATA_SIZE (5) 70 #define MPL3115_SAMPLING_EXPONENT (0) 134 int16_t tempInDegrees;
135 uint32_t pressureInPascals;
149 PRINTF(
"\r\n ISSDK MPL3115 sensor driver example demonstration with interrupt mode.\r\n");
159 if (ARM_DRIVER_OK != status)
161 PRINTF(
"\r\n I2C Initialization Failed\r\n");
166 status = I2Cdrv->PowerControl(ARM_POWER_FULL);
167 if (ARM_DRIVER_OK != status)
169 PRINTF(
"\r\n I2C Power Mode setting Failed\r\n");
174 status = I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
175 if (ARM_DRIVER_OK != status)
177 PRINTF(
"\r\n I2C Control Mode setting Failed\r\n");
186 PRINTF(
"\r\n Sensor Initialization Failed\r\n");
189 PRINTF(
"\r\n Successfully Initiliazed Sensor\r\n");
200 PRINTF(
"\r\nMPL3115 configuration failed...\r\n");
203 PRINTF(
"\r\n Successfully Applied MAG3110 Sensor Configuration\r\n");
225 if (ARM_DRIVER_OK != status)
227 PRINTF(
"\r\n Read Failed. \r\n");
232 pressureInPascals = 0;
245 PRINTF(
"\r\nAverage Pressure = %d Pa\r\n", pressureInPascals / FIFO_WMRK_SIZE);
246 PRINTF(
"\r\nAverage Temperature = %d degC\r\n", tempInDegrees / FIFO_WMRK_SIZE);
#define MPL3115_TEMPERATURE_CONV_FACTOR
#define __END_WRITE_DATA__
#define MPL3115_CTRL_REG4_INT_EN_FIFO_MASK
int32_t MPL3115_I2C_Initialize(mpl3115_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi)
The interface function to initialize the sensor.
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
#define BOARD_BootClockRUN
#define MPL3115_CTRL_REG3_IPOL1_MASK
uint8_t data[FXLS8962_DATA_SIZE]
int32_t MPL3115_I2C_ReadData(mpl3115_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
void(* toggle_pin)(pinID_t aPinId)
#define MPL3115_CTRL_REG4_INT_EN_FIFO_INTENABLED
void BOARD_InitDebugConsole(void)
#define MPL3115_PT_DATA_CFG_PDEFE_ENABLED
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
#define MPL3115_DATA_SIZE
#define MPL3115_CTRL_REG1_OS_OSR_128
#define __END_READ_DATA__
void MPL3115_I2C_SetIdleTask(mpl3115_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
#define MPL3115_PT_DATA_CFG_DREM_ENABLED
#define MPL3115_CTRL_REG1_OS_MASK
#define MPL3115_PT_DATA_CFG_PDEFE_MASK
int32_t MPL3115_I2C_Configure(mpl3115_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
GENERIC_DRIVER_GPIO * pGpioDriver
#define MPL3115_PT_DATA_CFG_TDEFE_ENABLED
#define MPL3115_WHOAMI_VALUE
#define MPL3115_CTRL_REG5_INT_CFG_FIFO_INT1
#define MPL3115_CTRL_REG5_INT_CFG_FIFO_MASK
gpioHandleKSDK_t GREEN_LED
#define MPL3115_F_SETUP_F_MODE_MASK
This defines the sensor specific information.
#define ASK_USER_TO_RESUME(x)
void mpl3115_int_data_ready_callback(void *pUserData)
This is the Sensor Data Ready ISR implementation.
#define I2C_S_DEVICE_INDEX
volatile uint8_t gMpl3115DataReady
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
The mpl3115_drv.h file describes the MPL3115 driver interface and structures.
const registerreadlist_t cMpl3115OutputFIFO[]
Address and size of Pressure+Temperature Data in FIFO Mode.
#define MPL3115_F_SETUP_F_WMRK_MASK
Access structure of the GPIO Driver.
#define MPL3115_CTRL_REG2_ST_MASK
#define MPL3115_SAMPLING_EXPONENT
fxls8962_acceldataUser_t rawData
This structure defines the Write command List.
This structure defines the Read command List.
#define MPL3115_PT_DATA_CFG_DREM_MASK
status_t SMC_SetPowerModeWait(void *arg)
Configures the system to WAIT power mode. API name used from Kinetis family to maintain compatibility...
const registerwritelist_t cMpl3115ConfigFIFO[]
Register settings for FIFO (buffered) mode @ default 1 sample per second with Interrupts.
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.
#define MPL3115_F_SETUP_F_MODE_STOP_MODE
const registerreadlist_t cMpl3115Status[]
Address of Status Register.
#define MPL3115_PT_DATA_CFG_TDEFE_MASK
This structure defines the mpl3115 data buffer in Pressure Mode.
#define MPL3115_PRESSURE_CONV_FACTOR
#define I2C_S_SIGNAL_EVENT
int main(void)
This is the The main function implementation.
#define MPL3115_CTRL_REG3_IPOL1_HIGH