Пример #1
0
void main() {
	HAL_Init_Hardware();
	APP_Init();
	HPL_ISR_GLOBAL_SET();
	while(1) {
		if(RunNextTask() == 0) {
			//SLEEP();
		}
	}
}
Пример #2
0
int main(void)
{
#if 0
    APP_Init();
    while(1);
#else    
    static int time_tick = 10; // 1S delay
    
	delay_init();
	NVIC_Configuration();
	
	delay_ms(500);
 	usb_port_set(0); 	//USB先断开
	delay_ms(300);
   	usb_port_set(1);	//USB再次连接
   	
 	USB_Interrupts_Config();    
 	Set_USBClock();   
 	USB_Init();

	while(1)
	{
        delay_ms(100);
        if((time_tick > 0) && (system_status == (SYS_STATUS_USB_OFF | SYS_STATUS_UPDATE_OFF)))
        {
            if(--time_tick <= 0)
            {
                time_tick = 0;
                system_info = SYS_EVENT_RUN_APP;
            }
        }
        
        (void)EventDispatch();
	};
    
#endif
}
Пример #3
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(); 
}    
Пример #4
0
static portTASK_FUNCTION(TaskMain, pvParameters ) {
  byte i;
#if PL_HAS_HW_LED
  byte cntr;
#endif
  
	/* The parameters are not used. */
	(void)pvParameters;
#if PL_HAS_WATCHDOG
	WDOG_Clear();
#endif
#if PL_HAS_HW_TOUCHSCREEN
  TouchScreen_CheckTouchScreenCalibrationData();
#endif
  BUZ_Init();
#if PL_HAS_UI
  APP_Init();
#endif
#if PL_HAS_HW_LED
  cntr = 0;
  LED3_On(); LED4_Off();
#endif
	for(;;) {
  #if PL_HAS_HW_TOUCHSCREEN
    TCHS1_Scan();
  #endif
  #if PL_POLL_KEYS2    
    KEY2_ScanKeys(); /* poll keys */
  #endif
    i = 10; /* to avoid stalling */
    while (EVNT1_EventsPending() && i>0) {
      EVNT1_HandleEvent();
      i--;
    }
  #if PL_HAS_HW_LED
    cntr++;
    if (cntr == 10) {  /* change LED's */
      LED3_Neg();
      LED4_Neg();
      cntr = 0;
    }
  #endif
#if PL_HAS_AUTO_DEMO
  #if PL_HAS_FONT_DEMO
    FRTOS1_vTaskDelay((2*1000)/portTICK_RATE_MS);
    APP_SetApplicationMode(APP_MODE_FONT_DEMO);
    FRTOS1_vTaskDelay((10*1000)/portTICK_RATE_MS);
  #endif
  #if PL_HAS_ACCEL_DEMO
    APP_SetApplicationMode(APP_MODE_ACCEL_DEMO);
    FRTOS1_vTaskDelay((15*1000)/portTICK_RATE_MS);
    ACCEL_StopAccelDemo();
    FRTOS1_vTaskDelay((2*1000)/portTICK_RATE_MS);
  #endif
  #if 0 && PL_HAS_TETRIS_DEMO
    APP_SetApplicationMode(APP_MODE_TETRIS);
    FRTOS1_vTaskDelay((5*1000)/portTICK_RATE_MS);
    TETRIS_KillTask();
    FRTOS1_vTaskDelay((2*1000)/portTICK_RATE_MS);
  #endif
  #if PL_HAS_CUBE_DEMO
    APP_SetApplicationMode(APP_MODE_3D_CUBE);
    FRTOS1_vTaskDelay((8*1000)/portTICK_RATE_MS);
    CUBE_CloseShipWindow();
    FRTOS1_vTaskDelay((2*1000)/portTICK_RATE_MS);
    CUBE_CloseCubeWindow();
    FRTOS1_vTaskDelay((2*1000)/portTICK_RATE_MS);
  #endif
    //APP_SetApplicationMode(APP_MODE_MAIN_MENU);
    //FRTOS1_vTaskDelay((5*1000)/portTICK_RATE_MS);
    heapSize = FRTOS1_xPortGetFreeHeapSize();
#endif
    FRTOS1_vTaskDelay(50/portTICK_RATE_MS);
	} /* for */
}
Пример #5
0
/////////////////////////////////////////////////////////////////////////////
// Main function
/////////////////////////////////////////////////////////////////////////////
int main(void)
{
  // initialize hardware and MIOS32 modules
#ifndef MIOS32_DONT_USE_SYS
  MIOS32_SYS_Init(0);
#endif
#ifndef MIOS32_DONT_USE_DELAY
  MIOS32_DELAY_Init(0);
#endif
#ifndef MIOS32_DONT_USE_TIMESTAMP
  MIOS32_TIMESTAMP_Init(0);
#endif
#ifndef MIOS32_DONT_USE_BOARD
  MIOS32_BOARD_Init(0);
#endif
#ifndef MIOS32_DONT_USE_SPI
  MIOS32_SPI_Init(0);
#endif
#ifndef MIOS32_DONT_USE_SRIO
  MIOS32_SRIO_Init(0);
#endif
#if !defined(MIOS32_DONT_USE_DIN) && !defined(MIOS32_DONT_USE_SRIO)
  MIOS32_DIN_Init(0);
#endif
#if !defined(MIOS32_DONT_USE_DOUT) && !defined(MIOS32_DONT_USE_SRIO)
  MIOS32_DOUT_Init(0);
#endif
#if !defined(MIOS32_DONT_USE_ENC) && !defined(MIOS32_DONT_USE_SRIO)
  MIOS32_ENC_Init(0);
#endif
#if !defined(MIOS32_DONT_USE_MF)
  MIOS32_MF_Init(0);
#endif
#if !defined(MIOS32_DONT_USE_AIN)
  MIOS32_AIN_Init(0);
#endif
#ifndef MIOS32_DONT_USE_IIC_BS
  MIOS32_IIC_BS_Init(0);
#endif
#ifndef MIOS32_DONT_USE_MIDI
  MIOS32_MIDI_Init(0);
#endif
#ifndef MIOS32_DONT_USE_USB
  MIOS32_USB_Init(0);
#endif
#ifndef MIOS32_DONT_USE_OSC
  MIOS32_OSC_Init(0);
#endif
#ifndef MIOS32_DONT_USE_COM
  MIOS32_COM_Init(0);
#endif
#ifndef MIOS32_DONT_USE_LCD
  MIOS32_LCD_Init(0);

# if defined(MIOS32_BOARD_MBHP_CORE_STM32) || defined(MIOS32_BOARD_MBHP_CORE_LPC17) || defined(MIOS32_BOARD_STM32F4DISCOVERY) || defined(MIOS32_BOARD_MBHP_CORE_STM32F4)
  // init second LCD as well (if available)
  MIOS32_LCD_DeviceSet(1);
  APP_LCD_Init(0);
  MIOS32_LCD_DeviceSet(0);
# endif
#endif
#ifdef MIOS32_USE_I2S
  MIOS32_I2S_Init(0);
#endif

  // call C++ constructors
  __libc_init_array();

  // initialize application
  APP_Init();

#if MIOS32_LCD_BOOT_MSG_DELAY
  // print boot message
# ifndef MIOS32_DONT_USE_LCD
  MIOS32_LCD_PrintBootMessage();
# endif

  // wait for given delay (usually 2 seconds)
# ifndef MIOS32_DONT_USE_DELAY
  int delay = 0;
  for(delay=0; delay<MIOS32_LCD_BOOT_MSG_DELAY; ++delay)
    MIOS32_DELAY_Wait_uS(1000);
# endif
#endif

  // start the task which calls the application hooks
  xTaskCreate(TASK_Hooks, (signed portCHAR *)"Hooks", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_HOOKS, NULL);
#if !defined(MIOS32_DONT_USE_MIDI)
  xTaskCreate(TASK_MIDI_Hooks, (signed portCHAR *)"MIDI_Hooks", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_HOOKS, NULL);
#endif

  // start the scheduler
  vTaskStartScheduler();

  // Will only get here if there was not enough heap space to create the idle task
  return 0;
}