16 #include "fsl_debug_console.h" 24 #ifndef F_USE_WIRELESS_UART 25 #define F_USE_WIRELESS_UART 0x0001 27 #ifndef F_USE_WIRED_UART 28 #define F_USE_WIRED_UART 0x0002 31 #define CONTROL_BAUDRATE 115200 51 flag = base->S1 & 0x80;
53 UART_WriteByte(base, data);
60 for (i = 0; i < nbytes; i++)
65 #if F_USE_WIRELESS_UART 73 #if F_USE_WIRELESS_UART 80 for (i = 0; i < nbytes; i++)
94 static char iCommandBuffer_B[5] =
"~~~~";
98 if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & flags)
101 if (sts == kStatus_Success)
120 ilen = strlen((
char *)sUARTOutputBuffer);
130 if (kUART_TxDataRegEmptyFlag & UART_GetStatusFlags(
WIRED_UART))
142 static char iCommandBuffer_A[5] =
"~~~~";
147 if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & flags)
150 if (sts == kStatus_Success)
164 uart_config_t config;
182 UART_GetDefaultConfig(&config);
185 config.enableTx =
true;
186 config.enableRx =
true;
187 config.rxFifoWatermark = 1;
191 UART_EnableInterrupts(
WIRED_UART, kUART_RxDataRegFullInterruptEnable |
192 kUART_RxOverrunInterruptEnable);
195 #if F_USE_WIRELESS_UART 207 UART_EnableInterrupts(
WIRELESS_UART, kUART_RxDataRegFullInterruptEnable |
208 kUART_RxOverrunInterruptEnable);
quaternion_type DefaultQuaternionPacketType
default quaternion transmitted at power on
void CreateAndSendPackets(SensorFusionGlobals *sfg, uint8_t *sUARTOutputBuffer)
uart_handle_t wireless_uartHandle
volatile uint8_t RPCPacketOn
flag to enable roll, pitch, compass packet
uart_handle_t wired_uartHandle
int8_t writeWirelessPort(uint8_t buffer[], uint16_t nbytes)
#define WIRED_UART_PORT
KDSK handle for the pin port associated with this UART.
void WIRED_UART_IRQHandler(void)
void myUART_WriteByte(UART_Type *base, uint8_t data)
#define WIRED_UART_IRQn
The interrupt number associated with this IRQ.
volatile uint8_t AngularVelocityPacketOn
flag to enable angular velocity packet
#define CONTROL_BAUDRATE
Baudrate to be used for serial communications.
#define WIRED_UART_CLKSRC
KSDK instance name for the clock feeding this module.
writePort_t * write
low level function to write a char buffer to the serial stream
#define WIRELESS_UART_TX_PIN
The port number associated with TX.
Defines control sub-system.
The top level fusion structure.
volatile uint8_t DebugPacketOn
flag to enable debug packet
Receiving commands over wireless interface (momentary)
Quaternion derived from 3-axis accel (tilt)
void WIRELESS_UART_IRQHandler(void)
volatile quaternion_type QuaternionPacketType
quaternion type transmitted over UART
he ControlSubsystem encapsulates command and data streaming functions.
#define WIRED_UART
KSDK instance name for the debug UART.
#define WIRELESS_UART_RX_PIN
The port number associated with RX.
#define WIRELESS_UART
KSDK instance name for the debug UART.
int8_t writeControlPort(ControlSubsystem *pComm, uint8_t buffer[], uint16_t nbytes)
The sensor_fusion.h file implements the top level programming interface.
uint8_t data[FXLS8962_DATA_SIZE]
#define WIRED_UART_RX_PIN
The port number associated with RX.
#define WIRELESS_UART_PORT
KDSK handle for the pin port associated with this UART.
setStatus_t * setStatus
change status indicator immediately
volatile uint8_t AltPacketOn
flag to enable altitude packet
#define WIRED_UART_MUX
If Using Orient App then use Host I/O.
SensorFusionGlobals sfg
This is the primary sensor fusion data structure.
#define WIRED_UART_TX_PIN
The port number associated with TX.
uint8_t sUARTOutputBuffer[256]
main output buffer defined in control.c
Receiving commands over wired interface (momentary)
#define WIRELESS_UART_CLKSRC
KSDK instance name for the clock feeding this module.
int8_t initializeControlPort(ControlSubsystem *pComm)
Initialize the control subsystem and all related hardware.
#define WIRELESS_UART_MUX
KDSK pin mux selector.
#define WIRELESS_UART_PORT_CLKEN
KDSK handle for the pin port clock enable.
void DecodeCommandBytes(SensorFusionGlobals *sfg, char iCommandBuffer[], uint8 sUART_InputBuffer[], uint16 nbytes)
#define WIRELESS_UART_IRQn
The interrupt number associated with this IRQ.
streamData_t * stream
function to create packets for serial stream
void BlueRadios_Init(void)
#define WIRED_UART_PORT_CLKEN
KDSK handle for the pin port clock enable.
volatile int8_t AccelCalPacketOn
variable used to coordinate accelerometer calibration