Update tmr.c

This commit is contained in:
Kirill 2015-04-07 23:27:15 +05:00
parent 263179ea14
commit 77d2d14c2e
1 changed files with 2 additions and 10 deletions

View File

@ -71,15 +71,7 @@ static int tmr_delay( lua_State* L )
us = luaL_checkinteger( L, 1 ); us = luaL_checkinteger( L, 1 );
if ( us <= 0 ) if ( us <= 0 )
return luaL_error( L, "wrong arg range" ); return luaL_error( L, "wrong arg range" );
unsigned sec = (unsigned)us / 1000000; os_delay_us( us );
unsigned remain = (unsigned)us % 1000000;
int i = 0;
for(i=0;i<sec;i++){
os_delay_us( 1000000 );
WRITE_PERI_REG(0x60000914, 0x73);
}
if(remain>0)
os_delay_us( remain );
return 0; return 0;
} }