diff options
author | Nao Pross <naopross@thearcway.org> | 2018-05-05 17:13:59 +0200 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-05-05 17:13:59 +0200 |
commit | 601ee769f5ceeab7c71e61806804e4788f279c59 (patch) | |
tree | bc0479325be9e69b7039304deba663ad89422700 /hal/uart.hpp | |
parent | Add top comments (diff) | |
download | SAMLiquidSmoke-601ee769f5ceeab7c71e61806804e4788f279c59.tar.gz SAMLiquidSmoke-601ee769f5ceeab7c71e61806804e4788f279c59.zip |
Rename class pin to io_pin, add general gpio class, add uart echo
Diffstat (limited to '')
-rw-r--r-- | hal/uart.hpp | 41 |
1 files changed, 29 insertions, 12 deletions
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<uint8_t> _rx_buffer[devices_count]; std::queue<uint8_t> _tx_buffer[devices_count]; + // the following functions have been inlined + + // template<unsigned dev> + // std::queue<uint8_t>& rx_buffer(); + + // template<unsigned dev> + // std::queue<uint8_t>& tx_buffer(); + template<unsigned dev> void initialize(); + // the following functions have been inlined + + // template<unsigned dev> + // void echo(bool enabled); + + // template<unsigned dev> + // bool echo_enabled(); + template<unsigned dev> uint8_t read(); + template<unsigned dev> + uint8_t read_wait(); + #if 0 template<unsigned dev> std::string read(const unsigned len); @@ -73,22 +97,15 @@ namespace uart unsigned write(const uint8_t *buffer, const unsigned numbytes); template<unsigned dev> - status status(); - - template<unsigned dev> - transfer_status tranfer_status(); - - template<unsigned dev> - unsigned rx_buffer_size(); - - template<unsigned dev> - unsigned tx_buffer_size(); + void print(const std::string &str); +#if 0 template<unsigned dev> - bool rx_buffer_empty(); + status status(); template<unsigned dev> - bool tx_buffer_full(); + transfer_status tranfer_status(); +#endif } #endif /* UART_HPP */ |