Merge pull request #14 from sadekbaroudi/fp/rockon_v3

rock on v3 firmware support
This commit is contained in:
Sadek Baroudi 2022-10-05 18:54:35 -07:00 committed by GitHub
commit 78f5880717
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 748 additions and 22 deletions

View File

@ -26,17 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MANUFACTURER sadekbaroudi
#define PRODUCT sadekbaroudi rockon
/* key matrix size */
/* Rows are doubled up */
#define MATRIX_ROWS 8
#define MATRIX_COLS 9
// wiring
#define MATRIX_ROW_PINS \
{ B6, F4, B5, B4, B2, B3, B7, D5 }
#define MATRIX_COL_PINS \
{ D2, D4, C6, D7, E6, F5, F6, F7, B1 }
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
@ -49,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_HUE_STEP 16
#define RGBLIGHT_SAT_STEP 16
#define RGBLIGHT_VAL_STEP 16
#define RGBLIGHT_LIMIT_VAL 60 /* The maximum brightness level for RGBLIGHT_ENABLE */
#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 */
#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_BREATHING
@ -110,9 +99,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
//#define DYNAMIC_KEYMAP_LAYER_COUNT 5
#ifdef OLED_ENABLE
#define OLED_DISPLAY_128X64
#endif

View File

@ -21,6 +21,8 @@
# include "v1.h"
#elif defined(KEYBOARD_fingerpunch_rockon_v2)
# include "v2.h"
#elif defined(KEYBOARD_fingerpunch_rockon_v3)
# include "v3.h"
#endif
#include "keyboards/fingerpunch/fp.h"

View File

@ -18,3 +18,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#define DEVICE_VER 0x0001
/* key matrix size */
/* Rows are doubled up */
#define MATRIX_ROWS 8
#define MATRIX_COLS 9
// wiring
#define MATRIX_ROW_PINS \
{ B6, F4, B5, B4, B2, B3, B7, D5 }
#define MATRIX_COL_PINS \
{ D2, D4, C6, D7, E6, F5, F6, F7, B1 }
#ifdef OLED_ENABLE
#define OLED_DISPLAY_128X64
#endif

View File

@ -19,6 +19,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DEVICE_VER 0x0002
/* key matrix size */
/* Rows are doubled up */
#define MATRIX_ROWS 8
#define MATRIX_COLS 9
// wiring
#define MATRIX_ROW_PINS \
{ B6, F4, B5, B4, B2, B3, B7, D5 }
#define MATRIX_COL_PINS \
{ D2, D4, C6, D7, E6, F5, F6, F7, B1 }
/* encoder config */
#define ENCODERS_PAD_A {F0, C7}
#define ENCODERS_PAD_B {F1, F1}
@ -45,3 +57,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define I2C1_CLOCK_SPEED 400000
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
#ifdef OLED_ENABLE
#define OLED_DISPLAY_128X64
#endif

View File

