16 #include "fsl_debug_console.h"    19 #include "fsl_usart.h"    35     uint32_t flag = kUSART_TxFifoNotFullFlag & USART_GetStatusFlags(base);
    38         flag = kUSART_TxFifoNotFullFlag & USART_GetStatusFlags(base);
    40     USART_WriteByte(base, data);
    47     for (i = 0; i < nbytes; i++)
    58     static char iCommandBuffer_B[5] = 
"~~~~";   
    61     if ((kUSART_RxFifoNotEmptyFlag | kUSART_RxError) & USART_GetStatusFlags(
WIRED_USART))
    73     usart_config_t config;
    90         RESET_PeripheralReset(kFC0_RST_SHIFT_RSTn);
   100         USART_GetDefaultConfig(&config);
   102         config.enableTx = 
true;
   103         config.enableRx = 
true;
   108         USART_EnableInterrupts(
WIRED_USART, kUSART_RxLevelInterruptEnable | kUSART_RxErrorInterruptEnable);
 quaternion_type DefaultQuaternionPacketType
default quaternion transmitted at power on 
 
void CreateAndSendPackets(SensorFusionGlobals *sfg, uint8_t *sUARTOutputBuffer)
 
volatile uint8_t RPCPacketOn
flag to enable roll, pitch, compass packet 
 
int8_t initializeControlPort(ControlSubsystem *pComm)
Initialize the control subsystem and all related hardware. 
 
#define WIRED_USART_CLK_FREQ
 
volatile uint8_t AngularVelocityPacketOn
flag to enable angular velocity packet 
 
writePort_t * write
low level function to write a char buffer to the serial stream 
 
Defines control sub-system. 
 
The top level fusion structure. 
 
volatile uint8_t DebugPacketOn
flag to enable debug packet 
 
Quaternion derived from 3-axis accel (tilt) 
 
int8_t writeControlPort(ControlSubsystem *pComm, uint8_t buffer[], uint16_t nbytes)
 
volatile quaternion_type QuaternionPacketType
quaternion type transmitted over UART 
 
he ControlSubsystem encapsulates command and data streaming functions. 
 
#define BOARD_DEBUG_UART_BAUDRATE
 
The sensor_fusion.h file implements the top level programming interface. 
 
uint8_t data[FXLS8962_DATA_SIZE]
 
void myUART_WriteByte(USART_Type *base, uint8_t data)
 
volatile uint8_t AltPacketOn
flag to enable altitude packet 
 
#define BOARD_DEBUG_UART_CLK_ATTACH
 
void WIRED_USART_IRQHandler(void)
 
void DecodeCommandBytes(SensorFusionGlobals *sfg, char iCommandBuffer[], uint8 sUART_InputBuffer[], uint16 nbytes)
 
SensorFusionGlobals sfg
This is the primary sensor fusion data structure. 
 
streamData_t * stream
function to create packets for serial stream 
 
volatile int8_t AccelCalPacketOn
variable used to coordinate accelerometer calibration 
 
uint8_t sUARTOutputBuffer[256]
main output buffer defined in control.c