From 601ee769f5ceeab7c71e61806804e4788f279c59 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 5 May 2018 17:13:59 +0200 Subject: Rename class pin to io_pin, add general gpio class, add uart echo --- hal/uart.hpp | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'hal/uart.hpp') diff --git a/hal/uart.hpp b/hal/uart.hpp index 60dd5bb..b1dce29 100644 --- a/hal/uart.hpp +++ b/hal/uart.hpp @@ -3,6 +3,8 @@ * Author: naopross * * Created on May 2, 2018, 7:04 PM + * + * Note: Non working or untested features are commented out with #if 0 .. #endif */ #ifndef UART_HPP @@ -23,6 +25,7 @@ namespace uart { const unsigned devices_count = 4; +#if 0 enum class status : unsigned int { rx_data_available = 1<<0, @@ -42,16 +45,37 @@ namespace uart tx_full = 1<<3, tx_empty = 1<<4, }; +#endif + bool _echo[devices_count]; std::queue _rx_buffer[devices_count]; std::queue _tx_buffer[devices_count]; + // the following functions have been inlined + + // template + // std::queue& rx_buffer(); + + // template + // std::queue& tx_buffer(); + template void initialize(); + // the following functions have been inlined + + // template + // void echo(bool enabled); + + // template + // bool echo_enabled(); + template uint8_t read(); + template + uint8_t read_wait(); + #if 0 template std::string read(const unsigned len); @@ -73,22 +97,15 @@ namespace uart unsigned write(const uint8_t *buffer, const unsigned numbytes); template - status status(); - - template - transfer_status tranfer_status(); - - template - unsigned rx_buffer_size(); - - template - unsigned tx_buffer_size(); + void print(const std::string &str); +#if 0 template - bool rx_buffer_empty(); + status status(); template - bool tx_buffer_full(); + transfer_status tranfer_status(); +#endif } #endif /* UART_HPP */ -- cgit v1.2.1