@ -0,0 +1,83 @@
/*
Copyright 2021 Sadek Baroudi <sadekbaroudi@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
#define DEVICE_VER 0x0003
/* key matrix size */
/* Rows are doubled up */
#define MATRIX_ROWS 9
#define MATRIX_COLS 8
// SHIFT REGISTER
// Only needed for matrix_74hc595_spi.c
#define SHIFTREG_MATRIX_COL_CS B6
#define SHIFTREG_DIVISOR 8 // needs to be the same as the PMW33XX_CS_DIVISOR below
#define MATRIX_ROW_PINS_SR { D4, C6, D7, E6, B4, F4, F5, F6, F7 }
#define RGB_DI_PIN D3
#ifdef RGBLIGHT_ENABLE
#ifdef RGBLED_NUM
#undef RGBLED_NUM
#endif
#define RGBLED_NUM 69
#endif
#ifdef RGB_MATRIX_ENABLE
#ifdef DRIVER_LED_TOTAL
#undef DRIVER_LED_TOTAL
#endif
#define DRIVER_LED_TOTAL 69
#endif
// SPI config for shift register (and trackball if enabled)
#define SPI_DRIVER SPID1
#define SPI_SCK_PIN B1
#define SPI_SCK_PAL_MODE 5
#define SPI_MOSI_PIN B2
#define SPI_MOSI_PAL_MODE 5
#define SPI_MISO_PIN B3
#define SPI_MISO_PAL_MODE 5
/* COL2ROW, ROW2COL*/
#define DIODE_DIRECTION COL2ROW
#define ENCODERS_PAD_A {C7, D5, F1}
#define ENCODERS_PAD_B {D2, B7, F0}
#ifdef CIRQUE_ENABLE
// cirque trackpad config
#define CIRQUE_PINNACLE_ADDR 0x2A
#define POINTING_DEVICE_ROTATION_90
#define CIRQUE_PINNACLE_TAP_ENABLE
#define POINTING_DEVICE_TASK_THROTTLE_MS 5
#define I2C1_CLOCK_SPEED 400000
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
#endif
#ifdef FP_TRACKBALL_ENABLE
// Trackball config
#define FP_POINTING_DEFAULT_DPI 800
#define PMW33XX_CS_PIN B5
#define PMW33XX_CPI FP_POINTING_DEFAULT_DPI
#define PMW33XX_CS_DIVISOR 8 // needs to be the same as the SHIFTREG_DIVISOR above
#define POINTING_DEVICE_INVERT_Y
#endif
#define DYNAMIC_KEYMAP_LAYER_COUNT 5

View File

@ -0,0 +1,22 @@
[
{
"type" : "single",
"name" : "CIRQUE_ENABLE",
"user_input": "Do you have a cirque?"
},
{
"type" : "single",
"name" : "FP_TRACKBALL_ENABLE",
"user_input": "Do you have a trackball?"
},
{
"type" : "one-of",
"names" : [ "RGBLIGHT_ENABLE", "RGB_MATRIX_ENABLE" ],
"user_input": "No RGB, RGB light, RGB matrix?"
},
{
"type" : "single",
"name" : "ENCODER_ENABLE",
"user_input": "Do you have one or more rotary encoders?"
}
]

View File

@ -0,0 +1,30 @@
// BEGIN SADEK PWM LED testing
/* Copyright 2020 QMK
*
* 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/>.
*/
/*
* This file was auto-generated by:
* `qmk chibios-confupdate -i keyboards/tkw/grandiceps/halconf.h -r platforms/chibios/BLACKPILL_STM32_F411/configs/halconf.h`
*/
#pragma once
#define HAL_USE_SERIAL TRUE
#define HAL_USE_SPI TRUE
#define SPI_USE_WAIT TRUE
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#include_next <halconf.h>

View File

