瀏覽代碼

Merge pull request #308 from FrankBoesing/patch-2

optimized delayNanoseconds
teensy4-core
Paul Stoffregen 5 年之前
父節點
當前提交
be8a8b9f4a
No account linked to committer's email address
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. +1
    -1
      teensy4/core_pins.h

+ 1
- 1
teensy4/core_pins.h 查看文件

@@ -758,7 +758,7 @@ static inline void delayNanoseconds(uint32_t) __attribute__((always_inline, unus
static inline void delayNanoseconds(uint32_t nsec)
{
uint32_t begin = ARM_DWT_CYCCNT;
uint32_t cycles = ((uint64_t)F_CPU_ACTUAL * nsec) / 1000000000UL;
uint32_t cycles = ((F_CPU_ACTUAL>>16) * nsec) / (1000000000UL>>16);
while (ARM_DWT_CYCCNT - begin < cycles) ; // wait
}


Loading…
取消
儲存