mbed-drivers
|
#include <RawSerial.h>
Public Member Functions | |
RawSerial (PinName tx, PinName rx) | |
int | putc (int c) |
int | getc () |
int | puts (const char *str) |
int | printf (const char *format,...) |
![]() | |
void | baud (int baudrate) |
void | format (int bits=8, Parity parity=SerialBase::None, int stop_bits=1) |
int | readable () |
int | writeable () |
void | attach (void(*fptr)(void), IrqType type=RxIrq) |
template<typename T > | |
void | attach (T *tptr, void(T::*mptr)(void), IrqType type=RxIrq) |
void | send_break () |
void | set_flow_control (Flow type, PinName flow1=NC, PinName flow2=NC) |
int | write (void *buffer, int length, const event_callback_t &callback, int event=SERIAL_EVENT_TX_COMPLETE) |
int | write (const Buffer &buf, const event_callback_t &callback, int event=SERIAL_EVENT_TX_COMPLETE) |
void | abort_write () |
int | read (void *buffer, int length, const event_callback_t &callback, int event=SERIAL_EVENT_RX_COMPLETE, unsigned char char_match=SERIAL_RESERVED_CHAR_MATCH) |
int | read (const Buffer &buffer, const event_callback_t &callback, int event=SERIAL_EVENT_RX_COMPLETE, unsigned char char_match=SERIAL_RESERVED_CHAR_MATCH) |
void | abort_read () |
int | set_dma_usage_tx (DMAUsage usage) |
int | set_dma_usage_rx (DMAUsage usage) |
Additional Inherited Members | |
![]() | |
enum | Parity { None = 0, Odd, Even, Forced1, Forced0 } |
enum | IrqType { RxIrq = 0, TxIrq } |
enum | Flow { Disabled = 0, RTS, CTS, RTSCTS } |
typedef mbed::util::FunctionPointer2< void, Buffer, int > | event_callback_t |
![]() | |
static void | _irq_handler (uint32_t id, SerialIrq irq_type) |
![]() | |
typedef OneWayTransaction< event_callback_t > | transaction_data_t |
typedef Transaction< SerialBase, transaction_data_t > | transaction_t |
![]() | |
void | start_read (const Buffer &buffer, char buffer_width, const event_callback_t &callback, int event, unsigned char char_match) |
void | start_write (const Buffer &buffer, char buffer_width, const event_callback_t &callback, int event) |
void | interrupt_handler_asynch (void) |
SerialBase (PinName tx, PinName rx) | |
int | _base_getc () |
int | _base_putc (int c) |
![]() | |
CThunk< SerialBase > | _thunk_irq |
transaction_data_t | _current_tx_transaction |
transaction_data_t | _current_rx_transaction |
DMAUsage | _tx_usage |
DMAUsage | _rx_usage |
serial_t | _serial |
mbed::util::FunctionPointer | _irq [2] |
int | _baud |
A serial port (UART) for communication with other serial devices This is a variation of the Serial class that doesn't use streams, thus making it safe to use in interrupt handlers with the RTOS.
Can be used for Full Duplex communication, or Simplex by specifying one pin as NC (Not Connected)
Example:
mbed::RawSerial::RawSerial | ( | PinName | tx, |
PinName | rx | ||
) |
Create a RawSerial port, connected to the specified transmit and receive pins
tx | Transmit pin |
rx | Receive pin |
int mbed::RawSerial::getc | ( | ) |
Read a char from the serial port
int mbed::RawSerial::putc | ( | int | c | ) |
Write a char to the serial port
c | The char to write |
int mbed::RawSerial::puts | ( | const char * | str | ) |
Write a string to the serial port
str | The string to write |