30#include <Driver_USART.h>
46 c_cb_func_ (c_cb_func)
60#pragma GCC diagnostic push
61#pragma GCC diagnostic ignored "-Waggregate-return"
62#pragma GCC diagnostic ignored "-Wstrict-aliasing"
68 *(
reinterpret_cast<ARM_DRIVER_VERSION*
> (&version_)) =
69 driver_->GetVersion ();
77 *(
reinterpret_cast<ARM_USART_CAPABILITIES*
> (&capa_)) =
78 driver_->GetCapabilities ();
86 *(
reinterpret_cast<ARM_USART_STATUS*
> (&status_)) = driver_->GetStatus ();
94 *(
reinterpret_cast<ARM_USART_MODEM_STATUS*
> (&modem_status_)) =
95 driver_->GetModemStatus ();
99#pragma GCC diagnostic pop
108 status = driver_->Initialize (c_cb_func_);
109 if (status != ARM_DRIVER_OK)
115 status = driver_->PowerControl (
static_cast<ARM_POWER_STATE
> (state));
119 driver_->Uninitialize ();
128 return driver_->Send (data,
static_cast<uint32_t
> (num));
134 return driver_->Receive (data,
static_cast<uint32_t
> (num));
139 std::size_t num)
noexcept
141 return driver_->Transfer (data_out, data_in,
static_cast<uint32_t
> (num));
147 return driver_->GetTxCount ();
153 return driver_->GetRxCount ();
159 return driver_->Control (cfg, arg);
170 return driver_->Control (
174 return driver_->Control (ctrl, 1);
180 return driver_->SetModemControl (
181 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)