From 5be58d553a8823cdcc57448c1fc331edf2a121a4 Mon Sep 17 00:00:00 2001 From: Kirill Date: Wed, 8 Apr 2015 15:31:40 +0500 Subject: [PATCH] Update tmr.c Adding watchdog clear for tmr.delay --- app/modules/tmr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/modules/tmr.c b/app/modules/tmr.c index 3cefb824..bc021304 100644 --- a/app/modules/tmr.c +++ b/app/modules/tmr.c @@ -72,6 +72,9 @@ static int tmr_delay( lua_State* L ) if ( us <= 0 ) return luaL_error( L, "wrong arg range" ); os_delay_us( us ); + // Adding watchdog clear to avoid reboot. + // May be it is good to add a simple check for delay value > 500 to clear it every 500 us. + WRITE_PERI_REG(0x60000914, 0x73); return 0; }