Merge pull request #2068 from yangjie11/stm32-dev
[bsp][stm32 hal drv_gpio] add more settings for "GPIO_InitStruct.Pull"
This commit is contained in:
commit
b9261e4340
|
@ -487,17 +487,19 @@ static rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
|
||||||
|
|
||||||
/* Configure GPIO_InitStructure */
|
/* Configure GPIO_InitStructure */
|
||||||
GPIO_InitStruct.Pin = index->pin;
|
GPIO_InitStruct.Pin = index->pin;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||||
switch (pin_irq_hdr_tab[irqindex].mode)
|
switch (pin_irq_hdr_tab[irqindex].mode)
|
||||||
{
|
{
|
||||||
case PIN_IRQ_MODE_RISING:
|
case PIN_IRQ_MODE_RISING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
||||||
break;
|
break;
|
||||||
case PIN_IRQ_MODE_FALLING:
|
case PIN_IRQ_MODE_FALLING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||||
break;
|
break;
|
||||||
case PIN_IRQ_MODE_RISING_FALLING:
|
case PIN_IRQ_MODE_RISING_FALLING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -788,17 +788,19 @@ rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
|
||||||
drv_clock_enable(gpio_pin);
|
drv_clock_enable(gpio_pin);
|
||||||
/* Configure GPIO_InitStructure */
|
/* Configure GPIO_InitStructure */
|
||||||
GPIO_InitStruct.Pin = get_st_pin(gpio_pin);
|
GPIO_InitStruct.Pin = get_st_pin(gpio_pin);
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||||
switch (pin_irq_hdr_tab[irqindex].mode)
|
switch (pin_irq_hdr_tab[irqindex].mode)
|
||||||
{
|
{
|
||||||
case PIN_IRQ_MODE_RISING:
|
case PIN_IRQ_MODE_RISING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
||||||
break;
|
break;
|
||||||
case PIN_IRQ_MODE_FALLING:
|
case PIN_IRQ_MODE_FALLING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||||
break;
|
break;
|
||||||
case PIN_IRQ_MODE_RISING_FALLING:
|
case PIN_IRQ_MODE_RISING_FALLING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1757,17 +1757,19 @@ rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
|
||||||
index->rcc();
|
index->rcc();
|
||||||
/* Configure GPIO_InitStructure */
|
/* Configure GPIO_InitStructure */
|
||||||
GPIO_InitStruct.Pin = index->pin;
|
GPIO_InitStruct.Pin = index->pin;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
switch (pin_irq_hdr_tab[irqindex].mode)
|
switch (pin_irq_hdr_tab[irqindex].mode)
|
||||||
{
|
{
|
||||||
case PIN_IRQ_MODE_RISING:
|
case PIN_IRQ_MODE_RISING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
||||||
break;
|
break;
|
||||||
case PIN_IRQ_MODE_FALLING:
|
case PIN_IRQ_MODE_FALLING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||||
break;
|
break;
|
||||||
case PIN_IRQ_MODE_RISING_FALLING:
|
case PIN_IRQ_MODE_RISING_FALLING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1757,17 +1757,19 @@ static rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
|
||||||
drv_clock_enable(gpio_pin);
|
drv_clock_enable(gpio_pin);
|
||||||
/* Configure GPIO_InitStructure */
|
/* Configure GPIO_InitStructure */
|
||||||
GPIO_InitStruct.Pin = get_st_pin(gpio_pin);
|
GPIO_InitStruct.Pin = get_st_pin(gpio_pin);
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
switch (pin_irq_hdr_tab[irqindex].mode)
|
switch (pin_irq_hdr_tab[irqindex].mode)
|
||||||
{
|
{
|
||||||
case PIN_IRQ_MODE_RISING:
|
case PIN_IRQ_MODE_RISING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
||||||
break;
|
break;
|
||||||
case PIN_IRQ_MODE_FALLING:
|
case PIN_IRQ_MODE_FALLING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||||
break;
|
break;
|
||||||
case PIN_IRQ_MODE_RISING_FALLING:
|
case PIN_IRQ_MODE_RISING_FALLING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -738,17 +738,19 @@ rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
|
||||||
index->rcc();
|
index->rcc();
|
||||||
/* Configure GPIO_InitStructure */
|
/* Configure GPIO_InitStructure */
|
||||||
GPIO_InitStruct.Pin = index->pin;
|
GPIO_InitStruct.Pin = index->pin;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||||
switch (pin_irq_hdr_tab[irqindex].mode)
|
switch (pin_irq_hdr_tab[irqindex].mode)
|
||||||
{
|
{
|
||||||
case PIN_IRQ_MODE_RISING:
|
case PIN_IRQ_MODE_RISING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
||||||
break;
|
break;
|
||||||
case PIN_IRQ_MODE_FALLING:
|
case PIN_IRQ_MODE_FALLING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||||
break;
|
break;
|
||||||
case PIN_IRQ_MODE_RISING_FALLING:
|
case PIN_IRQ_MODE_RISING_FALLING:
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue