Loading...
Searching...
No Matches
digital_signal.h
Go to the documentation of this file.
1
17#pragma once
18
19#include <stdint.h>
20#include <stdbool.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26// DigitalSignal uses 10 picosecond time units (1 tick = 10 ps).
27// Use the macros below to convert the time from other units.
28
29#define DIGITAL_SIGNAL_MS(x) ((x) * 100000000UL)
30#define DIGITAL_SIGNAL_US(x) ((x) * 100000UL)
31#define DIGITAL_SIGNAL_NS(x) ((x) * 100UL)
32#define DIGITAL_SIGNAL_PS(x) ((x) / 10UL)
33
34typedef struct DigitalSignal DigitalSignal;
35
43
50
57void digital_signal_add_period(DigitalSignal* signal, uint32_t ticks);
58
92void digital_signal_add_period_with_level(DigitalSignal* signal, uint32_t ticks, bool level);
93
103
110void digital_signal_set_start_level(DigitalSignal* signal, bool level);
111
118uint32_t digital_signal_get_size(const DigitalSignal* signal);
119
120#ifdef __cplusplus
121}
122#endif
void digital_signal_add_period_with_level(DigitalSignal *signal, uint32_t ticks, bool level)
Append one period to the end of the DigitalSignal instance, with the level specified.
Definition digital_signal.c:80
void digital_signal_add_period(DigitalSignal *signal, uint32_t ticks)
Append one period to the end of the DigitalSignal instance.
Definition digital_signal.c:40
bool digital_signal_get_start_level(const DigitalSignal *signal)
Get the current start level contained in the DigitalSignal instance.
Definition digital_signal.c:22
void digital_signal_set_start_level(DigitalSignal *signal, bool level)
Set the start level contained in the DigitalSignal instance.
Definition digital_signal.c:28
void digital_signal_free(DigitalSignal *signal)
Delete a previously allocated DigitalSignal instance.
Definition digital_signal.c:16
DigitalSignal * digital_signal_alloc(uint32_t max_size)
Allocate a DigitalSignal instance with a defined maximum size.
Definition digital_signal.c:8
uint32_t digital_signal_get_size(const DigitalSignal *signal)
Get the number of periods currently stored in a DigitalSignal instance.
Definition digital_signal.c:34
DigitalSignal structure type.
Definition digital_signal_i.h:17
uint32_t max_size
Maximum period count this instance can hold.
Definition digital_signal_i.h:20