17 #include "clock_config.h" 19 #include "fsl_debug_console.h" 22 #include "Driver_I2C.h" 25 #include "issdk_hal.h" 32 #define MMA865x_ACCEL_DATA_SIZE (6) 57 .bits = {.config = 1},
99 PRINTF(
"\r\n ISSDK Pedometer Example using MMA8652 sensor as the acceleration source\r\n");
103 if (ARM_DRIVER_OK != status)
105 PRINTF(
"\r\n I2C Initialization Failed\r\n");
110 status = I2Cdrv->PowerControl(ARM_POWER_FULL);
111 if (ARM_DRIVER_OK != status)
113 PRINTF(
"\r\n I2C Power Mode setting Failed\r\n");
118 status = I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
119 if (ARM_DRIVER_OK != status)
121 PRINTF(
"\r\n I2C Control Mode setting Failed\r\n");
130 PRINTF(
"\r\n Sensor Initialization Failed\r\n");
135 PRINTF(
"\r\n Successfully Initiliazed Sensor\r\n");
145 PRINTF(
"\r\n MMA865x Sensor Configuration Failed, Err = %d\r\n", status);
150 PRINTF(
"\r\n Successfully Applied MMA865x Sensor Configuration\r\n");
170 if (ARM_DRIVER_OK != status)
176 rawData.
accel[0] = ((int16_t)data[0] << 8) | data[1];
177 rawData.
accel[1] = ((int16_t)data[2] << 8) | data[3];
178 rawData.
accel[2] = ((int16_t)data[4] << 8) | data[5];
struct pedometer_t::pedometer_status_tag status
#define MMA865x_CTRL_REG1_DR_MASK
void pedometer_configure(pedometer_t *pPedometer, const pedometer_config_t *pConfig)
The interface function to configure the pedometer.
int main(void)
Main function.
This structure defines the Write command List.
This defines the sensor specific information.
The pedometer.h file contains the interface and structure definitions for pedometer application...
#define MMA865x_XYZ_DATA_CFG_FS_MASK
status_t SMC_SetPowerModeVlpr(void *arg)
Configures the system to VLPR power mode. API name used from Kinetis family to maintain compatibility...
#define MMA865x_CTRL_REG1_DR_50HZ
#define PEDO_FILTER_STEPS_DEFAULT
#define MMA865x_STATUS_ZYXDR_MASK
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
int32_t MMA865x_I2C_ReadData(mma865x_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
#define I2C_S_SIGNAL_EVENT
This defines the pedometer instance.
#define MMA865x_CTRL_REG2_MODS_MASK
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]
int32_t MMA865x_I2C_Configure(mma865x_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
#define __END_READ_DATA__
The mma865x_drv.h file describes the MMA865x driver interface and structures.
fxos8700_accelmagdata_t rawData
#define MMA865x_ACCEL_DATA_SIZE
#define MMA865x_CTRL_REG2_MODS_HR
#define PEDO_SPEED_PERIOD_DEFAULT
#define MMA865x_XYZ_DATA_CFG_FS_2G
This structure defines the Read command List.
This structure defines the mma865x raw data buffer.
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 MMA865x_I2C_SetIdleTask(mma865x_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
const registerwritelist_t cMma865xConfigNormal[]
void BOARD_InitDebugConsole(void)
#define MMA8652_WHOAMI_VALUE
void pedometer_init(pedometer_t *pPedometer)
The interface function initialize the pedometer.
int32_t MMA865x_I2C_Initialize(mma865x_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi)
The interface function to initialize the sensor.
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.
const registerreadlist_t cMma865xDataReady[]
const registerreadlist_t cMma865xOutputValues[]