How can I use "gpiod.h" function on IMX8MQ-EVK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I use "gpiod.h" function on IMX8MQ-EVK

158 Views
yumy
Contributor I

Hi, 我目前正在IMX8MQ-EVK上開發關於gpio的功能

需要在我的程式內偵測gpio某個pin腳(正在使用中)的電位

我在local.conf加了IMAGE_INSTALL:append = "libgpiod libgpiod-dev libgpiod-tools"來include "gpiod.h"

但使用像是下列範例程式

struct gpiod_chip; //GPIO chip
struct gpiod_line; //GPIO line

//获取GPIO控制器(GPIO组)
struct gpiod_chip *gpiod_chip_open(const char *path);

//获取GPIO引脚
struct gpiod_line * gpiod_chip_get_line(struct gpiod_chip *chip, unsigned int offset);

//读取引脚状态
int gpiod_line_get_value(struct gpiod_line *line);

卻顯示在gpiod.h沒定義gpiod_chip_get_line、gpiod_line_get_value等function

請問是我沒有將gpiod.h的資料include齊全嗎

有別的幫法可以使用gpiod.h的資料嗎

或者可以偵測gpio現在的value值

 

謝謝

0 Kudos
1 Reply

110 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

The API change a lot, you should change your code refer example

https://github.com/brgl/libgpiod/tree/master/examples

0 Kudos