Relationship between gpio_direction_output and gpio_set_value

Source: Internet
Author: User

Gpio_set_value (port_num, 0/1) generally only writes a value on the register of the gpio port. It cannot control whether the port is set to output!

While gpio_direction_output (port_num, 0/1), after a value is written on a gpio port, the port is set to the output mode.

Therefore, some people may suggest removing the gpio_set_value function directly. Is it OK.

Generally, it is recommended that you do not change the Input and Output Modes of a port frequently.

Call gpio_direction_output () first. You can directly use gpio_set_value () to set high and low power consumption in the future. This saves you the trouble of calling the operation that sets the output mode again to improve the running efficiency!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.