summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortmk <hasu@tmk-kbd.com>2015-07-23 11:57:15 +0900
committertmk <hasu@tmk-kbd.com>2015-07-23 11:57:15 +0900
commitd4220ac9f36209ba7e641f35181b41f84b9c98da (patch)
treeab3de73a2ea0fb0ee99ff63fe29c024893fb9d6d
parent1efdd867c8f88ad779ad82e1b22df62bf6be8fe9 (diff)
hhkb: Add power saving code of matrix scan for JP
-rw-r--r--keyboard/hhkb/hhkb_avr.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/keyboard/hhkb/hhkb_avr.h b/keyboard/hhkb/hhkb_avr.h
index 7ea6322c73..c3e176fa09 100644
--- a/keyboard/hhkb/hhkb_avr.h
+++ b/keyboard/hhkb/hhkb_avr.h
@@ -45,12 +45,20 @@ 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); }