Sensor Fusion 7.00 Preview - Part 1

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sensor Fusion 7.00 Preview - Part 1

Sensor Fusion 7.00 Preview - Part 1

All,

We are busily working to integrate Version 7.00 of the sensor fusion library into the Kinetis Expert (KEX) ecosystem.  ETA is early August.  I have attached here a preview copy of the user manual for that release.  This is subject to the usual disclaimers: content subject to change, no liability, yada yada yada.  There are a LOT of changes.    These are documented ad nauseum in the user guide.  I've also added a lot of our old blog content into the user guide, as I keep getting requests for them.  Please take a look and give me your feedback.

 

FYI, Here is a sample main() for the new fusion, running on FreeRTOS:

 

/* FreeRTOS kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "timers.h"
#include "event_groups.h"

// KSDK and ISSDK Headers
#include "fsl_debug_console.h"  // KSDK header file for the debug interface
#include "board.h"              // KSDK header file to define board configuration
#include "pin_mux.h"            // KSDK header file for pin mux initialization functions
#include "clock_config.h"       // KSDK header file for clock configuration
#include "fsl_port.h"           // KSDK header file for Port I/O control
#include "fsl_i2c.h"            // KSDK header file for I2C interfaces
#include "Driver_I2C_SDK2.h"    // ISSDK header file for CMSIS I2C Driver
#include "fxas21002.h"          // register address and bit field definitions
#include "mpl3115.h"            // register address and bit field definitions
#include "fxos8700.h"           // register address and bit field definitions

// Sensor Fusion Headers
#include "sensor_fusion.h"      // top level magCal and sensor fusion interfaces
#include "control.h"           // Command/Streaming interface - application specific
#include "status.h"            // Sta:tus indicator interface - application specific
#include "drivers.h"           // NXP sensor drivers OR customer-supplied drivers

// Global data structures
SensorFusionGlobals sfg;                ///< This is the primary sensor fusion data structure
ControlSubsystem controlSubsystem;      ///< used for serial communications
StatusSubsystem statusSubsystem;        ///< provides visual (usually LED) status indicator
PhysicalSensor sensors[3];              ///< This implementation uses three physical sensors
EventGroupHandle_t event_group = NULL;

static void read_task(void *pvParameters);              // FreeRTOS Task definition
static void fusion_task(void *pvParameters);            // FreeRTOS Task definition

/// This is a FreeRTOS (dual task) implementation of the NXP sensor fusion demo build.
int main(void)
{
    ARM_DRIVER_I2C* I2Cdrv = &I2C_S_DRIVER_BLOCKING;       // defined in the <shield>.h file

    BOARD_InitPins();                   // defined in pin_mux.c, initializes pkg pins
    BOARD_BootClockRUN();               // defined in clock_config.c, initializes clocks
    BOARD_InitDebugConsole();           // defined in board.c, initializes the OpenSDA port

    I2Cdrv->Initialize(NULL);                                 // Initialize the KSDK driver for the I2C port

    I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);      // Configure the I2C bus speed

    initializeControlPort(&controlSubsystem);                           // configure pins and ports for the control sub-system
    initializeStatusSubsystem(&statusSubsystem);                        // configure pins and ports for the status sub-system
    initSensorFusionGlobals(&sfg, &statusSubsystem, &controlSubsystem); // Initialize sensor fusion structures
    // "install" the sensors we will be using
    sfg.installSensor(&sfg, &sensors[0], FXOS8700_I2C_ADDR, 1, (void*) I2Cdrv, FXOS8700_Init,  FXOS8700_Read);
    sfg.installSensor(&sfg, &sensors[1], FXAS21002_I2C_ADDR, 1, (void*) I2Cdrv, FXAS21002_Init, FXAS21002_Read);
    sfg.installSensor(&sfg, &sensors[2], MPL3115_I2C_ADDR, 2, (void*) I2Cdrv, MPL3115_Init, MPL3115_Read);
    sfg.initializeFusionEngine(&sfg);         // This will initialize sensors and magnetic calibration

    event_group = xEventGroupCreate();
    xTaskCreate(read_task, "READ", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 2, NULL);
    xTaskCreate(fusion_task, "FUSION", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL);

    sfg.setStatus(&sfg, NORMAL);                // If we got this far, let's set status state to NORMAL
    vTaskStartScheduler();                      // Start the RTOS scheduler
    sfg.setStatus(&sfg, HARD_FAULT);            // If we got this far, FreeRTOS does not have enough memory allocated
    for (;;) ;
}

static void read_task(void *pvParameters)
{
    uint16_t i=0;                       // general counter variable
    portTickType lastWakeTime;
    const portTickType frequency = 1;   // tick counter runs at the read rate
    lastWakeTime = xTaskGetTickCount();
    while (1)
    {
        for (i=1; i<=OVERSAMPLE_RATE; i++) {
            vTaskDelayUntil(&lastWakeTime, frequency);
            sfg.readSensors(&sfg, i);              // Reads sensors, applies HAL and does averaging (if applicable)
        }
        xEventGroupSetBits(event_group, B0);
    }
}

static void fusion_task(void *pvParameters)
{
    uint16_t i=0;  // general counter variable
    while (1)
    {
        xEventGroupWaitBits(event_group,    /* The event group handle. */
                            B0,             /* The bit pattern the event group is waiting for. */
                            pdTRUE,         /* BIT_0 and BIT_4 will be cleared automatically. */
                            pdFALSE,        /* Don't wait for both bits, either bit unblock task. */
                            portMAX_DELAY); /* Block indefinitely to wait for the condition to be met. */

        sfg.conditionSensorReadings(&sfg);  // magCal is run as part of this
        sfg.runFusion(&sfg);                // Run the actual fusion algorithms
        sfg.applyPerturbation(&sfg);        // apply debug perturbation (testing only)

        sfg.loopcounter++;                  // The loop counter is used to "serialize" mag cal operations
        i=i+1;
        if (i>=4) {                         // Some status codes include a "blink" feature.  This loop
                i=0;                        // should cycle at least four times for that to operate correctly.
                sfg.updateStatus(&sfg);     // This is where pending status updates are made visible
        }
        sfg.queueStatus(&sfg, NORMAL);      // assume NORMAL status for next pass through the loop
        sfg.pControlSubsystem->stream(&sfg, sUARTOutputBuffer);      // Send stream data to the Sensor Fusion Toolbox
    }
}

