Browse Source

Merge pull request #307 from FrankBoesing/patch-1

Add delayNanoseconds()
teensy4-core
Paul Stoffregen 6 years ago
parent
commit
9f6a4858f2
No account linked to committer's email address
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      teensy4/core_pins.h

+ 7
- 0
teensy4/core_pins.h View File

@@ -692,6 +692,13 @@ static inline void delayMicroseconds(uint32_t usec)
while (ARM_DWT_CYCCNT - begin < cycles) ; // wait
}

static inline void delayNanoseconds(uint32_t) __attribute__((always_inline, unused));
static inline void delayNanoseconds(uint32_t nsec)
{
uint32_t begin = ARM_DWT_CYCCNT;
uint32_t cycles = ((uint64_t)F_CPU_ACTUAL * nsec) / 1000000000UL;
while (ARM_DWT_CYCCNT - begin < cycles) ; // wait
}


unsigned long rtc_get(void);

Loading…
Cancel
Save