Blacktyl: Left side works

This commit is contained in:
Thomas Haukland 2022-03-27 23:29:55 +02:00
parent 196074e57b
commit 17744429a4
8 changed files with 272 additions and 0 deletions

View File

@ -0,0 +1,28 @@
#include "blacktyl.h"
void keyboard_post_init_user(void) {
// rgblight_enable();
// rgblight_sethsv_cyan();
// rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL);
// debug_config.enable = true;
// debug_config.matrix = true;
// debug_config.keyboard = true;
// debug_config.mouse = true;
if (is_keyboard_left()) {
dprintln("I'm left!");
} else {
dprintln("I'm right!");
}
}
void housekeeping_task_user(void) {
static uint16_t start = 0;
if (timer_elapsed(start) > 1000) {
start = timer_read();
dprintf("Fresh into eeprom %d\n", (uint8_t)start);
eeconfig_update_debug((uint8_t)start);
dprintf("Fresh from eeprom %d\n", (uint8_t)eeconfig_read_debug());
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright 2021 Quentin LEBASTARD <qlebastard@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 "quantum.h"
// clang-format off
#define LAYOUT_split_3x5_3( \
k00, k01, k02, k03, k04, k44, k43, k42, k41, k40, \
k10, k11, k12, k13, k14, k54, k53, k52, k51, k50, \
k20, k21, k22, k23, k24, k64, k63, k62, k61, k60, \
k33, k34, k31, k71, k74, k73 \
) \
{ \
{ k00, k01, k02, k03, k04 }, \
{ k10, k11, k12, k13, k14 }, \
{ k20, k21, k22, k23, k24 }, \
{ k31, KC_NO, k33, k34, KC_NO }, \
{ k40, k41, k42, k43, k44 }, \
{ k50, k51, k52, k53, k54 }, \
{ k60, k61, k62, k63, k64 }, \
{ k71, KC_NO, k73, k74, KC_NO }, \
}
// clang-format on

View File

@ -0,0 +1,17 @@
#pragma once
#define CH_CFG_ST_FREQUENCY 10000
#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
#define CH_CFG_FACTORY_SEMAPHORES TRUE
#define CH_CFG_FACTORY_MAILBOXES TRUE
#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
#define CH_CFG_FACTORY_PIPES TRUE
#include_next <chconf.h>

View File

@ -0,0 +1,67 @@
#pragma once
#include "config_common.h"
/* USB DEVICE DESCRIPTOR */
#define PRODUCT The Bastard Keyboards Blackpill
#define MANUFACTURER Bastard Keyboards x KarlK90
#define VENDOR_ID 0xA8F8
#define PRODUCT_ID 0x1828
#define DEVICE_VER 0x0001
/* MATRIX CONFIG */
#define MATRIX_COLS 5
#define MATRIX_ROWS 8
#define MATRIX_COL_PINS \
{ B1, B10, B4, B3, B8 }
#define MATRIX_ROW_PINS \
{ A2, B5, B9, A8 }
#define DIODE_DIRECTION ROW2COL
// #define DEBUG_MATRIX_SCAN_RATE
/* RGB CONFIG - WS2812 DRIVER
#define RGB_DI_PIN A1
#define WS2812_EXTERNAL_PULLUP
#define WS2812_PWM_DRIVER PWMD2
#define WS2812_PWM_CHANNEL 2
#define WS2812_PWM_PAL_MODE 1
#define WS2812_DMA_CHANNEL 3
#define WS2812_DMA_STREAM STM32_DMA1_STREAM1
// Without the following configurations the WS2812 would not light up
#define WS2812_PWM_TARGET_PERIOD 800000
*/
/* CRC DRIVER
#define CRC8_USE_TABLE
#define CRC8_OPTIMIZE_SPEED
*/
/* SPLIT CONFIG */
#define SPLIT_HAND_PIN A3
/* SERIAL SPLIT DRIVER */
#define SOFT_SERIAL_PIN A9 // D0 or D1, D2, D3, E6
#define SELECT_SOFT_SERIAL_SPEED 1 // or 0, 2, 3, 4, 5
// 0: about 189kbps (Experimental only)
// 1: about 137kbps (default)
// 2: about 75kbps
// 3: about 39kbps
// 4: about 26kbps
// 5: about 20kbps
//#define SERIAL_USART_TX_PIN A9
// To use the highest possible baudrate (3.75Mbit/s) uncomment the following
// line, this can result in dropped communications so lower the speed if there
// are many timeouts. #define SERIAL_USART_SPEED (STM32_PCLK2 >> 4)
/* SPI DRIVER
*/
#define SPI_DRIVER SPID1
#define SPI_SCK_PIN A5
#define SPI_MOSI_PIN B7
#define SPI_MISO_PIN A6
/* EEPROM DRIVER */
//#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4
/* PMW3360 DRIVER */
//#define PMW3360_CS_PIN B14

View File

@ -0,0 +1,10 @@
#pragma once
#define HAL_USE_SPI TRUE
#define HAL_USE_PWM TRUE
#define HAL_USE_SERIAL TRUE
// #define PAL_USE_CALLBACKS TRUE
// #define PAL_USE_WAIT TRUE
#include_next <halconf.h>

View File

@ -0,0 +1,70 @@
/*
* Copyright 2021 Quentin LEBASTARD <qlebastard@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/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_split_3x5_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_1, KC_SPC , KC_2, KC_3, KC_ENT , KC_4
//`--------------------------' `--------------------------'
),
[1] = LAYOUT_split_3x5_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP,KC_RIGHT, XXXXXXX,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LGUI, KC_SPC, _______, MO(3), KC_ENT, KC_RALT
//`--------------------------' `--------------------------'
),
[2] = LAYOUT_split_3x5_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LGUI, KC_SPC, MO(3), _______, KC_ENT, KC_RALT
//`--------------------------' `--------------------------'
),
[3] = LAYOUT_split_3x5_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LGUI, KC_SPC, _______, _______, KC_ENT, KC_RALT
//`--------------------------' `--------------------------'
)
};

View File

@ -0,0 +1,18 @@
#pragma once
#include_next "mcuconf.h"
#undef STM32_I2C_USE_I2C1
#define STM32_I2C_USE_I2C1 FALSE
#undef STM32_ST_USE_TIMER
#define STM32_ST_USE_TIMER 5
#undef STM32_PWM_USE_TIM2
#define STM32_PWM_USE_TIM2 TRUE
#undef STM32_SPI_USE_SPI1
#define STM32_SPI_USE_SPI1 TRUE
#undef STM32_SERIAL_USE_USART1
#define STM32_SERIAL_USE_USART1 TRUE

View File

@ -0,0 +1,24 @@
# MCU name
MCU = STM32F401
# or
# MCU = STM32F411
# For newer blackpills
BOOTMAGIC_ENABLE = yes
LAYOUTS = split_3x5_3
# Bootloader selection
BOOTLOADER = stm32-dfu
# CONSOLE_ENABLE = yes
DEBOUNCE_TYPE = asym_eager_defer_pk
# EEPROM_DRIVER = spi
# KEYBOARD_SHARED_EP = yes
# POINTING_DEVICE_DRIVER = pmw3360
# POINTING_DEVICE_ENABLE = yes
# RGBLIGHT_DRIVER = WS2812
# RGBLIGHT_ENABLE = no
# SERIAL_DRIVER = bitbang
SERIAL_DRIVER = usart
SPLIT_KEYBOARD = yes
# VIA_ENABLE = no
# WS2812_DRIVER = pwm