[Keyboard] Add configs for Centromere keyboard (#7467)

* Create readme.md

* Add files for Centromere

* Add keymap files for Centromere

* Add default keymap for Centromere

* Create keymap directory

* Add keymap files

* keymap directory cleanup

* Keyboard keymap directory cleanup

* Update keyboards/centromere/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/centromere/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keyboards/centromere/config.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Update keymap.c

* Update keymap.c

* Update centromere.c

Changed LED control to GPIO functions

* Update centromere.h

* Update rules.mk

* Update keyboards/centromere/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/keymaps/default_u2/keymap.c

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/keymaps/default/keymap.c

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/centromere.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/centromere.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/centromere.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/centromere.c

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/centromere.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/centromere.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/centromere/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Apply suggestions from code review

Co-Authored-By: fauxpark <fauxpark@gmail.com>

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: fauxpark <fauxpark@gmail.com>
master
spe2 2020-02-15 22:05:20 -07:00 committed by GitHub
parent 58101cbb73
commit 89c3355fd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 516 additions and 0 deletions

View File

@ -0,0 +1,48 @@
#include "centromere.h"
void uart_init(void) {
SERIAL_UART_INIT();
}
void led_init(void) {
#if MCU == atmega32u2
setPinOutput(C4); // Set red LED pin as output
setPinOutput(C5); // Set blue LED pin as output
setPinOutput(D1); // Set green LED pin as output
writePinHigh(C4); // Turn off red LED pin
writePinHigh(C5); // Turn off blue LED pin
writePinHigh(D1); // Turn off green LED pin
#else
setPinOutput(F4); // Set red LED pin as output
setPinOutput(F5); // Set blue LED pin as output
setPinOutput(D1); // Set green LED pin as output
writePinHigh(F4); // Turn off red LED pin
writePinHigh(F5); // Turn off blue LED pin
writePinHigh(D1); // Turn off green LED pin
#endif
}
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
uart_init();
led_init();
}
#ifdef SWAP_HANDS_ENABLE
__attribute__ ((weak))
const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
{{9, 0}, {8, 0}, {7, 0}, {6, 0}, {5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}},
{{9, 1}, {8, 1}, {7, 1}, {6, 1}, {5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}},
{{9, 2}, {8, 2}, {7, 2}, {6, 2}, {5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}},
{{9, 3}, {8, 3}, {7, 3}, {6, 3}, {5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}},
{{9, 4}, {8, 4}, {7, 4}, {6, 4}, {5, 4}, {4, 4}, {3, 4}, {2, 4}, {1, 4}, {0, 4}},
};
#endif

View File

@ -0,0 +1,47 @@
#pragma once
#include "quantum.h"
#if MCU == atmega32u2
#define red_led_off writePinHigh(C5)
#define red_led_on writePinLow(C5)
#define blu_led_off writePinHigh(C4)
#define blu_led_on writePinLow(C4)
#else
#define red_led_off writePinHigh(F5)
#define red_led_on writePinLow(F5)
#define blu_led_off writePinHigh(F4)
#define blu_led_on writePinLow(F4)
#endif
#define grn_led_off writePinHigh(D1)
#define grn_led_on writePinLow(D1)
#define set_led_off red_led_off; blu_led_off
#define set_led_red red_led_on; grn_led_off; blu_led_off
#define set_led_blue red_led_off; grn_led_off; blu_led_on
#define set_led_green red_led_off; grn_led_on; blu_led_off
#define set_led_yellow red_led_on; grn_led_on; blu_led_off
#define set_led_magenta red_led_on; grn_led_off; blu_led_on
#define set_led_cyan red_led_off; grn_led_on; blu_led_on
#define set_led_white red_led_on; grn_led_on; blu_led_on
// This a shortcut to help you visually see your layout.
// The first section contains all of the arguments
// The second converts the arguments into a two-dimensional array
#define LAYOUT( \
k0a, k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0b, \
k1a, k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1b,\
k2a, k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2b,\
k32, k33, k34, k35, k36, k37 \
) \
{ \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09 }, \
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19 }, \
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29 }, \
{ KC_NO, KC_NO, k32, k33, k34, k35, k36, k37, KC_NO, KC_NO }, \
{ KC_NO, KC_NO, k2a, k1a, k0a, k0b, k1b, k2b, KC_NO, KC_NO } \
}

