SerialPort Class Class that provides the functionality of arduino Serial library
Definition at line 31 of file SerialPort.h.
#include <SerialPort.h>
|
| SerialPort (const char *port, bool isPty=false) |
| SerialPort constructor.
|
|
void | begin (int bauds) |
| Open the serial port and set the data rate in bits per second (baud). More...
|
|
bool | open (int bauds=115200) |
| Open the serial port and set the data rate in bits per second (baud). More...
|
|
bool | setGroupPerm (const char *groupName) |
| Grant access to the specified system group for the serial device. More...
|
|
int | available () |
| Get the number of bytes available. More...
|
|
int | read () |
| Reads 1 byte of incoming serial data. More...
|
|
size_t | write (uint8_t b) |
| Writes a single byte to the serial port. More...
|
|
size_t | write (const uint8_t *buffer, size_t size) |
| Writes binary data to the serial port. More...
|
|
int | peek () |
| Returns the next byte (character) of incoming serial data without removing it from the internal serial buffer. More...
|
|
void | flush () |
| Remove any data remaining on the serial buffer.
|
|
void | end () |
| Disables serial communication.
|
|
◆ available()
int SerialPort::available |
( |
| ) |
|
Get the number of bytes available.
Get the numberof bytes (characters) available for reading from the serial port.
- Returns
- number of bytes avalable to read.
◆ begin()
void SerialPort::begin |
( |
int |
bauds | ) |
|
Open the serial port and set the data rate in bits per second (baud).
This function will terminate the program on an error.
- Parameters
-
◆ open()
bool SerialPort::open |
( |
int |
bauds = 115200 | ) |
|
Open the serial port and set the data rate in bits per second (baud).
- Parameters
-
- Returns
true
if no errors, else false
.
◆ peek()
Returns the next byte (character) of incoming serial data without removing it from the internal serial buffer.
- Returns
- -1 if no data else character in the buffer.
◆ read()
Reads 1 byte of incoming serial data.
- Returns
- first byte of incoming serial data available.
◆ setGroupPerm()
bool SerialPort::setGroupPerm |
( |
const char * |
groupName | ) |
|
Grant access to the specified system group for the serial device.
- Parameters
-
groupName | system group name. |
◆ write() [1/2]
size_t SerialPort::write |
( |
const uint8_t * |
buffer, |
|
|
size_t |
size |
|
) |
| |
Writes binary data to the serial port.
- Parameters
-
buffer | to write. |
size | of the buffer. |
- Returns
- number of bytes written.
◆ write() [2/2]
size_t SerialPort::write |
( |
uint8_t |
b | ) |
|
Writes a single byte to the serial port.
- Parameters
-
- Returns
- number of bytes written.
The documentation for this class was generated from the following file: