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

Basic comment cleanup in supporting SPI files (#94)

* Basic comment cleanup in supporting SPI files

* Added wording from feedback
上级 c56ac594
......@@ -11,7 +11,7 @@ namespace System.Device.Spi.Drivers
private const string Default_Device_Path = "/dev/spidev";
private const uint SPI_IOC_MESSAGE_1 = 0x40206b00;
private int _deviceFileDescriptor = -1;
private SpiConnectionSettings _settings;
private readonly SpiConnectionSettings _settings;
private static readonly object s_InitializationLock = new object();
public UnixSpiDevice(SpiConnectionSettings settings)
......
......@@ -5,40 +5,40 @@
namespace System.Device.Spi
{
/// <summary>
/// Class that holds the connection settings of a device on a Spi bus.
/// The connection settings of a device on a SPI bus.
/// </summary>
public sealed class SpiConnectionSettings
{
private const SpiMode _defaultSpiMode = SpiMode.Mode0;
private const int _defaultDataBitLenght = 8; // 1 byte.
private const int _defaultDataBitLength = 8; // 1 byte
private const int _defaultClockFrequency = 500_000; // 500 KHz
private SpiConnectionSettings() { }
/// <summary>
/// Default constructor. Takes the bus id and the chip select line for that bus.
/// Initializes new instance of SpiConnectionSettings.
/// </summary>
/// <param name="busId">The bus id the device is connected to.</param>
/// <param name="chipSelectLine">The chip select line used on that bus id.</param>
/// <param name="busId">The bus ID the device is connected to.</param>
/// <param name="chipSelectLine">The chip select line used on the bus.</param>
public SpiConnectionSettings(int busId, int chipSelectLine)
{
BusId = busId;
ChipSelectLine = chipSelectLine;
Mode = _defaultSpiMode;
DataBitLength = _defaultDataBitLenght;
DataBitLength = _defaultDataBitLength;
ClockFrequency = _defaultClockFrequency;
}
/// <summary>
/// The Spi mode being used.
/// The SPI mode being used.
/// </summary>
public SpiMode Mode { get; set; }
/// <summary>
/// The bus id the device is connected to.
/// The bus ID the device is connected to.
/// </summary>
public int BusId { get; set; }
/// <summary>
/// The chip select line used on that bus id.
/// The chip select line used on the bus.
/// </summary>
public int ChipSelectLine { get; set; }
/// <summary>
......
......@@ -12,11 +12,13 @@ namespace System.Device.Spi
public abstract void WriteByte(byte data);
public abstract void Write(Span<byte> data);
public abstract void TransferFullDuplex(Span<byte> writeBuffer, Span<byte> readBuffer);
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
public virtual void Dispose(bool disposing)
{
//Nothing to do in base class.
......
......@@ -5,26 +5,26 @@
namespace System.Device.Spi
{
/// <summary>
/// Enum with the different modes supported by SPI.
/// CPOL - Clock polarity: defines if each cycle consists of a pulse of 1, or 0.
/// CPHA - Clock phase: timing of the data bits relative to the clock pulses.
/// Defines how data is synchronized between devices on a SPI bus.
/// Clock Polarity (CPOL) determines if clock signal is low or high when in idle state.
/// Clock Phase (CPHA) determines when data is sampled relative to the clock signal.
/// </summary>
public enum SpiMode
{
/// <summary>
/// CPOL 0, CPHA 0
/// CPOL 0, CPHA 0. Polarity is idled low and data is sampled on rising edge of the clock signal.
/// </summary>
Mode0,
/// <summary>
/// CPOL 0, CPHA 1
/// CPOL 0, CPHA 1. Polarity is idled low and data is sampled on falling edge of the clock signal.
/// </summary>
Mode1,
/// <summary>
/// CPOL 1, CPHA 0
/// CPOL 1, CPHA 0. Polarity is idled high and data is sampled on falling edge of the clock signal.
/// </summary>
Mode2,
/// <summary>
/// CPOL 1, CPHA 1
/// CPOL 1, CPHA 1. Polarity is idled high and data is sampled on rising edge of the clock signal.
/// </summary>
Mode3
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册