15#include <Driver_USART.h>
31 c_cb_func_ (c_cb_func)
45#pragma GCC diagnostic push
47#elif defined(__GNUC__)
48#pragma GCC diagnostic ignored "-Waggregate-return"
50#pragma GCC diagnostic ignored "-Wstrict-aliasing"
56 *(
reinterpret_cast<ARM_DRIVER_VERSION*
> (&version_)) =
57 driver_->GetVersion ();
65 *(
reinterpret_cast<ARM_USART_CAPABILITIES*
> (&capa_)) =
66 driver_->GetCapabilities ();
74 *(
reinterpret_cast<ARM_USART_STATUS*
> (&status_)) = driver_->GetStatus ();
82 *(
reinterpret_cast<ARM_USART_MODEM_STATUS*
> (&modem_status_)) =
83 driver_->GetModemStatus ();
87#pragma GCC diagnostic pop
96 status = driver_->Initialize (c_cb_func_);
97 if (status != ARM_DRIVER_OK)
103 status = driver_->PowerControl (
static_cast<ARM_POWER_STATE
> (state));
107 driver_->Uninitialize ();
116 return driver_->Send (data,
static_cast<uint32_t
> (num));
122 return driver_->Receive (data,
static_cast<uint32_t
> (num));
127 std::size_t num)
noexcept
129 return driver_->Transfer (data_out, data_in,
static_cast<uint32_t
> (num));
135 return driver_->GetTxCount ();
141 return driver_->GetRxCount ();
147 return driver_->Control (cfg, arg);
158 return driver_->Control (
162 return driver_->Control (ctrl, 1);
168 return driver_->SetModemControl (
169 static_cast<ARM_USART_MODEM_CONTROL
> (ctrl));
Serial device driver capabilities.
virtual std::size_t do_get_rx_count(void) noexcept override
virtual ~usart_wrapper() noexcept override
virtual serial::Status & do_get_status(void) noexcept override
virtual const Version & do_get_version(void) noexcept override
virtual return_t do_receive(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
ARM_DRIVER_USART * driver_
Pointer to CMSIS USART Keil driver.
virtual std::size_t do_get_tx_count(void) noexcept override
virtual const serial::Capabilities & do_get_capabilities(void) noexcept override
usart_wrapper(ARM_DRIVER_USART *driver, ARM_USART_SignalEvent_t c_cb_func) noexcept
virtual serial::Modem_status & do_get_modem_status(void) noexcept override
virtual return_t do_control(serial::control_t ctrl) noexcept override
virtual return_t do_power(Power state) noexcept override
virtual return_t do_configure(serial::config_t ctrl, serial::config_arg_t arg) noexcept override
virtual return_t do_send(const void *data, std::size_t num) noexcept override
virtual return_t do_control_modem_line(serial::Modem_control ctrl) noexcept override
int printf(const char *format,...)
Write a formatted string to the trace device.
@ disable_tx
Disable Receiver.
@ enable_tx
Enable Transmitter.
@ disable_rx
Disable Continuous Break transmission;.
Modem_control
Configuration to change the serial modem lines.
struct _ARM_DRIVER_USART const ARM_DRIVER_USART
void(* ARM_USART_SignalEvent_t)(uint32_t event)