xivik controller firmware

This commit is contained in:
Sadek Baroudi 2023-11-17 20:31:04 -08:00
parent 7b65f1a786
commit 9cef22e6f4
14 changed files with 426 additions and 0 deletions

View File

@ -0,0 +1,99 @@
/*
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/>.
*/
// NOTE: All logic for the modules can be found in:
// keyboards/fingerpunch/src/vik/config.h
// keyboards/fingerpunch/src/vik/rules.mk
#pragma once
#include "keyboards/fingerpunch/src/config_pre.h"
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
/* 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
/* key matrix size */
// Rows are doubled-up
#define MATRIX_ROWS 4
#define MATRIX_COLS 7
// VIK pin config
#define VIK_SPI_DRIVER SPID1
#define VIK_SPI_SCK_PIN GP14
#define VIK_SPI_MOSI_PIN GP15
#define VIK_SPI_MISO_PIN GP12
#define VIK_SPI_CS GP13
#define VIK_I2C_DRIVER I2CD1
#define VIK_I2C_SDA_PIN GP22
#define VIK_I2C_SCL_PIN GP23
#define VIK_GPIO_1 GP18
#define VIK_GPIO_2 GP10
#define VIK_WS2812_DI_PIN GP16
// Used only if you have a weact st7735 display, set to unused pin
#define VIK_ST7735_UNUSED_PIN GP11
// All the through hole pins from the controller
#define MATRIX_ROW_PINS { GP24, GP9, GP8, GP7 }
#define MATRIX_COL_PINS { GP0, GP1, GP2, GP3, GP4, GP5, GP6 }
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
#ifdef ENCODER_ENABLE
#define ENCODERS_PAD_A { GP18 }
#define ENCODERS_PAD_B { GP10 }
#endif
#ifdef CIRQUE_ENABLE
// cirque trackpad config
#define CIRQUE_PINNACLE_SPI_CS_PIN VIK_SPI_CS
// Uncomment 2 lines below to switch to relative mode and enable right click
// Note that tap to click doesn't work on the slave side unless you enable relative mode
// #define CIRQUE_PINNACLE_POSITION_MODE CIRQUE_PINNACLE_RELATIVE_MODE
// #define CIRQUE_PINNACLE_SECONDARY_TAP_ENABLE
#define CIRQUE_PINNACLE_TAP_ENABLE
#define POINTING_DEVICE_TASK_THROTTLE_MS 5
#endif
#define WS2812_DI_PIN GP16
#ifdef RGBLIGHT_ENABLE
#define RGBLED_NUM 10 // Arbitrary number, gets overridden by the vik module stuff below
#define RGBLIGHT_HUE_STEP 16
#define RGBLIGHT_SAT_STEP 16
#define RGBLIGHT_VAL_STEP 16
#define RGBLIGHT_LIMIT_VAL 130 /* The maximum brightness level for RGBLIGHT_ENABLE */
#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_CHRISTMAS
#define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
#define RGBLIGHT_EFFECT_SNAKE
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
#define RGBLIGHT_EFFECT_TWINKLE
#endif
#include "keyboards/fingerpunch/src/config_post.h"

View File

@ -0,0 +1,16 @@
[
{
"type" : "one-of",
"names" : [
"VIK_HAPTIC",
"VIK_PER56_CIRQUE_LEDS",
"VIK_PER56_CIRQUE_LEDS",
"VIK_PER56_PMW3360_LEDS",
"VIK_PMW3360",
"VIK_WEACT_ST7735",
"VIK_VIK_GC9A01",
"VIK_WAVESHARE_22224"
],
"user_input": "Which VIK module are you testing? NONE, VIK_HAPTIC, VIK_PER56_CIRQUE_LEDS, VIK_PER56_CIRQUE_LEDS, VIK_PER56_PMW3360_LEDS, VIK_PMW3360, VIK_WEACT_ST7735, VIK_VIK_GC9A01, VIK_WAVESHARE_22224"
}
]

View File

