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

S110,9.0.0,this function if i want 4 button, it will return 0xff,when i run button=2;why ?if the code err?

this the origin code of offical,,,this some err?? help !!!!

static int8_t channel_port_alloc(uint32_t pin,nrf_drv_gpiote_evt_handler_t handler, bool channel)
{
    int8_t channel_id = NO_CHANNELS;
    uint32_t i;

    uint32_t start_idx = channel ? 0 : NUMBER_OF_GPIO_TE;
    uint32_t end_idx = channel ? NUMBER_OF_GPIO_TE : (NUMBER_OF_GPIO_TE+GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS);
    //critical section

    for (i = start_idx; i < end_idx; i++)// start_idx=4;end_idx=5;  it can only allocate 1 channl ,then it will reutn 0xff; if it have a err?
    {
        if (m_cb.handlers[i] == FORBIDDEN_HANDLER_ADDRESS)
        {
            pin_in_use_by_te_set(pin, i, handler, channel);
            channel_id = i;
            break;
        }
    }
    //critical section
    return channel_id;
}
Parents Reply Children
No Data
Related