Skip to content

Commit

Permalink
Allow setting hub base name
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Sep 26, 2023
1 parent 8dca5ca commit db44f9f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion OpenEphys.Onix/OpenEphys.Onix/Headstage64.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System.Collections.Generic;
using System.ComponentModel;
using Bonsai;

namespace OpenEphys.Onix
{
public class Headstage64 : HubDeviceFactory
public class Headstage64 : HubDeviceFactory, INamedElement
{
PortName port;
readonly ConfigureFmcLinkController LinkController = new();
Expand All @@ -16,9 +17,13 @@ public Headstage64()
LinkController.MaxVoltage = 7.0;
}

public string Name { get; set; }

[Category(ConfigurationCategory)]
[TypeConverter(typeof(HubDeviceConverter))]
public ConfigureRhd2164 Rhd2164 { get; set; } = new();

[Category(ConfigurationCategory)]
[TypeConverter(typeof(HubDeviceConverter))]
public ConfigureBno055 Bno055 { get; set; } = new();

Expand All @@ -29,6 +34,8 @@ public PortName Port
{
port = value;
LinkController.DeviceAddress = (uint)port;
Rhd2164.DeviceName = !string.IsNullOrEmpty(Name) ? $"{Name}.Rhd2164" : null;
Bno055.DeviceName = !string.IsNullOrEmpty(Name) ? $"{Name}.Bno055" : null;
Rhd2164.DeviceAddress = ((uint)port << 8) + 0;
Bno055.DeviceAddress = ((uint)port << 8) + 1;
}
Expand Down

0 comments on commit db44f9f

Please sign in to comment.