fix(bsp/st/driver): Fix bugs in STM32 PIN and PWM device drivers.

1.Fixed the bug where PIN was missing an if judgment condition(thanks to 'Zuosir').
2.Fix the PWM parameter detection error (Thanks to '决浮云').
This commit is contained in:
MacRsh
2025-08-13 22:51:54 +08:00
parent c945804480
commit d1af97b42d
2 changed files with 3 additions and 3 deletions

View File

@@ -192,7 +192,7 @@ static int drv_pin_configure(struct mr_pin *pin, int number, int mode)
{
HAL_NVIC_DisableIRQ(pin_irq_map[exti_line]);
}
} else
} else if ((exti_line >= 10) && (exti_line <= 15))
{
if ((pin_irq_mask[10] == -1) &&
(pin_irq_mask[11] == -1) &&

View File

@@ -303,7 +303,7 @@ static int drv_pwm_read(struct mr_pwm *pwm, int channel, uint32_t *compare_value
uint32_t Channel = (channel - 1) << 2;
#ifdef MR_USING_PWM_CHANNEL_CHECK
if ((Channel & TIM_CHANNEL_ALL) || (Channel == 0))
if (Channel & TIM_CHANNEL_ALL)
{
return MR_EINVAL;
}
@@ -319,7 +319,7 @@ static int drv_pwm_write(struct mr_pwm *pwm, int channel, uint32_t compare_value
uint32_t Channel = (channel - 1) << 2;
#ifdef MR_USING_PWM_CHANNEL_CHECK
if ((Channel & TIM_CHANNEL_ALL) || (Channel == 0))
if (Channel & TIM_CHANNEL_ALL)
{
return MR_EINVAL;
}