16 #include "clock_config.h" 18 #include "fsl_debug_console.h" 19 #include "fsl_irqsteer.h" 22 #include "Driver_I2C.h" 25 #include "issdk_hal.h" 36 #define RAW_ACCEL_DATA_SIZE (6) 77 ipc = BOARD_InitRpc();
84 PRINTF(
"\r\n -----------------------------------------------------------------\r\n");
85 PRINTF(
"\r\n ISSDK FXOS8700 sensor driver example demonstration with FIFO mode\r\n");
86 PRINTF(
"\r\n -----------------------------------------------------------------\r\n");
89 if (sc_pm_set_resource_power_mode(ipc, SC_R_I2C_0, SC_PM_PW_MODE_ON) != SC_ERR_NONE)
91 PRINTF(
"Error: Failed to power on LPI2C\r\n");
95 freq = CLOCK_SetIpFreq(kCLOCK_DMA_Lpi2c0, SC_24MHZ);
98 PRINTF(
"Error: Failed to set LPI2C frequency\r\n");
102 #if (MIMX8QM_CM4_CORE0) 103 if (sc_pm_set_resource_power_mode(ipc, SC_R_IRQSTR_M4_0, SC_PM_PW_MODE_ON) != SC_ERR_NONE)
105 PRINTF(
"Error: Failed to power on IRQSTEER M4_0\r\n");
107 #elif (MIMX8QM_CM4_CORE1) 108 if (sc_pm_set_resource_power_mode(ipc, SC_R_IRQSTR_M4_1, SC_PM_PW_MODE_ON) != SC_ERR_NONE)
110 PRINTF(
"Error: Failed to power on IRQSTEER M4_1\r\n");
115 IRQSTEER_Init(IRQSTEER);
116 IRQSTEER_EnableInterrupt(IRQSTEER, DMA_I2C0_INT_IRQn);
120 if (ARM_DRIVER_OK != status)
122 PRINTF(
"\r\n I2C Initialization Failed\r\n");
127 status = I2Cdrv->PowerControl(ARM_POWER_FULL);
128 if (ARM_DRIVER_OK != status)
130 PRINTF(
"\r\n I2C Power Mode setting Failed\r\n");
135 status = I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
136 if (ARM_DRIVER_OK != status)
138 PRINTF(
"\r\n I2C Control Mode setting Failed\r\n");
147 PRINTF(
"\r\n Sensor Initialization Failed\r\n");
150 PRINTF(
"\r\n Successfully Initiliazed FXOS8700 Sensor\r\n");
157 PRINTF(
"\r\n FXOS8700 Sensor Configuration Failed, Err = %d\r\n", status);
160 PRINTF(
"\r\n Successfully Applied FXOS8700 Sensor Configuration\r\n");
162 PRINTF(
"\r\n Reading FXOS8700 Accel Values in FIFO mode, FIFO width=%d\r\n",
FIFO_SIZE);
175 if (ARM_DRIVER_OK != status)
177 PRINTF(
"\r\n Read Failed. \r\n");
185 rawData.
accel[0] /= 4;
187 rawData.
accel[1] /= 4;
189 rawData.
accel[2] /= 4;
192 PRINTF(
"\r\n Accel X = %d Y = %d Z = %d\r\n", rawData.
accel[0], rawData.
accel[1], rawData.
accel[2]);
#define RAW_ACCEL_DATA_SIZE
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.
This structure defines the fxos8700 raw data buffer.
This structure defines the Write command List.
#define ASK_USER_TO_RESUME(x)
#define FXOS8700_WHO_AM_I_PROD_VALUE
#define FXOS8700_CTRL_REG1_DR_MASK
#define FXOS8700_CTRL_REG1_DR_SINGLE_12P5_HZ
#define __END_WRITE_DATA__
int main(void)
Main function.
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
#define I2C_S_SIGNAL_EVENT
#define FXOS8700_F_SETUP_F_WMRK_SHIFT
This defines the sensor specific information for I2C.
#define FXOS8700_F_STATUS_F_WMRK_FLAG_MASK
const registerwritelist_t fxos8700_Config_with_Fifo[]
int32_t FXOS8700_I2C_Configure(fxos8700_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he 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 BOARD_BootClockRUN
uint8_t data[FXLS8962_DATA_SIZE]
#define __END_READ_DATA__
#define FXOS8700_F_SETUP_F_WMRK_MASK
#define FXOS8700_F_SETUP_F_MODE_FIFO_STOP_OVF
#define FIFO_SIZE
The watermark value configured for FXAS21002 FIFO Buffer.
fxos8700_accelmagdata_t rawData
const registerreadlist_t FXOS8700_ACCEL_FIFO_READ[]
The fxos8700_drv.h file describes the fxos8700 driver interface and structures.
#define FXOS8700_F_SETUP_F_MODE_MASK
This structure defines the Read command List.
const registerreadlist_t FXOS8700_STATUS_READ[]
#define I2C_S_DEVICE_INDEX
void BOARD_InitDebugConsole(void)
#define FXOS8700_I2C_ADDR
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.