diff --git a/OpenEphys.Onix1/BreakoutAnalogInput.cs b/OpenEphys.Onix1/AnalogInput.cs
similarity index 66%
rename from OpenEphys.Onix1/BreakoutAnalogInput.cs
rename to OpenEphys.Onix1/AnalogInput.cs
index 6a320a3d..2034bb43 100644
--- a/OpenEphys.Onix1/BreakoutAnalogInput.cs
+++ b/OpenEphys.Onix1/AnalogInput.cs
@@ -9,29 +9,33 @@
namespace OpenEphys.Onix1
{
+ ///
+ [Obsolete("Use AnalogInput instead. This operator will be removed in version 1.0.0")]
+ public class BreakoutAnalogInput : AnalogInput { }
+
///
/// Produces a sequence of analog input frames from an ONIX breakout board.
///
///
/// This data IO operator must be linked to an appropriate configuration, such as a , using a shared DeviceName.
+ /// cref="ConfigureAnalogIO"/>, using a shared DeviceName.
///
[Description("Produces a sequence of analog input frames from an ONIX breakout board.")]
- public class BreakoutAnalogInput : Source
+ public class AnalogInput : Source
{
///
- [TypeConverter(typeof(BreakoutAnalogIO.NameConverter))]
+ [TypeConverter(typeof(AnalogIO.NameConverter))]
[Description(SingleDeviceFactory.DeviceNameDescription)]
[Category(DeviceFactory.ConfigurationCategory)]
public string DeviceName { get; set; }
///
- /// Gets or sets the number of samples collected for each channel that are use to create a single .
+ /// Gets or sets the number of samples collected for each channel that are use to create a single .
///
///
/// This property determines the number of analog samples that are buffered for each channel before data is propagated. For instance, if this
/// value is set to 100, then 100 samples, along with corresponding clock values, will be collected from each of the input channels
- /// and packed into each . Because channels are sampled at 100 kHz, this is equivalent to 1
+ /// and packed into each . Because channels are sampled at 100 kHz, this is equivalent to 1
/// millisecond of data from each channel.
///
[Description("The number of analog samples that are buffered for each channel before data is propagated.")]
@@ -42,15 +46,15 @@ public class BreakoutAnalogInput : Source
/// Gets or sets the data type used to represent analog samples.
///
///
- /// If is selected, each ADC sample is represented at a signed, twos-complement encoded
- /// 16-bit integer. samples can be converted to a voltage using each channels'
- /// selection. For instance, channel 0 can be converted using .
- /// When is selected, the voltage conversion is performed automatically and samples
+ /// If is selected, each ADC sample is represented at a signed, twos-complement encoded
+ /// 16-bit integer. samples can be converted to a voltage using each channels'
+ /// selection. For instance, channel 0 can be converted using .
+ /// When is selected, the voltage conversion is performed automatically and samples
/// are represented as 32-bit floating point voltages.
///
[Description("The data type used to represent analog samples.")]
[Category(DeviceFactory.ConfigurationCategory)]
- public BreakoutAnalogIODataType DataType { get; set; } = BreakoutAnalogIODataType.S16;
+ public AnalogIODataType DataType { get; set; } = AnalogIODataType.S16;
static Mat CreateVoltageScale(int bufferSize, float[] voltsPerDivision)
{
@@ -66,35 +70,35 @@ static Mat CreateVoltageScale(int bufferSize, float[] voltsPerDivision)
}
///
- /// Generates a sequence of .
+ /// Generates a sequence of .
///
- /// A sequence of
- public unsafe override IObservable Generate()
+ /// A sequence of
+ public unsafe override IObservable Generate()
{
var bufferSize = BufferSize;
var dataType = DataType;
return DeviceManager.GetDevice(DeviceName).SelectMany(
- deviceInfo => Observable.Create(observer =>
+ deviceInfo => Observable.Create(observer =>
{
- var device = deviceInfo.GetDeviceContext(typeof(BreakoutAnalogIO));
- var ioDeviceInfo = (BreakoutAnalogIODeviceInfo)deviceInfo;
+ var device = deviceInfo.GetDeviceContext(typeof(AnalogIO));
+ var ioDeviceInfo = (AnalogIODeviceInfo)deviceInfo;
var sampleIndex = 0;
- var voltageScale = dataType == BreakoutAnalogIODataType.Volts
+ var voltageScale = dataType == AnalogIODataType.Volts
? CreateVoltageScale(bufferSize, ioDeviceInfo.VoltsPerDivision)
: null;
var transposeBuffer = voltageScale != null
- ? new Mat(BreakoutAnalogIO.ChannelCount, bufferSize, Depth.S16, 1)
+ ? new Mat(AnalogIO.ChannelCount, bufferSize, Depth.S16, 1)
: null;
- var analogDataBuffer = new short[BreakoutAnalogIO.ChannelCount * bufferSize];
+ var analogDataBuffer = new short[AnalogIO.ChannelCount * bufferSize];
var hubClockBuffer = new ulong[bufferSize];
var clockBuffer = new ulong[bufferSize];
var frameObserver = Observer.Create(
frame =>
{
- var payload = (BreakoutAnalogInputPayload*)frame.Data.ToPointer();
- Marshal.Copy(new IntPtr(payload->AnalogData), analogDataBuffer, sampleIndex * BreakoutAnalogIO.ChannelCount, BreakoutAnalogIO.ChannelCount);
+ var payload = (AnalogInputPayload*)frame.Data.ToPointer();
+ Marshal.Copy(new IntPtr(payload->AnalogData), analogDataBuffer, sampleIndex * AnalogIO.ChannelCount, AnalogIO.ChannelCount);
hubClockBuffer[sampleIndex] = payload->HubClock;
clockBuffer[sampleIndex] = frame.Clock;
if (++sampleIndex >= bufferSize)
@@ -102,11 +106,11 @@ public unsafe override IObservable Generate()
var analogData = BufferHelper.CopyTranspose(
analogDataBuffer,
bufferSize,
- BreakoutAnalogIO.ChannelCount,
+ AnalogIO.ChannelCount,
Depth.S16,
voltageScale,
transposeBuffer);
- observer.OnNext(new BreakoutAnalogInputDataFrame(clockBuffer, hubClockBuffer, analogData));
+ observer.OnNext(new AnalogInputDataFrame(clockBuffer, hubClockBuffer, analogData));
hubClockBuffer = new ulong[bufferSize];
clockBuffer = new ulong[bufferSize];
sampleIndex = 0;
diff --git a/OpenEphys.Onix1/BreakoutAnalogInputDataFrame.cs b/OpenEphys.Onix1/AnalogInputDataFrame.cs
similarity index 69%
rename from OpenEphys.Onix1/BreakoutAnalogInputDataFrame.cs
rename to OpenEphys.Onix1/AnalogInputDataFrame.cs
index bb62cd01..3a68ce08 100644
--- a/OpenEphys.Onix1/BreakoutAnalogInputDataFrame.cs
+++ b/OpenEphys.Onix1/AnalogInputDataFrame.cs
@@ -6,15 +6,15 @@ namespace OpenEphys.Onix1
///
/// Buffered analog data produced by the ONIX breakout board.
///
- public class BreakoutAnalogInputDataFrame : BufferedDataFrame
+ public class AnalogInputDataFrame : BufferedDataFrame
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// A buffered array of values.
/// A buffered array of hub clock counter values.
/// A buffered array of multi-channel analog data.
- public BreakoutAnalogInputDataFrame(ulong[] clock, ulong[] hubClock, Mat analogData)
+ public AnalogInputDataFrame(ulong[] clock, ulong[] hubClock, Mat analogData)
: base(clock, hubClock)
{
AnalogData = analogData;
@@ -27,9 +27,9 @@ public BreakoutAnalogInputDataFrame(ulong[] clock, ulong[] hubClock, Mat analogD
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- unsafe struct BreakoutAnalogInputPayload
+ unsafe struct AnalogInputPayload
{
public ulong HubClock;
- public fixed short AnalogData[BreakoutAnalogIO.ChannelCount];
+ public fixed short AnalogData[AnalogIO.ChannelCount];
}
}
diff --git a/OpenEphys.Onix1/BreakoutAnalogOutput.cs b/OpenEphys.Onix1/AnalogOutput.cs
similarity index 78%
rename from OpenEphys.Onix1/BreakoutAnalogOutput.cs
rename to OpenEphys.Onix1/AnalogOutput.cs
index 84b13ad2..d9b7b058 100644
--- a/OpenEphys.Onix1/BreakoutAnalogOutput.cs
+++ b/OpenEphys.Onix1/AnalogOutput.cs
@@ -7,20 +7,24 @@
namespace OpenEphys.Onix1
{
+ ///
+ [Obsolete("Use AnalogOutput instead. This operator will be removed in version 1.0.0")]
+ public class BreakoutAnalogOutput : AnalogOutput { }
+
///
/// Sends analog output data to an ONIX breakout board.
///
///
/// This data IO operator must be linked to an appropriate configuration, such as a , using a shared DeviceName.
+ /// cref="ConfigureAnalogIO"/>, using a shared DeviceName.
///
[Description("Sends analog output data to an ONIX breakout board.")]
- public class BreakoutAnalogOutput : Sink
+ public class AnalogOutput : Sink
{
- const BreakoutAnalogIOVoltageRange OutputRange = BreakoutAnalogIOVoltageRange.TenVolts;
+ const AnalogIOVoltageRange OutputRange = AnalogIOVoltageRange.TenVolts;
///
- [TypeConverter(typeof(BreakoutAnalogIO.NameConverter))]
+ [TypeConverter(typeof(AnalogIO.NameConverter))]
[Description(SingleDeviceFactory.DeviceNameDescription)]
[Category(DeviceFactory.ConfigurationCategory)]
public string DeviceName { get; set; }
@@ -29,15 +33,15 @@ public class BreakoutAnalogOutput : Sink
/// Gets or sets the data type used to represent analog samples.
///
///
- /// If is selected, each DAC value is represented by a
+ /// If is selected, each DAC value is represented by a
/// signed, twos-complement encoded 16-bit integer. In this case, the output voltage always
- /// corresponds to . When is selected, 32-bit floating point voltages between -10
+ /// corresponds to . When is selected, 32-bit floating point voltages between -10
/// and 10 volts are sent directly to the DACs.
///
[Description("The data type used to represent analog samples.")]
[Category(DeviceFactory.ConfigurationCategory)]
- public BreakoutAnalogIODataType DataType { get; set; } = BreakoutAnalogIODataType.S16;
+ public AnalogIODataType DataType { get; set; } = AnalogIODataType.S16;
///
/// Send an matrix of samples to all enabled analog outputs.
@@ -45,8 +49,8 @@ public class BreakoutAnalogOutput : Sink
///
/// If a matrix contains multiple samples, they will be written to hardware as quickly as
/// communication allows. The data within each input matrix must have when
- /// DataType is set to or
- /// when DataType is set to .
+ /// DataType is set to or
+ /// when DataType is set to .
///
/// A sequence of 12xN sample matrices containing the analog data to write to
/// channels 0 to 11.
@@ -60,14 +64,14 @@ public override unsafe IObservable Process(IObservable source)
var bufferSize = 0;
var scaleBuffer = default(Mat);
var transposeBuffer = default(Mat);
- var sampleScale = dataType == BreakoutAnalogIODataType.Volts
- ? 1 / BreakoutAnalogIODeviceInfo.GetVoltsPerDivision(OutputRange)
+ var sampleScale = dataType == AnalogIODataType.Volts
+ ? 1 / AnalogIODeviceInfo.GetVoltsPerDivision(OutputRange)
: 1;
- var device = deviceInfo.GetDeviceContext(typeof(BreakoutAnalogIO));
+ var device = deviceInfo.GetDeviceContext(typeof(AnalogIO));
return source.Do(data =>
{
- if (dataType == BreakoutAnalogIODataType.S16 && data.Depth != Depth.S16 ||
- dataType == BreakoutAnalogIODataType.Volts && data.Depth != Depth.F32)
+ if (dataType == AnalogIODataType.S16 && data.Depth != Depth.S16 ||
+ dataType == AnalogIODataType.Volts && data.Depth != Depth.F32)
{
ThrowDataTypeException(data.Depth);
}
@@ -116,7 +120,7 @@ public override unsafe IObservable Process(IObservable source)
///
///
/// This overload should be used when DataType is set to and values should be within -32,768 to 32,767, which
+ /// cref="AnalogIODataType.S16"/> and values should be within -32,768 to 32,767, which
/// correspond to -10.0 to 10.0 volts.
///
/// A sequence of 12x1 element arrays each containing the analog data to write
@@ -125,12 +129,12 @@ public override unsafe IObservable Process(IObservable source)
/// to 11.
public IObservable Process(IObservable source)
{
- if (DataType != BreakoutAnalogIODataType.S16)
+ if (DataType != AnalogIODataType.S16)
ThrowDataTypeException(Depth.S16);
return DeviceManager.GetDevice(DeviceName).SelectMany(deviceInfo =>
{
- var device = deviceInfo.GetDeviceContext(typeof(BreakoutAnalogIO));
+ var device = deviceInfo.GetDeviceContext(typeof(AnalogIO));
return source.Do(data =>
{
AssertChannelCount(data.Length);
@@ -150,7 +154,7 @@ public IObservable Process(IObservable source)
///
///
/// This overload should be used when DataType is set to and values should be within -10.0 to 10.0 volts.
+ /// cref="AnalogIODataType.Volts"/> and values should be within -10.0 to 10.0 volts.
///
/// A sequence of 12x1 element arrays each containing the analog data to write
/// to channels 0 to 11.
@@ -158,20 +162,20 @@ public IObservable Process(IObservable source)
/// to 11.
public IObservable Process(IObservable source)
{
- if (DataType != BreakoutAnalogIODataType.Volts)
+ if (DataType != AnalogIODataType.Volts)
ThrowDataTypeException(Depth.F32);
return DeviceManager.GetDevice(DeviceName).SelectMany(deviceInfo =>
{
- var device = deviceInfo.GetDeviceContext(typeof(BreakoutAnalogIO));
- var divisionsPerVolt = 1 / BreakoutAnalogIODeviceInfo.GetVoltsPerDivision(OutputRange);
+ var device = deviceInfo.GetDeviceContext(typeof(AnalogIO));
+ var divisionsPerVolt = 1 / AnalogIODeviceInfo.GetVoltsPerDivision(OutputRange);
return source.Do(data =>
{
AssertChannelCount(data.Length);
var samples = new ushort[data.Length];
for (int i = 0; i < samples.Length; i++)
{
- samples[i] = (ushort)(data[i] * divisionsPerVolt + BreakoutAnalogIO.DacMidScale);
+ samples[i] = (ushort)(data[i] * divisionsPerVolt + AnalogIO.DacMidScale);
}
device.Write(samples);
@@ -181,10 +185,10 @@ public IObservable Process(IObservable source)
static void AssertChannelCount(int channels)
{
- if (channels != BreakoutAnalogIO.ChannelCount)
+ if (channels != AnalogIO.ChannelCount)
{
throw new InvalidOperationException(
- $"The input data must have exactly {BreakoutAnalogIO.ChannelCount} channels."
+ $"The input data must have exactly {AnalogIO.ChannelCount} channels."
);
}
}
diff --git a/OpenEphys.Onix1/ConfigureBreakoutAnalogIO.cs b/OpenEphys.Onix1/ConfigureAnalogIO.cs
similarity index 72%
rename from OpenEphys.Onix1/ConfigureBreakoutAnalogIO.cs
rename to OpenEphys.Onix1/ConfigureAnalogIO.cs
index 23ff2291..d1f6ba8f 100644
--- a/OpenEphys.Onix1/ConfigureBreakoutAnalogIO.cs
+++ b/OpenEphys.Onix1/ConfigureAnalogIO.cs
@@ -4,23 +4,27 @@
namespace OpenEphys.Onix1
{
+ ///
+ [Obsolete("Use ConfigureAnalogIO instead. This operator will be removed in version 1.0.0")]
+ public class ConfigureBreakoutAnalogIO : ConfigureAnalogIO { }
+
///
- /// Configures the ONIX breakout board's analog inputs and outputs.
+ /// Configures an analog inputs and output device.
///
///
/// This configuration operator can be linked to data IO operators, such as and , using a shared
+ /// cref="AnalogInput"/> and , using a shared
/// DeviceName.
///
[TypeConverter(typeof(SortedPropertyConverter))]
- [Description("Configures the ONIX breakout board's analog inputs and outputs.")]
- public class ConfigureBreakoutAnalogIO : SingleDeviceFactory
+ [Description("Configures analog inputs and outputs.")]
+ public class ConfigureAnalogIO : SingleDeviceFactory
{
///
- /// Initialize a new instance of class.
+ /// Initialize a new instance of class.
///
- public ConfigureBreakoutAnalogIO()
- : base(typeof(BreakoutAnalogIO))
+ public ConfigureAnalogIO()
+ : base(typeof(AnalogIO))
{
DeviceAddress = 6;
}
@@ -29,7 +33,7 @@ public ConfigureBreakoutAnalogIO()
/// Gets or sets the device enable state.
///
///
- /// If set to true, will produce data. If set to false, will not produce data.
+ /// If set to true, will produce data. If set to false, will not produce data.
///
[Category(ConfigurationCategory)]
[Description("Specifies whether the analog IO device is enabled.")]
@@ -40,168 +44,168 @@ public ConfigureBreakoutAnalogIO()
///
[Category(ConfigurationCategory)]
[Description("The input voltage range of channel 0.")]
- public BreakoutAnalogIOVoltageRange InputRange0 { get; set; }
+ public AnalogIOVoltageRange InputRange0 { get; set; }
///
/// Gets or sets the input voltage range of channel 1.
///
[Category(ConfigurationCategory)]
[Description("The input voltage range of channel 1.")]
- public BreakoutAnalogIOVoltageRange InputRange1 { get; set; }
+ public AnalogIOVoltageRange InputRange1 { get; set; }
///
/// Gets or sets the input voltage range of channel 2.
///
[Category(ConfigurationCategory)]
[Description("The input voltage range of channel 2.")]
- public BreakoutAnalogIOVoltageRange InputRange2 { get; set; }
+ public AnalogIOVoltageRange InputRange2 { get; set; }
///
/// Gets or sets the input voltage range of channel 3.
///
[Category(ConfigurationCategory)]
[Description("The input voltage range of channel 3.")]
- public BreakoutAnalogIOVoltageRange InputRange3 { get; set; }
+ public AnalogIOVoltageRange InputRange3 { get; set; }
///
/// Gets or sets the input voltage range of channel 4.
///
[Category(ConfigurationCategory)]
[Description("The input voltage range of channel 4.")]
- public BreakoutAnalogIOVoltageRange InputRange4 { get; set; }
+ public AnalogIOVoltageRange InputRange4 { get; set; }
///
/// Gets or sets the input voltage range of channel 5.
///
[Category(ConfigurationCategory)]
[Description("The input voltage range of channel 5.")]
- public BreakoutAnalogIOVoltageRange InputRange5 { get; set; }
+ public AnalogIOVoltageRange InputRange5 { get; set; }
///
/// Gets or sets the input voltage range of channel 6.
///
[Category(ConfigurationCategory)]
[Description("The input voltage range of channel 6.")]
- public BreakoutAnalogIOVoltageRange InputRange6 { get; set; }
+ public AnalogIOVoltageRange InputRange6 { get; set; }
///
/// Gets or sets the input voltage range of channel 7.
///
[Category(ConfigurationCategory)]
[Description("The input voltage range of channel 7.")]
- public BreakoutAnalogIOVoltageRange InputRange7 { get; set; }
+ public AnalogIOVoltageRange InputRange7 { get; set; }
///
/// Gets or sets the input voltage range of channel 8.
///
[Category(ConfigurationCategory)]
[Description("The input voltage range of channel 8.")]
- public BreakoutAnalogIOVoltageRange InputRange8 { get; set; }
+ public AnalogIOVoltageRange InputRange8 { get; set; }
///
/// Gets or sets the input voltage range of channel 9.
///
[Category(ConfigurationCategory)]
[Description("The input voltage range of channel 9.")]
- public BreakoutAnalogIOVoltageRange InputRange9 { get; set; }
+ public AnalogIOVoltageRange InputRange9 { get; set; }
///
/// Gets or sets the input voltage range of channel 10.
///
[Category(ConfigurationCategory)]
[Description("The input voltage range of channel 10.")]
- public BreakoutAnalogIOVoltageRange InputRange10 { get; set; }
+ public AnalogIOVoltageRange InputRange10 { get; set; }
///
/// Gets or sets the input voltage range of channel 11.
///
[Category(ConfigurationCategory)]
[Description("The input voltage range of channel 11.")]
- public BreakoutAnalogIOVoltageRange InputRange11 { get; set; }
+ public AnalogIOVoltageRange InputRange11 { get; set; }
///
/// Gets or sets the direction of channel 0.
///
[Category(ConfigurationCategory)]
[Description("The direction of channel 0.")]
- public BreakoutAnalogIODirection Direction0 { get; set; }
+ public AnalogIODirection Direction0 { get; set; }
///
/// Gets or sets the direction of channel 1.
///
[Category(ConfigurationCategory)]
[Description("The direction of channel 1.")]
- public BreakoutAnalogIODirection Direction1 { get; set; }
+ public AnalogIODirection Direction1 { get; set; }
///
/// Gets or sets the direction of channel 2.
///
[Category(ConfigurationCategory)]
[Description("The direction of channel 2.")]
- public BreakoutAnalogIODirection Direction2 { get; set; }
+ public AnalogIODirection Direction2 { get; set; }
///
/// Gets or sets the direction of channel 3.
///
[Category(ConfigurationCategory)]
[Description("The direction of channel 3.")]
- public BreakoutAnalogIODirection Direction3 { get; set; }
+ public AnalogIODirection Direction3 { get; set; }
///
/// Gets or sets the direction of channel 4.
///
[Category(ConfigurationCategory)]
[Description("The direction of channel 4.")]
- public BreakoutAnalogIODirection Direction4 { get; set; }
+ public AnalogIODirection Direction4 { get; set; }
///
/// Gets or sets the direction of channel 5.
///
[Category(ConfigurationCategory)]
[Description("The direction of channel 5.")]
- public BreakoutAnalogIODirection Direction5 { get; set; }
+ public AnalogIODirection Direction5 { get; set; }
///
/// Gets or sets the direction of channel 6.
///
[Category(ConfigurationCategory)]
[Description("The direction of channel 6.")]
- public BreakoutAnalogIODirection Direction6 { get; set; }
+ public AnalogIODirection Direction6 { get; set; }
///
/// Gets or sets the direction of channel 7.
///
[Category(ConfigurationCategory)]
[Description("The direction of channel 7.")]
- public BreakoutAnalogIODirection Direction7 { get; set; }
+ public AnalogIODirection Direction7 { get; set; }
///
/// Gets or sets the direction of channel 8.
///
[Category(ConfigurationCategory)]
[Description("The direction of channel 8.")]
- public BreakoutAnalogIODirection Direction8 { get; set; }
+ public AnalogIODirection Direction8 { get; set; }
///
/// Gets or sets the direction of channel 9.
///
[Category(ConfigurationCategory)]
[Description("The direction of channel 9.")]
- public BreakoutAnalogIODirection Direction9 { get; set; }
+ public AnalogIODirection Direction9 { get; set; }
///
/// Gets or sets the direction of channel 10.
///
[Category(ConfigurationCategory)]
[Description("The direction of channel 10.")]
- public BreakoutAnalogIODirection Direction10 { get; set; }
+ public AnalogIODirection Direction10 { get; set; }
///
/// Gets or sets the direction of channel 11.
///
[Category(ConfigurationCategory)]
[Description("The direction of channel 11.")]
- public BreakoutAnalogIODirection Direction11 { get; set; }
+ public AnalogIODirection Direction11 { get; set; }
///
/// Configures the analog input and output device in the ONIX breakout board.
@@ -224,22 +228,22 @@ public override IObservable Process(IObservable source
return source.ConfigureDevice(context =>
{
var device = context.GetDeviceContext(deviceAddress, DeviceType);
- device.WriteRegister(BreakoutAnalogIO.ENABLE, Enable ? 1u : 0u);
- device.WriteRegister(BreakoutAnalogIO.CH00INRANGE, (uint)InputRange0);
- device.WriteRegister(BreakoutAnalogIO.CH01INRANGE, (uint)InputRange1);
- device.WriteRegister(BreakoutAnalogIO.CH02INRANGE, (uint)InputRange2);
- device.WriteRegister(BreakoutAnalogIO.CH03INRANGE, (uint)InputRange3);
- device.WriteRegister(BreakoutAnalogIO.CH04INRANGE, (uint)InputRange4);
- device.WriteRegister(BreakoutAnalogIO.CH05INRANGE, (uint)InputRange5);
- device.WriteRegister(BreakoutAnalogIO.CH06INRANGE, (uint)InputRange6);
- device.WriteRegister(BreakoutAnalogIO.CH07INRANGE, (uint)InputRange7);
- device.WriteRegister(BreakoutAnalogIO.CH08INRANGE, (uint)InputRange8);
- device.WriteRegister(BreakoutAnalogIO.CH09INRANGE, (uint)InputRange9);
- device.WriteRegister(BreakoutAnalogIO.CH10INRANGE, (uint)InputRange10);
- device.WriteRegister(BreakoutAnalogIO.CH11INRANGE, (uint)InputRange11);
+ device.WriteRegister(AnalogIO.ENABLE, Enable ? 1u : 0u);
+ device.WriteRegister(AnalogIO.CH00INRANGE, (uint)InputRange0);
+ device.WriteRegister(AnalogIO.CH01INRANGE, (uint)InputRange1);
+ device.WriteRegister(AnalogIO.CH02INRANGE, (uint)InputRange2);
+ device.WriteRegister(AnalogIO.CH03INRANGE, (uint)InputRange3);
+ device.WriteRegister(AnalogIO.CH04INRANGE, (uint)InputRange4);
+ device.WriteRegister(AnalogIO.CH05INRANGE, (uint)InputRange5);
+ device.WriteRegister(AnalogIO.CH06INRANGE, (uint)InputRange6);
+ device.WriteRegister(AnalogIO.CH07INRANGE, (uint)InputRange7);
+ device.WriteRegister(AnalogIO.CH08INRANGE, (uint)InputRange8);
+ device.WriteRegister(AnalogIO.CH09INRANGE, (uint)InputRange9);
+ device.WriteRegister(AnalogIO.CH10INRANGE, (uint)InputRange10);
+ device.WriteRegister(AnalogIO.CH11INRANGE, (uint)InputRange11);
// Build the whole value for CHDIR and write it once
- static uint SetIO(uint io_reg, int channel, BreakoutAnalogIODirection direction) =>
+ static uint SetIO(uint io_reg, int channel, AnalogIODirection direction) =>
(io_reg & ~((uint)1 << channel)) | ((uint)(direction) << channel);
var io_reg = 0u;
@@ -255,9 +259,9 @@ static uint SetIO(uint io_reg, int channel, BreakoutAnalogIODirection direction)
io_reg = SetIO(io_reg, 9, Direction9);
io_reg = SetIO(io_reg, 10, Direction10);
io_reg = SetIO(io_reg, 11, Direction11);
- device.WriteRegister(BreakoutAnalogIO.CHDIR, io_reg);
+ device.WriteRegister(AnalogIO.CHDIR, io_reg);
- var deviceInfo = new BreakoutAnalogIODeviceInfo(device, this);
+ var deviceInfo = new AnalogIODeviceInfo(device, this);
return DeviceManager.RegisterDevice(deviceName, deviceInfo);
});
}
@@ -268,8 +272,8 @@ public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContex
{
var properties = base.GetProperties(context, value, attributes);
var sortedOrder = properties.Cast()
- .Where(p => p.PropertyType == typeof(BreakoutAnalogIOVoltageRange)
- || p.PropertyType == typeof(BreakoutAnalogIODirection))
+ .Where(p => p.PropertyType == typeof(AnalogIOVoltageRange)
+ || p.PropertyType == typeof(AnalogIODirection))
.OrderBy(p => p.PropertyType.MetadataToken)
.Select(p => p.Name)
.Prepend(nameof(Enable))
@@ -279,7 +283,7 @@ public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContex
}
}
- static class BreakoutAnalogIO
+ static class AnalogIO
{
public const int ID = 22;
@@ -307,15 +311,15 @@ static class BreakoutAnalogIO
internal class NameConverter : DeviceNameConverter
{
public NameConverter()
- : base(typeof(BreakoutAnalogIO))
+ : base(typeof(AnalogIO))
{
}
}
}
- class BreakoutAnalogIODeviceInfo : DeviceInfo
+ class AnalogIODeviceInfo : DeviceInfo
{
- public BreakoutAnalogIODeviceInfo(DeviceContext device, ConfigureBreakoutAnalogIO deviceFactory)
+ public AnalogIODeviceInfo(DeviceContext device, ConfigureAnalogIO deviceFactory)
: base(device, deviceFactory.DeviceType)
{
VoltsPerDivision = new[]
@@ -335,13 +339,13 @@ public BreakoutAnalogIODeviceInfo(DeviceContext device, ConfigureBreakoutAnalogI
};
}
- public static float GetVoltsPerDivision(BreakoutAnalogIOVoltageRange voltageRange)
+ public static float GetVoltsPerDivision(AnalogIOVoltageRange voltageRange)
{
return voltageRange switch
{
- BreakoutAnalogIOVoltageRange.TenVolts => 20.0f / BreakoutAnalogIO.NumberOfDivisions,
- BreakoutAnalogIOVoltageRange.TwoPointFiveVolts => 5.0f / BreakoutAnalogIO.NumberOfDivisions,
- BreakoutAnalogIOVoltageRange.FiveVolts => 10.0f / BreakoutAnalogIO.NumberOfDivisions,
+ AnalogIOVoltageRange.TenVolts => 20.0f / AnalogIO.NumberOfDivisions,
+ AnalogIOVoltageRange.TwoPointFiveVolts => 5.0f / AnalogIO.NumberOfDivisions,
+ AnalogIOVoltageRange.FiveVolts => 10.0f / AnalogIO.NumberOfDivisions,
_ => throw new ArgumentOutOfRangeException(nameof(voltageRange)),
};
}
@@ -352,7 +356,7 @@ public static float GetVoltsPerDivision(BreakoutAnalogIOVoltageRange voltageRang
///
/// Specifies the analog input ADC voltage range.
///
- public enum BreakoutAnalogIOVoltageRange
+ public enum AnalogIOVoltageRange
{
///
/// ±10.0 volts.
@@ -374,7 +378,7 @@ public enum BreakoutAnalogIOVoltageRange
///
/// Specifies analog channel direction.
///
- public enum BreakoutAnalogIODirection
+ public enum AnalogIODirection
{
///
/// Input to breakout board.
@@ -389,7 +393,7 @@ public enum BreakoutAnalogIODirection
///
/// Specifies the analog sample representation.
///
- public enum BreakoutAnalogIODataType
+ public enum AnalogIODataType
{
///
/// Twos-complement encoded signed 16-bit integer
diff --git a/OpenEphys.Onix1/ConfigureBreakoutBoard.cs b/OpenEphys.Onix1/ConfigureBreakoutBoard.cs
index 0c1b878d..881163c3 100644
--- a/OpenEphys.Onix1/ConfigureBreakoutBoard.cs
+++ b/OpenEphys.Onix1/ConfigureBreakoutBoard.cs
@@ -36,7 +36,7 @@ public class ConfigureBreakoutBoard : MultiDeviceFactory
[TypeConverter(typeof(SingleDeviceFactoryConverter))]
[Description("Specifies the configuration for the analog IO device in the ONIX breakout board.")]
[Category(DevicesCategory)]
- public ConfigureBreakoutAnalogIO AnalogIO { get; set; } = new();
+ public ConfigureAnalogIO AnalogIO { get; set; } = new();
///
/// Gets or sets the breakout board's digital IO configuration.
@@ -44,7 +44,7 @@ public class ConfigureBreakoutBoard : MultiDeviceFactory
[TypeConverter(typeof(SingleDeviceFactoryConverter))]
[Description("Specifies the configuration for the digital IO device in the ONIX breakout board.")]
[Category(DevicesCategory)]
- public ConfigureBreakoutDigitalIO DigitalIO { get; set; } = new();
+ public ConfigureDigitalIO DigitalIO { get; set; } = new();
///
/// Gets or sets the breakout board's output clock configuration.
diff --git a/OpenEphys.Onix1/ConfigureBreakoutDigitalIO.cs b/OpenEphys.Onix1/ConfigureDigitalIO.cs
similarity index 86%
rename from OpenEphys.Onix1/ConfigureBreakoutDigitalIO.cs
rename to OpenEphys.Onix1/ConfigureDigitalIO.cs
index f20e7b6e..75841e9f 100644
--- a/OpenEphys.Onix1/ConfigureBreakoutDigitalIO.cs
+++ b/OpenEphys.Onix1/ConfigureDigitalIO.cs
@@ -3,22 +3,26 @@
namespace OpenEphys.Onix1
{
+ ///
+ [Obsolete("Use ConfigureDigitalIO instead. This operator will be removed in version 1.0.0v")]
+ public class ConfigureBreakoutDigitalIO : ConfigureDigitalIO { }
+
///
/// Configures the ONIX breakout board's digital inputs and outputs.
///
///
/// This configuration operator can be linked to data IO operators, such as and , using a shared
+ /// cref="DigitalInput"/> and , using a shared
/// DeviceName.
///
[Description("Configures the ONIX breakout board's digital inputs and outputs.")]
- public class ConfigureBreakoutDigitalIO : SingleDeviceFactory
+ public class ConfigureDigitalIO : SingleDeviceFactory
{
///
- /// Initialize a new instance of the class.
+ /// Initialize a new instance of the class.
///
- public ConfigureBreakoutDigitalIO()
- : base(typeof(BreakoutDigitalIO))
+ public ConfigureDigitalIO()
+ : base(typeof(DigitalIO))
{
DeviceAddress = 7;
}
@@ -27,8 +31,8 @@ public ConfigureBreakoutDigitalIO()
/// Gets or sets the device enable state.
///
///
- /// If set to true, will produce data. If set to false, will not produce data.
+ /// If set to true, will produce data. If set to false, will not produce data.
///
[Category(ConfigurationCategory)]
[Description("Specifies whether the digital IO device is enabled.")]
@@ -54,13 +58,13 @@ public override IObservable Process(IObservable source
return source.ConfigureDevice(context =>
{
var device = context.GetDeviceContext(deviceAddress, DeviceType);
- device.WriteRegister(BreakoutDigitalIO.ENABLE, Enable ? 1u : 0);
+ device.WriteRegister(DigitalIO.ENABLE, Enable ? 1u : 0);
return DeviceManager.RegisterDevice(deviceName, device, DeviceType);
});
}
}
- static class BreakoutDigitalIO
+ static class DigitalIO
{
public const int ID = 18;
@@ -70,7 +74,7 @@ static class BreakoutDigitalIO
internal class NameConverter : DeviceNameConverter
{
public NameConverter()
- : base(typeof(BreakoutDigitalIO))
+ : base(typeof(DigitalIO))
{
}
}
@@ -80,7 +84,7 @@ public NameConverter()
/// Specifies the state of the ONIX breakout board's digital input pins.
///
[Flags]
- public enum BreakoutDigitalPortState : ushort
+ public enum DigitalPortState : ushort
{
///
/// Specifies that pin 0 is high.
diff --git a/OpenEphys.Onix1/BreakoutDigitalInput.cs b/OpenEphys.Onix1/DigitalInput.cs
similarity index 67%
rename from OpenEphys.Onix1/BreakoutDigitalInput.cs
rename to OpenEphys.Onix1/DigitalInput.cs
index 4f087be3..1e88e804 100644
--- a/OpenEphys.Onix1/BreakoutDigitalInput.cs
+++ b/OpenEphys.Onix1/DigitalInput.cs
@@ -6,18 +6,22 @@
namespace OpenEphys.Onix1
{
+ ///
+ [Obsolete("Use DigitalInput instead. This operator will be removed in version 1.0.0")]
+ public class BreakoutDigitalInput : DigitalInput { }
+
///
/// Produces a sequence of digital input data from an ONIX breakout board.
///
///
/// This data IO operator must be linked to an appropriate configuration, such as a , using a shared DeviceName.
+ /// cref="ConfigureDigitalIO"/>, using a shared DeviceName.
///
[Description("Produces a sequence of digital input frames from an ONIX breakout board.")]
- public class BreakoutDigitalInput : Source
+ public class DigitalInput : Source
{
///
- [TypeConverter(typeof(BreakoutDigitalIO.NameConverter))]
+ [TypeConverter(typeof(DigitalIO.NameConverter))]
[Description(SingleDeviceFactory.DeviceNameDescription)]
[Category(DeviceFactory.ConfigurationCategory)]
public string DeviceName { get; set; }
@@ -27,18 +31,18 @@ public class BreakoutDigitalInput : Source
/// breakout board's digital input state.
///
///
- /// Digital inputs are sampled at 4 MHz but a is produced
+ /// Digital inputs are sampled at 4 MHz but a is produced
/// only when a button, switch, or digital input pin is toggled.
///
- /// A sequence of objects.
- public unsafe override IObservable Generate()
+ /// A sequence of objects.
+ public unsafe override IObservable Generate()
{
return DeviceManager.GetDevice(DeviceName).SelectMany(deviceInfo =>
{
- var device = deviceInfo.GetDeviceContext(typeof(BreakoutDigitalIO));
+ var device = deviceInfo.GetDeviceContext(typeof(DigitalIO));
return deviceInfo.Context
.GetDeviceFrames(device.Address)
- .Select(frame => new BreakoutDigitalInputDataFrame(frame));
+ .Select(frame => new DigitalInputDataFrame(frame));
});
}
}
diff --git a/OpenEphys.Onix1/BreakoutDigitalInputDataFrame.cs b/OpenEphys.Onix1/DigitalInputDataFrame.cs
similarity index 67%
rename from OpenEphys.Onix1/BreakoutDigitalInputDataFrame.cs
rename to OpenEphys.Onix1/DigitalInputDataFrame.cs
index 2a018303..371bc099 100644
--- a/OpenEphys.Onix1/BreakoutDigitalInputDataFrame.cs
+++ b/OpenEphys.Onix1/DigitalInputDataFrame.cs
@@ -5,16 +5,16 @@ namespace OpenEphys.Onix1
///
/// A digital event produced by the ONIX breakout board.
///
- public class BreakoutDigitalInputDataFrame : DataFrame
+ public class DigitalInputDataFrame : DataFrame
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// A frame produced by an ONIX breakout board's digital IO device.
- public unsafe BreakoutDigitalInputDataFrame(oni.Frame frame)
+ public unsafe DigitalInputDataFrame(oni.Frame frame)
: base(frame.Clock)
{
- var payload = (BreakoutDigitalInputPayload*)frame.Data.ToPointer();
+ var payload = (DigitalInputPayload*)frame.Data.ToPointer();
HubClock = payload->HubClock;
DigitalInputs = payload->DigitalInputs;
Buttons = payload->Buttons;
@@ -23,7 +23,7 @@ public unsafe BreakoutDigitalInputDataFrame(oni.Frame frame)
///
/// Gets the state of the breakout board's 8-bit digital input port.
///
- public BreakoutDigitalPortState DigitalInputs { get; }
+ public DigitalPortState DigitalInputs { get; }
///
/// Gets the state of the breakout board's buttons and switches.
@@ -32,10 +32,10 @@ public unsafe BreakoutDigitalInputDataFrame(oni.Frame frame)
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- struct BreakoutDigitalInputPayload
+ struct DigitalInputPayload
{
public ulong HubClock;
- public BreakoutDigitalPortState DigitalInputs;
+ public DigitalPortState DigitalInputs;
public BreakoutButtonState Buttons;
}
}
diff --git a/OpenEphys.Onix1/BreakoutDigitalOutput.cs b/OpenEphys.Onix1/DigitalOutput.cs
similarity index 63%
rename from OpenEphys.Onix1/BreakoutDigitalOutput.cs
rename to OpenEphys.Onix1/DigitalOutput.cs
index 249916e7..2a23f112 100644
--- a/OpenEphys.Onix1/BreakoutDigitalOutput.cs
+++ b/OpenEphys.Onix1/DigitalOutput.cs
@@ -6,18 +6,22 @@
namespace OpenEphys.Onix1
{
+ ///
+ [Obsolete("Use DigitalOutput instead. This operator will be removed in version 1.0.0")]
+ public class BreakoutDigitalOutput : DigitalOutput { }
+
///
/// Sends digital output data to an ONIX breakout board.
///
///
/// This data IO operator must be linked to an appropriate configuration, such as a , using a shared DeviceName.
+ /// cref="ConfigureDigitalIO"/>, using a shared DeviceName.
///
[Description("Sends digital output data to an ONIX breakout board.")]
- public class BreakoutDigitalOutput : Sink
+ public class DigitalOutput : Sink
{
///
- [TypeConverter(typeof(BreakoutDigitalIO.NameConverter))]
+ [TypeConverter(typeof(DigitalIO.NameConverter))]
[Description(SingleDeviceFactory.DeviceNameDescription)]
[Category(DeviceFactory.ConfigurationCategory)]
public string DeviceName { get; set; }
@@ -25,13 +29,13 @@ public class BreakoutDigitalOutput : Sink
///
/// Updates the digital output port state.
///
- /// A sequence of values indicating the state of the breakout board's 8 digital output pins
+ /// A sequence of values indicating the state of the breakout board's 8 digital output pins
/// A sequence that is identical to .
- public override IObservable Process(IObservable source)
+ public override IObservable Process(IObservable source)
{
return DeviceManager.GetDevice(DeviceName).SelectMany(deviceInfo =>
{
- var device = deviceInfo.GetDeviceContext(typeof(BreakoutDigitalIO));
+ var device = deviceInfo.GetDeviceContext(typeof(DigitalIO));
return source.Do(value => device.Write((uint)value));
});
}
diff --git a/OpenEphys.Onix1/StartAcquisition.cs b/OpenEphys.Onix1/StartAcquisition.cs
index bf878426..078f540b 100644
--- a/OpenEphys.Onix1/StartAcquisition.cs
+++ b/OpenEphys.Onix1/StartAcquisition.cs
@@ -34,7 +34,7 @@ namespace OpenEphys.Onix1
///
///
/// These pre-sorted frame sequences can be interpreted by downstream Data I/O operators (e.g. or ) that convert or ) that convert ONI Data Frames into
/// data types that are are more amenable to processing within Bonsai workflows.
///