Merge remote-tracking branch 'upstream/develop' into xap
This commit is contained in:
commit
942d9f6a09
172 changed files with 3974 additions and 379 deletions
|
|
@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "keycode.h"
|
||||
#include "keyboard.h"
|
||||
#include "mousekey.h"
|
||||
#include "programmable_button.h"
|
||||
#include "command.h"
|
||||
#include "led.h"
|
||||
#include "action_layer.h"
|
||||
|
|
@ -988,6 +989,10 @@ void clear_keyboard_but_mods_and_keys() {
|
|||
mousekey_clear();
|
||||
mousekey_send();
|
||||
#endif
|
||||
#ifdef PROGRAMMABLE_BUTTON_ENABLE
|
||||
programmable_button_clear();
|
||||
programmable_button_send();
|
||||
#endif
|
||||
}
|
||||
|
||||
/** \brief Utilities for actions. (FIXME: Needs better description)
|
||||
|
|
|
|||
|
|
@ -109,9 +109,9 @@ void audio_driver_initialize(void) {
|
|||
|
||||
// connect the AUDIO_PIN to the PWM hardware
|
||||
#if defined(USE_GPIOV1) // STM32F103C8
|
||||
palSetLineMode(AUDIO_PIN, PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
||||
palSetLineMode(AUDIO_PIN, PAL_MODE_ALTERNATE_PUSHPULL);
|
||||
#else // GPIOv2 (or GPIOv3 for f4xx, which is the same/compatible at this command)
|
||||
palSetLineMode(AUDIO_PIN, PAL_STM32_MODE_ALTERNATE | PAL_STM32_ALTERNATE(AUDIO_PWM_PAL_MODE));
|
||||
palSetLineMode(AUDIO_PIN, PAL_MODE_ALTERNATE(AUDIO_PWM_PAL_MODE));
|
||||
#endif
|
||||
|
||||
gptStart(&AUDIO_STATE_TIMER, &gptCFG);
|
||||
|
|
|
|||
|
|
@ -8,9 +8,13 @@
|
|||
# define BACKLIGHT_LIMIT_VAL 255
|
||||
#endif
|
||||
|
||||
// GPIOV2 && GPIOV3
|
||||
#ifndef BACKLIGHT_PAL_MODE
|
||||
# define BACKLIGHT_PAL_MODE 2
|
||||
# if defined(USE_GPIOV1)
|
||||
# define BACKLIGHT_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
|
||||
# else
|
||||
// GPIOV2 && GPIOV3
|
||||
# define BACKLIGHT_PAL_MODE 5
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// GENERIC
|
||||
|
|
@ -70,7 +74,7 @@ static uint32_t rescale_limit_val(uint32_t val) {
|
|||
|
||||
void backlight_init_ports(void) {
|
||||
#ifdef USE_GPIOV1
|
||||
palSetPadMode(PAL_PORT(BACKLIGHT_PIN), PAL_PAD(BACKLIGHT_PIN), PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
||||
palSetPadMode(PAL_PORT(BACKLIGHT_PIN), PAL_PAD(BACKLIGHT_PIN), BACKLIGHT_PAL_MODE);
|
||||
#else
|
||||
palSetPadMode(PAL_PORT(BACKLIGHT_PIN), PAL_PAD(BACKLIGHT_PIN), PAL_MODE_ALTERNATE(BACKLIGHT_PAL_MODE));
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,11 +4,6 @@
|
|||
#include "eeconfig.h"
|
||||
#include "action_layer.h"
|
||||
|
||||
#ifdef STM32_EEPROM_ENABLE
|
||||
# include <hal.h>
|
||||
# include "eeprom_stm32.h"
|
||||
#endif
|
||||
|
||||
#if defined(EEPROM_DRIVER)
|
||||
# include "eeprom_driver.h"
|
||||
#endif
|
||||
|
|
@ -43,9 +38,6 @@ __attribute__((weak)) void eeconfig_init_kb(void) {
|
|||
* FIXME: needs doc
|
||||
*/
|
||||
void eeconfig_init_quantum(void) {
|
||||
#ifdef STM32_EEPROM_ENABLE
|
||||
EEPROM_Erase();
|
||||
#endif
|
||||
#if defined(EEPROM_DRIVER)
|
||||
eeprom_driver_erase();
|
||||
#endif
|
||||
|
|
@ -111,9 +103,6 @@ void eeconfig_enable(void) { eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_N
|
|||
* FIXME: needs doc
|
||||
*/
|
||||
void eeconfig_disable(void) {
|
||||
#ifdef STM32_EEPROM_ENABLE
|
||||
EEPROM_Erase();
|
||||
#endif
|
||||
#if defined(EEPROM_DRIVER)
|
||||
eeprom_driver_erase();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#ifdef JOYSTICK_ENABLE
|
||||
# include "process_joystick.h"
|
||||
#endif
|
||||
#ifdef PROGRAMMABLE_BUTTON_ENABLE
|
||||
# include "programmable_button.h"
|
||||
#endif
|
||||
#ifdef HD44780_ENABLE
|
||||
# include "hd44780.h"
|
||||
#endif
|
||||
|
|
@ -97,9 +100,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#ifdef DIP_SWITCH_ENABLE
|
||||
# include "dip_switch.h"
|
||||
#endif
|
||||
#ifdef STM32_EEPROM_ENABLE
|
||||
# include "eeprom_stm32.h"
|
||||
#endif
|
||||
#ifdef EEPROM_DRIVER
|
||||
# include "eeprom_driver.h"
|
||||
#endif
|
||||
|
|
@ -246,9 +246,6 @@ void keyboard_setup(void) {
|
|||
disable_jtag();
|
||||
#endif
|
||||
print_set_sendchar(sendchar);
|
||||
#ifdef STM32_EEPROM_ENABLE
|
||||
EEPROM_Init();
|
||||
#endif
|
||||
#ifdef EEPROM_DRIVER
|
||||
eeprom_driver_init();
|
||||
#endif
|
||||
|
|
@ -548,6 +545,10 @@ MATRIX_LOOP_END:
|
|||
digitizer_task();
|
||||
#endif
|
||||
|
||||
#ifdef PROGRAMMABLE_BUTTON_ENABLE
|
||||
programmable_button_send();
|
||||
#endif
|
||||
|
||||
// update LED
|
||||
if (led_status != host_keyboard_leds()) {
|
||||
led_status = host_keyboard_leds();
|
||||
|
|
|
|||
31
quantum/process_keycode/process_programmable_button.c
Normal file
31
quantum/process_keycode/process_programmable_button.c
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
Copyright 2021 Thomas Weißschuh <thomas@t-8ch.de>
|
||||
|
||||
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 "process_programmable_button.h"
|
||||
#include "programmable_button.h"
|
||||
|
||||
bool process_programmable_button(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode >= PROGRAMMABLE_BUTTON_MIN && keycode <= PROGRAMMABLE_BUTTON_MAX) {
|
||||
uint8_t button = keycode - PROGRAMMABLE_BUTTON_MIN + 1;
|
||||
if (record->event.pressed) {
|
||||
programmable_button_on(button);
|
||||
} else {
|
||||
programmable_button_off(button);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
23
quantum/process_keycode/process_programmable_button.h
Normal file
23
quantum/process_keycode/process_programmable_button.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
Copyright 2021 Thomas Weißschuh <thomas@t-8ch.de>
|
||||
|
||||
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 <stdint.h>
|
||||
#include "quantum.h"
|
||||
|
||||
bool process_programmable_button(uint16_t keycode, keyrecord_t *record);
|
||||
37
quantum/programmable_button.c
Normal file
37
quantum/programmable_button.c
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
Copyright 2021 Thomas Weißschuh <thomas@t-8ch.de>
|
||||
|
||||
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 "programmable_button.h"
|
||||
#include "host.h"
|
||||
|
||||
#define REPORT_BIT(index) (((uint32_t)1) << (index - 1))
|
||||
|
||||
static uint32_t programmable_button_report = 0;
|
||||
|
||||
void programmable_button_clear(void) { programmable_button_report = 0; }
|
||||
|
||||
void programmable_button_send(void) { host_programmable_button_send(programmable_button_report); }
|
||||
|
||||
void programmable_button_on(uint8_t index) { programmable_button_report |= REPORT_BIT(index); }
|
||||
|
||||
void programmable_button_off(uint8_t index) { programmable_button_report &= ~REPORT_BIT(index); }
|
||||
|
||||
bool programmable_button_is_on(uint8_t index) { return !!(programmable_button_report & REPORT_BIT(index)); };
|
||||
|
||||
uint32_t programmable_button_get_report(void) { return programmable_button_report; };
|
||||
|
||||
void programmable_button_set_report(uint32_t report) { programmable_button_report = report; }
|
||||
30
quantum/programmable_button.h
Normal file
30
quantum/programmable_button.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
Copyright 2021 Thomas Weißschuh <thomas@t-8ch.de>
|
||||
|
||||
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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "report.h"
|
||||
|
||||
void programmable_button_clear(void);
|
||||
void programmable_button_send(void);
|
||||
void programmable_button_on(uint8_t index);
|
||||
void programmable_button_off(uint8_t index);
|
||||
bool programmable_button_is_on(uint8_t index);
|
||||
uint32_t programmable_button_get_report(void);
|
||||
void programmable_button_set_report(uint32_t report);
|
||||
|
|
@ -295,6 +295,9 @@ bool process_record_quantum(keyrecord_t *record) {
|
|||
#endif
|
||||
#ifdef JOYSTICK_ENABLE
|
||||
process_joystick(keycode, record) &&
|
||||
#endif
|
||||
#ifdef PROGRAMMABLE_BUTTON_ENABLE
|
||||
process_programmable_button(keycode, record) &&
|
||||
#endif
|
||||
true)) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -147,6 +147,10 @@ extern layer_state_t layer_state;
|
|||
# include "process_joystick.h"
|
||||
#endif
|
||||
|
||||
#ifdef PROGRAMMABLE_BUTTON_ENABLE
|
||||
# include "process_programmable_button.h"
|
||||
#endif
|
||||
|
||||
#ifdef GRAVE_ESC_ENABLE
|
||||
# include "process_grave_esc.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -524,6 +524,40 @@ enum quantum_keycodes {
|
|||
// Additional magic key
|
||||
MAGIC_TOGGLE_GUI,
|
||||
|
||||
// Programmable Button
|
||||
PROGRAMMABLE_BUTTON_1,
|
||||
PROGRAMMABLE_BUTTON_2,
|
||||
PROGRAMMABLE_BUTTON_3,
|
||||
PROGRAMMABLE_BUTTON_4,
|
||||
PROGRAMMABLE_BUTTON_5,
|
||||
PROGRAMMABLE_BUTTON_6,
|
||||
PROGRAMMABLE_BUTTON_7,
|
||||
PROGRAMMABLE_BUTTON_8,
|
||||
PROGRAMMABLE_BUTTON_9,
|
||||
PROGRAMMABLE_BUTTON_10,
|
||||
PROGRAMMABLE_BUTTON_11,
|
||||
PROGRAMMABLE_BUTTON_12,
|
||||
PROGRAMMABLE_BUTTON_13,
|
||||
PROGRAMMABLE_BUTTON_14,
|
||||
PROGRAMMABLE_BUTTON_15,
|
||||
PROGRAMMABLE_BUTTON_16,
|
||||
PROGRAMMABLE_BUTTON_17,
|
||||
PROGRAMMABLE_BUTTON_18,
|
||||
PROGRAMMABLE_BUTTON_19,
|
||||
PROGRAMMABLE_BUTTON_20,
|
||||
PROGRAMMABLE_BUTTON_21,
|
||||
PROGRAMMABLE_BUTTON_22,
|
||||
PROGRAMMABLE_BUTTON_23,
|
||||
PROGRAMMABLE_BUTTON_24,
|
||||
PROGRAMMABLE_BUTTON_25,
|
||||
PROGRAMMABLE_BUTTON_26,
|
||||
PROGRAMMABLE_BUTTON_27,
|
||||
PROGRAMMABLE_BUTTON_28,
|
||||
PROGRAMMABLE_BUTTON_29,
|
||||
PROGRAMMABLE_BUTTON_30,
|
||||
PROGRAMMABLE_BUTTON_31,
|
||||
PROGRAMMABLE_BUTTON_32,
|
||||
|
||||
// Start of custom keycode range for keyboards and keymaps - always leave at the end
|
||||
SAFE_RANGE
|
||||
};
|
||||
|
|
@ -854,3 +888,39 @@ enum quantum_keycodes {
|
|||
#define OS_TOGG ONESHOT_TOGGLE
|
||||
#define OS_ON ONESHOT_ENABLE
|
||||
#define OS_OFF ONESHOT_DISABLE
|
||||
|
||||
// Programmable Button aliases
|
||||
#define PB_1 PROGRAMMABLE_BUTTON_1
|
||||
#define PB_2 PROGRAMMABLE_BUTTON_2
|
||||
#define PB_3 PROGRAMMABLE_BUTTON_3
|
||||
#define PB_4 PROGRAMMABLE_BUTTON_4
|
||||
#define PB_5 PROGRAMMABLE_BUTTON_5
|
||||
#define PB_6 PROGRAMMABLE_BUTTON_6
|
||||
#define PB_7 PROGRAMMABLE_BUTTON_7
|
||||
#define PB_8 PROGRAMMABLE_BUTTON_8
|
||||
#define PB_9 PROGRAMMABLE_BUTTON_9
|
||||
#define PB_10 PROGRAMMABLE_BUTTON_10
|
||||
#define PB_11 PROGRAMMABLE_BUTTON_11
|
||||
#define PB_12 PROGRAMMABLE_BUTTON_12
|
||||
#define PB_13 PROGRAMMABLE_BUTTON_13
|
||||
#define PB_14 PROGRAMMABLE_BUTTON_14
|
||||
#define PB_15 PROGRAMMABLE_BUTTON_15
|
||||
#define PB_16 PROGRAMMABLE_BUTTON_16
|
||||
#define PB_17 PROGRAMMABLE_BUTTON_17
|
||||
#define PB_18 PROGRAMMABLE_BUTTON_18
|
||||
#define PB_19 PROGRAMMABLE_BUTTON_19
|
||||
#define PB_20 PROGRAMMABLE_BUTTON_20
|
||||
#define PB_21 PROGRAMMABLE_BUTTON_21
|
||||
#define PB_22 PROGRAMMABLE_BUTTON_22
|
||||
#define PB_23 PROGRAMMABLE_BUTTON_23
|
||||
#define PB_24 PROGRAMMABLE_BUTTON_24
|
||||
#define PB_25 PROGRAMMABLE_BUTTON_25
|
||||
#define PB_26 PROGRAMMABLE_BUTTON_26
|
||||
#define PB_27 PROGRAMMABLE_BUTTON_27
|
||||
#define PB_28 PROGRAMMABLE_BUTTON_28
|
||||
#define PB_29 PROGRAMMABLE_BUTTON_29
|
||||
#define PB_30 PROGRAMMABLE_BUTTON_30
|
||||
#define PB_31 PROGRAMMABLE_BUTTON_31
|
||||
#define PB_32 PROGRAMMABLE_BUTTON_32
|
||||
#define PROGRAMMABLE_BUTTON_MIN PROGRAMMABLE_BUTTON_1
|
||||
#define PROGRAMMABLE_BUTTON_MAX PROGRAMMABLE_BUTTON_32
|
||||
|
|
|
|||
|
|
@ -172,7 +172,12 @@ const rgb_matrix_driver_t rgb_matrix_driver = {
|
|||
.set_color_all = IS31FL3737_set_color_all,
|
||||
};
|
||||
# else
|
||||
static void flush(void) { IS31FL3741_update_pwm_buffers(DRIVER_ADDR_1, DRIVER_ADDR_2); }
|
||||
static void flush(void) {
|
||||
IS31FL3741_update_pwm_buffers(DRIVER_ADDR_1, 0);
|
||||
# if defined(DRIVER_ADDR_2) && (DRIVER_ADDR_2 != DRIVER_ADDR_1) // provides backward compatibility
|
||||
IS31FL3741_update_pwm_buffers(DRIVER_ADDR_2, 1);
|
||||
# endif
|
||||
}
|
||||
|
||||
const rgb_matrix_driver_t rgb_matrix_driver = {
|
||||
.init = init,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue