Fix for new v3 PCB of AKB96
This commit is contained in:
parent
7d995a595b
commit
bb10a45a1f
@ -47,7 +47,11 @@ void backlight_enable(void)
|
|||||||
softpwm_led_enable();
|
softpwm_led_enable();
|
||||||
#else
|
#else
|
||||||
// Turn on PWM
|
// Turn on PWM
|
||||||
|
#if defined(REV_V2)
|
||||||
DDRB |= (1<<PB6);
|
DDRB |= (1<<PB6);
|
||||||
|
#elif defined(REV_V3)
|
||||||
|
DDRB |= (1<<PB7);
|
||||||
|
#endif
|
||||||
cli();
|
cli();
|
||||||
TCCR1A |= ((1<<WGM10) | (1<<COM1B1));
|
TCCR1A |= ((1<<WGM10) | (1<<COM1B1));
|
||||||
TCCR1B |= ((1<<CS11) | (1<<CS10));
|
TCCR1B |= ((1<<CS11) | (1<<CS10));
|
||||||
@ -62,7 +66,11 @@ void backlight_disable(void)
|
|||||||
#else
|
#else
|
||||||
// Turn off PWM
|
// Turn off PWM
|
||||||
cli();
|
cli();
|
||||||
|
#if defined(REV_V2)
|
||||||
DDRB &= ~(1<<PB6);
|
DDRB &= ~(1<<PB6);
|
||||||
|
#elif defined(REV_V3)
|
||||||
|
DDRB &= ~(1<<PB7);
|
||||||
|
#endif
|
||||||
TCCR1A &= ~( (1<<WGM10) | (1<<COM1B1) );
|
TCCR1A &= ~( (1<<WGM10) | (1<<COM1B1) );
|
||||||
TCCR1B &= ~( (1<<CS11) | (1<<CS10) );
|
TCCR1B &= ~( (1<<CS11) | (1<<CS10) );
|
||||||
sei();
|
sei();
|
||||||
@ -166,18 +174,31 @@ inline void backlight_set_raw(uint8_t raw)
|
|||||||
#ifndef LEDMAP_ENABLE
|
#ifndef LEDMAP_ENABLE
|
||||||
void softpwm_led_init(void)
|
void softpwm_led_init(void)
|
||||||
{
|
{
|
||||||
|
#if defined(REV_V2)
|
||||||
DDRB |= (1<<PB6);
|
DDRB |= (1<<PB6);
|
||||||
PORTB &= ~(1<<PB6);
|
PORTB &= ~(1<<PB6);
|
||||||
|
#elif defined(REV_V3)
|
||||||
|
DDRB |= (1<<PB7);
|
||||||
|
PORTB &= ~(1<<PB7);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void softpwm_led_on(uint8_t index)
|
void softpwm_led_on(uint8_t index)
|
||||||
{
|
{
|
||||||
|
#if defined(REV_V2)
|
||||||
PORTB |= (1<<PB6);
|
PORTB |= (1<<PB6);
|
||||||
|
#elif defined(REV_V3)
|
||||||
|
PORTB |= (1<<PB7);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void softpwm_led_off(uint8_t index)
|
void softpwm_led_off(uint8_t index)
|
||||||
{
|
{
|
||||||
|
#if defined(REV_V2)
|
||||||
PORTB &= ~(1<<PB6);
|
PORTB &= ~(1<<PB6);
|
||||||
|
#elif defined(REV_V3)
|
||||||
|
PORTB &= ~(1<<PB7);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,14 +29,14 @@ uint8_t ledmap_get_code(uint8_t index)
|
|||||||
void ledmap_led_init(void)
|
void ledmap_led_init(void)
|
||||||
{
|
{
|
||||||
#if defined(REV_V2)
|
#if defined(REV_V2)
|
||||||
DDRB |= (1<<PB5 | 1<<PB2);
|
DDRB |= (1<<PB6 | 1<<PB5 | 1<<PB2);
|
||||||
PORTB &= ~(1<<PB5 | 1<<PB2);
|
PORTB &= ~(1<<PB6 | 1<<PB5 | 1<<PB2);
|
||||||
#elif defined(REV_V3)
|
#elif defined(REV_V3)
|
||||||
DDRC |= (1<<PC7 | 1<<PC6);
|
DDRC |= (1<<PC7 | 1<<PC6);
|
||||||
PORTC &= ~(1<<PC7 | 1<<PC6);
|
PORTC &= ~(1<<PC7 | 1<<PC6);
|
||||||
|
DDRB |= (1<<PB7);
|
||||||
|
PORTB &= ~(1<<PB7);
|
||||||
#endif
|
#endif
|
||||||
DDRB |= (1<<PB6);
|
|
||||||
PORTB &= ~(1<<PB6);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ledmap_led_on(uint8_t index)
|
void ledmap_led_on(uint8_t index)
|
||||||
@ -62,7 +62,7 @@ void ledmap_led_on(uint8_t index)
|
|||||||
PORTC |= (1<<PC6);
|
PORTC |= (1<<PC6);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
PORTB |= (1<<PB6);
|
PORTB |= (1<<PB7);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -91,7 +91,7 @@ void ledmap_led_off(uint8_t index)
|
|||||||
PORTC &= ~(1<<PC6);
|
PORTC &= ~(1<<PC6);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
PORTB &= ~(1<<PB6);
|
PORTB &= ~(1<<PB7);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -166,7 +166,8 @@ static matrix_row_t read_cols(void)
|
|||||||
(PINF&(1<<PF5) ? 0 : (1<<4)) |
|
(PINF&(1<<PF5) ? 0 : (1<<4)) |
|
||||||
(PINF&(1<<PF4) ? 0 : (1<<5));
|
(PINF&(1<<PF4) ? 0 : (1<<5));
|
||||||
#elif defined(REV_V3)
|
#elif defined(REV_V3)
|
||||||
return ((~(PINF) >> 4) & 0x0F) | (~(PINF) & (1<<PF0 | 1<<PF1));
|
//return ((~(PINF) >> 4) & 0x0F) | (~(PINF) & (1<<PF0 | 1<<PF1));
|
||||||
|
return (~(PINF) & 0b00000011) | ((~(PINF) >> 2) & 0b00111100);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user