#pragma once
#include "tmk_core/common/eeconfig.h"
#ifndef VIA_EEPROM_MAGIC_ADDR
# define VIA_EEPROM_MAGIC_ADDR (EECONFIG_SIZE)
#endif
#define VIA_EEPROM_LAYOUT_OPTIONS_ADDR (VIA_EEPROM_MAGIC_ADDR + 3)
#ifndef VIA_EEPROM_LAYOUT_OPTIONS_SIZE
# define VIA_EEPROM_LAYOUT_OPTIONS_SIZE 1
#endif
#ifndef VIA_EEPROM_LAYOUT_OPTIONS_DEFAULT
# define VIA_EEPROM_LAYOUT_OPTIONS_DEFAULT 0x00000000
#endif
#define VIA_EEPROM_CUSTOM_CONFIG_ADDR (VIA_EEPROM_LAYOUT_OPTIONS_ADDR + VIA_EEPROM_LAYOUT_OPTIONS_SIZE)
#ifndef VIA_EEPROM_CUSTOM_CONFIG_SIZE
# define VIA_EEPROM_CUSTOM_CONFIG_SIZE 0
#endif
#define VIA_PROTOCOL_VERSION 0x0009
enum via_command_id {
id_get_protocol_version = 0x01, id_get_keyboard_value = 0x02,
id_set_keyboard_value = 0x03,
id_dynamic_keymap_get_keycode = 0x04,
id_dynamic_keymap_set_keycode = 0x05,
id_dynamic_keymap_reset = 0x06,
id_lighting_set_value = 0x07,
id_lighting_get_value = 0x08,
id_lighting_save = 0x09,
id_eeprom_reset = 0x0A,
id_bootloader_jump = 0x0B,
id_dynamic_keymap_macro_get_count = 0x0C,
id_dynamic_keymap_macro_get_buffer_size = 0x0D,
id_dynamic_keymap_macro_get_buffer = 0x0E,
id_dynamic_keymap_macro_set_buffer = 0x0F,
id_dynamic_keymap_macro_reset = 0x10,
id_dynamic_keymap_get_layer_count = 0x11,
id_dynamic_keymap_get_buffer = 0x12,
id_dynamic_keymap_set_buffer = 0x13,
id_unhandled = 0xFF,
};
enum via_keyboard_value_id {
id_uptime = 0x01, id_layout_options = 0x02,
id_switch_matrix_state = 0x03
};
enum via_lighting_value {
id_qmk_backlight_brightness = 0x09,
id_qmk_backlight_effect = 0x0A,
id_qmk_rgblight_brightness = 0x80,
id_qmk_rgblight_effect = 0x81,
id_qmk_rgblight_effect_speed = 0x82,
id_qmk_rgblight_color = 0x83,
};
enum via_keycodes {
FN_MO13 = 0x5F10,
FN_MO23,
MACRO00,
MACRO01,
MACRO02,
MACRO03,
MACRO04,
MACRO05,
MACRO06,
MACRO07,
MACRO08,
MACRO09,
MACRO10,
MACRO11,
MACRO12,
MACRO13,
MACRO14,
MACRO15,
};
enum user_keycodes {
USER00 = 0x5F80,
USER01,
USER02,
USER03,
USER04,
USER05,
USER06,
USER07,
USER08,
USER09,
USER10,
USER11,
USER12,
USER13,
USER14,
USER15,
};
bool via_eeprom_is_valid(void);
void via_eeprom_set_valid(bool valid);
void via_eeprom_reset(void);
void via_init(void);
uint32_t via_get_layout_options(void);
void via_set_layout_options(uint32_t value);
bool process_record_via(uint16_t keycode, keyrecord_t *record);