示例#1
0
void gpio_irq_free(gpio_irq_t *obj)
{
    nrf_drv_gpiote_in_uninit(obj->ch);
    m_gpio_cfg[obj->ch].used_as_irq = false;
    m_channel_ids[obj->ch] = 0;

    gpio_apply_config(obj->ch);
}
示例#2
0
void gpio_dir(gpio_t *obj, PinDirection direction)
{
    MBED_ASSERT(obj->pin != (PinName)NC);
    
    gpiote_pin_uninit(obj->pin); // try to uninitialize gpio before a change.
    
    m_gpio_cfg[obj->pin].direction = direction;
    gpio_apply_config(obj->pin);
}
示例#3
0
void gpio_mode(gpio_t *obj, PinMode mode)
{
    MBED_ASSERT(obj->pin != (PinName)NC);
    
    gpiote_pin_uninit(obj->pin); // try to uninitialize gpio before a change.
    
    m_gpio_cfg[obj->pin].pull = mode;
    gpio_apply_config(obj->pin);
}
示例#4
0
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id)
{
    if (pin == NC) {
        return -1;
    }
    MBED_ASSERT((uint32_t)pin < GPIO_PIN_COUNT);
    (void) nrf_drv_gpiote_init();

    m_gpio_cfg[pin].used_as_irq = true;
    m_channel_ids[pin] = id;
    obj->ch            = pin;
    m_irq_handler      = handler;
    m_channel_ids[pin] = id;

    gpio_apply_config(pin);
    return 1;
}
示例#5
0
void gpio_dir(gpio_t *obj, PinDirection direction)
{
    MBED_ASSERT(obj->pin <= GPIO_PIN_COUNT);
    m_gpio_cfg[obj->pin].direction = direction;
    gpio_apply_config(obj->pin);
}
示例#6
0
void gpio_mode(gpio_t *obj, PinMode mode)
{
    MBED_ASSERT(obj->pin <= GPIO_PIN_COUNT);
    m_gpio_cfg[obj->pin].pull = mode;
    gpio_apply_config(obj->pin);
}