eBoard ①⑧⑨
Written for SIA 2017/2018
eagle_impl::SoftwareSerial Class Reference

[328p] This is used to avoid path resolving issues and defines the common known Arduino SoftwareSerial interface only enabled on UNO and NANO (specific, ATmega328P based-plattforms)
        Don't use manually More...

#include <eagle_SoftwareSerial.h>

Inherits Stream.

+ Collaboration diagram for eagle_impl::SoftwareSerial:

Public Member Functions

 SoftwareSerial (uint8_t receivePin, uint8_t transmitPin, bool inverse_logic=false)
 the constructor for the SoftwareSerial object More...
 
 SoftwareSerial (void)
 this enables eBoard to use the SoftwareSerial-interface More...
 
void configure (uint8_t receivePin, uint8_t transmitPin, bool inverse_logic=false)
 this allows eBoard to configure the object More...
 
 ~SoftwareSerial (void)
 the destructor of the SoftwareSerial object More...
 
void begin (long speed)
 the start function to setup delay_values etc. More...
 
bool listen (void)
 sets the SoftwareSerial object to be the listening one gaining control over the buffers etc. More...
 
void end (void)
 ends communcation on the rx pin More...
 
bool isListening (void)
 checks if this object is the listening object More...
 
bool overflow (void)
 returns the current overflow flag and disables it More...
 
int peek (void)
 reads the actual pointed rxBuffer element without dropping it More...
 
virtual size_t write (uint8_t byte)
 writes a specific value to the tx register More...
 
virtual int read (void)
 reads the actual pointed rxBuffer top element More...
 
virtual int available (void)
 checks if there is data to read available More...
 
virtual void flush (void)
 resets the position in buffer and the buffer itself if the object is listening More...
 

Static Public Member Functions

static void handle_interrupt (void)
 used to handle interrupts on active listening object More...
 

Private Member Functions

void recv (void)
 private receive routine called each time interrupt handler gets triggered More...
 
uint8_t rx_pin_read (void)
 simple routine to read the rxPin by registers More...
 
void tx_pin_write (uint8_t pin_state)
 writes a bool value on the txPin by registers More...
 
void setTX (uint8_t transmitPin)
 sets a specific pin to be 'the chosen one' as a txPin More...
 
void setRX (uint8_t receivePin)
 sets a specific pin to be 'the chosen one' as a rxPin More...
 

Static Private Member Functions

static void tunedDelay (uint16_t delay)
 apply a specific delay to achieve higher precision More...
 

Private Attributes

uint8_t _receivePin
 the id of the receive pin More...
 
uint8_t _receiveBitMask
 the pin mask to directly read from register (Rx) More...
 
volatile uint8_t * _receivePortRegister
 the register the reveice pin is located on More...
 
uint8_t _transmitBitMask
 the pin mask to address the tx pin More...
 
volatile uint8_t * _transmitPortRegister
 the register the reveice pin is located on More...
 
uint16_t _rx_delay_centering
 the rx center delay More...
 
uint16_t _rx_delay_intrabit
 the rx startbit delay More...
 
uint16_t _rx_delay_stopbit
 the rx stopbit dely More...
 
uint16_t _tx_delay
 the (generic) tx delay More...
 
uint16_t _buffer_overflow:1
 determining if an _buffer_overflow occured More...
 
uint16_t _inverse_logic:1
 determining if all pin reads etc whould be inverted (e.g. no pullup on rx); More...
 

Static Private Attributes

static char _receive_buffer [64]
 the buffer for rxBuffer More...
 
static volatile uint8_t _receive_buffer_tail
 size of rxBuffer More...
 
static volatile uint8_t _receive_buffer_head
 current location in rxBuffer More...
 
static SoftwareSerialactive_object
 the active SoftwareSerial object to operate on More...
 

Detailed Description

[328p] This is used to avoid path resolving issues and defines the common known Arduino SoftwareSerial interface only enabled on UNO and NANO (specific, ATmega328P based-plattforms)
        Don't use manually

This class was known as NewSoftSerial and renamend to SoftwareSerial for consistent naming

