Add support for Geistmaschine Macropod (#20116)
Co-authored-by: Pablo Martínez <58857054+elpekenin@users.noreply.github.com>master
parent
ebe36ea83c
commit
5687fc7646
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* 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 size, only 1x4 are used in current state.
|
||||
IO expander setup would allow up to 1x16 + 1 from the MCU */
|
||||
#define MATRIX_ROWS 1
|
||||
#define MATRIX_COLS 17
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"manufacturer": "Geistmaschine",
|
||||
"keyboard_name": "Macropod",
|
||||
"maintainer": "ebastler",
|
||||
"bootloader": "atmel-dfu",
|
||||
"processor": "atmega32u4",
|
||||
"url": "https://geistmaschine.io/",
|
||||
"usb": {
|
||||
"device_version": "1.0.0",
|
||||
"pid": "0x0004",
|
||||
"vid": "0x676D"
|
||||
},
|
||||
"features": {
|
||||
"bootmagic": true,
|
||||
"command": false,
|
||||
"console": false,
|
||||
"extrakey": true,
|
||||
"mousekey": false,
|
||||
"nkro": false,
|
||||
"encoder": true
|
||||
},
|
||||
"encoder": {
|
||||
"rotary": [
|
||||
{
|
||||
"pin_a": "D3",
|
||||
"pin_b": "D5",
|
||||
"resolution": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"layouts": {
|
||||
"LAYOUT_fourkey": {
|
||||
"layout": [
|
||||
{"x":0, "y":0, "matrix":[0,0] },
|
||||
{"x":0, "y":1.25, "matrix":[0,1] },
|
||||
{"x":0, "y":2.25, "matrix":[0,2] },
|
||||
{"x":0, "y":3.25, "matrix":[0,3] }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/* Copyright 2023 Moritz Plattner
|
||||
*
|
||||
* 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 QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT_fourkey (
|
||||
LT(1, KC_MUTE), KC_MPRV, KC_MPLY, KC_MNXT
|
||||
),
|
||||
|
||||
[1] = LAYOUT_fourkey (
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||
),
|
||||
|
||||
};
|
||||
|
||||
#if defined(ENCODER_MAP_ENABLE)
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
|
||||
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
|
||||
[1] = { ENCODER_CCW_CW(KC_MRWD, KC_MFFD) },
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1 @@
|
|||
ENCODER_MAP_ENABLE = yes
|
|
@ -0,0 +1,35 @@
|
|||
/* Copyright 2023 Moritz Plattner
|
||||
*
|
||||
* 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 QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT_fourkey (
|
||||
LT(1, KC_MUTE), KC_MPRV, KC_MPLY, KC_MNXT
|
||||
),
|
||||
|
||||
[1] = LAYOUT_fourkey (
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||
),
|
||||
|
||||
};
|
||||
|
||||
#if defined(ENCODER_MAP_ENABLE)
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
|
||||
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
|
||||
[1] = { ENCODER_CCW_CW(KC_MRWD, KC_MFFD) },
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1,2 @@
|
|||
ENCODER_MAP_ENABLE = yes
|
||||
VIA_ENABLE = yes
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2022 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
// This will be overridden by encoder map in all default keymaps, but serves as a catch-all for user keymaps that may omit the map.
|
||||
#if defined (ENCODER_ENABLE) && !defined (ENCODER_MAP_ENABLE)
|
||||
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||
if (!encoder_update_user(index, clockwise)) {
|
||||
return false; /* Don't process further events if user function exists and returns false */
|
||||
}
|
||||
if (index == 0) { /* First encoder */
|
||||
if (clockwise) {
|
||||
tap_code_delay(KC_VOLU, 10);
|
||||
} else {
|
||||
tap_code_delay(KC_VOLD, 10);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,87 @@
|
|||
/* Copyright 2023 ebastler and elpekenin
|
||||
*
|
||||
* 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 "pca9555.h"
|
||||
#include "quantum.h"
|
||||
|
||||
// PCA9555 i2c address, 0x20: A0 = 0, A1 = 0, A2 = 0
|
||||
#define IC1 0x20
|
||||
|
||||
// Define how long to wait to reach the IO expander after connection loss again
|
||||
// Since this board is modular, it should not spam unnecessary i2c requests if used without a module
|
||||
#define RETRY_TIMESPAN 2000
|
||||
|
||||
typedef enum {
|
||||
PLUGGED,
|
||||
DOUBTFUL,
|
||||
UNPLUGGED
|
||||
} expander_status_t;
|
||||
|
||||
void pca9555_setup(void) {
|
||||
// Initialize the expander, no need to set ports to inputs as that is the default behavior
|
||||
pca9555_init(IC1);
|
||||
}
|
||||
|
||||
void matrix_init_custom(void) {
|
||||
// Encoder pushbutton on the MCU is connected to PD2
|
||||
setPinInputHigh(D2);
|
||||
pca9555_setup();
|
||||
}
|
||||
|
||||
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
||||
static expander_status_t status = DOUBTFUL;
|
||||
static uint32_t retry_timer = 0;
|
||||
|
||||
// initialize one byte filled with 1
|
||||
uint8_t pin_states = 0xFF;
|
||||
|
||||
|
||||
if (status != UNPLUGGED || timer_elapsed32(retry_timer) > RETRY_TIMESPAN) {
|
||||
// If the chip was unplugged before, it needs to be re-initialized
|
||||
if(status==UNPLUGGED) {
|
||||
pca9555_setup();
|
||||
}
|
||||
// Read the entire port into this byte, 1 = not pressed, 0 = pressed
|
||||
bool ret = pca9555_readPins(IC1, PCA9555_PORT0, &pin_states);
|
||||
|
||||
// Update state
|
||||
if (ret) {
|
||||
status = PLUGGED;
|
||||
} else {
|
||||
switch (status) {
|
||||
case PLUGGED:
|
||||
status = DOUBTFUL;
|
||||
break;
|
||||
|
||||
case DOUBTFUL:
|
||||
status = UNPLUGGED;
|
||||
break;
|
||||
|
||||
// If we've diagnosed as unplugged, update timer to not read I2C
|
||||
case UNPLUGGED:
|
||||
retry_timer = timer_read32();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Shift pin states by 1 to make room for the switch connected to the MCU, then OR them together and invert (as QMK uses inverted logic compared to the electrical levels)
|
||||
matrix_row_t data = ~(pin_states << 1 | readPin(D2));
|
||||
|
||||
bool changed = current_matrix[0] != data;
|
||||
current_matrix[0] = data;
|
||||
|
||||
return changed;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
# Geistmaschine Macropod
|
||||
|
||||
![macropod](https://i.imgur.com/lAsCslA.png)
|
||||
|
||||
Macropod is a modular macropad, designed around a central big encoder with a magnetic connector for modularity. The default module uses three MX style keys.
|
||||
* Keyboard Maintainer: [ebastler](https://github.com/ebastler)
|
||||
* Hardware Supported: Macropod rev1
|
||||
* Hardware Availability: [geistmaschine.io](https://geistmaschine.io/)
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
qmk compile -kb geistmaschine/macropod -km default
|
||||
|
||||
Flashing example for this keyboard:
|
||||
|
||||
qmk flash -kb geistmaschine/macropod -km default
|
||||
|
||||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
||||
|
||||
## Bootloader
|
||||
|
||||
Enter the bootloader in 2 ways:
|
||||
|
||||
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (the knob on the main module) and plug in the keyboard
|
||||
* **Physical reset button**: Briefly tap the button marked "RST" on the back of the main module PCB
|
|
@ -0,0 +1,5 @@
|
|||
CUSTOM_MATRIX = lite
|
||||
|
||||
VPATH += drivers/gpio
|
||||
SRC += pca9555.c matrix.c
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
Loading…
Reference in New Issue