Skip to content

Commit

Permalink
fixed I2C driver, now working on Raspberry Pi 2 as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Gene committed Feb 24, 2015
1 parent 1d5dce1 commit 5f0c86d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Raspberry.IO.InterIntegratedCircuit/I2cDriver.cs
Expand Up @@ -286,19 +286,19 @@ private static uint GetBscBase(ProcessorPin sdaPin, ProcessorPin sclPin)
{
case 1:
if (sdaPin == ProcessorPin.Pin0 && sclPin == ProcessorPin.Pin1)
return Board.Current.Model == '2' ? Interop.BCM2836_BSC0_BASE : Interop.BCM2835_BSC0_BASE;
return Interop.BCM2835_BSC0_BASE;
throw new InvalidOperationException("No I2C device exist on the specified pins");

case 2:
if (sdaPin == ProcessorPin.Pin28 && sclPin == ProcessorPin.Pin29)
return Board.Current.Model == '2' ? Interop.BCM2836_BSC0_BASE : Interop.BCM2835_BSC0_BASE;
return Interop.BCM2835_BSC0_BASE;
if (sdaPin == ProcessorPin.Pin2 && sclPin == ProcessorPin.Pin3)
return Board.Current.Model == '2' ? Interop.BCM2836_BSC1_BASE : Interop.BCM2835_BSC1_BASE;
return Interop.BCM2835_BSC1_BASE;
throw new InvalidOperationException("No I2C device exist on the specified pins");

case 3:
if (sdaPin == ProcessorPin.Pin2 && sclPin == ProcessorPin.Pin3)
return Interop.BCM2835_BSC1_BASE;
return Board.Current.Model == '2' ? Interop.BCM2836_BSC1_BASE : Interop.BCM2835_BSC1_BASE;
throw new InvalidOperationException("No I2C device exist on the specified pins");

default:
Expand Down

0 comments on commit 5f0c86d

Please sign in to comment.