Authors
arduiniana (core)
ladyada
Mikel Hart
Paul Stoffregen
Garrett Mace
Brett Hagman
Note
this code was documented and modified by EagleoutIce in 2018 for custom use! [Kept _DEBUG functionality]

Definition at line 47 of file eagle_SoftwareSerial.h.

Constructor & Destructor Documentation

◆ SoftwareSerial() [1/2]

eagle_impl::SoftwareSerial::SoftwareSerial ( uint8_t  receivePin,
uint8_t  transmitPin,
bool  inverse_logic = false 
)

the constructor for the SoftwareSerial object

Parameters
receivePinthe destined rx Pin
transmitPinthe destined tx Pin
inverse_logictrue if you wan't to have no pullups and inverted com logic

◆ SoftwareSerial() [2/2]

eagle_impl::SoftwareSerial::SoftwareSerial ( void  )

this enables eBoard to use the SoftwareSerial-interface

◆ ~SoftwareSerial()

eagle_impl::SoftwareSerial::~SoftwareSerial ( void  )

the destructor of the SoftwareSerial object

This calls SoftwareSerial::end() internal and assures a sufficent termination

Member Function Documentation

◆ available()

virtual int eagle_impl::SoftwareSerial::available ( void  )
virtual

checks if there is data to read available

Returns
0 if there's no Data available or the device isn't listening

◆ begin()

void eagle_impl::SoftwareSerial::begin ( long  speed)

the start function to setup delay_values etc.

Parameters
speedthe communcation should work at
possible values:
  •           300 (baud)
  •         1200 (baud)
  •         2400 (baud)
  •         4800 (baud)
  •         9600 (baud) [common]
  •       14400 (baud)
  •       19200 (baud)
  •       28800 (baud)
  •       38400 (baud)
  •       57600 (baud)
  •     115200 (baud)

◆ configure()

void eagle_impl::SoftwareSerial::configure ( uint8_t  receivePin,
uint8_t  transmitPin,
bool  inverse_logic = false 
)

this allows eBoard to configure the object

Parameters
receivePinthe destined rx Pin
transmitPinthe destined tx Pin
inverse_logictrue if you wan't to have no pullups and inverted com logic

◆ end()

void eagle_impl::SoftwareSerial::end ( void  )
inline

ends communcation on the rx pin

◆ flush()

virtual void eagle_impl::SoftwareSerial::flush ( void  )
virtual

resets the position in buffer and the buffer itself if the object is listening

◆ handle_interrupt()

static void eagle_impl::SoftwareSerial::handle_interrupt ( void  )
inlinestatic

used to handle interrupts on active listening object

◆ isListening()

bool eagle_impl::SoftwareSerial::isListening ( void  )
inline

checks if this object is the listening object

Returns
true if the object is the listening object

◆ listen()

bool eagle_impl::SoftwareSerial::listen ( void  )

sets the SoftwareSerial object to be the listening one gaining control over the buffers etc.

Returns
true if it replaces another object (can be no object)

◆ overflow()

bool eagle_impl::SoftwareSerial::overflow ( void  )
inline

returns the current overflow flag and disables it

Returns
the current overflow flag

◆ peek()

int eagle_impl::SoftwareSerial::peek ( void  )

reads the actual pointed rxBuffer element without dropping it

Returns
the read value (-1 if fails)

◆ read()

virtual int eagle_impl::SoftwareSerial::read ( void  )
virtual

reads the actual pointed rxBuffer top element

Returns
the read value (-1 if fails)

◆ recv()

void eagle_impl::SoftwareSerial::recv ( void  )
private

private receive routine called each time interrupt handler gets triggered

◆ rx_pin_read()

uint8_t eagle_impl::SoftwareSerial::rx_pin_read ( void  )
inlineprivate

simple routine to read the rxPin by registers

Returns
the (bool) value on current pin

◆ setRX()

void eagle_impl::SoftwareSerial::setRX ( uint8_t  receivePin)
private

sets a specific pin to be 'the chosen one' as a rxPin

Parameters
receivePinthe Pin-Id of the pin to setup

◆ setTX()

