diff options
| author | Eric Tang <e_l_tang@outlook.com> | 2016-06-12 15:01:55 -0700 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2016-06-12 18:01:55 -0400 |
| commit | 6955719075a9a07524814e4183f3f90f83db1c6a (patch) | |
| tree | 4992f68783514c307c327a8fe88fc41d29550a56 /keyboard/planck | |
| parent | 92759be3226c83087959015be097b66d8c7e2f21 (diff) | |
| download | qmk_firmware-6955719075a9a07524814e4183f3f90f83db1c6a.tar.gz qmk_firmware-6955719075a9a07524814e4183f3f90f83db1c6a.zip | |
Move LED strip initialization (#397)
Diffstat (limited to 'keyboard/planck')
| -rw-r--r-- | keyboard/planck/planck.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/keyboard/planck/planck.c b/keyboard/planck/planck.c index da7b3a170..f1a76266e 100644 --- a/keyboard/planck/planck.c +++ b/keyboard/planck/planck.c | |||
| @@ -19,10 +19,6 @@ void matrix_init_kb(void) { | |||
| 19 | backlight_init_ports(); | 19 | backlight_init_ports(); |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | #ifdef RGBLIGHT_ENABLE | ||
| 23 | rgblight_init(); | ||
| 24 | #endif | ||
| 25 | |||
| 26 | // Turn status LED on | 22 | // Turn status LED on |
| 27 | DDRE |= (1<<6); | 23 | DDRE |= (1<<6); |
| 28 | PORTE |= (1<<6); | 24 | PORTE |= (1<<6); |
| @@ -61,20 +57,20 @@ void backlight_init_ports() | |||
| 61 | // Setup PB7 as output and output low. | 57 | // Setup PB7 as output and output low. |
| 62 | DDRB |= (1<<7); | 58 | DDRB |= (1<<7); |
| 63 | PORTB &= ~(1<<7); | 59 | PORTB &= ~(1<<7); |
| 64 | 60 | ||
| 65 | // Use full 16-bit resolution. | 61 | // Use full 16-bit resolution. |
| 66 | ICR1 = 0xFFFF; | 62 | ICR1 = 0xFFFF; |
| 67 | 63 | ||
| 68 | // I could write a wall of text here to explain... but TL;DW | 64 | // I could write a wall of text here to explain... but TL;DW |
| 69 | // Go read the ATmega32u4 datasheet. | 65 | // Go read the ATmega32u4 datasheet. |
| 70 | // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on | 66 | // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on |
| 71 | 67 | ||
| 72 | // Pin PB7 = OCR1C (Timer 1, Channel C) | 68 | // Pin PB7 = OCR1C (Timer 1, Channel C) |
| 73 | // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0 | 69 | // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0 |
| 74 | // (i.e. start high, go low when counter matches.) | 70 | // (i.e. start high, go low when counter matches.) |
| 75 | // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0 | 71 | // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0 |
| 76 | // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1 | 72 | // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1 |
| 77 | 73 | ||
| 78 | TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010; | 74 | TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010; |
| 79 | TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; | 75 | TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; |
| 80 | 76 | ||
| @@ -100,7 +96,7 @@ void backlight_set(uint8_t level) | |||
| 100 | // Set the brightness | 96 | // Set the brightness |
| 101 | CHANNEL = 0xFFFF; | 97 | CHANNEL = 0xFFFF; |
| 102 | } | 98 | } |
| 103 | else | 99 | else |
| 104 | { | 100 | { |
| 105 | // Turn on PWM control of PB7 | 101 | // Turn on PWM control of PB7 |
| 106 | TCCR1A |= _BV(COM1C1); | 102 | TCCR1A |= _BV(COM1C1); |
| @@ -303,4 +299,4 @@ ISR(TIMER1_COMPA_vect) | |||
| 303 | 299 | ||
| 304 | 300 | ||
| 305 | 301 | ||
| 306 | #endif \ No newline at end of file | 302 | #endif |
