summaryrefslogtreecommitdiffstats
path: root/fpm.c
diff options
context:
space:
mode:
Diffstat (limited to 'fpm.c')
-rw-r--r--fpm.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/fpm.c b/fpm.c
index 6599996..e85ee94 100644
--- a/fpm.c
+++ b/fpm.c
@@ -1,8 +1,7 @@
-#include <avr/io.h>
#include <util/delay.h>
-#include <util/setbaud.h>
#include "fpm.h"
+#include "uart.h"
#define MAXPDLEN 64
@@ -15,16 +14,12 @@
static inline uint8_t read(void)
{
- while (!(UCSR0A & (1 << RXC0)))
- ;
- return UDR0;
+ return uart_recv();
}
static inline void write(uint8_t c)
{
- while (!(UCSR0A & (1 << UDRE0)))
- ;
- UDR0 = c;
+ uart_send(c);
}
static inline void send(uint8_t *data, uint8_t n)
@@ -167,13 +162,13 @@ static inline uint8_t img2tz(uint8_t bufid)
uint8_t fpm_init(void)
{
- uint8_t rc;
+ uint8_t rc, wt = 100;
uint16_t dt = 0;
do {
rc = check_pwd();
- _delay_ms(100);
- dt += 100;
+ dt += wt;
+ _delay_ms(wt);
} while (rc == 0 && dt < 500);
return rc;