1.6. 示例代码
以下是在 gpioAPI 中执行使用的示例。
#include “gpio.h”
/* GPIO mapping APIs */
/* C_GPIO(pins) */
/* P_GPIO(pins) */
/* S_GPIO(pins) */
/* L_GPIO(pins) */
/* H_GPIO(pins) */
/* D_GPIO(pins) */
/* A_GPIO(pins) */
void foo(void) {
// Set C_GPIO 3 as example
Uint32_t value, direction;
gpio_direction_input(C_GPIO_3); // Set C_CPIO 3 as an input pin
Value = gpio_get_value(C_GPIO_3); // Get the value of C_GPIO 3
gpio_direction_output(C_GPIO_3, value); // Set the output direction of C_CPIO 3 and target value // set output high or output low
gpio_set_value(C_GPIO_3, value); // Set the value of C_CPIO 3 if pin was set as output
......
16RD supports Paypal , Payment is calculated at the exchange rate of the day. Unable to download please contact 18902843661 (WhatsApp OR wechat number)