mirror of
https://github.com/D-Modem/hardware.git
synced 2026-11-28 17:48:05 -08:00
Copyright lines, licensing texts and metadata named Neo-Desktop; they now name the D-Modem Authors, and the licensing contact points at the D-Modem organisation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRUwD2JJ5d6fgHmpVTw
23 lines
798 B
C
23 lines
798 B
C
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
* Copyright (C) 2026 D-Modem Authors
|
|
*/
|
|
// Test waveforms: the line timings a capture would see for some characters.
|
|
#pragma once
|
|
#include <stddef.h>
|
|
#include "../src/core/hal.h"
|
|
|
|
#define WAVE_MAX 8192
|
|
typedef struct {
|
|
uint32_t n;
|
|
bool high[WAVE_MAX];
|
|
uint32_t ticks[WAVE_MAX];
|
|
} wave_t;
|
|
|
|
// Characters sent at baud * (1 + err), each edge moved by up to +-jitter of
|
|
// a bit, gap_bits of idle between characters. Starts at the first start bit;
|
|
// the run still going at the end (the final stop bit and idle) isn't included.
|
|
void wave_make(wave_t *w, uint32_t hz, uint32_t baud, double err, const uart_format_t *f,
|
|
const uint8_t *msg, size_t len, double gap_bits, double jitter);
|
|
double wave_rnd(void); // 0..1, repeatable
|