RGB Inidcator example for new van pcbs (#6544)
[jackhill/qmk/firmware.git] / docs / internals_gpio_control.md
1 # GPIO Control
2
3 QMK has a GPIO control abstraction layer which is microcontroller agnostic. This is done to allow easy access to pin control across different platforms.
4
5 ## Functions
6
7 The 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 |
15 |`writePinHigh(pin)` |Set pin level as high, assuming it is an output |
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
20 ## Advanced Settings
21
22 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.
23