template<
UartType TxType = UartType::IT,
UartType RxType = UartType::IT>
class stm32rcos::peripheral::Uart< TxType, RxType >
デフォルトでTx, Rxともに割り込みを使用します。
#include <cstdio>
extern UART_HandleTypeDef huart2;
extern "C" void main_thread(void *) {
while (true) {
uint8_t data[] = {'h', 'e', 'l', 'l', 'o', '\r', '\n'};
uart2.transmit(data, sizeof(data), osWaitForever);
char c;
if (uart2.receive((uint8_t *)&c, 1, osWaitForever)) {
printf("入力した文字: %c\r\n", c);
}
osDelay(10);
}
}
Uart(UART_HandleTypeDef *huart, size_t rx_buf_size=64)
Definition uart.hpp:65
bool enable_stdout(UartBase &uart)