17#ifndef MBED_UNBUFFERED_SERIAL_H
18#define MBED_UNBUFFERED_SERIAL_H
20#include "platform/platform.h"
22#if DEVICE_SERIAL || defined(DOXYGEN_ONLY)
26#include "drivers/SerialBase.h"
27#include "platform/FileHandle.h"
28#include "platform/mbed_toolchain.h"
29#include "platform/NonCopyable.h"
67 int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE
79 int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE
90 ssize_t
write(
const void *buffer,
size_t size)
override;
114 off_t
seek(off_t offset,
int whence = SEEK_SET)
override
187 short poll(
short events)
const override;
194 using SerialBase::IrqCnt;
195 using SerialBase::RxIrq;
196 using SerialBase::TxIrq;
201 using SerialBase::Flow;
203 using SerialBase::Disabled;
204 using SerialBase::RTS;
205 using SerialBase::CTS;
206 using SerialBase::RTSCTS;
Prevents generation of copy constructor and copy assignment operator in derived classes.
A base class for serial port implementations Can't be instantiated directly (use UnbufferedSerial or ...
int readable()
Determine if there is a character available to read.
void attach(Callback< void()> func, IrqType type=RxIrq)
Attach a function to call whenever a serial interrupt is generated.
void format(int bits=8, Parity parity=SerialBase::None, int stop_bits=1)
Set the transmission format used by the serial port.
void baud(int baudrate)
Set the baud rate of the serial port.
int writeable()
Determine if there is space available to write a character.
Class implementation for unbuffered I/O for an interrupt driven application or one that needs to have...
void baud(int baudrate)
Set the baud rate of the serial port.
int enable_input(bool enabled) override
Enable or disable input.
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,...
off_t size() override
Get the size of the file.
void set_flow_control(Flow type, PinName flow1=NC, PinName flow2=NC)
Set the flow control type on the serial port.
ssize_t write(const void *buffer, size_t size) override
Write the contents of a buffer to a file.
off_t seek(off_t offset, int whence=SEEK_SET) override
Move the file position to a given offset from from a given location.
int enable_output(bool enabled) override
Enable or disable output.
int close() override
Close a file.
ssize_t read(void *buffer, size_t size) override
Read the contents of a file into a buffer.
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,...
int isatty() override
Check if the file in an interactive terminal device.
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 wi...