Skip to content

Instantly share code, notes, and snippets.

@ahappyforest
Created June 3, 2013 19:14
Show Gist options
  • Save ahappyforest/5700546 to your computer and use it in GitHub Desktop.
Save ahappyforest/5700546 to your computer and use it in GitHub Desktop.
module YL69HumidityControlP {
provides {
interface SplitControl;
}
uses {
interface Timer<TMilli> as Delay;
interface GeneralIO as Power;
}
}
implementation {
command error_t SplitControl.start() {
call Power.makeOutput();
call Power.clr(); // 由于使用了PNP型三极管, 低电平打开设备
call Delay.startOneShot(10);
return SUCCESS;
}
event void Delay.fired() {
signal SplitControl.startDone(SUCCESS);
}
task void stopDone() {
signal SplitControl.stopDone(SUCCESS);
}
command error_t SplitControl.stop() {
call Power.set(); // 高点平关闭设备, 至于要不要makeInput, 还不知道
call Power.makeInput();
post stopDone();
return SUCCESS;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment