Serial communication (basics)
This file contains the definitions for the basics of weAutSys' serial communication. Please find detailed description of the variables, functions etc. in the modules Serial communication and Serial com. drivers.
This is system software and must not be modified for user or application programs.
This file is part of weAutSys <weinert-automation.de>
Copyright © 2011 Albrecht Weinert, Bochum
Defines | |
#define | B1D6MODE_NONE 0 |
Usage mode of ports PD6 and PB1: none. | |
#define | B1D6MODE_RTSCTS_FLOWC 0x11 |
Usage mode of ports PD6 and PB1: RTS CTS input flow control. | |
#define | B1MODE_MASK 0xF0 |
Usage mask for PB1. | |
#define | B1MODE_RTS_FLOWC 0x10 |
Usage mode of port PB1 : RTS output flow control. | |
#define | D6MODE_CTS_FLOWC 0x01 |
Usage mode of port PD6 : CTS input flow control. | |
#define | D6MODE_MASK 0x0F |
Usage mask for PD6. | |
#define | FROM_BUFFER2UART() |
Driver helper. | |
#define | isCTSflowC |
Usage mode of port PD6 : CTS input flow control. | |
#define | isRTSflowC |
Usage mode of port PB1: RTS output flow control. | |
#define | SER_RECVBUF_EMPTY |
The serial input buffer is empty. | |
#define | SER_RECVBUF_NOT_EMPTY |
The serial input buffer is not empty. | |
#define | SER_SENDBUF_EMPTY |
The serial output buffer is empty. | |
#define | SER_SENDBUF_NOT_EMPTY |
The serial output buffer is not empty. | |
#define | UART_CAN_SEND |
UART (0) can get send data. | |
#define | UART_IN_BUF_CAP 127 |
The maximum capacity of the serial input buffer. | |
#define | UART_IN_SPACE_LIM 11 |
UART space limit for flow control. | |
#define | UART_OUT_BUF_CAP 255 |
The capacity of the serial output buffer. | |
Functions | |
uint8_t | getB1D6mode (void) __attribute__((always_inline)) |
Get the usage of the ports PD6 and PB1. | |
uint16_t | serInBufferd (FILE *streams) |
The number of characters buffered from serial input. | |
void | setB1D6mode (uint8_t mode) |
Set the usage of the ports PD6 and PB1. | |
void | setUARTflowcontrolByChar (char cC) |
Sets UART flow control by (one) character. | |
uint8_t | uartClearInBuffer (void) |
Clear the internal buffer for serial input. | |
uint8_t | uartClearOutBuffer (void) |
Clear the internal buffer for serial output. | |
int | uartGetChar (FILE *stream) |
Get one byte from serial input. | |
uint8_t | uartGetLine (char *line, uint8_t max) |
Read a line from UART. | |
uint8_t | uartInBufferd (void) |
The number of characters buffered from serial input. | |
uint8_t | uartInErrors (void) |
The accumulated serial input (UART0) errors. | |
void | uartInit (uint16_t baudDivide, uint8_t x2, uint8_t len, uint8_t parity, uint8_t stopBits) |
Initialise the serial input (UART0) | |
uint8_t | uartInRetBufferd (void) |
The number of line feeds buffered from serial input. | |
uint8_t | uartOutSpace (void) |
The buffer space available for serial output. | |
uint8_t | uartPutBytes (uint8_t *src, uint8_t n) |
Put some bytes (characters) to serial output. | |
uint8_t | uartPutChars (char *src, uint8_t n) |
Put some characters to serial output. | |
int | uartPutCharsP (char const *src, uint8_t n) |
Put some characters from program space to serial output. | |
uint8_t | uartPutSt (char *src, const FILE *stream) |
Put a RAM string (some characters) to serial output. | |
int | uartPutSt_P (prog_char *src, const FILE *stream) |
Put a string (some characters) from flash memory to serial output. | |
void | uartSetBaudDivide (uint16_t baudDivide) __attribute__((always_inline)) |
Set the UART0's baudrate divisor. | |
Variables | |
uint8_t | uartInAccErrors |
The serial input's accumulated (or) errors. | |
uint8_t | uartInBuf [] |
The serial input buffer. | |
uint8_t | uartInBufRetCnt |
The serial input buffer line feeds code counter. | |
uint8_t | uartInBufRi |
The serial input buffer read/get index. | |
uint8_t | uartInBufWi |
The serial input buffer write/put index. | |
uint8_t | uartOutBuf [] |
The serial output buffer. | |
volatile uint8_t | uartOutBufRi |
The serial output buffer read/get index. | |
volatile uint8_t | uartOutBufWi |
The serial output buffer write/put index. |