From 8b5d8e578d8244e330e93c717e4e47ad0963dbd5 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Fri, 9 Jan 2015 05:12:31 +0100 Subject: lightctrl: factor out startup routine --- helpers.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 helpers.c (limited to 'helpers.c') diff --git a/helpers.c b/helpers.c new file mode 100644 index 0000000..a24e8fc --- /dev/null +++ b/helpers.c @@ -0,0 +1,26 @@ + +static void postinit_slowboot(void) +{ + sei(); + + uart_puts("\nreset from"); + if (MCUSR & (1 << WDRF)) + uart_puts(" WDT"); + if (MCUSR & (1 << BORF)) + uart_puts(" BO"); + if (MCUSR & (1 << EXTRF)) + uart_puts(" EXT"); + if (MCUSR & (1 << PORF)) + uart_puts(" POR"); + MCUSR = 0; + + uart_puts("\nwdt_generation "); + uart_puthex(wdt_generation); + + uart_puts("\ndelay...\n"); + wdt_reset(); + _delay_ms(1000); + wdt_reset(); + uart_puts("\ninit done\n"); +} + -- cgit v1.2.1