diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/config_options.md | 4 | ||||
-rw-r--r-- | docs/faq_keymap.md | 2 | ||||
-rw-r--r-- | docs/feature_backlight.md | 28 | ||||
-rw-r--r-- | docs/hardware_avr.md | 3 |
4 files changed, 32 insertions, 5 deletions
diff --git a/docs/config_options.md b/docs/config_options.md index a9ff54995..1dd4cdbaa 100644 --- a/docs/config_options.md +++ b/docs/config_options.md | |||
@@ -70,6 +70,10 @@ This is a C header file that is one of the first things included, and will persi | |||
70 | * pin of the backlight - B5, B6, B7 use PWM, others use softPWM | 70 | * pin of the backlight - B5, B6, B7 use PWM, others use softPWM |
71 | * `#define BACKLIGHT_LEVELS 3` | 71 | * `#define BACKLIGHT_LEVELS 3` |
72 | * number of levels your backlight will have (not including off) | 72 | * number of levels your backlight will have (not including off) |
73 | * `#define BACKLIGHT_BREATHING` | ||
74 | * enables backlight breathing (only works with backlight pins B5, B6 and B7) | ||
75 | * `#define BREATHING_PERIOD 6` | ||
76 | * the length of one backlight "breath" in seconds | ||
73 | * `#define DEBOUNCING_DELAY 5` | 77 | * `#define DEBOUNCING_DELAY 5` |
74 | * the delay when reading the value of the pin (5 is default) | 78 | * the delay when reading the value of the pin (5 is default) |
75 | * `#define LOCKING_SUPPORT_ENABLE` | 79 | * `#define LOCKING_SUPPORT_ENABLE` |
diff --git a/docs/faq_keymap.md b/docs/faq_keymap.md index 7093dec20..0fed0445f 100644 --- a/docs/faq_keymap.md +++ b/docs/faq_keymap.md | |||
@@ -127,7 +127,7 @@ https://github.com/tekezo/Karabiner/issues/403 | |||
127 | 127 | ||
128 | ## Esc and <code>`</code> on a Single Key | 128 | ## Esc and <code>`</code> on a Single Key |
129 | 129 | ||
130 | See the [Grave Escape](feature_grave_escape.md) feature. | 130 | See the [Grave Escape](feature_grave_esc.md) feature. |
131 | 131 | ||
132 | ## Arrow on Right Modifier Keys with Dual-Role | 132 | ## Arrow on Right Modifier Keys with Dual-Role |
133 | This turns right modifier keys into arrow keys when the keys are tapped while still modifiers when the keys are hold. In TMK the dual-role function is dubbed **TAP**. | 133 | This turns right modifier keys into arrow keys when the keys are tapped while still modifiers when the keys are hold. In TMK the dual-role function is dubbed **TAP**. |
diff --git a/docs/feature_backlight.md b/docs/feature_backlight.md index aa747f90e..97421c043 100644 --- a/docs/feature_backlight.md +++ b/docs/feature_backlight.md | |||
@@ -10,8 +10,30 @@ These keycodes control the backlight. Most keyboards use this for single color i | |||
10 | |---------|------------------------------------------| | 10 | |---------|------------------------------------------| |
11 | |`BL_TOGG`|Turn the backlight on or off | | 11 | |`BL_TOGG`|Turn the backlight on or off | |
12 | |`BL_STEP`|Cycle through backlight levels | | 12 | |`BL_STEP`|Cycle through backlight levels | |
13 | |`BL_x` |Set a specific backlight level between 0-9| | 13 | |`BL_ON` |Set backlight to max brightness | |
14 | |`BL_ON` |An alias for `BL_9` | | 14 | |`BL_OFF` |Turn backlight off | |
15 | |`BL_OFF` |An alias for `BL_0` | | ||
16 | |`BL_INC` |Increase backlight level | | 15 | |`BL_INC` |Increase backlight level | |
17 | |`BL_DEC` |Decrease backlight level | | 16 | |`BL_DEC` |Decrease backlight level | |
17 | |`BL_BRTG`|Toggle backlight breathing | | ||
18 | |||
19 | Note that for backlight breathing, you need to have `#define BACKLIGHT_BREATHING` in your config.h. | ||
20 | |||
21 | ## Configuration Options in `config.h` | ||
22 | |||
23 | * `BACKLIGHT_PIN B7` defines the pin that controlls the LEDs. Unless you design your own keyboard, you don't need to set this. | ||
24 | * `BACKLIGHT_LEVELS 3` defines the number of brightness levels (excluding OFF). | ||
25 | * `BACKLIGHT_BREATHING` if defined, enables backlight breathing. Note that this is only available if `BACKLIGHT_PIN` is B5, B6 or B7. | ||
26 | * `BREATHING_PERIOD 6` defines the length of one backlight "breath" in seconds. | ||
27 | |||
28 | ## Notes on Implementation | ||
29 | |||
30 | To change the brightness when using pins B5, B6 or B7, the PWM (Pulse Width Modulation) functionality of the on-chip timer is used. | ||
31 | The timer is a counter that counts up to a certain TOP value (`0xFFFF` set in ICR1) before resetting to 0. | ||
32 | We also set an OCR1x register. | ||
33 | When the counter reaches the value stored in that register, the PWM pin drops to low. | ||
34 | The PWM pin is pulled high again when the counter resets to 0. | ||
35 | Therefore, OCR1x basically sets the duty cycle of the LEDs and as such the brightness where `0` is the darkest and `0xFFFF` the brightest setting. | ||
36 | |||
37 | To enable the breathing effect, we register an interrupt handler to be called whenever the counter resets (with `ISR(TIMER1_OVF_vect)`). | ||
38 | In this handler, which gets called roughly 244 times per second, we compute the desired brightness using a precomputed brightness curve. | ||
39 | To disable breathing, we can just disable the respective interrupt vector and reset the brightness to the desired level. | ||
diff --git a/docs/hardware_avr.md b/docs/hardware_avr.md index c6f3881dc..770817045 100644 --- a/docs/hardware_avr.md +++ b/docs/hardware_avr.md | |||
@@ -101,8 +101,9 @@ By default QMK supports backlighting on pins `B5`, `B6`, and `B7`. If you are us | |||
101 | 101 | ||
102 | ``` | 102 | ``` |
103 | #define BACKLIGHT_PIN B7 | 103 | #define BACKLIGHT_PIN B7 |
104 | #define BACKLIGHT_BREATHING | ||
105 | #define BACKLIGHT_LEVELS 3 | 104 | #define BACKLIGHT_LEVELS 3 |
105 | #define BACKLIGHT_BREATHING | ||
106 | #define BREATHING_PERIOD 6 | ||
106 | ``` | 107 | ``` |
107 | 108 | ||
108 | {% hint style='info' %} | 109 | {% hint style='info' %} |