![]() |
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 "fxls8962_drv.h"
Go to the source code of this file.
Macros | |
#define | SDCD_LTHS_LSB 0xA0 /* Lower Threshold LSB value. */ |
#define | SDCD_LTHS_MSB 0x0F /* Lower Threshold MSB value. */ |
#define | SDCD_UTHS_LSB 0x40 /* Upper Threshold LSB value. */ |
#define | SDCD_UTHS_MSB 0x00 /* Upper Threshold MSB value. */ |
#define | ASLP_COUNT_LSB 0xFA /* Auto Sleep after 5s @50Hz Wake ODR */ |
#define | ASLP_COUNT_MSB 0x00 /* Auto Sleep after 5s @50Hz Wake ODR */ |
#define | FXLS8962_DATA_SIZE 6 /* 2 byte X,Y,Z Axis Data each. */ |
Functions | |
void | fxls8962_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 | cFxls8962ConfigInitialize [] |
FXLS8962 Motion based Pedometer Register Write List. More... | |
const registerwritelist_t | cFxls8962ConfigMotionDetect [] |
FXLS8962 Motion Detect Mode Register Write List. More... | |
const registerwritelist_t | cFxls8962ConfigDataReady [] |
FXLS8962 DRDY and ASLP Detect Mode Register Write List. More... | |
const registerreadlist_t | cFxls8962INTStatus [] = {{.readFrom = FXLS8962_INT_STATUS, .numBytes = 1}, __END_READ_DATA__} |
Address of INT Status Register. More... | |
const registerreadlist_t | cFxls8962Output [] = {{.readFrom = FXLS8962_OUT_X_LSB, .numBytes = FXLS8962_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 | gFxls8962EventReady = false |
pedometer_config_t | cPedoConfig |
gpioConfigKSDK_t | gpioConfigINT1 |
#define ASLP_COUNT_LSB 0xFA /* Auto Sleep after 5s @50Hz Wake ODR */ |
Definition at line 43 of file pedometer_stepcount_motion_fxls8962.c.
#define ASLP_COUNT_MSB 0x00 /* Auto Sleep after 5s @50Hz Wake ODR */ |
Definition at line 44 of file pedometer_stepcount_motion_fxls8962.c.
#define FXLS8962_DATA_SIZE 6 /* 2 byte X,Y,Z Axis Data each. */ |
Definition at line 45 of file pedometer_stepcount_motion_fxls8962.c.
Referenced by main().
#define SDCD_LTHS_LSB 0xA0 /* Lower Threshold LSB value. */ |
Definition at line 39 of file pedometer_stepcount_motion_fxls8962.c.
#define SDCD_LTHS_MSB 0x0F /* Lower Threshold MSB value. */ |
Definition at line 40 of file pedometer_stepcount_motion_fxls8962.c.
#define SDCD_UTHS_LSB 0x40 /* Upper Threshold LSB value. */ |
Definition at line 41 of file pedometer_stepcount_motion_fxls8962.c.
#define SDCD_UTHS_MSB 0x00 /* Upper Threshold MSB value. */ |
Definition at line 42 of file pedometer_stepcount_motion_fxls8962.c.
void fxls8962_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 147 of file pedometer_stepcount_motion_fxls8962.c.
References gFxls8962EventReady.
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 FXLS8962 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 FXLS8962 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 Status from the FXLS8962.
Display that a Motion event has been detected.
Read the Output from the FXLS8962.
Convert the raw sensor data for feeding to pedometer algorithm.
Execute the pedometer Algorithm
Definition at line 161 of file pedometer_stepcount_motion_fxls8962.c.
References fxls8962_acceldata_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, fxls8962_i2c_sensorhandle_t::deviceInfo, pedometer_t::pedometer_status_tag::distance, Driver_GPIO_KSDK, FXLS8962_DATA_SIZE, FXLS8962_I2C_ADDR, FXLS8962_I2C_Configure(), FXLS8962_I2C_Initialize(), FXLS8962_I2C_ReadData(), FXLS8962_I2C_SetIdleTask(), FXLS8962_INT1, fxls8962_int_callback(), FXLS8962_INT_STATUS_SRC_ASLP_MASK, FXLS8962_INT_STATUS_SRC_SDCD_OT_MASK, FXLS8962_WHOAMI_VALUE, fxls8962Driver, gFxls8962EventReady, GPIO_DIRECTION_IN, GPIO_DIRECTION_OUT, GREEN_LED, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, I2Cdrv, int32_t(), pActivity, fxls8962_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, fxls8962_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 cFxls8962ConfigDataReady[] |
FXLS8962 DRDY and ASLP Detect Mode Register Write List.
Definition at line 87 of file pedometer_stepcount_motion_fxls8962.c.
const registerwritelist_t cFxls8962ConfigInitialize[] |
FXLS8962 Motion based Pedometer Register Write List.
Definition at line 51 of file pedometer_stepcount_motion_fxls8962.c.
const registerwritelist_t cFxls8962ConfigMotionDetect[] |
FXLS8962 Motion Detect Mode Register Write List.
Definition at line 81 of file pedometer_stepcount_motion_fxls8962.c.
const registerreadlist_t cFxls8962INTStatus[] = {{.readFrom = FXLS8962_INT_STATUS, .numBytes = 1}, __END_READ_DATA__} |
Address of INT Status Register.
Definition at line 93 of file pedometer_stepcount_motion_fxls8962.c.
const registerreadlist_t cFxls8962Output[] = {{.readFrom = FXLS8962_OUT_X_LSB, .numBytes = FXLS8962_DATA_SIZE}, __END_READ_DATA__} |
Address of Data Output Registers.
Definition at line 96 of file pedometer_stepcount_motion_fxls8962.c.
pedometer_config_t cPedoConfig |
Definition at line 107 of file pedometer_stepcount_motion_fxls8962.c.
volatile bool gFxls8962EventReady = false |
Definition at line 104 of file pedometer_stepcount_motion_fxls8962.c.
Referenced by fxls8962_int_callback(), and main().
gpioConfigKSDK_t gpioConfigINT1 |
Definition at line 129 of file pedometer_stepcount_motion_fxls8962.c.
const char* pActivity[5] = {"Unknown ", "Rest ", "Walking ", "Jogging ", "Running "} |
Pedometer Mode Name Strings.
Definition at line 99 of file pedometer_stepcount_motion_fxls8962.c.
Referenced by main().