View File

@ -0,0 +1,76 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
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 "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER Southpaw Design
#define PRODUCT centromere
#define DESCRIPTION Q.M.K. keyboard firmware for Centromere
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 10
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
//#define BACKLIGHT_LEVELS 3
#define ONESHOT_TIMEOUT 500
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
//#define NO_DEBUG
/* disable print */
//#define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
//UART settings for communication with the RF microcontroller
#define SERIAL_UART_BAUD 500000
#define SERIAL_UART_DATA UDR1
#define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
#define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1))
#define SERIAL_UART_INIT() do { \
/* baud rate */ \
UBRR1L = SERIAL_UART_UBRR; \
/* baud rate */ \
UBRR1H = SERIAL_UART_UBRR >> 8; \
/* enable TX and RX */ \
UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
/* 8-bit data */ \
UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
} while(0)

View File

@ -0,0 +1,69 @@
#include QMK_KEYBOARD_H
enum centromere_layers
{
_STD,
_NUM,
_FN
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_STD] = LAYOUT( \
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,\
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,\
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,\
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LGUI, MO(_FN), KC_SPC, KC_SPC,MO(_NUM), KC_RALT \
//`--------------------------' `--------------------------'
),
[_NUM] = LAYOUT( \
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,\
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,\
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP,KC_RIGHT, KC_ENT,\
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LGUI, MO(_FN), KC_SPC, KC_ENT,MO(_NUM), KC_RALT \
//`--------------------------' `--------------------------'
),
[_FN] = LAYOUT( \
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,\
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LCTL, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV,\
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD,\
KC_LGUI, MO(_FN), KC_SPC, KC_ENT,MO(_NUM), KC_RALT \
//`--------------------------' `--------------------------'
),
};
void matrix_scan_user(void) {
uint8_t layer = get_highest_layer(layer_state);
switch (layer) {
case _STD:
set_led_off;
break;
case _FN:
set_led_blue;
break;
case _NUM:
set_led_red;
break;
default:
break;
}
};

View File

@ -0,0 +1,68 @@
#include QMK_KEYBOARD_H
enum centromere_layers
{
_STD,
_NUM,
_FN
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_STD] = LAYOUT( \
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,\
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,\
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,\
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LGUI, MO(_FN), KC_SPC, KC_SPC,MO(_NUM), KC_RALT \
//`--------------------------' `--------------------------'
),
[_NUM] = LAYOUT( \
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,\
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,\
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP,KC_RIGHT, KC_ENT,\
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LGUI, MO(_FN), KC_SPC, KC_ENT,MO(_NUM), KC_RALT \
//`--------------------------' `--------------------------'
),
[_FN] = LAYOUT( \
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,\
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LCTL, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV,\
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD,\
KC_LGUI, MO(_FN), KC_SPC, KC_ENT,MO(_NUM), KC_RALT \
//`--------------------------' `--------------------------'
),
};
void matrix_scan_user(void) {
uint8_t layer = get_highest_layer(layer_state);
switch (layer) {
case _STD:
set_led_off;
break;
case _FN:
set_led_blue;
break;
case _NUM:
set_led_red;
break;
default:
break;
}
};

View File

@ -0,0 +1,12 @@
# MCU name
MCU = atmega32u2
# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = atmel-dfu

View File

