Datasheet

Flyport Wi-Fi and Ethernet Programmer's guide framework 2.3 (rev 1.0) www.openpicus.com
UART Functions
First of all you must initiate the UART at a specific baudrate. Then you must enable the UART.
Note: In the IDE wizard, there is the possibility to use the uart 1 as “TCP debug on UART1”. In this
case the UART1 module is initialized at 19200 baud and turned on at startup.
Initialize the UART UARTInit(int port, long int baud);
This is a mandatory function that initializes the module to work properly.
This function is called in the Flyport Framework initialization, but it can be recalled to change the
baudrate parameter at runtime.
Parameters:
port: The UART port to initialize (from 1 to 3)
baud: Desired baudrate
Turn On the UART UARTOn(int port);
This function turns on the UART module functionalities. It should be called only after UARTInit
Parameters:
port: the UART port to turn on
Turn Off the UART UARTOff(int port);
This function turns off the UART module functionalities. It should be called before calling UARTInit.
Parameters:
port: the UART port to turn off
Check the UART input buffer UARTBufferSize(int port);
This function returns an int number equal to how many chars have arrived and are stored inside the
UART RX Buffer.
Parameters:
port: the UART port
Returns:
int N: number of chars inside the buffer
Read the UART input buffer UARTRead(int port, char *towrite,
int count);
This function reads characters from the UART RX buffer and puts them in the char pointer “towrite”.
It also returns the report of the operation.
Parameters:
port: the UART port
towrite: the char pointer to fill with the read characters
count: the number of characters to read
Returns:
int N: N > 0, N characters correctly read.
N < 0, N characters read, but buffer overflow detected.
23