This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

app_gpiote_user_disable not working?

Hi,

I'm looking at interrupts from three different GPIO-pins. I'm setting it up like this:

static void gpiote_init(void)
{
uint32_t pins_low_to_high_mask = INTERRUPT_1 | INTERRUPT_2 | INTERRUPT_3;
uint32_t pins_high_to_low_mask = 0;
uint32_t err_code;

APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS);
err_code = app_gpiote_user_register(&id, pins_low_to_high_mask, pins_high_to_low_mask, IRQ_evt_handler);
APP_ERROR_CHECK(err_code);

I would like to be able to enable and disable interrupts by bluetooth. However as it is right now, my interrupt handler is always fired when my pins go from low to high. Even though I use app_gpiote_user_disable. Is there a known bug with this function or am I using it wrong?

Nikolaj

Parents
  • Which version of SDK are you using.

    In SDK 8.x it is as below

    uint32_t app_gpiote_user_disable(app_gpiote_user_id_t user_id)
    {
        ....
    
        // Disable user.
        m_enabled_users_mask &= ~(1UL << user_id);
        .....
    }
    
    void GPIOTE_IRQHandler(void)
    {
          ....
      for (i = 0; i < m_user_count; i++)
      {
        gpiote_user_t * p_user = &mp_users[i];
            // Check if user is enabled.
            if (((1 << i) & m_enabled_users_mask) != 0)
           { fire your registered handler }
          ......
      }
    }
    

    seems to be simple enough logic regarding calling registered handlers. did your call to app_gpiote_user_disable succeed with no errors?

Reply
  • Which version of SDK are you using.

    In SDK 8.x it is as below

    uint32_t app_gpiote_user_disable(app_gpiote_user_id_t user_id)
    {
        ....
    
        // Disable user.
        m_enabled_users_mask &= ~(1UL << user_id);
        .....
    }
    
    void GPIOTE_IRQHandler(void)
    {
          ....
      for (i = 0; i < m_user_count; i++)
      {
        gpiote_user_t * p_user = &mp_users[i];
            // Check if user is enabled.
            if (((1 << i) & m_enabled_users_mask) != 0)
           { fire your registered handler }
          ......
      }
    }
    

    seems to be simple enough logic regarding calling registered handlers. did your call to app_gpiote_user_disable succeed with no errors?

Children
Related