1.1.9.4.15 DRV_USART_WriteBuffer Function
C
bool DRV_USART_WriteBuffer
(
const DRV_HANDLE handle,
void* buffer,
const size_t size
);Summary
This is a blocking function that writes data over USART.
Description
This function does a blocking write operation. The function blocks till the data write is complete. Function will return false to report failure. The failure will occur for the following reasons:
- if the handle is invalid
- if the input buffer pointer is NULL
- if the buffer size is 0
Precondition
DRV_USART_Open must have been called to obtain a valid opened device handle.
Parameters
| Param | Description |
|---|---|
| handle | Handle of the communication channel as return by the DRV_USART_Open function. |
| buffer | Pointer to the data to be transmitted. |
| size | Buffer size in bytes. |
Returns
true - write is successful
false - error has occurred
Example
MY_APP_OBJ myAppObj;
uint8_t myBuffer[MY_BUFFER_SIZE];
// myUSARTHandle is the handle returned
// by the DRV_USART_Open function.
if (DRV_USART_WriteBuffer(myUSARTHandle, myBuffer, MY_BUFFER_SIZE) == false)
{
// Error handling here
}Remarks
This function is thread safe in a RTOS application. This function should not be called from an interrupt context.
