Main Site Documentation

Accessing pins on Cerberus in 4.3?


#1

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.

Thanks


#2

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

#3

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

#4

Thanks. I need the usings and refs required.


#5

Microsoft.SPOT.Hardware;


#6

So, where is the Cerberus defined pin-names?


#7

More specifically I would like to understand how to use the socket map http://www.ghielectronics.com/uploads/doc/item/1556_large.jpg

From code.


#8

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;


#9

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.


#10

If your using Gadgeteer why do you care?


#11

Because I really want to try the low power stuff from https://www.ghielectronics.com/docs/141/low-power

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…


#12

Without cheating…

Button uses Pin 4 on a G socket…

https://www.ghielectronics.com/catalog/product/274

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

So in code…



Crystal?

#13

In that case…it doesnt matter…

Just press de button


#14

As clear as a billabong after rain. Thanks buddy


#15

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?


#16

correct a mundo


#17

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

[/quote]
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 https://www.ghielectronics.com/catalog/product/274!

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

What say you?


#18

3 == 4 init? :whistle: