mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-10-01 06:19:16 +02:00
Merge branch 'master' of github.com:qmk/qmk_firmware into peasy
This commit is contained in:
@@ -38,9 +38,15 @@ uint8_t leader_sequence_size = 0;
|
||||
bool process_leader(uint16_t keycode, keyrecord_t *record) {
|
||||
// Leader key set-up
|
||||
if (record->event.pressed) {
|
||||
#ifdef LEADER_PER_KEY_TIMING
|
||||
leader_time = timer_read();
|
||||
#endif
|
||||
if (!leading && keycode == KC_LEAD) {
|
||||
leader_start();
|
||||
leading = true;
|
||||
#ifndef LEADER_PER_KEY_TIMING
|
||||
leader_time = timer_read();
|
||||
#endif
|
||||
leader_time = timer_read();
|
||||
leader_sequence_size = 0;
|
||||
leader_sequence[0] = 0;
|
||||
|
||||
@@ -132,6 +132,14 @@ void unregister_code16 (uint16_t code) {
|
||||
}
|
||||
}
|
||||
|
||||
void tap_code16(uint16_t code) {
|
||||
register_code16(code);
|
||||
#if TAP_CODE_DELAY > 0
|
||||
wait_ms(TAP_CODE_DELAY);
|
||||
#endif
|
||||
unregister_code16(code);
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
bool process_action_kb(keyrecord_t *record) {
|
||||
return true;
|
||||
|
||||
+1
-1
@@ -243,7 +243,7 @@ void shutdown_user(void);
|
||||
|
||||
void register_code16(uint16_t code);
|
||||
void unregister_code16(uint16_t code);
|
||||
inline void tap_code16(uint16_t code) { register_code16(code); unregister_code16(code); }
|
||||
void tap_code16(uint16_t code);
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
void backlight_init_ports(void);
|
||||
|
||||
+64
-16
@@ -205,21 +205,33 @@ void rgblight_decrease(void) {
|
||||
}
|
||||
rgblight_mode(mode);
|
||||
}
|
||||
void rgblight_step(void) {
|
||||
void rgblight_step_helper(bool write_to_eeprom) {
|
||||
uint8_t mode = 0;
|
||||
mode = rgblight_config.mode + 1;
|
||||
if (mode > RGBLIGHT_MODES) {
|
||||
mode = 1;
|
||||
}
|
||||
rgblight_mode(mode);
|
||||
rgblight_mode_eeprom_helper(mode, write_to_eeprom);
|
||||
}
|
||||
void rgblight_step_reverse(void) {
|
||||
void rgblight_step_noeeprom(void) {
|
||||
rgblight_step_helper(false);
|
||||
}
|
||||
void rgblight_step(void) {
|
||||
rgblight_step_helper(true);
|
||||
}
|
||||
void rgblight_step_reverse_helper(bool write_to_eeprom) {
|
||||
uint8_t mode = 0;
|
||||
mode = rgblight_config.mode - 1;
|
||||
if (mode < 1) {
|
||||
mode = RGBLIGHT_MODES;
|
||||
}
|
||||
rgblight_mode(mode);
|
||||
rgblight_mode_eeprom_helper(mode, write_to_eeprom);
|
||||
}
|
||||
void rgblight_step_reverse_noeeprom(void) {
|
||||
rgblight_step_reverse_helper(false);
|
||||
}
|
||||
void rgblight_step_reverse(void) {
|
||||
rgblight_step_reverse_helper(true);
|
||||
}
|
||||
|
||||
uint32_t rgblight_get_mode(void) {
|
||||
@@ -337,55 +349,91 @@ static uint8_t decrement( uint8_t value, uint8_t step, uint8_t min, uint8_t max
|
||||
return MIN( MAX( new_value, min ), max );
|
||||
}
|
||||
|
||||
void rgblight_increase_hue(void) {
|
||||
void rgblight_increase_hue_helper(bool write_to_eeprom) {
|
||||
uint16_t hue;
|
||||
hue = (rgblight_config.hue+RGBLIGHT_HUE_STEP) % 360;
|
||||
rgblight_sethsv(hue, rgblight_config.sat, rgblight_config.val);
|
||||
rgblight_sethsv_eeprom_helper(hue, rgblight_config.sat, rgblight_config.val, write_to_eeprom);
|
||||
}
|
||||
void rgblight_decrease_hue(void) {
|
||||
void rgblight_increase_hue_noeeprom(void) {
|
||||
rgblight_increase_hue_helper(false);
|
||||
}
|
||||
void rgblight_increase_hue(void) {
|
||||
rgblight_increase_hue_helper(true);
|
||||
}
|
||||
void rgblight_decrease_hue_helper(bool write_to_eeprom) {
|
||||
uint16_t hue;
|
||||
if (rgblight_config.hue-RGBLIGHT_HUE_STEP < 0) {
|
||||
hue = (rgblight_config.hue + 360 - RGBLIGHT_HUE_STEP) % 360;
|
||||
} else {
|
||||
hue = (rgblight_config.hue - RGBLIGHT_HUE_STEP) % 360;
|
||||
}
|
||||
rgblight_sethsv(hue, rgblight_config.sat, rgblight_config.val);
|
||||
rgblight_sethsv_eeprom_helper(hue, rgblight_config.sat, rgblight_config.val, write_to_eeprom);
|
||||
}
|
||||
void rgblight_increase_sat(void) {
|
||||
void rgblight_decrease_hue_noeeprom(void) {
|
||||
rgblight_decrease_hue_helper(false);
|
||||
}
|
||||
void rgblight_decrease_hue(void) {
|
||||
rgblight_decrease_hue_helper(true);
|
||||
}
|
||||
void rgblight_increase_sat_helper(bool write_to_eeprom) {
|
||||
uint8_t sat;
|
||||
if (rgblight_config.sat + RGBLIGHT_SAT_STEP > 255) {
|
||||
sat = 255;
|
||||
} else {
|
||||
sat = rgblight_config.sat + RGBLIGHT_SAT_STEP;
|
||||
}
|
||||
rgblight_sethsv(rgblight_config.hue, sat, rgblight_config.val);
|
||||
rgblight_sethsv_eeprom_helper(rgblight_config.hue, sat, rgblight_config.val, write_to_eeprom);
|
||||
}
|
||||
void rgblight_decrease_sat(void) {
|
||||
void rgblight_increase_sat_noeeprom(void) {
|
||||
rgblight_increase_sat_helper(false);
|
||||
}
|
||||
void rgblight_increase_sat(void) {
|
||||
rgblight_increase_sat_helper(true);
|
||||
}
|
||||
void rgblight_decrease_sat_helper(bool write_to_eeprom) {
|
||||
uint8_t sat;
|
||||
if (rgblight_config.sat - RGBLIGHT_SAT_STEP < 0) {
|
||||
sat = 0;
|
||||
} else {
|
||||
sat = rgblight_config.sat - RGBLIGHT_SAT_STEP;
|
||||
}
|
||||
rgblight_sethsv(rgblight_config.hue, sat, rgblight_config.val);
|
||||
rgblight_sethsv_eeprom_helper(rgblight_config.hue, sat, rgblight_config.val, write_to_eeprom);
|
||||
}
|
||||
void rgblight_increase_val(void) {
|
||||
void rgblight_decrease_sat_noeeprom(void) {
|
||||
rgblight_decrease_sat_helper(false);
|
||||
}
|
||||
void rgblight_decrease_sat(void) {
|
||||
rgblight_decrease_sat_helper(true);
|
||||
}
|
||||
void rgblight_increase_val_helper(bool write_to_eeprom) {
|
||||
uint8_t val;
|
||||
if (rgblight_config.val + RGBLIGHT_VAL_STEP > RGBLIGHT_LIMIT_VAL) {
|
||||
val = RGBLIGHT_LIMIT_VAL;
|
||||
} else {
|
||||
val = rgblight_config.val + RGBLIGHT_VAL_STEP;
|
||||
}
|
||||
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val);
|
||||
rgblight_sethsv_eeprom_helper(rgblight_config.hue, rgblight_config.sat, val, write_to_eeprom);
|
||||
}
|
||||
void rgblight_decrease_val(void) {
|
||||
void rgblight_increase_val_noeeprom(void) {
|
||||
rgblight_increase_val_helper(false);
|
||||
}
|
||||
void rgblight_increase_val(void) {
|
||||
rgblight_increase_val_helper(true);
|
||||
}
|
||||
void rgblight_decrease_val_helper(bool write_to_eeprom) {
|
||||
uint8_t val;
|
||||
if (rgblight_config.val - RGBLIGHT_VAL_STEP < 0) {
|
||||
val = 0;
|
||||
} else {
|
||||
val = rgblight_config.val - RGBLIGHT_VAL_STEP;
|
||||
}
|
||||
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val);
|
||||
rgblight_sethsv_eeprom_helper(rgblight_config.hue, rgblight_config.sat, val, write_to_eeprom);
|
||||
}
|
||||
void rgblight_decrease_val_noeeprom(void) {
|
||||
rgblight_decrease_val_helper(false);
|
||||
}
|
||||
void rgblight_decrease_val(void) {
|
||||
rgblight_decrease_val_helper(true);
|
||||
}
|
||||
void rgblight_increase_speed(void) {
|
||||
rgblight_config.speed = increment( rgblight_config.speed, 1, 0, 3 );
|
||||
|
||||
@@ -203,6 +203,14 @@ void rgblight_mode_noeeprom(uint8_t mode);
|
||||
void rgblight_toggle_noeeprom(void);
|
||||
void rgblight_enable_noeeprom(void);
|
||||
void rgblight_disable_noeeprom(void);
|
||||
void rgblight_step_noeeprom(void);
|
||||
void rgblight_step_reverse_noeeprom(void);
|
||||
void rgblight_increase_hue_noeeprom(void);
|
||||
void rgblight_decrease_hue_noeeprom(void);
|
||||
void rgblight_increase_sat_noeeprom(void);
|
||||
void rgblight_decrease_sat_noeeprom(void);
|
||||
void rgblight_increase_val_noeeprom(void);
|
||||
void rgblight_decrease_val_noeeprom(void);
|
||||
|
||||
void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom);
|
||||
void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom);
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include "i2c.h"
|
||||
#include "split_flags.h"
|
||||
|
||||
#if defined(USE_I2C) || defined(EH)
|
||||
|
||||
// Limits the amount of we wait for any one i2c transaction.
|
||||
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
|
||||
// 9 bits, a single transaction will take around 90μs to complete.
|
||||
@@ -184,4 +182,3 @@ ISR(TWI_vect) {
|
||||
// Reset everything, so we are ready for the next TWI interrupt
|
||||
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,56 @@
|
||||
#include <stdbool.h>
|
||||
#include "serial.h"
|
||||
|
||||
#ifndef USE_I2C
|
||||
#ifdef SOFT_SERIAL_PIN
|
||||
|
||||
#ifdef __AVR_ATmega32U4__
|
||||
// if using ATmega32U4 I2C, can not use PD0 and PD1 in soft serial.
|
||||
#ifdef USE_AVR_I2C
|
||||
#if SOFT_SERIAL_PIN == D0 || SOFT_SERIAL_PIN == D1
|
||||
#error Using ATmega32U4 I2C, so can not use PD0, PD1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if SOFT_SERIAL_PIN >= D0 && SOFT_SERIAL_PIN <= D3
|
||||
#define SERIAL_PIN_DDR DDRD
|
||||
#define SERIAL_PIN_PORT PORTD
|
||||
#define SERIAL_PIN_INPUT PIND
|
||||
#if SOFT_SERIAL_PIN == D0
|
||||
#define SERIAL_PIN_MASK _BV(PD0)
|
||||
#define EIMSK_BIT _BV(INT0)
|
||||
#define EICRx_BIT (~(_BV(ISC00) | _BV(ISC01)))
|
||||
#define SERIAL_PIN_INTERRUPT INT0_vect
|
||||
#elif SOFT_SERIAL_PIN == D1
|
||||
#define SERIAL_PIN_MASK _BV(PD1)
|
||||
#define EIMSK_BIT _BV(INT1)
|
||||
#define EICRx_BIT (~(_BV(ISC10) | _BV(ISC11)))
|
||||
#define SERIAL_PIN_INTERRUPT INT1_vect
|
||||
#elif SOFT_SERIAL_PIN == D2
|
||||
#define SERIAL_PIN_MASK _BV(PD2)
|
||||
#define EIMSK_BIT _BV(INT2)
|
||||
#define EICRx_BIT (~(_BV(ISC20) | _BV(ISC21)))
|
||||
#define SERIAL_PIN_INTERRUPT INT2_vect
|
||||
#elif SOFT_SERIAL_PIN == D3
|
||||
#define SERIAL_PIN_MASK _BV(PD3)
|
||||
#define EIMSK_BIT _BV(INT3)
|
||||
#define EICRx_BIT (~(_BV(ISC30) | _BV(ISC31)))
|
||||
#define SERIAL_PIN_INTERRUPT INT3_vect
|
||||
#endif
|
||||
#elif SOFT_SERIAL_PIN == E6
|
||||
#define SERIAL_PIN_DDR DDRE
|
||||
#define SERIAL_PIN_PORT PORTE
|
||||
#define SERIAL_PIN_INPUT PINE
|
||||
#define SERIAL_PIN_MASK _BV(PE6)
|
||||
#define EIMSK_BIT _BV(INT6)
|
||||
#define EICRx_BIT (~(_BV(ISC60) | _BV(ISC61)))
|
||||
#define SERIAL_PIN_INTERRUPT INT6_vect
|
||||
#else
|
||||
#error invalid SOFT_SERIAL_PIN value
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error serial.c now support ATmega32U4 only
|
||||
#endif
|
||||
|
||||
// Serial pulse period in microseconds. Its probably a bad idea to lower this
|
||||
// value.
|
||||
@@ -225,4 +274,4 @@ int serial_update_buffers(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* SOFT_SERIAL_PIN */
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
#ifndef MY_SERIAL_H
|
||||
#define MY_SERIAL_H
|
||||
|
||||
#include "config.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
/* TODO: some defines for interrupt setup */
|
||||
#define SERIAL_PIN_DDR DDRD
|
||||
#define SERIAL_PIN_PORT PORTD
|
||||
#define SERIAL_PIN_INPUT PIND
|
||||
#define SERIAL_PIN_MASK _BV(PD0)
|
||||
#define SERIAL_PIN_INTERRUPT INT0_vect
|
||||
|
||||
#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
|
||||
#define SERIAL_MASTER_BUFFER_LENGTH 1
|
||||
|
||||
// Address location defines
|
||||
#define SERIAL_BACKLIT_START 0x00
|
||||
// /////////////////////////////////////////////////////////////////
|
||||
// Need Soft Serial defines in config.h
|
||||
// /////////////////////////////////////////////////////////////////
|
||||
// ex.
|
||||
// /* Configuration of lower interface with the lower layer(hardware) of serial.c */
|
||||
// #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6
|
||||
//
|
||||
// /* Configuration of upper interface with the upper layer of serial.c */
|
||||
// #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
|
||||
// #define SERIAL_MASTER_BUFFER_LENGTH 1
|
||||
|
||||
// Buffers for master - slave communication
|
||||
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/* serial.h backward compatibility */
|
||||
|
||||
// #ifndef SOFT_SERIAL_PIN
|
||||
// #define SOFT_SERIAL_PIN D0
|
||||
// #endif
|
||||
|
||||
#ifndef SERIAL_SLAVE_BUFFER_LENGTH
|
||||
#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
|
||||
#define SERIAL_MASTER_BUFFER_LENGTH 1
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
#include <stdlib.h>
|
||||
#include "eeconfig.h"
|
||||
|
||||
// backlight level store index in serial_master_buffer[] for slave to read
|
||||
#define SERIAL_BACKLIT_START 0x00
|
||||
|
||||
#define SLAVE_I2C_ADDRESS 0x32
|
||||
|
||||
extern volatile bool isLeftHand;
|
||||
|
||||
@@ -48,6 +48,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
|
||||
/*
|
||||
* Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
|
||||
*/
|
||||
#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
|
||||
|
||||
// #define BACKLIGHT_PIN B7
|
||||
// #define BACKLIGHT_BREATHING
|
||||
// #define BACKLIGHT_LEVELS 3
|
||||
|
||||
Reference in New Issue
Block a user