distortos  v0.4.0
object-oriented C++ RTOS for microcontrollers
distortos::devices::UartLowLevel Class Referenceabstract

#include <UartLowLevel.hpp>

Inheritance diagram for distortos::devices::UartLowLevel:
[legend]

Public Member Functions

virtual ~UartLowLevel ()=0
 UartLowLevel's destructor. More...
 
virtual std::pair< int, uint32_t > start (UartBase &uartBase, uint32_t baudRate, uint8_t characterLength, UartParity parity, bool _2StopBits)=0
 Starts low-level UART driver. More...
 
virtual int startRead (void *buffer, size_t size)=0
 Starts asynchronous read operation. More...
 
virtual int startWrite (const void *buffer, size_t size)=0
 Starts asynchronous write operation. More...
 
virtual int stop ()=0
 Stops low-level UART driver. More...
 
virtual size_t stopRead ()=0
 Stops asynchronous read operation. More...
 
virtual size_t stopWrite ()=0
 Stops asynchronous write operation. More...
 

Detailed Description

UartLowLevel class is an interface for low-level UART driver

Constructor & Destructor Documentation

◆ ~UartLowLevel()

distortos::devices::UartLowLevel::~UartLowLevel ( )
pure virtual

UartLowLevel's destructor.

Member Function Documentation

◆ start()

virtual std::pair<int, uint32_t> distortos::devices::UartLowLevel::start ( UartBase uartBase,
uint32_t  baudRate,
uint8_t  characterLength,
UartParity  parity,
bool  _2StopBits 
)
pure virtual

Starts low-level UART driver.

Parameters
[in]uartBaseis a reference to UartBase object that will be associated with this one
[in]baudRateis the desired baud rate, bps
[in]characterLengthselects character length, bits
[in]parityselects parity
[in]_2StopBitsselects whether 1 (false) or 2 (true) stop bits are used
Returns
pair with return code (0 on success, error code otherwise) and real baud rate; error codes:
  • EBADF - the driver is not stopped;
  • EINVAL - selected baud rate and/or format are invalid;

Implemented in distortos::chip::ChipUartLowLevel.

Here is the caller graph for this function:

◆ startRead()

virtual int distortos::devices::UartLowLevel::startRead ( void *  buffer,
size_t  size 
)
pure virtual

Starts asynchronous read operation.

This function returns immediately. When the operation is finished (expected number of bytes were read), UartBase::readCompleteEvent() will be executed. For any detected error during reception, UartBase::receiveErrorEvent() will be executed. Note that overrun error may be reported even if it happened when no read operation was in progress.

Parameters
[out]bufferis the buffer to which the data will be written
[in]sizeis the size of buffer, bytes, must be even if selected character length is greater than 8 bits
Returns
0 on success, error code otherwise:
  • EBADF - the driver is not started;
  • EBUSY - read is in progress;
  • EINVAL - buffer and/or size are invalid;

Implemented in distortos::chip::ChipUartLowLevel.

Here is the caller graph for this function:

◆ startWrite()

virtual int distortos::devices::UartLowLevel::startWrite ( const void *  buffer,
size_t  size 
)
pure virtual

Starts asynchronous write operation.

This function returns immediately. If no transmission is active, UartBase::transmitStartEvent() will be executed. When the operation is finished (expected number of bytes were written), UartBase::writeCompleteEvent() will be executed. When the transmission physically ends, UartBase::transmitCompleteEvent() will be executed.

Parameters
[in]bufferis the buffer with data that will be transmitted
[in]sizeis the size of buffer, bytes, must be even if selected character length is greater than 8 bits
Returns
0 on success, error code otherwise:
  • EBADF - the driver is not started;
  • EBUSY - write is in progress;
  • EINVAL - buffer and/or size are invalid;

Implemented in distortos::chip::ChipUartLowLevel.

Here is the caller graph for this function:

◆ stop()

virtual int distortos::devices::UartLowLevel::stop ( )
pure virtual

Stops low-level UART driver.

Returns
0 on success, error code otherwise:
  • EBADF - the driver is not started;
  • EBUSY - read and/or write are in progress;

Implemented in distortos::chip::ChipUartLowLevel.

Here is the caller graph for this function:

◆ stopRead()

virtual size_t distortos::devices::UartLowLevel::stopRead ( )
pure virtual

Stops asynchronous read operation.

This function returns immediately. After this call UartBase::readCompleteEvent() will not be executed.

Returns
number of bytes already read by low-level UART driver (and written to read buffer)

Implemented in distortos::chip::ChipUartLowLevel.

Here is the caller graph for this function:

◆ stopWrite()

virtual size_t distortos::devices::UartLowLevel::stopWrite ( )
pure virtual

Stops asynchronous write operation.

This function returns immediately. After this call UartBase::writeCompleteEvent() will not be executed. UartBase::transmitCompleteEvent() will not be suppressed.

Returns
number of bytes already written by low-level UART driver (and read from write buffer)

Implemented in distortos::chip::ChipUartLowLevel.

Here is the caller graph for this function:

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