21 #ifndef ARM_CORTEX_STM32_COMMON_USART_STREAM_HPP_INCLUDED 22 #define ARM_CORTEX_STM32_COMMON_USART_STREAM_HPP_INCLUDED 24 #include <arch/usart.hpp> 33 bool debug_irqs =
false 38 static constexpr
bool crlf = _crlf;
50 using SR =
typename usart_type::USARTx::SR;
52 static void isr(
void) {
53 auto flags = SR::load();
57 if(flags & (SR::ORE::value | SR::FE::value | SR::NE::value | SR::PE::value))
61 if(flags & SR::RXNE::value) {
62 uint32_t data = usart_type::receive();
65 if(flags & SR::TXE::value) {
71 usart_type::disable_tx_interrupt();
83 typename usart_type::resources,
88 usart_type::enable_tx_interrupt();
105 usart_type::enable();
106 usart_type::irq::enable();
107 usart_type::enable_interrupt(
true,
false,
true,
false,
false);
118 usart_type::disable_interrupt(
true,
false,
true,
false,
false);
119 usart_type::irq::disable();
120 usart_type::disable();
124 template<
typename usart_type,
typename fifo_type,
bool crlf,
bool debug_irqs>
127 template<
typename usart_type,
typename fifo_type,
bool crlf,
bool debug_irqs>
130 template<
typename usart_type,
typename fifo_type,
bool crlf,
bool debug_irqs>
133 template<
typename usart_type,
typename fifo_type,
bool crlf,
bool debug_irqs>
139 #endif // ARM_CORTEX_STM32_COMMON_USART_STREAM_HPP_INCLUDED
_fifo_type fifo_type
Definition: usart_stream.hpp:39
static void close(void)
close the stream
Definition: usart_stream.hpp:117
static constexpr bool crlf
Definition: usart_stream.hpp:38
static fifo_type tx_fifo
Definition: usart_stream.hpp:43
typelist< typename usart_type::resources, irq_resources > resources
Definition: usart_stream.hpp:85
static fifo_type rx_fifo
Definition: usart_stream.hpp:42
static volatile unsigned int irq_errors
Definition: usart_stream.hpp:46
Definition: usart_stream.hpp:35
typelist< irq_handler< typename usart_type::irq, isr > > irq_resources
Definition: usart_stream.hpp:80
char char_type
Definition: usart_stream.hpp:40
static volatile unsigned int irq_count
Definition: usart_stream.hpp:45
typename mpl::make_typelist< sane_typelist<>, Tp... >::type typelist
static void open(void)
open the stream
Definition: usart_stream.hpp:101
static void flush()
Definition: usart_stream.hpp:87