PaulStoffregen 8 年之前
父節點
當前提交
9b06bacb72
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. +11
    -1
      teensy3/core_pins.h

+ 11
- 1
teensy3/core_pins.h 查看文件

@@ -1529,7 +1529,17 @@ extern volatile uint32_t systick_millis_count;
static inline uint32_t millis(void) __attribute__((always_inline, unused));
static inline uint32_t millis(void)
{
return systick_millis_count; // single aligned 32 bit is atomic;
// Reading a volatile variable to another volatile
// seems redundant, but isn't for some cases.
// Eventually this should probably be replaced by a
// proper memory barrier or other technique. Please
// do not revome this "redundant" code without
// carefully verifying the case mentioned here:
//
// https://forum.pjrc.com/threads/17469-millis%28%29-on-teensy-3?p=104924&viewfull=1#post104924
//
volatile uint32_t ret = systick_millis_count; // single aligned 32 bit is atomic
return ret;
}

uint32_t micros(void);

Loading…
取消
儲存