📄 ultrasoundcontrolm.nc
字号:
/* * Cricket Ultrasound Control implementation for TOSSIM. * David Moore <dcm@csail.mit.edu> */module UltrasoundControlM { provides { interface UltrasoundControl; }}implementation { /* * Resets the timer that measures the number of microseconds until * each incoming pulse of the ultrasound receiver. The * PulseDetected event will be generated for each rising edge of * the pulse. timeout specifies the number of microseconds before * the timer is disabled, at which time the DetectorTimeout event * is generated. */ async command result_t UltrasoundControl.StartDetector(uint16_t timeout) { TOSH_us_start_detector(timeout); return SUCCESS; } /* * Stops the ultrasound timer and prevents the generation of further * events. */ async command result_t UltrasoundControl.StopDetector() { TOSH_us_stop_detector(); return SUCCESS; } default async event result_t UltrasoundControl.PulseDetected(uint16_t timer) { return SUCCESS; } default async event result_t UltrasoundControl.DetectorTimeout() { return SUCCESS; } /* When the timeout is reached, the timer is stopped and the * DetectorTimeout event is generated. */ void TOSH_us_timeout() __attribute__ ((C)) { call UltrasoundControl.StopDetector(); signal UltrasoundControl.DetectorTimeout(); } /* Upon receiving the rising edge of a pulse, generate an event * with the captured time. */ void TOSH_us_pulse_detected(uint16_t timer) __attribute__ ((C)) { signal UltrasoundControl.PulseDetected(timer); } /* * Generate a 150 us pulse of 40 KHz ultrasound using the transducer. */ async command result_t UltrasoundControl.SendPulse() { TOSH_us_send_pulse(); return SUCCESS; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -