Software buffers and interrupt driven tx and rx for Serial. More...
#include <BufferedSerial.h>

Public Member Functions | |
| BufferedSerial (PinName tx, PinName rx, uint32_t buf_size=256, uint32_t tx_multiple=4, const char *name=NULL) | |
| virtual int | getc (void) |
| virtual int | printf (const char *format,...) |
| virtual int | putc (int c) |
| virtual int | puts (const char *s) |
| virtual int | readable (void) |
| virtual ssize_t | write (const void *s, std::size_t length) |
| virtual int | writeable (void) |
| virtual | ~BufferedSerial (void) |
Private Member Functions | |
| void | prime (void) |
| void | rxIrq (void) |
| void | txIrq (void) |
Private Attributes | |
| uint32_t | _buf_size |
| Buffer< char > | _rxbuf |
| uint32_t | _tx_multiple |
| Buffer< char > | _txbuf |
Software buffers and interrupt driven tx and rx for Serial.
A serial port (UART) for communication with other serial devices
Can be used for Full Duplex communication, or Simplex by specifying one pin as NC (Not Connected)
Example:
Definition at line 71 of file BufferedSerial.h.
| BufferedSerial::BufferedSerial | ( | PinName | tx, |
| PinName | rx, | ||
| uint32_t | buf_size = 256, |
||
| uint32_t | tx_multiple = 4, |
||
| const char * | name = NULL |
||
| ) |
Create a BufferedSerial port, connected to the specified transmit and receive pins
| tx | Transmit pin |
| rx | Receive pin |
| buf_size | printf() buffer size |
| tx_multiple | amount of max printf() present in the internal ring buffer at one time |
| name | optional name |
Definition at line 26 of file BufferedSerial.cpp.
|
virtual |
Destroy a BufferedSerial port
Definition at line 35 of file BufferedSerial.cpp.
|
virtual |
Get a single byte from the BufferedSerial Port. Should check readable() before calling this.
Definition at line 53 of file BufferedSerial.cpp.
|
private |
Definition at line 146 of file BufferedSerial.cpp.
|
virtual |
Write a formatted string to the BufferedSerial Port.
| format | The string + format specifiers to write to the Serial Port |
Definition at line 82 of file BufferedSerial.cpp.
|
virtual |
Write a single byte to the BufferedSerial Port.
| c | The byte to write to the Serial Port |
Definition at line 58 of file BufferedSerial.cpp.
|
virtual |
Write a string to the BufferedSerial Port. Must be NULL terminated
| s | The string to write to the Serial Port |
Definition at line 66 of file BufferedSerial.cpp.
|
virtual |
Check on how many bytes are in the rx buffer
Definition at line 43 of file BufferedSerial.cpp.
|
private |
Definition at line 120 of file BufferedSerial.cpp.
|
private |
Definition at line 130 of file BufferedSerial.cpp.
|
virtual |
Write data to the Buffered Serial Port
| s | A pointer to data to send |
| length | The amount of data being pointed to |
Definition at line 103 of file BufferedSerial.cpp.
|
virtual |
Check to see if the tx buffer has room
Definition at line 48 of file BufferedSerial.cpp.
|
private |
Definition at line 76 of file BufferedSerial.h.
|
private |
Definition at line 74 of file BufferedSerial.h.
|
private |
Definition at line 77 of file BufferedSerial.h.
|
private |
Definition at line 75 of file BufferedSerial.h.