Ejemplo n.º 1
0
void mico_system_monitor_thread_main( void* arg )
{
  (void)arg;
  
  while (1)
  {
    int a;
    uint32_t current_time = mico_get_time();
    
    for (a = 0; a < MAXIMUM_NUMBER_OF_SYSTEM_MONITORS; ++a)
    {
      if (system_monitors[a] != NULL)
      {
        if ((current_time - system_monitors[a]->last_update) > system_monitors[a]->longest_permitted_delay)
        {
          /* A system monitor update period has been missed */
          while(1);
        }
      }
    }
    
    MicoWdgReload();
    mico_thread_msleep(DEFAULT_SYSTEM_MONITOR_PERIOD);
  }
}
Ejemplo n.º 2
0
//tmr.delay()
static int ltmr_delay( lua_State* L )
{
  uint32_t ms = luaL_checkinteger( L, 1 );
  if ( ms <= 0 ) return luaL_error( L, "wrong arg range" );
  
  uint32_t delay_start = mico_get_time();
  while(1)
  {
     MicoWdgReload();
     if(mico_get_time() >= delay_start + ms) break;
  }
  return 0;
}
Ejemplo n.º 3
0
static void _watchdog_reload_timer_handler( void* arg )
{
  (void)(arg);
  MicoWdgReload();
}
Ejemplo n.º 4
0
static s32_t lspiffs_erase(u32_t addr, u32_t size) {
    MicoFlashErase(MICO_FLASH_FOR_LUA,addr,addr+size-1);
    MicoWdgReload();//in case wathdog
    return SPIFFS_OK;
  } 
Ejemplo n.º 5
0
//tmr.wdclr()
static int ltmr_wdclr( lua_State* L )
{
  MicoWdgReload();
  return 0;
}