Developer World
Spresense Arduino Library v3.3.0-b2e6327
SoftwareSerial Class Reference

SoftwareSerial controller. More...

#include <SoftwareSerial.h>

Inheritance diagram for SoftwareSerial:
Collaboration diagram for SoftwareSerial:

Public Member Functions

 SoftwareSerial (uint8_t receivePin, uint8_t transmitPin)
 Create SoftwareSerial object. More...
 
 ~SoftwareSerial ()
 Destroy SoftwareSerial object.
 
void begin (long speed)
 Initialize the serial communication. More...
 
void end ()
 Deinitialize the serial communication.
 
bool listen ()
 Sets the current object as the "listening" one. More...
 
bool isListening ()
 Checks if the SoftwareSerial object is listening. More...
 
bool stopListening ()
 Stop listening. More...
 
bool overflow ()
 Checks if a SoftwareSerial buffer overflow has occurred. More...
 
int peek ()
 Get a character that was received on the RX pin of the SoftwareSerial object. More...
 
virtual size_t write (uint8_t byte)
 Send a single byte to the transmit pin of SoftwareSerial object. More...
 
virtual int read ()
 Read data from buffer. More...
 
virtual int available ()
 Get the number of bytes available for reading from a SoftwareSerial objects. More...
 
virtual void flush ()
 There is no tx buffering, simply return.
 

Static Public Member Functions

static int handle_interrupt (int irq, FAR void *context, FAR void *arg)
 Interrupt handling. More...
 

Detailed Description

SoftwareSerial controller.

You can control Software Serial comunication by operating SoftwareSerial objects instantiated in your app. It is usable on all the GPIO pins (D0 - D28).

Constructor & Destructor Documentation

◆ SoftwareSerial()

SoftwareSerial::SoftwareSerial ( uint8_t  receivePin,
uint8_t  transmitPin 
)

Create SoftwareSerial object.

Parameters
[in]receivePinPin used for receive
[in]transmitPinPin used for transmit

Member Function Documentation

◆ begin()

void SoftwareSerial::begin ( long  speed)

Initialize the serial communication.

Parameters
[in]speedBaud rate. The maximum speed is 250,000 bps.

◆ listen()

bool SoftwareSerial::listen ( )

Sets the current object as the "listening" one.

Returns
true if success, false if failure

◆ isListening()

bool SoftwareSerial::isListening ( )
inline

Checks if the SoftwareSerial object is listening.

Returns
true if is listening

◆ stopListening()

bool SoftwareSerial::stopListening ( )

Stop listening.

Returns
true if we were actually listening

◆ overflow()

bool SoftwareSerial::overflow ( )
inline

Checks if a SoftwareSerial buffer overflow has occurred.

Returns
true if overflow

◆ peek()

int SoftwareSerial::peek ( )

Get a character that was received on the RX pin of the SoftwareSerial object.

Subsequent calls to this function will return the same character.

Returns
the character read, or -1 if none is available

◆ write()

virtual size_t SoftwareSerial::write ( uint8_t  byte)
virtual

Send a single byte to the transmit pin of SoftwareSerial object.

Parameters
[in]byteByte to write
Returns
Return the number of bytes written

◆ read()

virtual int SoftwareSerial::read ( )
virtual

Read data from buffer.

Returns
The byte read, or -1 if none is available

◆ available()

virtual int SoftwareSerial::available ( )
virtual

Get the number of bytes available for reading from a SoftwareSerial objects.

Returns
number of bytes available to read

◆ handle_interrupt()

static int SoftwareSerial::handle_interrupt ( int  irq,
FAR void *  context,
FAR void *  arg 
)
inlinestatic

Interrupt handling.

Parameters
[in]irqInterrupt number
[in]contextContext (not used)
[in]argArgument (not used)

The documentation for this class was generated from the following file: