A quick fix for backlight
This commit is contained in:
parent
e96f00a0bf
commit
78e21c18c0
@ -33,20 +33,26 @@ void backlight_set(uint8_t level)
|
|||||||
// Turn on PWM
|
// Turn on PWM
|
||||||
cli();
|
cli();
|
||||||
DDRC |= (1<<PC6);
|
DDRC |= (1<<PC6);
|
||||||
TCCR3A |= ( (1<<WGM30) | (1<<COM3A1) );
|
//TCCR3A = 0b10101001;
|
||||||
|
//TCCR3B = 0b00000011;
|
||||||
|
TCCR3A |= ( (1<<WGM30) | (1<<COM3A1) | (1<<COM3B1) | (1<<COM3C1) );
|
||||||
TCCR3B |= ( (1<<CS31) | (1<<CS30) );
|
TCCR3B |= ( (1<<CS31) | (1<<CS30) );
|
||||||
sei();
|
sei();
|
||||||
// Set PWM
|
// Set PWM
|
||||||
OCR3A = pgm_read_byte(&backlight_table[level]);
|
OCR3A = pgm_read_byte(&backlight_table[level]);
|
||||||
|
OCR3B = pgm_read_byte(&backlight_table[level]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Turn off PWM
|
// Turn off PWM
|
||||||
cli();
|
cli();
|
||||||
DDRC &= ~(1<<PC6);
|
DDRC &= ~(1<<PC6);
|
||||||
TCCR3A &= ~( (1<<WGM30) | (1<<COM3A1) );
|
//TCCR3A = 0b00000000;
|
||||||
|
//TCCR3B = 0b00000000;
|
||||||
|
TCCR3A &= ~( (1<<WGM30) | (1<<COM3A1) | (1<<COM3B1) | (1<<COM3C1) );
|
||||||
TCCR3B &= ~( (1<<CS31) | (1<<CS30) );
|
TCCR3B &= ~( (1<<CS31) | (1<<CS30) );
|
||||||
sei();
|
sei();
|
||||||
// Set PWM
|
// Set PWM
|
||||||
OCR3A = 0;
|
OCR3A = 0;
|
||||||
|
OCR3B = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user