File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed
hardware/arduino/sam/cores/arduino Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ ARDUINO 1.5.6 BETA
1111[core]
1212* sam: Fixed wrap-around bug in delay() (Mark Tillotson)
1313* sam: Fixed regression in analogRead() (fails to read multiple channels) (Mark Tillotson)
14+ * sam: Optimized delayMicroseconds() (Rob Tillaart) #1121
1415* Optimized Print::print(String&) method, now uses internal string buffer to perform block write
1516
1617ARDUINO 1.5.5 BETA 2013.11.28
Original file line number Diff line number Diff line change @@ -64,11 +64,12 @@ extern void delay( uint32_t dwMs ) ;
6464 */
6565static inline void delayMicroseconds (uint32_t ) __attribute__((always_inline , unused ));
6666static inline void delayMicroseconds (uint32_t usec ){
67+ if (usec == 0 ) return ;
6768 uint32_t n = usec * (VARIANT_MCK / 3000000 );
6869 asm volatile (
6970 "L_%=_delayMicroseconds:" "\n\t"
7071 "subs %0, #1" "\n\t"
71- "bge L_%=_delayMicroseconds" "\n"
72+ "bne L_%=_delayMicroseconds" "\n"
7273 : "+r" (n ) :
7374 );
7475}
You can’t perform that action at this time.
0 commit comments