gpio_direction_output()
时间: 2023-09-16 15:15:07 浏览: 131
gpio_direction_output() is a function used in the Linux kernel to set the direction of a GPIO pin as output. It takes two arguments: the first argument is the pin number, and the second argument is the initial value to set the pin to.
The function sets the direction of the pin to output mode and sets the initial value of the pin according to the second argument. If the second argument is 1, the pin is set to logic high, and if it is 0, the pin is set to logic low.
After calling this function, the pin can be controlled as an output pin using gpio_set_value() function.
Here is an example of using gpio_direction_output() function to set pin 17 as output with an initial value of 0:
```
gpio_direction_output(17, 0);
```
阅读全文