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 <UART_HandleTypeDef *Handle, UartType TxType> class UartTx;
24template <UART_HandleTypeDef *Handle, UartType RxType> class UartRx;
25
26} // namespace detail
27
62template <UART_HandleTypeDef *Handle, UartType TxType = UartType::IT,
63 UartType RxType = UartType::IT>
64class Uart : public UartBase {
65public:
66 Uart(size_t rx_buf_size = 64) : rx_{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
bool transmit(const uint8_t *data, size_t size, uint32_t timeout)
Definition uart.hpp:68
size_t available()
Definition uart.hpp:78
void flush()
Definition uart.hpp:76
Uart(size_t rx_buf_size=64)
Definition uart.hpp:66
bool receive(uint8_t *data, size_t size, uint32_t timeout)
Definition uart.hpp:72
Definition uart.hpp:21
Definition can.hpp:18
UartType
Definition uart_type.hpp:6
@ IT
Definition uart_type.hpp:8
Definition mutex.hpp:9