Skip to content

Commit

Permalink
Add V1 to TS4231 class names
Browse files Browse the repository at this point in the history
- Qualify all TS4231* nodes with V1 because they data handle is produced
by V1 basesations.
-  We have V2 basestation variants of the FPGA core, but these classes
will not work with that data.
  • Loading branch information
jonnew committed Jul 25, 2024
1 parent 68552df commit 2df0ff0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion OpenEphys.Onix/OpenEphys.Onix/ConfigureHeadstage64.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public ConfigureHeadstage64()

[Category(ConfigurationCategory)]
[TypeConverter(typeof(HubDeviceConverter))]
public ConfigureTS4231 TS4231 { get; set; } = new() { Enable = false };
public ConfigureTS4231V1 TS4231 { get; set; } = new() { Enable = false };

[Category(ConfigurationCategory)]
[TypeConverter(typeof(HubDeviceConverter))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

namespace OpenEphys.Onix
{
public class ConfigureTS4231 : SingleDeviceFactory
public class ConfigureTS4231V1 : SingleDeviceFactory
{
public ConfigureTS4231()
: base(typeof(TS4231))
public ConfigureTS4231V1()
: base(typeof(TS4231V1))
{
}

Expand All @@ -21,13 +21,13 @@ public override IObservable<ContextTask> Process(IObservable<ContextTask> source
return source.ConfigureDevice(context =>
{
var device = context.GetDeviceContext(deviceAddress, DeviceType);
device.WriteRegister(TS4231.ENABLE, Enable ? 1u : 0);
device.WriteRegister(TS4231V1.ENABLE, Enable ? 1u : 0);
return DeviceManager.RegisterDevice(deviceName, device, DeviceType);
});
}
}

static class TS4231
static class TS4231V1
{
public const int ID = 25;

Expand All @@ -37,7 +37,7 @@ static class TS4231
internal class NameConverter : DeviceNameConverter
{
public NameConverter()
: base(typeof(TS4231))
: base(typeof(TS4231V1))
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@

namespace OpenEphys.Onix
{
public class TS4231Data : Source<TS4231DataFrame>
public class TS4231V1Data : Source<TS4231V1DataFrame>
{
[TypeConverter(typeof(TS4231.NameConverter))]
[TypeConverter(typeof(TS4231V1.NameConverter))]
public string DeviceName { get; set; }

public override IObservable<TS4231DataFrame> Generate()
public override IObservable<TS4231V1DataFrame> Generate()
{
return DeviceManager.GetDevice(DeviceName).SelectMany(deviceInfo =>
{
var device = deviceInfo.GetDeviceContext(typeof(TS4231));
var device = deviceInfo.GetDeviceContext(typeof(TS4231V1));
return deviceInfo.Context.FrameReceived
.Where(frame => frame.DeviceAddress == device.Address)
.Select(frame => new TS4231DataFrame(frame));
.Select(frame => new TS4231V1DataFrame(frame));
});
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System.Runtime.InteropServices;
using System.Numerics;
using System.Runtime.InteropServices;
using oni;

namespace OpenEphys.Onix
{
public class TS4231DataFrame : DataFrame
public class TS4231V1DataFrame : DataFrame
{
public unsafe TS4231DataFrame(oni.Frame frame)
public unsafe TS4231V1DataFrame(oni.Frame frame)
: base(frame.Clock)
{
var payload = (TS4231Payload*)frame.Data.ToPointer();
Expand All @@ -18,7 +20,7 @@ public unsafe TS4231DataFrame(oni.Frame frame)

public uint EnvelopeWidth { get; }

public TS4231Envelope EnvelopeType { get; }
public TS4231V1Envelope EnvelopeType { get; }
}

[StructLayout(LayoutKind.Sequential, Pack = 1)]
Expand All @@ -27,17 +29,20 @@ struct TS4231Payload
public ulong HubClock;
public ushort SensorIndex;
public uint EnvelopeWidth;
public TS4231Envelope EnvelopeType;
public TS4231V1Envelope EnvelopeType;
}

public enum TS4231Envelope : short
public enum TS4231V1Envelope : short
{
Sweep,
Bad = -1,
J0,
K0,
J1,
K1,
J2,
K2
K2,
J3,
K3,
Sweep,
}
}

0 comments on commit 2df0ff0

Please sign in to comment.