diff options
author | Daniel Garcia <danielgarcia@gmail.com> | 2017-08-17 00:06:50 +0300 |
---|---|---|
committer | Daniel Garcia <danielgarcia@gmail.com> | 2017-08-17 00:06:50 +0300 |
commit | 7637a251e878f09febc8dcf836644e0468f37231 (patch) | |
tree | 57d3b4ea212620f53fe7bf19f54d25d28401478b | |
parent | 074794de8ecc385116925b0f9731cfcc053b5c7a (diff) |
Fix #478 -- don't use a generic name for NOP in case other platforms mess with it.
-rw-r--r-- | fastled_delay.h | 26 | ||||
-rw-r--r-- | fastspi_bitbang.h | 4 |
2 files changed, 12 insertions, 18 deletions
diff --git a/fastled_delay.h b/fastled_delay.h index cfc7882f..0fd8de09 100644 --- a/fastled_delay.h +++ b/fastled_delay.h @@ -34,18 +34,12 @@ public: // Default is now just 'nop', with special case for AVR -// ESP32 core has it's own definition of NOP, so undef it first -#ifdef ESP32 -#undef NOP -#undef NOP2 -#endif - #if defined(__AVR__) -# define NOP __asm__ __volatile__ ("cp r0,r0\n"); -# define NOP2 __asm__ __volatile__ ("rjmp .+0"); +# define FL_NOP __asm__ __volatile__ ("cp r0,r0\n"); +# define FL_NOP2 __asm__ __volatile__ ("rjmp .+0"); #else -# define NOP __asm__ __volatile__ ("nop\n"); -# define NOP2 __asm__ __volatile__ ("nop\n\t nop\n"); +# define FL_NOP __asm__ __volatile__ ("nop\n"); +# define FL_NOP2 __asm__ __volatile__ ("nop\n\t nop\n"); #endif // predeclaration to not upset the compiler @@ -98,7 +92,7 @@ template<int CYCLES> __attribute__((always_inline)) inline void delaycycles() { template<int CYCLES> __attribute__((always_inline)) inline void delaycycles() { // _delaycycles_ARM<CYCLES / 3, CYCLES % 3>(); - NOP; delaycycles<CYCLES-1>(); + FL_NOP; delaycycles<CYCLES-1>(); } #endif @@ -115,11 +109,11 @@ template<> __attribute__((always_inline)) inline void delaycycles<-3>() {} template<> __attribute__((always_inline)) inline void delaycycles<-2>() {} template<> __attribute__((always_inline)) inline void delaycycles<-1>() {} template<> __attribute__((always_inline)) inline void delaycycles<0>() {} -template<> __attribute__((always_inline)) inline void delaycycles<1>() {NOP;} -template<> __attribute__((always_inline)) inline void delaycycles<2>() {NOP2;} -template<> __attribute__((always_inline)) inline void delaycycles<3>() {NOP;NOP2;} -template<> __attribute__((always_inline)) inline void delaycycles<4>() {NOP2;NOP2;} -template<> __attribute__((always_inline)) inline void delaycycles<5>() {NOP2;NOP2;NOP;} +template<> __attribute__((always_inline)) inline void delaycycles<1>() {FL_NOP;} +template<> __attribute__((always_inline)) inline void delaycycles<2>() {FL_NOP2;} +template<> __attribute__((always_inline)) inline void delaycycles<3>() {FL_NOP;FL_NOP2;} +template<> __attribute__((always_inline)) inline void delaycycles<4>() {FL_NOP2;FL_NOP2;} +template<> __attribute__((always_inline)) inline void delaycycles<5>() {FL_NOP2;FL_NOP2;FL_NOP;} // Some timing related macros/definitions diff --git a/fastspi_bitbang.h b/fastspi_bitbang.h index 6621668a..3add2b9c 100644 --- a/fastspi_bitbang.h +++ b/fastspi_bitbang.h @@ -158,7 +158,7 @@ private: FastPin<CLOCK_PIN>::fastset(clockpin, hiclock); CLOCK_HI_DELAY; FastPin<CLOCK_PIN>::fastset(clockpin, loclock); CLOCK_LO_DELAY; } else { - // NOP; + // FL_NOP; FastPin<DATA_PIN>::fastset(datapin, loval); FastPin<CLOCK_PIN>::fastset(clockpin, hiclock); CLOCK_HI_DELAY; FastPin<CLOCK_PIN>::fastset(clockpin, loclock); CLOCK_LO_DELAY; @@ -178,7 +178,7 @@ private: FastPin<DATA_PIN>::fastset(clockdatapin, datahiclockhi); CLOCK_HI_DELAY; FastPin<DATA_PIN>::fastset(clockdatapin, datahiclocklo); CLOCK_LO_DELAY; } else { - // NOP; + // FL_NOP; FastPin<DATA_PIN>::fastset(clockdatapin, dataloclocklo); FastPin<DATA_PIN>::fastset(clockdatapin, dataloclockhi); CLOCK_HI_DELAY; FastPin<DATA_PIN>::fastset(clockdatapin, dataloclocklo); CLOCK_LO_DELAY; |