34 lines
1.0 KiB
C#
34 lines
1.0 KiB
C#
namespace Pcie8586Probe.Models;
|
|
|
|
public sealed record AcquisitionConfig(
|
|
int ChannelCount,
|
|
InputRange InputRange,
|
|
int ClockDivider,
|
|
AcquisitionMode Mode,
|
|
long FiniteSamplesPerChannel)
|
|
{
|
|
public const double BaseSampleRateHz = 100_000_000.0;
|
|
|
|
public double SampleRateHz => BaseSampleRateHz / ClockDivider;
|
|
|
|
public static AcquisitionConfig Default { get; } = new(1, InputRange.PlusMinus5V, 100, AcquisitionMode.Continuous, 10_000);
|
|
|
|
public void Validate()
|
|
{
|
|
if (ChannelCount is not (1 or 2 or 4 or 8))
|
|
{
|
|
throw new ArgumentOutOfRangeException(nameof(ChannelCount), "Channel count must be 1, 2, 4, or 8.");
|
|
}
|
|
|
|
if (ClockDivider < 1)
|
|
{
|
|
throw new ArgumentOutOfRangeException(nameof(ClockDivider), "Clock divider must be positive.");
|
|
}
|
|
|
|
if (Mode == AcquisitionMode.Finite && FiniteSamplesPerChannel < 1)
|
|
{
|
|
throw new ArgumentOutOfRangeException(nameof(FiniteSamplesPerChannel), "Finite sample count must be positive.");
|
|
}
|
|
}
|
|
}
|