Main Site Documentation

GPIO pin map


#1

This may sound strange, but is there a GPIO to marked pin map somewhere? For a class, I need to write an LED class and would like to create a constructor where the user supplies a DIO pin number (as an int) instead of a port. I see that one way to use the onboard LED is to create an output port using the call (Cpu.Pin)4, but I can’t figure out where the 4 came from. I assume it has something to do with a physical mapping, but I can’t figure out what. I hope this makes sense. Thanks in advance.


#2

What type of FEZ hardware in question, Domino, Panda or Mini?


#3

On GHI main website, look for usbizi brochure and pinout document


#4

I must admit this is a strange question :slight_smile:
But if you right click on a digital pin definition in VS you can select the ‘go to definition that will give you the enumeration.
Ps. these values will change with the device your programming.


#5

Thanks Geir. I forgot VS would give me that. I haven’t used a Visual language in a few years. Sorry I forgot to include that this is for a Domino. I am supposed to be designing classes for people who have never programed before, so I thought that having them just pass a port number would be the easiest for someone who has never coded. If anyone thinks there is a better way, please let me know.


#6

Personally I cant see why passing an int would make things easier than using the pin mapping supplied by GHI. It all boils down to the same thing. I would rather have the intelligence of VS give me the options available then use an unguided integer…


#7

@ dpeterson3
A new IDE, MS framework, and ghi fw, can be a lot to reason about at first (and second). As you are making a class specific to fez, it would seem reasonable to me to keep the context as fez pins instead of forcing the consumer to do a cast to CPU.Pin - which I agree be confusing until you see the big picture. Also, have a look at the LED driver under the LED hw component on the site that will give you start http://www.tinyclr.com/downloads/Component/FEZ_Components_LED.cs

You can think of FEZ_Pin as a helper that helps you map named pins to the actual int value of hw pin number. Just print that class/enum out if you want a reference. Ultimately, it is the int that is used regardless of what enum is used. For example, you could craft your own enum if you had a reason.

public class TestLed
    {
        FEZ_Pin.Digital pin;
        OutputPort led;
        public TestLed(FEZ_Pin.Digital pin)
        {
            this.pin = pin;
            led = new OutputPort((Cpu.Pin)pin, false);
        }
        public void SetOn()
        {
            led.Write(true);
        }
        // ...
        public static void Usage()
        {
            TestLed led = new TestLed(FEZ_Pin.Digital.LED);
            led.SetOn();
        }
    }