Re: Java Action events/asychronous notification
Barry Demchak <[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <[email protected]> |
Hi, Nathan -- Try creating an Interface ... that's a definition of a function or a group of functions. Then have the module that wants notification of events (i.e., the client module) *implement* the interface, and pass its own pointer to the event generating module (... see the "implements" Java keyword). When the event generator needs to call the event handler in the module that wants notification, it should call the appropriate Interface function through the client module's pointer. Simple and elegant, but not very obvious until you know it. At 01:01 PM 1/14/2004 -0600, Nathan Gustavson wrote: >Hello, >I'm a C/C++ embedded developer who has been forcefully thrown into the world >of Java with the advent of this Tini processor. I'm looking for advice on >implementing asychronous methods for our Tini carrier board. >I've been trying to write some simple drivers for the IO on our board for >the last couple days and have been having a lot of trouble implementing and >asychronous interface for our keypad. >I've got the Interrupts running with ExternalInterrupt and am receiving the >keys no problem, but can't seem to discover a good end API for the users for >this. > >In C I would just create a function pointer to a callback and call it when >the key is pressed. > >After 2 days research and hair pulling I have discoved that Java does not do >this, I've been Googling and going through the html documentation, but all I >have discovered is how to set up and action to occur when a pre-defined >event(such as mouse movement) occurs. I have been unable to find any >reference to how to actually set up the API to call a function. That is, how >to implement an addtask type method for my own IO devices. > >If anyone out there has any example code or knows any good tutorials it >would be appreciated. >Help! > > > > >Thank you, > >Nathan Z. Gustavson >Embedded Engineer >EMAC, Inc. >2390 EMAC Way >Carbondale, IL 62902 >Phone (618) 529-4525 ext 320 >Fax (618) 457-0110 >Website: http://www.emacinc.com > > >_______________________________________________ >TINI mailing list >TINI-6tN4nzCoH/[email protected] >To UNSUBSCRIBE, edit your profile, or see list archives: >http://lists.dalsemi.com/mailman/listinfo/tini vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv > Barry Demchak < > Torrey Pines Software, Inc. < > www.tpsoft.com < > (858) 452-8700 < ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ _______________________________________________ TINI mailing list TINI-6tN4nzCoH/[email protected] To UNSUBSCRIBE, edit your profile, or see list archives: http://lists.dalsemi.com/mailman/listinfo/tini