Main Site Documentation

Question about replacing Gadgeteer module class


#1

I have a (discontinued) KeypadKP16 module, and want to replace the C# KeypadKP16 class with my own, providing key up and key down events and some other features. I have in mind how to accomplish this, but I have a Gadgeteer “plumbing” question.

Let’s call my class MyKP16. If I physically connect the module to an appropriate Y socket, provide a MyKP16 constructor that does essentially the same thing as the KeypadKP16 constructor (plus some additional stuff), and create an instance of the class inside ProgramStarted, passing in the correct socket number (which would normally happen inside InitializeModules)…here comes the question…

Do I need to do anything in the Gadgeteer diagram, or can I just leave that socket not connected to anything, and talk to the module connected to that socket through my MyKP16 object?

I don’t know if attaching something to the socket in the diagram does something else to “enable” the socket, or just calls the driver’s constructor with the appropriate socket (in InitializeModules). In looking at the generated code, it doesn’t appear that anything else is done to the socket, but I just want to make sure I’m not missing something.

Note: I considered layering the events and other features on top of the existing class, but think it would be more efficient (and I could learn a bit more along the way) if I just replace the class with my own.

Thanks.


#2

A Scoket doesn’t need to be enabled.
In fact you can work completely without the Gadgeteer Framework. It’s plain NETMF then.
Just initialize all Pins from the socket as you Need them in you constructor.


#3

@ Reinhard Ostermeier -

Great. Thanks for confirming.