void eagle_impl::SoftwareSerial::setTX ( uint8_t  transmitPin)
private

sets a specific pin to be 'the chosen one' as a txPin

Parameters
transmitPinthe Pin-Id of the pin to setup

◆ tunedDelay()

static void eagle_impl::SoftwareSerial::tunedDelay ( uint16_t  delay)
inlinestaticprivate

apply a specific delay to achieve higher precision

Parameters
delaythe desired delay

◆ tx_pin_write()

void eagle_impl::SoftwareSerial::tx_pin_write ( uint8_t  pin_state)
inlineprivate

writes a bool value on the txPin by registers

Parameters
pin_statethe state the pin should be assigned to

◆ write()

virtual size_t eagle_impl::SoftwareSerial::write ( uint8_t  byte)
virtual

writes a specific value to the tx register

Parameters
bytethe byte to write
Returns
0 if there's an error with the delay
1 if the writing was successful

Member Data Documentation

◆ _buffer_overflow

uint16_t eagle_impl::SoftwareSerial::_buffer_overflow
private

determining if an _buffer_overflow occured

Definition at line 70 of file eagle_SoftwareSerial.h.

◆ _inverse_logic

uint16_t eagle_impl::SoftwareSerial::_inverse_logic
private

determining if all pin reads etc whould be inverted (e.g. no pullup on rx);

Definition at line 72 of file eagle_SoftwareSerial.h.

◆ _receive_buffer

char eagle_impl::SoftwareSerial::_receive_buffer[64]
staticprivate

the buffer for rxBuffer

Definition at line 74 of file eagle_SoftwareSerial.h.

◆ _receive_buffer_head

volatile uint8_t eagle_impl::SoftwareSerial::_receive_buffer_head
staticprivate

current location in rxBuffer

Definition at line 78 of file eagle_SoftwareSerial.h.

◆ _receive_buffer_tail

volatile uint8_t eagle_impl::SoftwareSerial::_receive_buffer_tail
staticprivate

size of rxBuffer

Definition at line 76 of file eagle_SoftwareSerial.h.

◆ _receiveBitMask

uint8_t eagle_impl::SoftwareSerial::_receiveBitMask
private

the pin mask to directly read from register (Rx)

Definition at line 52 of file eagle_SoftwareSerial.h.

◆ _receivePin

uint8_t eagle_impl::SoftwareSerial::_receivePin
private

the id of the receive pin

Definition at line 50 of file eagle_SoftwareSerial.h.

◆ _receivePortRegister

volatile uint8_t* eagle_impl::SoftwareSerial::_receivePortRegister
private

the register the reveice pin is located on

Definition at line 54 of file eagle_SoftwareSerial.h.

◆ _rx_delay_centering

uint16_t eagle_impl::SoftwareSerial::_rx_delay_centering
private

the rx center delay

Definition at line 61 of file eagle_SoftwareSerial.h.

◆ _rx_delay_intrabit

uint16_t eagle_impl::SoftwareSerial::_rx_delay_intrabit
private

the rx startbit delay

Definition at line 63 of file eagle_SoftwareSerial.h.

◆ _rx_delay_stopbit

uint16_t eagle_impl::SoftwareSerial::_rx_delay_stopbit
private

the rx stopbit dely

Definition at line 65 of file eagle_SoftwareSerial.h.

◆ _transmitBitMask

uint8_t eagle_impl::SoftwareSerial::_transmitBitMask
private

the pin mask to address the tx pin

Definition at line 56 of file eagle_SoftwareSerial.h.

◆ _transmitPortRegister

volatile uint8_t* eagle_impl::SoftwareSerial::_transmitPortRegister
private

the register the reveice pin is located on

Definition at line 58 of file eagle_SoftwareSerial.h.

◆ _tx_delay

uint16_t eagle_impl::SoftwareSerial::_tx_delay
private

the (generic) tx delay

Definition at line 67 of file eagle_SoftwareSerial.h.

◆ active_object

SoftwareSerial* eagle_impl::SoftwareSerial::active_object
staticprivate

the active SoftwareSerial object to operate on

Definition at line 80 of file eagle_SoftwareSerial.h.


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