Skip to content

Commit

Permalink
bastardkb/dilemma/assembled: add new keyboard
Browse files Browse the repository at this point in the history
Fixes qmk#20
  • Loading branch information
0xcharly committed Nov 9, 2022
1 parent e47ead7 commit 618088f
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 1 deletion.
32 changes: 32 additions & 0 deletions keyboards/bastardkb/dilemma/assembled/assembled.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "quantum.h"

// Forward declare RP2040 SDK declaration.
void gpio_init(uint gpio);

void keyboard_pre_init_user(void) {
// Ensures that GP26 through GP29 are initialized as digital inputs (as
// opposed to analog inputs). These GPIOs are shared with A0 through A3,
// respectively. On RP2040-B2 and later, the digital inputs are disabled by
// default (see RP2040-E6).
gpio_init(GP26);
gpio_init(GP27);
gpio_init(GP28);
gpio_init(GP29);
}
46 changes: 46 additions & 0 deletions keyboards/bastardkb/dilemma/assembled/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

/* Key matrix configuration. */
#define MATRIX_ROW_PINS \
{ GP4, GP5, GP28, GP26 }
#define MATRIX_COL_PINS \
{ GP8, GP9, GP7, GP6, GP27 }

/* Handedness. */
#define SPLIT_HAND_PIN GP29
#define SPLIT_HAND_PIN_LOW_IS_LEFT // High -> right, Low -> left.

/* serial.c configuration (for split keyboard). */
#define SOFT_SERIAL_PIN GP1

/* CRC. */
#define CRC8_USE_TABLE
#define CRC8_OPTIMIZE_SPEED

/* Cirque trackpad. */
#define SPI_SCK_PIN GP22
#define SPI_MOSI_PIN GP23
#define SPI_MISO_PIN GP20
#define CIRQUE_PINNACLE_SPI_CS_PIN GP21

/* Reset. */
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP17
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 1000U
22 changes: 22 additions & 0 deletions keyboards/bastardkb/dilemma/assembled/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#define HAL_USE_SPI TRUE

#include_next "halconf.h"
7 changes: 7 additions & 0 deletions keyboards/bastardkb/dilemma/assembled/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"keyboard_name": "Dilemma Assembled",
"usb": {
"device_version": "1.0.0",
},
}

23 changes: 23 additions & 0 deletions keyboards/bastardkb/dilemma/assembled/mcuconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include_next "mcuconf.h"

#undef RP_SPI_USE_SPI1
#define RP_SPI_USE_SPI1 TRUE
12 changes: 12 additions & 0 deletions keyboards/bastardkb/dilemma/assembled/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# MCU name
MCU = RP2040

# Bootloader selection
BOOTLOADER = rp2040

# RP2040-specific options
PICO_INTRINSICS_ENABLED = no # ATM Unsupported by ChibiOS.
SERIAL_DRIVER = vendor

# Assembled version uses SPI instead of I2C.
POINTING_DEVICE_DRIVER = cirque_pinnacle_spi
2 changes: 1 addition & 1 deletion keyboards/bastardkb/dilemma/splinky/config.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/**
* Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
*
* This program is free software: you can redistribute it and/or modify
Expand Down

0 comments on commit 618088f

Please sign in to comment.