diff options
author | Nao Pross <naopross@thearcway.org> | 2018-05-04 20:47:39 +0200 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-05-04 20:47:39 +0200 |
commit | e82789253b7c915270cfdc126e8e000924d90444 (patch) | |
tree | a58d4194d22e507afe506159b12c0cb2d182be7f /main.cpp | |
parent | Implement uart TX features (diff) | |
download | SAMLiquidSmoke-e82789253b7c915270cfdc126e8e000924d90444.tar.gz SAMLiquidSmoke-e82789253b7c915270cfdc126e8e000924d90444.zip |
Implement TX read(n) and readline() (not working yet)
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -5,7 +5,7 @@ * Created on May 1, 2018, 6:18 PM */ -#include <string> +#define DEBUG // basic devices #include "hal/confbits.hpp" @@ -15,6 +15,10 @@ #include "hal/uart.tpp" #include "hal/pin.tpp" +// standard library +#include <string> + +// microchip libraries extern "C" { #include <xc.h> // #include <proc/p32mx470f512h.h> @@ -40,9 +44,9 @@ int main(int argc, char** argv) while (true) { while (uart::rx_buffer<1>().empty()); - - while (!uart::rx_buffer<1>().empty()) { - uint8_t c = uart::read<1>(); + while (uart::rx_buffer<1>().size() > 0) { + char c = uart::read<1>(); + uart::write<1>(c); uart::write<1>("\n\r"); } |