Implemented basic hardware support for transmitting

This commit is contained in:
2019-07-28 17:32:51 +02:00
parent a71035d4b7
commit 8e0ba5a463
2 changed files with 203 additions and 9 deletions

View File

@@ -7,6 +7,8 @@
#include "../flash/flash.hpp"
#define FORCE_INLINE __attribute__((always_inline))
namespace uart {
namespace detail {
@@ -33,7 +35,7 @@ class uart {
uart &operator=(const uart &) = delete;
uart &operator=(uart &&) = delete;
static void txByte(typename Driver::data_t byte)
static void txByte(typename Driver::data_t byte) FORCE_INLINE
{
Driver::txByte(byte);
}
@@ -48,7 +50,7 @@ class uart {
return Driver::peek();
}
static void txString(const char *str)
static void txString(const char *str) FORCE_INLINE
{
static_assert(Driver::DATA_BITS == DataBits::EIGHT, "Strings are only supported with 8 data bits");
@@ -56,7 +58,7 @@ class uart {
txByte(ch);
}
static void txString(const ::detail::FlashString *str)
static void txString(const ::detail::FlashString *str) FORCE_INLINE
{
static_assert(Driver::DATA_BITS == DataBits::EIGHT, "Strings are only supported with 8 data bits");
@@ -69,13 +71,13 @@ class uart {
//////////////////////////////////////////////////////////////////////////
// Output stream overloads
uart &operator<<(const char *str)
uart &operator<<(const char *str) FORCE_INLINE
{
txString(str);
return *this;
}
uart &operator<<(const ::detail::FlashString *str)
uart &operator<<(const ::detail::FlashString *str) FORCE_INLINE
{
txString(str);
return *this;
@@ -266,3 +268,5 @@ class uart {
};
} // namespace uart
#undef FORCE_INLINE