Bosch XDK110 Getting Started page 10

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

Advertisement

Extension Bus Advanced Guide | XDK110
Now, a callback function with the type and parameter signature as shown in Code 4 needs to be declared.
Code 4. Callback function for MCU_UART_Initialize()
void
UartDriverCallBack(UART_T
if
(UartTransceiverInstance.handle == uart){
UARTTransceiver_LoopCallback(&UartTransceiverInstance, event);
}
}
This function invokes the UART receive and transmit event by passing it to the
UARTTransceiver_LoopCallback()
function.
module or sends the next UART data packet over it.
Afterwards, the UART driver API can be initialized. Code 5 shows how this is done.
Code 5. Initializing the UART driver API
HWHandle_T
UartHandle = BSP_ExtensionPort_GetUartHandle();
MCU_UART_Initialize(UartHandle, UartDriverCallBack);
Before the initialization function
in Code 2 needs to be obtained by calling the function
HWHandle_T
of the type
. Then the function
declared in Code 4 UART handle.
Now that the configuration on the UART hardware level is completed and the driver API is initialized, the utility API for the
UARTTransceiver can be initialized.
For that, preparation as shown in Code 6 needs to be done.
Code 6. Preparation for UARTTransceiver
#define
MAX_UART_RING_BUFFERSIZE
static
uint8_t
UartRingBuffer[MAX_UART_RING_BUFFERSIZE];
For using the UARTTransceiver a static buffer needs to be declared. This buffer called
ring buffer for the UART module and temporarily store the received UART data packets. After it is created, it is
recommended to leave it as it is and to do no further operation with it in other code snippets as the proposed ones.

uart,
struct
takes the triggered events and reads for example data from the UART
MCU_UART_Initialize()
BSP_ExtensionPort_GetUartHandle()
MCU_UART_Initialize()
UINT32_C(45)
MCU_UART_Event_S
event){
can be called, the hardware handle with the configurations made
can be called by passing the callback function
UARTTransceiver_LoopCallback()
and passed into a variable
UartRingBuffer
will be used as a
10 24
|

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents