Defines a driver to facilitate interfacing with the UART hardware to send and receive bytes or a stream of bytes over the UART hardware.
More...
Defines a driver to facilitate interfacing with the UART hardware to send and receive bytes or a stream of bytes over the UART hardware.
Typical use-cases involve printing messages over UART/RS-232, or to communicate with peripheral devices.
Example Usage:
void testPUARTDriver(void)
{
uint8_t readbyte;
uint8_t loopCtrl = 1;
char printBuffer[50];
while(loopCtrl)
{
{
if(readbyte == 'S')
{
sprintf(printBuffer, "\nThis message sprintf'ed here.");
}
if(readbyte == 'E')
{
loopCtrl = 0;
}
}
}
}
wiced_bool_t wiced_hal_puart_configuration |
( |
uint32_t |
baudrate, |
|
|
parity_t |
parity, |
|
|
stop_bit_t |
stop_bit |
|
) |
| |
updates the parity and stop bits as per received value
- Parameters
-
baudrate | - Desired rate in symbols/sec ex. 9600 |
parity | - PARITY_ODD for odd parity, PARITY_EVEN for even parity, PARITY_NONE for no parity. |
stop_bit | - STOP_BIT_1 for 1 stop bit, STOP_BIT_2 for 2 stop bits. |
- Returns
- wiced_bool_t - WICED_TRUE if the configuration was successfully set, otherwise WICED_FALSE. NOTE: For baudrate greater than 2.727272 Mb/sec use of 2 stop bits is mandatory due to hardware limitation.
void wiced_hal_puart_disable_tx |
( |
void |
| ) |
|
Disable transmit capability.
- Parameters
-
- Returns
- none
void wiced_hal_puart_enable_rx |
( |
void |
| ) |
|
Enable receive capability (specifically, by enabling PUART RX interrupts through the MIA driver).
- Parameters
-
- Returns
- none
void wiced_hal_puart_enable_tx |
( |
void |
| ) |
|
Enable transmit capability.
- Parameters
-
- Returns
- none
void wiced_hal_puart_flow_off |
( |
void |
| ) |
|
Disable flow control.
- Parameters
-
- Returns
- none
void wiced_hal_puart_flow_on |
( |
void |
| ) |
|
Enable flow control.
- Parameters
-
- Returns
- none
void wiced_hal_puart_init |
( |
void |
| ) |
|
Initialize the Peripheral UART interface with the default configuration parameters.
This must be invoked once at boot before using any of PUART's services.
Default baud rate is 115200 Bd. This can be changed by calling "wiced_hal_puart_configuration()" as described later, after this initialization function.
- Parameters
-
- Returns
- none
void wiced_hal_puart_print |
( |
char * |
string | ) |
|
Print/send a string of characters via the TX line.
- Parameters
-
string | - A string of characters to send. |
- Returns
- none
wiced_bool_t wiced_hal_puart_read |
( |
uint8_t * |
rxByte | ) |
|
Read one byte via the RX line.
- Parameters
-
rxByte | - Destination byte to hold received data byte from RX FIFO. |
- Returns
- TRUE if data was successfully read, FALSE if not (RX FIFO was empty).
void wiced_hal_puart_register_interrupt |
( |
void(*)(void *) |
puart_rx_cbk | ) |
|
Register Interrupt handler with PUART.
- Parameters
-
puart_rx_cbk | - Call back function to process rx bytes |
- Returns
- none
void wiced_hal_puart_reset_puart_interrupt |
( |
void |
| ) |
|
Clears and enables PUART interrupt.
- Parameters
-
- Returns
- none
wiced_bool_t wiced_hal_puart_rx_fifo_not_empty |
( |
void |
| ) |
|
Check to see if there is any data ready in the RX FIFO.
- Parameters
-
- Returns
- TRUE if bytes are avaliable, FALSE if the FIFO is empty.
wiced_bool_t wiced_hal_puart_select_uart_pads |
( |
uint8_t |
rxdPin, |
|
|
uint8_t |
txdPin, |
|
|
uint8_t |
ctsPin, |
|
|
uint8_t |
rtsPin |
|
) |
| |
Select the TX/RX and optional CTS/RTS pins (P<pin>) for the UART hardware to use.
Please follow the guidelines set in the User Documentation when selecting pins, as not all pins are avaliable for the PUART driver; they depend on the specific hardware platform.
Remember that P# is the physical pin number on the board minus 1. Ex: Board Pin 33 = P32.
- Parameters
-
rxdPin | - RX Pin |
txdPin | - TX Pin |
ctsPin | - CTS Pin |
rtsPin | - RTS Pin |
- Returns
- TRUE if pads were successfully set, FALSE if pads were not set. If FALSE, make sure input port/pin parameters are correct.
void wiced_hal_puart_set_baudrate |
( |
uint32_t |
baudrate | ) |
|
Set the baud rate (Bd) to a value other than the default 115200 Bd.
- Parameters
-
baudrate | - Desired rate in symbols per second, e.g. 9600. |
- Returns
- none
void wiced_hal_puart_set_watermark_level |
( |
uint32_t |
watermark_level | ) |
|
updates the watermark level to the received value
- Parameters
-
watermark_level | - watermark level in bytes |
- Returns
- none
void wiced_hal_puart_synchronous_read |
( |
uint8_t * |
buffer, |
|
|
uint32_t |
length |
|
) |
| |
Read in a set of bytes sequentially.
- Parameters
-
buffer | - Destination buffer to hold incoming bytes. |
length | - Number of bytes to read from the RX FIFO. |
- Returns
- none
void wiced_hal_puart_synchronous_write |
( |
uint8_t * |
buffer, |
|
|
uint32_t |
length |
|
) |
| |
Write a set of bytes sequentially.
- Parameters
-
buffer | - Source buffer to hold outgoing bytes. |
length | - Number of bytes to write to the TX FIFO. |
- Returns
- none
void wiced_hal_puart_write |
( |
uint8_t |
byte | ) |
|
Print/send one byte via the TX line.
- Parameters
-
byte | - Byte to send on the TX line. |
- Returns
- none