Merge pull request #111 from lalalademaxiya1/playground

Playground
This commit is contained in:
lalalademaxiya1 2023-03-21 16:56:59 +08:00 committed by GitHub
commit 2badc3ccaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
143 changed files with 2062 additions and 262 deletions

View File

@ -27,7 +27,7 @@ enum layers{
};
enum custom_keycodes {
KC_LOPTN = QK_KB_2, // TECH DEBT: Starts at QK_KB_2 to maintain ordering with VIA definitions. See #19884. Revert to QK_KB_0 when VIA catches up with QMK.
KC_LOPTN = QK_KB_2,
KC_ROPTN,
KC_LCMMD,
KC_RCMMD,

View File

@ -27,7 +27,7 @@ enum layers{
};
enum custom_keycodes {
KC_LOPTN = QK_KB_2, // TECH DEBT: Starts at QK_KB_2 to maintain ordering with VIA definitions. See #19884. Revert to QK_KB_0 when VIA catches up with QMK.
KC_LOPTN = QK_KB_2,
KC_ROPTN,
KC_LCMMD,
KC_RCMMD,

View File

@ -39,3 +39,7 @@
#define I2C1_TIMINGR_SDADEL 0U
#define I2C1_TIMINGR_SCLH 15U
#define I2C1_TIMINGR_SCLL 51U
/* Factory test keys */
#define FN_KEY1 MO(1)
#define FN_KEY2 MO(3)

View File

@ -20,7 +20,10 @@
#define DEBOUNCE 5
/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID { {5, 4} }
#define DIP_SWITCH_MATRIX_GRID \
{ \
{ 5, 4 } \
}
#define SCAN_COUNT_MAX 100
/* Disable DIP switch in matrix data */
@ -36,3 +39,7 @@
#define I2C1_TIMINGR_SDADEL 0U
#define I2C1_TIMINGR_SCLH 15U
#define I2C1_TIMINGR_SCLL 51U
/* Factory test keys */
#define FN_KEY1 MO(1)
#define FN_KEY2 MO(3)

View File

@ -78,7 +78,7 @@ static void HC595_output(uint8_t data) {
}
}
static void HC595_output_byte(uint8_t data) {
static void HC595_output_bit(uint8_t data) {
ATOMIC_BLOCK_FORCEON {
if (data & 0x1) {
writePinHigh(HC595_DS);
@ -102,26 +102,13 @@ static bool select_col(uint8_t col) {
return true;
} else {
if (col == 10) {
HC595_output_byte(0x00);
HC595_output_bit(0x00);
}
return true;
}
return false;
}
void select_all_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
pin_t pin = col_pins[x];
if (pin != NO_PIN) {
setPinOutput_writeLow(pin);
} else {
if (x == 10)
HC595_output(0x00);
}
}
}
static void unselect_col(uint8_t col) {
pin_t pin = col_pins[col];
@ -132,7 +119,7 @@ static void unselect_col(uint8_t col) {
setPinInputHigh_atomic(pin);
#endif
} else {
HC595_output_byte(0x01);
HC595_output_bit(0x01);
}
}

View File

@ -28,7 +28,7 @@ key_combination_t key_comb_list[4] = {
};
static uint8_t mac_keycode[4] = {KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD};
//clang-format on
// clang-format on
void housekeeping_task_keychron(void) {
if (is_siri_active) {
if (sync_timer_elapsed32(siri_timer) >= 500) {
@ -50,7 +50,7 @@ bool process_record_keychron(uint16_t keycode, keyrecord_t *record) {
} else {
unregister_code(mac_keycode[keycode - KC_LOPTN]);
}
return false; // Skip all further processing of this key
return false; // Skip all further processing of this key
case KC_SIRI:
if (record->event.pressed) {
if (!is_siri_active) {
@ -62,7 +62,7 @@ bool process_record_keychron(uint16_t keycode, keyrecord_t *record) {
} else {
// Do something else when release
}
return false; // Skip all further processing of this key
return false; // Skip all further processing of this key
case KC_TASK:
case KC_FLXP:
case KC_SNAP:
@ -76,9 +76,9 @@ bool process_record_keychron(uint16_t keycode, keyrecord_t *record) {
unregister_code(key_comb_list[keycode - KC_TASK].keycode[i]);
}
}
return false; // Skip all further processing of this key
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
return true; // Process all other keycodes normally
}
}

View File

@ -22,7 +22,7 @@
#endif
enum custom_keycodes {
KC_LOPTN = QK_KB_2, // TECH DEBT: Starts at QK_KB_2 to maintain ordering with VIA definitions. See #19884. Revert to QK_KB_0 when VIA catches up with QMK.
KC_LOPTN = QK_KB_2,
KC_ROPTN,
KC_LCMMD,
KC_RCMMD,

View File

@ -17,6 +17,14 @@
#include "keychron_ft_common.h"
#include "raw_hid.h"
#ifndef BL_TEST_KEY1
# define BL_TEST_KEY1 KC_RIGHT
#endif
#ifndef BL_TEST_KEY2
# define BL_TEST_KEY2 KC_HOME
#endif
// clang-format off
enum {
OS_SWITCH = 0x01,
@ -47,10 +55,17 @@ HSV hsv;
__attribute__((weak)) bool process_record_keychron_ft(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case MO(1):
case MO(2):
case MO(3):
case MO(4):
#if defined(FN_KEY1) || defined(FN_KEY2) || defined(FN_KEY3)
# ifdef FN_KEY1
case FN_KEY1: /* fall through */
# endif
# ifdef FN_KEY2
case FN_KEY2:
# endif
# ifdef FN_KEY3
case FN_KEY3:
# endif
#endif
if (record->event.pressed) {
key_press_status |= KEY_PRESS_STEP_0;
} else {
@ -80,7 +95,7 @@ __attribute__((weak)) bool process_record_keychron_ft(uint16_t keycode, keyrecor
timer_3s_buffer = 0;
}
return true;
case KC_RIGHT:
case BL_TEST_KEY1:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_STEP_3;
if (led_test_mode) {
@ -95,7 +110,7 @@ __attribute__((weak)) bool process_record_keychron_ft(uint16_t keycode, keyrecor
timer_3s_buffer = 0;
}
return true;
case KC_HOME:
case BL_TEST_KEY2:
if (record->event.pressed) {
key_press_status |= KEY_PRESS_STEP_4;
if (led_test_mode) {

View File

@ -84,3 +84,6 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(1)

View File

@ -18,10 +18,17 @@
bool process_record_keychron_ft(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case MO(1):
case MO(2):
case MO(3):
case MO(4):
#if defined(FN_KEY1) || defined(FN_KEY2) || defined(FN_KEY3)
# ifdef FN_KEY1
case FN_KEY1: /* fall through */
# endif
# ifdef FN_KEY2
case FN_KEY2:
# endif
# ifdef FN_KEY3
case FN_KEY3:
# endif
#endif
if (record->event.pressed) {
key_press_status |= KEY_PRESS_STEP_0;
} else {

View File

@ -17,5 +17,6 @@
#pragma once
#define HAL_USE_I2C TRUE
#define PAL_USE_CALLBACKS TRUE
#include_next <halconf.h>

View File

@ -0,0 +1,21 @@
/* Copyright 2022 @ Keychron (https://www.keychron.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 "quantum.h"
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -91,3 +91,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -15,6 +15,8 @@
*/
#include "quantum.h"
#include <avr/interrupt.h>
#include <avr/io.h>
const matrix_row_t matrix_mask[] = {
0b111111111111101,
@ -156,3 +158,20 @@ led_config_t g_led_config = {
};
#endif
#ifdef ENCODER_ENABLE
void keyboard_post_init_kb(void) {
PCMSK0 |= (1 << 7);
PCICR |= (1 << PCIE0);
sei();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
ISR(PCINT0_vect) {
encoder_inerrupt_read(0);
}
#endif

View File

@ -156,3 +156,7 @@ led_config_t g_led_config = {
};
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -156,3 +156,46 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -77,3 +77,7 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(1)
#define FN_KEY2 MO(3)

View File

@ -17,5 +17,6 @@
#pragma once
#define HAL_USE_I2C TRUE
#define PAL_USE_CALLBACKS TRUE
#include_next <halconf.h>

View File

@ -157,3 +157,20 @@ led_config_t g_led_config = {
};
#endif
#ifdef ENCODER_ENABLE
void keyboard_post_init_kb(void) {
PCMSK0 |= (1 << 7);
PCICR |= (1 << PCIE0);
sei();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
ISR(PCINT0_vect) {
encoder_inerrupt_read(0);
}
#endif

View File

@ -157,3 +157,7 @@ led_config_t g_led_config = {
};
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -157,3 +157,46 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -160,3 +160,7 @@ led_config_t g_led_config = {
};
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -160,3 +160,46 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -78,7 +78,7 @@ static void HC595_output(uint8_t data) {
}
}
static void HC595_output_byte(uint8_t data) {
static void HC595_output_bit(uint8_t data) {
ATOMIC_BLOCK_FORCEON {
if (data & 0x1) {
writePinHigh(HC595_DS);
@ -102,26 +102,13 @@ static bool select_col(uint8_t col) {
return true;
} else {
if (col == 8) {
HC595_output_byte(0x00);
HC595_output_bit(0x00);
}
return true;
}
return false;
}
void select_all_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
pin_t pin = col_pins[x];
if (pin != NO_PIN) {
setPinOutput_writeLow(pin);
} else {
if (x == 8)
HC595_output(0x00);
}
}
}
static void unselect_col(uint8_t col) {
pin_t pin = col_pins[col];
@ -132,7 +119,7 @@ static void unselect_col(uint8_t col) {
setPinInputHigh_atomic(pin);
#endif
} else {
HC595_output_byte(0x01);
HC595_output_bit(0x01);
}
}

View File

@ -18,7 +18,9 @@
#ifdef DIP_SWITCH_ENABLE
bool dip_switch_update_kb(uint8_t index, bool active) {
if (!dip_switch_update_user(index, active)) { return false;}
if (!dip_switch_update_user(index, active)) {
return false;
}
if (index == 0) {
default_layer_set(1UL << (active ? 2 : 0));
}

View File

@ -155,3 +155,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -102,3 +102,7 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(1)
#define FN_KEY2 MO(3)

View File

@ -17,5 +17,6 @@
#pragma once
#define HAL_USE_I2C TRUE
#define PAL_USE_CALLBACKS TRUE
#include_next <halconf.h>

View File

@ -156,3 +156,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -78,7 +78,7 @@ static void HC595_output(uint8_t data) {
}
}
static void HC595_output_byte(uint8_t data) {
static void HC595_output_bit(uint8_t data) {
ATOMIC_BLOCK_FORCEON {
if (data & 0x1) {
writePinHigh(HC595_DS);
@ -102,26 +102,13 @@ static bool select_col(uint8_t col) {
return true;
} else {
if (col == 8) {
HC595_output_byte(0x00);
HC595_output_bit(0x00);
}
return true;
}
return false;
}
void select_all_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
pin_t pin = col_pins[x];
if (pin != NO_PIN) {
setPinOutput_writeLow(pin);
} else {
if (x == 8)
HC595_output(0x00);
}
}
}
static void unselect_col(uint8_t col) {
pin_t pin = col_pins[col];
@ -132,7 +119,7 @@ static void unselect_col(uint8_t col) {
setPinInputHigh_atomic(pin);
#endif
} else {
HC595_output_byte(0x01);
HC595_output_bit(0x01);
}
}

View File

@ -36,3 +36,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -189,29 +189,29 @@ led_config_t g_led_config = {
#define ADC_RESOLUTION ADC_CFGR_RES_10BITS
static int16_t analogReadPin_my(pin_t pin) {
ADCConfig adcCfg = {};
adcsample_t sampleBuffer[ADC_NUM_CHANNELS*ADC_BUFFER_DEPTH];
ADCDriver* targetDriver = &ADCD1;
ADCConfig adcCfg = {};
adcsample_t sampleBuffer[ADC_NUM_CHANNELS * ADC_BUFFER_DEPTH];
ADCDriver *targetDriver = &ADCD1;
ADCConversionGroup adcConversionGroup = {
.circular = FALSE,
.circular = FALSE,
.num_channels = (uint16_t)(ADC_NUM_CHANNELS),
.cfgr = ADC_RESOLUTION,
.cfgr = ADC_RESOLUTION,
};
palSetLineMode(pin, PAL_MODE_INPUT_ANALOG);
switch (pin) {
case B0:
adcConversionGroup.smpr[2] = ADC_SMPR2_SMP_AN15(ADC_SAMPLING_RATE);
adcConversionGroup.sqr[0] = ADC_SQR1_SQ1_N(ADC_CHANNEL_IN15);
sampleBuffer[0] = 0;
adcConversionGroup.sqr[0] = ADC_SQR1_SQ1_N(ADC_CHANNEL_IN15);
sampleBuffer[0] = 0;
break;
case B1:
adcConversionGroup.smpr[2] = ADC_SMPR2_SMP_AN16(ADC_SAMPLING_RATE);
adcConversionGroup.sqr[0] = ADC_SQR1_SQ1_N(ADC_CHANNEL_IN16);
sampleBuffer[0] = 0;
adcConversionGroup.sqr[0] = ADC_SQR1_SQ1_N(ADC_CHANNEL_IN16);
sampleBuffer[0] = 0;
break;
default:
return 0;
return 0;
}
adcStart(targetDriver, &adcCfg);
if (adcConvert(targetDriver, &adcConversionGroup, &sampleBuffer[0], ADC_BUFFER_DEPTH) != MSG_OK) {
@ -221,6 +221,39 @@ static int16_t analogReadPin_my(pin_t pin) {
return *sampleBuffer;
}
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
#endif
void keyboard_post_init_kb(void) {
if (is_keyboard_left()) {
setPinOutput(A0);
@ -231,6 +264,9 @@ void keyboard_post_init_kb(void) {
setPinInput(A12);
}
}
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
encoder_interrupt_init();
#endif
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}

View File

@ -120,3 +120,7 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(1)
#define FN_KEY2 MO(3)

View File

@ -21,10 +21,17 @@ static bool skip_next_step = false;
bool process_record_keychron_ft(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case MO(1):
case MO(2):
case MO(3):
case MO(4):
#if defined(FN_KEY1) || defined(FN_KEY2) || defined(FN_KEY3)
# ifdef FN_KEY1
case FN_KEY1: /* fall through */
# endif
# ifdef FN_KEY2
case FN_KEY2:
# endif
# ifdef FN_KEY3
case FN_KEY3:
# endif
#endif
if (record->event.pressed) {
key_press_status |= KEY_PRESS_STEP_0;
} else {

View File

@ -19,5 +19,6 @@
#define HAL_USE_I2C TRUE
#define HAL_USE_SERIAL TRUE
#define HAL_USE_ADC TRUE
#define PAL_USE_CALLBACKS TRUE
#include_next <halconf.h>

View File

@ -167,3 +167,42 @@ led_config_t g_led_config = {
}
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -100,3 +100,7 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(1)
#define FN_KEY2 MO(3)

View File

@ -17,5 +17,6 @@
#pragma once
#define HAL_USE_I2C TRUE
#define PAL_USE_CALLBACKS TRUE
#include_next <halconf.h>

View File

@ -171,3 +171,42 @@ led_config_t g_led_config = {
}
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -78,7 +78,7 @@ static void HC595_output(uint16_t data) {
}
}
static void HC595_output_byte(uint8_t data) {
static void HC595_output_bit(uint8_t data) {
ATOMIC_BLOCK_FORCEON {
if (data & 0x1) {
writePinHigh(HC595_DS);
@ -102,7 +102,7 @@ static bool select_col(uint8_t col) {
return true;
} else {
if (col == 10) {
HC595_output_byte(0x00);
HC595_output_bit(0x00);
}
return true;
}
@ -119,7 +119,7 @@ static void unselect_col(uint8_t col) {
setPinInputHigh_atomic(pin);
#endif
} else {
HC595_output_byte(0x01);
HC595_output_bit(0x01);
}
}

View File

@ -37,3 +37,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -128,3 +128,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -103,3 +103,7 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(2)
#define FN_KEY2 MO(3)

View File

@ -17,5 +17,6 @@
#pragma once
#define HAL_USE_I2C TRUE
#define PAL_USE_CALLBACKS TRUE
#include_next <halconf.h>

View File

@ -129,3 +129,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -132,3 +132,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -33,3 +33,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -153,3 +153,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -103,3 +103,7 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(1)
#define FN_KEY2 MO(3)

View File

@ -17,5 +17,6 @@
#pragma once
#define HAL_USE_I2C TRUE
#define PAL_USE_CALLBACKS TRUE
#include_next <halconf.h>

View File

@ -153,3 +153,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -157,3 +157,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -78,7 +78,7 @@ static void HC595_output(uint8_t data) {
}
}
static void HC595_output_byte(uint8_t data) {
static void HC595_output_bit(uint8_t data) {
ATOMIC_BLOCK_FORCEON {
if (data & 0x1) {
writePinHigh(HC595_DS);
@ -102,26 +102,13 @@ static bool select_col(uint8_t col) {
return true;
} else {
if (col == 8) {
HC595_output_byte(0x00);
HC595_output_bit(0x00);
}
return true;
}
return false;
}
void select_all_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
pin_t pin = col_pins[x];
if (pin != NO_PIN) {
setPinOutput_writeLow(pin);
} else {
if (x == 8)
HC595_output(0x00);
}
}
}
static void unselect_col(uint8_t col) {
pin_t pin = col_pins[col];
@ -132,7 +119,7 @@ static void unselect_col(uint8_t col) {
setPinInputHigh_atomic(pin);
#endif
} else {
HC595_output_byte(0x01);
HC595_output_bit(0x01);
}
}

View File

@ -40,3 +40,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif // DIP_SWITCH_ENABLE
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -95,3 +95,6 @@
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(2)
#define FN_KEY2 MO(3)

View File

@ -33,3 +33,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -167,3 +167,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -100,3 +100,7 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(1)
#define FN_KEY2 MO(3)

View File

@ -17,5 +17,6 @@
#pragma once
#define HAL_USE_I2C TRUE
#define PAL_USE_CALLBACKS TRUE
#include_next <halconf.h>

View File

@ -166,3 +166,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -78,7 +78,7 @@ static void HC595_output(uint8_t data) {
}
}
static void HC595_output_byte(uint8_t data) {
static void HC595_output_bit(uint8_t data) {
ATOMIC_BLOCK_FORCEON {
if (data & 0x1) {
writePinHigh(HC595_DS);
@ -102,26 +102,13 @@ static bool select_col(uint8_t col) {
return true;
} else {
if (col == 10) {
HC595_output_byte(0x00);
HC595_output_bit(0x00);
}
return true;
}
return false;
}
void select_all_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
pin_t pin = col_pins[x];
if (pin != NO_PIN) {
setPinOutput_writeLow(pin);
} else {
if (x == 10)
HC595_output(0x00);
}
}
}
static void unselect_col(uint8_t col) {
pin_t pin = col_pins[col];
@ -132,7 +119,7 @@ static void unselect_col(uint8_t col) {
setPinInputHigh_atomic(pin);
#endif
} else {
HC595_output_byte(0x01);
HC595_output_bit(0x01);
}
}

View File

@ -36,3 +36,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -78,7 +78,7 @@ static void HC595_output(uint8_t data) {
}
}
static void HC595_output_byte(uint8_t data) {
static void HC595_output_bit(uint8_t data) {
ATOMIC_BLOCK_FORCEON {
if (data & 0x1) {
writePinHigh(HC595_DS);
@ -102,26 +102,13 @@ static bool select_col(uint8_t col) {
return true;
} else {
if (col == 11) {
HC595_output_byte(0x00);
HC595_output_bit(0x00);
}
return true;
}
return false;
}
void select_all_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
pin_t pin = col_pins[x];
if (pin != NO_PIN) {
setPinOutput_writeLow(pin);
} else {
if (x == 11)
HC595_output(0x00);
}
}
}
static void unselect_col(uint8_t col) {
pin_t pin = col_pins[col];
@ -132,7 +119,7 @@ static void unselect_col(uint8_t col) {
setPinInputHigh_atomic(pin);
#endif
} else {
HC595_output_byte(0x01);
HC595_output_bit(0x01);
}
}

View File

@ -175,3 +175,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -78,7 +78,7 @@ static void HC595_output(uint16_t data) {
}
}
static void HC595_output_byte(uint8_t data) {
static void HC595_output_bit(uint8_t data) {
ATOMIC_BLOCK_FORCEON {
if (data & 0x1) {
writePinHigh(HC595_DS);
@ -102,26 +102,13 @@ static bool select_col(uint8_t col) {
return true;
} else {
if (col == 10) {
HC595_output_byte(0x00);
HC595_output_bit(0x00);
}
return true;
}
return false;
}
void select_all_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
pin_t pin = col_pins[x];
if (pin != NO_PIN) {
setPinOutput_writeLow(pin);
} else {
if (x == 10)
HC595_output(0x0000);
}
}
}
static void unselect_col(uint8_t col) {
pin_t pin = col_pins[col];
@ -132,7 +119,7 @@ static void unselect_col(uint8_t col) {
setPinInputHigh_atomic(pin);
#endif
} else {
HC595_output_byte(0x01);
HC595_output_bit(0x01);
}
}

View File

@ -100,3 +100,7 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(1)
#define FN_KEY2 MO(3)

View File

@ -17,5 +17,6 @@
#pragma once
#define HAL_USE_I2C TRUE
#define PAL_USE_CALLBACKS TRUE
#include_next <halconf.h>

View File

@ -78,7 +78,7 @@ static void HC595_output(uint8_t data) {
}
}
static void HC595_output_byte(uint8_t data) {
static void HC595_output_bit(uint8_t data) {
ATOMIC_BLOCK_FORCEON {
if (data & 0x1) {
writePinHigh(HC595_DS);
@ -102,26 +102,13 @@ static bool select_col(uint8_t col) {
return true;
} else {
if (col == 11) {
HC595_output_byte(0x00);
HC595_output_bit(0x00);
}
return true;
}
return false;
}
void select_all_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
pin_t pin = col_pins[x];
if (pin != NO_PIN) {
setPinOutput_writeLow(pin);
} else {
if (x == 11)
HC595_output(0x00);
}
}
}
static void unselect_col(uint8_t col) {
pin_t pin = col_pins[col];
@ -132,7 +119,7 @@ static void unselect_col(uint8_t col) {
setPinInputHigh_atomic(pin);
#endif
} else {
HC595_output_byte(0x01);
HC595_output_bit(0x01);
}
}

View File

@ -176,3 +176,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -78,7 +78,7 @@ static void HC595_output(uint16_t data) {
}
}
static void HC595_output_byte(uint8_t data) {
static void HC595_output_bit(uint8_t data) {
ATOMIC_BLOCK_FORCEON {
if (data & 0x1) {
writePinHigh(HC595_DS);
@ -102,26 +102,13 @@ static bool select_col(uint8_t col) {
return true;
} else {
if (col == 10) {
HC595_output_byte(0x00);
HC595_output_bit(0x00);
}
return true;
}
return false;
}
void select_all_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
pin_t pin = col_pins[x];
if (pin != NO_PIN) {
setPinOutput_writeLow(pin);
} else {
if (x == 10)
HC595_output(0x0000);
}
}
}
static void unselect_col(uint8_t col) {
pin_t pin = col_pins[col];
@ -132,7 +119,7 @@ static void unselect_col(uint8_t col) {
setPinInputHigh_atomic(pin);
#endif
} else {
HC595_output_byte(0x01);
HC595_output_bit(0x01);
}
}

View File

@ -36,3 +36,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -99,3 +99,6 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(2)

View File

@ -33,3 +33,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -133,3 +133,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -102,3 +102,7 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(2)
#define FN_KEY2 MO(3)

View File

@ -17,5 +17,6 @@
#pragma once
#define HAL_USE_I2C TRUE
#define PAL_USE_CALLBACKS TRUE
#include_next <halconf.h>

View File

@ -78,7 +78,7 @@ static void HC595_output(uint8_t data) {
}
}
static void HC595_output_byte(uint8_t data) {
static void HC595_output_bit(uint8_t data) {
ATOMIC_BLOCK_FORCEON {
if (data & 0x1) {
writePinHigh(HC595_DS);
@ -102,26 +102,13 @@ static bool select_col(uint8_t col) {
return true;
} else {
if (col == 0) {
HC595_output_byte(0x00);
HC595_output_bit(0x00);
}
return true;
}
return false;
}
void select_all_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
pin_t pin = col_pins[x];
if (pin != NO_PIN) {
setPinOutput_writeLow(pin);
} else {
if (x == 0)
HC595_output(0x00);
}
}
}
static void unselect_col(uint8_t col) {
pin_t pin = col_pins[col];
@ -132,7 +119,7 @@ static void unselect_col(uint8_t col) {
setPinInputHigh_atomic(pin);
#endif
} else {
HC595_output_byte(0x01);
HC595_output_bit(0x01);
}
}

View File

@ -33,3 +33,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -101,3 +101,7 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(2)
#define FN_KEY2 MO(3)

View File

@ -33,3 +33,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -133,3 +133,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -105,3 +105,7 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(2)
#define FN_KEY2 MO(3)

View File

@ -17,5 +17,6 @@
#pragma once
#define HAL_USE_I2C TRUE
#define PAL_USE_CALLBACKS TRUE
#include_next <halconf.h>

View File

@ -133,3 +133,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -33,3 +33,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -111,3 +111,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -99,3 +99,8 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(2)
#define FN_KEY2 MO(3)
#define FN_KEY3 MO(4)

View File

@ -17,5 +17,6 @@
#pragma once
#define HAL_USE_I2C TRUE
#define PAL_USE_CALLBACKS TRUE
#include_next <halconf.h>

View File

@ -112,3 +112,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -32,3 +32,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -36,3 +36,7 @@
#define I2C1_TIMINGR_SDADEL 0U
#define I2C1_TIMINGR_SCLH 15U
#define I2C1_TIMINGR_SCLL 51U
/* Factory test keys */
#define FN_KEY1 MO(1)
#define FN_KEY2 MO(3)

View File

@ -38,3 +38,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -149,3 +149,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -100,3 +100,7 @@
// #define ENABLE_RGB_MATRIX_MULTISPLASH
#define ENABLE_RGB_MATRIX_SOLID_SPLASH
// #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
/* Factory test keys */
#define FN_KEY1 MO(1)
#define FN_KEY2 MO(3)

View File

@ -17,5 +17,6 @@
#pragma once
#define HAL_USE_I2C TRUE
#define PAL_USE_CALLBACKS TRUE
#include_next <halconf.h>

View File

@ -150,3 +150,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -153,3 +153,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

View File

@ -78,7 +78,7 @@ static void HC595_output(uint8_t data) {
}
}
static void HC595_output_byte(uint8_t data) {
static void HC595_output_bit(uint8_t data) {
ATOMIC_BLOCK_FORCEON {
if (data & 0x1) {
writePinHigh(HC595_DS);
@ -102,26 +102,13 @@ static bool select_col(uint8_t col) {
return true;
} else {
if (col == 8) {
HC595_output_byte(0x00);
HC595_output_bit(0x00);
}
return true;
}
return false;
}
void select_all_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
pin_t pin = col_pins[x];
if (pin != NO_PIN) {
setPinOutput_writeLow(pin);
} else {
if (x == 8)
HC595_output(0x00);
}
}
}
static void unselect_col(uint8_t col) {
pin_t pin = col_pins[col];
@ -132,7 +119,7 @@ static void unselect_col(uint8_t col) {
setPinInputHigh_atomic(pin);
#endif
} else {
HC595_output_byte(0x01);
HC595_output_bit(0x01);
}
}

View File

@ -36,3 +36,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
#endif
void restart_usb_driver(USBDriver *usbp) {
(void)usbp;
}

View File

@ -155,3 +155,42 @@ led_config_t g_led_config = {
};
#endif
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
void encoder0_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(0);
}
void encoder1_pad_cb(void *param) {
(void)param;
encoder_inerrupt_read(1);
}
void encoder_interrupt_init(void) {
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint8_t i = 0; i < NUM_ENCODERS; i++) {
palEnableLineEvent(encoders_pad_a[i], PAL_EVENT_MODE_BOTH_EDGES);
palEnableLineEvent(encoders_pad_b[i], PAL_EVENT_MODE_BOTH_EDGES);
}
if (NUM_ENCODERS > 0) {
palSetLineCallback(encoders_pad_a[0], encoder0_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[0], encoder0_pad_cb, NULL);
}
if (NUM_ENCODERS > 1) {
palSetLineCallback(encoders_pad_a[1], encoder1_pad_cb, NULL);
palSetLineCallback(encoders_pad_b[1], encoder1_pad_cb, NULL);
}
}
void keyboard_post_init_kb(void) {
encoder_interrupt_init();
// allow user keymaps to do custom post_init
keyboard_post_init_user();
}
#endif

Some files were not shown because too many files have changed in this diff Show More