flyingcys / rt-thread

RT-Thread is an open source IoT operating system.
http://www.rt-thread.io
Apache License 2.0
0 stars 1 forks source link

duo : gpio : rt_pin_read 无法读出引脚的状态 #2

Closed unicornx closed 6 months ago

unicornx commented 6 months ago

在编写跑马灯例子过程中,尝试读取 GPIO 引脚的状态值,失败

简单示例代码如下:

static int led_on(void)
{
    rt_pin_write(pinno, PIN_HIGH);
    rt_kprintf("%d\n", rt_pin_read(pinno)); // 这里希望读到 1,但是 0
    return 0;
}

static int led_off(void)
{
    rt_pin_write(pinno, PIN_LOW);
    rt_kprintf("%d\n", rt_pin_read(pinno)); // 这里希望读到 0,
    return 0;
}

看了一下驱动,rt_pin_read 回去读取 GPIO_EXT_PORTA,怀疑这个寄存器是不是反应了引脚的状态?

unicornx commented 6 months ago

已经 report 给 sophgo 看看这个寄存器到底怎么个说法

unicornx commented 6 months ago

moved to https://github.com/RT-Thread/rt-thread/issues/8930