Mbed OS Reference
|
Data Structures | |
class | UnbufferedSerial |
Class implementation for unbuffered I/O for an interrupt driven application or one that needs to have more control. More... | |
Functions | |
UnbufferedSerial (PinName tx, PinName rx, int baud=MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE) | |
Create a serial port instance connected to the specified transmit and receive pins, with the specified baud rate. More... | |
UnbufferedSerial (const serial_pinmap_t &static_pinmap, int baud=MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE) | |
Create a UnbufferedSerial port, connected to the specified transmit and receive pins, with a particular baud rate. More... | |
ssize_t | write (const void *buffer, size_t size) override |
Write the contents of a buffer to a file. More... | |
ssize_t | read (void *buffer, size_t size) override |
Read the contents of a file into a buffer. More... | |
off_t | seek (off_t offset, int whence=SEEK_SET) override |
Move the file position to a given offset from from a given location. More... | |
off_t | size () override |
Get the size of the file. More... | |
int | isatty () override |
Check if the file in an interactive terminal device. More... | |
int | close () override |
Close a file. More... | |
int | enable_input (bool enabled) override |
Enable or disable input. More... | |
int | enable_output (bool enabled) override |
Enable or disable output. More... | |
short | poll (short events) const override |
Check for poll event flags Check the events listed in events to see if data can be read or written without blocking. More... | |
void | set_flow_control (Flow type, PinName flow1=NC, PinName flow2=NC) |
Set the flow control type on the serial port. More... | |
UnbufferedSerial | ( | PinName | tx, |
PinName | rx, | ||
int | baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE |
||
) |
Create a serial port instance connected to the specified transmit and receive pins, with the specified baud rate.
tx | Transmit pin |
rx | Receive pin |
baud | The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE, which is set via platform.default-serial-baud-rate in mbed_app.json) |
UnbufferedSerial | ( | const serial_pinmap_t & | static_pinmap, |
int | baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE |
||
) |
Create a UnbufferedSerial port, connected to the specified transmit and receive pins, with a particular baud rate.
static_pinmap | reference to structure which holds static pinmap |
baud | The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE, which is set via platform.default-serial-baud-rate in mbed_app.json) |
|
overridevirtual |
Write the contents of a buffer to a file.
Blocks until all data is written
buffer | The buffer to write from |
size | The number of bytes to write |
Implements FileHandle.
|
overridevirtual |
Read the contents of a file into a buffer.
Blocks and reads exactly one character
buffer | The buffer to read in to |
size | The number of bytes to read |
Implements FileHandle.
|
overridevirtual |
Move the file position to a given offset from from a given location.
Not valid for a device type FileHandle like UnbufferedSerial. In case of UnbufferedSerial, returns ESPIPE
offset | The offset from whence to move to |
whence | The start of where to seek SEEK_SET to start from beginning of file, SEEK_CUR to start from current position in file, SEEK_END to start from end of file |
Implements FileHandle.
Definition at line 114 of file UnbufferedSerial.h.
|
overridevirtual |
Get the size of the file.
Reimplemented from FileHandle.
Definition at line 123 of file UnbufferedSerial.h.
|
overridevirtual |
Check if the file in an interactive terminal device.
Reimplemented from FileHandle.
Definition at line 134 of file UnbufferedSerial.h.
|
overridevirtual |
Close a file.
Implements FileHandle.
Definition at line 143 of file UnbufferedSerial.h.
|
overridevirtual |
Enable or disable input.
Control enabling of device for input. This is primarily intended for temporary power-saving; the overall ability of the device to operate for input and/or output may be fixed at creation time, but this call can allow input to be temporarily disabled to permit power saving without losing device state.
enabled | true to enable input, false to disable. |
Reimplemented from FileHandle.
|
overridevirtual |
Enable or disable output.
Control enabling of device for output. This is primarily intended for temporary power-saving; the overall ability of the device to operate for input and/or output may be fixed at creation time, but this call can allow output to be temporarily disabled to permit power saving without losing device state.
enabled | true to enable output, false to disable. |
Reimplemented from FileHandle.
|
overridevirtual |
Check for poll event flags Check the events listed in events to see if data can be read or written without blocking.
Call is nonblocking - returns state of events.
events | bitmask of poll events we're interested in - POLLIN/POLLOUT etc. |
Reimplemented from FileHandle.
void set_flow_control | ( | Flow | type, |
PinName | flow1 = NC , |
||
PinName | flow2 = NC |
||
) |
Set the flow control type on the serial port.
type | the flow control type (Disabled, RTS, CTS, RTSCTS) |
flow1 | the first flow control pin (RTS for RTS or RTSCTS, CTS for CTS) |
flow2 | the second flow control pin (CTS for RTSCTS) |