ximi first pass at firmware, matrix works, need to add haptics and audio, as well as test cirque, trackball, and leds
This commit is contained in:
parent
e168cf5b12
commit
876e465eff
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
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 DEVICE_VER 0x0001
|
||||
#define VENDOR_ID 0xFEFE
|
||||
#define PRODUCT_ID 0xB171
|
||||
#define MANUFACTURER sadekbaroudi
|
||||
#define PRODUCT sadekbaroudi ximi
|
||||
|
||||
/* key matrix size */
|
||||
// Rows are doubled-up
|
||||
#define MATRIX_ROWS 6
|
||||
#define MATRIX_COLS 16
|
||||
|
||||
#define SHIFTREG_MATRIX_COL_CS GP1
|
||||
#define SHIFTREG_DIVISOR 8 // needs to be the same as the PMW33XX_CS_DIVISOR below
|
||||
// These next two should match the MATRIX_ROWS and MATRIX_COLS if a unibody, and should be cut in half if a split keyboard
|
||||
#define SHIFTREG_ROWS 3
|
||||
#define SHIFTREG_COLS 8
|
||||
|
||||
/* COL2ROW or ROW2COL */
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
#define MATRIX_ROW_PINS_SR { GP27, GP28, GP29 }
|
||||
|
||||
#define SOFT_SERIAL_PIN GP0
|
||||
|
||||
#define USE_SERIAL
|
||||
|
||||
#define RGB_DI_PIN GP26
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
#define RGBLIGHT_SPLIT
|
||||
#define RGBLED_SPLIT { 21, 21 }
|
||||
#define RGBLED_NUM 42
|
||||
#define RGBLIGHT_HUE_STEP 16
|
||||
#define RGBLIGHT_SAT_STEP 16
|
||||
#define RGBLIGHT_VAL_STEP 16
|
||||
#define RGBLIGHT_LIMIT_VAL 120 /* 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 */
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
|
||||
// cirque trackpad config
|
||||
#define CIRQUE_PINNACLE_ADDR 0x2A
|
||||
#define POINTING_DEVICE_TASK_THROTTLE_MS 5
|
||||
#define I2C1_CLOCK_SPEED 400000
|
||||
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
|
||||
|
||||
// Trackball config
|
||||
// Move into pwm3360 feature directory
|
||||
#define PMW33XX_CS_PIN GP26
|
||||
#define PMW33XX_CPI 800
|
||||
#define PMW33XX_CS_DIVISOR 8 // needs to be the same as the SHIFTREG_DIVISOR above
|
||||
#define POINTING_DEVICE_INVERT_Y
|
||||
|
||||
#define SPI_SCK_PIN GP2
|
||||
#define SPI_MOSI_PIN GP3
|
||||
#define SPI_MISO_PIN GP4
|
||||
|
||||
/* SPI config for pmw3360 sensor. */
|
||||
// #define SPI_DRIVER SPID1
|
||||
// #define SPI_SCK_PIN GP2
|
||||
// #define SPI_SCK_PAL_MODE 5
|
||||
// #define SPI_MOSI_PIN GP3
|
||||
// #define SPI_MOSI_PAL_MODE 5
|
||||
// #define SPI_MISO_PIN GP4
|
||||
// #define SPI_MISO_PAL_MODE 5
|
||||
// end Trackball config
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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_SERIAL FALSE
|
||||
#define HAL_USE_SPI TRUE
|
||||
#define HAL_USE_I2C TRUE
|
||||
#define SPI_USE_WAIT TRUE
|
||||
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
|
||||
|
||||
#include_next "halconf.h"
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
#include QMK_KEYBOARD_H
|
||||
|
||||
// Defines names for use in layer keycodes and the keymap
|
||||
enum layer_names {
|
||||
_QWERTY,
|
||||
_COLEMAK,
|
||||
_LOWER,
|
||||
_RAISE,
|
||||
_ADJUST
|
||||
};
|
||||
|
||||
#define LOWER MO(_LOWER)
|
||||
#define RAISE MO(_RAISE)
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* Qwerty
|
||||
*
|
||||
* ,-----------------------------------------. ,-----------------------------------------.
|
||||
* | Esc | Q | W | E | R | T | | Y | U | I | O | P | \ |
|
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
* | Tab | A | S | D | F | G | | H | J | K | L | ; | ' |
|
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
* | Shft | Z | X | C | V | B | | N | M | , | . | / | Ctrl |
|
||||
* `-----------------------------------------' `-----------------------------------------'
|
||||
* ,--------------------. ,--------------------.
|
||||
* | LOWER| Enter| Del | |BckSpc| Space| RAISE|
|
||||
* `--------------------' `--------------------.
|
||||
*/
|
||||
|
||||
// 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_ximi(
|
||||
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
|
||||
KC_TAB, LCTL_T(KC_A), LGUI_T(KC_S), LALT_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, RSFT_T(KC_J), RALT_T(KC_K), RGUI_T(KC_L), RCTL_T(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_RCTL,
|
||||
LOWER, KC_ENT, KC_DEL, KC_BSPC, KC_SPC, RAISE,
|
||||
LOWER, KC_ENT, KC_DEL, KC_BSPC, KC_SPC, RAISE
|
||||
),
|
||||
|
||||
/* Colemak
|
||||
*
|
||||
* ,-----------------------------------------. ,-----------------------------------------.
|
||||
* | Esc | Q | W | F | P | B | | J | L | U | Y | ; | \ |
|
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
* | Tab | A | R | S | T | G | | M | N | E | I | O | ' |
|
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
* | Shft | Z | X | C | D | V | | K | H | , | . | / | Ctrl |
|
||||
* `--------------------+--------------------' `-----------------------------------------'
|
||||
* ,--------------------. ,--------------------.
|
||||
* | LOWER| Enter| ' | |BckSpc| Space| RAISE|
|
||||
* `--------------------' `--------------------.
|
||||
*/
|
||||
|
||||
// Default config uses home row mods. So hold each of the keys on the home row to use ctrl, gui, alt, or shift
|
||||
[_COLEMAK] = LAYOUT_ximi(
|
||||
KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS,
|
||||
KC_TAB, LCTL_T(KC_A), LGUI_T(KC_R), LALT_T(KC_S), LSFT_T(KC_T), KC_G, KC_M, RSFT_T(KC_N), RALT_T(KC_E), RGUI_T(KC_I), RCTL_T(KC_O), KC_QUOT,
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RCTL,
|
||||
LOWER, KC_ENT, KC_QUOT, KC_BSPC, KC_SPC, RAISE,
|
||||
LOWER, KC_ENT, KC_QUOT, KC_BSPC, KC_SPC, RAISE
|
||||
),
|
||||
|
||||
/* Raise
|
||||
*
|
||||
* ,-----------------------------------------. ,-----------------------------------------.
|
||||
* | ____ | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | ____ |
|
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
* | ____ | Left | Down | Up | Right| Tab | | | - | = | [ | ] | ____ |
|
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
* | ____ | Ctrl| ` | GUI | Alt | | | | | | \ | ' | ____ |
|
||||
* `-----------------------------------------' `-----------------------------------------'
|
||||
* ,--------------------. ,--------------------.
|
||||
* | LOWER| | | | | | RAISE|
|
||||
* `--------------------' `--------------------.
|
||||
*/
|
||||
[_RAISE] = LAYOUT_ximi(
|
||||
_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______,
|
||||
_______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TAB, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, _______,
|
||||
_______, KC_LCTL, KC_GRV, KC_LGUI, KC_LALT, _______, _______, _______, _______, KC_BSLS, KC_QUOT, _______,
|
||||
_______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______
|
||||
),
|
||||
|
||||
/* Lower
|
||||
*
|
||||
* ,-----------------------------------------. ,-----------------------------------------.
|
||||
* | ____ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | ____ |
|
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
* | ____ | Esc | | | | | | | _ | + | { | } | ____ |
|
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
* | ____ | Caps| ~ | | | | | | | | | | ' | ____ |
|
||||
* `-----------------------------------------' `-----------------------------------------'
|
||||
* ,--------------------. ,--------------------.
|
||||
* | LOWER| | | | Del | | RAISE|
|
||||
* `--------------------' `--------------------.
|
||||
*/
|
||||
[_LOWER] = LAYOUT_ximi(
|
||||
_______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______,
|
||||
_______, KC_ESC, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, _______,
|
||||
_______, KC_CAPS, KC_TILD, _______, _______, _______, _______, _______, _______, KC_PIPE, KC_DQT, _______,
|
||||
_______, _______, _______, KC_DEL, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______
|
||||
),
|
||||
|
||||
/* Adjust (Lower + Raise)
|
||||
*
|
||||
* ,-----------------------------------------. ,-----------------------------------------.
|
||||
* | ____ | RGB_T| RGB_R| RGB_F| |QWERTY| | F1 | F2 | F3 | F4 | F5 | ____ |
|
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
* | ____ | SPD_I| HUE_I| SAT_I| VAL_I|COLEMK| | F6 | F7 | F8 | F9 | F10 | ____ |
|
||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
* | ____ | SPD_D| HUE_D| SAT_D| VAL_D| | | F11 | F12 | | | Reset| ____ |
|
||||
* `-----------------------------------------' `-----------------------------------------'
|
||||
* ,--------------------. ,--------------------.
|
||||
* | LOWER| | | | | | RAISE|
|
||||
* `--------------------' `--------------------.
|
||||
*/
|
||||
[_ADJUST] = LAYOUT_ximi(
|
||||
_______, RGB_TOG, RGB_RMOD, RGB_MOD, _______, TO(_QWERTY), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______,
|
||||
_______, RGB_SPI, RGB_HUI, RGB_SAI, RGB_VAI, TO(_COLEMAK), KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______,
|
||||
_______, RGB_SPD, RGB_HUD, RGB_SAD, RGB_VAD, _______, KC_F11, KC_F12, _______, _______, QK_RBT, _______,
|
||||
_______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______
|
||||
)
|
||||
};
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/* 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
|
||||
|
||||
/*
|
||||
* The `LAYOUT_luakeeb_base` macro is a template to allow the use of identical
|
||||
* modifiers for the default layouts (eg ALPHA_ALT, Colemak, Dvorak, etc), so
|
||||
* that there is no need to set them up for each layout, and modify all of
|
||||
* them if I want to change them. This helps to keep consistency and ease
|
||||
* of use. K## is a placeholder to pass through the individual keycodes
|
||||
*/
|
||||
|
||||
// Note: changed the thumb keys from the following, testing out a new layout:
|
||||
// KC_DEL, LT(_NAVIGATION,KC_ENT), LT(_FUNCTION,KC_TAB), LT(_FUNCTION,KC_BSPC), LT(_SYMBOLS,KC_SPACE), KC_QUOT "\"
|
||||
// _______, KC_BSPC, LT(_NAVIGATION,KC_ENT), LT(_SYMBOLS,KC_SPACE), KC_QUOT, _______ "\"
|
||||
|
||||
// clang-format off
|
||||
#define LAYOUT_luakeeb_base( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \
|
||||
K33, K34, K35, K36, K37, K38 \
|
||||
) \
|
||||
LAYOUT_wrapper( \
|
||||
N_SEL_LINE, K01, K02, K03, LT(_FUNCTION, K04), K05, K06, LT(_FUNCTION, K07), K08, K09, K0A, KC_BSLS, \
|
||||
LCTL(KC_C), LCTL_T(K11), LGUI_T(K12), LALT_T(K13), LSFT_T(K14), K15, LT(_MOUSE, K16), RSFT_T(K17), RALT_T(K18), RGUI_T(K19), RCTL_T(K1A), LCTL(KC_V), \
|
||||
TG(_NAVIGATION), K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, S_ALT_TAB, \
|
||||
KC_MUTE, K33, LT(_NAVIGATION,K34), LT(_FUNCTION,K35), LT(_MEDIA,K36), LT(_SYMBOLS,K37), K38, LCTL(KC_BSPC) \
|
||||
)
|
||||
|
||||
/* Re-pass though to allow templates to be used */
|
||||
#define LAYOUT_luakeeb_base_wrapper(...) LAYOUT_luakeeb_base(__VA_ARGS__)
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
[_ALPHA_ALT] = LAYOUT_luakeeb_base_wrapper(
|
||||
_________________ALPHA_ALT_L1_________________, _________________ALPHA_ALT_R1_________________,
|
||||
_________________ALPHA_ALT_L2_________________, _________________ALPHA_ALT_R2_________________,
|
||||
_________________ALPHA_ALT_L3_________________, _________________ALPHA_ALT_R3_________________,
|
||||
__ALPHA_ALT_THUMBS_6__
|
||||
),
|
||||
|
||||
[_ALPHA] = LAYOUT_luakeeb_base_wrapper(
|
||||
__________________ALPHA_L1____________________, __________________ALPHA_R1____________________,
|
||||
__________________ALPHA_L2____________________, __________________ALPHA_R2____________________,
|
||||
__________________ALPHA_L3____________________, __________________ALPHA_R3____________________,
|
||||
__ALPHA_THUMBS_6__
|
||||
),
|
||||
|
||||
[_NAVIGATION] = LAYOUT_wrapper(
|
||||
_______, ________________NAVIGATION_1_______________, _________________NUMPAD_1__________________, _______,
|
||||
_______, ________________NAVIGATION_2_______________, _________________NUMPAD_2__________________, _______,
|
||||
_______, ________________NAVIGATION_3_______________, _________________NUMPAD_3__________________, _______,
|
||||
_______, _______, _______, KC_TAB, KC_BSPC, KC_SPACE, KC_DOT, _______
|
||||
),
|
||||
|
||||
[_SYMBOLS] = LAYOUT_wrapper(
|
||||
_______, ________________SYMBOLS_L1_________________, ________________SYMBOLS_R1_________________, _______,
|
||||
_______, ________________SYMBOLS_L2_________________, ________________SYMBOLS_R2_________________, _______,
|
||||
_______, ________________SYMBOLS_L3_________________, ________________SYMBOLS_R3_________________, _______,
|
||||
_______, _______, KC_ENT, KC_DEL, KC_BSPC, _______, _______, _______
|
||||
),
|
||||
|
||||
[_FUNCTION] = LAYOUT_wrapper(
|
||||
_______, ________________SHIFTNAV_1_________________, ________________FUNCTION_1_________________, _______,
|
||||
_______, ________________SHIFTNAV_2_________________, ________________FUNCTION_2_________________, _______,
|
||||
_______, ________________SHIFTNAV_3_________________, ________________FUNCTION_3_________________, _______,
|
||||
_______, _______, _______, _______, N_DEL_LINE, KC_SPACE, _______, _______
|
||||
),
|
||||
|
||||
[_MEDIA] = LAYOUT_wrapper(
|
||||
_______, ___________________RGB_1___________________, _________________MACROS_1__________________, _______,
|
||||
_______, ___________________RGB_2___________________, _________________MACROS_2__________________, _______,
|
||||
_______, ___________________RGB_3___________________, _________________MACROS_3__________________, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______
|
||||
),
|
||||
|
||||
[_MOUSE] = LAYOUT_wrapper(
|
||||
_______, __________________MOUSE_1__________________, ___________________BLANK___________________, _______,
|
||||
_______, __________________MOUSE_2__________________, ___________________BLANK___________________, _______,
|
||||
_______, __________________MOUSE_3__________________, ___________________BLANK___________________, _______,
|
||||
_______, _______, KC_MS_BTN1, KC_MS_BTN3, KC_MS_BTN3, KC_MS_BTN2, _______, _______
|
||||
)
|
||||
|
||||
};
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
// Copyright 2022 @sadekbaroudi (Sadek Baroudi)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#include "quantum.h"
|
||||
#include "spi_master.h"
|
||||
#include <string.h> /* memset */
|
||||
#include <unistd.h> /* close */
|
||||
#include "quantum.h"
|
||||
#include "matrix.h"
|
||||
// added for testing with SR_DEBUG_RATIO, remove when done
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
// end testing
|
||||
|
||||
#define SR_DEBUG_RATIO 10000
|
||||
|
||||
#if (!defined(SHIFTREG_MATRIX_COL_CS))
|
||||
# error Missing shift register I/O pin definitions
|
||||
#endif
|
||||
|
||||
int matrixArraySize = SHIFTREG_ROWS * sizeof(matrix_row_t);
|
||||
matrix_row_t oldMatrix[SHIFTREG_ROWS];
|
||||
|
||||
#define SHIFTREG_OUTPUT_BITS 8
|
||||
pin_t rowPinsSR[SHIFTREG_ROWS] = MATRIX_ROW_PINS_SR;
|
||||
|
||||
// semaphore to make sure SPI doesn't get called multiple times
|
||||
static bool shiftRegisterSPILocked = false;
|
||||
|
||||
void semaphore_lock(bool value) {
|
||||
shiftRegisterSPILocked = value;
|
||||
}
|
||||
|
||||
bool semaphore_is_locked(void) {
|
||||
return shiftRegisterSPILocked;
|
||||
}
|
||||
|
||||
void sr_74hc595_spi_stop(void) {
|
||||
spi_stop();
|
||||
semaphore_lock(false);
|
||||
}
|
||||
|
||||
bool sr_74hc595_spi_start(void) {
|
||||
if (!spi_start(SHIFTREG_MATRIX_COL_CS, false, 0, SHIFTREG_DIVISOR)) {
|
||||
xprintf("74hc595 matrix: failed to start spi\n");
|
||||
sr_74hc595_spi_stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
semaphore_lock(true);
|
||||
wait_us(1); // not sure if I need this
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sr_74hc595_spi_send_byte(uint8_t data) {
|
||||
sr_74hc595_spi_start();
|
||||
writePinLow(SHIFTREG_MATRIX_COL_CS);
|
||||
matrix_io_delay();
|
||||
// spi_status_t spiResponse = spi_write(data);
|
||||
spi_write(data);
|
||||
// Status is irrelevant as we don't have a MISO pin to check if it succeeded
|
||||
// if (spiResponse != SPI_STATUS_SUCCESS) {
|
||||
// xprintf("74hc595 matrix: failed to send data over SPI: response %d\n", spiResponse);
|
||||
// writePinHigh(SHIFTREG_MATRIX_COL_CS);
|
||||
// sr_74hc595_spi_stop();
|
||||
// return false;
|
||||
// }
|
||||
matrix_io_delay();
|
||||
writePinHigh(SHIFTREG_MATRIX_COL_CS);
|
||||
sr_74hc595_spi_stop();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the entire shift register to be full of inactive bits
|
||||
*/
|
||||
void clearColumns(void) {
|
||||
uint8_t value = 0b00000000;
|
||||
sr_74hc595_spi_send_byte(value);
|
||||
}
|
||||
|
||||
void setColumn(int columnShift, bool test_run) {
|
||||
uint8_t columnShiftByte = ((uint8_t)1 << columnShift);
|
||||
if(test_run) {
|
||||
xprintf("byte sent: %d\n", columnShiftByte);
|
||||
}
|
||||
sr_74hc595_spi_send_byte(columnShiftByte);
|
||||
}
|
||||
|
||||
/*
|
||||
* override of the qmk intialization function
|
||||
*/
|
||||
void matrix_init_custom(void) {
|
||||
wait_ms(300);
|
||||
spi_init();
|
||||
// Set up the initial states for all the row pins
|
||||
for (int r = 0; r < SHIFTREG_ROWS; r++) {
|
||||
// Note: This needs to use the internal pull down resistors, and atmegas do *not* support that
|
||||
setPinInputLow(rowPinsSR[r]);
|
||||
}
|
||||
|
||||
// Set the CS to low by default, and specify as an output pin
|
||||
writePinHigh(SHIFTREG_MATRIX_COL_CS); // should be high when using SPI?
|
||||
setPinOutput(SHIFTREG_MATRIX_COL_CS);
|
||||
|
||||
// Since it's the init, deactivate all the columns. We'll activate once we get to the matrix scan
|
||||
clearColumns();
|
||||
}
|
||||
|
||||
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
||||
// respect the semaphore
|
||||
if (semaphore_is_locked()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Keep track of if something was modified
|
||||
bool matrix_has_changed = false;
|
||||
|
||||
// reset the current matrix, as we'll be updating and comparing to the old matrix
|
||||
memset(current_matrix, 0, matrixArraySize);
|
||||
|
||||
bool debug_output = ((rand() % SR_DEBUG_RATIO) == 1);
|
||||
// Loop through the columns, activating one at a time, and read the rows, and place in the new current_matrix
|
||||
for (int c = 0; c < SHIFTREG_COLS; c++) {
|
||||
if (debug_output) {
|
||||
xprintf("column iteration: %d\n", c);
|
||||
}
|
||||
setColumn(c, debug_output);
|
||||
matrix_io_delay();
|
||||
|
||||
for (int r = 0; r < SHIFTREG_ROWS; r++) {
|
||||
current_matrix[r] |= ((readPin(rowPinsSR[r]) ? 1 : 0) << c);
|
||||
}
|
||||
}
|
||||
|
||||
matrix_has_changed = memcmp(current_matrix, oldMatrix, matrixArraySize) != 0;
|
||||
memcpy(oldMatrix, current_matrix, matrixArraySize);
|
||||
|
||||
if (matrix_has_changed) {
|
||||
matrix_print();
|
||||
}
|
||||
// matrix_print();
|
||||
// xprintf("matrix_has_changed: %d\n", matrix_has_changed);
|
||||
|
||||
// Deactivate all the columns for the next run.
|
||||
clearColumns();
|
||||
matrix_io_delay();
|
||||
|
||||
return matrix_has_changed;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include_next "mcuconf.h"
|
||||
|
||||
#undef RP_SPI_USE_SPI0
|
||||
#define RP_SPI_USE_SPI1 TRUE
|
||||
|
||||
// #undef RP_SPI_USE_SPI1
|
||||
// #define RP_SPI_USE_SPI1 TRUE
|
||||
|
||||
#undef RP_I2C_USE_I2C0
|
||||
#define RP_I2C_USE_I2C0 TRUE
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
# luakeeb
|
||||
|
||||
* Keyboard Maintainer: sadekbaroudi
|
||||
* Hardware Supported: luakeeb PCB
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make fingerpunch/luakeeb:default
|
||||
|
||||
Flashing example for this keyboard ([using the command line](https://docs.qmk.fm/#/newbs_flashing?id=flash-your-keyboard-from-the-command-line)):
|
||||
|
||||
make fingerpunch/luakeeb:default:flash
|
||||
|
||||
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.
|
||||
|
||||
## Build Guide
|
||||
|
||||
See:
|
||||
https://github.com/sadekbaroudi/fingerpunch/blob/master/luakeeb/BUILDGUIDE.md
|
||||
|
||||
## Choosing which board to plug the USB cable into (choosing Master)
|
||||
|
||||
Because the two boards are identical, the firmware has logic to differentiate the left and right board. It uses two strategies to figure things out, [EE_HANDS](https://docs.qmk.fm/#/feature_split_keyboard?id=handedness-by-eeprom) or [by define](https://docs.qmk.fm/#/feature_split_keyboard?id=handedness-by-define). See [setting-handedness](https://docs.qmk.fm/#/config_options?id=setting-handedness) for more information.
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
# 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 = no # 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
|
||||
RGB_MATRIX_DRIVER = WS2812
|
||||
|
||||
MIDI_ENABLE = no # MIDI support
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
||||
ENCODER_ENABLE = no
|
||||
OLED_DRIVER_ENABLE = no # this can be yes or no depending on if you have an OLED
|
||||
EXTRAFLAGS += -flto # macros enable or disable
|
||||
MOUSEKEY_ENABLE = yes
|
||||
|
||||
SPLIT_KEYBOARD = yes
|
||||
SERIAL_DRIVER = vendor
|
||||
|
||||
# CIRQUE_ENABLE = no
|
||||
# PMW3360_ENABLE = no
|
||||
|
||||
# ifeq ($(strip $(CIRQUE_ENABLE)), yes)
|
||||
# POINTING_DEVICE_ENABLE = yes
|
||||
# POINTING_DEVICE_DRIVER = cirque_pinnacle_i2c
|
||||
# endif
|
||||
|
||||
# ifeq ($(strip $(PMW3360_ENABLE)), yes)
|
||||
# POINTING_DEVICE_ENABLE := yes
|
||||
# POINTING_DEVICE_DRIVER = pmw3360
|
||||
# QUANTUM_LIB_SRC += spi_master.c
|
||||
# endif
|
||||
|
||||
|
||||
SRC += matrix_74hc595_spi.c
|
||||
QUANTUM_LIB_SRC += spi_master.c
|
||||
CUSTOM_MATRIX = lite
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "ximi.h"
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#pragma once
|
||||
#include "quantum.h"
|
||||
|
||||
#define LAYOUT_ximi( \
|
||||
K00, K01, K02, K03, K04, K05, K35, K34, K33, K32, K31, K30, \
|
||||
K10, K11, K12, K13, K14, K15, K45, K44, K43, K42, K41, K40, \
|
||||
K20, K21, K22, K23, K24, K25, K55, K54, K53, K52, K51, K50, \
|
||||
K06, K16, K26, K56, K46, K36, \
|
||||
K07, K17, K27, K57, K47, K37 \
|
||||
) \
|
||||
{ \
|
||||
{ K00, K01, K02, K03, K04, K05, K06, K07 }, \
|
||||
{ K10, K11, K12, K13, K14, K15, K16, K17 }, \
|
||||
{ K20, K21, K22, K23, K24, K25, K26, K27 }, \
|
||||
{ K30, K31, K32, K33, K34, K35, K36, K37 }, \
|
||||
{ K40, K41, K42, K43, K44, K45, K46, K47 }, \
|
||||
{ K50, K51, K52, K53, K54, K55, K56, K57 } \
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue