2020-10-14 15:16:42 -04:00
|
|
|
/* Copyright 2020 Ilya Zhuravlev
|
|
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
|
2020-10-18 14:36:45 -04:00
|
|
|
#include <inttypes.h>
|
2020-12-06 19:23:57 -05:00
|
|
|
#include <stdbool.h>
|
2020-10-18 14:36:45 -04:00
|
|
|
|
2021-07-02 23:19:41 -04:00
|
|
|
#define VIAL_PROTOCOL_VERSION ((uint32_t)0x00000004)
|
2020-10-18 14:36:45 -04:00
|
|
|
|
2020-10-14 15:16:42 -04:00
|
|
|
void vial_handle_cmd(uint8_t *data, uint8_t length);
|
2020-12-06 19:23:57 -05:00
|
|
|
|
|
|
|
|
#ifdef VIAL_ENCODERS_ENABLE
|
2021-06-26 16:22:02 -04:00
|
|
|
bool vial_encoder_update(uint8_t index, bool clockwise);
|
2020-12-06 19:23:57 -05:00
|
|
|
#endif
|
2020-12-27 08:03:10 -05:00
|
|
|
|
|
|
|
|
extern int vial_unlocked;
|
|
|
|
|
extern int vial_unlock_in_progress;
|
2020-12-29 15:36:12 -05:00
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
vial_get_keyboard_id = 0x00,
|
|
|
|
|
vial_get_size = 0x01,
|
|
|
|
|
vial_get_def = 0x02,
|
|
|
|
|
vial_get_encoder = 0x03,
|
|
|
|
|
vial_set_encoder = 0x04,
|
2020-12-29 19:30:29 -05:00
|
|
|
vial_get_unlock_status = 0x05,
|
2020-12-29 15:36:12 -05:00
|
|
|
vial_unlock_start = 0x06,
|
|
|
|
|
vial_unlock_poll = 0x07,
|
|
|
|
|
vial_lock = 0x08,
|
2021-06-29 19:43:11 -04:00
|
|
|
vial_qmk_settings_query = 0x09,
|
|
|
|
|
vial_qmk_settings_get = 0x0A,
|
|
|
|
|
vial_qmk_settings_set = 0x0B,
|
2021-07-01 15:00:12 -04:00
|
|
|
vial_qmk_settings_reset = 0x0C,
|
2020-12-29 15:36:12 -05:00
|
|
|
};
|
2021-01-03 09:12:16 -05:00
|
|
|
|
|
|
|
|
/* Fake encoder position in keyboard matrix, can't use 255 as that is immediately rejected by IS_NOEVENT */
|
|
|
|
|
#define VIAL_ENCODER_MATRIX_MAGIC 254
|