Fix lab04 based on feedback
This commit is contained in:
parent
d931c3b632
commit
6472da9c13
@ -3,6 +3,7 @@
|
|||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
|
#include <util/atomic.h>
|
||||||
#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
#include "hmi_msg.h"
|
#include "hmi_msg.h"
|
||||||
#include "uart-wrapper.h"
|
#include "uart-wrapper.h"
|
||||||
@ -80,7 +81,10 @@ static inline void search_month() {
|
|||||||
|
|
||||||
static inline void heartbeat() {
|
static inline void heartbeat() {
|
||||||
static uint32_t last_time;
|
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) {
|
if ((last_time - cur_time) > 0) {
|
||||||
// Toggle led on arduino pin 25
|
// Toggle led on arduino pin 25
|
||||||
PORTA ^= _BV(PORTA3);
|
PORTA ^= _BV(PORTA3);
|
||||||
|
@ -29,5 +29,5 @@ int uart3_putchar(char c, FILE *stream)
|
|||||||
int uart0_getchar(FILE *stream)
|
int uart0_getchar(FILE *stream)
|
||||||
{
|
{
|
||||||
(void) stream;
|
(void) stream;
|
||||||
return (unsigned char)uart0_getc();
|
return uart0_getc() & 0xff;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user