![]() |
ISSDK
1.8
IoT Sensing Software Development Kit
|
#include "board.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "fsl_debug_console.h"
#include "Driver_I2C.h"
#include "issdk_hal.h"
#include "pedometer.h"
#include "gpio_driver.h"
#include "fxos8700_drv.h"
Go to the source code of this file.
Macros | |
#define | MT_A_FFMT_THS 0x15 /* Threshold Value. */ |
#define | ASLP_COUNTER 0x10 /* Auto Sleep after ~5s. */ |
#define | FXOS8700_ACCEL_DATA_SIZE 6 /* 2-byte Accel x,y,z each */ |
Functions | |
void | fxos8700_int_callback (void *pUserData) |
This is the Sensor Event Ready ISR implementation. More... | |
int | main (void) |
This is the The main function implementation. More... | |
Variables | |
const registerwritelist_t | cFxos8700CommonConfiguration [] |
FXOS8700 Motion based Pedometer Register Write List. More... | |
const registerwritelist_t | cFxos8700ConfigMotionDetect [] |
FXOS8700 Motion Detect Mode Register Write List. More... | |
const registerwritelist_t | cFxos8700ConfigDataReady [] |
FXOS8700 DRDY and ASLP Detect Mode Register Write List. More... | |
const registerreadlist_t | cFxos8700INTSrc [] = {{.readFrom = FXOS8700_INT_SOURCE, .numBytes = 1}, __END_READ_DATA__} |
Address of INT Source Register. More... | |
const registerreadlist_t | cFxos8700Output [] = {{.readFrom = FXOS8700_OUT_X_MSB, .numBytes = FXOS8700_ACCEL_DATA_SIZE}, __END_READ_DATA__} |
Address of Data Output Registers. More... | |
const char * | pActivity [5] = {"Unknown ", "Rest ", "Walking ", "Jogging ", "Running "} |
Pedometer Mode Name Strings. More... | |
volatile bool | gFxos8700EventReady = false |
pedometer_config_t | cPedoConfig |
#define ASLP_COUNTER 0x10 /* Auto Sleep after ~5s. */ |
Definition at line 40 of file pedometer_stepcount_motion_fxos8700.c.
#define FXOS8700_ACCEL_DATA_SIZE 6 /* 2-byte Accel x,y,z each */ |
Definition at line 41 of file pedometer_stepcount_motion_fxos8700.c.
Referenced by main().
#define MT_A_FFMT_THS 0x15 /* Threshold Value. */ |
Definition at line 39 of file pedometer_stepcount_motion_fxos8700.c.
void fxos8700_int_callback | ( | void * | pUserData | ) |
This is the Sensor Event Ready ISR implementation.
This function sets the flag which indicates if a new sample(s) is available for reading.
[in] | pUserData | This is a void pointer to the instance of the user specific data structure for the ISR. |
Set flag to indicate Sensor has signaled event ready.
Definition at line 129 of file pedometer_stepcount_motion_fxos8700.c.
References gFxos8700EventReady.
Referenced by main().
int main | ( | void | ) |
This is the The main function implementation.
This function invokes board initializes routines, then then brings up the sensor and finally enters an endless loop to continuously read available samples.
[in] | void | This is no input parameter. |
Initialize the MCU hardware.
Initialize FXOS8700 pin used by FRDM board
Initialize RGB LED pin used by FRDM board
Initialize the I2C driver.
Set the I2C Power mode.
Set the I2C bus speed.
Initialize FXOS8700 sensor driver.
Set the task to be executed while waiting for I2C transactions to complete.
Initialize the pedometer
Configure the pedometer
Clear the data ready flag, it will be set again by the ISR.
Read the INT_SRC from the FXOS8700.
Display that a Motion event has been detected.
Read the Output from the FXOS8700.
Convert the raw sensor data for feeding to pedometer algorithm.
Execute the pedometer Algorithm
Definition at line 143 of file pedometer_stepcount_motion_fxos8700.c.
References fxos8700_accelmagdata_t::accel, pedometer_t::pedometer_status_tag::bits, BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), pedometer_t::pedometer_status_tag::calories, GENERIC_DRIVER_GPIO::clr_pin, data, fxos8700_i2c_sensorhandle_t::deviceInfo, pedometer_t::pedometer_status_tag::distance, Driver_GPIO_KSDK, FXOS8700_ACCEL_DATA_SIZE, FXOS8700_I2C_ADDR, FXOS8700_I2C_Configure(), FXOS8700_I2C_Initialize(), FXOS8700_I2C_ReadData(), FXOS8700_I2C_SetIdleTask(), FXOS8700_INT1, fxos8700_int_callback(), FXOS8700_INT_SOURCE_SRC_ASLP_MASK, FXOS8700_INT_SOURCE_SRC_FFMT_MASK, FXOS8700_WHO_AM_I_PROD_VALUE, gFxos8700EventReady, GPIO_DIRECTION_IN, GPIO_DIRECTION_OUT, GREEN_LED, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, I2Cdrv, int32_t(), pActivity, fxos8700_i2c_sensorhandle_t::pCommDrv, pedometer_configure(), pedometer_init(), pedometer_run(), pGpioDriver, GENERIC_DRIVER_GPIO::pin_init, rawData, SENSOR_ERROR_NONE, Sensor_I2C_Write(), GENERIC_DRIVER_GPIO::set_pin, fxos8700_i2c_sensorhandle_t::slaveAddress, SMC, SMC_SetPowerModeVlpr(), SMC_SetPowerModeWait(), pedometer_t::pedometer_status_tag::speed, pedometer_t::pedometer_status_tag::status, pedometer_t::status, status, pedometer_t::pedometer_status_tag::stepcount, and GENERIC_DRIVER_GPIO::toggle_pin.
const registerwritelist_t cFxos8700CommonConfiguration[] |
FXOS8700 Motion based Pedometer Register Write List.
Definition at line 47 of file pedometer_stepcount_motion_fxos8700.c.
const registerwritelist_t cFxos8700ConfigDataReady[] |
FXOS8700 DRDY and ASLP Detect Mode Register Write List.
Definition at line 73 of file pedometer_stepcount_motion_fxos8700.c.
const registerwritelist_t cFxos8700ConfigMotionDetect[] |
FXOS8700 Motion Detect Mode Register Write List.
Definition at line 64 of file pedometer_stepcount_motion_fxos8700.c.
const registerreadlist_t cFxos8700INTSrc[] = {{.readFrom = FXOS8700_INT_SOURCE, .numBytes = 1}, __END_READ_DATA__} |
Address of INT Source Register.
Definition at line 82 of file pedometer_stepcount_motion_fxos8700.c.
const registerreadlist_t cFxos8700Output[] = {{.readFrom = FXOS8700_OUT_X_MSB, .numBytes = FXOS8700_ACCEL_DATA_SIZE}, __END_READ_DATA__} |
Address of Data Output Registers.
Definition at line 85 of file pedometer_stepcount_motion_fxos8700.c.
pedometer_config_t cPedoConfig |
Definition at line 96 of file pedometer_stepcount_motion_fxos8700.c.
volatile bool gFxos8700EventReady = false |
Definition at line 93 of file pedometer_stepcount_motion_fxos8700.c.
Referenced by fxos8700_int_callback(), and main().
const char* pActivity[5] = {"Unknown ", "Rest ", "Walking ", "Jogging ", "Running "} |
Pedometer Mode Name Strings.
Definition at line 88 of file pedometer_stepcount_motion_fxos8700.c.
Referenced by main().