Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 3:6e60574091dd, committed 2018-11-12
- Comitter:
- MACRUM
- Date:
- Mon Nov 12 05:05:50 2018 +0000
- Parent:
- 2:6e647820f587
- Commit message:
- Support GCC_ARM compiler
Changed in this revision
| WS2812.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/WS2812.cpp Thu Feb 12 20:24:15 2015 +0000
+++ b/WS2812.cpp Mon Nov 12 05:05:50 2018 +0000
@@ -1,5 +1,11 @@
#include "WS2812.h"
+#if defined ( __GNUC__ ) /* GCC Compiler */
+#define NOP __asm __volatile("nop\n")
+#else
+#define NOP __nop()
+#endif
+
WS2812::WS2812(PinName pin, int size, int zeroHigh, int zeroLow, int oneHigh, int oneLow) : __gpo(pin)
{
__size = size;
@@ -92,20 +98,20 @@
if (__transmitBuf[i]){
__gpo = 1;
for (; j < __oneHigh; j++) {
- __nop();
+ NOP;
}
__gpo = 0;
for (; j < __oneLow; j++) {
- __nop();
+ NOP;
}
} else {
__gpo = 1;
for (; j < __zeroHigh; j++) {
- __nop();
+ NOP;
}
__gpo = 0;
for (; j < __zeroLow; j++) {
- __nop();
+ NOP;
}
}
}