Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ports/atmel-samd/common-hal/neopixel_write/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ static inline void delay_cycles(uint8_t cycles) {
uint32_t stop = start - cycles;
if (start < cycles) {
stop = 0xffffff + start - cycles;
while (SysTick->VAL < start || SysTick->VAL > stop) {}
} else {
// Make sure the systick value is between start and stop in case it
// wraps around before we read its value less than stop.
while (SysTick->VAL > stop && SysTick->VAL <= start) {}
}
while (SysTick->VAL > stop) {}
}
#endif

Expand Down