From 6472da9c1382df907e6b5adffeccbb964e82fde6 Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Thu, 1 Dec 2016 14:22:40 +0200 Subject: [PATCH] Fix lab04 based on feedback --- src/main.c | 6 +++++- src/uart-wrapper.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 2aad978..af73129 100644 --- a/src/main.c +++ b/src/main.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include "hmi_msg.h" #include "uart-wrapper.h" @@ -80,7 +81,10 @@ static inline void search_month() { static inline void heartbeat() { static uint32_t last_time; - uint32_t cur_time = time; + uint32_t cur_time; + ATOMIC_BLOCK(ATOMIC_FORCEON) { + cur_time = time; + } if ((last_time - cur_time) > 0) { // Toggle led on arduino pin 25 PORTA ^= _BV(PORTA3); diff --git a/src/uart-wrapper.c b/src/uart-wrapper.c index 571e628..c086a0b 100644 --- a/src/uart-wrapper.c +++ b/src/uart-wrapper.c @@ -29,5 +29,5 @@ int uart3_putchar(char c, FILE *stream) int uart0_getchar(FILE *stream) { (void) stream; - return (unsigned char)uart0_getc(); + return uart0_getc() & 0xff; }