20 #include "clock_config.h" 25 #include "Driver_I2C.h" 26 #include "Driver_USART.h" 31 #include "issdk_hal.h" 32 #include "gpio_driver.h" 36 #include "auto_detection_service.h" 41 #define FXAS21002_STREAM_DATA_SIZE 12 44 #define APPLICATION_NAME "FXAS21002 Gyroscope Demo" 46 #define APPLICATION_VERSION "2.5" 48 #define SKIP_PACKET_COUNT 5 108 uint8_t tag, uint8_t *hostCommand, uint8_t *hostResponse,
size_t *hostMsgSize,
size_t respBufferSize)
110 bool success =
false;
125 if (respBufferSize >= boardNameLen + shieldNameLen + appNameLen + 3)
134 hostResponse[*hostMsgSize] = appNameLen;
137 memcpy(hostResponse + *hostMsgSize,
embAppName, appNameLen);
138 *hostMsgSize += appNameLen;
140 hostResponse[*hostMsgSize] = boardNameLen;
143 memcpy(hostResponse + *hostMsgSize,
boardString, boardNameLen);
144 *hostMsgSize += boardNameLen;
146 hostResponse[*hostMsgSize] = shieldNameLen;
149 memcpy(hostResponse + *hostMsgSize,
shieldString, shieldNameLen);
150 *hostMsgSize += shieldNameLen;
160 switch (hostCommand[0])
223 if (ARM_DRIVER_OK != status)
229 status = pI2Cdriver->PowerControl(ARM_POWER_FULL);
230 if (ARM_DRIVER_OK != status)
236 status = pI2Cdriver->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
237 if (ARM_DRIVER_OK != status)
244 if (ARM_DRIVER_OK != status)
250 status = pUartDriver->PowerControl(ARM_POWER_FULL);
251 if (ARM_DRIVER_OK != status)
258 if (ARM_DRIVER_OK != status)
314 if (ARM_DRIVER_OK != status)
321 if (ARM_DRIVER_OK != status)
327 if (ARM_DRIVER_OK != status)
336 rawData.
gyro[0] = ((int16_t)data[0] << 8) | data[1];
337 rawData.
gyro[1] = ((int16_t)data[2] << 8) | data[3];
338 rawData.
gyro[2] = ((int16_t)data[4] << 8) | data[5];
339 rawData.
temp = tempOut;
#define FXAS21002_WHO_AM_I_WHOAMI_PROD_VALUE
#define FXAS21002_CTRL_REG2_INT_EN_DRDY_ENABLE
uint8_t Host_IO_Init(ARM_DRIVER_USART *pDrv, void *pBus, void *pDevInfo, void *spiSlaveParams, uint16_t slaveAddress)
void Host_IO_Receive(host_cmd_proc_fn_t process_host_command, uint8_t encoding)
This structure defines the Write command List.
char embAppName[ADS_MAX_STRING_LENGTH]
#define FXAS21002_CTRL_REG2_INT_CFG_DRDY_INT1
#define FXAS21002_STREAM_DATA_SIZE
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.
volatile bool bFxas21002Ready
status_t SMC_SetPowerModeVlpr(void *arg)
Configures the system to VLPR power mode. API name used from Kinetis family to maintain compatibility...
The host_io_uart.h file contains the Host Protocol interface definitions and configuration.
void FXAS21002_I2C_SetIdleTask(fxas21002_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
void fxas21002_int_data_ready_callback(void *pUserData)
#define HOST_PRO_CMD_W_CFG_TAG
Access structure of the GPIO Driver.
#define APPLICATION_NAME
Unique Name for this application which should match the target GUI pkg name.
registerDeviceInfo_t deviceInfo
#define __END_WRITE_DATA__
void(* clr_pin)(pinID_t aPinId)
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
#define HOST_S_SIGNAL_EVENT
#define APPLICATION_VERSION
Version to distinguish between instances the same application based on target Shield and updates...
const registerreadlist_t fxas21002_Reg[]
#define FXAS21002_CTRL_REG2_INT_EN_DRDY_MASK
volatile bool bStreamingEnabled
#define I2C_S_SIGNAL_EVENT
GENERIC_DRIVER_GPIO * pGpioDriver
volatile bool bFxas21002DataReady
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.
void Host_IO_Add_ISO_Header(uint8_t streamID, uint8_t *pStreamingPacket, size_t sizePayload)
#define FXAS21002_CTRL_REG2_IPOL_MASK
volatile uint8_t bSkipPacket
#define BOARD_DEBUG_UART_BAUDRATE
#define BOARD_BootClockRUN
#define FXAS21002_CTRL_REG2_IPOL_ACTIVE_HIGH
#define SKIP_PACKET_COUNT
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
uint8_t streamingPacket[STREAMING_HEADER_LEN+FXLS8962_STREAM_DATA_SIZE]
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
#define FXAS21002_I2C_ADDR
void Host_IO_Send(uint8_t *pMsg, size_t size, uint8_t encoding)
#define FXAS21002_CTRL_REG2_INT_EN_RT_ENABLE
void BOARD_SystickStart(int32_t *pStart)
Function to Record the Start systick.
uint32_t BOARD_SystickElapsedTime_us(int32_t *pStart)
Function to compute the Elapsed Time.
#define FXAS21002_CTRL_REG2_INT_EN_RT_MASK
This structure defines the fxas21002 raw data buffer.
uint8_t data[FXLS8962_DATA_SIZE]
#define __END_READ_DATA__
#define HOST_PRO_INT_DEV_TAG
void BOARD_RunADS(const char *appName, char *boardString, char *shieldString, size_t bufferLength)
The function to register Application Name and initialte ADS.
const registerreadlist_t fxas21002_Output_Values[]
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
int main(void)
Main function.
bool process_host_command(uint8_t tag, uint8_t *hostCommand, uint8_t *hostResponse, size_t *hostMsgSize, size_t respBufferSize)
void(* toggle_pin)(pinID_t aPinId)
#define ADS_MAX_STRING_LENGTH
ARM_DRIVER_I2C * pCommDrv
#define FXAS21002_GYRO_DATA_SIZE
The size of the FXAS21002 gyro data.
char shieldString[ADS_MAX_STRING_LENGTH]
#define FXAS21002_CTRL_REG1_DR_MASK
void BOARD_SystickEnable(void)
Function to enable systicks framework.
#define STREAMING_HEADER_LEN
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
const registerwritelist_t fxas21002_Config_Isr[]
gpioHandleKSDK_t GREEN_LED
char boardString[ADS_MAX_STRING_LENGTH]
#define I2C_S_DEVICE_INDEX
#define FXAS21002_CTRL_REG1_DR_12_5HZ
#define HOST_PRO_INT_CMD_TAG
Bit aligned values for Host Protocol Interface IDs (Bits 5-6).
const registerreadlist_t fxas21002_Temp[]