Hello guys,
i was wondering if any of you guys would the trick to initialize the modules outside of the ProgramStarted Dispatcher.
for example i want to be able to do this:
void myMethod()
{
Gadgeteer.Modules.GHIElectronics.Button button;
button = new GTM.GHIElectronics.Button(14);
button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
}
from an event i would call myMethod().
right now i get this error:
modules must be created on the Program's Dispatcher thread
and if you are wondering why i want to do that . well it is simple really…
the above if possible and i hope it is, will allow me to load the application on the spider for example once and be able to turn it off and change the socket, plug the module to another socket and be able to use it… hope this makes sense. and of course it would also allow me to remove the socket without getting an exception.
Hi Architect,
i’m not sure i get what you are saying… it’s kind of late here so maybe that has something to do with it…
anyway are you talking about modifying the source code of the module? and make it static? what if i don’t have access to the source? or is this something that can be done on my Program…
Releasing sockets and mainboard resources (such as pins, serial ports, etc.) for reuse at runtime would require some changes to the mainboard software implementation. The existing implementation assumes that modules don’t change after startup, so mainboard reservations are non-reversable.
The GadgeteerCore and Fez Spider Mainboard source is published on Codeplex at http://gadgeteer.codeplex.com, so you could experiment with making these changes yourself.
Yep, Module class has static list of all initialized modules and Socket has static list of reserved pins. There are no methods that remove items from these lists for now.
i guess that is expected since one would have to turn off the Main board to plug and unplug modules, but still it would have made configuration easier if one could release those pin…