Bosch XDK110 Getting Started page 11

Cross-domain development kit
Hide thumbs Also See for XDK110:
Table of Contents

Advertisement

Extension Bus Advanced Guide | XDK110
Afterwards, the UARTTransceiver can be initialized. Code 7 showcases how.
Code 7. Initializing the UARTTransceiver
enum
UARTTransceiver_UartType_E
uint8_t
rxBuffSize = (MAX_UART_RING_BUFFERSIZE-1);
UARTTransceiver_Initialize(&UartTransceiverInstance, UartHandle, UartRingBuffer,
rxBuffSize, type);
type
First, two variables,
module the UARTTranceiver will take data from or transmit over. Since only UART is currently supported by the
U A R T T r a n s c e i v e r m o d u l e , i t i s s i m p l y s e t t o u s e U A R T b y s e t t i n g i t t o t h e e n u m e r a t i o n
UART_TRANSCEIVER_UART_TYPE_UART
Please note: Currently LEUART is not supported by the UARTTransceiver module.
rxBuffSize
Afterwards, the variable
Both of this variables, as well as the
for the UART module are passed to the function
Now all configuration and initialization for UART are made. Only a few steps are necessary to start the module to receive
and transmit data.
For that, a callback for checking every incoming UART data packet is declared as shown in Code 8.
Code 8. UART data packet frame check callback
static bool
UartFrameEndCheck(uint8_t
BCDS_UNUSED(lastByte);
return
true;
}
The callback simply returns true for every incoming byte. Depending on the application use case, this function can be
adapted to trigger custom events for certain received bytes.
Afterwards, a callback function is declared for the receive and transmit events as shown in Code 9.
Code 9. UART event callback
static void UartTxRxCallbacks(struct
if
(event.RxComplete){
portYIELD_FROM_ISR(pdTRUE);
}
}
Since the UART module is interrupt driven, only a return from the interrupt service routine is required after a bit is received
to inform freeRTOS to continue with the interrupted initial task.

type = UART_TRANSCEIVER_UART_TYPE_UART;
rxBuffSize,
and
are declared for better readability. The variable type represents the UART
.
is set to the maximum length of elements the ring buffer declared in Code 6 can hold.
UartTransceiverInstance
UARTTransceiver_Initialize()
lastByte){
MCU_UART_Event_S
, declared in Code 3 and the obtained hardware handle
, which initializes the UARTTransceiver.
event){
11 24
|

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents