增加 gpiod_get_optional.

Signed-off-by: rick.chan <chenyang@autoai.com>
This commit is contained in:
rick.chan 2020-08-12 11:41:14 +08:00
parent 136da28c52
commit d293a39910
1 changed files with 35 additions and 3 deletions

View File

@ -101,7 +101,39 @@ flagsoptional GPIO initialization flags。
This is equivalent to gpiod_get_index(), except that when no GPIO with the specified index was assigned to the requested function it will return NULL。
## 4. gpiod_direction_output 函数
## 4. gpiod_get_optional 函数
**头文件:**
```cpp
#include <linux/gpio/consumer.h>
```
**函数原型:**
```cpp
static inline struct gpio_desc *__must_check
gpiod_get_optional(struct device *dev, const char *con_id,
enum gpiod_flags flags);
```
**说明:**
Obtain an optional GPIO for a given GPIO function. This is equivalent to gpiod_get(), except that when no GPIO was assigned to the requested function it will return NULL. This is convenient for drivers that need to handle optional GPIOs.
**参数:**
devGPIO consumer, can be NULL for system-global GPIOs
con_idfunction within the GPIO consumer
flagsoptional GPIO initialization flags
**返回值:**
Equivalent to gpiod_get(), except that when no GPIO was assigned to the requested function it will return NULL.
## 5. gpiod_direction_output 函数
**头文件:**
@ -129,7 +161,7 @@ valueinitial output value of the GPIO。
Return 0 in case of success, else an error code。
## 5. gpiod_direction_input 函数
## 6. gpiod_direction_input 函数
**头文件:**
@ -155,7 +187,7 @@ descGPIO to set to input。
Return 0 in case of success, else an error code。
## 6. gpiod_set_value_cansleep 函数
## 7. gpiod_set_value_cansleep 函数
**头文件:**