示例#1
0
void setup()
{
	setupSystemClock();
	setup_system_tick(SYSTEM_TICK_FREQ);
	setupUART();
#ifdef GPS
	setupGPS();
#endif
	I2C_Init();
	FlashInit();
	UpdateBoardVersion(false);
#ifdef OPTION_RC
	RC_Init();
	if(IsSSVConnected())
		Battery_Init();
	LED_Init();
	TIMER_Init();
	stabilizerInit();
#endif
#ifdef ABROBOT
  ABRobotMotorInit();
#endif
	nvtAHRSInit();
	SensorsInit();
	ChronographSet(ChronMain);
}
示例#2
0
void setup()
{
    int i;
	
	setupSystemClock();
	setupUART();
	setup_system_tick(SYSTEM_TICK_FREQ);
	ID_Init();  // MO: Is it also system init?
	GetID();

	/* Init AHRS I2C */
	/* ----Initialize I2C slave mode--- */
	if(devNum == 0)
		I2C_MS_Master_Init();
	else
		I2C_MS_Slave_Init();

	//I2CWakeUpInit();

	TIDMstFirstInitFIN = 0;
	TIDMstInitFIN = 0;
	TIDMstStage = 0;
	TIDMstInitDevState = 1;
	FlashInit();

    // Setup function pointers for default sensor boards.
	for(i=0; i<MAX_TID_DEV; i++)
	{
		if (pTidList[i])
		SetDeviceFunction(pTidList[i], &(pfnDevFunc[i]));
	}


    // Call board init function
    if (pTidList[devNum]->func.pfnSetup)
        pTidList[devNum]->func.pfnSetup();
    
    // Load TID feature from flash
    GetFlashTID(&(pTidList[devNum]->Feature), devNum);
    
    // Set Timer1 to (1000/value) in (Hz)
    Timer1Init(1000 / (pTidList[devNum]->Feature.data1.value)); 
    
    /* TID initialize */
	SlvDataInit();
	MstDataInit();
}
示例#3
0
文件: main.c 项目: yanyu130/JRW_4
void setup()
{
	uint8_t i=0;
	//初始化系统时钟
	setupSystemClock();
	
	//初始化串口
	setupUART();
	UART_NVIC_INIT();

	//初始化System_tick
	setup_system_tick(SYSTEM_TICK_FREQ);
	
	//初始化IIC
	I2C_Init();
	
	//初始化FLASH
	FlashInit();
	LoadParamsFromFlash();
	
	//初始化低电压检测
	BatteryCheckInit();
	
	//初始化遥控
	Comm_Init();
	
	//初始化LED
	LED_Init();
	
	//初始化SENSOR
	#ifdef IMU_SW											//软件姿态解算
	//	MPU6050_initialize();
	//	DelayMsec(1000);			//必须加延迟,否则读取陀螺仪数据出错
	#else
		MPU6050_initialize();
		DelayMsec(1000);			//必须加延迟,否则读取陀螺仪数据出错
		MPU6050_DMP_Initialize();     //初始化DMP引擎
	#endif
	
	//初始化自稳定
	
//	LED_ON();
//	//测试用,延迟启动时间
//	for(i=0;i<6;i++)
//	{
//		DelayMsec(1000);
//		LED_OFF();
//	}
		
	
	//初始化电机
	Motor_Init();
	
	//printf("Motor_Init(); \n");
	
	//IMU_Init();			// sample rate and cutoff freq.  sample rate is too low now due to using dmp.
	
//	printf("\n\nCPU @ %dHz\n", SystemCoreClock);
	//MotorPwmOutput(100,100,0,0);

}