cypherkey / RaspberryPi.Net

Raspberry PI .NET library
GNU General Public License v2.0
299 stars 86 forks source link

Supporting Board Rev2 #7

Closed arakis closed 11 years ago

arakis commented 12 years ago

Hey, since the board Rev2 has changed some GPIO numbers, you should modify the GPIPins-enum.

Documentation: http://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29

Source changes:

public enum GPIOPins { GPIO_NONE = -1, GPIO00 = 0, GPIO01 = 1,

        GPIO02 = 2, //REV2
        GPIO03 = 3, //REV2

        GPIO04 = 4,
        GPIO07 = 7,
        GPIO08 = 8,
        GPIO09 = 9,
        GPIO10 = 10,
        GPIO11 = 11,
        GPIO14 = 14,
        GPIO15 = 15,
        GPIO17 = 17,
        GPIO18 = 18,
        GPIO21 = 21,
        GPIO22 = 22,
        GPIO23 = 23,
        GPIO24 = 24,
        GPIO25 = 25,

        GPIO27 = 27, //REV2

        Pin03 = 2, //REV2
        Pin05 = 3, //REV2
        Pin07 = 4,
        Pin08 = 14,
        Pin10 = 15,
        Pin11 = 17,
        Pin12 = 18,
        Pin13 = 27, //REV2
        Pin15 = 22,
        Pin16 = 23,
        Pin18 = 24,
        Pin19 = 10,
        Pin21 = 9,
        Pin22 = 25,
        Pin23 = 11,
        Pin24 = 8,
        Pin26 = 7,
        LED = 16
    };

Greetings, Sebastian

cypherkey commented 11 years ago

Thanks. I'll make those changes shortly.

arakis commented 11 years ago

"Shortly"? Please define "shortly" ;) In the moment, i have a locally patched version of your library.

Greetings, Sebastian

cypherkey commented 11 years ago

I'm curious what you did for your patch? Do you still support revision 1 boards?

I've updated my code with commit 11285685cc027a96061462295b3fc83a3922f7c7. I'm not a fan of doing it this way but it's the easiest solution. You can't subclass an enum so I've been looking in to changing the enum to a class and then that would allow me to subclass it with a new class called GPIOPinsRev2. That in my mind makes it more explicit.