Skip to content

stopClock

gicking edited this page Feb 6, 2018 · 2 revisions

back to Command Reference / Time

Description

Selectively disables the interrupt used for time-keeping (1ms timer4 update). Can be re-enabled using startClock(). In contrast to command noInterrupts(), other interrupts are not affected (e.g. interrupt-driven communication).

The following functions require an enabled 1ms interrupt: delay(), delayMicroseconds(), millis(), micros(), flagMilli(), clearFlagMilli(), setTimeout(), checkTimeout()

Inclusion

  • defined in timer4.h
  • auto-loaded in main_general.h
  • in config.h set #define USE_TIM4_UPD_ISR to enable time-keeping via 1ms interrupt.

Syntax

stopClock()

Parameters

  • input:

    • none
  • output:

    • none

Returns

  • Nothing

Example Code

The below code disables the time-keeping interrupt, performs some time-critical code, and re-enable the interrupt afterwards.

#include "main_general.h"   // board-independent main

void setup() {}

void loop()
{
  stopClock();
  // critical, time-sensitive code here
  startClock();
  // other code here
}

Relevant Tutorial

  • tbd

See also

Clone this wiki locally