18 #include "clock_config.h"    20 #include "fsl_debug_console.h"    25 #include "Driver_I2C.h"    30 #include "issdk_hal.h"    32 #include "gpio_driver.h"    38 #define FXLS8974_DATA_SIZE 6      58 const char *
pActivity[5] = {
"Unknown ", 
"Rest    ", 
"Walking ", 
"Jogging ", 
"Running "};
    66     .bits = {.config = 1},
    88     .portPinConfig = {.pullSelect = kPORT_PullUp, .mux = kPORT_MuxAsGpio},
    89     .interruptMode = kPORT_InterruptFallingEdge,
   108     uint16_t lastReportedSteps;
   123     PRINTF(
"\r\n ISSDK FXLS896x sensor driver example for Pedometer.\r\n");
   130     if (ARM_DRIVER_OK != status)
   132         PRINTF(
"\r\n I2C Initialization Failed\r\n");
   137     status = I2Cdrv->PowerControl(ARM_POWER_FULL);
   138     if (ARM_DRIVER_OK != status)
   140         PRINTF(
"\r\n I2C Power Mode setting Failed\r\n");
   145     status = I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
   146     if (ARM_DRIVER_OK != status)
   148         PRINTF(
"\r\n I2C Control Mode setting Failed\r\n");
   155     if (ARM_DRIVER_OK != status)
   157         PRINTF(
"\r\n Sensor Initialization Failed\r\n");
   162                 PRINTF(
"\r\n Successfully Initialized Gemini with WHO_AM_I = 0x%X\r\n", whoami);
   166                 PRINTF(
"\r\n Successfully Initialized Timandra with WHO_AM_I = 0x%X\r\n", whoami);
   170                 PRINTF(
"\r\n Successfully Initialized Newstein with WHO_AM_I = 0x%X\r\n", whoami);
   174                 PRINTF(
"\r\n Bad WHO_AM_I = 0x%X\r\n", whoami);
   186         PRINTF(
"\r\n FXLS896x Sensor Configuration Failed, Err = %d\r\n", status);
   189     PRINTF(
"\r\n Successfully Applied FXLS8974 Sensor Configuration\r\n");
   193     PRINTF(
"\r\n Pedometer successfully Initialized.");
   194     PRINTF(
"\r\n\r\n Ready for measurements.");
   215             if (ARM_DRIVER_OK != status)
   217                 PRINTF(
"\r\n ERROR : Read Data Failed!\r\n");
   222             rawData.
accel[0] = ((int16_t)data[1] << 8) | data[0];
   223             rawData.
accel[0] *= 16; 
   224             rawData.
accel[1] = ((int16_t)data[3] << 8) | data[2];
   225             rawData.
accel[1] *= 16; 
   226             rawData.
accel[2] = ((int16_t)data[5] << 8) | data[4];
   227             rawData.
accel[2] *= 16; 
   239                     PRINTF(
"\r\n\r\n | Steps |\r\n");
 void(* set_pin)(pinID_t aPinId)
 
struct pedometer_t::pedometer_status_tag status
 
void pedometer_configure(pedometer_t *pPedometer, const pedometer_config_t *pConfig)
The interface function to configure the pedometer. 
 
const char * pActivity[5]
Pedometer Mode Name Strings. 
 
The GPIO Configuration KSDK. 
 
This structure defines the Write command List. 
 
#define FXLS8974_SENS_CONFIG1_FSR_MASK
 
#define FXLS8974_INT_STATUS_SRC_DRDY_MASK
 
int32_t FXLS8974_I2C_Configure(fxls8974_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor. 
 
The pedometer.h file contains the interface and structure definitions for pedometer application...
 
int32_t FXLS8974_I2C_Initialize(fxls8974_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t *whoami)
The interface function to initialize the sensor. 
 
#define PEDO_FILTER_STEPS_DEFAULT
 
Access structure of the GPIO Driver. 
 
This defines the sensor specific information for I2C. 
 
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 FXLS8967_WHOAMI_VALUE
 
gpio_pin_config_t pinConfig
 
#define I2C_S_SIGNAL_EVENT
 
#define FXLS8974_I2C_ADDR
 
This defines the pedometer instance. 
 
This defines the acceleration input data for the pedometer. 
 
#define BOARD_BootClockRUN
 
#define PEDO_FILTER_TIME_DEFAULT
 
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type. 
 
int32_t FXLS8974_I2C_ReadData(fxls8974_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data. 
 
const registerwritelist_t cFxls8974ConfigInitialize[]
FXLS896x Motion based Pedometer Register Write List. 
 
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
 
GENERIC_DRIVER_GPIO * pGpioDriver
 
This structure defines the fxls8974 raw data buffer. 
 
const registerreadlist_t cFxls8974DRDYEvent[]
Address of DATA Ready Status Register. 
 
uint8_t data[FXLS8962_DATA_SIZE]
 
#define FXLS8974_DATA_SIZE
 
#define __END_READ_DATA__
 
gpioConfigKSDK_t gpioConfigINT1
 
#define FXLS8974_SENS_CONFIG3_WAKE_ODR_MASK
 
const registerreadlist_t cFxls8974Output[]
Address of Data Output Registers. 
 
fxls8974_i2c_sensorhandle_t fxls8974Driver
 
fxos8700_accelmagdata_t rawData
 
void FXLS8974_I2C_SetIdleTask(fxls8974_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task. 
 
int main(void)
This is the The main function implementation. 
 
void(* toggle_pin)(pinID_t aPinId)
 
#define PEDO_SPEED_PERIOD_DEFAULT
 
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)
 
#define FXLS8974_SENS_CONFIG1_FSR_2G
 
This structure defines the Read command List. 
 
gpioHandleKSDK_t GREEN_LED
 
#define FXLS8974_WHOAMI_VALUE
 
The fxls8974_drv.h file describes the FXLS8974CF driver interface and structures. ...
 
int32_t pedometer_run(pedometer_t *pPedometer, ped_accel_t *pData)
The interface function excutes the pedometer algorithm. 
 
#define FXLS8968_WHOAMI_VALUE
 
#define I2C_S_DEVICE_INDEX
 
#define PEDO_STEP_THRESHOLD_DEFAULT
 
#define FXLS8974_SENS_CONFIG3_WAKE_ODR_50HZ
 
void BOARD_InitDebugConsole(void)
 
#define FXLS8962_WHOAMI_VALUE
 
void pedometer_init(pedometer_t *pPedometer)
The interface function initialize the pedometer. 
 
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features. 
 
#define FXLS8964_WHOAMI_VALUE