19 #include "clock_config.h" 21 #include "fsl_debug_console.h" 26 #include "Driver_I2C.h" 31 #include "issdk_hal.h" 32 #include "gpio_driver.h" 38 #define RAW_ACCEL_DATA_SIZE (6) 109 PRINTF(
"\r\n ISSDK FXOS8700 sensor driver example demonstration with interrupt mode.\r\n");
119 if (ARM_DRIVER_OK != status)
121 PRINTF(
"\r\n I2C Initialization Failed\r\n");
126 status = I2Cdrv->PowerControl(ARM_POWER_FULL);
127 if (ARM_DRIVER_OK != status)
129 PRINTF(
"\r\n I2C Power Mode setting Failed\r\n");
134 status = I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
135 if (ARM_DRIVER_OK != status)
137 PRINTF(
"\r\n I2C Control Mode setting Failed\r\n");
146 PRINTF(
"\r\n Sensor Initialization Failed\r\n");
149 PRINTF(
"\r\n Successfully Initiliazed Sensor\r\n");
158 PRINTF(
"\r\n FXOS8700 Sensor Configuration Failed, Err = %d\r\n", status);
161 PRINTF(
"\r\n Successfully Applied FXOS8700 Sensor Configuration\r\n");
179 if (ARM_DRIVER_OK != status)
181 PRINTF(
"\r\n Read Failed. \r\n");
186 rawData.
accel[0] = ((int16_t)data[0] << 8) | data[1];
187 rawData.
accel[0] /= 4;
188 rawData.
accel[1] = ((int16_t)data[2] << 8) | data[3];
189 rawData.
accel[1] /= 4;
190 rawData.
accel[2] = ((int16_t)data[4] << 8) | data[5];
191 rawData.
accel[2] /= 4;
194 PRINTF(
"\r\n Accel X = %d Y = %d Z = %d\r\n", rawData.
accel[0], rawData.
accel[1], rawData.
accel[2]);
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 FXOS8700_M_CTRL_REG2_M_AUTOINC_MASK
#define ASK_USER_TO_RESUME(x)
#define FXOS8700_CTRL_REG5_INT_CFG_DRDY_MASK
#define FXOS8700_CTRL_REG4_INT_EN_DRDY_EN
const registerwritelist_t fxos8700_Config_Interrupt[]
status_t SMC_SetPowerModeVlpr(void *arg)
Configures the system to VLPR power mode. API name used from Kinetis family to maintain compatibility...
#define FXOS8700_WHO_AM_I_PROD_VALUE
#define FXOS8700_CTRL_REG1_DR_MASK
Access structure of the GPIO Driver.
#define FXOS8700_CTRL_REG1_DR_SINGLE_12P5_HZ
#define __END_WRITE_DATA__
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
#define FXOS8700_CTRL_REG3_PP_OD_MASK
#define I2C_S_SIGNAL_EVENT
This defines the sensor specific information for I2C.
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 FXOS8700_CTRL_REG4_INT_EN_DRDY_MASK
#define BOARD_BootClockRUN
#define RAW_ACCEL_DATA_SIZE
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
uint8_t data[FXLS8962_DATA_SIZE]
#define FXOS8700_CTRL_REG5_INT_CFG_DRDY_INT2
#define __END_READ_DATA__
void fxos8700_isr_callback(void *pUserData)
This is the Sensor Data Ready ISR implementation.
fxos8700_accelmagdata_t rawData
#define FXOS8700_M_CTRL_REG2_M_AUTOINC_ACCEL_ONLY_MODE
void(* toggle_pin)(pinID_t aPinId)
The fxos8700_drv.h file describes the fxos8700 driver interface and structures.
status_t SMC_SetPowerModeWait(void *arg)
Configures the system to WAIT power mode. API name used from Kinetis family to maintain compatibility...
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
This structure defines the Read command List.
const registerreadlist_t FXOS8700_STATUS_READ[]
volatile bool fxos8700Interrupt
gpioHandleKSDK_t GREEN_LED
#define I2C_S_DEVICE_INDEX
#define FXOS8700_CTRL_REG3_PP_OD_PUSH_PULL
void FXOS8700_I2C_SetIdleTask(fxos8700_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
#define FXOS8700_CTRL_REG3_IPOL_MASK
void BOARD_InitDebugConsole(void)
#define FXOS8700_I2C_ADDR
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.
int main(void)
This is the The main function implementation.
#define FXOS8700_CTRL_REG3_IPOL_ACTIVE_HIGH
const registerreadlist_t FXOS8700_ACCEL_READ[]