gpio.rst 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. GPIO API
  2. ========
  3. Overview
  4. --------
  5. `Instructions <http://esp-idf.readthedocs.io/en/latest/api/template.html>`_
  6. Application Example
  7. -------------------
  8. `Instructions <http://esp-idf.readthedocs.io/en/latest/api/template.html>`_
  9. Reference
  10. ---------
  11. `Instructions <http://esp-idf.readthedocs.io/en/latest/api/template.html>`_
  12. Enumerations
  13. ^^^^^^^^^^^^
  14. .. doxygenenum:: gpio_int_type_t
  15. .. doxygenenum:: gpio_mode_t
  16. .. doxygenenum:: gpio_pull_mode_t
  17. Functions
  18. ^^^^^^^^^
  19. .. doxygenfunction:: gpio_config
  20. .. doxygenfunction:: gpio_set_intr_type
  21. .. doxygenfunction:: gpio_intr_enable
  22. .. doxygenfunction:: gpio_intr_disable
  23. .. doxygenfunction:: gpio_set_level
  24. .. doxygenfunction:: gpio_get_level
  25. .. doxygenfunction:: gpio_set_direction
  26. .. doxygenfunction:: gpio_set_pull_mode
  27. .. doxygenfunction:: gpio_wakeup_enable
  28. .. doxygenfunction:: gpio_wakeup_disable
  29. .. doxygenfunction:: gpio_isr_register
  30. *Example code:* Configuration of GPIO as an output
  31. .. code-block:: c
  32. gpio_config_t io_conf;
  33. io_conf.intr_type = GPIO_INTR_DISABLE; //disable interrupt
  34. io_conf.mode = GPIO_MODE_OUTPUT; //set as output mode
  35. io_conf.pin_bit_mask = GPIO_SEL_18 | GPIO_SEL_19; //bit mask of the pins that you want to set,e.g.GPIO18/19
  36. io_conf.pull_down_en = 0; //disable pull-down mode
  37. io_conf.pull_up_en = 0; //disable pull-up mode
  38. gpio_config(&io_conf); //configure GPIO with the given settings
  39. *Example code:* Configuration of GPIO as an input
  40. .. code-block:: c
  41. gpio_config_t io_conf;
  42. io_conf.intr_type = GPIO_INTR_POSEDGE; //set posedge interrupt
  43. io_conf.mode = GPIO_MODE_INPUT; //set as input
  44. io_conf.pin_bit_mask = GPIO_SEL_4 | GPIO_SEL_5; //bit mask of the pins that you want to set, e.g.,GPIO4/5
  45. io_conf.pull_down_en = 0; //disable pull-down mode
  46. io_conf.pull_up_en = 1; //enable pull-up mode
  47. gpio_config(&io_conf); //configure GPIO with the given settings
  48. ROM GPIO functions
  49. ^^^^^^^^^^^^^^^^^^
  50. .. doxygenfunction:: gpio_init
  51. .. doxygenfunction:: gpio_output_set
  52. .. doxygenfunction:: gpio_output_set_high
  53. .. doxygenfunction:: gpio_input_get
  54. .. doxygenfunction:: gpio_input_get_high
  55. .. doxygenfunction:: gpio_intr_handler_register
  56. .. doxygenfunction:: gpio_intr_pending
  57. .. doxygenfunction:: gpio_intr_pending_high
  58. .. doxygenfunction:: gpio_intr_ack
  59. .. doxygenfunction:: gpio_intr_ack_high
  60. .. doxygenfunction:: gpio_pin_wakeup_enable
  61. .. doxygenfunction:: gpio_pin_wakeup_disable
  62. .. doxygenfunction:: gpio_matrix_in
  63. .. doxygenfunction:: gpio_matrix_out
  64. .. doxygenfunction:: gpio_pad_select_gpio
  65. .. doxygenfunction:: gpio_pad_set_drv
  66. .. doxygenfunction:: gpio_pad_pullup
  67. .. doxygenfunction:: gpio_pad_pulldown
  68. .. doxygenfunction:: gpio_pad_unhold
  69. .. doxygenfunction:: gpio_pad_hold