46 #include "clock_config.h" 47 #include "fsl_debug_console.h" 52 #include "Driver_I2C.h" 55 #include "issdk_hal.h" 61 #define MPL3115_DATA_SIZE (5) 65 #define MPL3115_SAMPLING_EXPONENT (1) 98 int16_t tempInDegrees;
112 PRINTF(
"\r\n ISSDK MPL3115 sensor driver example demonstration with poll mode\r\n");
116 if (ARM_DRIVER_OK != status)
118 PRINTF(
"\r\n I2C Initialization Failed\r\n");
123 status = I2Cdrv->PowerControl(ARM_POWER_FULL);
124 if (ARM_DRIVER_OK != status)
126 PRINTF(
"\r\n I2C Power Mode setting Failed\r\n");
131 status = I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
132 if (ARM_DRIVER_OK != status)
134 PRINTF(
"\r\n I2C Control Mode setting Failed\r\n");
143 PRINTF(
"\r\n Sensor Initialization Failed\r\n");
146 PRINTF(
"\r\n Successfully Initiliazed Sensor\r\n");
155 PRINTF(
"\r\nMPL3115 configuration failed...\r\n");
158 PRINTF(
"\r\n Successfully Applied MPL3115 Sensor Configuration\r\n");
171 if (ARM_DRIVER_OK != status)
173 PRINTF(
"\r\n Read Failed. \r\n");
178 rawData.
altitude = (
int32_t)((data[0]) << 24) | ((data[1]) << 16) | ((data[2]) << 8);
181 rawData.
temperature = (int16_t)((data[3]) << 8) | (data[4]);
184 PRINTF(
"\r\nAltitude = %d Meters\r\n", altitudeInMeters);
185 PRINTF(
"\r\nTemperature = %d degC\r\n", tempInDegrees);
#define MPL3115_TEMPERATURE_CONV_FACTOR
#define MPL3115_DR_STATUS_PTDR_MASK
#define __END_WRITE_DATA__
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.
#define MPL3115_ALTITUDE_CONV_FACTOR
#define BOARD_BootClockRUN
#define MPL3115_DATA_SIZE
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.
#define MPL3115_CTRL_REG1_ALT_MASK
const registerwritelist_t cMpl3115ConfigAltitude[]
Register settings for Altitude readings in Normal (non buffered) mode.
const registerreadlist_t cMpl3115OutputNormal[]
Address and size of Raw Altitude+Temperature Data in Normal Mode.
void BOARD_InitDebugConsole(void)
#define MPL3115_SAMPLING_EXPONENT
#define MPL3115_PT_DATA_CFG_PDEFE_ENABLED
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
int main(void)
Main function.
#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
const registerreadlist_t cMpl3115Status[]
Address of Status Register.
int32_t MPL3115_I2C_Configure(mpl3115_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
#define MPL3115_CTRL_REG1_ALT_ALT
#define MPL3115_PT_DATA_CFG_TDEFE_ENABLED
#define MPL3115_WHOAMI_VALUE
This defines the sensor specific information.
#define ASK_USER_TO_RESUME(x)
This structure defines the mpl3115 data buffer in Altitude Mode.
#define I2C_S_DEVICE_INDEX
The mpl3115_drv.h file describes the MPL3115 driver interface and structures.
#define MPL3115_CTRL_REG2_ST_MASK
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...
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.
#define MPL3115_PT_DATA_CFG_TDEFE_MASK
#define I2C_S_SIGNAL_EVENT