From: tmk Date: Sun, 6 Aug 2017 00:29:36 +0000 (+0900) Subject: pana_m8: Fix unimap X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;h=13fe8ac87b779cae145664c04f655282a3dc299a;p=max%2Ftmk_keyboard.git pana_m8: Fix unimap --- diff --git a/keyboard/pana_m8/README b/keyboard/pana_m8/README index c2540b75..234da931 100644 --- a/keyboard/pana_m8/README +++ b/keyboard/pana_m8/README @@ -1,10 +1,13 @@ Panasonic VP-0187A ================== -It is unknown keyboard from Panasonic +2017/08/06 -6P6C connector +It is unknown keyboard from Panasonic with Hirose Cherry M8 and 6P6C connector. -Hirose Cheery M8 switches +Pictures: +http://imgur.com/a/GAZE7 + +Hirose Cheery M8 switches: https://deskthority.net/wiki/Cherry_M8 @@ -28,16 +31,25 @@ The keyboard is comprised of some of 4000 series IC without microcontroller. ||| |decoder| ||| --------- ||| |||||| col[0..7] - ABC vvvvvvv pull down + ABC TC4512 vvvvvvv pull down ---------- <----|+++++++|--100K--+ |data | <----|+++++++|--100K--+ STATE<--|selector| <----|+++++++|--100K--+ | 7 to 1 | <----|+++++++|--100K--+ ---------- <----|+++++++|--100K--+ - row[0..7] | - 8x8 matrix - - GND + row[0..7] | 8x8 matrix | + | - + TC4078 | GND + ------ | + SENSE<----| OR |========+ OR'd row[0..7] + ------ +- TC4520BP - Dual Binary Up Counter +- TC4028B - BCD-to-Decimal Decoder +- TC4512BP - 8-Channel Data Selector +- TC4081BP - Quad 2-Input AND Gate +- TC4071BP - Quad 2-Input OR Gate +- TC4078BP - 8-Input NOR/OR Gate Matrix @@ -60,14 +72,23 @@ Matrix 1. VCC 2. Clock - sends clock to binary counter TC4520 3. Key State - indicates hi if key selected by counter is active -4. Sense - indicates hi if any key is active while Reset is hi. +4. Sense - indicates lo if any key is active while Reset is hi. 5. Reset - resets counter and drives all column 6. GND 123456 ,--------. - | | + | |||||| | | | `--____--' plug + +Ping configuration +------------------ +AVR ATmega32u4 is used as protocol converter. + + PD0: Clock. Counter couts up at falling edge. + PD1: Key State. Hi if selected key is activated. + PD2: Sense. Lo if any key is activated while Reset is Hi. + PD3: Reset. Resets counters at riging edge. diff --git a/keyboard/pana_m8/pana_m8.c b/keyboard/pana_m8/pana_m8.c index 62fdc748..19f88487 100644 --- a/keyboard/pana_m8/pana_m8.c +++ b/keyboard/pana_m8/pana_m8.c @@ -21,25 +21,26 @@ void matrix_init(void) debug_keyboard = true; debug_matrix = true; - // PD0:Clock PD1:State PD2:Sense_All PD3:Reset(Scan_All) - DDRD = (1<<3) | (1<<0); - PORTD = (1<<2) | (1<<1); + // PD0: Clock. Counter couts up at falling edge. + // PD1: Key State. Hi if selected key is activated. + // PD2: Sense. Lo if any key is activated while Reset is Hi. + // PD3: Reset. Resets counters at riging edge. + DDRD |= (1<<3) | (1<<0); // output + DDRD &= ~((1<<2) | (1<<1)); // input + PORTD &= ~((1<<3) | (1<<0)); // low + PORTD |= (1<<2) | (1<<1); // pull-up dprintf("init\n"); } uint8_t matrix_scan(void) { - - // Scan_all resets counter + // TODO: debouce & unplug detect + // Reset counters RST_HI(); wait_us(10); - // TODO: cannot get reliable value from SENSE() - //uint8_t s = SENSE() | STATE(); - //if (!SENSE()) return 0; // no activated key RST_LO(); wait_us(10); - //if (!s) return 0; // 8x8 matrix: row:sense, col:drive, key_on:hi for (uint8_t col = 0; col < 8; col++) { @@ -53,7 +54,7 @@ uint8_t matrix_scan(void) matrix[row] &= ~(1<