本文整理汇总了C++中HAL_TIM_PWM_ConfigChannel函数的典型用法代码示例。如果您正苦于以下问题:C++ HAL_TIM_PWM_ConfigChannel函数的具体用法?C++ HAL_TIM_PWM_ConfigChannel怎么用?C++ HAL_TIM_PWM_ConfigChannel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HAL_TIM_PWM_ConfigChannel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPWMHeaterValue
/** \brief 设置加热PWM值
*
* \param index uint8_t 0-ex1; 1-bed; 2-ex2; 3-ex3
* \return uint16_t
*/
void setPWMHeaterValue(uint8_t index, uint8_t value)
{
TIM_OC_InitTypeDef TIM_InitStruct;
TIM_InitStruct.OCMode = TIM_OCMODE_PWM1;
TIM_InitStruct.OCPolarity = TIM_OCPOLARITY_HIGH;
TIM_InitStruct.OCFastMode = TIM_OCFAST_DISABLE;
TIM_InitStruct.Pulse = (uint32_t)value;
if (index == 0){
HAL_TIM_PWM_ConfigChannel(&TIM_PWM_HandleStruct, &TIM_InitStruct, TIM_CHANNEL_1);
}
#ifdef HEATBED_ENABLED
else if (index == 1){
HAL_TIM_PWM_ConfigChannel(&TIM_PWM_HandleStruct, &TIM_InitStruct, TIM_CHANNEL_2);
}
#endif
#ifdef EXTRUDER_2_ENABLED
else if (index == 2){
HAL_TIM_PWM_ConfigChannel(&TIM_PWM_HandleStruct, &TIM_InitStruct, TIM_CHANNEL_3);
}
#endif
#ifdef EXTRUDER_3_ENABLED
else if (index == 3){
HAL_TIM_PWM_ConfigChannel(&TIM_PWM_HandleStruct, &TIM_InitStruct, TIM_CHANNEL_4);
}
#endif
}
示例2: Steer_Pwm_Init
/**
* @brief 初始化舵机PWM.
* @param None
* @retval None
*/
void Steer_Pwm_Init(void){
//B0引脚定义
GPIO_InitTypeDef GPIO_InitStruct;
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_TIM3_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_0;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
//C7引脚定义
__HAL_RCC_GPIOC_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_7;
GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
//TIM3
TimHandleT3.Instance = TIM3;
TimHandleT3.Init.Period = 1000 - 1;;
TimHandleT3.Init.Prescaler = 1680-1;
TimHandleT3.Init.ClockDivision = 0;
TimHandleT3.Init.CounterMode = TIM_COUNTERMODE_UP;
HAL_TIM_PWM_Init(&TimHandleT3);
pwmConfig.OCMode=TIM_OCMODE_PWM1;
pwmConfig.Pulse=79;
HAL_TIM_PWM_ConfigChannel(&TimHandleT3, &pwmConfig, TIM_CHANNEL_2);
HAL_TIM_PWM_ConfigChannel(&TimHandleT3, &pwmConfig, TIM_CHANNEL_3);
HAL_TIM_PWM_Start(&TimHandleT3, TIM_CHANNEL_3);
HAL_TIM_PWM_Start(&TimHandleT3, TIM_CHANNEL_2);
}
示例3: LBF_PWM4_Ch34_Init
/*******************************************************************************
* @brief : Initialise and configure PWM of a Timer
* @param : Aucun.
* @return : Rien.
******************************************************************************/
void LBF_PWM4_Ch34_Init ( void )
{
// Derived from Cube MX code and STM32L152 project example in Cube Library package
// To set Prescaler and Pulse values:
// Prescaler = (TIMxCLK / Prescaled clock) - 1
// ARR Period = (Prescaled clock / Target PWM Fqcy) - 1
// TIM2 Channely duty cycle = (TIMx_CCRy/ TIMx_ARR + 1)* 100%
TIM_OC_InitTypeDef sConfigOC; // or NEEDS TO BE GLOBAL ????
// First, confirgure the TIM (timer) peripheral
htim4.Instance = TIM4;
htim4.Init.Prescaler = (HAL_RCC_GetPCLK1Freq()/1000000) - 1; // so prescaled clock always 1MHz
// Caution: TIM4CLK is 1x PCLK2 if APB1 prescaler=1 else is 2x -- see STM32 UserMan
htim4.Init.CounterMode = TIM_COUNTERMODE_UP;
htim4.Init.Period = 0 ; // Initial Value, Target Value to be set by Application
htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; // ie no division
HAL_TIM_PWM_Init(&htim4);
// Second, configure the PWM channel
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 0 ; // Initial Value, Target Value to be set by Application
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
HAL_TIM_PWM_ConfigChannel(&htim4, &sConfigOC, TIM_CHANNEL_3);
sConfigOC.Pulse = 0 ; // Initial Value, Target Value to be set by Application
HAL_TIM_PWM_ConfigChannel(&htim4, &sConfigOC, TIM_CHANNEL_4);
}
示例4: SC_TIM3_Init
/* TIM3 init function */
void SC_TIM3_Init(SERVO_CONTROLLER_Frequency frequency)
{
TIM_ClockConfigTypeDef sClockSourceConfig;
TIM_MasterConfigTypeDef sMasterConfig;
TIM_OC_InitTypeDef sConfigOC;
htim3.Instance = TIM3;
htim3.Init.Prescaler = CORE_FCLK / TIM_FCLK - 1;
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
htim3.Init.Period = (uint16_t)(TIM_FCLK / frequency); //should not exceed 0xFFFF
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
HAL_TIM_Base_Init(&htim3);
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
HAL_TIM_ConfigClockSource(&htim3, &sClockSourceConfig);
HAL_TIM_PWM_Init(&htim3);
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig);
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 0;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_1);
HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_2);
HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_3);
}
示例5: MX_TIM9_Init
/* TIM9 init function */
void MX_TIM9_Init(void)
{
TIM_ClockConfigTypeDef sClockSourceConfig;
TIM_OC_InitTypeDef sConfigOC;
htim9.Instance = TIM9;
htim9.Init.Prescaler = 167;
htim9.Init.CounterMode = TIM_COUNTERMODE_UP;
htim9.Init.Period = 19999;
htim9.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
HAL_TIM_Base_Init(&htim9);
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
HAL_TIM_ConfigClockSource(&htim9, &sClockSourceConfig);
HAL_TIM_PWM_Init(&htim9);
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 1500;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
HAL_TIM_PWM_ConfigChannel(&htim9, &sConfigOC, TIM_CHANNEL_1);
HAL_TIM_PWM_ConfigChannel(&htim9, &sConfigOC, TIM_CHANNEL_2);
}
示例6: MX_TIM2_Init
/* TIM2 init function */
void MX_TIM2_Init(void)
{
TIM_ClockConfigTypeDef sClockSourceConfig;
TIM_MasterConfigTypeDef sMasterConfig;
TIM_OC_InitTypeDef sConfigOC;
htim2.Instance = TIM2;
htim2.Init.Prescaler = 0;
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
htim2.Init.Period = 47;
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
HAL_TIM_Base_Init(&htim2);
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig);
HAL_TIM_PWM_Init(&htim2);
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig);
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 0;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_1);
HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_4);
HAL_TIM_MspPostInit(&htim2);
}
示例7: pwmout_write
void pwmout_write(pwmout_t* obj, float value) {
TIM_OC_InitTypeDef sConfig;
TimHandle.Instance = (TIM_TypeDef *)(obj->pwm);
if (value < (float)0.0) {
value = 0.0;
} else if (value > (float)1.0) {
value = 1.0;
}
obj->pulse = (uint32_t)((float)obj->period * value);
sConfig.OCMode = TIM_OCMODE_PWM1;
sConfig.OCFastMode = TIM_OCFAST_DISABLE;
sConfig.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfig.Pulse = obj->pulse;
if (obj->pin == PB_3) {
HAL_TIM_PWM_ConfigChannel(&TimHandle, &sConfig, TIM_CHANNEL_2);
HAL_TIM_PWM_Start(&TimHandle, TIM_CHANNEL_2);
}
if ((obj->pin == PB_4) || (obj->pin == PB_6)) {
HAL_TIM_PWM_ConfigChannel(&TimHandle, &sConfig, TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&TimHandle, TIM_CHANNEL_1);
}
}
示例8: init
void Fan::setSpeed(uint8_t fanspeed)
{
if (fan_init != 1){
init();
fan_init = 1;
}
TIM_OC_InitTypeDef TIM_InitStruct;
TIM_InitStruct.OCMode = TIM_OCMODE_PWM1;
TIM_InitStruct.OCPolarity = TIM_OCPOLARITY_HIGH;
TIM_InitStruct.OCFastMode = TIM_OCFAST_DISABLE;
TIM_InitStruct.Pulse = (uint32_t)fanspeed * 257;
fan_speed = fanspeed;
if (fan_index == 0){
HAL_TIM_PWM_ConfigChannel(&TIM_PWM_HandleStruct, &TIM_InitStruct, TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&TIM_PWM_HandleStruct, TIM_CHANNEL_1);
// HAL_TIM_PWM_ConfigChannel(&TIM_PWM_HandleStruct, &TIM_InitStruct, TIM_CHANNEL_3);
// HAL_TIM_PWM_Start(&TIM_PWM_HandleStruct, TIM_CHANNEL_3);
}
else if (fan_index == 1){
HAL_TIM_PWM_ConfigChannel(&TIM_PWM_HandleStruct, &TIM_InitStruct, TIM_CHANNEL_2);
HAL_TIM_PWM_Start(&TIM_PWM_HandleStruct, TIM_CHANNEL_2);
}
}
示例9: MX_TIM4_Init
/* TIM4 init function */
void MX_TIM4_Init(void)
{
TIM_MasterConfigTypeDef sMasterConfig;
TIM_OC_InitTypeDef sConfigOC;
htim4.Instance = TIM4;
htim4.Init.Prescaler = 49;
htim4.Init.CounterMode = TIM_COUNTERMODE_UP;
htim4.Init.Period = 19999;
htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
HAL_TIM_PWM_Init(&htim4);
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
HAL_TIMEx_MasterConfigSynchronization(&htim4, &sMasterConfig);
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 0;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
HAL_TIM_PWM_ConfigChannel(&htim4, &sConfigOC, TIM_CHANNEL_1);
HAL_TIM_PWM_ConfigChannel(&htim4, &sConfigOC, TIM_CHANNEL_2);
HAL_TIM_PWM_ConfigChannel(&htim4, &sConfigOC, TIM_CHANNEL_3);
HAL_TIM_PWM_ConfigChannel(&htim4, &sConfigOC, TIM_CHANNEL_4);
}
示例10: motorsbsp_init
void motorsbsp_init(void)
{
MOTORS_CLK;
// Configura os GPIOs do drive dos motores como sa�das push/pull
GPIO_InitTypeDef GPIO_InitStructure;
for (int i = 0; i < N_PINS; i++)
{
GPIO_InitStructure.Pin = MOTORES_PIN[i];
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStructure.Pull = GPIO_PULLUP;
GPIO_InitStructure.Speed = GPIO_SPEED_FAST;
HAL_GPIO_Init(MOTORES_PORT[i], &GPIO_InitStructure);
}
HAL_GPIO_WritePin(STBY_PORT, STBY_PIN, GPIO_PIN_SET);
// Configura os GPIOs de PWM como Alternate Function
GPIO_InitStructure.Pin = L_PWM_PIN;
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Speed = GPIO_SPEED_FAST;
GPIO_InitStructure.Alternate = PWM_AF_TIM;
HAL_GPIO_Init(L_PWM_PORT, &GPIO_InitStructure);
GPIO_InitStructure.Pin = R_PWM_PIN;
HAL_GPIO_Init(R_PWM_PORT, &GPIO_InitStructure);
// Time base PWM COnfig
// PWMf: f = [(168M / 2) / (PS + 1) ] / T
//TIM4 connected on APB1 and prescaller is 4 (the minimal!!) -> Pag. 67 - Reference Manual
/* (168M/4) */
// timer_tick_frequency = Timer_default_frequency / (prescaller_set + 1)
// ttf = 10500000
// PWM_frequency = (timer_tick_frequency / (TIM_Period + 1))
// PWMf = 10500
TimHandle.Instance = PWM_TIM;
TimHandle.Init.Period = PWM_PERIOD;
TimHandle.Init.Prescaler = PWM_PRESCALER;
TimHandle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
HAL_TIM_PWM_Init(&TimHandle);
// Output Compare - PWM
// TIM_Period = timer_tick_frequency / PWM_frequency - 1
// TIM_Period = 10500000 / 10500 = 1000
TIM_OC_InitTypeDef sConfig;
sConfig.OCMode = TIM_OCMODE_PWM1;
sConfig.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfig.OCFastMode = TIM_OCFAST_DISABLE;
sConfig.Pulse = 999;
HAL_TIM_PWM_ConfigChannel(&TimHandle, &sConfig, L_PWM_CHANNEL);
HAL_TIM_PWM_ConfigChannel(&TimHandle, &sConfig, R_PWM_CHANNEL);
HAL_TIM_PWM_Start(&TimHandle, L_PWM_CHANNEL);
HAL_TIM_PWM_Start(&TimHandle, R_PWM_CHANNEL);
}
示例11: POLOLU_MOTOR_Run_InIn
void POLOLU_MOTOR_Run_InIn(DRIVER_InitTypeDef *driver, MOTOR_InitTypeDef *motor, uint32_t mode, uint32_t speed)
{
if (mode == MOTOR_IN_IN_BREAK)
{
POLOLU_MOTOR_Break_InIn(driver, motor);
return;
}
TIM_OC_InitTypeDef sConfigOC;
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
switch (mode)
{
case MOTOR_IN_IN_COAST:
HAL_TIM_PWM_Stop(motor->htimIn1, motor->ChannelIn1);
HAL_TIM_PWM_Stop(motor->htimIn2, motor->ChannelIn2);
motor->GPIOxIn1->BSRR = (uint32_t)(motor->PinIn1) << 16;
motor->GPIOxIn2->BSRR = (uint32_t)(motor->PinIn2) << 16;
break;
case MOTOR_IN_IN_REVERSE_COAST:
HAL_TIM_PWM_Stop(motor->htimIn1, motor->ChannelIn1);
motor->GPIOxIn1->BSRR = (uint32_t)(motor->PinIn1) << 16;
sConfigOC.Pulse = count_pulse(motor->htimIn2->Init.Period, speed);
HAL_TIM_PWM_ConfigChannel(motor->htimIn2, &sConfigOC, motor->ChannelIn2);
HAL_TIM_MspPostInit(motor->htimIn2);
HAL_TIM_PWM_Start(motor->htimIn2, motor->ChannelIn2);
break;
case MOTOR_IN_IN_FORWARD_COAST:
HAL_TIM_PWM_Stop(motor->htimIn2, motor->ChannelIn2);
motor->GPIOxIn2->BSRR = (uint32_t)(motor->PinIn2) << 16;
sConfigOC.Pulse = count_pulse(motor->htimIn1->Init.Period, speed);
HAL_TIM_MspPostInit(motor->htimIn1);
HAL_TIM_PWM_Start(motor->htimIn1, motor->ChannelIn2);
break;
case MOTOR_IN_IN_REVERSE:
HAL_TIM_PWM_Stop(motor->htimIn2, motor->ChannelIn2);
motor->GPIOxIn2->BSRR = motor->PinIn2;
sConfigOC.Pulse = count_pulse(motor->htimIn1->Init.Period, speed);
HAL_TIM_MspPostInit(motor->htimIn1);
HAL_TIM_PWM_Start(motor->htimIn1, motor->ChannelIn2);
break;
case MOTOR_IN_IN_FORWARD:
HAL_TIM_PWM_Stop(motor->htimIn1, motor->ChannelIn1);
motor->GPIOxIn1->BSRR = motor->PinIn1;
sConfigOC.Pulse = count_pulse(motor->htimIn2->Init.Period, speed);
HAL_TIM_PWM_ConfigChannel(motor->htimIn2, &sConfigOC, motor->ChannelIn2);
HAL_TIM_MspPostInit(motor->htimIn2);
HAL_TIM_PWM_Start(motor->htimIn2, motor->ChannelIn2);
}
}
示例12: Motors_stop
/**********************************************************
* @brief Motors_stop
* @param Direction and speed of the motor (0 to 100)
* @retval None
**********************************************************/
void Motors_stop(void)
{
TIMER_OC_InitStruct.Pulse = 0;
HAL_TIM_PWM_ConfigChannel(&TIMER_InitStruct, &TIMER_OC_InitStruct, TIM_CHANNEL_3);
HAL_TIM_PWM_ConfigChannel(&TIMER_InitStruct, &TIMER_OC_InitStruct, TIM_CHANNEL_4);
HAL_TIM_PWM_Start(&TIMER_InitStruct,TIM_CHANNEL_3);
HAL_TIM_PWM_Start(&TIMER_InitStruct,TIM_CHANNEL_4);
s_motorRight.speed = 0;
s_motorLeft.speed = 0;
}
示例13: pwm_set
void pwm_set(PWM_NAME pwm, int32_T val)
{
int32_T period = 0;
/* 参数检查 */
if(pwm > PWM_MAX)
{
ERR_STR("参数错误.");
}
/* 限制val在有效值范围内 [0,period] */
period = pwm_get_period();
if(val < 0)
{
val = 0;
}
if(val > period)
{
val = period;
}
/* 修改占空比 */
s_sConfig.Pulse = val;
if (HAL_TIM_PWM_ConfigChannel(&s_tim_handle, &s_sConfig, g_pwm_ch_list[pwm].ch) != HAL_OK)
{
ERR_STR("执行失败.");
}
/* 启动PWM */
if (HAL_TIM_PWM_Start(&s_tim_handle, g_pwm_ch_list[pwm].ch) != HAL_OK)
{
ERR_STR("执行失败.");
}
}
示例14: POLOLU_MOTOR_Run_EnablePhase
void POLOLU_MOTOR_Run_EnablePhase(DRIVER_InitTypeDef *driver, MOTOR_InitTypeDef *motor, uint32_t mode, uint32_t speed)
{
switch (mode)
{
case MOTOR_ENABLE_PHASE_FORWARD:
motor->GPIOxIn1->BSRR = motor->PinIn1;
break;
case MOTOR_ENABLE_PHASE_REVERSE:
motor->GPIOxIn1->BSRR = (uint32_t)(motor->PinIn1) << 16;
break;
case MOTOR_ENABLE_PHASE_BREAK:
POLOLU_MOTOR_Break_EnablePhase(driver, motor);
return;
}
uint32_t pulse = count_pulse(motor->htimIn2->Init.Period, speed);
TIM_OC_InitTypeDef sConfigOC;
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = pulse;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
HAL_TIM_PWM_ConfigChannel(motor->htimIn2, &sConfigOC, motor->ChannelIn2);
HAL_TIM_MspPostInit(motor->htimIn2);
HAL_TIM_PWM_Start(motor->htimIn2, motor->ChannelIn2);
}
示例15: MX_TIM10_Init
/* TIM10 init function */
void MX_TIM10_Init(void)
{
TIM_OC_InitTypeDef sConfigOC;
htim10.Instance = TIM10;
htim10.Init.Prescaler = 0;
htim10.Init.CounterMode = TIM_COUNTERMODE_UP;
htim10.Init.Period = 0;
htim10.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
if (HAL_TIM_Base_Init(&htim10) != HAL_OK)
{
Error_Handler();
}
if (HAL_TIM_PWM_Init(&htim10) != HAL_OK)
{
Error_Handler();
}
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 0;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
if (HAL_TIM_PWM_ConfigChannel(&htim10, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
{
Error_Handler();
}
HAL_TIM_MspPostInit(&htim10);
}