@ -0,0 +1,107 @@
#include QMK_KEYBOARD_H
// Defines names for use in layer keycodes and the keymap
enum layer_names {
_QWERTY,
_COLEMAK,
_LOWER,
_RAISE,
_ADJUST
};
enum custom_keycodes {
QWERTY = SAFE_RANGE,
LOWER,
RAISE,
ADJUST
};
// All the KC_MUTE keycodes below represent the encoders. If you aren't using encoders, you can ignore these:
// --> KC_MUTE, KC_LCTL, KC_LGUI, LOWER, KC_SPC, KC_LALT, KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, KC_RALT, KC_SPC, RAISE, KC_RGUI, KC_RCTL, KC_MUTE, <--
// --> KC_MUTE <--
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT_rockon(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LPRN, KC_RPRN, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LCBR, KC_RCBR, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, ADJUST, ADJUST, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
KC_MUTE, KC_LCTL, KC_LGUI, LOWER, KC_SPC, KC_LALT, KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, KC_RALT, KC_SPC, RAISE, KC_RGUI, KC_RCTL, KC_MUTE,
KC_MUTE
),
[_COLEMAK] = LAYOUT_rockon(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LPRN, KC_RPRN, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_LBRC, KC_RBRC, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS,
KC_CAPS, KC_A, KC_R, KC_S, KC_T, KC_G, KC_LCBR, KC_RCBR, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_D, KC_V, ADJUST, ADJUST, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
KC_MUTE, KC_LCTL, KC_LGUI, LOWER, KC_SPC, KC_LALT, KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, KC_RALT, KC_SPC, RAISE, KC_RGUI, KC_RCTL, KC_MUTE,
KC_MUTE
),
[_LOWER] = LAYOUT_rockon(
KC_GRV, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______
),
[_RAISE] = LAYOUT_rockon(
KC_GRV, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, _______,
_______, KC_PGUP, KC_UP, KC_PGDN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______
),
[_ADJUST] = LAYOUT_rockon(
RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______,
_______, RGB_TOG, RGB_RMOD, RGB_MOD, _______, TG(_QWERTY), _______, _______, _______, _______, _______, KC_F11, KC_F12, _______,
_______, RGB_SPI, RGB_HUI, RGB_SAI, RGB_VAI, TG(_COLEMAK), _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_SPD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______
)
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case ADJUST:
if (record->event.pressed) {
layer_on(_ADJUST);
} else {
layer_off(_ADJUST);
}
return false;
break;
default:
break;
}
return true;
}

View File

@ -0,0 +1,2 @@
// #define FP_LAYER_LIGHTING_HUE_0 HSV_YELLOW
// #define FP_LAYER_LIGHTING_HUE_4 HSV_BLUE

View File

