Skip to content

Commit e6f499a

Browse files
committed
Normalize line endings
1 parent 17af2c7 commit e6f499a

File tree

1,015 files changed

+82423
-82423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,015 files changed

+82423
-82423
lines changed

Bonsai.Arduino/AnalogInput.cs

+39-39
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
using System;
2-
using System.ComponentModel;
3-
4-
namespace Bonsai.Arduino
5-
{
6-
/// <summary>
7-
/// Represents an operator that generates a sequence of digitized analog readings
8-
/// from the specified Arduino input pin.
9-
/// </summary>
10-
[DefaultProperty(nameof(Pin))]
11-
[Description("Generates a sequence of digitized analog readings from the specified Arduino input pin.")]
12-
public class AnalogInput : Source<int>
13-
{
14-
/// <summary>
15-
/// Gets or sets the name of the serial port used to communicate with the Arduino.
16-
/// </summary>
17-
[TypeConverter(typeof(PortNameConverter))]
18-
[Description("The name of the serial port used to communicate with the Arduino.")]
19-
public string PortName { get; set; }
20-
21-
/// <summary>
22-
/// Gets or sets the analog input pin number from which to take readings.
23-
/// </summary>
24-
[Description("The analog input pin number from which to take readings.")]
25-
public int Pin { get; set; }
26-
27-
/// <summary>
28-
/// Generates an observable sequence of digitized analog values.
29-
/// </summary>
30-
/// <returns>
31-
/// A sequence of <see cref="int"/> values that report the digitized analog
32-
/// readings from the specified Arduino analog input pin.
33-
/// </returns>
34-
public override IObservable<int> Generate()
35-
{
36-
return ObservableArduino.AnalogInput(PortName, Pin);
37-
}
38-
}
39-
}
1+
using System;
2+
using System.ComponentModel;
3+
4+
namespace Bonsai.Arduino
5+
{
6+
/// <summary>
7+
/// Represents an operator that generates a sequence of digitized analog readings
8+
/// from the specified Arduino input pin.
9+
/// </summary>
10+
[DefaultProperty(nameof(Pin))]
11+
[Description("Generates a sequence of digitized analog readings from the specified Arduino input pin.")]
12+
public class AnalogInput : Source<int>
13+
{
14+
/// <summary>
15+
/// Gets or sets the name of the serial port used to communicate with the Arduino.
16+
/// </summary>
17+
[TypeConverter(typeof(PortNameConverter))]
18+
[Description("The name of the serial port used to communicate with the Arduino.")]
19+
public string PortName { get; set; }
20+
21+
/// <summary>
22+
/// Gets or sets the analog input pin number from which to take readings.
23+
/// </summary>
24+
[Description("The analog input pin number from which to take readings.")]
25+
public int Pin { get; set; }
26+
27+
/// <summary>
28+
/// Generates an observable sequence of digitized analog values.
29+
/// </summary>
30+
/// <returns>
31+
/// A sequence of <see cref="int"/> values that report the digitized analog
32+
/// readings from the specified Arduino analog input pin.
33+
/// </returns>
34+
public override IObservable<int> Generate()
35+
{
36+
return ObservableArduino.AnalogInput(PortName, Pin);
37+
}
38+
}
39+
}
+32-32
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
using System;
2-
3-
namespace Bonsai.Arduino
4-
{
5-
/// <summary>
6-
/// Provides data for the <see cref="Arduino.AnalogInputReceived"/> event.
7-
/// </summary>
8-
public class AnalogInputReceivedEventArgs : EventArgs
9-
{
10-
/// <summary>
11-
/// Initializes a new instance of the <see cref="AnalogInputReceivedEventArgs"/>
12-
/// class using the pin number and analog value received in the analog input message.
13-
/// </summary>
14-
/// <param name="pin">The pin number from which the analog value was sampled.</param>
15-
/// <param name="value">The digitized analog value.</param>
16-
public AnalogInputReceivedEventArgs(int pin, int value)
17-
{
18-
Pin = pin;
19-
Value = value;
20-
}
21-
22-
/// <summary>
23-
/// Gets the pin number from which the analog value was sampled.
24-
/// </summary>
25-
public int Pin { get; private set; }
26-
27-
/// <summary>
28-
/// Gets the digitized analog value.
29-
/// </summary>
30-
public int Value { get; private set; }
31-
}
32-
}
1+
using System;
2+
3+
namespace Bonsai.Arduino
4+
{
5+
/// <summary>
6+
/// Provides data for the <see cref="Arduino.AnalogInputReceived"/> event.
7+
/// </summary>
8+
public class AnalogInputReceivedEventArgs : EventArgs
9+
{
10+
/// <summary>
11+
/// Initializes a new instance of the <see cref="AnalogInputReceivedEventArgs"/>
12+
/// class using the pin number and analog value received in the analog input message.
13+
/// </summary>
14+
/// <param name="pin">The pin number from which the analog value was sampled.</param>
15+
/// <param name="value">The digitized analog value.</param>
16+
public AnalogInputReceivedEventArgs(int pin, int value)
17+
{
18+
Pin = pin;
19+
Value = value;
20+
}
21+
22+
/// <summary>
23+
/// Gets the pin number from which the analog value was sampled.
24+
/// </summary>
25+
public int Pin { get; private set; }
26+
27+
/// <summary>
28+
/// Gets the digitized analog value.
29+
/// </summary>
30+
public int Value { get; private set; }
31+
}
32+
}

