µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
os::driver::usart_wrapper Class Reference

#include <usart-wrapper.h>

+ Inheritance diagram for os::driver::usart_wrapper:

Public Member Functions

 usart_wrapper (ARM_DRIVER_USART *driver, ARM_USART_SignalEvent_t c_cb_func) noexcept
 
 usart_wrapper (const usart_wrapper &)=delete
 
 usart_wrapper (usart_wrapper &&)=delete
 
virtual ~usart_wrapper () noexcept override
 
void clean (void) noexcept
 
return_t configure (serial::config_t cfg, serial::config_arg_t arg) noexcept
 Configure the serial interface.
 
return_t control (serial::control_t ctrl) noexcept
 Control the serial interface.
 
return_t control_modem_line (serial::Modem_control ctrl) noexcept
 Configure serial modem lines.
 
const serial::Capabilitiesget_capabilities (void) noexcept
 Get driver capabilities.
 
serial::Modem_statusget_modem_status (void) noexcept
 Get serial modem lines state.
 
std::size_t get_rx_count (void) noexcept
 Get received bytes count.
 
serial::Statusget_status (void) noexcept
 Get serial port status.
 
std::size_t get_tx_count (void) noexcept
 Get transmitted bytes count.
 
const Versionget_version (void) noexcept
 Get driver version.
 
usart_wrapperoperator= (const usart_wrapper &)=delete
 
usart_wrapperoperator= (usart_wrapper &&)=delete
 
return_t power (Power state) noexcept
 Power up/down device.
 
return_t receive (void *data, std::size_t num) noexcept
 Start the serial receiver.
 
void register_callback (signal_event_t cb_func, const void *cb_object=nullptr) noexcept
 Register event callback.
 
return_t send (const void *data, std::size_t num) noexcept
 Start the serial transmitter.
 
void signal_event (event_t event) noexcept
 Signal serial events.
 
return_t transfer (const void *data_out, void *data_in, std::size_t num) noexcept
 Start sending/receiving data to/from the serial transmitter/receiver.
 

Protected Member Functions

virtual return_t do_configure (serial::config_t ctrl, serial::config_arg_t arg) noexcept override
 
virtual return_t do_control (serial::control_t ctrl) noexcept override
 
virtual return_t do_control_modem_line (serial::Modem_control ctrl) noexcept override
 
virtual const serial::Capabilitiesdo_get_capabilities (void) noexcept override
 
virtual serial::Modem_statusdo_get_modem_status (void) noexcept override
 
virtual std::size_t do_get_rx_count (void) noexcept override
 
virtual serial::Statusdo_get_status (void) noexcept override
 
virtual std::size_t do_get_tx_count (void) noexcept override
 
virtual const Versiondo_get_version (void) noexcept override
 
virtual return_t do_power (Power state) noexcept override
 
virtual return_t do_receive (void *data, std::size_t num) noexcept override
 
virtual return_t do_send (const void *data, std::size_t num) noexcept override
 
virtual return_t do_transfer (const void *data_out, void *data_in, std::size_t num) noexcept override
 

Protected Attributes

signal_event_t cb_func_
 Pointer to static function that implements the callback.
 
const void * cb_object_
 Pointer to object instance associated with this driver.
 
serial::Modem_status modem_status_
 
serial::Status status_
 

Private Attributes

ARM_USART_SignalEvent_t c_cb_func_
 
serial::Capabilities capa_
 
ARM_DRIVER_USARTdriver_
 Pointer to CMSIS USART Keil driver.
 
Version version_ { 0, 0 }
 

Detailed Description

Definition at line 52 of file usart-wrapper.h.

Constructor & Destructor Documentation

◆ usart_wrapper() [1/3]

os::driver::usart_wrapper::usart_wrapper ( ARM_DRIVER_USART driver,
ARM_USART_SignalEvent_t  c_cb_func 
)
noexcept

Definition at line 28 of file usart-wrapper.cpp.

◆ usart_wrapper() [2/3]

os::driver::usart_wrapper::usart_wrapper ( const usart_wrapper )
delete

◆ usart_wrapper() [3/3]

os::driver::usart_wrapper::usart_wrapper ( usart_wrapper &&  )
delete

◆ ~usart_wrapper()

os::driver::usart_wrapper::~usart_wrapper ( )
overridevirtualnoexcept

Definition at line 36 of file usart-wrapper.cpp.

Member Function Documentation

◆ clean()

void os::driver::Serial::clean ( void  )
noexceptinherited