@ -0,0 +1,120 @@
/* 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
// Uncomment to set up WPM
//char wpm_as_str[8];
/*
* The `LAYOUT_rockon_bp_base` macro is a template to allow the use of identical
* modifiers for the default layouts (eg ALPHA_ALT, Alpha, 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
*/
// clang-format off
#define LAYOUT_rockon_bp_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( \
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, _______, TO(_GAME), KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
KC_TAB, K01, K02, K03, LT(_FUNCTION, K04), K05, FP_SCROLL_TOG, TO(_NAVIGATION), K06, LT(_FUNCTION, K07), K08, K09, K0A, KC_BSLS, \
KC_CAPS, LCTL_T(K11), LGUI_T(K12), LALT_T(K13), LSFT_T(K14), K15, KC_MS_BTN1, TO(_ALPHA), LT(_MOUSE, K16), RSFT_T(K17), RALT_T(K18), RGUI_T(K19), RCTL_T(K1A), KC_QUOT, \
KC_LSFT, K21, K22, K23, K24, K25, FP_SNIPE_TOG, FP_SUPER_TAB, K26, K27, K28, K29, K2A, KC_ENT, \
KC_MUTE, KC_LCTL, KC_LGUI, K33, LT(_NAVIGATION,K34), LT(_FUNCTION,K35), KC_MS_BTN3, KC_MS_BTN1, KC_MS_BTN2, LT(_MEDIA,K36), LT(_SYMBOLS,K37), K38, KC_RGUI, KC_RCTL, KC_MUTE, \
KC_MUTE \
)
/* Re-pass though to allow templates to be used */
#define LAYOUT_rockon_bp_base_wrapper(...) LAYOUT_rockon_bp_base(__VA_ARGS__)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_ALPHA_ALT] = LAYOUT_rockon_bp_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_rockon_bp_base_wrapper(
__________________ALPHA_L1____________________, __________________ALPHA_R1____________________,
__________________ALPHA_L2____________________, __________________ALPHA_R2____________________,
__________________ALPHA_L3____________________, __________________ALPHA_R3____________________,
__ALPHA_THUMBS_6__
),
[_NAVIGATION] = LAYOUT_wrapper(
_______, _______, _______, _______, _______, _______, _______, TO(_ALPHA), _______, _______, _______, _______, _______, _______,
_______, ________________NAVIGATION_1_______________, _______, TO(_SYMBOLS), _________________NUMPAD_1__________________, _______,
_______, ________________NAVIGATION_2_______________, _______, _______, _________________NUMPAD_2__________________, _______,
_______, ________________NAVIGATION_3_______________, _______, _______, _________________NUMPAD_3__________________, _______,
_______, _______, _______, _______, _______, KC_TAB, _______, _______, _______, KC_BSPC, KC_SPACE, KC_DOT, _______, _______, _______,
_______
),
[_SYMBOLS] = LAYOUT_wrapper(
_______, _______, _______, _______, _______, _______, _______, TO(_NAVIGATION), _______, _______, _______, _______, _______, _______,
_______, ________________SYMBOLS_L1_________________, _______, TO(_FUNCTION), ________________SYMBOLS_R1_________________, _______,
_______, ________________SYMBOLS_L2_________________, _______, _______, ________________SYMBOLS_R2_________________, _______,
_______, ________________SYMBOLS_L3_________________, _______, _______, ________________SYMBOLS_R3_________________, _______,
_______, _______, _______, _______, KC_ENT, KC_DEL, _______, _______, _______, KC_BSPC, _______, _______, _______, _______, _______,
_______
),
[_FUNCTION] = LAYOUT_wrapper(
_______, _______, _______, _______, _______, _______, _______, TO(_SYMBOLS), _______, _______, _______, _______, _______, _______,
_______, ________________SHIFTNAV_1_________________, KC_MS_WH_UP, TO(_MEDIA), ________________FUNCTION_1_________________, _______,
_______, ________________SHIFTNAV_2_________________, KC_MS_WH_DOWN, _______, ________________FUNCTION_2_________________, _______,
_______, ________________SHIFTNAV_3_________________, _______, _______, ________________FUNCTION_3_________________, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, N_DEL_LINE, KC_SPACE, _______, _______, _______, _______,
_______
),
[_MEDIA] = LAYOUT_wrapper(
_______, _______, _______, _______, _______, _______, _______, TO(_FUNCTION), _______, _______, _______, _______, _______, _______,
_______, ___________________RGB_1___________________, _______, TO(_GAME), _________________MACROS_1__________________, _______,
_______, ___________________RGB_2___________________, _______, _______, _________________MACROS_2__________________, _______,
_______, ___________________RGB_3___________________, _______, _______, _________________MACROS_3__________________, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______
),
[_MOUSE] = LAYOUT_wrapper(
_______, _______, _______, _______, _______, _______, _______, KC_NO, _______, _______, _______, _______, _______, _______,
_______, _______________AUTO_MOUSE_1________________, _______, KC_NO, ___________________BLANK___________________, _______,
_______, _______________AUTO_MOUSE_2________________, _______, _______, ___________________BLANK___________________, _______,
_______, _______________AUTO_MOUSE_3________________, _______, _______, ___________________BLANK___________________, _______,
_______, _______, _______, _______, KC_MS_BTN1, KC_MS_BTN3, _______, _______, _______, KC_MS_BTN3, KC_MS_BTN2, _______, _______, _______, _______,
_______
),
[_GAME] = LAYOUT_wrapper(
__GAMES_R0_L__, ___________________GAMES_0_________________, __GAMES_R0_R__, TO(_MEDIA), _______, _______, _______, _______, _______, _______,
__GAMES_R1_L__, ___________________GAMES_1_________________, __GAMES_R1_R__, TO(_ALPHA), ___________________BLANK___________________, _______,
__GAMES_R2_L__, ___________________GAMES_2_________________, __GAMES_R2_R__, _______, ___________________BLANK___________________, _______,
__GAMES_R3_L__, ___________________GAMES_3_________________, __GAMES_R3_R__, _______, ___________________BLANK___________________, _______,
_______, __GAMES_R4_1__, __GAMES_R4_3__, __GAMES_TH_L__, __GAMES_TH_C__, __GAMES_TH_R__, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______
)
};

View File

