Hi,
thanks for the answer, and mostly appreciated the way you answered so I can 
have also me motivated to find the solution. I looked on the code and this is 
what I found : 




static void 
/*UserButtonC.SwitchToggleC*/SwitchToggleC__0__sendEvent__runTask(void )
#line 79
{
bool pinHigh;

#line 81
pinHigh = /*UserButtonC.SwitchToggleC*/SwitchToggleC__0__m_pinHigh;

/*UserButtonC.SwitchToggleC*/SwitchToggleC__0__Notify__notify(pinHigh);

if (pinHigh) {
/*UserButtonC.SwitchToggleC*/SwitchToggleC__0__GpioInterrupt__enableFallingEdge();
}
else
#line 87
{
/*UserButtonC.SwitchToggleC*/SwitchToggleC__0__GpioInterrupt__enableRisingEdge();
}
}
It looks, that the Notify__notify to be inside a piece of code that is 
responsible for handling the key is pressed(pinHigh).
I guess that If I add the Notify__disable there it will work the way I want. Do 
not have the compiler with me, will check tomorrow morning when I will be at 
the office.

For the Notify__disable the function does
static inline error_t 
/*UserButtonC.SwitchToggleC*/SwitchToggleC__0__Notify__disable(void )
#line 67
{
return /*UserButtonC.SwitchToggleC*/SwitchToggleC__0__GpioInterrupt__disable();
}

but then I also found the
inline static error_t MyFooC__Notify__disable(void ){

unsigned char __nesc_result;



__nesc_result = UserButtonP__Notify__disable();



return __nesc_result;
line 67
}


What I do not understand is that the way is written looks like tha the low 
level GpioInterrupt_disable would be called at the end. Have to proceed to bed 
soon, as my daughter gets her teeth out soon but I Will try to check again all 
the code tomorrow during my train ride to work.

Thanks a lot have fun





On Monday, November 11, 2013 5:30 AM, Eric Decker <[email protected]> wrote:
 


look at the code actually generated…

build/telosb/app.c

Then look to see where Notify__notify is actually called.   And see what 
Notify__disable actually does.

Notice the name munging.    xyzP.nc which has Notify.disable() in it has the 
names munged to be xyzP__Notify__disable.




On Sun, Nov 10, 2013 at 4:04 PM, Alaios <[email protected]> wrote:

Dear all,
>I was looking the other day on the tinyos website regarding the Notify 
>interface
>http://www.tinyos.net/tinyos-2.1.0/doc/nesdoc/telosb/ihtml/tos.interfaces.Notify.html
>
>there I found the Notify.disable() call that I wanted to try. What I did is I 
>wrote a simple program that once the key at my telosb is pressed the led turns 
>on.
>
>Code looks like that
>
>#include <UserButton.h>
>module MyFooC {
>    uses interface Boot;
>    uses interface Leds;
>    uses interface Notify<button_state_t>;
>}
>
>implementation {
>
>event void Boot.booted() {
>            call Leds.led1Toggle();
>            call
 Notify.enable();
>            }
>
>event void Notify.notify(button_state_t state) {
>if (state == 0) {call Leds.led0Toggle(); }
>else call Leds.led2Toggle();
>call Notify.disable();
>            }
>
>}
>
>as you can see after led turns off I call Notify.disable() so it starts to 
>ignore when button is pressed. Unfortunately this did not work out at all. I 
>keep pressing the button and the led just toggles. What I am missing here from 
>the "theory"?
>
>I would like to thank you in advance for your help
>
>Regards
>Alex
>P.s If wiring is needen then it was:
>
>configuration MyFooAppC{
>}
>
>implementation {
>
>components MyFooC,MainC,LedsC,UserButtonC;
>
>MyFooC.Boot -> MainC.Boot;
>MyFooC.Leds -> LedsC;
>MyFooC.Notify -> UserButtonC.Notify;
>
>}
>
>
>
>
>_______________________________________________
>Tinyos-help mailing list
>[email protected]
>https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>


-- 
Eric B. Decker
Senior (over 50 :-) Researcher



_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to