vial: change number of tapdance/combos enabled based on eeprom size
This commit is contained in:
parent
14c7ba62b0
commit
e7789a9502
@ -21,10 +21,7 @@
|
||||
#include "quantum.h" // for send_string()
|
||||
#include "dynamic_keymap.h"
|
||||
#include "via.h" // for default VIA_EEPROM_ADDR_END
|
||||
|
||||
#ifdef STM32_EEPROM_ENABLE
|
||||
# include "eeprom_stm32.h"
|
||||
#endif
|
||||
#include "dynamic_keymap_eeprom.h"
|
||||
|
||||
#ifdef VIAL_ENABLE
|
||||
#include "vial.h"
|
||||
@ -34,24 +31,6 @@
|
||||
# define DYNAMIC_KEYMAP_MACRO_COUNT 16
|
||||
#endif
|
||||
|
||||
// This is the default EEPROM max address to use for dynamic keymaps.
|
||||
// The default is the ATmega32u4 EEPROM max address.
|
||||
// Explicitly override it if the keyboard uses a microcontroller with
|
||||
// more EEPROM *and* it makes sense to increase it.
|
||||
#ifndef DYNAMIC_KEYMAP_EEPROM_MAX_ADDR
|
||||
# if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__)
|
||||
# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047
|
||||
# elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__)
|
||||
# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095
|
||||
# elif defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega16U4__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATtiny85__)
|
||||
# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 511
|
||||
# elif defined(FEE_DENSITY_BYTES)
|
||||
# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR FEE_DENSITY_BYTES-1
|
||||
# else
|
||||
# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 1023
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Due to usage of uint16_t check for max 65535
|
||||
#if DYNAMIC_KEYMAP_EEPROM_MAX_ADDR > 65535
|
||||
# error DYNAMIC_KEYMAP_EEPROM_MAX_ADDR must be less than 65536
|
||||
|
@ -18,6 +18,10 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef VIAL_ENABLE
|
||||
#include "vial.h"
|
||||
#endif
|
||||
|
||||
#ifndef DYNAMIC_KEYMAP_LAYER_COUNT
|
||||
# define DYNAMIC_KEYMAP_LAYER_COUNT 4
|
||||
#endif
|
||||
|
25
quantum/dynamic_keymap_eeprom.h
Normal file
25
quantum/dynamic_keymap_eeprom.h
Normal file
@ -0,0 +1,25 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef STM32_EEPROM_ENABLE
|
||||
# include "eeprom_stm32.h"
|
||||
#endif
|
||||
|
||||
// This is the default EEPROM max address to use for dynamic keymaps.
|
||||
// The default is the ATmega32u4 EEPROM max address.
|
||||
// Explicitly override it if the keyboard uses a microcontroller with
|
||||
// more EEPROM *and* it makes sense to increase it.
|
||||
#ifndef DYNAMIC_KEYMAP_EEPROM_MAX_ADDR
|
||||
# if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__)
|
||||
# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047
|
||||
# elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__)
|
||||
# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095
|
||||
# elif defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega16U4__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATtiny85__)
|
||||
# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 511
|
||||
# elif defined(FEE_DENSITY_BYTES)
|
||||
# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR FEE_DENSITY_BYTES-1
|
||||
# else
|
||||
# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 1023
|
||||
# endif
|
||||
#endif
|
@ -19,6 +19,8 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "dynamic_keymap_eeprom.h"
|
||||
|
||||
#define VIAL_PROTOCOL_VERSION ((uint32_t)0x00000004)
|
||||
#define VIAL_RAW_EPSIZE 32
|
||||
|
||||
@ -66,7 +68,15 @@ enum {
|
||||
#define VIAL_TAP_DANCE_ENABLE
|
||||
|
||||
#ifndef VIAL_TAP_DANCE_ENTRIES
|
||||
#define VIAL_TAP_DANCE_ENTRIES 16
|
||||
#if DYNAMIC_KEYMAP_EEPROM_MAX_ADDR > 4000
|
||||
#define VIAL_TAP_DANCE_ENTRIES 32
|
||||
#elif DYNAMIC_KEYMAP_EEPROM_MAX_ADDR > 2000
|
||||
#define VIAL_TAP_DANCE_ENTRIES 16
|
||||
#elif DYNAMIC_KEYMAP_EEPROM_MAX_ADDR > 1000
|
||||
#define VIAL_TAP_DANCE_ENTRIES 8
|
||||
#else
|
||||
#define VIAL_TAP_DANCE_ENTRIES 4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
@ -87,7 +97,15 @@ _Static_assert(sizeof(vial_tap_dance_entry_t) == 10, "Unexpected size of the via
|
||||
#define VIAL_COMBO_ENABLE
|
||||
|
||||
#ifndef VIAL_COMBO_ENTRIES
|
||||
#define VIAL_COMBO_ENTRIES 16
|
||||
#if DYNAMIC_KEYMAP_EEPROM_MAX_ADDR > 4000
|
||||
#define VIAL_COMBO_ENTRIES 32
|
||||
#elif DYNAMIC_KEYMAP_EEPROM_MAX_ADDR > 2000
|
||||
#define VIAL_COMBO_ENTRIES 16
|
||||
#elif DYNAMIC_KEYMAP_EEPROM_MAX_ADDR > 1000
|
||||
#define VIAL_COMBO_ENTRIES 8
|
||||
#else
|
||||
#define VIAL_COMBO_ENTRIES 4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
@ -104,5 +122,6 @@ _Static_assert(sizeof(vial_combo_entry_t) == 10, "Unexpected size of the vial_co
|
||||
#define COMBO_COUNT VIAL_COMBO_ENTRIES
|
||||
|
||||
#else
|
||||
#undef VIAL_COMBO_ENTRIES
|
||||
#define VIAL_COMBO_ENTRIES 0
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user