diff options
author | fauxpark <fauxpark@gmail.com> | 2019-08-09 06:12:12 +1000 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-08-08 13:12:12 -0700 |
commit | 4d72aa428fb8dc72634bded428f78ffba2284fdc (patch) | |
tree | 4ff5ead1218accfb7650e79ec60697fb0ac22a2a /docs | |
parent | 57540af102d034396c9f41a5a6e69ead8b10ba99 (diff) |
Improve backlight PWM pin support (#6202)
* Improve backlight PWM pin support
* I accidentally an equals sign
* Another typo
* Order by pin number
* Throw an error if backlight pin is C4 or C5 on 16/32U4
* Use else for clarity
* Minor alignment adjustments
Diffstat (limited to 'docs')
-rw-r--r-- | docs/config_options.md | 2 | ||||
-rw-r--r-- | docs/feature_backlight.md | 47 | ||||
-rw-r--r-- | docs/getting_started_make_guide.md | 2 | ||||
-rw-r--r-- | docs/hardware_avr.md | 4 | ||||
-rw-r--r-- | docs/porting_your_keyboard_to_qmk_(arm_and_other_chibios_cpus).md | 2 |
5 files changed, 27 insertions, 30 deletions
diff --git a/docs/config_options.md b/docs/config_options.md index 3be294db89..d2ae561798 100644 --- a/docs/config_options.md +++ b/docs/config_options.md @@ -76,7 +76,7 @@ This is a C header file that is one of the first things included, and will persi * `#define B7_AUDIO` * enables audio on pin B7 (duophony is enables if one of B[5-7]\_AUDIO is enabled along with one of C[4-6]\_AUDIO) * `#define BACKLIGHT_PIN B7` - * pin of the backlight - `B5`, `B6`, `B7` and `C6` (and `D4` on ATmega32A) use hardware PWM, others use software implementation + * pin of the backlight * `#define BACKLIGHT_LEVELS 3` * number of levels your backlight will have (maximum 15 excluding off) * `#define BACKLIGHT_BREATHING` diff --git a/docs/feature_backlight.md b/docs/feature_backlight.md index 64c663076b..2d9eea67bf 100644 --- a/docs/feature_backlight.md +++ b/docs/feature_backlight.md @@ -30,32 +30,31 @@ You should then be able to use the keycodes below to change the backlight level. This feature is distinct from both the [RGB underglow](feature_rgblight.md) and [RGB matrix](feature_rgb_matrix.md) features as it usually allows for only a single colour per switch, though you can obviously use multiple different coloured LEDs on a keyboard. -Hardware PWM is only supported on certain pins of the MCU, so if the backlighting is not connected to one of them, a software PWM implementation triggered by hardware timer interrupts will be used. - Hardware PWM is supported according to the following table: -| Backlight Pin | Hardware timer | -|---------------|-------------------------| -|`B5` | Timer 1 | -|`B6` | Timer 1 | -|`B7` | Timer 1 | -|`C6` | Timer 3 | -|`D4` | Timer 1 (ATmega32A only)| -| other | Software PWM | - -The [audio feature](feature_audio.md) also uses hardware timers. Please refer to the following table to know what hardware timer the software PWM will use depending on the audio configuration: - -| Audio Pin(s) | Audio Timer | Software PWM Timer | -|--------------|-------------|--------------------| -| `C4` | Timer 3 | Timer 1 | -| `C5` | Timer 3 | Timer 1 | -| `C6` | Timer 3 | Timer 1 | -| `B5` | Timer 1 | Timer 3 | -| `B6` | Timer 1 | Timer 3 | -| `B7` | Timer 1 | Timer 3 | -| `Bx` & `Cx` | Timer 1 & 3 | None | - -When all timers are in use for [audio](feature_audio.md), the backlight software PWM will not use a hardware timer, but instead will be triggered during the matrix scan. In this case the backlight doesn't support breathing and might show lighting artifacts (for instance flickering), because the PWM computation might not be called with enough timing precision. +|Backlight Pin|AT90USB64/128|ATmega16/32U4|ATmega16/32U2|ATmega32A| +|-------------|-------------|-------------|-------------|---------| +|`B5` |Timer 1 |Timer 1 | | | +|`B6` |Timer 1 |Timer 1 | | | +|`B7` |Timer 1 |Timer 1 |Timer 1 | | +|`C4` |Timer 3 | | | | +|`C5` |Timer 3 | |Timer 1 | | +|`C6` |Timer 3 |Timer 3 |Timer 1 | | +|`D4` | | | |Timer 1 | +|`D5` | | | |Timer 1 | + +All other pins will use software PWM. If the [Audio](feature_audio.md) feature is disabled or only using one timer, the backlight PWM can be triggered by a hardware timer: + +|Audio Pin|Audio Timer|Software PWM Timer| +|---------|-----------|------------------| +|`C4` |Timer 3 |Timer 1 | +|`C5` |Timer 3 |Timer 1 | +|`C6` |Timer 3 |Timer 1 | +|`B5` |Timer 1 |Timer 3 | +|`B6` |Timer 1 |Timer 3 | +|`B7` |Timer 1 |Timer 3 | + +When both timers are in use for Audio, the backlight PWM will not use a hardware timer, but will instead be triggered during the matrix scan. In this case, breathing is not supported, and the backlight might flicker, because the PWM computation may not be called with enough timing precision. ## Configuration diff --git a/docs/getting_started_make_guide.md b/docs/getting_started_make_guide.md index 75eafd42cc..4fe3f184df 100644 --- a/docs/getting_started_make_guide.md +++ b/docs/getting_started_make_guide.md @@ -83,7 +83,7 @@ This allows the keyboard to tell the host OS that up to 248 keys are held down a `BACKLIGHT_ENABLE` -This enables your backlight on Timer1 and ports B5, B6, or B7 (for now). You can specify your port by putting this in your `config.h`: +This enables the in-switch LED backlighting. You can specify the backlight pin by putting this in your `config.h`: #define BACKLIGHT_PIN B7 diff --git a/docs/hardware_avr.md b/docs/hardware_avr.md index 7c28ab6dbc..c6987d1bdf 100644 --- a/docs/hardware_avr.md +++ b/docs/hardware_avr.md @@ -125,7 +125,7 @@ To configure a keyboard where each switch is connected to a separate pin and gro ### Backlight Configuration -By default QMK supports backlighting on pins `B5`, `B6`, and `B7`. If you are using one of those you can simply enable it here. For more details see the [Backlight Documentation](feature_backlight.md). +QMK supports backlighting on most GPIO pins. A select few of these can be driven by the MCU in hardware. For more details see the [Backlight Documentation](feature_backlight.md). ```c #define BACKLIGHT_PIN B7 @@ -134,8 +134,6 @@ By default QMK supports backlighting on pins `B5`, `B6`, and `B7`. If you are us #define BREATHING_PERIOD 6 ``` -?> You can use backlighting on any pin you like, but you will have to do more work to support that. See the [Backlight Documentation](feature_backlight.md) for more details. - ### Other Configuration Options There are a lot of features that can be configured or tuned in `config.h`. You should see the [Config Options](config_options.md) page for more details. diff --git a/docs/porting_your_keyboard_to_qmk_(arm_and_other_chibios_cpus).md b/docs/porting_your_keyboard_to_qmk_(arm_and_other_chibios_cpus).md index 979eafbc80..bce9f9dc9b 100644 --- a/docs/porting_your_keyboard_to_qmk_(arm_and_other_chibios_cpus).md +++ b/docs/porting_your_keyboard_to_qmk_(arm_and_other_chibios_cpus).md @@ -34,7 +34,7 @@ For the `DIODE_DIRECTION`, most hand-wiring guides will instruct you to wire the To configure a keyboard where each switch is connected to a separate pin and ground instead of sharing row and column pins, use `DIRECT_PINS`. The mapping defines the pins of each switch in rows and columns, from left to right. Must conform to the sizes within `MATRIX_ROWS` and `MATRIX_COLS`, use `NO_PIN` to fill in blank spaces. Overrides the behaviour of `DIODE_DIRECTION`, `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`. -`BACKLIGHT_PIN` is the pin that your PWM-controlled backlight (if one exists) is hooked-up to. Currently only B5, B6, and B7 are supported. +`BACKLIGHT_PIN` is the pin that your PWM-controlled backlight (if one exists) is hooked-up to. `BACKLIGHT_BREATHING` is a fancier backlight feature that adds breathing/pulsing/fading effects to the backlight. It uses the same timer as the normal backlight. These breathing effects must be called by code in your keymap. |