Commit 84db652
committed
Fix micros() rollover
It was getting the 32 bit value dividing by system clock speed and returning
it, so it never fully went through the 32 bit value to properly rollover
changed to retrieve the 64 bit value instead, which appears to work
```
unsigned long micros(void) {
return k_cyc_to_us_floor32(k_cycle_get_64());
}
```
Output from example sketch from before, shows rollover now:
```
US: 4288826633 4289826702 1000069 MS: 4288826 4289826 1000
US: 4289826733 4290826802 1000069 MS: 4289826 4290826 1000
US: 4290826833 4291826902 1000069 MS: 4290826 4291826 1000
US: 4291826933 4292827002 1000069 MS: 4291826 4292827 1001
US: 4292827057 4293827102 1000045 MS: 4292827 4293827 1000
US: 4293827133 4294827202 1000069 MS: 4293827 4294827 1000
US: 4294827233 860006 1000069 MS: 4294827 4295827 1000
US: 860058 1860107 1000049 MS: 4295827 4296827 1000
US: 1860137 2860206 1000069 MS: 4296827 4297827 1000
US: 2860237 3860306 1000069 MS: 4297827 4298827 1000
US: 3860358 4860406 1000048 MS: 4298827 4299827 1000
```1 parent 00ec495 commit 84db652
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
| 274 | + | |
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| |||
0 commit comments