1.1.10.4.15 DRV_USART_WriteBuffer Function
1.1.10.4.15 C
bool DRV_USART_WriteBuffer
(
const DRV_HANDLE handle,
void* buffer,
const size_t size
);1.1.10.4.15 Summary
This is a blocking function that writes data over USART.
1.1.10.4.15 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
1.1.10.4.15 Precondition
DRV_USART_Open must have been called to obtain a valid opened device handle.
1.1.10.4.15 Parameters
| Parameters | 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 |
1.1.10.4.15 Returns
True - Write is successful.
False - Error has occurred.
1.1.10.4.15 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
}1.1.10.4.15 Remarks
This function is thread safe in a RTOS application. This function should not be called from an interrupt context.
