更正gpio框架中断方式宏定义与1c底层中断方式宏定义不一致问题

This commit is contained in:
liufeilong 2019-08-21 13:40:57 +08:00
parent 418757fa67
commit 3ac168c9f6
1 changed files with 18 additions and 2 deletions

View File

@ -73,8 +73,24 @@ rt_err_t ls1c_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
{ {
unsigned int gpio = pin; unsigned int gpio = pin;
char irq_name[10]; char irq_name[10];
rt_uint32_t type;
switch (mode)
{
case PIN_IRQ_MODE_RISING:
type=IRQ_TYPE_EDGE_RISING;
break;
case PIN_IRQ_MODE_FALLING:
type=IRQ_TYPE_EDGE_FALLING;
break;
case PIN_IRQ_MODE_HIGH_LEVEL:
type=IRQ_TYPE_LEVEL_HIGH;
break;
case PIN_IRQ_MODE_LOW_LEVEL:
type=IRQ_TYPE_LEVEL_LOW;
break;
}
gpio_set_irq_type(gpio, type);
gpio_set_irq_type(gpio, mode);
rt_sprintf(irq_name, "PIN_%d", gpio); rt_sprintf(irq_name, "PIN_%d", gpio);
rt_hw_interrupt_install(LS1C_GPIO_TO_IRQ(gpio), (rt_isr_handler_t)hdr, args, irq_name); rt_hw_interrupt_install(LS1C_GPIO_TO_IRQ(gpio), (rt_isr_handler_t)hdr, args, irq_name);