📄 sounderp.nc
字号:
module SounderP{ provides interface Mts300Sounder; uses { interface Timer<TMilli>; interface GeneralIO as SounderPin; }}implementation{ command void Mts300Sounder.beep(uint16_t length) { if (call Timer.isRunning()) { uint32_t remaining = call Timer.getdt(), elapsed = call Timer.getNow() - call Timer.gett0(); /* If more time left than we are requesting, just exit */ if (remaining > elapsed && (remaining - elapsed) > length) return; /* Override timer with new duration */ } call Timer.startOneShot(length); call SounderPin.makeOutput(); call SounderPin.set(); } event void Timer.fired() { call SounderPin.clr(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -