You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
1.6 KiB

  1. # GPIO Control
  2. QMK has a GPIO control abstraction layer which is microcontroller agnostic. This is done to allow easy access to pin control across different platforms.
  3. ## Functions
  4. The following functions can provide basic control of GPIOs and are found in `quantum/quantum.h`.
  5. |Function |Description |
  6. |----------------------|------------------------------------------------------------------|
  7. |`setPinInput(pin)` |Set pin as input with high impedance (High-Z) |
  8. |`setPinInputHigh(pin)`|Set pin as input with build in pull-up |
  9. |`setPinInputLow(pin)` |Set pin as input with build in pull-down (Supported only on STM32)|
  10. |`setPinOutput(pin)` |Set pin as output |
  11. |`writePinHigh(pin)` |Set pin level as high, assuming it is an output |
  12. |`writePinLow(pin)` |Set pin level as low, assuming it is an output |
  13. |`writePin(pin, level)`|Set pin level, assuming it is an output |
  14. |`readPin(pin)` |Returns the level of the pin |
  15. ## Advanced Settings
  16. Each microcontroller can have multiple advanced settings regarding its GPIO. This abstraction layer does not limit the use of architecture-specific functions. Advanced users should consult the datasheet of their desired device and include any needed libraries. For AVR, the standard avr/io.h library is used; for STM32, the ChibiOS [PAL library](http://chibios.sourceforge.net/docs3/hal/group___p_a_l.html) is used.