- espnow_link, ctrl_msg and beat_sync: the reliable link, envelopes and beat-synced timing. - ctrl_msg: accept an envelope with the trailing save byte. - patterns_frame() and espnow_link_poll() split out of their tasks, so the WebAssembly simulator can drive one frame and one link pass from a timer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
874 B
C++
25 lines
874 B
C++
/*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Messages from led-controller over ESP-NOW: envelopes (0x4C CMD / GROUP_CMD, v2 and v3 binary), v1 JSON
|
|
* objects, and the group list. They are applied as the MicroPython driver applies them (controller_messages.py).
|
|
*/
|
|
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
#include "cJSON.h"
|
|
|
|
/** @brief Load the saved group list. Call once, after NVS is up. */
|
|
void ctrl_init(void);
|
|
|
|
/** @brief Handle one controller message from mac. Runs in the ESP-NOW link task. */
|
|
void ctrl_handle(const uint8_t mac[6], const uint8_t *data, size_t len);
|
|
|
|
/** @brief This driver's ANNOUNCE packet (boot hello, with its settings) into out. Returns its length. */
|
|
size_t ctrl_build_announce(uint8_t *out, size_t cap);
|
|
|
|
/** @brief The group ids this driver is in, as a new JSON array. The caller frees it. */
|
|
cJSON *ctrl_groups_json(void);
|