Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
unicornx opened this issue May 10, 2024 · 2 comments
Open

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

unicornx opened this issue May 10, 2024 · 2 comments

Comments

@unicornx
Copy link
Contributor

bsp/cvitek/cv18xx_risc-v/ 最新 master

在编写跑马灯例子过程中,尝试读取 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
Copy link
Contributor Author

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

@BernardXiong
Copy link
Member

是否可能和pin的模式相关?难道需要先配置成输入模式?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants