Correct backlight on state docs (#6358)
[jackhill/qmk/firmware.git] / docs / internals_gpio_control.md
CommitLineData
7fe03d08 1# GPIO Control
2
3c26f07f 3QMK has a GPIO control abstraction layer which is microcontroller agnostic. This is done to allow easy access to pin control across different platforms.
7fe03d08 4
5## Functions
6
7The following functions can provide basic control of GPIOs and are found in `quantum/quantum.h`.
8
9|Function |Description |
10|----------------------|------------------------------------------------------------------|
11|`setPinInput(pin)` |Set pin as input with high impedance (High-Z) |
12|`setPinInputHigh(pin)`|Set pin as input with build in pull-up |
13|`setPinInputLow(pin)` |Set pin as input with build in pull-down (Supported only on STM32)|
14|`setPinOutput(pin)` |Set pin as output |
15f6278a 15|`writePinHigh(pin)` |Set pin level as high, assuming it is an output |
7fe03d08 16|`writePinLow(pin)` |Set pin level as low, assuming it is an output |
17|`writePin(pin, level)`|Set pin level, assuming it is an output |
18|`readPin(pin)` |Returns the level of the pin |
19
3c26f07f 20## Advanced Settings
7fe03d08 21
3c26f07f 22Each 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.
7fe03d08 23