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" 99 PRINTF(
"\r\n ISSDK FXAS21002 sensor driver example demonstration with interrupt mode.\r\n");
109 if (ARM_DRIVER_OK != status)
111 PRINTF(
"\r\n I2C Initialization Failed\r\n");
116 status = I2Cdrv->PowerControl(ARM_POWER_FULL);
117 if (ARM_DRIVER_OK != status)
119 PRINTF(
"\r\n I2C Power Mode setting Failed\r\n");
124 status = I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
125 if (ARM_DRIVER_OK != status)
127 PRINTF(
"\r\n I2C Control Mode setting Failed\r\n");
136 PRINTF(
"\r\n Sensor Initialization Failed\r\n");
139 PRINTF(
"\r\n Successfully Initiliazed Sensor\r\n");
148 PRINTF(
"\r\n FXAS21002 Sensor Configuration Failed, Err = %d\r\n", status);
151 PRINTF(
"\r\n Successfully Applied FXAS21002 Sensor Configuration\r\n");
169 if (ARM_DRIVER_OK != status)
171 PRINTF(
"\r\n Read Failed. \r\n");
176 rawData.
gyro[0] = ((int16_t)data[0] << 8) | data[1];
177 rawData.
gyro[1] = ((int16_t)data[2] << 8) | data[3];
178 rawData.
gyro[2] = ((int16_t)data[4] << 8) | data[5];
181 PRINTF(
"\r\n Gyro X = %d Y = %d Z = %d\r\n", rawData.
gyro[0], rawData.
gyro[1], rawData.
gyro[2]);
int main(void)
This is the The main function implementation.
#define FXAS21002_WHO_AM_I_WHOAMI_PROD_VALUE
#define FXAS21002_CTRL_REG2_INT_EN_DRDY_ENABLE
This structure defines the Write command List.
#define ASK_USER_TO_RESUME(x)
#define FXAS21002_CTRL_REG2_INT_CFG_DRDY_INT1
int32_t FXAS21002_I2C_Initialize(fxas21002_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi)
The interface function to initialize the sensor.
status_t SMC_SetPowerModeVlpr(void *arg)
Configures the system to VLPR power mode. API name used from Kinetis family to maintain compatibility...
void FXAS21002_I2C_SetIdleTask(fxas21002_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
This structure defines the fxas21002 raw data buffer.
Access structure of the GPIO Driver.
#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 FXAS21002_CTRL_REG2_INT_EN_DRDY_MASK
#define I2C_S_SIGNAL_EVENT
int32_t FXAS21002_I2C_Configure(fxas21002_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
This defines the sensor specific information for I2C.
#define FXAS21002_CTRL_REG2_IPOL_MASK
#define BOARD_BootClockRUN
#define FXAS21002_CTRL_REG2_IPOL_ACTIVE_HIGH
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
const registerreadlist_t fxas21002_DRDY[]
const registerreadlist_t fxas21002_Output_Values[]
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
#define FXAS21002_I2C_ADDR
volatile bool fxas21002Interrupt
uint8_t data[FXLS8962_DATA_SIZE]
#define __END_READ_DATA__
const registerwritelist_t fxas21002_Config_Isr[]
The fxas21002_drv.h file describes the fxas21002 driver interface and structures. ...
int32_t FXAS21002_I2C_ReadData(fxas21002_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
fxos8700_accelmagdata_t rawData
void(* toggle_pin)(pinID_t aPinId)
#define FXAS21002_GYRO_DATA_SIZE
The size of the FXAS21002 gyro data.
#define FXAS21002_CTRL_REG1_DR_MASK
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.
#define FXAS21002_CTRL_REG2_INT_CFG_DRDY_MASK
gpioHandleKSDK_t GREEN_LED
#define I2C_S_DEVICE_INDEX
void fxas21002_isr(void *pUserData)
This is the Sensor Data Ready ISR implementation.
#define FXAS21002_CTRL_REG1_DR_12_5HZ
void BOARD_InitDebugConsole(void)
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.