mirror of
https://github.com/zmkfirmware/zmk.git
synced 2026-03-31 02:15:25 -05:00
feat(studio): Initial RPC infrastructure and subsystems.
* UART and BLE/GATT transports for a protobuf encoded RPC request/response protocol. * Custom framing protocol is used to frame a give message. * Requests/responses are divided into major "subsystems" which handle requests and create response messages. * Notification support, including mapping local events to RPC notifications by a given subsystem. * Meta responses for "no response" and "unlock needed". * Initial basic lock state support in a new core section, and allow specifying if a given RPC callback requires unlocked state or not. * Add behavior subsystem with full metadata support and examples of using callback to serialize a repeated field without extra stack space needed. Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
This commit is contained in:
committed by
Pete Johanson
parent
ea64fcaf71
commit
feda96eb40
31
app/src/studio/msg_framing.h
Normal file
31
app/src/studio/msg_framing.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2024 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
|
||||
enum studio_framing_state {
|
||||
FRAMING_STATE_IDLE,
|
||||
FRAMING_STATE_AWAITING_DATA,
|
||||
FRAMING_STATE_ESCAPED,
|
||||
FRAMING_STATE_ERR,
|
||||
FRAMING_STATE_EOF,
|
||||
};
|
||||
|
||||
#define FRAMING_SOF 0xAB
|
||||
#define FRAMING_ESC 0xAC
|
||||
#define FRAMING_EOF 0xAD
|
||||
|
||||
/**
|
||||
* @brief Process an incoming byte from a frame. Will possibly update the framing state depending on
|
||||
* what data is received.
|
||||
* @retval true if data is a non-framing byte, and is real data to be handled by the upper level
|
||||
* logic.
|
||||
* @retval false if data is a framing byte, and should be ignored. Also indicates the framing state
|
||||
* has been updated.
|
||||
*/
|
||||
bool studio_framing_process_byte(enum studio_framing_state *frame_state, uint8_t data);
|
||||
Reference in New Issue
Block a user