diff options
| -rw-r--r-- | docs/feature_backlight.md | 22 | ||||
| -rw-r--r-- | quantum/quantum.c | 16 |
2 files changed, 28 insertions, 10 deletions
diff --git a/docs/feature_backlight.md b/docs/feature_backlight.md index 690eb8215..556da7385 100644 --- a/docs/feature_backlight.md +++ b/docs/feature_backlight.md | |||
| @@ -32,16 +32,18 @@ This feature is distinct from both the [RGB underglow](feature_rgblight.md) and | |||
| 32 | 32 | ||
| 33 | Hardware PWM is supported according to the following table: | 33 | Hardware PWM is supported according to the following table: |
| 34 | 34 | ||
| 35 | |Backlight Pin|AT90USB64/128|ATmega16/32U4|ATmega16/32U2|ATmega32A| | 35 | |Backlight Pin|AT90USB64/128|ATmega16/32U4|ATmega16/32U2|ATmega32A|ATmega328P| |
| 36 | |-------------|-------------|-------------|-------------|---------| | 36 | |-------------|-------------|-------------|-------------|---------|----------| |
| 37 | |`B5` |Timer 1 |Timer 1 | | | | 37 | |`B1` | | | | |Timer 1 | |
| 38 | |`B6` |Timer 1 |Timer 1 | | | | 38 | |`B2` | | | | |Timer 1 | |
| 39 | |`B7` |Timer 1 |Timer 1 |Timer 1 | | | 39 | |`B5` |Timer 1 |Timer 1 | | | | |
| 40 | |`C4` |Timer 3 | | | | | 40 | |`B6` |Timer 1 |Timer 1 | | | | |
| 41 | |`C5` |Timer 3 | |Timer 1 | | | 41 | |`B7` |Timer 1 |Timer 1 |Timer 1 | | | |
| 42 | |`C6` |Timer 3 |Timer 3 |Timer 1 | | | 42 | |`C4` |Timer 3 | | | | | |
| 43 | |`D4` | | | |Timer 1 | | 43 | |`C5` |Timer 3 | |Timer 1 | | | |
| 44 | |`D5` | | | |Timer 1 | | 44 | |`C6` |Timer 3 |Timer 3 |Timer 1 | | | |
| 45 | |`D4` | | | |Timer 1 | | | ||
| 46 | |`D5` | | | |Timer 1 | | | ||
| 45 | 47 | ||
| 46 | 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: | 48 | 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: |
| 47 | 49 | ||
diff --git a/quantum/quantum.c b/quantum/quantum.c index 85a03377f..ec80fa557 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -1104,6 +1104,22 @@ void matrix_scan_quantum() { | |||
| 1104 | # define COMxx1 COM1A1 | 1104 | # define COMxx1 COM1A1 |
| 1105 | # define OCRxx OCR1A | 1105 | # define OCRxx OCR1A |
| 1106 | # endif | 1106 | # endif |
| 1107 | # elif defined(__AVR_ATmega328P__) && (BACKLIGHT_PIN == B1 || BACKLIGHT_PIN == B2) | ||
| 1108 | # define HARDWARE_PWM | ||
| 1109 | # define ICRx ICR1 | ||
| 1110 | # define TCCRxA TCCR1A | ||
| 1111 | # define TCCRxB TCCR1B | ||
| 1112 | # define TIMERx_OVF_vect TIMER1_OVF_vect | ||
| 1113 | # define TIMSKx TIMSK1 | ||
| 1114 | # define TOIEx TOIE1 | ||
| 1115 | |||
| 1116 | # if BACKLIGHT_PIN == B1 | ||
| 1117 | # define COMxx1 COM1A1 | ||
| 1118 | # define OCRxx OCR1A | ||
| 1119 | # elif BACKLIGHT_PIN == B2 | ||
| 1120 | # define COMxx1 COM1B1 | ||
| 1121 | # define OCRxx OCR1B | ||
| 1122 | # endif | ||
| 1107 | # else | 1123 | # else |
| 1108 | # if !defined(BACKLIGHT_CUSTOM_DRIVER) | 1124 | # if !defined(BACKLIGHT_CUSTOM_DRIVER) |
| 1109 | # if !defined(B5_AUDIO) && !defined(B6_AUDIO) && !defined(B7_AUDIO) | 1125 | # if !defined(B5_AUDIO) && !defined(B6_AUDIO) && !defined(B7_AUDIO) |
