Microchip® Advanced Software Framework

serial_bridge_wilc3000_example/uart_stream.c File Reference

Configurations for the WILC3000 Serial Bridge Application.

Copyright (c) 2018 Microchip Technology Inc. and its subsidiaries.

#include "uart_stream.h"
#include <string.h>

Functions

void configure_usart (uint32_t baudrate)
 Initialize USART module. More...
 
void usart_stream_move (uint32_t offset)
 Move back USART buffer. More...
 
int usart_stream_read (uint8_t **data, uint32_t *size)
 Read data from USART module. More...
 
void usart_stream_reset (void)
 Clear USART buffer and flush USART module. More...
 
void usart_stream_write (uint8_t data)
 Write one byte of data. More...
 
void usart_stream_write_buffer (uint8_t *data, uint32_t size)
 Write multiple bytes of data. More...
 

Variables

static uint8_t usart_buffer [USART_BUFFER_MAX]
 
static uint32_t usart_recv_size = 0
 

void configure_usart ( uint32_t  baud_rate)

Initialize USART module.

Parameters
baud_rateBaudrate of USART.

References uart_rs232_options::baudrate, usart_serial_init(), and usart_stream_reset().

void usart_stream_move ( uint32_t  offset)

Move back USART buffer.

Parameters
offsetSize of data to remove.

References usart_buffer, and usart_recv_size.

int usart_stream_read ( uint8_t **  data,
uint32_t *  size 
)

Read data from USART module.

Parameters
dataPointer to USART buffer.
dataPointer to USART buffer size.

References uart_read(), usart_buffer, usart_read(), and usart_recv_size.

void usart_stream_reset ( void  )

Clear USART buffer and flush USART module.

References uart_enable(), uart_reset(), usart_enable_rx(), usart_recv_size, and usart_reset_rx().

void usart_stream_write ( uint8_t  data)

Write one byte of data.

Parameters
dataData to send.

References uart_is_tx_buf_empty(), usart_is_tx_empty(), and usart_serial_putchar().

void usart_stream_write_buffer ( uint8_t *  data,
uint32_t  size 
)

Write multiple bytes of data.

Parameters
dataPointer to data to send.
sizeSize of data.

References usart_serial_putchar().

uint8_t usart_buffer[USART_BUFFER_MAX]
static
uint32_t usart_recv_size = 0
static