Add BLE host transport selectable via DIP8 alongside UART.
Master can speak the same framed protobuf protocol over NimBLE or UART; goTool gains -ble, ble-rtt, and ble-stream timing checks for ESP-NOW coexistence. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#ifndef HOST_TRANSPORT_H
|
||||
#define HOST_TRANSPORT_H
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/** TX callback: send a complete framed packet (0xAA … 0xCC). */
|
||||
typedef esp_err_t (*host_tx_fn_t)(const uint8_t *frame, size_t frame_len);
|
||||
|
||||
/** Set the active host TX backend (UART write or BLE notify). */
|
||||
void host_transport_set_tx(host_tx_fn_t tx_fn);
|
||||
|
||||
/** Bind the shared cmd_queue used by uart_enqueue_packet / host RX. */
|
||||
void host_transport_set_cmd_queue(QueueHandle_t cmd_queue);
|
||||
|
||||
QueueHandle_t host_transport_cmd_queue(void);
|
||||
|
||||
/**
|
||||
* Build AA|len|payload|xor|CC and send via the registered TX backend.
|
||||
* Same semantics as uart_send_framed.
|
||||
*/
|
||||
esp_err_t host_send_framed(const uint8_t *payload, size_t len);
|
||||
|
||||
/**
|
||||
* Feed raw host RX bytes into the shared frame parser and enqueue complete
|
||||
* packets onto the cmd_queue.
|
||||
*/
|
||||
void host_rx_bytes(const uint8_t *data, size_t len);
|
||||
|
||||
/** Enqueue a completed uart_packet_t (payload[0]=msg type). */
|
||||
bool host_enqueue_packet(const uint8_t *payload, uint8_t len);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user