Powerup tinyos接口实现

// tos启动时点亮Led

module PowerupC @safe()
{

// 使用Boot接口,Boot接口中只有一个事件booted,模块使用接口时,要实现接口中的事件

// 根据提供接口要实现接口中的命令

uses interface Boot;  

// Leds也只是接口而已

uses interface Leds;
}

implementation
{
event void Boot.booted()
{
call Leds.led1On();
}
}

 

 

// 顶层配件:顶层配件中的内容是空

configuration PowerupAppC{}
implementation
{
components MainC,PowerupC,LedsC;

PowerupC->MainC.Boot;
PowerupC->LedsC.Leds;
}

 

https://files.cnblogs.com/files/tinyos/1_Powerup.zip

 

posted @ 2017-03-15 22:34  未命名blogs  阅读(221)  评论(0编辑  收藏  举报