提交 f2fd649f 编写于 作者: G Greg Ingram 提交者: Jose Perez Rodriguez

Fixed naming for seconds (#636)

上级 74be68ef
......@@ -16,7 +16,7 @@ namespace System.Device.Gpio.Tests
private const int LedPin = 18;
private const int OutputPin = 16;
private const int InputPin = 12;
private static readonly int WaitMilliSeconds = 1000;
private static readonly int WaitMilliseconds = 1000;
[Fact]
public void ControllerCanTurnOnLEDs()
......@@ -143,7 +143,7 @@ namespace System.Device.Gpio.Tests
controller.Write(OutputPin, PinValue.Low);
controller.RegisterCallbackForPinValueChangedEvent(InputPin, PinEventTypes.Rising, callback);
controller.Write(OutputPin, PinValue.High);
Thread.Sleep(WaitMilliSeconds);
Thread.Sleep(WaitMilliseconds);
Assert.True(wasCalled);
}
......@@ -164,7 +164,7 @@ namespace System.Device.Gpio.Tests
controller.Write(OutputPin, PinValue.Low);
controller.RegisterCallbackForPinValueChangedEvent(InputPin, PinEventTypes.Falling, callback);
controller.Write(OutputPin, PinValue.High);
Thread.Sleep(WaitMilliSeconds);
Thread.Sleep(WaitMilliseconds);
Assert.False(wasCalled);
}
......@@ -203,9 +203,9 @@ namespace System.Device.Gpio.Tests
for (int i = 0; i < 10; i++)
{
controller.Write(OutputPin, PinValue.High);
Thread.Sleep(WaitMilliSeconds);
Thread.Sleep(WaitMilliseconds);
controller.Write(OutputPin, PinValue.Low);
Thread.Sleep(WaitMilliSeconds);
Thread.Sleep(WaitMilliseconds);
}
Assert.Equal(25, risingEventOccuredCount);
......@@ -243,16 +243,16 @@ namespace System.Device.Gpio.Tests
controller.RegisterCallbackForPinValueChangedEvent(InputPin, PinEventTypes.Rising, callback4);
controller.Write(OutputPin, PinValue.High);
Thread.Sleep(WaitMilliSeconds);
Thread.Sleep(WaitMilliseconds);
controller.UnregisterCallbackForPinValueChangedEvent(InputPin, callback1);
controller.UnregisterCallbackForPinValueChangedEvent(InputPin, callback2);
controller.UnregisterCallbackForPinValueChangedEvent(InputPin, callback3);
controller.UnregisterCallbackForPinValueChangedEvent(InputPin, callback4);
Thread.Sleep(WaitMilliSeconds);
Thread.Sleep(WaitMilliseconds);
controller.Write(OutputPin, PinValue.Low);
Thread.Sleep(WaitMilliSeconds);
Thread.Sleep(WaitMilliseconds);
controller.Write(OutputPin, PinValue.High);
Assert.Equal(1, risingEventOccuredCount);
......@@ -283,11 +283,11 @@ namespace System.Device.Gpio.Tests
[Fact]
[Trait("SkipOnTestRun", "Windows_NT")] // The windows driver is returning none as the event type.
public void WaitForEventCancelAfter10MilliSecondsTest()
public void WaitForEventCancelAfter10MillisecondsTest()
{
using (GpioController controller = new GpioController(GetTestNumberingScheme(), GetTestDriver()))
{
CancellationTokenSource tokenSource = new CancellationTokenSource(WaitMilliSeconds);
CancellationTokenSource tokenSource = new CancellationTokenSource(WaitMilliseconds);
controller.OpenPin(InputPin, PinMode.Input);
controller.OpenPin(OutputPin, PinMode.Output);
controller.Write(OutputPin, PinValue.Low);
......@@ -311,7 +311,7 @@ namespace System.Device.Gpio.Tests
Task.Run(() =>
{
Thread.Sleep(WaitMilliSeconds);
Thread.Sleep(WaitMilliseconds);
controller.Write(OutputPin, PinValue.High);
});
......@@ -335,7 +335,7 @@ namespace System.Device.Gpio.Tests
Task.Run(() =>
{
controller.Write(OutputPin, PinValue.High);
Thread.Sleep(WaitMilliSeconds);
Thread.Sleep(WaitMilliseconds);
controller.Write(OutputPin, PinValue.Low);
});
......
......@@ -77,7 +77,7 @@ namespace System.Device.Pwm.Channels
/// </summary>
/// <param name="frequency">The frequency in hertz.</param>
/// <returns>The frequency period in nanoseconds.</returns>
private static int GetPeriodInNanoSeconds(int frequency)
private static int GetPeriodInNanoseconds(int frequency)
{
// In Linux, the period needs to be a whole number and can't have a decimal point.
return (int)((1.0 / frequency) * 1_000_000_000);
......@@ -94,8 +94,8 @@ namespace System.Device.Pwm.Channels
throw new ArgumentOutOfRangeException(nameof(frequency), frequency, "Value must not be negative.");
}
int periodInNanoSeconds = GetPeriodInNanoSeconds(frequency);
File.WriteAllText($"{_channelPath}/period", Convert.ToString(periodInNanoSeconds));
int periodInNanoseconds = GetPeriodInNanoseconds(frequency);
File.WriteAllText($"{_channelPath}/period", Convert.ToString(periodInNanoseconds));
_frequency = frequency;
}
......@@ -111,8 +111,8 @@ namespace System.Device.Pwm.Channels
}
// In Linux, the period needs to be a whole number and can't have decimal point.
int dutyCycleInNanoSeconds = (int)(GetPeriodInNanoSeconds(_frequency) * dutyCyclePercentage);
File.WriteAllText($"{_channelPath}/duty_cycle", Convert.ToString(dutyCycleInNanoSeconds));
int dutyCycleInNanoseconds = (int)(GetPeriodInNanoseconds(_frequency) * dutyCyclePercentage);
File.WriteAllText($"{_channelPath}/duty_cycle", Convert.ToString(dutyCycleInNanoseconds));
_dutyCyclePercentage = dutyCyclePercentage;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册