Exemplo n.º 1
0
void InitDevice(void)
{
    IntDisableAll();
    WDT_INIT();
    Digitals_Init();  
    ItcInit();
    NVM_FlashInit();
    CRM_Init();  
    TMR_Init();
    ASM_Init();
    UART1_Init();
    UART2_Init();
    SPI_Init();
    MACA_Init(); 
    
///    DMAP_ResetStack(0);
  // WirelessHART Stack Initialisation
    NVM_ReadRecords(); // persistent data reading
    APP_Init();
    DLL_Init();   // reset the modem inside
    TL_Init();
    NET_Init();
    HART_DLL_Init(HART_ROLE_DECIDED);
  
  #if ( SHT1X_MODE != 0 )
    SHT1x_INIT();
  #endif
 
  #if ( (BOARD_TYPE == BOARD_TYPE_HART_DEV_KIT) )
    #if (!defined (IS_VN220))
      ADC_Extern_Init();
    #endif
  #endif
    
    IntEnableAll(); 
}    
Exemplo n.º 2
0
///////////////////////////////////////////////////////////////////////////////////
// Name: MAIN Function
///////////////////////////////////////////////////////////////////////////////////
  void main(void)
  {
    IntDisableAll();
  
    WDT_INIT();  
             
    Digitals_Init();
   
    ItcInit();
    
    NVM_FlashInit();
    
    CRM_Init();  
        
    TMR_Init();
    ASM_Init();
    UART1_Init();
    UART2_Init();
    SPI_Init();
    
    PROVISION_Init();
        
    MACA_Init(); 
    
    DAQ_Init();
        
    DMAP_ResetStack(0);
    
    IntEnableAll();
    
    //--------------------------------------------------------------------
    // Main Loop
    //--------------------------------------------------------------------
    for (;;)
    {           
        NLDE_Task();        // as fast as possible, keep this task first on loop
  
        DMAP_Task();        //
        ASLDE_ASLTask();    //
 
        UART_LINK_Task();   //
        UART2_CommControl();
        
        DAQ_RxHandler();
        
        if( g_uc250msFlag ) // 250ms Tasks
        {
            g_uc250msFlag = 0;
            
            // Handle DAQ after all other stack related tasks.
            DAQ_TxHandler();            
            UAP_MainTask();     
            
            ARMO_Task();
            
            if( !g_stTAI.m_uc250msStep ) // first 250ms slot from each second -> 1sec Tasks
            {
                ASLDE_PerformOneSecondOperations();
                DMAP_DMO_CheckNewDevInfoTTL();
    
                DMAP_CheckSecondCounter();
                
                ARMO_OneSecondTask();
    
                SLME_KeyUpdateTask();
                
                DMO_PerformOneSecondTasks();  
                
                MACA_WachDog();
            }
        }

        FEED_WDT();
    }
  }