示例#1
0
Car::Car()
		: m_leds{Led(0), Led(1), Led(2), Led(3)},
		  m_uart(3, 115200),
		  m_motor1(0), m_motor2(1),
#ifdef LIBSC_USE_CAMERA
		  m_cam(CAM_W, CAM_H),
#endif
		  m_accel(RXADC),
		  m_lcd(true),
		  m_start_button(0),
		  m_joystick(0),
		  m_balancevolt(LIBSC_VOLT)
{
#ifdef LIBSC_USE_UART
	m_uart.StartReceive();
	libutil::InitDefaultFwriteHandler(&m_uart);
#endif

#ifdef LIBSC_USE_CAMERA
	while (!m_cam.Init())
	{
		LOG_E("Camera f****d up!!!!!");
		DELAY_MS(250);
	}
	m_cam.ShootContinuously();
#endif

#ifdef LIBSC_USE_K60_ENCODERS
	FTM_QUAD_Init(FTM1);
	FTM_QUAD_Init(FTM2);
#endif
}
示例#2
0
void FTM_init()
{   
    FTM_QUAD_Init(FTM1);
    FTM_QUAD_Init(FTM2);

    FTM_PWM_init(FTM0,FTM_CH0,20*1000,0);//leftMotorDeadDutyA:340
    FTM_PWM_init(FTM0,FTM_CH1,20*1000,0);//leftMotorDeadDutyB:590
    FTM_PWM_init(FTM0,FTM_CH2,20*1000,0);//rightMotorDeadDutyA:530
    FTM_PWM_init(FTM0,FTM_CH3,20*1000,0);//rightMotorDeadDutyB:380

}
示例#3
0
文件: main.c 项目: Needrom/Freescale
void Device_init()
{       
        gpio_init(PTC11,GPI,1);                                         //拨码开关5
        gpio_init(PTC12,GPI,1);                                         //拨码开关4
        gpio_init(PTC13,GPI,1);                                         //拨码开关3
        gpio_init(PTC15,GPI,1);                                         //拨码开关2
        gpio_init(PTD2,GPI,1);                                          //拨码开关1
        gpio_init(PTD1,GPO,1);						//三个指示灯依次亮起
        gpio_init(PTD3,GPO,1);
        gpio_init(PTD4,GPO,1);						//每进入一次初始化PTD4灯灭,初始化完成亮起
        gpio_init(PTC5,GPO,1);
        gpio_init(PTC4,GPI,0);                                          //干簧管

	FTM_PWM_init(FTM1,FTM_CH0,50,angle_to_period(0));				//舵机初始化,从百分之十占空比到百分之七十占空比测试
	
	FTM_PWM_init(FTM0,FTM_CH1,10000,0);			//电机pwm初始化
	FTM_PWM_init(FTM0,FTM_CH2,10000,0);
	
	//FTM_PWM_init(FTM2,FTM_CH0,3000000,93000);		//编码器初始化
	//FTM_PWM_init(FTM2,FTM_CH1,3000000,93000);
          FTM_QUAD_Init(FTM2);							//初始化为正交解码
	LCD_Init();
     
     PIT_init();
    gpio_set(PTD4,1);
}