summaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-05-04 19:13:38 +0200
committerNao Pross <naopross@thearcway.org>2018-05-04 19:13:38 +0200
commite68e31de1c419fe4e500cdf1d0f8ca6de2964dcc (patch)
tree32547408c2f03da9552df7f1200457ea20ed7a7a /main.cpp
parentImplement most of basic HAL (diff)
downloadSAMLiquidSmoke-e68e31de1c419fe4e500cdf1d0f8ca6de2964dcc.tar.gz
SAMLiquidSmoke-e68e31de1c419fe4e500cdf1d0f8ca6de2964dcc.zip
Implement uart TX features
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/main.cpp b/main.cpp
index 119e5ce..d95bc74 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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();
}