@ -0,0 +1,150 @@
// 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 = MATRIX_ROWS * sizeof(matrix_row_t);
matrix_row_t oldMatrix[MATRIX_ROWS];
#define SHIFTREG_OUTPUT_BITS 8
pin_t rowPinsSR[MATRIX_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 < MATRIX_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 < MATRIX_COLS; c++) {
if (debug_output) {
xprintf("column iteration: %d\n", c);
}
setColumn(c, debug_output);
matrix_io_delay();
for (int r = 0; r < MATRIX_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;
}

View File

@ -0,0 +1,46 @@
/* Copyright 2020 QMK
*
* 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/>.
*/
/*
* This file was auto-generated by:
* `qmk chibios-confupdate -i keyboards/tkw/grandiceps/mcuconf.h -r platforms/chibios/BLACKPILL_STM32_F411/configs/mcuconf.h`
*/
#pragma once
#include_next "mcuconf.h"
#undef STM32_SPI_USE_SPI0
#define STM32_SPI_USE_SPI0 TRUE
// Added because of this error at compile time
/*
Compiling: keyboards/fingerpunch/ffkb_byomcu/v3/matrix_74hc595_spi.c In file included from ./lib/chibios/os/hal/include/hal_spi_v2.h:146:0,
from ./lib/chibios/os/hal/include/hal_spi.h:31,
from ./lib/chibios/os/hal/include/hal.h:315,
from platforms/chibios/platform_deps.h:18,
from quantum/quantum.h:18,
from keyboards/fingerpunch/ffkb_byomcu/v3/matrix_74hc595_spi.c:3:
./lib/chibios/os/hal/ports/STM32/LLD/SPIv1/hal_spi_v2_lld.h:282:2: error: #error "SPI driver activated but no SPI peripheral assigned"
#error "SPI driver activated but no SPI peripheral assigned"
^~~~~
[ERRORS]
*/
#undef STM32_SPI_USE_SPI1
#define STM32_SPI_USE_SPI1 TRUE
#undef STM32_ST_USE_TIMER
#define STM32_ST_USE_TIMER 5

View File

@ -0,0 +1,28 @@
# rockon
An ergonomic 70% keyboard
* Keyboard Maintainer: [sadekbaroudi](https://github.com/sadekbaroudi)
To build the firmware for this keyboard (after setting up your build environment), select from one of the following, depending on what features you have on your board:
```
make fingerpunch/rockon/v3:default RGBLIGHT_ENABLE=yes ENCODER_ENABLE=yes CIRQUE_ENABLE=yes
```
Don't forget to add ```CONVERT_TO=stemcell``` if using a stemcell controller.
Options are:
```
CIRQUE_ENABLE=yes
FP_TRACKBALL_ENABLE=yes
RGBLIGHT_ENABLE=yes
RGB_MATRIX_ENABLE=yes
ENCODER_ENABLE=yes
```
Example of flashing this keyboard:
```
make fingerpunch/rockon/v3:default:flash RGBLIGHT_ENABLE=yes ENCODER_ENABLE=yes CIRQUE_ENABLE=yes
```
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).

View File

@ -0,0 +1,59 @@
# MCU name
MCU = atmega32u4
# 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
# 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
MOUSEKEY_ENABLE = yes
# 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 on port C6
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
ENCODER_ENABLE = no
# EXTRAFLAGS += -flto # macros disabled, if you need the extra space
MOUSEKEY_ENABLE = no
SRC += matrix_74hc595_spi.c
QUANTUM_LIB_SRC += spi_master.c
CUSTOM_MATRIX = lite
ifeq ($(strip $(CIRQUE_ENABLE)), yes)
MOUSEKEY_ENABLE := yes # not required, but enabling for mouse button keys
POINTING_DEVICE_ENABLE := yes
POINTING_DEVICE_DRIVER := cirque_pinnacle_i2c
OPT_DEFS += -DCIRQUE_ENABLE
endif
ifeq ($(strip $(FP_TRACKBALL_ENABLE)), yes)
MOUSEKEY_ENABLE := yes # not required, but enabling for mouse button keys
POINTING_DEVICE_ENABLE := yes
POINTING_DEVICE_DRIVER := pmw3360
QUANTUM_LIB_SRC += spi_master.c
OPT_DEFS += -DFP_TRACKBALL_ENABLE
endif

View File

@ -0,0 +1,62 @@
/* Copyright 2021 Sadek Baroudi <sadekbaroudi@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"
/* This a shortcut to help you visually see your layout.
*
* The first section contains all of the arguments representing the physical
* layout of the board and position of the keys.
*
* The second converts the arguments into a two-dimensional array which
* represents the switch matrix.
*/
#define ___ KC_NO
#define LAYOUT_rockon( \
K50, K00, K01, K02, K03, K04, K62, K65, K05, K06, K07, K80, K53, K86, \
K60, K10, K11, K12, K13, K14, K72, K75, K15, K16, K17, K81, K55, K87, \
K70, K20, K21, K22, K23, K24, K63, K66, K25, K26, K27, K82, K56, K67, \
K71, K30, K31, K32, K33, K34, K51, K52, K35, K36, K37, K83, K57, K77, \
K76, K40, K41, K42, K43, K44, K61, K54, K64, K45, K46, K47, K84, K85, K73, \
K74 \
) \
{ \
{ K07, K02, K04, K05, K06, K03, K01, K00 }, \
{ K17, K12, K14, K15, K16, K13, K11, K10 }, \
{ K27, K22, K24, K25, K26, K23, K21, K20 }, \
{ K37, K32, K34, K35, K36, K33, K31, K30 }, \
{ K47, K42, K44, K45, K46, K43, K41, K40 }, \
{ K57, K52, K54, K55, K56, K53, K51, K50 }, \
{ K67, K62, K64, K65, K66, K63, K61, K60 }, \
{ K77, K72, K74, K75, K76, K73, K71, K70 }, \
{ K87, K82, K84, K85, K86, K83, K81, K80 } \
}
/*
{ \
{ 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 }, \
{ K60, K61, K62, K63, K64, K65, K66, K67 }, \
{ K70, K71, K72, K73, K74, K75, K76, K77 }, \
{ K80, K81, K82, K83, K84, K85, K86, K87 } \
}
*/

