/* Function for enabling or disabling events for pins used by the user. 
Function will enable pin events only if they are not yet enabled. Function will disable pin events only if there is no other enabled user that is using them. */
static uint32_t user_enable(app_gpiote_user_id_t user_id, bool enable)
/* Function for enabling or disabling events for pins used by the user. 
Function will enable pin events only if they are not yet enabled. Function will disable pin events only if there is no other enabled user that is using them. */
static uint32_t user_enable(app_gpiote_user_id_t user_id, bool enable)
{
    uint32_t ret_code = error_check(user_id);
    if (ret_code == NRF_SUCCESS)
    {
        uint32_t i;
        uint32_t mask = 1UL;
        for (i = 0; i < 32; i++)
        {
            if (mp_users[user_id].pins_mask & mask)
            {
                pin_event_enable(i, enable);
            }
            mask <<= 1;
        }
    }
    return ret_code;
}