stm32rcos
 
読み取り中…
検索中…
一致する文字列を見つけられません
uart.hpp
[詳解]
1#pragma once
2
3#include <cstddef>
4#include <cstdint>
5
6#include "stm32rcos/hal.hpp"
7
8#include "uart/stdout.hpp"
9#include "uart/uart_base.hpp"
10#include "uart/uart_type.hpp"
11
12#ifdef HAL_UART_MODULE_ENABLED
16#endif
17
18namespace stm32rcos {
19namespace peripheral {
20
21namespace detail {
22
23template <UartType TxType> class UartTx;
24template <UartType RxType> class UartRx;
25
26} // namespace detail
27
62template <UartType TxType = UartType::IT, UartType RxType = UartType::IT>
63class Uart : public UartBase {
64public:
65 Uart(UART_HandleTypeDef *huart, size_t rx_buf_size = 64)
66 : tx_{huart}, rx_{huart, rx_buf_size} {}
67
68 bool transmit(const uint8_t *data, size_t size, uint32_t timeout) {
69 return tx_.transmit(data, size, timeout);
70 }
71
72 bool receive(uint8_t *data, size_t size, uint32_t timeout) {
73 return rx_.receive(data, size, timeout);
74 }
75
76 void flush() { rx_.flush(); }
77
78 size_t available() { return rx_.available(); }
79
80private:
83};
84
85} // namespace peripheral
86} // namespace stm32rcos
Definition uart_base.hpp:9
void flush()
Definition uart.hpp:76
size_t available()
Definition uart.hpp:78
bool transmit(const uint8_t *data, size_t size, uint32_t timeout)
Definition uart.hpp:68
Uart(UART_HandleTypeDef *huart, size_t rx_buf_size=64)
Definition uart.hpp:65
bool receive(uint8_t *data, size_t size, uint32_t timeout)
Definition uart.hpp:72
Definition uart.hpp:21
Definition can.hpp:18
Definition mutex.hpp:9