[riot-notifications] [RIOT-OS/RIOT] cpu/nrf5x: handle multiple exti pins in gpio driver (#10828)

Leandro Lanzieri notifications at github.com
Mon Jan 21 16:51:09 CET 2019


leandrolanzieri requested changes on this pull request.

There is something odd going on with the disabling of interrupts. I tested with the periph_gpio app on nrf52840dk board. When an interrupt is disabled for a particular pin it seems that all of them are disabled. According to the [specification](https://www.nordicsemi.com/-/media/DocLib/Other/Product_Spec/nRF52840PSv10.pdf?la=en) by writing a '1' to the n bit of INTENCLR the interrupt for IN[n] should be disabled, so the implementation appears to be correct.

@aabadie could you confirm this?

> @@ -125,44 +145,62 @@ void gpio_write(gpio_t pin, int value)
 int gpio_init_int(gpio_t pin, gpio_mode_t mode, gpio_flank_t flank,
                   gpio_cb_t cb, void *arg)
 {
+    assert(_gpiote_chan_index < GPIOTE_CHAN_NUMOF);
+
     /* disable external interrupt in case one is active */
     NRF_GPIOTE->INTENSET &= ~(GPIOTE_INTENSET_IN0_Msk);

Other interrupts should not be disabled.

>  }
 
 void gpio_irq_disable(gpio_t pin)
 {
-    (void) pin;
-    NRF_GPIOTE->INTENCLR |= GPIOTE_INTENSET_IN0_Msk;
+    for (unsigned int i = 0; i < _gpiote_chan_index; ++i) {
+        if (_exti_pins[i] == pin) {
+            NRF_GPIOTE->INTENCLR |= GPIOTE_INTENCLR_IN0_Msk << i;

There seems to be a problem when clearing the IN[n] event. When printing the register value before and after it appears that is set to 0.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10828#pullrequestreview-194659755
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190121/a43db55f/attachment.html>


More information about the notifications mailing list