From b92387b7499e21603e241d136db92c6e716b0cba Mon Sep 17 00:00:00 2001 From: Volodymyr Lukashevych Date: Tue, 11 Jun 2019 15:18:14 -0700 Subject: [Keymap] Add BB8520 trackpad support for CrKbd (#5925) * Add vlukash CrKbd keymap to support trackpad adapter. The trackpad adapter uses Elite-C board that has five extra pins. Also SPI pins are taken for trackpad, keymap config updates column data pins for matrix scan. * Update vlukash keymap * Enable pointing devide, configure mouse BTN1 * Set TAPPING_TERM to 300 * Add support for the BlackBerry 8520 trackpad * Add vlukash keymap for master-right no-trackpad version * Remap backspace * Set EXTRAKEY_ENABLE = yes * Update thumb keys mappings * Set bootloader to atmel-dfu * Sync keymap * Add scrolling support * Make debug LEDS conditional * Add support for both flex and no-flex PCBs * Add readme and rename root folders * Update readme file with blog link * Fix readme file formatting * Remove ADJUST keycode, code cleanup. * Add Win key to the keymap. --- keyboards/crkbd/rev1/matrix.c | 50 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 7 deletions(-) (limited to 'keyboards/crkbd/rev1') diff --git a/keyboards/crkbd/rev1/matrix.c b/keyboards/crkbd/rev1/matrix.c index 718cc57448..dd93506db1 100644 --- a/keyboards/crkbd/rev1/matrix.c +++ b/keyboards/crkbd/rev1/matrix.c @@ -93,6 +93,44 @@ uint8_t matrix_cols(void) return MATRIX_COLS; } +void tx_rx_leds_init(void) +{ +#ifndef NO_DEBUG_LEDS + TX_RX_LED_INIT; + TXLED0; + RXLED0; +#endif +} + +void tx_led_on(void) +{ +#ifndef NO_DEBUG_LEDS + TXLED1; +#endif +} + +void tx_led_off(void) +{ +#ifndef NO_DEBUG_LEDS + TXLED0; +#endif +} + +void rx_led_on(void) +{ +#ifndef NO_DEBUG_LEDS + RXLED1; +#endif +} + +void rx_led_off(void) +{ +#ifndef NO_DEBUG_LEDS + RXLED0; +#endif +} + + void matrix_init(void) { debug_enable = true; @@ -102,9 +140,7 @@ void matrix_init(void) unselect_rows(); init_cols(); - TX_RX_LED_INIT; - TXLED0; - RXLED0; + tx_rx_leds_init(); // initialize matrix state: all keys off for (uint8_t i=0; i < MATRIX_ROWS; i++) { @@ -189,10 +225,10 @@ int serial_transaction(int master_changed) { int ret=serial_update_buffers(); #endif if (ret ) { - if(ret==2) RXLED1; + if(ret==2) rx_led_on(); return 1; } - RXLED0; + rx_led_off(); memcpy(&matrix[slaveOffset], (void *)serial_slave_buffer, SERIAL_SLAVE_BUFFER_LENGTH); return 0; @@ -241,7 +277,7 @@ uint8_t matrix_master_scan(void) { if( serial_transaction(mchanged) ) { #endif // turn on the indicator led when halves are disconnected - TXLED1; + tx_led_on(); error_count++; @@ -254,7 +290,7 @@ uint8_t matrix_master_scan(void) { } } else { // turn off the indicator led on no error - TXLED0; + tx_led_off(); error_count = 0; } matrix_scan_quantum(); -- cgit v1.2.3