![]() |
ISSDK
1.8
IoT Sensing Software Development Kit
|
Defines control sub-system. More...
Go to the source code of this file.
Data Structures | |
struct | ControlSubsystem |
he ControlSubsystem encapsulates command and data streaming functions. More... | |
Typedefs | |
typedef struct ControlSubsystem | ControlSubsystem |
he ControlSubsystem encapsulates command and data streaming functions. More... | |
Control Port Function Type Definitions | |
The "write" and "stream" commands provide two control functions visible at the main() level. These typedefs define the structure of those two calls. | |
typedef int8_t() | writePort_t(struct ControlSubsystem *pComm, uint8_t buffer[], uint16_t nbytes) |
typedef void() | streamData_t(SensorFusionGlobals *sfg, uint8_t *sUARTOutputBuffer) |
Functions | |
int8_t | initializeControlPort (ControlSubsystem *pComm) |
Call this once to initialize structures, ports, etc. More... | |
void | CreateAndSendPackets (SensorFusionGlobals *sfg, uint8_t *sUARTOutputBuffer) |
void | DecodeCommandBytes (SensorFusionGlobals *sfg, char iCommandBuffer[], uint8 sUART_InputBuffer[], uint16 nbytes) |
void | BlueRadios_Init (void) |
void | sBufAppendItem (uint8_t *pDest, uint16_t *pIndex, uint8_t *pSource, uint16_t iBytesToCopy) |
Utility function used to place data in output buffer about to be transmitted via UART. More... | |
Variables | |
uint8_t | sUARTOutputBuffer [256] |
main output buffer defined in control.c More... | |
Defines control sub-system.
Each sensor fusion application will probably have its own set of functions to control the fusion process and report results. This file defines the programming interface that should be followed in order for the fusion functions to operate correctly out of the box. The actual command interpreter is defined separately in DecodeCommandBytes.c. The output streaming function is defined in output_stream.c. Via these three files, the NXP Sensor Fusion Library provides a default set of functions which are compatible with the Sensor Fusion Toolbox. Use of the toolbox is highly recommended at least during initial development, as it provides many useful debug features. The NXP development team will typically require use of the toolbox as a pre-requisite for providing software support.
Definition in file control.h.
typedef struct ControlSubsystem ControlSubsystem |
he ControlSubsystem encapsulates command and data streaming functions.
The ControlSubsystem encapsulates command and data streaming functions for the library. A C++-like typedef structure which includes executable methods for the subsystem is defined here.
typedef void() streamData_t(SensorFusionGlobals *sfg, uint8_t *sUARTOutputBuffer) |
typedef int8_t() writePort_t(struct ControlSubsystem *pComm, uint8_t buffer[], uint16_t nbytes) |
void BlueRadios_Init | ( | void | ) |
Used to initialize the Blue Radios Bluetooth module found on the FRDM-FXS-MULT2-B sensor shield from NXP.
Definition at line 110 of file control.c.
References sUARTOutputBuffer, writeControlPort(), and writeWirelessPort().
Referenced by initializeControlPort().
void CreateAndSendPackets | ( | SensorFusionGlobals * | sfg, |
uint8_t * | sUARTOutputBuffer | ||
) |
Called once per fusion cycle to stream information required by the NXP Sensor Fusion Toolbox. Packet protocols are defined in the NXP Sensor Fusion for Kinetis Product Development Kit User Guide.
Definition at line 122 of file output_stream.c.
References ControlSubsystem::AccelCalPacketOn, ControlSubsystem::AltPacketOn, ControlSubsystem::AngularVelocityPacketOn, CHX, CHY, CHZ, ControlSubsystem::DebugPacketOn, F_1DOF_P_BASIC, F_3DOF_B_BASIC, F_3DOF_G_BASIC, F_3DOF_Y_BASIC, F_6DOF_GB_BASIC, F_6DOF_GY_KALMAN, F_9DOF_GBY_KALMAN, F_USING_ACCEL, F_USING_GYRO, F_USING_MAG, MagCalibration::fB, MagCalibration::fFitErrorpc, MagCalibration::finvW, FUSION_HZ, MagCalibration::fV, MagSensor::iBc, MagBuffer::iBs, MagSensor::iCountsPeruT, SensorFusionGlobals::iFlags, MagBuffer::iMagBufferCount, MagBuffer::index, int32_t(), SensorFusionGlobals::Mag, SensorFusionGlobals::MagBuffer, MAGBUFFSIZEX, MAGBUFFSIZEY, SensorFusionGlobals::MagCal, MAX_ACCEL_CAL_ORIENTATIONS, SensorFusionGlobals::pControlSubsystem, Quaternion::q0, Quaternion::q1, Quaternion::q2, Quaternion::q3, Q3, Q3G, Q3M, Q6AG, Q6MA, Q9, ControlSubsystem::QuaternionPacketType, readCommon(), ControlSubsystem::RPCPacketOn, sBufAppendItem(), sBufAppendZeros(), THIS_BOARD, THIS_SHIELD, THISBUILD, throttle(), and ControlSubsystem::write.
Referenced by initializeControlPort().
void DecodeCommandBytes | ( | SensorFusionGlobals * | sfg, |
char | iCommandBuffer[], | ||
uint8 | sUART_InputBuffer[], | ||
uint16 | nbytes | ||
) |
This function is responsible for decoding commands sent by the NXP Sensor Fusion Toolbox and setting the appropriate flags in the ControlSubsystem data structure. Packet protocols are defined in the NXP Sensor Fusion for Kinetis Product Development Kit User Guide.
Definition at line 68 of file DecodeCommandBytes.c.
References ACCEL_CAL_AVERAGING_SECS, ControlSubsystem::AccelCalPacketOn, ControlSubsystem::AltPacketOn, ControlSubsystem::AngularVelocityPacketOn, CHX, CHZ, cmd_180X, cmd_180Y, cmd_180Z, cmd_ALTminus, cmd_ALTplus, cmd_DBminus, cmd_DBplus, cmd_ERAC, cmd_ERGC, cmd_ERMC, cmd_ERYC, cmd_M90X, cmd_M90Y, cmd_M90Z, cmd_P90X, cmd_P90Y, cmd_P90Z, cmd_PA00, cmd_PA01, cmd_PA02, cmd_PA03, cmd_PA04, cmd_PA05, cmd_PA06, cmd_PA07, cmd_PA08, cmd_PA09, cmd_PA10, cmd_PA11, cmd_Q3, cmd_Q3G, cmd_Q3M, cmd_Q6AG, cmd_Q6MA, cmd_Q9, cmd_RINS, cmd_RPCminus, cmd_RPCplus, cmd_RST, cmd_SVAC, cmd_SVGC, cmd_SVMC, cmd_SVYC, cmd_VGminus, cmd_VGplus, ControlSubsystem::DebugPacketOn, EraseAccelCalibrationFromNVM(), EraseGyroCalibrationFromNVM(), EraseMagCalibrationFromNVM(), fInitializeAccelCalibration(), fInitializeFusion(), fInitializeMagCalibration(), FUSION_HZ, SensorFusionGlobals::iPerturbation, SensorFusionGlobals::MagBuffer, SensorFusionGlobals::MagCal, SensorFusionGlobals::pControlSubsystem, Q3, Q3G, Q3M, Q6AG, Q6MA, Q9, ControlSubsystem::QuaternionPacketType, ControlSubsystem::RPCPacketOn, SaveAccelCalibrationToNVM(), SaveGyroCalibrationToNVM(), and SaveMagCalibrationToNVM().
Referenced by CONTROL_UART_IRQHandler(), WIRED_UART_IRQHandler(), WIRED_USART_IRQHandler(), and WIRELESS_UART_IRQHandler().
int8_t initializeControlPort | ( | ControlSubsystem * | pComm | ) |
Call this once to initialize structures, ports, etc.
Call this once to initialize structures, ports, etc.
pComm | pointer to the control subystem structure |
Definition at line 160 of file control.c.
References ControlSubsystem::AccelCalPacketOn, ControlSubsystem::AltPacketOn, ControlSubsystem::AngularVelocityPacketOn, BlueRadios_Init(), BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_CLK_ATTACH, CONTROL_BAUDRATE, CONTROL_UART, CONTROL_UART_CLKSRC, CONTROL_UART_IRQn, CONTROL_UART_MUX, CONTROL_UART_PORT, CONTROL_UART_PORT_CLKEN, CONTROL_UART_RX_PIN, CONTROL_UART_TX_PIN, CreateAndSendPackets(), ControlSubsystem::DebugPacketOn, ControlSubsystem::DefaultQuaternionPacketType, Q3, ControlSubsystem::QuaternionPacketType, ControlSubsystem::RPCPacketOn, ControlSubsystem::stream, WIRED_UART, WIRED_UART_CLKSRC, WIRED_UART_IRQn, WIRED_UART_MUX, WIRED_UART_PORT, WIRED_UART_PORT_CLKEN, WIRED_UART_RX_PIN, WIRED_UART_TX_PIN, WIRED_USART, WIRED_USART_CLK_FREQ, WIRED_USART_IRQn, WIRELESS_UART, WIRELESS_UART_CLKSRC, WIRELESS_UART_IRQn, WIRELESS_UART_MUX, WIRELESS_UART_PORT, WIRELESS_UART_PORT_CLKEN, WIRELESS_UART_RX_PIN, WIRELESS_UART_TX_PIN, ControlSubsystem::write, and writeControlPort().
Referenced by main().
void sBufAppendItem | ( | uint8_t * | pDest, |
uint16_t * | pIndex, | ||
uint8_t * | pSource, | ||
uint16_t | iBytesToCopy | ||
) |
Utility function used to place data in output buffer about to be transmitted via UART.
Definition at line 37 of file output_stream.c.
Referenced by appendZerosOrientBuf(), CreateAndSendPackets(), and sBufAppendZeros().
uint8_t sUARTOutputBuffer[256] |
main output buffer defined in control.c
Definition at line 37 of file control.c.
Referenced by BlueRadios_Init(), and main().