File syn_datalog.h¶
FileList > log > syn_datalog.h
Go to the source code of this file
High-speed binary telemetry logger. More...
#include "../common/syn_defs.h"#include "../util/syn_ringbuf.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_DataLog Data logger control block — ring buffer + drop counter. |
| struct | SYN_DataLogHeader Telemetry frame header. |
Public Functions¶
| Type | Name |
|---|---|
| void | syn_datalog_init (SYN_DataLog * log, uint8_t * buf, size_t size) Initialize a datalogger. |
| size_t | syn_datalog_read (SYN_DataLog * log, uint16_t * out_id, void * out_data, size_t max_len) Read the next telemetry frame from the logger. |
| bool | syn_datalog_write (SYN_DataLog * log, uint16_t id, const void * data, uint16_t len) Write a telemetry frame to the logger. |
Public Static Functions¶
| Type | Name |
|---|---|
| size_t | syn_datalog_available (const SYN_DataLog * log) Get number of bytes available for reading. |
| uint32_t | syn_datalog_get_dropped (const SYN_DataLog * log) Get number of dropped frames. |
| void | syn_datalog_reset (SYN_DataLog * log) Reset the datalog, discarding all frames. |
Detailed Description¶
Captures arbitrary structs or data frames into a static ringbuffer. Useful for high-speed PID tuning, state recording, or telemetry streams.
Uses a zero-allocation, lock-free ringbuffer backend. Data is prefixed with a 16-bit ID and 16-bit length to allow demultiplexing on the host.
Public Functions Documentation¶
function syn_datalog_init¶
Initialize a datalogger.
Parameters:
logPointer to logger instance.bufCaller-provided backing array.sizeSize of backing array in bytes.
function syn_datalog_read¶
Read the next telemetry frame from the logger.
Parameters:
logPointer to logger instance.out_id[out] Stream ID of read frame.out_data[out] Buffer to store payload.max_lenMaximum size of out_data.
Returns:
Number of payload bytes read, or 0 if empty or buffer too small.
function syn_datalog_write¶
Write a telemetry frame to the logger.
Parameters:
logPointer to logger instance.idStream ID.dataPayload to write.lenPayload size in bytes.
Returns:
true if written, false if buffer is full (frame dropped).
Public Static Functions Documentation¶
function syn_datalog_available¶
Get number of bytes available for reading.
Parameters:
logLogger instance.
Returns:
Bytes available.
function syn_datalog_get_dropped¶
Get number of dropped frames.
Parameters:
logLogger instance.
Returns:
Drop count.
function syn_datalog_reset¶
Reset the datalog, discarding all frames.
Parameters:
logLogger instance.
The documentation for this class was generated from the following file src/syntropic/log/syn_datalog.h