summaryrefslogtreecommitdiffstats
path: root/fpm.c
diff options
context:
space:
mode:
Diffstat (limited to 'fpm.c')
-rw-r--r--fpm.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/fpm.c b/fpm.c
index 4f3b4ed..6599996 100644
--- a/fpm.c
+++ b/fpm.c
@@ -5,7 +5,6 @@
#include "fpm.h"
#define MAXPDLEN 64
-#define RST_DELAY_MS 500
#define HEADER_HO 0xEF
#define HEADER_LO 0x01
@@ -169,21 +168,14 @@ static inline uint8_t img2tz(uint8_t bufid)
uint8_t fpm_init(void)
{
uint8_t rc;
+ uint16_t dt = 0;
- UBRR0H = UBRRH_VALUE;
- UBRR0L = UBRRL_VALUE;
-#if USE_2X
- UCSR0A |= (1 << U2X0);
-#else
- UCSR0A &= ~(1 << U2X0);
-#endif
- UCSR0B = (1 << TXEN0) | (1 << RXEN0);
- UCSR0C = (1 << UCSZ01) | (1 << UCSZ00);
-
- _delay_ms(RST_DELAY_MS);
+ do {
+ rc = check_pwd();
+ _delay_ms(100);
+ dt += 100;
+ } while (rc == 0 && dt < 500);
- if ((rc = check_pwd()))
- fpm_led(OFF, NIL, 0);
return rc;
}