using System; using Unosquare.RaspberryIO.Abstractions; namespace Unosquare.WiringPi { /// <summary> /// The SPI Bus containing the 2 SPI channels. /// </summary> public class SpiBus : ISpiBus { /// <inheritdoc /> public Int32 Channel0Frequency { get; set; } /// <inheritdoc /> public Int32 Channel1Frequency { get; set; } /// <inheritdoc /> public Int32 DefaultFrequency => 8000000; /// <inheritdoc /> public ISpiChannel Channel0 { get { if(this.Channel0Frequency == 0) { this.Channel0Frequency = this.DefaultFrequency; } return SpiChannel.Retrieve(SpiChannelNumber.Channel0, this.Channel0Frequency); } } /// <inheritdoc /> public ISpiChannel Channel1 { get { if(this.Channel1Frequency == 0) { this.Channel1Frequency = this.DefaultFrequency; } return SpiChannel.Retrieve(SpiChannelNumber.Channel1, this.Channel1Frequency); } } } }