![]() |
ISSDK
1.8
IoT Sensing Software Development Kit
|
FreeRTOS (two task) implementation of sensor fusion on FRDM-K64F/FRDM-FXS-AGM02 with smart power-cycling support. More...
#include "FreeRTOS.h"#include "task.h"#include "queue.h"#include "timers.h"#include "event_groups.h"#include "fsl_debug_console.h"#include "FSL_SMC.H"#include "board.h"#include "pin_mux.h"#include "clock_config.h"#include "fsl_port.h"#include "fsl_i2c.h"#include "register_io_i2c.h"#include "fsl_i2c_cmsis.h"#include "fsl_dspi_cmsis.h"#include "sensor_fusion.h"#include "control.h"#include "status.h"#include "drivers.h"#include "fusion.h"
Go to the source code of this file.
Functions | |
| void | vApplicationIdleHook (void) |
| void | vApplicationTickHook (void) |
| bool | motionCheck (float sample[3], float baseline[3], float tolerance, uint32_t winLength, uint32_t *count) |
| int | main (void) |
| This is a FreeRTOS (dual task) implementation of the NXP sensor fusion demo build. More... | |
Variables | |
| registerDeviceInfo_t | i2cBusInfo |
| SensorFusionGlobals | sfg |
| This is the primary sensor fusion data structure. More... | |
| ControlSubsystem | controlSubsystem |
| used for serial communications More... | |
| StatusSubsystem | statusSubsystem |
| provides visual (usually LED) status indicator More... | |
| struct PhysicalSensor | sensors [3] |
| This implementation uses three physical sensors. More... | |
| EventGroupHandle_t | event_group = NULL |
FreeRTOS (two task) implementation of sensor fusion on FRDM-K64F/FRDM-FXS-AGM02 with smart power-cycling support.
This file shows one recommended way to incorporate sensor fusion capabilities into a FreeRTOS project AND adds intelligent power down of sensors when the DUT is stationary.
Definition in file main_freertos_agm02_power_cycling.c.
| int main | ( | void | ) |
This is a FreeRTOS (dual task) implementation of the NXP sensor fusion demo build.
Definition at line 76 of file main_freertos_agm02_power_cycling.c.
References BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), event_group, FXAS21002_I2C_ADDR, FXAS21002_Init(), FXAS21002_Read(), FXLS8952_Init(), FXLS8952_Read(), FXLS8952C_I2C_ADDR, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, I2Cdrv, initializeControlPort(), SensorFusionGlobals::initializeFusionEngine, initializeStatusSubsystem(), initSensorFusionGlobals(), SensorFusionGlobals::installSensor, MAG3110_I2C_ADDR, MAG3110_Init(), MAG3110_Read(), and sensors.

| bool motionCheck | ( | float | sample[3], |
| float | baseline[3], | ||
| float | tolerance, | ||
| uint32_t | winLength, | ||
| uint32_t * | count | ||
| ) |
The motionCheck() function is not a sensor fusion function. It is a function that simply monitors an accelerometer or magnetometer tri-axial sensor output, returning Boolean true if the sensor appears to be stationary, and false otherwise. This function would normally be called from your fusion_tasks in your main().
| sample | processed triaxial sensor sample (accel or mag) |
| baseline | previous value to compare to |
| tolerance | how much tolerance you can stand |
| winLength | how many samples need to be stable to assert "noMotion" |
| count | how many samples so far we've been not moving |
Definition at line 23 of file motionCheck.c.
| void vApplicationIdleHook | ( | void | ) |
Definition at line 55 of file main_freertos_agm02_power_cycling.c.
| void vApplicationTickHook | ( | void | ) |
Definition at line 63 of file main_freertos_agm02_power_cycling.c.
References NORMAL, and SensorFusionGlobals::queueStatus.
| ControlSubsystem controlSubsystem |
used for serial communications
Definition at line 51 of file main_freertos_agm02_power_cycling.c.
| EventGroupHandle_t event_group = NULL |
Definition at line 54 of file main_freertos_agm02_power_cycling.c.
Referenced by main().
| registerDeviceInfo_t i2cBusInfo |
Definition at line 43 of file main_freertos_agm02_power_cycling.c.
| struct PhysicalSensor sensors[3] |
This implementation uses three physical sensors.
Definition at line 53 of file main_freertos_agm02_power_cycling.c.
Referenced by main().
This is the primary sensor fusion data structure.
Definition at line 50 of file main_freertos_agm02_power_cycling.c.
| StatusSubsystem statusSubsystem |
provides visual (usually LED) status indicator
Definition at line 52 of file main_freertos_agm02_power_cycling.c.