-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support RHS2116 streaming and stimulation #67
Closed
Changes from 5 commits
Commits
Show all changes
123 commits
Select commit
Hold shift + click to select a range
b19f6a0
Add partial headstage RHS2116 support
jonnew 5a136d6
Finish headstage RHS2116 support
jonnew fcf921a
Move register class to top-level for consistency
glopesdev 50e29db
Fix indentation for consistency
glopesdev 33d933d
Bring rhs2116 up to date with main and gateware 0.3
jonnew ea49ff5
Remove un-resolvable TODO comment
jonnew cbb9f70
Ensure any BNO polling exceptions are routed
glopesdev 39ee5bc
Ensure exception is thrown on configuration error
glopesdev 5818b57
Ensure dynamic configuration exceptions are routed
glopesdev e60f898
Remove unused fields and properties
glopesdev 35d1862
Refactor context task to allow async dispose
glopesdev 191bedb
Avoid rethrowing exception if routed to observer
glopesdev 6eb907a
Terminate frame distribution if read frame throws
glopesdev 75c12ef
Document analog IO
jonnew 7a7bd95
NeuropixelsV1e documentation
bparks13 4eb85eb
Address comments in #142
jonnew 4ac8aa4
Ensure device is removed even on shutdown errors
glopesdev 9769985
Rename standard data frame properties
glopesdev a266c31
Add data frame abstract base classes
glopesdev 879c318
Align heartbeat data node with data frame pattern
glopesdev 1138ee2
Derive data types from common data frame classes
glopesdev 517e7dd
Align memory monitor node with data frame pattern
glopesdev 4dd39bb
NeuropixelsV2e documentation
bparks13 a07d1bb
Address comments
bparks13 58c41a7
Merge pull request #132 from neurogears/issue-131
glopesdev f42fb50
Merge pull request #126 from neurogears/issue-121
glopesdev bd54594
Remove ConfigureRhd2164.Rhd2164AmplifierDataFormat
jonnew 20f779e
NeuropixelsV2eBeta documentation
bparks13 8b7852d
Document headstage-64 and related classes
jonnew 74585bc
Remove unused enum
glopesdev da99155
Merge pull request #151 from neurogears/issue-149
glopesdev a30d975
Merge pull request #147 from neurogears/issue-140
glopesdev 7ddea06
Refactor device manager to avoid ref count dispose
glopesdev 3d6fb57
Rename manager getter function for clarity
glopesdev 68552df
Merge pull request #155 from neurogears/devicemanager-refactor
glopesdev c946cb1
Update ConfigureRhd2164.cs
jonnew 4bfe9c0
Update Rhd2164Data.cs
jonnew 181bf0f
Address review comments
bparks13 9fb74da
Merge branch 'issue-144' into issue-158
bparks13 56396ac
Merge branch 'issue-141' into issue-158
bparks13 a1be2ef
Merge branch 'issue-148' into documentation
bparks13 8b2b93a
Add breakout board documentation
jonnew 65546e3
Fixing modified variables after merges
bparks13 bf5ebe9
Merge branch 'issue-157' into documentation
bparks13 01c4e38
Minor fixes
bparks13 c100fe6
Remove reference to method call
bparks13 2df0ff0
Add V1 to TS4231 class names
jonnew f2db16f
Fix properties in several basic device types
jonnew de1d561
Validate device name argument against null
glopesdev b5d8720
Ensure dynamic property subscription error routing
glopesdev d9066e0
Remove Test0 device from FMC package
glopesdev 8aa7eed
Rename AnalogIO and DigitalIO to refer to breakout
glopesdev 63bbc4f
Remove unused enum type
glopesdev 2b70a4c
Address review comments from #153
bparks13 649ac2d
Merge pull request #163 from neurogears/api-cleanup
glopesdev 9ca6531
Merge pull request #164 from neurogears/issue-160
glopesdev 96c64b7
Add TS4231 data source that automatically calculates 3D positions
jonnew d628246
Update ConfigureHeadstage64.cs
jonnew 9b78802
Improve existing TS4231 documentation
jonnew 571b8b2
Address code review
jonnew ac28b93
Merge pull request #166 from neurogears/issue-152-attempt2
jonnew 4097251
TS4231 code cleanup
jonnew 7b4c7de
Document TS4231V1GeometricPositionData/Frame
jonnew 7574e63
Group frame distribution by device address
glopesdev c809023
Merge pull request #110 from neurogears/issue-62
glopesdev ad55181
Merge branch 'issue-167' into documentation
bparks13 6216f5e
Add docs for TS4231V1DataFrame
jonnew 80dcdb9
Merge branch 'documentation'
jonnew a5e0505
Remove geometric prefix
glopesdev 6dc9e26
Merge pull request #171 from neurogears/naming-refactor
glopesdev c123dd5
Update package dependencies
glopesdev 391ad2b
Unify processor architecture
glopesdev 56e026c
Remove unused configuration operator for DS90UB9x
glopesdev 7bdb036
Avoid exposing internal implementation classes
glopesdev fb191f0
Merge pull request #172 from neurogears/api-cleanup
glopesdev ff250e9
Internalize implementation specific members
glopesdev 4088fd6
Merge pull request #175 from neurogears/issue-174
glopesdev 7ef2536
Document ContextTask public API
jonnew 01e3661
Document StartAcquisition and CreateContext
jonnew 589370e
Add missing descriptions and improve wording
glopesdev cf1557f
Address review comments
glopesdev e8add7f
Merge pull request #177 from neurogears/issue-173-internalized
glopesdev 2b1039b
Refactor project folder structure
glopesdev dcbc0c5
Use artifacts output layout
glopesdev 25010e4
Avoid packing empty project
glopesdev a38c23f
Add package README file
glopesdev 259cd20
Add build CI workflow with package artifacts
glopesdev 9347ce3
Merge pull request #179 from neurogears/release-automation
glopesdev 744d587
Minor documentation edits
jonnew fcca30a
Add functional README file
jonnew be731ce
Merge pull request #183 from open-ephys/add-readme
glopesdev bd979f5
Merge pull request #181 from open-ephys/20240731-docs-edits
glopesdev ba63945
Rename hub to multi-device factory for clarity
glopesdev 66f858b
Merge pull request #184 from open-ephys/naming-refactor
glopesdev 2bb4474
Rename project to OpenEphys.Onix1
glopesdev e44531d
Add package project and repository URLs
glopesdev e7a63cb
Merge pull request #185 from open-ephys/naming-refactor
glopesdev cf4ce2f
Publish packages to github on push to main
glopesdev 5dc8fb8
Merge pull request #187 from open-ephys/release-automation
glopesdev 9215835
Minor updates to documentation
jonnew 7e2c852
Publish packages to github on release
glopesdev 0b071bf
Ensure build suffix is declared at job level
glopesdev 7a3a6c2
Change spelling
bparks13 7cb45a2
Merge pull request #189 from open-ephys/20240802-docs-update
bparks13 18b50bf
Fix register mapping for Neuropixels 2.0 public probes
jonnew de8af86
Resolve issues in discussion of #189
jonnew beb4610
Disconnect i2c bus from probes before streaming
jonnew b86733c
Fix neuropixels gain corrections
jonnew 62aa90b
Merge pull request #190 from open-ephys/issue-186
jonnew e2b7f72
Address review in #194
jonnew ee8a775
Minor wording review
glopesdev cf48a92
Merge pull request #194 from open-ephys/20240804-docs-update
glopesdev 3cbf6ca
Merge pull request #196 from open-ephys/release-automation
glopesdev 13fb905
Update bootstrapper version
glopesdev 7ac700f
Merge pull request #197 from open-ephys/bootstrapper-update
glopesdev 01b36a2
Add partial headstage RHS2116 support
jonnew 4209da7
Finish headstage RHS2116 support
jonnew 84ec7ed
Fix indentation for consistency
glopesdev 51fb1fb
Bring rhs2116 up to date with main and gateware 0.3
jonnew 6e8133e
Remove un-resolvable TODO comment
jonnew 208d631
Bring rhs2116 classes up to date with latest API
jonnew 068c681
Merge branch 'issue-26' of github.com:open-ephys/onix-bonsai-onix1 in…
jonnew 07871b4
Fix sytax errors introduced during conflict resolution
jonnew File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
OpenEphys.Onix/OpenEphys.Onix/ConfigureHeadstageRhs2116.cs
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file (along with a few others in the same OpenEphys.Onix/OpenEphys.Onix folder path) are leftovers from the old folder pattern. These should be removed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Threading; | ||
|
||
namespace OpenEphys.Onix | ||
{ | ||
public class ConfigureHeadstageRhs2116 : HubDeviceFactory | ||
{ | ||
PortName port; | ||
readonly ConfigureHeadstageRhs2116LinkController LinkController = new(); | ||
|
||
public ConfigureHeadstageRhs2116() | ||
{ | ||
// TODO: The issue with this headstage is that its locking voltage is far, far lower than the voltage required for full | ||
// functionality. Locking occurs at around 2V on the headstage (enough to turn 1.8V on). Full functionality is at 5.0 volts. | ||
// Whats worse: the port voltage can only go down to 3.3V, which means that its very hard to find the true lowest voltage | ||
// for a lock and then add a large offset to that. | ||
Port = PortName.PortA; | ||
LinkController.HubConfiguration = HubConfiguration.Standard; | ||
} | ||
|
||
[Category(ConfigurationCategory)] | ||
[TypeConverter(typeof(HubDeviceConverter))] | ||
public ConfigureRhs2116 Rhs2116A { get; set; } = new(); | ||
|
||
[Category(ConfigurationCategory)] | ||
[TypeConverter(typeof(HubDeviceConverter))] | ||
public ConfigureRhs2116 Rhs2116B { get; set; } = new(); | ||
|
||
[Category(ConfigurationCategory)] | ||
[TypeConverter(typeof(HubDeviceConverter))] | ||
public ConfigureRhs2116Trigger StimulusTrigger { get; set; } = new(); | ||
|
||
internal override void UpdateDeviceNames() | ||
{ | ||
LinkController.DeviceName = GetFullDeviceName(nameof(LinkController)); | ||
Rhs2116A.DeviceName = GetFullDeviceName(nameof(Rhs2116A)); | ||
Rhs2116B.DeviceName = GetFullDeviceName(nameof(Rhs2116B)); | ||
StimulusTrigger.DeviceName = GetFullDeviceName(nameof(StimulusTrigger)); | ||
} | ||
|
||
public PortName Port | ||
{ | ||
get { return port; } | ||
set | ||
{ | ||
port = value; | ||
var offset = (uint)port << 8; | ||
LinkController.DeviceAddress = (uint)port; | ||
Rhs2116A.DeviceAddress = offset + 0; | ||
Rhs2116B.DeviceAddress = offset + 1; | ||
StimulusTrigger.DeviceAddress = offset + 2; | ||
} | ||
} | ||
|
||
|
||
[Description("If defined, it will override automated voltage discovery and apply the specified voltage" + | ||
"to the headstage. Warning: this device requires 3.4V to 4.4V for proper operation." + | ||
"Supplying higher voltages may result in damage to the headstage.")] | ||
public double? PortVoltage | ||
{ | ||
get => LinkController.PortVoltage; | ||
set => LinkController.PortVoltage = value; | ||
} | ||
|
||
internal override IEnumerable<IDeviceConfiguration> GetDevices() | ||
{ | ||
yield return LinkController; | ||
yield return Rhs2116A; | ||
yield return Rhs2116B; | ||
yield return StimulusTrigger; | ||
} | ||
|
||
class ConfigureHeadstageRhs2116LinkController : ConfigureFmcLinkController | ||
{ | ||
protected override bool ConfigurePortVoltage(DeviceContext device) | ||
{ | ||
const double MinVoltage = 3.3; | ||
const double MaxVoltage = 4.4; | ||
const double VoltageOffset = 2.0; | ||
const double VoltageIncrement = 0.2; | ||
|
||
for (var voltage = MinVoltage; voltage <= MaxVoltage; voltage += VoltageIncrement) | ||
{ | ||
SetPortVoltage(device, voltage); | ||
if (base.CheckLinkState(device)) | ||
{ | ||
SetPortVoltage(device, voltage + VoltageOffset); | ||
return CheckLinkState(device); | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
private void SetPortVoltage(DeviceContext device, double voltage) | ||
{ | ||
device.WriteRegister(FmcLinkController.PORTVOLTAGE, 0); | ||
Thread.Sleep(500); | ||
device.WriteRegister(FmcLinkController.PORTVOLTAGE, (uint)(10 * voltage)); | ||
Thread.Sleep(500); | ||
} | ||
|
||
protected override bool CheckLinkState(DeviceContext device) | ||
{ | ||
// NB: The RHS2116 headstage needs an additional reset after power on to provide its device table. | ||
device.Context.Reset(); | ||
var linkState = device.ReadRegister(FmcLinkController.LINKSTATE); | ||
return (linkState & FmcLinkController.LINKSTATE_SL) != 0; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the phase detector package used in the implementation, or just for examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Should not be there. Also don't know why I committed this file.