Skip to content

Explicitly set GATE_RUN register in ConfigureOutputClock #438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<UseArtifactsOutput>true</UseArtifactsOutput>
<PackageIcon>icon.png</PackageIcon>
<VersionPrefix>0.4.5</VersionPrefix>
<VersionPrefix>0.5.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<LangVersion>10.0</LangVersion>
<Features>strict</Features>
Expand Down
10 changes: 7 additions & 3 deletions OpenEphys.Onix1/ConfigureOutputClock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public ConfigureOutputClock()
/// Gets or sets a value specifying if the output clock is active.
/// </summary>
/// <remarks>
/// If set to true, the clock output will be connected to the clock output line. If set to false, the
/// clock output line will be held low. This value can be toggled in real time to gate acquisition of
/// external hardware.
/// If set to true, the physical clock output will be connected to the internal clock signal. If set
/// to false, the clock output line will be held low. This value can be toggled in real time to gate
/// acquisition of external hardware without resetting the internal clock.
/// </remarks>
[Category(AcquisitionCategory)]
[Description("Clock gate control signal.")]
Expand Down Expand Up @@ -141,6 +141,10 @@ public override IObservable<ContextTask> Process(IObservable<ContextTask> source
{
var device = context.GetDeviceContext(deviceAddress, DeviceType);

// NB: In this library the hardware run state and the workflow operation are linked.
// Therefore, the clock should never be active outside the running state
device.WriteRegister(OutputClock.GATE_RUN, 0b1);

var baseFreqHz = device.ReadRegister(OutputClock.BASE_FREQ_HZ);
var periodTicks = (uint)(baseFreqHz / clkFreqHz);
var h = (uint)(periodTicks * (dutyCycle / 100));
Expand Down