theCore C++ embedded framework
ecl::uart_bus< dev > Class Template Reference

Electron UART bus wrapper. More...

#include </home/travis/build/forGGe/theCore/platform/particle_electron/export/aux/uart_bus.hpp>

Public Types

using channel = ecl::bus_channel
 
using event = ecl::bus_event
 
using handler_fn = ecl::bus_handler
 

Public Member Functions

 uart_bus ()=delete
 
 ~uart_bus ()=delete
 
uart_busoperator= (uart_bus &)=delete
 
 uart_bus (uart_bus &)=delete
 

Static Public Member Functions

static err init ()
 Lazy initialization. More...
 
static void set_rx (uint8_t *rx, size_t size)
 Sets rx buffer with given size. More...
 
static void set_tx (size_t size, uint8_t fill_byte=0xff)
 Sets tx buffer made-up from sequence of similar bytes. More...
 
static void set_tx (const uint8_t *tx, size_t size)
 Sets tx buffer with given size. More...
 
static void set_handler (const handler_fn &handler)
 Sets event handler. More...
 
static void reset_buffers ()
 Reset xfer buffers. More...
 
static void reset_handler ()
 Resets previously set handler. More...
 
static err do_xfer ()
 Executes xfer, using buffers previously set. More...
 
static err do_tx ()
 
static err do_rx ()
 
static err cancel_xfer ()
 Cancels xfer. More...
 

Friends

void serial_tx_dispatch ()
 
template<uart_device d>
void serial_rx_dispatch ()
 

Detailed Description

template<uart_device dev>
class ecl::uart_bus< dev >

Electron UART bus wrapper.

Member Typedef Documentation

◆ channel

template<uart_device dev>
using ecl::uart_bus< dev >::channel = ecl::bus_channel

◆ event

template<uart_device dev>
using ecl::uart_bus< dev >::event = ecl::bus_event

◆ handler_fn

template<uart_device dev>
using ecl::uart_bus< dev >::handler_fn = ecl::bus_handler

Constructor & Destructor Documentation

◆ uart_bus() [1/2]

template<uart_device dev>
ecl::uart_bus< dev >::uart_bus ( )
delete

◆ ~uart_bus()

template<uart_device dev>
ecl::uart_bus< dev >::~uart_bus ( )
delete

◆ uart_bus() [2/2]

template<uart_device dev>
ecl::uart_bus< dev >::uart_bus ( uart_bus< dev > &  )
delete

Member Function Documentation

◆ operator=()

template<uart_device dev>
uart_bus& ecl::uart_bus< dev >::operator= ( uart_bus< dev > &  )
delete

◆ init()

template<uart_device dev>
err ecl::uart_bus< dev >::init ( )
static

Lazy initialization.

Returns
Status of operation.
Here is the call graph for this function:

◆ set_rx()

template<uart_device dev>
void ecl::uart_bus< dev >::set_rx ( uint8_t *  rx,
size_t  size 
)
static

Sets rx buffer with given size.

Parameters
[in,out]rxBuffer to write data to. Optional.
[in]sizeSize

◆ set_tx() [1/2]

template<uart_device dev>
void ecl::uart_bus< dev >::set_tx ( size_t  size,
uint8_t  fill_byte = 0xff 
)
static

Sets tx buffer made-up from sequence of similar bytes.

Parameters
[in]sizeSize of sequence
[in]fill_byteByte to fill a sequence. Optional.

◆ set_tx() [2/2]

template<uart_device dev>
void ecl::uart_bus< dev >::set_tx ( const uint8_t *  tx,
size_t  size 
)
static

Sets tx buffer with given size.

Parameters
[in]txBuffer to transmit. Optional.
[in]sizeBuffer size.

◆ set_handler()

template<uart_device dev>
void ecl::uart_bus< dev >::set_handler ( const handler_fn handler)
static

Sets event handler.

Handler will be used by the bus, until reset_handler() will be called.

Parameters
[in]handlerHandler itself.

◆ reset_buffers()

template<uart_device dev>
void ecl::uart_bus< dev >::reset_buffers ( )
static

Reset xfer buffers.

Buffers that were set by

See also
set_tx() and
set_rx() will be no longer used after this call.

◆ reset_handler()

template<uart_device dev>
void ecl::uart_bus< dev >::reset_handler ( )
static

Resets previously set handler.

◆ do_xfer()

template<uart_device dev>
err ecl::uart_bus< dev >::do_xfer ( )
static

Executes xfer, using buffers previously set.

When it will be done, handler will be invoked.

Returns
Status of operation.
Here is the call graph for this function:

◆ do_tx()

template<uart_device dev>
err ecl::uart_bus< dev >::do_tx ( )
static

◆ do_rx()

template<uart_device dev>
err ecl::uart_bus< dev >::do_rx ( )
static

◆ cancel_xfer()

template<uart_device dev>
err ecl::uart_bus< dev >::cancel_xfer ( )
static

Cancels xfer.

After this call no xfer will occur.

Returns
Status of operation.

Friends And Related Function Documentation

◆ serial_tx_dispatch

template<uart_device dev>
void serial_tx_dispatch ( )
friend

◆ serial_rx_dispatch

template<uart_device dev>
template<uart_device d>
void serial_rx_dispatch ( )
friend

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