aboutsummaryrefslogtreecommitdiff
path: root/quantum/via.h
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/via.h')
-rw-r--r--quantum/via.h61
1 files changed, 27 insertions, 34 deletions
diff --git a/quantum/via.h b/quantum/via.h
index f9a8017b2..98f8dea8c 100644
--- a/quantum/via.h
+++ b/quantum/via.h
@@ -16,7 +16,7 @@
16 16
17#pragma once 17#pragma once
18 18
19#include <tmk_core/common/eeconfig.h> // for EECONFIG_SIZE 19#include <tmk_core/common/eeconfig.h> // for EECONFIG_SIZE
20 20
21// Keyboard level code can change where VIA stores the magic. 21// Keyboard level code can change where VIA stores the magic.
22// The magic is the build date YYMMDD encoded as BCD in 3 bytes, 22// The magic is the build date YYMMDD encoded as BCD in 3 bytes,
@@ -25,34 +25,33 @@
25// The only reason this is important is in case EEPROM usage changes 25// The only reason this is important is in case EEPROM usage changes
26// and the EEPROM was not explicitly reset by bootmagic lite. 26// and the EEPROM was not explicitly reset by bootmagic lite.
27#ifndef VIA_EEPROM_MAGIC_ADDR 27#ifndef VIA_EEPROM_MAGIC_ADDR
28# define VIA_EEPROM_MAGIC_ADDR (EECONFIG_SIZE) 28# define VIA_EEPROM_MAGIC_ADDR (EECONFIG_SIZE)
29#endif 29#endif
30 30
31#define VIA_EEPROM_LAYOUT_OPTIONS_ADDR (VIA_EEPROM_MAGIC_ADDR+3) 31#define VIA_EEPROM_LAYOUT_OPTIONS_ADDR (VIA_EEPROM_MAGIC_ADDR + 3)
32 32
33// Changing the layout options size after release will invalidate EEPROM, 33// Changing the layout options size after release will invalidate EEPROM,
34// but this is something that should be set correctly on initial implementation. 34// but this is something that should be set correctly on initial implementation.
35// 1 byte is enough for most uses (i.e. 8 binary states, or 6 binary + 1 ternary/quaternary ) 35// 1 byte is enough for most uses (i.e. 8 binary states, or 6 binary + 1 ternary/quaternary )
36#ifndef VIA_EEPROM_LAYOUT_OPTIONS_SIZE 36#ifndef VIA_EEPROM_LAYOUT_OPTIONS_SIZE
37# define VIA_EEPROM_LAYOUT_OPTIONS_SIZE 1 37# define VIA_EEPROM_LAYOUT_OPTIONS_SIZE 1
38#endif 38#endif
39 39
40// The end of the EEPROM memory used by VIA 40// The end of the EEPROM memory used by VIA
41// By default, dynamic keymaps will start at this if there is no 41// By default, dynamic keymaps will start at this if there is no
42// custom config 42// custom config
43#define VIA_EEPROM_CUSTOM_CONFIG_ADDR (VIA_EEPROM_LAYOUT_OPTIONS_ADDR+VIA_EEPROM_LAYOUT_OPTIONS_SIZE) 43#define VIA_EEPROM_CUSTOM_CONFIG_ADDR (VIA_EEPROM_LAYOUT_OPTIONS_ADDR + VIA_EEPROM_LAYOUT_OPTIONS_SIZE)
44 44
45#ifndef VIA_EEPROM_CUSTOM_CONFIG_SIZE 45#ifndef VIA_EEPROM_CUSTOM_CONFIG_SIZE
46# define VIA_EEPROM_CUSTOM_CONFIG_SIZE 0 46# define VIA_EEPROM_CUSTOM_CONFIG_SIZE 0
47#endif 47#endif
48 48
49// This is changed only when the command IDs change, 49// This is changed only when the command IDs change,
50// so VIA Configurator can detect compatible firmware. 50// so VIA Configurator can detect compatible firmware.
51#define VIA_PROTOCOL_VERSION 0x0009 51#define VIA_PROTOCOL_VERSION 0x0009
52 52
53enum via_command_id 53enum via_command_id {
54{ 54 id_get_protocol_version = 0x01, // always 0x01
55 id_get_protocol_version = 0x01, // always 0x01
56 id_get_keyboard_value, 55 id_get_keyboard_value,
57 id_set_keyboard_value, 56 id_set_keyboard_value,
58 id_dynamic_keymap_get_keycode, 57 id_dynamic_keymap_get_keycode,
@@ -74,12 +73,7 @@ enum via_command_id
74 id_unhandled = 0xFF, 73 id_unhandled = 0xFF,
75}; 74};
76 75
77enum via_keyboard_value_id 76enum via_keyboard_value_id { id_uptime = 0x01, id_layout_options, id_switch_matrix_state };
78{
79 id_uptime = 0x01,
80 id_layout_options,
81 id_switch_matrix_state
82};
83 77
84// Can't use SAFE_RANGE here, it might change if someone adds 78// Can't use SAFE_RANGE here, it might change if someone adds
85// new values to enum quantum_keycodes. 79// new values to enum quantum_keycodes.
@@ -108,22 +102,22 @@ enum via_keycodes {
108}; 102};
109 103
110enum user_keycodes { 104enum user_keycodes {
111 USER00 = 0x5F80, 105 USER00 = 0x5F80,
112 USER01, 106 USER01,
113 USER02, 107 USER02,
114 USER03, 108 USER03,
115 USER04, 109 USER04,
116 USER05, 110 USER05,
117 USER06, 111 USER06,
118 USER07, 112 USER07,
119 USER08, 113 USER08,
120 USER09, 114 USER09,
121 USER10, 115 USER10,
122 USER11, 116 USER11,
123 USER12, 117 USER12,
124 USER13, 118 USER13,
125 USER14, 119 USER14,
126 USER15, 120 USER15,
127}; 121};
128 122
129// Can be called in an overriding via_init_kb() to test if keyboard level code usage of 123// Can be called in an overriding via_init_kb() to test if keyboard level code usage of
@@ -144,8 +138,7 @@ void via_init(void);
144 138
145// Used by VIA to store and retrieve the layout options. 139// Used by VIA to store and retrieve the layout options.
146uint32_t via_get_layout_options(void); 140uint32_t via_get_layout_options(void);
147void via_set_layout_options(uint32_t value); 141void via_set_layout_options(uint32_t value);
148 142
149// Called by QMK core to process VIA-specific keycodes. 143// Called by QMK core to process VIA-specific keycodes.
150bool process_record_via(uint16_t keycode, keyrecord_t *record); 144bool process_record_via(uint16_t keycode, keyrecord_t *record);
151