Accessing pins on Cerberus in 4.3?

Hmm, stuff has changed with OSHW other things. I am not able to access the pins with the usual usings and references.

Can you please enlighten me as to reference the pins in the most elegant and future proof way.


STM Pin class…

 public class Pin
        /// <summary>A value indicating that no GPIO pin is specified.</summary>
        public const Cpu.Pin GPIO_NONE = Cpu.Pin.GPIO_NONE;

        /// <summary>Digital I/O.</summary>
        public const Cpu.Pin PA0 = (Cpu.Pin)((0 * 16) + 0);

        /// <summary>Digital I/O.</summary>
        public const Cpu.Pin PA1 = (Cpu.Pin)((0 * 16) + 1);

        /// <summary>Digital I/O.</summary>
        public const Cpu.Pin PA2 = (Cpu.Pin)((0 * 16) + 2);

        /// <summary>Digital I/O.</summary>
        public const Cpu.Pin PA3 = (Cpu.Pin)((0 * 16) + 3);

       //etc etc
1 Like

When you get to PB0 it becomes

/// <summary>Digital I/O.</summary>
public const Cpu.Pin PB0 = (Cpu.Pin)((1 * 16) + 0);

/// <summary>Digital I/O.</summary>
public const Cpu.Pin PB1 = (Cpu.Pin)((1 * 16) + 1);

// etc

Thanks. I need the usings and refs required.


So, where is the Cerberus defined pin-names?

More specifically I would like to understand how to use the socket map

From code.

For Cerberus, I use the chart to find the pin name (PC0 is pin C0)
Then use the GHI call Generic.GetPin(port, number). i.e.:
static OutputPort resetOled = new OutputPort(Generic.GetPin(‘C’, 1), true);
will set up an OuputPort on PC1, and set it to ‘1’.

For this, you need to add the reference GHI.Pins
and a using statement: using GHI.Pins;

1 Like

Is this really the easiest way? I have come across Cpu.Pin.GPIO_Pin0 several times and I still dont have a clue where to find the exact pin/socket/wire.

If I plug in a Gadgeteer button to Spider socket 4, how do I find out which pin is used the button input? And no cheating, I need refs to documents that leads all the way to the result.

If your using Gadgeteer why do you care?

Because I really want to try the low power stuff from

But dont now how to instruct it to react to my button press from the button in lets say socket 4.

What to replace Cpu.Pin.GPIO_Pin0 with - in the example with interrupts…

Without cheating…

Button uses Pin 4 on a G socket…

Looking at Spider Schematic…Socket 4 pin 4 is IO37…

So in code…


In that case…it doesnt matter…

Just press de button

As clear as a billabong after rain. Thanks buddy

Hmm, interessting, I was exactly thinking that it didnt matter in this case.

So what you are saying is that ANY GPIO change will wake up the sleeping beauty? And the arguments does not matter?

correct a mundo

[quote=“Justin”]Without cheating…
Button uses Pin 4 on a G socket…

Perhaps cheating might have helped, since unless I’m now confused, a button uses pin 3 (not 4) on either an X or Y socket, not G according to!

I labour the point, just to ensure I’m following along correctly.

What say you?

1 Like

3 == 4 init? :whistle:

1 Like