// Copyright 2022 Philip Gaber (@qhga)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

/* key matrix size */
#define MATRIX_ROWS 12
#define MATRIX_COLS 7

/*
 * Keyboard Matrix Assignments
 *
 * Change this to how you wired your keyboard
 * COLS: AVR pins used for columns, left to right
 * ROWS: AVR pins used for rows, top to bottom
 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
 *                  ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
 *
 */
#define MATRIX_ROW_PINS { GP4, GP5, GP6, GP7, GP8, GP9 }
#define MATRIX_COL_PINS { GP28, GP27, GP26, GP22, GP20, GP23, GP21 }
#define BOOTMAGIC_ROW 0
#define BOOTMAGIC_COLUMN 6
#define BOOTMAGIC_ROW_RIGHT 6
#define BOOTMAGIC_COLUMN_RIGHT 6

/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW
// Set the handedness by writing it to EEPROM
#define EE_HANDS
// Used in ChibiOS/ARM boards that do not support VBUS detection (r2040 promicro, not liatris)
#define SPLIT_USB_DETECT
// ATTENTION: This has to be enabled on both halves so make sure you have a button on each
// half (independently) to get the half into bootloader mode. (e.g. BOOTMAGIC keys for both halves)
#define SPLIT_WATCHDOG_ENABLE
#define SPLIT_WATCHDOG_TIMEOUT 3000
// https://github.com/qmk/qmk_firmware/blob/master/docs/serial_driver.md#usart-full-duplex
#define SERIAL_USART_FULL_DUPLEX   // Enable full duplex operation mode.
#define SERIAL_USART_TX_PIN GP0     // USART TX pin
#define SERIAL_USART_RX_PIN GP1     // USART RX pin

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 20
#define USB_POLLING_INTERVAL_MS 1

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
