1
1
/*
2
- * Copyright (c) 2006-2022 , RT-Thread Development Team
2
+ * Copyright (c) 2006-2025 , RT-Thread Development Team
3
3
*
4
4
* SPDX-License-Identifier: Apache-2.0
5
5
*
@@ -223,6 +223,7 @@ static rt_err_t nrf5x_pin_attach_irq(struct rt_device *device, rt_base_t pin,
223
223
break ;
224
224
}
225
225
}
226
+
226
227
if (irqindex == -1 )
227
228
{
228
229
return - RT_ENOMEM ;
@@ -298,6 +299,7 @@ static rt_err_t nrf5x_pin_dettach_irq(struct rt_device *device, rt_base_t pin)
298
299
break ;
299
300
}
300
301
}
302
+
301
303
if (i >= irq_quantity )
302
304
{
303
305
return - RT_ENOSYS ;
@@ -414,6 +416,7 @@ void button_1_callback(void *args)
414
416
rt_pin_write (DK_BOARD_LED_1 , PIN_HIGH );
415
417
}
416
418
}
419
+
417
420
void button_2_callback (void * args )
418
421
{
419
422
static int flag2 = 0 ;
@@ -428,6 +431,7 @@ void button_2_callback(void *args)
428
431
rt_pin_write (DK_BOARD_LED_2 , PIN_HIGH );
429
432
}
430
433
}
434
+
431
435
void button_3_callback (void * args )
432
436
{
433
437
static int flag3 = 0 ;
@@ -442,6 +446,7 @@ void button_3_callback(void *args)
442
446
rt_pin_write (DK_BOARD_LED_3 , PIN_HIGH );
443
447
}
444
448
}
449
+
445
450
void button_4_callback (void * args )
446
451
{
447
452
static int flag4 = 0 ;
@@ -470,21 +475,22 @@ void gpio_sample(void)
470
475
rt_pin_write (DK_BOARD_LED_4 , PIN_HIGH );
471
476
472
477
rt_pin_attach_irq (DK_BOARD_BUTTON_1 , PIN_IRQ_MODE_FALLING ,
473
- button_1_callback , (void * ) true); // true: hi_accuracy(IN_EVENT),false: lo_accuracy(PORT_EVENT)
478
+ button_1_callback , (void * ) true); /* true: hi_accuracy(IN_EVENT),false: lo_accuracy(PORT_EVENT) */
474
479
rt_pin_irq_enable (DK_BOARD_BUTTON_1 , PIN_IRQ_ENABLE );
475
480
476
481
rt_pin_attach_irq (DK_BOARD_BUTTON_2 , PIN_IRQ_MODE_FALLING ,
477
- button_2_callback , (void * ) true); // true: hi_accuracy(IN_EVENT),false: lo_accuracy(PORT_EVENT)
482
+ button_2_callback , (void * ) true); /* true: hi_accuracy(IN_EVENT),false: lo_accuracy(PORT_EVENT) */
478
483
rt_pin_irq_enable (DK_BOARD_BUTTON_2 , PIN_IRQ_ENABLE );
479
484
480
485
rt_pin_attach_irq (DK_BOARD_BUTTON_3 , PIN_IRQ_MODE_FALLING ,
481
- button_3_callback , (void * ) true); // true: hi_accuracy(IN_EVENT),false: lo_accuracy(PORT_EVENT)
486
+ button_3_callback , (void * ) true); /* true: hi_accuracy(IN_EVENT),false: lo_accuracy(PORT_EVENT) */
482
487
rt_pin_irq_enable (DK_BOARD_BUTTON_3 , PIN_IRQ_ENABLE );
483
488
484
489
rt_pin_attach_irq (DK_BOARD_BUTTON_4 , PIN_IRQ_MODE_FALLING ,
485
- button_4_callback , (void * ) false); // true: hi_accuracy(IN_EVENT),false: lo_accuracy(PORT_EVENT)
490
+ button_4_callback , (void * ) false); /* true: hi_accuracy(IN_EVENT),false: lo_accuracy(PORT_EVENT) */
486
491
rt_pin_irq_enable (DK_BOARD_BUTTON_4 , PIN_IRQ_ENABLE );
487
492
}
488
493
MSH_CMD_EXPORT (gpio_sample , gpio sample );
489
494
490
495
#endif /* RT_USING_PIN */
496
+
0 commit comments