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