Definition at line 56 of file serial.cpp.

◆ configure()

return_t os::driver::Serial::configure ( serial::config_t  cfg,
serial::config_arg_t  arg 
)
inlinenoexceptinherited

Configure the serial interface.

Parameters
[in]cfgOperation
[in]argArgument of operation (optional)
Returns
Common execution status and driver specific usart_execution_status

Definition at line 825 of file serial.h.

◆ control()

return_t os::driver::Serial::control ( serial::control_t  ctrl)
inlinenoexceptinherited

Control the serial interface.

Parameters
[in]ctrlOperation
Returns
Common execution status and driver specific usart_execution_status

Definition at line 831 of file serial.h.

◆ control_modem_line()

return_t os::driver::Serial::control_modem_line ( serial::Modem_control  ctrl)
inlinenoexceptinherited

Configure serial modem lines.

Parameters
[in]ctrlControl.
Returns
Execution status.

Definition at line 843 of file serial.h.

◆ do_configure()

return_t os::driver::usart_wrapper::do_configure ( serial::config_t  ctrl,
serial::config_arg_t  arg 
)
overrideprotectedvirtualnoexcept

Implements os::driver::Serial.

Definition at line 145 of file usart-wrapper.cpp.

◆ do_control()

return_t os::driver::usart_wrapper::do_control ( serial::control_t  ctrl)
overrideprotectedvirtualnoexcept

Implements os::driver::Serial.

Definition at line 151 of file usart-wrapper.cpp.

◆ do_control_modem_line()

return_t os::driver::usart_wrapper::do_control_modem_line ( serial::Modem_control  ctrl)
overrideprotectedvirtualnoexcept

Implements os::driver::Serial.

Definition at line 166 of file usart-wrapper.cpp.

◆ do_get_capabilities()

const serial::Capabilities & os::driver::usart_wrapper::do_get_capabilities ( void  )
overrideprotectedvirtualnoexcept

Implements os::driver::Serial.

Definition at line 62 of file usart-wrapper.cpp.

◆ do_get_modem_status()

serial::Modem_status & os::driver::usart_wrapper::do_get_modem_status ( void  )
overrideprotectedvirtualnoexcept

Implements os::driver::Serial.

Definition at line 79 of file usart-wrapper.cpp.

◆ do_get_rx_count()

std::size_t os::driver::usart_wrapper::do_get_rx_count ( void  )
overrideprotectedvirtualnoexcept

Implements os::driver::Serial.

Definition at line 139 of file usart-wrapper.cpp.

◆ do_get_status()

serial::Status & os::driver::usart_wrapper::do_get_status ( void  )
overrideprotectedvirtualnoexcept

Implements os::driver::Serial.

Definition at line 71 of file usart-wrapper.cpp.

◆ do_get_tx_count()

std::size_t os::driver::usart_wrapper::do_get_tx_count ( void  )
overrideprotectedvirtualnoexcept

Implements os::driver::Serial.

Definition at line 133 of file usart-wrapper.cpp.

◆ do_get_version()

const Version & os::driver::usart_wrapper::do_get_version ( void  )
overrideprotectedvirtualnoexcept

Implements os::driver::Base.

Definition at line 53 of file usart-wrapper.cpp.

◆ do_power()

return_t os::driver::usart_wrapper::do_power ( Power  state)
overrideprotectedvirtualnoexcept

Implements os::driver::Base.

Definition at line 90 of file usart-wrapper.cpp.

◆ do_receive()

return_t os::driver::usart_wrapper::do_receive ( void *  data,
std::size_t  num 
)
overrideprotectedvirtualnoexcept

Implements os::driver::Serial.

Definition at line 120 of file usart-wrapper.cpp.

◆ do_send()

return_t os::driver::usart_wrapper::do_send ( const void *  data,
std::size_t  num 
)
overrideprotectedvirtualnoexcept

Implements os::driver::Serial.

Definition at line 114 of file usart-wrapper.cpp.

◆ do_transfer()

return_t os::driver::usart_wrapper::do_transfer ( const void *  data_out,
void *  data_in,
std::size_t  num 
)
overrideprotectedvirtualnoexcept

Implements os::driver::Serial.

Definition at line 126 of file usart-wrapper.cpp.

◆ get_capabilities()

const serial::Capabilities & os::driver::Serial::get_capabilities ( void  )
inlinenoexceptinherited

Get driver capabilities.

Returns
Capabilities.

Definition at line 807 of file serial.h.

◆ get_modem_status()

