17 #include "clock_config.h" 19 #include "fsl_debug_console.h" 22 #include "Driver_I2C.h" 25 #include "issdk_hal.h" 32 #define RAW_ACCEL_DATA_SIZE (6) 50 .bits = {.config = 1},
100 PRINTF(
"\r\n ISSDK Pedometer Example using FXOS8700 sensor as the acceleration source\r\n");
104 if (ARM_DRIVER_OK != status)
106 PRINTF(
"\r\n I2C Initialization Failed\r\n");
111 status = I2Cdrv->PowerControl(ARM_POWER_FULL);
112 if (ARM_DRIVER_OK != status)
114 PRINTF(
"\r\n I2C Power Mode setting Failed\r\n");
119 status = I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
120 if (ARM_DRIVER_OK != status)
122 PRINTF(
"\r\n I2C Control Mode setting Failed\r\n");
131 PRINTF(
"\r\n Sensor Initialization Failed\r\n");
134 PRINTF(
"\r\n Successfully Initialized Sensor\r\n");
143 PRINTF(
"\r\n FXOS8700 Sensor Configuration Failed, Err = %d\r\n", status);
146 PRINTF(
"\r\n Successfully Applied FXOS8700 Sensor Configuration\r\n");
158 if (0 == (drStatus.b.zyxdr))
165 if (ARM_DRIVER_OK != status)
169 rawData.
accel[0] = ((int16_t)readBuffer[0] << 8) | readBuffer[1];
170 rawData.
accel[1] = ((int16_t)readBuffer[2] << 8) | readBuffer[3];
171 rawData.
accel[2] = ((int16_t)readBuffer[4] << 8) | readBuffer[5];
struct pedometer_t::pedometer_status_tag status
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.
int main(void)
Main function.
void pedometer_configure(pedometer_t *pPedometer, const pedometer_config_t *pConfig)
The interface function to configure the pedometer.
This structure defines the Write command List.
The pedometer.h file contains the interface and structure definitions for pedometer application...
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 PEDO_FILTER_STEPS_DEFAULT
This defines the configuration structure of the pedometer.
#define __END_WRITE_DATA__
debounce_count_t sleepcount_threshold
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
#define PEDO_FREQHZ_DEFAULT
#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.
#define RAW_ACCEL_DATA_SIZE
This defines the pedometer instance.
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.
This defines the acceleration input data for the pedometer.
const registerwritelist_t fxos8700_Config[]
#define BOARD_BootClockRUN
#define FXOS8700_CTRL_REG1_DR_SINGLE_50_HZ
#define PEDO_FILTER_TIME_DEFAULT
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
const registerreadlist_t FXOS8700_STATUS_READ[]
This structure defines the fxos8700 raw accel data buffer.
const registerreadlist_t FXOS8700_ACCEL_READ[]
#define __END_READ_DATA__
fxos8700_accelmagdata_t rawData
#define FXOS8700_M_CTRL_REG2_M_AUTOINC_ACCEL_ONLY_MODE
The fxos8700_drv.h file describes the fxos8700 driver interface and structures.
#define PEDO_SPEED_PERIOD_DEFAULT
This structure defines the Read command List.
int32_t pedometer_run(pedometer_t *pPedometer, ped_accel_t *pData)
The interface function excutes the pedometer algorithm.
#define I2C_S_DEVICE_INDEX
#define PEDO_STEP_THRESHOLD_DEFAULT
void FXOS8700_I2C_SetIdleTask(fxos8700_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
void BOARD_InitDebugConsole(void)
void pedometer_init(pedometer_t *pPedometer)
The interface function initialize the pedometer.
#define FXOS8700_I2C_ADDR
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.