Beispiel #1
0
//------------------------------------------------------------------------------
/// Interrupt service routine for the system tick. Debounces the wake-up pin input.
//------------------------------------------------------------------------------
void SysTick_Handler(void)
{
    // Button released
    if (PIO_Get(&pinWakeUp)) 
    {

        debounceCounter = DEBOUNCE_TIME;
    }
    // Button still pressed
    else 
    {

        debounceCounter--;
    }

    // End of debounce time
    if (debounceCounter == 0) 
    {

        // Disable debounce timer
        SysTick_Configure(1, BOARD_MCK/1000, 0);

        debounceCounter = DEBOUNCE_TIME;
        HIDDMouseDriver_RemoteWakeUp();
    }
}
Beispiel #2
0
/*
*********************************************************************************************************
*                                            App_StartTask()
*
* Description : 系统任务初始化
*
* Argument(s) : pdata.
*
* Return(s)   : none.
*********************************************************************************************************
*/
static void App_StartTask(void *pdata)
{
	(void)pdata;

	//创建事件
	App_EventCreate();
	//系统滴答设置
	SysTick_Configure();
	//机器人系统初始化
	RobotSystemInit();
	//创建任务
	App_TaskCreate();
	
	 //挂起任务
	 OSTaskSuspend(4); //超声波避障任务
	 OSTaskSuspend(5); //机器人防跌落(PD:  Prevent Drop)
	 OSTaskSuspend(6); //机器人动作任务挂起和恢复
// 	 OSTaskSuspend(7); //GLWP: Get the Legs and Waist Position//储存膝关节位置信息,用于指导机器人摆臂
// 	 OSTaskSuspend(8); //串口接收任务
// 	 OSTaskSuspend(9); //动作执行任务(RW: Robot Walk)
// 	 OSTaskSuspend(10); //动作步骤任务(RFS: Robot Forward Step)
//	 OSTaskSuspend(11); //动作步骤任务(RBS: Robot Backward Step)
//	 OSTaskSuspend(12); //右臂复位任务(RRA: Reset Right Arm)
//	 OSTaskSuspend(13); //左臂复位任务(RLA: Reset Left Arm)
//	 OSTaskSuspend(14); //右摆臂任务(SRA: Swing Right Arm)
//	 OSTaskSuspend(15); //左摆臂任务(SLA: Swing Left Arm)	
//	 OSTaskSuspend(16); //摆腰任务(SW: Swing Waist)
	 OSTaskSuspend(17); //左右手腕和头部转动任务(SteerWork:Steer control)
//	 OSTaskSuspend(18); //眼睛任务(EE: Eye Expression)
//	 OSTaskSuspend(19); //LED任务(LED:decorative lighting)
//	 OSTaskSuspend(20); //LED任务(LED:decorative lighting)
//挂起自己
	 OSTaskDel(OS_PRIO_SELF);
}
Beispiel #3
0
static void init(void) {
	const Pin pinsDbgu[] = {PINS_DBGU};
    
	PMC_EnablePeripheral(AT91C_ID_DBGU);
	PIO_Configure(pinsDbgu, PIO_LISTSIZE(pinsDbgu));
    DBGU_Configure(AT91C_US_PAR_NONE, 115200, BOARD_MCK);
	SysTick_Configure(1, BOARD_MCK / 1000, SysTick_Handler);
}
Beispiel #4
0
//------------------------------------------------------------------------------
/// Configures the SYS Tisk to generate 1ms ticks.
//------------------------------------------------------------------------------
static void ConfigureSysTick(void)
{
    // 1ms System Tick
    SysTick_Configure(1, BOARD_MCK/1000, SysTick_Handler);
}
Beispiel #5
0
int main()
{
	
    TRACE_CONFIGURE(DBGU_STANDARD, 115200, BOARD_MCK);
    printf("-- USB Device CDC Serial Project %s --\n\r", SOFTPACK_VERSION);
    printf("-- %s\n\r", BOARD_NAME);
    printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__);

    // If they are present, configure Vbus & Wake-up pins
    //PIO_InitializeInterrupts(0);
	
	//-------- Init parameters --------------
	printf("INIT Parameters\n\r");
	init_parameters();
	
	//-------- Load parameters from Flash --------------
	printf("Load parameters from Flash\n\r");
	FLASH_LoadSettings();
	
    //-------- Init UART --------------
	printf("USB Seriel INIT\n\r");
	samserial_init();
	
	//-------- Init ADC without Autostart --------------
	printf("Init ADC\n\r");
    initadc(0);
	
	//-------- On USB recived byte call this function --------------
	printf("Init Callback for USB\n\r");
    samserial_setcallback(&usb_characterhandler);
	
	//-------- Init Motor driver --------------
	printf("Init Motors\n\r");
    motor_setup();
	
	//-------- Init Heater I/O  --------------
	printf("Init Heaters\n\r");
    heaters_setup();
	
    //-------- Start SYSTICK (1ms) --------------
	printf("Configuring systick.\n\r");
	SysTick_Configure(1, BOARD_MCK/1000, SysTick_Handler);
	
	//-------- Timer 0 for Stepper --------------
	printf("Init Stepper IO\n\r");
    stepper_setup();	//Timer for Stepper


	//-------- Timer 0 for Stepper --------------
	printf("Configuring Timer 0 Stepper\n\r");
    ConfigureTc0_Stepper();	//Timer for Stepper
	
	//-------- Timer 1 for heater PWM --------------
	printf("Configuring Timer 1 PWM.\n\r");
	ConfigureTc_1();

	//-------- Init Planner Values --------------
	printf("Plan Init\n\r");
	plan_init();
	
	//-------- Check for SD card presence -------
//	sdcard_handle_state();
	
	//motor_enaxis(0,1);
    //motor_enaxis(1,1);
	while (1)
	{
  		//uncomment to use//sprinter_mainloop();
    	//main loop events go here

		do_periodic();
    	
		if(buflen < (BUFSIZE-1))
			get_command();

    	if(buflen > 0)
		{
			
			//-------- Check and execute G-CODE --------------
			process_commands();

			//-------- Increment G-Code FIFO  --------------
			buflen = (buflen-1);
			bufindr++;
			if(bufindr == BUFSIZE) bufindr = 0;
			
		}
		  
    }
}