示例#1
0
int main(void)
{
  Task_t tasks[3];              // Create our task objects!

  /* Watchdog timer disabled */
  WDTCTL = WDTPW + WDTHOLD;
  
  BspInit();    // Set up
  UartInit(9600, UartCbf);
  
  (void)TimerMasterInit(100); 

  LedCtor(&led_red,   kPort1, kPin0); //P1.0 (red)
  LedCtor(&led_green, kPort1, kPin1); //P1.1 (green)

  ButtonCtor(&button_small, kPort1, kPin2, kResHigh, 1); // 1ms debounce

  TaskTimedCtor(&tasks[0],      LedRedFlash,  6, 0);
  TaskLoopCtor( &tasks[1], ManageLoop);
  TaskLoopCtor( &tasks[2],   UartStep);

  __eint();        // Enable global interrupts
  
  TaskMasterRun(tasks, 3);
  while(true) 
  {
  }
}
示例#2
0
int main(void)
{
  Timer_t timer;                // Create our timer object!
  Led_t led;                    // Create the LED Object on P1.0! 

  /* Watchdog timer disabled */
  WDTCTL = WDTPW + WDTHOLD;
  
  BspInit();    // Set up
  
  (void) TimerMasterInit(100); //100 *10us = 1ms
  
  TimerCtor(&timer);  
  LedCtor(&led, kPort1, kPin0); //P1.0 (red)

  __eint();        // Enable global interrupts
  while(true)
  {
    if (TimerGet(&timer)>100)  // 0.2s period (1ms*20)
    {
      LedToggle(&led);
      TimerReset(&timer);
    }
  }
}
示例#3
0
int main(void)
{
  /* Watchdog timer disabled */
  WDTCTL = WDTPW + WDTHOLD;
  
  BspInit();

  DioInit();
  DioSet(BUTTON0);
  UartInit(9600, UartCallback);

  LedInit();

  ButtonInit();
  ButtonSetup(0, Button0Cbf, 20);

  LedOn(0);

  SchedulerInit(100, 1, 2); // 1ms tick, 1 timed task, 2 loop task
  SetSchedulerTimedTask(LedRedFlash, 0, 500, 0); // schedule timed_task[0] as led_red_flash, set off every 500ms
  SetSchedulerLoopTask(ButtonLoop, 0); // schedule loop_task[0] as button_loop
  SetSchedulerLoopTask(UartManage, 1); // schedule loop_task[1] as uart_loop

  __eint();
  SchedulerRun();
  
  while(1)
  {
  }
}
示例#4
0
int main(void)
{		
    u8 flg = 0;
    
    BspInit();
    CommonInit();

    while(1)
    {
        CommonExec();
        if (IS_TIMEOUT_1MS(eTim1, 500))
        {
            flg? led_on(0): led_off(0);
            flg = !flg;
        }
    };
}
示例#5
0
int main(void)
{
  /* Watchdog timer disabled */
  WDTCTL = WDTPW + WDTHOLD;
  
  BspInit();
  DioInit();
  TimerInit(10);                         // 0.1ms tick, 1 timed task, 0 loop task
  WRITE_SR(GIE);       // Enable global interrupts
  __eint();
  LcdInit();

  BspReset();         // if ever we get here, we have nothing better to do but reset the micro
  while(1)
  {
  }
}
示例#6
0
/*----------------------------------------------------------------------------
 *  Main: Initialize and start RTX Kernel
 *---------------------------------------------------------------------------*/
int main (void) 
{
	int i1=0;
	int j1=0;
	
	uint8_t write_buf[128]={0};
	uint8_t read_buf[128]={0};
	uint8_t i=0;
	uint32_t err_count=0;
	uint32_t ok_count=0;
	int tmp=0;	

	SystemClockInit();						// 内部8M时钟初始化 主频36M

	BspInit();									// 板级初始化

	User_NVIC_Configuration();	// 中断向量表初始化, bootloader与APP的中断向量 配置
	RTC_RX8025_Init();

	os_sys_init(task_init);                    /* Initialize RTX and start init    */
}
示例#7
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f10x_xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f10x.c file
     */   
 
    BspInit();

    /* Infinite loop */
    while ( 1 )
    {	
        /*ÂÖѯ*/  
        LwIP_Periodic_Handle(LocalTime);		          	  
    }
          
    //return 0;

}
示例#8
0
int main(void)
{
  /* Watchdog timer disabled */
  WDTCTL = WDTPW + WDTHOLD;
  
  BspInit();    // Set up
  
  TimerInit(); 

  LedCtor(&led,   kPort1, kPin5); //P1.5 (red)

  ToggleLed();
  __eint();        // Enable global interrupts
  
  while(true)
  {
    if (tog == 1) //1 second
    {
      tog = 0;
      ToggleLed();
    }
  }
}
示例#9
0
/*******************************************************************************
* Function Name  : main
* Description    : Main program.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
int main(void)
{
		u32 i=0;
	
	while(1)
	{
		i++;
		if(i>3*MHZ)
			break;
	}

#ifdef DEBUG
    debug();
#endif
    
    BspInit();	
    CommonInit();
		FLASH_Unlock();
		LedOff(LED_5);
    while (1)
    {
        CommonExec();
    }
}