diff options
author | Nao Pross <naopross@thearcway.org> | 2018-05-04 18:27:12 +0200 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-05-04 18:27:12 +0200 |
commit | 5e8e628da03121323351e54e6866826288e4c4bd (patch) | |
tree | 4b3476cec9c295b5c633ea6b801815a131e2780b /hal/uart.hpp | |
parent | Add templated generic implementaions for uart, rename uart1.tpp to uart.tpp (diff) | |
download | SAMLiquidSmoke-5e8e628da03121323351e54e6866826288e4c4bd.tar.gz SAMLiquidSmoke-5e8e628da03121323351e54e6866826288e4c4bd.zip |
Implement most of basic HAL
Oscillator:
The oscillator is configured correctly.
Interrupts:
RX uart interrupts work.
The global interrupt vector table is enabled.
UART:
RX features work.
Diffstat (limited to 'hal/uart.hpp')
-rw-r--r-- | hal/uart.hpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/hal/uart.hpp b/hal/uart.hpp index 461f0fa..096ac7b 100644 --- a/hal/uart.hpp +++ b/hal/uart.hpp @@ -10,7 +10,7 @@ #include <cstdint> #include <cstddef> -#include <string> +#include <queue> extern "C" { void usart_1_isr(); @@ -43,17 +43,14 @@ namespace uart tx_empty = 1<<4, }; - std::string rx_buffer[devices_count]; - std::string tx_buffer[devices_count]; + std::queue<uint8_t> rx_buffer[devices_count]; + std::queue<uint8_t> tx_buffer[devices_count]; template<unsigned dev> void initialize(); template<unsigned dev> - uint8_t peek(uint16_t offset); - - template<unsigned dev> - uint8_t read(void); + uint8_t read(); template<unsigned dev> unsigned read(uint8_t *buffer, const unsigned numbytes); @@ -62,6 +59,9 @@ namespace uart void write(const uint8_t byte); template<unsigned dev> + void write(const std::string &str); + + template<unsigned dev> unsigned write(const uint8_t *buffer, const unsigned numbytes); template<unsigned dev> |