version_2.0
Dependents: cc3000_ping_demo_try_2
Fork of mbed by
SerialBase Class Reference
A base class for serial port implementations Can't be instantiated directly (use Serial or RawSerial) More...
#include <SerialBase.h>
Inherited by RawSerial, and Serial.
Public Member Functions | |
void | baud (int baudrate) |
Set the baud rate of the serial port. | |
void | format (int bits=8, Parity parity=SerialBase::None, int stop_bits=1) |
Set the transmission format used by the serial port. | |
int | readable () |
Determine if there is a character available to read. | |
int | writeable () |
Determine if there is space available to write a character. | |
void | attach (void(*fptr)(void), IrqType type=RxIrq) |
Attach a function to call whenever a serial interrupt is generated. | |
template<typename T > | |
void | attach (T *tptr, void(T::*mptr)(void), IrqType type=RxIrq) |
Attach a member function to call whenever a serial interrupt is generated. | |
void | send_break () |
Generate a break condition on the serial line. | |
void | set_flow_control (Flow type, PinName flow1=NC, PinName flow2=NC) |
Set the flow control type on the serial port. |
Detailed Description
A base class for serial port implementations Can't be instantiated directly (use Serial or RawSerial)
Definition at line 32 of file SerialBase.h.
Member Function Documentation
void attach | ( | void(*)(void) | fptr, |
IrqType | type = RxIrq |
||
) |
Attach a function to call whenever a serial interrupt is generated.
- Parameters:
-
fptr A pointer to a void function, or 0 to set as none type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
void attach | ( | T * | tptr, |
void(T::*)(void) | mptr, | ||
IrqType | type = RxIrq |
||
) |
Attach a member function to call whenever a serial interrupt is generated.
- Parameters:
-
tptr pointer to the object to call the member function on mptr pointer to the member function to be called type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
Definition at line 99 of file SerialBase.h.
void baud | ( | int | baudrate ) |
Set the baud rate of the serial port.
- Parameters:
-
baudrate The baudrate of the serial port (default = 9600).
void format | ( | int | bits = 8 , |
Parity | parity = SerialBase::None , |
||
int | stop_bits = 1 |
||
) |
Set the transmission format used by the serial port.
- Parameters:
-
bits The number of bits in a word (5-8; default = 8) parity The parity used (SerialBase::None, SerialBase::Odd, SerialBase::Even, SerialBase::Forced1, SerialBase::Forced0; default = SerialBase::None) stop The number of stop bits (1 or 2; default = 1)
int readable | ( | ) |
Determine if there is a character available to read.
- Returns:
- 1 if there is a character available to read, 0 otherwise
void send_break | ( | ) |
Generate a break condition on the serial line.
void set_flow_control | ( | Flow | type, |
PinName | flow1 = NC , |
||
PinName | flow2 = NC |
||
) |
Set the flow control type on the serial port.
- Parameters:
-
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)
int writeable | ( | ) |
Determine if there is space available to write a character.
- Returns:
- 1 if there is space to write a character, 0 otherwise
Generated on Thu Jul 14 2022 10:44:07 by 1.7.2