Jump to content

Using new gpiod_export in Orange Pi One


Recommended Posts

Hi,

 

I need set the PC1 pin as output on a device driver using the new gpiod_export() method.

What argument should i pass on the gpiod_get function?

 

    struct gpio_desc *gpio;


    gpio = gpiod_get(NULL, "PC1", GPIOD_OUT_HIGH);
    if (IS_ERR(gpio)) {
        printk("Failed to get GPIO: \n");
        return PTR_ERR(gpio);
    }

    // Export the GPIO
    ret = gpiod_export(gpio, false);
    if (ret) {
        pr_err("Failed to export GPIO: %d\n", ret);
        return ret;
    }

    // Set the direction of the GPIO
    ret = gpiod_direction_output(gpio, 1);
    if (ret) {
        pr_err("Failed to set GPIO direction: %d\n", ret);
        return ret;
    }

 

Armbian 23.8

Best regards

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines