コード例 #1
0
ファイル: pwm.c プロジェクト: GumpYangchh/wuzhuangbo
 void timer2_init(TRIPLE_PWM_HW_PAUSE_EN_t hw_pause_en, TRIPLE_PWM_SW_PAUSE_EN_t sw_pause_en, uint16_t triple_pwm_frequency)
{
    timer2_enable(TRIPLE_PWM_ENABLED);      
    timer2_set_hw_pause(hw_pause_en);
    timer2_set_sw_pause(sw_pause_en);
    timer2_set_pwm_frequency(triple_pwm_frequency);
}
コード例 #2
0
ファイル: servo.c プロジェクト: chris8567/runin_v2
void SERVO_init(void){
	//timer0 initlization for auto scan.
	timer0_comp_init();
	timer2_init();
	SERVO_DDR |= (_BV(SERVO_ENA)|_BV(SERVO_DIR)|_BV(SERVO_PUL));
	SERVO_PORT |= (_BV(SERVO_ENA));
	SERVO_enable();
	
	servo_position_buffer = ucHoldingBuf[P_SERVO_POSITION_REG];

	timer2_enable();
}
コード例 #3
0
ファイル: pwm.c プロジェクト: GumpYangchh/wuzhuangbo
/**
 ****************************************************************************************
 * @brief  Stops timer2. Does not disable the TIM clock, as it is shared with TIMER0
 *
 * @param[in]  timer2_duty_cycle: PWM2 duty cycle
 ****************************************************************************************
 */
inline void timer2_stop(void)
{
    timer2_enable(TRIPLE_PWM_DISABLED);
}