diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -5,8 +5,7 @@ * Created on May 1, 2018, 6:18 PM */ -#include <stdio.h> -#include <stdlib.h> +#include <string> // basic devices #include "hal/confbits.hpp" @@ -18,7 +17,7 @@ extern "C" { #include <xc.h> - #include <proc/p32mx470f512h.h> + // #include <proc/p32mx470f512h.h> } @@ -36,15 +35,18 @@ int main(int argc, char** argv) led1.set(1); led2.set(1); led3.set(1); + + uart::write<1>("started\n\r"); while (true) { - while (uart::rx_buffer_empty<1>()); -// while (!uart::rx_buffer_empty<1>()) { -// uart::write<1>(uart::read<1>()); -// uart::write<1>("\n\rk") -// } + while (uart::rx_buffer<1>().empty()); + + while (!uart::rx_buffer<1>().empty()) { + uint8_t c = uart::read<1>(); + uart::write<1>(c); + uart::write<1>("\n\r"); + } - uart::read<1>(); led1.toggle(); } |