synth/arm/uart_async.h

16 lines
431 B
C++

#pragma once
#include <span>
#include <string_view>
#include "async.h"
#include "buffer.h"
async::task<buffer> UartRead(int size);
async::task<uint8_t> UartReadLoop();
async::task<> UartWrite(std::span<const std::byte> data);
inline async::task<> UartWrite(std::string_view s) {
co_await UartWrite(std::as_bytes(std::span{s.data(), s.size()}));
}
async::task<> UartWriteLoop(async::gimme<std::span<const std::byte>>& data);