@ -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
#define HAL_USE_SPI TRUE
#define HAL_USE_I2C TRUE
#include_next "halconf.h"

View File

@ -0,0 +1,11 @@
{
"manufacturer": "sadekbaroudi",
"keyboard_name": "xivik",
"url": "https://fingerpunch.xyz/product/xivik/",
"maintainer": "Sadek Baroudi <sadekbaroudi@gmail.com>",
"usb": {
"vid": "0xFEFE",
"pid": "0x5177",
"device_version": "1.0.0"
}
}

View File

@ -0,0 +1,35 @@
#include QMK_KEYBOARD_H
// Defines names for use in layer keycodes and the keymap
enum layer_names {
_QWERTY
};
enum custom_keycodes {
QWERTY = SAFE_RANGE
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
*
* ,------------------------------------------------.
* | Q | W | E | R | T | Y | U |
* |------+------+------+------+------|------+------|
* | A | S | D | F | G | H | J |
* |------+------+------+------+------|------+------|
* | Z | X | C | V | B | N | M |
* |------+------+------+------+------|------+------|
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
* `------------------------------------------------'
*/
// Default config uses home row mods. So hold each of the keys on the home row to use ctrl, gui, alt, or shift
[_QWERTY] = LAYOUT_xivik(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U,
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J,
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6
)
};

View File

@ -0,0 +1,7 @@
#pragma once
#include "quantum.h"
#include QMK_KEYBOARD_H
enum layers {
_QWERTY = 0,
};

View File

@ -0,0 +1,88 @@
/* Copyright 2021 Sadek Baroudi
*
* 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 "sadekbaroudi.h"
#include QMK_KEYBOARD_H
// clang-format off
#define LAYOUT_xivik_base( \
K01, K02, K03, K04, K05, K06, K07, \
K11, K12, K13, K14, K15, K16, K17, \
K21, K22, K23, K24, K25, K26, K27, \
K31, K32, K33, K34, K35, K36, K37 \
) \
LAYOUT_wrapper( \
K01, K02, K03, K04, K05, K06, K07, \
K11, K12, K13, K14, K15, K16, K17, \
K21, K22, K23, K24, K25, K26, K27, \
K31, K32, K33, K34, K35, K36, K37 \
)
/* Re-pass though to allow templates to be used */
#define LAYOUT_xivik_base_wrapper(...) LAYOUT_xivik_base(__VA_ARGS__)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_ALPHA_ALT] = LAYOUT_wrapper(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U,
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J,
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6
),
[_ALPHA] = LAYOUT_wrapper(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U,
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J,
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6
),
[_NAVIGATION] = LAYOUT_wrapper(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U,
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J,
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6
),
[_SYMBOLS] = LAYOUT_wrapper(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U,
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J,
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6
),
[_FUNCTION] = LAYOUT_wrapper(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U,
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J,
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6
),
[_MEDIA] = LAYOUT_wrapper(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U,
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J,
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6
),
[_MOUSE] = LAYOUT_wrapper(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U,
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J,
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6
)
};

View File

@ -0,0 +1,13 @@
#pragma once
#include "quantum.h"
#include QMK_KEYBOARD_H
enum layers {
_ALPHA_ALT = 0,
_ALPHA,
_NAVIGATION,
_SYMBOLS,
_FUNCTION,
_MEDIA,
_MOUSE,
};

View File

@ -0,0 +1,9 @@
#pragma once
#include_next "mcuconf.h"
#undef RP_SPI_USE_SPI1
#define RP_SPI_USE_SPI1 TRUE
#undef RP_I2C_USE_I2C1
#define RP_I2C_USE_I2C1 TRUE

View File

@ -0,0 +1,38 @@
# xivik
* Keyboard Maintainer: sadekbaroudi
* Hardware Supported: xivik controller
## Description
This is a controller, **not** a keyboard. This firmware is intended to serve two purposes:
1) To test your controller
2) A template for copying over the firmware to any keyboard that you use it on.
## Building
Make example for this keyboard (after setting up your build environment):
```
make fingerpunch/xivik:default RGBLIGHT_ENABLE=yes
```
Options are:
```
RGBLIGHT_ENABLE=yes
HAPTIC_FEEDBACK=yes
// for the options below, select only one, or none, used for testing [VIK modules](https://github.com/sadekbaroudi/vik#known-list-of-vik-certifications)
VIK_PER56_CIRQUE_LEDS=yes
VIK_PER56_PMW3360_LEDS=yes
VIK_PMW3360=yes
VIK_WEACT_ST7735=yes
VIK_GC9A01=yes
VIK_WAVESHARE_22224=yes
VIK_HAPTIC=yes
```
See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
## Hardware
See:
https://fingerpunch.xyz/products/xivik/

View File

@ -0,0 +1,63 @@
# MCU name
MCU = RP2040
BOOTLOADER = rp2040
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = no # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
# Either do RGBLIGHT_ENABLE or RGB_MATRIX_ENABLE and RGB_MATRIX_DRIVER
RGBLIGHT_ENABLE ?= no
RGB_MATRIX_ENABLE ?= no # not supported yet, but will add
RGB_MATRIX_DRIVER = ws2812
WS2812_DRIVER = vendor
MIDI_ENABLE = no # MIDI support
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
ENCODER_ENABLE ?= no
EXTRAFLAGS += -flto # macros enable or disable
MOUSEKEY_ENABLE = yes
#HAPTIC FEEDBACK
HAPTIC_ENABLE ?= no
HAPTIC_DRIVER = drv2605l
AUDIO_ENABLE ?= no
AUDIO_DRIVER = pwm_hardware
VIK_ENABLE = yes
# Choose only one (or none) of the options below
# FP_PER56_CIRQUE_LEDS ?= no
# FP_PER56_PMW3360_LEDS ?= no
# FP_PMW3360 ?= no
# FP_WEACT_ST7735 ?= no
# The rest of the VIK logic is in the keyboards/fingerpunch/src/vik/rules.mk
ifeq ($(strip $(VIK_PER56_CIRQUE_LEDS)), yes)
RGBLIGHT_ENABLE = yes
endif
ifeq ($(strip $(VIK_PER56_PMW3360_LEDS)), yes)
RGBLIGHT_ENABLE = yes
endif
ifeq ($(strip $(CIRQUE_ENABLE)), yes)
POINTING_DEVICE_ENABLE := yes
POINTING_DEVICE_DRIVER := cirque_pinnacle_spi
OPT_DEFS += -DCIRQUE_ENABLE
endif
include keyboards/fingerpunch/src/rules.mk

View File

@ -0,0 +1 @@
#include "xivik.h"

View File

@ -0,0 +1,18 @@
#pragma once
#include "quantum.h"
#define LAYOUT_xivik( \
K01, K02, K03, K04, K05, K06, K07, \
K11, K12, K13, K14, K15, K16, K17, \
K21, K22, K23, K24, K25, K26, K27, \
K31, K32, K33, K34, K35, K36, K37 \
) \
{ \
{ K01, K02, K03, K04, K05, K06, K07 }, \
{ K11, K12, K13, K14, K15, K16, K17 }, \
{ K21, K22, K23, K24, K25, K26, K27 }, \
{ K31, K32, K33, K34, K35, K36, K37 } \
}
// General fingerpunch firmware include
#include "keyboards/fingerpunch/src/fp.h"

View File

@ -181,6 +181,11 @@ expanded before being used as arguments to the LAYOUT_xxx macro.
# define LAYOUT LAYOUT_svlinky
#endif
// Since LAYOUT_xivik uses the name LAYOUT_xivik instead of LAYOUT
#if (!defined(LAYOUT) && defined(LAYOUT_xivik))
# define LAYOUT LAYOUT_xivik
#endif
// Since LAYOUT_baboon38 uses the name LAYOUT_baboon38 instead of LAYOUT
#if (!defined(LAYOUT) && defined(LAYOUT_baboon38))
# define LAYOUT LAYOUT_baboon38