An mbed wrapper around the helium-client to communicate with the Helium Atom
BufferedSerial Class Reference
Implements a buffered serial port. More...
#include <BufferedSerial.h>
Public Member Functions | |
BufferedSerial (PinName tx, PinName rx, int baud=MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE) | |
Crete a buffered serial port. | |
~BufferedSerial () | |
Destructor. | |
void | baud (int baud) |
Sets the baud rate for the serial port. | |
int | getc () |
Get a byte from the serial port buffer. | |
int | putc (int ch) |
Write a byte to the serial port. | |
int | readable () |
Check if there are bytes to read. |
Detailed Description
Implements a buffered serial port.
This is a simple buffered serial port to work around `readable` issues on a number of mbed implementations. Receiving on the serial port is buffered through an interrupt handler.
Note that writing is not buffered at this time since writing to the serial port at speed had not been an issue so far.
Definition at line 24 of file BufferedSerial.h.
Constructor & Destructor Documentation
BufferedSerial | ( | PinName | tx, |
PinName | rx, | ||
int | baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE |
||
) |
Crete a buffered serial port.
- Parameters:
-
tx Serial port tx pin to use rx Serial port rx pin to use baud The baud rate to use. Defaults to the default for the current board
Definition at line 8 of file BufferedSerial.cpp.
~BufferedSerial | ( | ) |
Destructor.
Definition at line 18 of file BufferedSerial.cpp.
Member Function Documentation
void baud | ( | int | baud ) |
Sets the baud rate for the serial port.
- Parameters:
-
baud The baud rate to set on the serial port
Definition at line 29 of file BufferedSerial.cpp.
int getc | ( | ) |
Get a byte from the serial port buffer.
- Returns:
- a buffered byte or -1 if no bytes are available
Definition at line 34 of file BufferedSerial.cpp.
int putc | ( | int | ch ) |
Write a byte to the serial port.
- Parameters:
-
ch The byte to write
- Returns:
- the byte that was written
Definition at line 44 of file BufferedSerial.cpp.
int readable | ( | ) |
Check if there are bytes to read.
- Returns:
- 1 if bytes are available, 0 otherwise
Definition at line 51 of file BufferedSerial.cpp.
Generated on Tue Jul 12 2022 12:08:02 by 1.7.2