/// \endcode

Labels (1)
Attachments
%3CLINGO-SUB%20id%3D%22lingo-sub-1109202%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ESensor%20Fusion%207.00%20Preview%20-%20Part%201%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1109202%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EAll%2C%3C%2FP%3E%3CP%3EWe%20are%20busily%20working%20to%20integrate%20Version%207.00%20of%20the%20sensor%20fusion%20library%20into%20the%20Kinetis%20Expert%20(KEX)%20ecosystem.%26nbsp%3B%20ETA%20is%20early%20August.%26nbsp%3B%20I%20have%20attached%20here%20a%20preview%20copy%20of%20the%20user%20manual%20for%20that%20release.%26nbsp%3B%20This%20is%20subject%20to%20the%20usual%20disclaimers%3A%20content%20subject%20to%20change%2C%20no%20liability%2C%20yada%20yada%20yada.%26nbsp%3B%20There%20are%20a%20LOT%20of%20changes.%26nbsp%3B%26nbsp%3B%26nbsp%3B%20These%20are%20documented%20ad%20nauseum%20in%20the%20user%20guide.%26nbsp%3B%20I've%20also%20added%20a%20lot%20of%20our%20old%20blog%20content%20into%20the%20user%20guide%2C%20as%20I%20keep%20getting%20requests%20for%20them.%26nbsp%3B%20Please%20take%20a%20look%20and%20give%20me%20your%20feedback.%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFYI%2C%20Here%20is%20a%20sample%20main()%20for%20the%20new%20fusion%2C%20running%20on%20FreeRTOS%3A%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%2F*%20FreeRTOS%20kernel%20includes.%20*%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22FreeRTOS.h%22%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22task.h%22%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22queue.h%22%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22timers.h%22%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22event_groups.h%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%2F%2F%20KSDK%20and%20ISSDK%20Headers%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22fsl_debug_console.h%22%26nbsp%3B%20%2F%2F%20KSDK%20header%20file%20for%20the%20debug%20interface%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22board.h%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20KSDK%20header%20file%20to%20define%20board%20configuration%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22pin_mux.h%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20KSDK%20header%20file%20for%20pin%20mux%20initialization%20functions%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22clock_config.h%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20KSDK%20header%20file%20for%20clock%20configuration%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22fsl_port.h%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20KSDK%20header%20file%20for%20Port%20I%2FO%20control%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22fsl_i2c.h%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20KSDK%20header%20file%20for%20I2C%20interfaces%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22Driver_I2C_SDK2.h%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20ISSDK%20header%20file%20for%20CMSIS%20I2C%20Driver%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22fxas21002.h%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20register%20address%20and%20bit%20field%20definitions%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22mpl3115.h%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20register%20address%20and%20bit%20field%20definitions%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22fxos8700.h%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20register%20address%20and%20bit%20field%20definitions%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%2F%2F%20Sensor%20Fusion%20Headers%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22sensor_fusion.h%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20top%20level%20magCal%20and%20sensor%20fusion%20interfaces%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22control.h%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20Command%2FStreaming%20interface%20-%20application%20specific%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22status.h%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20Sta%3Atus%20indicator%20interface%20-%20application%20specific%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%23include%20%22drivers.h%22%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20NXP%20sensor%20drivers%20OR%20customer-supplied%20drivers%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%2F%2F%20Global%20data%20structures%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3ESensorFusionGlobals%20sfg%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%2F%26lt%3B%20This%20is%20the%20primary%20sensor%20fusion%20data%20structure%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3EControlSubsystem%20controlSubsystem%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%2F%26lt%3B%20used%20for%20serial%20communications%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3EStatusSubsystem%20statusSubsystem%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%2F%26lt%3B%20provides%20visual%20(usually%20LED)%20status%20indicator%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3EPhysicalSensor%20sensors%5B3%5D%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%2F%26lt%3B%20This%20implementation%20uses%20three%20physical%20sensors%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3EEventGroupHandle_t%20event_group%20%3D%20NULL%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3Estatic%20void%20read_task(void%20*pvParameters)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20FreeRTOS%20Task%20definition%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3Estatic%20void%20fusion_task(void%20*pvParameters)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20FreeRTOS%20Task%20definition%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%2F%2F%2F%20This%20is%20a%20FreeRTOS%20(dual%20task)%20implementation%20of%20the%20NXP%20sensor%20fusion%20demo%20build.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3Eint%20main(void)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%7B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ARM_DRIVER_I2C*%20I2Cdrv%20%3D%20%26amp%3BI2C_S_DRIVER_BLOCKING%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20defined%20in%20the%20%3CSHIELD%3E.h%20file%3C%2FSHIELD%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20BOARD_InitPins()%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20defined%20in%20pin_mux.c%2C%20initializes%20pkg%20pins%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20BOARD_BootClockRUN()%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20defined%20in%20clock_config.c%2C%20initializes%20clocks%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20BOARD_InitDebugConsole()%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20defined%20in%20board.c%2C%20initializes%20the%20OpenSDA%20port%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2Cdrv-%26gt%3BInitialize(NULL)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20Initialize%20the%20KSDK%20driver%20for%20the%20I2C%20port%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20I2Cdrv-%26gt%3BControl(ARM_I2C_BUS_SPEED%2C%20ARM_I2C_BUS_SPEED_FAST)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20Configure%20the%20I2C%20bus%20speed%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20initializeControlPort(%26amp%3BcontrolSubsystem)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20configure%20pins%20and%20ports%20for%20the%20control%20sub-system%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20initializeStatusSubsystem(%26amp%3BstatusSubsystem)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20configure%20pins%20and%20ports%20for%20the%20status%20sub-system%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20initSensorFusionGlobals(%26amp%3Bsfg%2C%20%26amp%3BstatusSubsystem%2C%20%26amp%3BcontrolSubsystem)%3B%20%2F%2F%20Initialize%20sensor%20fusion%20structures%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20%22install%22%20the%20sensors%20we%20will%20be%20using%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.installSensor(%26amp%3Bsfg%2C%20%26amp%3Bsensors%5B0%5D%2C%20FXOS8700_I2C_ADDR%2C%201%2C%20(void*)%20I2Cdrv%2C%20FXOS8700_Init%2C%26nbsp%3B%20FXOS8700_Read)%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.installSensor(%26amp%3Bsfg%2C%20%26amp%3Bsensors%5B1%5D%2C%20FXAS21002_I2C_ADDR%2C%201%2C%20(void*)%20I2Cdrv%2C%20FXAS21002_Init%2C%20FXAS21002_Read)%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.installSensor(%26amp%3Bsfg%2C%20%26amp%3Bsensors%5B2%5D%2C%20MPL3115_I2C_ADDR%2C%202%2C%20(void*)%20I2Cdrv%2C%20MPL3115_Init%2C%20MPL3115_Read)%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.initializeFusionEngine(%26amp%3Bsfg)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20This%20will%20initialize%20sensors%20and%20magnetic%20calibration%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20event_group%20%3D%20xEventGroupCreate()%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20xTaskCreate(read_task%2C%20%22READ%22%2C%20configMINIMAL_STACK_SIZE%2C%20NULL%2C%20tskIDLE_PRIORITY%20%2B%202%2C%20NULL)%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20xTaskCreate(fusion_task%2C%20%22FUSION%22%2C%20configMINIMAL_STACK_SIZE%2C%20NULL%2C%20tskIDLE_PRIORITY%20%2B%201%2C%20NULL)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.setStatus(%26amp%3Bsfg%2C%20NORMAL)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20If%20we%20got%20this%20far%2C%20let's%20set%20status%20state%20to%20NORMAL%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20vTaskStartScheduler()%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20Start%20the%20RTOS%20scheduler%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.setStatus(%26amp%3Bsfg%2C%20HARD_FAULT)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20If%20we%20got%20this%20far%2C%20FreeRTOS%20does%20not%20have%20enough%20memory%20allocated%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20for%20(%3B%3B)%20%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3Estatic%20void%20read_task(void%20*pvParameters)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%7B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20uint16_t%20i%3D0%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20general%20counter%20variable%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20portTickType%20lastWakeTime%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20const%20portTickType%20frequency%20%3D%201%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20tick%20counter%20runs%20at%20the%20read%20rate%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20lastWakeTime%20%3D%20xTaskGetTickCount()%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20while%20(1)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20for%20(i%3D1%3B%20i%26lt%3B%3DOVERSAMPLE_RATE%3B%20i%2B%2B)%20%7B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20vTaskDelayUntil(%26amp%3BlastWakeTime%2C%20frequency)%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.readSensors(%26amp%3Bsfg%2C%20i)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20Reads%20sensors%2C%20applies%20HAL%20and%20does%20averaging%20(if%20applicable)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20xEventGroupSetBits(event_group%2C%20B0)%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3Estatic%20void%20fusion_task(void%20*pvParameters)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%7B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20uint16_t%20i%3D0%3B%26nbsp%3B%20%2F%2F%20general%20counter%20variable%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20while%20(1)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20xEventGroupWaitBits(event_group%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F*%20The%20event%20group%20handle.%20*%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20B0%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F*%20The%20bit%20pattern%20the%20event%20group%20is%20waiting%20for.%20*%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20pdTRUE%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F*%20BIT_0%20and%20BIT_4%20will%20be%20cleared%20automatically.%20*%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20pdFALSE%2C%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F*%20Don't%20wait%20for%20both%20bits%2C%20either%20bit%20unblock%20task.%20*%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20portMAX_DELAY)%3B%20%2F*%20Block%20indefinitely%20to%20wait%20for%20the%20condition%20to%20be%20met.%20*%2F%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.conditionSensorReadings(%26amp%3Bsfg)%3B%26nbsp%3B%20%2F%2F%20magCal%20is%20run%20as%20part%20of%20this%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.runFusion(%26amp%3Bsfg)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20Run%20the%20actual%20fusion%20algorithms%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.applyPerturbation(%26amp%3Bsfg)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20apply%20debug%20perturbation%20(testing%20only)%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.loopcounter%2B%2B%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20The%20loop%20counter%20is%20used%20to%20%22serialize%22%20mag%20cal%20operations%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20i%3Di%2B1%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20if%20(i%26gt%3B%3D4)%20%7B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20Some%20status%20codes%20include%20a%20%22blink%22%20feature.%26nbsp%3B%20This%20loop%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20i%3D0%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20should%20cycle%20at%20least%20four%20times%20for%20that%20to%20operate%20correctly.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.updateStatus(%26amp%3Bsfg)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20This%20is%20where%20pending%20status%20updates%20are%20made%20visible%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.queueStatus(%26amp%3Bsfg%2C%20NORMAL)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20assume%20NORMAL%20status%20for%20next%20pass%20through%20the%20loop%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20sfg.pControlSubsystem-%26gt%3Bstream(%26amp%3Bsfg%2C%20sUARTOutputBuffer)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F%2F%20Send%20stream%20data%20to%20the%20Sensor%20Fusion%20Toolbox%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20courier%20new%2Ccourier%3B%20font-size%3A%208pt%3B%22%3E%2F%2F%2F%20%5Cendcode%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1109202%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3ESensorFusion%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
No ratings
Version history
Last update:
‎07-18-2016 03:01 PM
Updated by: