private static uint GetBscBase(ProcessorPin sdaPin, ProcessorPin sclPin)
{
switch (GpioConnectionSettings.ConnectorPinout)
{
case ConnectorPinout.Rev1:
if (sdaPin == ProcessorPin.Pin0 && sclPin == ProcessorPin.Pin1)
return Interop.BCM2835_BSC0_BASE;
throw new InvalidOperationException("No I2C device exist on the specified pins");
case ConnectorPinout.Rev2:
if (sdaPin == ProcessorPin.Pin28 && sclPin == ProcessorPin.Pin29)
return Interop.BCM2835_BSC0_BASE;
if (sdaPin == ProcessorPin.Pin2 && sclPin == ProcessorPin.Pin3)
return Interop.BCM2835_BSC1_BASE;
throw new InvalidOperationException("No I2C device exist on the specified pins");
case ConnectorPinout.Plus:
if (sdaPin == ProcessorPin.Pin2 && sclPin == ProcessorPin.Pin3)
return GetProcessorBscAddress(Board.Current.Processor);
throw new InvalidOperationException("No I2C device exist on the specified pins");
default:
throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Connector pinout {0} is not supported", GpioConnectionSettings.ConnectorPinout));
}
}