Bonsai.Arduino/AnalogOutput.cs

+61-61
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
1-
using System;
2-
using System.ComponentModel;
3-
using System.Reactive.Linq;
4-
using System.Threading.Tasks;
5-
6-
namespace Bonsai.Arduino
7-
{
8-
/// <summary>
9-
/// Represents an operator that writes the sequence of numerical values to the
10-
/// specified Arduino output pin using PWM.
11-
/// </summary>
12-
[DefaultProperty(nameof(Pin))]
13-
[Description("Writes the sequence of numerical values to the specified Arduino output pin using PWM.")]
14-
public class AnalogOutput : Sink<int>
15-
{
16-
/// <summary>
17-
/// Gets or sets the name of the serial port used to communicate with the Arduino.
18-
/// </summary>
19-
[TypeConverter(typeof(PortNameConverter))]
20-
[Description("The name of the serial port used to communicate with the Arduino.")]
21-
public string PortName { get; set; }
22-
23-
/// <summary>
24-
/// Gets or sets the digital output (PWM) pin number on which to write values.
25-
/// </summary>
26-
[Description("The digital output (PWM) pin number on which to write values.")]
27-
public int Pin { get; set; }
28-
29-
/// <summary>
30-
/// Writes a sequence of <see cref="int"/> values to the specified Arduino output pin using PWM.
31-
/// </summary>
32-
/// <param name="source">
33-
/// A sequence of <see cref="int"/> values to write into the specified Arduino output pin.
34-
/// </param>
35-
/// <returns>
36-
/// A sequence of the <see cref="int"/> values which have been written into the Arduino
37-
/// output pin.
38-
/// </returns>
39-
/// <remarks>
40-
/// This operator only subscribes to the <paramref name="source"/> sequence after initializing
41-
/// the connection to the Arduino and configuring the output pin mode to PWM.
42-
/// </remarks>
43-
public override IObservable<int> Process(IObservable<int> source)
44-
{
45-
return Observable.Using(
46-
cancellationToken => ArduinoManager.ReserveConnectionAsync(PortName),
47-
(connection, cancellationToken) =>
48-
{
49-
var pin = Pin;
50-
connection.Arduino.PinMode(pin, PinMode.Pwm);
51-
return Task.FromResult(source.Do(value =>
52-
{
53-
lock (connection.Arduino)
54-
{
55-
connection.Arduino.AnalogWrite(pin, value);
56-
}
57-
}));
58-
});
59-
}
60-
}
61-
}
1+
using System;
2+
using System.ComponentModel;
3+
using System.Reactive.Linq;
4+
using System.Threading.Tasks;
5+
6+
namespace Bonsai.Arduino
7+
{
8+
/// <summary>
9+
/// Represents an operator that writes the sequence of numerical values to the
10+
/// specified Arduino output pin using PWM.
11+
/// </summary>
12+
[DefaultProperty(nameof(Pin))]
13+
[Description("Writes the sequence of numerical values to the specified Arduino output pin using PWM.")]
14+
public class AnalogOutput : Sink<int>
15+
{
16+
/// <summary>
17+
/// Gets or sets the name of the serial port used to communicate with the Arduino.
18+
/// </summary>
19+
[TypeConverter(typeof(PortNameConverter))]
20+
[Description("The name of the serial port used to communicate with the Arduino.")]
21+
public string PortName { get; set; }
22+
23+
/// <summary>
24+
/// Gets or sets the digital output (PWM) pin number on which to write values.
25+
/// </summary>
26+
[Description("The digital output (PWM) pin number on which to write values.")]
27+
public int Pin { get; set; }
28+
29+
/// <summary>
30+
/// Writes a sequence of <see cref="int"/> values to the specified Arduino output pin using PWM.
31+
/// </summary>
32+
/// <param name="source">
33+
/// A sequence of <see cref="int"/> values to write into the specified Arduino output pin.
34+
/// </param>
35+
/// <returns>
36+
/// A sequence of the <see cref="int"/> values which have been written into the Arduino
37+
/// output pin.
38+
/// </returns>
39+
/// <remarks>
40+
/// This operator only subscribes to the <paramref name="source"/> sequence after initializing
41+
/// the connection to the Arduino and configuring the output pin mode to PWM.
42+
/// </remarks>
43+
public override IObservable<int> Process(IObservable<int> source)
44+
{
45+
return Observable.Using(
46+
cancellationToken => ArduinoManager.ReserveConnectionAsync(PortName),
47+
(connection, cancellationToken) =>
48+
{
49+
var pin = Pin;
50+
connection.Arduino.PinMode(pin, PinMode.Pwm);
51+
return Task.FromResult(source.Do(value =>
52+
{
53+
lock (connection.Arduino)
54+
{
55+
connection.Arduino.AnalogWrite(pin, value);
56+
}
57+
}));
58+
});
59+
}
60+
}
61+
}

0 commit comments

Comments
 (0)