On Wed, 10 Sep 2008 13:42:10 +0200
Marco Antonio Lopez Trinidad <[EMAIL PROTECTED]> wrote:
> It is missing the code of the module or at least the code part that starts the
> timer you use to generate the interruptions and the event handler, isn't?
>
> Otherwise is hard to say something else.
>
> --marco.
That's all the code:
<PiroSensorC.nc>
configuration PiroSensorC{
provides interface Get<bool>;
provides interface Notify<bool>;
provides interface DeviceMetadata;
}
implementation {
components PiroSensorLogicP;
Get = PiroSensorLogicP;
Notify = PiroSensorLogicP;
DeviceMetadata = PiroSensorLogicP;
components HplPiroSensorC;
PiroSensorLogicP.GpioInterrupt -> HplPiroSensorC;
PiroSensorLogicP.GeneralIO -> HplPiroSensorC;
}
<PiroSensorLogicP.nc>
module PiroSensorLogicP
{
provides interface Get<bool>;
provides interface Notify<bool>;
provides interface DeviceMetadata;
uses interface GeneralIO;
uses interface GpioInterrupt;
}
implementation
{
task void sendEvent();
command bool Get.get() {return call GeneralIO.get();}
command error_t Notify.enable() {
call GeneralIO.makeInput();
return call GpioInterrupt.enableRisingEdge();
}
command error_t Notify.disable() {
return call GpioInterrupt.disable();
}
async event void GpioInterrupt.fired() {
call GpioInterrupt.disable();
post sendEvent();
}
task void sendEvent() {
signal Notify.notify(TRUE);
call GpioInterrupt.enableRisingEdge();
}
command uint8_t DeviceMetadata.getSignificantBits() {return 1;}
}
<HplPiroSensorC>
configuration HplPiroSensorC
{
provides interface GeneralIO;
provides interface GpioInterrupt;
}
implementation
{
components MicaBusC;
components new Atm128GpioInterruptC() as InterruptC;
components HplAtm128InterruptC;
GeneralIO = MicaBusC.Int1;
InterruptC.Atm128Interrupt -> HplAtm128InterruptC.Int1;
GpioInterrupt = InterruptC.Interrupt;
}
the test application calls Notify.enable() when boot and
Notify.notify() event turns on a Led and starts a Timer that turns off
the led after 1 second.
Thanks
--
Nunca confies en un S.O. del que no tienes código fuente ;-)
--------------------------------
Javier Almansa Sobrino.
Ingeniero Técnico en Informática de Sistemas.
Grupo de Investigación ARCo.
Escuela Superior de Informática. Ciudad Real
Tel: (+34)926 29 53 00 Ext: 3705
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help