1
0

Fix for new v3 PCB of AKB96

This commit is contained in:
Kai Ryu 2014-09-22 10:16:17 +09:00
parent 7d995a595b
commit bb10a45a1f
3 changed files with 29 additions and 7 deletions

View File

@ -47,7 +47,11 @@ void backlight_enable(void)
softpwm_led_enable();
#else
// Turn on PWM
#if defined(REV_V2)
DDRB |= (1<<PB6);
#elif defined(REV_V3)
DDRB |= (1<<PB7);
#endif
cli();
TCCR1A |= ((1<<WGM10) | (1<<COM1B1));
TCCR1B |= ((1<<CS11) | (1<<CS10));
@ -62,7 +66,11 @@ void backlight_disable(void)
#else
// Turn off PWM
cli();
#if defined(REV_V2)
DDRB &= ~(1<<PB6);
#elif defined(REV_V3)
DDRB &= ~(1<<PB7);
#endif
TCCR1A &= ~( (1<<WGM10) | (1<<COM1B1) );
TCCR1B &= ~( (1<<CS11) | (1<<CS10) );
sei();
@ -166,18 +174,31 @@ inline void backlight_set_raw(uint8_t raw)
#ifndef LEDMAP_ENABLE
void softpwm_led_init(void)
{
#if defined(REV_V2)
DDRB |= (1<<PB6);
PORTB &= ~(1<<PB6);
#elif defined(REV_V3)
DDRB |= (1<<PB7);
PORTB &= ~(1<<PB7);
#endif
}
void softpwm_led_on(uint8_t index)
{
#if defined(REV_V2)
PORTB |= (1<<PB6);
#elif defined(REV_V3)
PORTB |= (1<<PB7);
#endif
}
void softpwm_led_off(uint8_t index)
{
#if defined(REV_V2)
PORTB &= ~(1<<PB6);
#elif defined(REV_V3)
PORTB &= ~(1<<PB7);
#endif
}
#endif
#endif

View File

@ -29,14 +29,14 @@ uint8_t ledmap_get_code(uint8_t index)
void ledmap_led_init(void)
{
#if defined(REV_V2)
DDRB |= (1<<PB5 | 1<<PB2);
PORTB &= ~(1<<PB5 | 1<<PB2);
DDRB |= (1<<PB6 | 1<<PB5 | 1<<PB2);
PORTB &= ~(1<<PB6 | 1<<PB5 | 1<<PB2);
#elif defined(REV_V3)
DDRC |= (1<<PC7 | 1<<PC6);
PORTC &= ~(1<<PC7 | 1<<PC6);
DDRB |= (1<<PB7);
PORTB &= ~(1<<PB7);
#endif
DDRB |= (1<<PB6);
PORTB &= ~(1<<PB6);
}
void ledmap_led_on(uint8_t index)
@ -62,7 +62,7 @@ void ledmap_led_on(uint8_t index)
PORTC |= (1<<PC6);
break;
case 2:
PORTB |= (1<<PB6);
PORTB |= (1<<PB7);
break;
}
#endif
@ -91,7 +91,7 @@ void ledmap_led_off(uint8_t index)
PORTC &= ~(1<<PC6);
break;
case 2:
PORTB &= ~(1<<PB6);
PORTB &= ~(1<<PB7);
break;
}
#endif

View File

@ -166,7 +166,8 @@ static matrix_row_t read_cols(void)
(PINF&(1<<PF5) ? 0 : (1<<4)) |
(PINF&(1<<PF4) ? 0 : (1<<5));
#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
}