![]() |
xyControl
0.1
Quadrotor Flight Controller on AVR Basis
|
UART Library enabling you to control all available UART Modules. More...
Files | |
| file | serial.h |
| UART Library Header File. | |
| file | serial_device.h |
| UART Library device-specific configuration. | |
| file | serial.c |
| UART Library Implementation. | |
Macros | |
| #define | USB 0 |
| First UART Name. More... | |
| #define | BLUETOOTH 1 |
| Second UART Name. More... | |
| #define | BAUD(baudRate, xtalCpu) ((xtalCpu)/((baudRate)*16l)-1) |
| Calculate Baudrate Register Value. More... | |
| #define | RX_BUFFER_SIZE 32 |
| If you define this, a '\r' (CR) will be put in front of a '\n' (LF) when sending a byte. More... | |
| #define | TX_BUFFER_SIZE 16 |
| TX Buffer Size in Bytes (Power of 2) More... | |
| #define | FLOWCONTROL |
| Defining this enables incoming XON XOFF (sends XOFF if rx buff is full) More... | |
| #define | FLOWMARK 5 |
| Space remaining to trigger xoff/xon. More... | |
| #define | XON 0x11 |
| XON Value. More... | |
| #define | XOFF 0x13 |
| XOFF Value. More... | |
Functions | |
| uint8_t | serialAvailable (void) |
| Get number of available UART modules. More... | |
| void | serialInit (uint8_t uart, uint16_t baud) |
| Initialize the UART Hardware. More... | |
| void | serialClose (uint8_t uart) |
| Stop the UART Hardware. More... | |
| void | setFlow (uint8_t uart, uint8_t on) |
| Manually change the flow control. More... | |
| uint8_t | serialHasChar (uint8_t uart) |
| Check if a byte was received. More... | |
| uint8_t | serialGet (uint8_t uart) |
| Read a single byte. More... | |
| uint8_t | serialGetBlocking (uint8_t uart) |
| Wait until a character is received. More... | |
| uint8_t | serialRxBufferFull (uint8_t uart) |
| Check if the receive buffer is full. More... | |
| uint8_t | serialRxBufferEmpty (uint8_t uart) |
| Check if the receive buffer is empty. More... | |
| void | serialWrite (uint8_t uart, uint8_t data) |
| Send a byte. More... | |
| void | serialWriteString (uint8_t uart, const char *data) |
| Send a string. More... | |
| uint8_t | serialTxBufferFull (uint8_t uart) |
| Check if the transmit buffer is full. More... | |
| uint8_t | serialTxBufferEmpty (uint8_t uart) |
| Check if the transmit buffer is empty. More... | |
UART Library enabling you to control all available UART Modules.
With XON/XOFF Flow Control and buffered Receiving and Transmitting.
| #define BAUD | ( | baudRate, | |
| xtalCpu | |||
| ) | ((xtalCpu)/((baudRate)*16l)-1) |
| #define BLUETOOTH 1 |
| #define FLOWCONTROL |
| #define FLOWMARK 5 |
Space remaining to trigger xoff/xon.
Definition at line 65 of file serial.c.
Referenced by serialGet().
| #define RX_BUFFER_SIZE 32 |
If you define this, a '\r' (CR) will be put in front of a '\n' (LF) when sending a byte.
Binary Communication will then be impossible!RX Buffer Size in Bytes (Power of 2)
Definition at line 55 of file serial.c.
Referenced by serialGet(), and serialRxBufferFull().
| #define TX_BUFFER_SIZE 16 |
TX Buffer Size in Bytes (Power of 2)
Definition at line 59 of file serial.c.
Referenced by serialTxBufferFull(), and serialWrite().
| #define USB 0 |
| #define XON 0x11 |
| uint8_t serialAvailable | ( | void | ) |
Get number of available UART modules.
Definition at line 114 of file serial.c.
Referenced by uartinput(), uartMenuTask(), uartoutput(), and xyInit().
| void serialClose | ( | uint8_t | uart | ) |
Stop the UART Hardware.
| uart | UART Module to stop |
Definition at line 149 of file serial.c.
References serialTxBufferEmpty().
| uint8_t serialGet | ( | uint8_t | uart | ) |
Read a single byte.
| uart | UART Module to read from |
Definition at line 218 of file serial.c.
References FLOWMARK, RX_BUFFER_SIZE, and XON.
Referenced by serialGetBlocking(), uartinput(), and uartMenuTask().
| uint8_t serialGetBlocking | ( | uint8_t | uart | ) |
Wait until a character is received.
| uart | UART Module to read from |
Definition at line 210 of file serial.c.
References serialGet(), and serialHasChar().
| uint8_t serialHasChar | ( | uint8_t | uart | ) |
Check if a byte was received.
| uart | UART Module to check |
Definition at line 199 of file serial.c.
Referenced by serialGetBlocking(), uartinput(), and uartMenuTask().
| void serialInit | ( | uint8_t | uart, |
| uint16_t | baud | ||
| ) |
Initialize the UART Hardware.
| uart | UART Module to initialize |
| baud | Baudrate. Use the BAUD() macro! |
Definition at line 118 of file serial.c.
Referenced by xyInit().
| uint8_t serialRxBufferEmpty | ( | uint8_t | uart | ) |
| uint8_t serialRxBufferFull | ( | uint8_t | uart | ) |
Check if the receive buffer is full.
| uart | UART Module to check |
Definition at line 252 of file serial.c.
References RX_BUFFER_SIZE.
| uint8_t serialTxBufferEmpty | ( | uint8_t | uart | ) |
Check if the transmit buffer is empty.
| uart | UART Module to check |
Definition at line 318 of file serial.c.
Referenced by serialClose().
| uint8_t serialTxBufferFull | ( | uint8_t | uart | ) |
Check if the transmit buffer is full.
| uart | UART Module to check |
Definition at line 311 of file serial.c.
References TX_BUFFER_SIZE.
Referenced by serialWrite().
| void serialWrite | ( | uint8_t | uart, |
| uint8_t | data | ||
| ) |
Send a byte.
| uart | UART Module to write to |
| data | Byte to send |
Definition at line 274 of file serial.c.
References serialTxBufferFull(), and TX_BUFFER_SIZE.
Referenced by serialWriteString(), and uartoutput().
| void serialWriteString | ( | uint8_t | uart, |
| const char * | data | ||
| ) |
Send a string.
| uart | UART Module to write to |
| data | Null-Terminated String |
Definition at line 298 of file serial.c.
References serialWrite().
1.8.3.1