Skip to content
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

Motivate heartbeat functionality in breakout #134

Merged
merged 3 commits into from
Oct 30, 2024
Merged
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
24 changes: 13 additions & 11 deletions articles/hardware/breakout/heartbeat.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ hardware: true
device: heartbeat
---

The following excerpt from the Breakout Board [example workflow](xref:breakout_workflow)
demonstrates heartbeat functionality.
ONIX has a single special device, called a heartbeat, that produces data at regular intervals and is always enabled.
When data is read from the hardware by software, the reading thread will block until enough data has been produced by
the hardware. If no devices are enabled, the software would block forever. The heartbeat prevents this from happening
since it is always enabled and always producing data. In practice, you can ignore the heartbeat functionality. In any
case, the following excerpt from the Breakout Board [example workflow](xref:breakout_workflow) demonstrates how to
observe the heartbeat.

::: workflow
![/workflows/hardware/breakout/heartbeat.bonsai workflow](../../../workflows/hardware/breakout/heartbeat.bonsai)
:::

The <xref:OpenEphys.Onix1.HeartbeatData> operator generates a sequence of
<xref:OpenEphys.Onix1.HeartbeatDataFrame>s. `HeartbeatData` emits `HeartbeatDataFrame`s at a regular
interval defined during <xref:breakout_configuration> using the
<xref:OpenEphys.Onix1.ConfigureBreakoutBoard>'s `Heartbeat BeatsPerSecond` property (in our case 10
Hz). In the Breakout Board example workflow, the `HeartbeatData`'s `DeviceName` property is set to
"BreakoutBoard/Heartbeat". This links the `HeartbeatData` operator to the corresponding
configuration operator. The
[MemberSelector](https://bonsai-rx.org/docs/api/Bonsai.Expressions.MemberSelectorBuilder.html)
operator selects the `Clock` member from the `HeartbeatDataFrame` so the user can visualize `Clock`
data from the `HeartbeatDataFrame`.
[HeartbeatDataFrames](xref:OpenEphys.Onix1.HeartbeatDataFrame). `HeartbeatData` emits `HeartbeatDataFrames` at a regular
interval defined during <xref:breakout_configuration> using the <xref:OpenEphys.Onix1.ConfigureBreakoutBoard>'s
`Heartbeat BeatsPerSecond` property (in our case 10 Hz). The `HeartbeatData`'s `DeviceName` property is set to
"BreakoutBoard/Heartbeat". This links the `HeartbeatData` operator to the corresponding configuration operator. The
[MemberSelector](https://bonsai-rx.org/docs/api/Bonsai.Expressions.MemberSelectorBuilder.html) operator selects the
`Clock` member from the `HeartbeatDataFrame` so the user can visualize the number of clock cycles that have passed for
a given heartbeat pulse if they double-click the `Clock` node.
Loading