serial::Modem_status & os::driver::Serial::get_modem_status ( void  )
inlinenoexceptinherited

Get serial modem lines state.

Returns
Modem status.

Definition at line 849 of file serial.h.

◆ get_rx_count()

std::size_t os::driver::Serial::get_rx_count ( void  )
inlinenoexceptinherited

Get received bytes count.

Returns
number of bytes received

Definition at line 819 of file serial.h.

◆ get_status()

serial::Status & os::driver::Serial::get_status ( void  )
inlinenoexceptinherited

Get serial port status.

Returns
Serial status.

Definition at line 837 of file serial.h.

◆ get_tx_count()

std::size_t os::driver::Serial::get_tx_count ( void  )
inlinenoexceptinherited

Get transmitted bytes count.

Returns
number of bytes transmitted

Definition at line 813 of file serial.h.

◆ get_version()

const Version & os::driver::Base::get_version ( void  )
inlinenoexceptinherited

Get driver version.

Returns
Version.

Definition at line 195 of file common.h.

◆ operator=() [1/2]

usart_wrapper & os::driver::usart_wrapper::operator= ( const usart_wrapper )
delete

◆ operator=() [2/2]

usart_wrapper & os::driver::usart_wrapper::operator= ( usart_wrapper &&  )
delete

◆ power()

return_t os::driver::Base::power ( Power  state)
inlinenoexceptinherited

Power up/down device.

Parameters
[in]statePower state
Returns
Execution status

Definition at line 201 of file common.h.

◆ receive()

return_t os::driver::Serial::receive ( void *  data,
std::size_t  num 
)
noexceptinherited

Start the serial receiver.

Parameters
[out]dataPointer to buffer for data to receive from USART receiver
[in]numNumber of data items to receive
Returns
Execution status

Definition at line 93 of file serial.cpp.

◆ register_callback()

void os::driver::Serial::register_callback ( signal_event_t  cb_func,
const void *  cb_object = nullptr 
)
noexceptinherited

Register event callback.

Parameters
[in]cb_funcPointer to function.
[in]cb_objectPointer to object passed to function.
Returns
Nothing.

Definition at line 75 of file serial.cpp.

◆ send()

return_t os::driver::Serial::send ( const void *  data,
std::size_t  num 
)
noexceptinherited

Start the serial transmitter.

Parameters
[in]dataPointer to buffer with data to send to USART transmitter.
[in]numNumber of data items to send.
Returns
Execution status

Definition at line 82 of file serial.cpp.

◆ signal_event()

void os::driver::Serial::signal_event ( event_t  event)
inlinenoexceptinherited

Signal serial events.

Parameters
[in]eventEvent notification mask.
Returns
Nothing.

Definition at line 855 of file serial.h.

◆ transfer()

return_t os::driver::Serial::transfer ( const void *  data_out,
void *  data_in,
std::size_t  num 
)
noexceptinherited

Start sending/receiving data to/from the serial transmitter/receiver.

Parameters
[in]data_outPointer to buffer with data to send
[out]data_inPointer to buffer for data to receive
[in]numNumber of bytes to transfer
Returns
Execution status

Definition at line 104 of file serial.cpp.

Member Data Documentation

◆ c_cb_func_

ARM_USART_SignalEvent_t os::driver::usart_wrapper::c_cb_func_
private

Pointer to non-reentrant callback. Must be stored because Initialize() is now delayed just before PowerControl(FULL).

Definition at line 128 of file usart-wrapper.h.

◆ capa_

serial::Capabilities os::driver::usart_wrapper::capa_
private

Definition at line 139 of file usart-wrapper.h.

◆ cb_func_

signal_event_t os::driver::Serial::cb_func_
protectedinherited

Pointer to static function that implements the callback.

Definition at line 716 of file serial.h.

◆ cb_object_

const void* os::driver::Serial::cb_object_
protectedinherited

Pointer to object instance associated with this driver.

Definition at line 719 of file serial.h.

◆ driver_

ARM_DRIVER_USART* os::driver::usart_wrapper::driver_
private

Pointer to CMSIS USART Keil driver.

Definition at line 124 of file usart-wrapper.h.

◆ modem_status_

serial::Modem_status os::driver::Serial::modem_status_
protectedinherited

Definition at line 722 of file serial.h.

◆ status_

serial::Status os::driver::Serial::status_
protectedinherited

Definition at line 721 of file serial.h.

◆ version_

Version os::driver::usart_wrapper::version_ { 0, 0 }
private

Definition at line 137 of file usart-wrapper.h.


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