X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=keyboard%2Fhhkb%2Fhhkb_avr.h;h=5cb1d0d7d8365d594450b0ddcde0704c650767ee;hb=bb955a819af89e74843743e268aa7b4ceb06cc4e;hp=c3e176fa09f6055afcc168c2cd4b66fb9477e917;hpb=d4220ac9f36209ba7e641f35181b41f84b9c98da;p=max%2Ftmk_keyboard.git diff --git a/keyboard/hhkb/hhkb_avr.h b/keyboard/hhkb/hhkb_avr.h index c3e176fa..5cb1d0d7 100644 --- a/keyboard/hhkb/hhkb_avr.h +++ b/keyboard/hhkb/hhkb_avr.h @@ -45,20 +45,12 @@ static inline void KEY_PREV_OFF(void) { (PORTB &= ~(1<<7)); } static inline void KEY_POWER_ON(void) { DDRB = 0xFF; PORTB = 0x40; // change pins output DDRD |= (1<<4); PORTD |= (1<<4); // MOS FET switch on -#ifdef HHKB_JP - DDRC |= (1<<6|1<<7); - PORTC |= (1<<6|1<<7); -#endif /* Without this wait you will miss or get false key events. */ _delay_ms(5); // wait for powering up } static inline void KEY_POWER_OFF(void) { /* input with pull-up consumes less than without it when pin is open. */ DDRB = 0x00; PORTB = 0xFF; // change pins input with pull-up -#ifdef HHKB_JP - DDRC &= ~(1<<6|1<<7); - PORTC |= (1<<6|1<<7); -#endif DDRD |= (1<<4); PORTD &= ~(1<<4); // MOS FET switch off } static inline bool KEY_POWER_STATE(void) { return PORTD & (1<<4); } @@ -79,6 +71,10 @@ static inline void KEY_INIT(void) /* row extention for HHKB JP */ DDRC |= (1<<6|1<<7); PORTC |= (1<<6|1<<7); +#else + /* input with pull up to save power */ + DDRC &= ~(1<<6|1<<7); + PORTC |= (1<<6|1<<7); #endif KEY_UNABLE(); KEY_PREV_OFF();