⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dripdrainpingm.nc

📁 无线通信的主要编程软件,是无线通信工作人员的必备工具,关天相关教程我会在后续传上.
💻 NC
字号:
includes DripDrainPing;module DripDrainPingM {  provides interface StdControl;  uses interface Send;  uses interface SendMsg;  uses interface Receive;  uses interface Drip;  uses interface Leds;}implementation {  TOS_Msg myBuf;  DripDrainPingMsg dripCache;  bool myBufBusy;    task void sendReply();  command result_t StdControl.init() {    call Leds.redOn();    call Drip.init();    return SUCCESS;  }  command result_t StdControl.start() { return SUCCESS; }  command result_t StdControl.stop() { return SUCCESS; }  event TOS_MsgPtr Receive.receive(TOS_MsgPtr buf,				   void* payload, uint16_t len) {    DripDrainPingMsg* msg = (DripDrainPingMsg*) payload;    memcpy(&dripCache, msg, sizeof(DripDrainPingMsg));    post sendReply();    return buf;  }  task void sendReply() {    uint16_t length;    DripDrainPingMsg* msg = call Send.getBuffer(&myBuf, &length);    if (myBufBusy) {      return;    }    call Leds.yellowToggle();    myBufBusy = TRUE;    memcpy(msg, &dripCache, sizeof(DripDrainPingMsg));    call SendMsg.send(TOS_DEFAULT_ADDR,		      sizeof(DripDrainPingMsg),		      &myBuf);  }  event result_t Drip.rebroadcastRequest(TOS_MsgPtr buf, void* payload) {    memcpy(payload, &dripCache, sizeof(DripDrainPingMsg));    call Drip.rebroadcast(buf, payload, sizeof(DripDrainPingMsg));    return SUCCESS;  }  event result_t Send.sendDone(TOS_MsgPtr buf, result_t result) {     return SUCCESS;  }  event result_t SendMsg.sendDone(TOS_MsgPtr buf, result_t result) {     myBufBusy = FALSE;    return SUCCESS;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -