Skip to content

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.

void syn_datalog_init (
    SYN_DataLog * log,
    uint8_t * buf,
    size_t size
) 

Parameters:

  • log Pointer to logger instance.
  • buf Caller-provided backing array.
  • size Size of backing array in bytes.

function syn_datalog_read

Read the next telemetry frame from the logger.

size_t syn_datalog_read (
    SYN_DataLog * log,
    uint16_t * out_id,
    void * out_data,
    size_t max_len
) 

Parameters:

  • log Pointer to logger instance.
  • out_id [out] Stream ID of read frame.
  • out_data [out] Buffer to store payload.
  • max_len Maximum 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.

bool syn_datalog_write (
    SYN_DataLog * log,
    uint16_t id,
    const void * data,
    uint16_t len
) 

Parameters:

  • log Pointer to logger instance.
  • id Stream ID.
  • data Payload to write.
  • len Payload 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.

static inline size_t syn_datalog_available (
    const SYN_DataLog * log
) 

Parameters:

  • log Logger instance.

Returns:

Bytes available.


function syn_datalog_get_dropped

Get number of dropped frames.

static inline uint32_t syn_datalog_get_dropped (
    const SYN_DataLog * log
) 

Parameters:

  • log Logger instance.

Returns:

Drop count.


function syn_datalog_reset

Reset the datalog, discarding all frames.

static inline void syn_datalog_reset (
    SYN_DataLog * log
) 

Parameters:

  • log Logger instance.


The documentation for this class was generated from the following file src/syntropic/log/syn_datalog.h