Arduino Serial Interface. More...
Arduino Serial Interface.
Definition at line 45 of file serialport.hpp.
#include <serialport.hpp>
Public Member Functions | |
SerialPort (uart_t dev) | |
Constructor maps the serial port to a RIOT UART device. More... | |
int | available (void) |
Get the number of bytes (characters) available for reading from the serial port. More... | |
void | begin (long speed) |
Sets the data rate in bits per second (baud) for serial data transmission. More... | |
void | end (void) |
Disables serial communication, allowing the RX and TX pins to be used for general input and output. More... | |
size_t | print (int val) |
Prints data to the serial port as human-readable ASCII text. More... | |
size_t | print (int val, SerialFormat format) |
Prints data to the serial port as human-readable ASCII text. More... | |
size_t | print (unsigned int val) |
Prints data to the serial port as human-readable ASCII text. More... | |
size_t | print (unsigned int val, SerialFormat format) |
Prints data to the serial port as human-readable ASCII text. More... | |
size_t | print (long val) |
Prints data to the serial port as human-readable ASCII text. More... | |
size_t | print (long val, SerialFormat format) |
Prints data to the serial port as human-readable ASCII text. More... | |
size_t | print (unsigned long val) |
Prints data to the serial port as human-readable ASCII text. More... | |
size_t | print (unsigned long val, SerialFormat format) |
Prints data to the serial port as human-readable ASCII text. More... | |
size_t | print (float val) |
Prints data to the serial port as human-readable ASCII text. More... | |
size_t | print (float val, int format) |
Prints data to the serial port as human-readable ASCII text. More... | |
size_t | print (char val) |
Prints data to the serial port as human-readable ASCII text. More... | |
size_t | print (const char *val) |
Prints data to the serial port as human-readable ASCII text. More... | |
size_t | println (int val) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n") More... | |
size_t | println (int val, SerialFormat format) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n") More... | |
size_t | println (unsigned int val) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n") More... | |
size_t | println (unsigned int val, SerialFormat format) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n") More... | |
size_t | println (long val) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n") More... | |
size_t | println (long val, SerialFormat format) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n") More... | |
size_t | println (unsigned long val) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n") More... | |
size_t | println (unsigned long val, SerialFormat format) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n") More... | |
size_t | println (float val) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n") More... | |
size_t | println (float val, int format) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n") More... | |
size_t | println (char val) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n") More... | |
size_t | println (const char *val) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n") More... | |
size_t | println (void) |
Prints a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n") More... | |
int | read (void) |
Reads incoming serial data. More... | |
int | write (int val) |
Writes binary data to the serial port. More... | |
int | write (const char *str) |
Writes binary data to the serial port. More... | |
int | write (char *buf, int len) |
Writes binary data to the serial port. More... | |
|
explicit |
Constructor maps the serial port to a RIOT UART device.
[in] | dev | RIOT UART device |
int SerialPort::available | ( | void | ) |
Get the number of bytes (characters) available for reading from the serial port.
This is data that's already arrived and stored in the serial receive buffer (which holds 64 bytes). available() inherits from the Stream utility class.
Copied from https://www.arduino.cc/en/Serial/Available
void SerialPort::begin | ( | long | speed | ) |
Sets the data rate in bits per second (baud) for serial data transmission.
For communicating with the computer, use one of these rates: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200. You can, however, specify other rates - for example, to communicate over pins 0 and 1 with a component that requires a particular baud rate.
Copied from https://www.arduino.cc/en/Serial/Begin
[in] | speed | speed in bits per second (baud) |
void SerialPort::end | ( | void | ) |
Disables serial communication, allowing the RX and TX pins to be used for general input and output.
To re-enable serial communication, call begin()
Copied from https://www.arduino.cc/en/Serial/End
size_t SerialPort::print | ( | char | val | ) |
Prints data to the serial port as human-readable ASCII text.
[in] | val | the value to print |
size_t SerialPort::print | ( | const char * | val | ) |
Prints data to the serial port as human-readable ASCII text.
[in] | val | the value to print |
size_t SerialPort::print | ( | float | val | ) |
Prints data to the serial port as human-readable ASCII text.
[in] | val | the value to print |
size_t SerialPort::print | ( | float | val, |
int | format | ||
) |
Prints data to the serial port as human-readable ASCII text.
[in] | val | the value to print |
[in] | format | number of decimal places |
size_t SerialPort::print | ( | int | val | ) |
Prints data to the serial port as human-readable ASCII text.
Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers are printed using an ASCII character for each digit. Floats are similarly printed as ASCII digits, defaulting to two decimal places. Bytes are sent as a single character. Characters and strings are sent as is.
Copied from https://www.arduino.cc/en/Serial/Print
[in] | val | the value to print |
size_t SerialPort::print | ( | int | val, |
SerialFormat | format | ||
) |
Prints data to the serial port as human-readable ASCII text.
[in] | val | the value to print |
[in] | format | specifies the number base |
size_t SerialPort::print | ( | long | val | ) |
Prints data to the serial port as human-readable ASCII text.
Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers are printed using an ASCII character for each digit. Floats are similarly printed as ASCII digits, defaulting to two decimal places. Bytes are sent as a single character. Characters and strings are sent as is.
Copied from https://www.arduino.cc/en/Serial/Print
[in] | val | the value to print |
size_t SerialPort::print | ( | long | val, |
SerialFormat | format | ||
) |
Prints data to the serial port as human-readable ASCII text.
[in] | val | the value to print |
[in] | format | specifies the number base |
size_t SerialPort::print | ( | unsigned int | val | ) |
Prints data to the serial port as human-readable ASCII text.
Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers are printed using an ASCII character for each digit. Floats are similarly printed as ASCII digits, defaulting to two decimal places. Bytes are sent as a single character. Characters and strings are sent as is.
Copied from https://www.arduino.cc/en/Serial/Print
[in] | val | the value to print |
size_t SerialPort::print | ( | unsigned int | val, |
SerialFormat | format | ||
) |
Prints data to the serial port as human-readable ASCII text.
[in] | val | the value to print |
[in] | format | specifies the number base |
size_t SerialPort::print | ( | unsigned long | val | ) |
Prints data to the serial port as human-readable ASCII text.
Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers are printed using an ASCII character for each digit. Floats are similarly printed as ASCII digits, defaulting to two decimal places. Bytes are sent as a single character. Characters and strings are sent as is.
Copied from https://www.arduino.cc/en/Serial/Print
[in] | val | the value to print |
size_t SerialPort::print | ( | unsigned long | val, |
SerialFormat | format | ||
) |
Prints data to the serial port as human-readable ASCII text.
[in] | val | the value to print |
[in] | format | specifies the number base |
size_t SerialPort::println | ( | char | val | ) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n")
[in] | val | the value to print |
size_t SerialPort::println | ( | const char * | val | ) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n")
[in] | val | the value to print |
size_t SerialPort::println | ( | float | val | ) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n")
[in] | val | the value to print |
size_t SerialPort::println | ( | float | val, |
int | format | ||
) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n")
[in] | val | the value to print |
[in] | format | number of decimal places |
size_t SerialPort::println | ( | int | val | ) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n")
This command takes the same forms as print().
Copied from https://www.arduino.cc/en/Serial/Println
[in] | val | the value to print |
size_t SerialPort::println | ( | int | val, |
SerialFormat | format | ||
) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n")
[in] | val | the value to print |
[in] | format | specifies the number base |
size_t SerialPort::println | ( | long | val | ) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n")
This command takes the same forms as print().
Copied from https://www.arduino.cc/en/Serial/Println
[in] | val | the value to print |
size_t SerialPort::println | ( | long | val, |
SerialFormat | format | ||
) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n")
[in] | val | the value to print |
[in] | format | specifies the number base |
size_t SerialPort::println | ( | unsigned int | val | ) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n")
This command takes the same forms as print().
Copied from https://www.arduino.cc/en/Serial/Println
[in] | val | the value to print |
size_t SerialPort::println | ( | unsigned int | val, |
SerialFormat | format | ||
) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n")
[in] | val | the value to print |
[in] | format | specifies the number base |
size_t SerialPort::println | ( | unsigned long | val | ) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n")
This command takes the same forms as print().
Copied from https://www.arduino.cc/en/Serial/Println
[in] | val | the value to print |
size_t SerialPort::println | ( | unsigned long | val, |
SerialFormat | format | ||
) |
Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n")
[in] | val | the value to print |
[in] | format | specifies the number base |
size_t SerialPort::println | ( | void | ) |
Prints a carriage return character (ASCII 13, or "\r") and a newline character (ASCII 10, or "\n")
int SerialPort::read | ( | void | ) |
Reads incoming serial data.
Copied from https://www.arduino.cc/en/Serial/Read
int SerialPort::write | ( | char * | buf, |
int | len | ||
) |
Writes binary data to the serial port.
[long description]
[in] | buf | an array to send as a series of bytes |
[in] | len | the length of the buffer |
int SerialPort::write | ( | const char * | str | ) |
Writes binary data to the serial port.
[in] | str | a string to send as a series of bytes |
int SerialPort::write | ( | int | val | ) |
Writes binary data to the serial port.
This data is sent as a byte or series of bytes; to send the characters representing the digits of a number use the print() function instead.
Copied from https://www.arduino.cc/en/Serial/Write
[in] | val | a value to send as a single byte |