microtimer.nc

来自「一种改进的节点间测距算法」· NC 代码 · 共 34 行

NC
34
字号
/**
 * This interface provides a generic timer that can be used to generate
 * events at regular intervals. This interface is for high-precision,
 * but limited duration, intervals
  */
interface MicroTimer {

  /**
   * Start the timer. 
   *  @param interval The timer interval in <b>microseconds</b> (1/1024
   *  second). Note that the 
   *    timer cannot support an arbitrary range of intervals.
   *    (Unfortunately this interface does not specify the valid range
   *    of timer intervals, which are specific to a platform.)
   *  @return Returns SUCCESS if the timer could be started with the 
   *    given interval.
   */
  command result_t start(uint32_t interval);

  /**
   * Stop the timer, preventing it from firing again. Note that the
   * timer might still fire before stop returns.
   * @return SUCCESS if the timer could be stopped, or FAIL if the timer 
   * is not running.
   */
  async command result_t stop();

  /**
   * The signal generated by the timer when it fires.
   */
  async event result_t fired();
}

⌨️ 快捷键说明

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