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" 66 int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE
77 int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE
88 ssize_t
write(
const void *buffer,
size_t size)
override;
98 ssize_t
read(
void *buffer,
size_t size)
override;
112 off_t
seek(off_t offset,
int whence = SEEK_SET)
override 163 using SerialBase::RxIrq;
164 using SerialBase::TxIrq;
165 using SerialBase::IrqCnt;
170 using SerialBase::Flow;
172 using SerialBase::Disabled;
173 using SerialBase::RTS;
174 using SerialBase::CTS;
175 using SerialBase::RTSCTS;
184 #endif // DEVICE_SERIAL_FC 189 #endif // DEVICE_SERIAL || defined(DOXYGEN_ONLY) 191 #endif // MBED_UNBUFFERED_SERIAL_H ssize_t write(const void *buffer, size_t size) override
Write the contents of a buffer to a file.
off_t size() override
Get the size of the file.
void baud(int baudrate)
Set the baud rate of the serial port.
int close() override
Close a file.
Class implementation for unbuffered I/O for an interrupt driven application or one that needs to have...
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.
Prevents generation of copy constructor and copy assignment operator in derived classes.
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 writeable()
Determine if there is space available to write a character.
A base class for serial port implementations Can't be instantiated directly (use UnbufferedSerial or ...
int isatty() override
Check if the file in an interactive terminal device.
int readable()
Determine if there is a character available to read.
ssize_t read(void *buffer, size_t size) override
Read the contents of a file into a buffer.
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 set_flow_control(Flow type, PinName flow1=NC, PinName flow2=NC)
Set the flow control type on the serial port.
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...