PicoWAN SDK Documentation
Functions
usart.h File Reference

UART/USART driver. More...

#include <stdint.h>
#include <arch.h>

Go to the source code of this file.

Functions

void usart_putc (usart_port_t usart, uint8_t c)
 Writes a byte to a given USART port (blocking). More...
 
uint8_t usart_getc (usart_port_t usart)
 Reads a byte from a given USART port (blocking). More...
 
void usart_init (usart_port_t usart, uint32_t baudrate)
 Initializes a given USART (RX disabled by default). More...
 
void usart_deinit (usart_port_t usart)
 De-initializes a given USART. More...
 
void usart_enable_rx (usart_port_t usart, void(*irq_cb)(void))
 Enables the reception of data (RX). More...
 
void usart_disable_rx (usart_port_t usart)
 Disables the reception of data (RX). More...
 
void usart_sync (usart_port_t usart)
 Synchronizes a given USART. More...
 
uint8_t usart_is_rx_not_empty (usart_port_t usart)
 Checks is some data are available to read. More...
 

Detailed Description

UART/USART driver.

Copyright (c) 2018, Archos S.A. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND AND EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARCHOS S.A. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

void usart_deinit ( usart_port_t  usart)

De-initializes a given USART.

Parameters
usartThe USART port number (USART_PORT_n).
void usart_disable_rx ( usart_port_t  usart)

Disables the reception of data (RX).

Parameters
usartThe USART port number (USART_PORT_n).
void usart_enable_rx ( usart_port_t  usart,
void(*)(void)  irq_cb 
)

Enables the reception of data (RX).

Parameters
usartThe USART port number (USART_PORT_n).
irq_cbThe callback that will be executed in IRQ context when data will be available.
uint8_t usart_getc ( usart_port_t  usart)

Reads a byte from a given USART port (blocking).

Parameters
usartThe USART port number (USART_PORT_n).
Return values
uint8_tThe byte read.
void usart_init ( usart_port_t  usart,
uint32_t  baudrate 
)

Initializes a given USART (RX disabled by default).

Parameters
usartThe USART port number (USART_PORT_n).
baudrateThe requested baud-rate in bps.
uint8_t usart_is_rx_not_empty ( usart_port_t  usart)

Checks is some data are available to read.

Parameters
usartThe USART port number (USART_PORT_n).
Return values
uint8_t1 if some data are available, 0 otherwise.
void usart_putc ( usart_port_t  usart,
uint8_t  c 
)

Writes a byte to a given USART port (blocking).

Parameters
usartThe USART port number (USART_PORT_n).
cThe byte to write.
void usart_sync ( usart_port_t  usart)

Synchronizes a given USART.

This function waits until the ongoing transmission in finished.

Parameters
usartThe USART port number (USART_PORT_n).