44 #include "clock_config.h" 45 #include "fsl_debug_console.h" 48 #include "Driver_I2C.h" 51 #include "issdk_hal.h" 57 #define RAW_ACCELMAG_DATA_SIZE (12) 106 PRINTF(
"\r\n ISSDK FXOS8700 sensor driver example demonstration with poll mode\r\n");
110 if (ARM_DRIVER_OK != status)
112 PRINTF(
"\r\n I2C Initialization Failed\r\n");
117 status = I2Cdrv->PowerControl(ARM_POWER_FULL);
118 if (ARM_DRIVER_OK != status)
120 PRINTF(
"\r\n I2C Power Mode setting Failed\r\n");
125 status = I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
126 if (ARM_DRIVER_OK != status)
128 PRINTF(
"\r\n I2C Control Mode setting Failed\r\n");
137 PRINTF(
"\r\n Sensor Initialization Failed\r\n");
140 PRINTF(
"\r\n Successfully Initiliazed Sensor\r\n");
149 PRINTF(
"\r\n FXOS8700 Sensor Configuration Failed, Err = %d\r\n", status);
152 PRINTF(
"\r\n Successfully Applied FXOS8700 Sensor Configuration\r\n");
165 if (ARM_DRIVER_OK != status)
167 PRINTF(
"\r\n Read Failed. \r\n");
172 rawData.
accel[0] = ((int16_t)data[0] << 8) | data[1];
173 rawData.
accel[0] /= 4;
174 rawData.
accel[1] = ((int16_t)data[2] << 8) | data[3];
175 rawData.
accel[1] /= 4;
176 rawData.
accel[2] = ((int16_t)data[4] << 8) | data[5];
177 rawData.
accel[2] /= 4;
178 rawData.
mag[0] = ((int16_t)data[6] << 8) | data[7];
179 rawData.
mag[1] = ((int16_t)data[8] << 8) | data[9];
180 rawData.
mag[2] = ((int16_t)data[10] << 8) | data[11];
183 PRINTF(
"\r\n Accel X = %d Y = %d Z = %d\r\n", rawData.
accel[0], rawData.
accel[1], rawData.
accel[2]);
184 PRINTF(
"\r\n Mag X = %d Y = %d Z = %d\r\n", rawData.
mag[0], rawData.
mag[1], rawData.
mag[2]);
#define FXOS8700_M_CTRL_REG1_M_HMS_MASK
#define FXOS8700_M_CTRL_REG1_M_ACAL_EN
#define __END_WRITE_DATA__
The fxos8700_drv.h file describes the fxos8700 driver interface and structures.
This structure defines the fxos8700 raw data buffer.
void FXOS8700_I2C_SetIdleTask(fxos8700_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
#define BOARD_BootClockRUN
const registerreadlist_t FXOS8700_STATUS_READ[]
uint8_t data[FXLS8962_DATA_SIZE]
void BOARD_InitDebugConsole(void)
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
This defines the sensor specific information for I2C.
const registerwritelist_t fxos8700_Config_Hybrid[]
#define FXOS8700_M_CTRL_REG2_M_RST_CNT_DISABLE
#define __END_READ_DATA__
const registerreadlist_t FXOS8700_ACCELMAG_READ[]
#define FXOS8700_CTRL_REG1_DR_HYBRID_25_HZ
const registerreadlist_t FXOS8700_ACCEL_MAG_READ[]
#define FXOS8700_WHO_AM_I_PROD_VALUE
#define FXOS8700_M_CTRL_REG2_M_AUTOINC_MASK
#define FXOS8700_M_CTRL_REG1_M_ACAL_MASK
#define ASK_USER_TO_RESUME(x)
int main(void)
Main function.
int32_t FXOS8700_I2C_Initialize(fxos8700_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi)
The interface function to initialize the sensor.
int32_t FXOS8700_I2C_ReadData(fxos8700_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
#define FXOS8700_M_CTRL_REG2_M_AUTOINC_HYBRID_MODE
#define I2C_S_DEVICE_INDEX
#define FXOS8700_M_CTRL_REG2_M_RST_CNT_MASK
int32_t FXOS8700_I2C_Configure(fxos8700_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
#define FXOS8700_CTRL_REG1_DR_MASK
fxls8962_acceldataUser_t rawData
#define FXOS8700_DR_STATUS_ZYXDR_MASK
This structure defines the Write command List.
This structure defines the Read command List.
status_t SMC_SetPowerModeWait(void *arg)
Configures the system to WAIT power mode. API name used from Kinetis family to maintain compatibility...
#define RAW_ACCELMAG_DATA_SIZE
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.
#define FXOS8700_I2C_ADDR
#define FXOS8700_M_CTRL_REG1_M_HMS_HYBRID_MODE
#define I2C_S_SIGNAL_EVENT