Skip to content

Commit b7dc215

Browse files
committed
Code style fixes
- Add missing license header in several files. - Fix typos in comments. - Several code style fixes.
1 parent 0f7f7a4 commit b7dc215

File tree

6 files changed

+50
-31
lines changed

6 files changed

+50
-31
lines changed

nanoFramework.Hardware.Esp32.Rmt.Benchmarks/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// See LICENSE file in the project root for full license information.
4+
//
5+
16
using nanoFramework.Benchmark;
27
using System;
38
using System.Diagnostics;

nanoFramework.Hardware.Esp32.Rmt.Benchmarks/SerializeCommandsBenchmark.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
using System.Collections;
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// See LICENSE file in the project root for full license information.
4+
//
5+
26
using nanoFramework.Benchmark;
37
using nanoFramework.Benchmark.Attributes;
8+
using System.Collections;
49

510
// ReSharper disable InconsistentNaming
611
namespace nanoFramework.Hardware.Esp32.Rmt.Benchmarks

nanoFramework.Hardware.Esp32.Rmt.UnitTests/RmtCommandSerializerTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
using System.Collections;
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// See LICENSE file in the project root for full license information.
4+
//
5+
26
using nanoFramework.TestFramework;
7+
using System.Collections;
38
// ReSharper disable InconsistentNaming
49

510
namespace nanoFramework.Hardware.Esp32.Rmt.UnitTests

nanoFramework.Hardware.Esp32.Rmt/ReceiverChannelSettings.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ public ushort IdleThreshold
5555
/// Gets or sets the filter state.
5656
/// If enabled, the receiver will ignore pulses with widths less than specified in <see cref="FilterThreshold"/>.
5757
/// </summary>
58-
public bool EnableFilter
59-
{
60-
get => _enableFilter;
58+
public bool EnableFilter
59+
{
60+
get => _enableFilter;
6161
set => _enableFilter = value;
6262
}
6363

@@ -71,18 +71,18 @@ public bool EnableFilter
7171
/// If the <see cref="RmtChannelSettings.ClockDivider"/> is set to 80 then the clock (80Mhz) will tick at a rate of 1Mhz (80Mhz / 80 = 1Mhz) making each clock tick equal to 1 microsecond.
7272
/// Therefore, setting <see cref="FilterThreshold"/> to a value like 100 will cause the receiver channel to ignore any pulses that are shorter than 100 microseconds.
7373
/// </remarks>
74-
public byte FilterThreshold
75-
{
76-
get => _filterThreshold;
74+
public byte FilterThreshold
75+
{
76+
get => _filterThreshold;
7777
set => _filterThreshold = value;
7878
}
7979

8080
/// <summary>
8181
/// Gets or sets the timeout threshold for the <see cref="ReceiverChannel.GetAllItems"/> call. Defaults to 1 second.
8282
/// </summary>
83-
public TimeSpan ReceiveTimeout
84-
{
85-
get => _receiveTimeout;
83+
public TimeSpan ReceiveTimeout
84+
{
85+
get => _receiveTimeout;
8686
set => _receiveTimeout = value;
8787
}
8888

@@ -176,7 +176,7 @@ public ReceiverChannelSettings(int channel, int pinNumber) : base(channel, pinNu
176176
_enableDemodulation = true;
177177
_carrierWaveFrequency = 38_000;
178178
_carrierWaveDutyPercentage = 33;
179-
_carrierLevel= true;
179+
_carrierLevel = true;
180180
}
181181

182182
/// <summary>
@@ -189,10 +189,10 @@ internal ReceiverChannelSettings(ReceiverChannelSettings other) : base(other)
189189
_enableFilter = other.EnableFilter;
190190
_filterThreshold = other.FilterThreshold;
191191
_receiveTimeout = other.ReceiveTimeout;
192-
_enableDemodulation= other.EnableDemodulation;
193-
_carrierWaveFrequency= other.CarrierWaveFrequency;
194-
_carrierWaveDutyPercentage= other.CarrierWaveDutyPercentage;
195-
_carrierLevel= other.CarrierLevel;
192+
_enableDemodulation = other.EnableDemodulation;
193+
_carrierWaveFrequency = other.CarrierWaveFrequency;
194+
_carrierWaveDutyPercentage = other.CarrierWaveDutyPercentage;
195+
_carrierLevel = other.CarrierLevel;
196196
}
197197
}
198198
}

nanoFramework.Hardware.Esp32.Rmt/RmtChannelSettings.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ public byte ClockDivider
8989
/// Channel 0 can use at most 8 blocks of memory, accordingly channel 7 can only use one memory block.
9090
/// </remarks>
9191
/// <exception cref="ArgumentOutOfRangeException">Value cannot be 0 or more than 8.</exception>
92-
public byte NumberOfMemoryBlocks
93-
{
94-
get => _numberOfMemoryBlocks;
92+
public byte NumberOfMemoryBlocks
93+
{
94+
get => _numberOfMemoryBlocks;
9595
set
9696
{
9797
if (value < 1 || value > 8)
@@ -111,20 +111,20 @@ public byte NumberOfMemoryBlocks
111111
/// For receive channels, Incoming <see cref="RmtCommand"/>s are moved to the ring buffer after the <see cref="ReceiverChannelSettings.IdleThreshold"/> has lapsed.
112112
/// For transmit channels, <see cref="RmtCommand"/>s are automatically copied over to the channel's memory block and written to the transmitter.
113113
/// </remarks>
114-
public int BufferSize
115-
{
116-
get => _bufferSize;
114+
public int BufferSize
115+
{
116+
get => _bufferSize;
117117
set => _bufferSize = value;
118118
}
119119

120120
/// <summary>
121121
/// Gets or sets a value indicating if the RMT module should invert the incoming/outgoing signal.
122122
/// </summary>
123123
/// <remarks>This works like an external inverter connected to the GPIO of certain RMT channel.</remarks>
124-
public bool SignalInverterEnabled
125-
{
126-
get => _signalInverterEnabled;
127-
set => _signalInverterEnabled = value;
124+
public bool SignalInverterEnabled
125+
{
126+
get => _signalInverterEnabled;
127+
set => _signalInverterEnabled = value;
128128
}
129129

130130
/// <summary>

nanoFramework.Hardware.Esp32.Rmt/RmtCommandSerializer.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
1-
using System.Collections;
2-
using System.Runtime.CompilerServices;
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// See LICENSE file in the project root for full license information.
4+
//
5+
6+
using System.Collections;
37

48
#nullable enable
59
namespace nanoFramework.Hardware.Esp32.Rmt
610
{
711
internal static class RmtCommandSerializer
812
{
913
/// <summary>
10-
/// Serialize commands to rmt_item32_t native byte format
14+
/// Serialize commands to rmt_item32_t native byte format.
1115
/// </summary>
12-
/// <returns>The serialized commands</returns>
16+
/// <returns><see langword="byte"/> array with the serialized commands.</returns>
1317
public static byte[] SerializeCommands(ArrayList commands)
1418
{
1519
var index = 0;
1620
var serializedCommands = new byte[commands.Count * 4];
1721

1822
for (var i = 0; i < commands.Count; i++)
1923
{
20-
var command = (RmtCommand) commands[i];
24+
var command = (RmtCommand)commands[i];
2125

2226
var highByte1 = (byte)(command.Duration0 >> 8);
2327
var lowByte1 = (byte)(command.Duration0 & 0xFF);

0 commit comments

Comments
 (0)