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) 58 .bits = {.config = 1},
101 PRINTF(
"\r\n ISSDK Pedometer Example using MMA8451 sensor as the acceleration source\r\n");
105 if (ARM_DRIVER_OK != status)
107 PRINTF(
"\r\n I2C Initialization Failed\r\n");
112 status = I2Cdrv->PowerControl(ARM_POWER_FULL);
113 if (ARM_DRIVER_OK != status)
115 PRINTF(
"\r\n I2C Power Mode setting Failed\r\n");
120 status = I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
121 if (ARM_DRIVER_OK != status)
123 PRINTF(
"\r\n I2C Control Mode setting Failed\r\n");
132 PRINTF(
"\r\n Sensor Initialization Failed\r\n");
135 PRINTF(
"\r\n Successfully Initiliazed Sensor\r\n");
144 PRINTF(
"\r\n MMA845x Sensor Configuration Failed, Err = %d\r\n", status);
149 PRINTF(
"\r\n Successfully Applied MMA845x Sensor Configuration\r\n");
169 if (ARM_DRIVER_OK != status)
175 rawData.
accel[0] = ((int16_t)data[0] << 8) | data[1];
176 rawData.
accel[1] = ((int16_t)data[2] << 8) | data[3];
177 rawData.
accel[2] = ((int16_t)data[4] << 8) | data[5];
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.
#define MMA8451_WHO_AM_I_WHOAMI_VALUE
This structure defines the Write command List.
const registerreadlist_t mma845x_Data_Ready[]
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 PEDO_FILTER_STEPS_DEFAULT
int32_t MMA845x_I2C_Configure(mma845x_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
int32_t MMA845x_I2C_Initialize(mma845x_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 defines the configuration structure of the pedometer.
#define __END_WRITE_DATA__
void MMA845x_I2C_SetIdleTask(mma845x_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
debounce_count_t sleepcount_threshold
This structure defines the mma845x raw data buffer.
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 pedometer instance.
#define MMA845x_CTRL_REG1_DR_50HZ
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.
uint8_t data[FXLS8962_DATA_SIZE]
#define __END_READ_DATA__
const registerwritelist_t mma845x_Config_Normal[]
fxos8700_accelmagdata_t rawData
#define MMA845x_F_SETUP_F_MODE_FIFODISABLED
#define MMA845x_ACCEL_DATA_SIZE
The size of the MMA845x accel data.
#define PEDO_SPEED_PERIOD_DEFAULT
#define MMA845x_STATUS_ZYXDR_MASK
int main(void)
Main function.
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
#define MMA845x_CTRL_REG1_MODE_STANDBY
This defines the sensor specific information.
The mma845x_drv.h file describes the MMA845x driver interface and structures.
void BOARD_InitDebugConsole(void)
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 MMA845x_CTRL_REG2_SMODS_HIGHRES
const registerreadlist_t mma845x_Output_Values[]
int32_t MMA845x_I2C_ReadData(mma845x_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.