View File

@ -24,13 +24,13 @@
#endif
#define AUTO_MOUSE_DEFAULT_LAYER 6
#define POINTING_DEVICE_AUTO_MOUSE_ENABLE
// #define POINTING_DEVICE_AUTO_MOUSE_ENABLE
// Define only one of the two below, but not both.
// Read here for details: https://github.com/sadekbaroudi/qmk_firmware/tree/master/keyboards/fingerpunch#layer-lighting
#define FP_LAYER_LIGHTING_ENABLE
//#define FP_LAYER_LIGHTING_AUTO_MOUSE_ENABLE
// #define FP_LAYER_LIGHTING_AUTO_MOUSE_ENABLE
#define FP_POINTING_SNIPING_LAYER_ENABLE
#define FP_POINTING_SCROLLING_LAYER_ENABLE

View File

@ -16,6 +16,7 @@
|| defined(KEYBOARD_fingerpunch_pinkiesout) \
|| defined(KEYBOARD_fingerpunch_rockon_v1) \
|| defined(KEYBOARD_fingerpunch_rockon_v2) \
|| defined(KEYBOARD_fingerpunch_rockon_v3) \
|| defined(KEYBOARD_fingerpunch_rockon_bp) \
|| defined(KEYBOARD_fingerpunch_sweeeeep) \
|| defined(KEYBOARD_fingerpunch_ximi)

View File

@ -41,8 +41,8 @@ enum userspace_layers {
_FUNCTION,
_MEDIA,
_MOUSE,
_KICAD,
_GAME
_GAME,
_KICAD
};
void press_super_alt_tab(bool shift);