namespace Unosquare.RaspberryIO.Gpio { using Swan.Abstractions; /// /// The SPI Bus containing the 2 SPI channels /// public class SpiBus : SingletonBase { /// /// Prevents a default instance of the class from being created. /// private SpiBus() { // placeholder } #region SPI Access /// /// Gets or sets the channel 0 frequency in Hz. /// /// /// The channel0 frequency. /// public int Channel0Frequency { get; set; } /// /// Gets the SPI bus on channel 1. /// /// /// The channel0. /// public SpiChannel Channel0 { get { if (Channel0Frequency == 0) Channel0Frequency = SpiChannel.DefaultFrequency; return SpiChannel.Retrieve(SpiChannelNumber.Channel0, Channel0Frequency); } } /// /// Gets or sets the channel 1 frequency in Hz /// /// /// The channel1 frequency. /// public int Channel1Frequency { get; set; } /// /// Gets the SPI bus on channel 1. /// /// /// The channel1. /// public SpiChannel Channel1 { get { if (Channel1Frequency == 0) Channel1Frequency = SpiChannel.DefaultFrequency; return SpiChannel.Retrieve(SpiChannelNumber.Channel1, Channel1Frequency); } } #endregion } }