@ -0,0 +1,153 @@
/*
Copyright 2012 Jun Wako
Copyright 2014 Jack Humbert
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 <stdint.h>
#include <stdbool.h>
#if defined(__AVR__)
#include <avr/io.h>
#endif
#include "wait.h"
#include "print.h"
#include "debug.h"
#include "util.h"
#include "matrix.h"
#include "timer.h"
#if (MATRIX_COLS <= 8)
# define print_matrix_header() print("\nr/c 01234567\n")
# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
# define matrix_bitpop(i) bitpop(matrix[i])
# define ROW_SHIFTER ((uint8_t)1)
#elif (MATRIX_COLS <= 16)
# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n")
# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row))
# define matrix_bitpop(i) bitpop16(matrix[i])
# define ROW_SHIFTER ((uint16_t)1)
#elif (MATRIX_COLS <= 32)
# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n")
# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row))
# define matrix_bitpop(i) bitpop32(matrix[i])
# define ROW_SHIFTER ((uint32_t)1)
#endif
/* matrix state(1:on, 0:off) */
static matrix_row_t matrix[MATRIX_ROWS];
__attribute__ ((weak))
void matrix_init_kb(void) {
matrix_init_user();
}
__attribute__ ((weak))
void matrix_scan_kb(void) {
matrix_scan_user();
}
__attribute__ ((weak))
void matrix_init_user(void) {
}
__attribute__ ((weak))
void matrix_scan_user(void) {
}
inline
uint8_t matrix_rows(void) {
return MATRIX_ROWS;
}
inline
uint8_t matrix_cols(void) {
return MATRIX_COLS;
}
void matrix_init(void) {
matrix_init_quantum();
}
uint8_t matrix_scan(void)
{
SERIAL_UART_INIT();
uint32_t timeout = 0;
//the s character requests the RF remote slave to send the matrix information
SERIAL_UART_DATA = 's';
//trust the external keystates, erase the last set of data
uint8_t uart_data[11] = {0};
//there are 10 bytes corresponding to 1w columns, and an end byte
for (uint8_t i = 0; i < 11; i++) {
//wait for the serial data, timeout if it's been too long
while(!SERIAL_UART_RXD_PRESENT){
timeout++;
if (timeout > 10000){
break;
}
}
uart_data[i] = SERIAL_UART_DATA;
}
//check for the end packet, the key state bytes use the LSBs, so 0xE0
//will only show up here if the correct bytes were recieved
if (uart_data[10] == 0xE0)
{
//shifting and transferring the keystates to the QMK matrix variable
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
matrix[i] = (uint16_t) uart_data[i*2] | (uint16_t) uart_data[i*2+1] << 5;
}
}
matrix_scan_quantum();
return 1;
}
inline
bool matrix_is_on(uint8_t row, uint8_t col)
{
return (matrix[row] & ((matrix_row_t)1<<col));
}
inline
matrix_row_t matrix_get_row(uint8_t row)
{
return matrix[row];
}
void matrix_print(void)
{
print_matrix_header();
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
phex(row); print(": ");
print_matrix_row(row);
print("\n");
}
}
uint8_t matrix_key_count(void)
{
uint8_t count = 0;
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
count += matrix_bitpop(i);
}
return count;
}

View File

@ -0,0 +1 @@
QMK Firmware for the Centromere keyboard. Centromere is a custom wireless ergonomic keyboard, with 6x3 columnar staggered keys and a 3 key thumb cluster. Centromere keyboards can utilize hot-swap Kailh sockets for MX switches, and either Choc or MX switches can be permanently soldered. There are two types of receiver that use two different MCU for the Centromere board, and you can define which one you are using by defining your rules.mk file appropriately, as shown in the default keymaps.

View File

@ -0,0 +1,42 @@
# MCU name
MCU = atmega32u4
# Processor frequency
F_CPU = 8000000
# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = caterina
# Build Options
# comment out to disable the options.
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration
CUSTOM_MATRIX = yes # Remote matrix from the wireless bridge
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
UNICODE_ENABLE = yes # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
USB = /dev/ttyACM0
# upload: build
# $(CENTROMERE_UPLOAD_COMMAND)
OPT_DEFS += -DCENTROMERE_PROMICRO
# # project specific files
SRC = matrix.c