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.
Diff: WS281X.cpp
- Revision:
- 4:4af895bb2979
- Parent:
- 2:cc8e091fd975
- Child:
- 5:8e6835a94e10
diff -r 786b31c65e7a -r 4af895bb2979 WS281X.cpp
--- a/WS281X.cpp Thu Jul 28 05:43:06 2016 +0000
+++ b/WS281X.cpp Thu Jul 28 17:41:52 2016 +0000
@@ -21,10 +21,13 @@
#include "WS281X.h"
#include "pinmap.h"
+// TARGET_STM32F7
// TARGET_DISCO_F746NG
// TARGET_NUCLEO_F746ZG
+// TARGET_STM32F0
// TARGET_NUCLEO_F030R8
// TARGET_NUCLEO_F070RB
+// TARGET_LPC82X
// TARGET_LPC824
//----------------------------------------------------------------------------
@@ -150,14 +153,14 @@
#define _nop15() _nop7(); _nop8()
#define _nop16() _nop8(); _nop8()
-#if defined(TARGET_NXP)
+#if defined(TARGET_LPC82X)
// LPC824-30MHz
#define DELAY_T0H() do{ _nop2(); }while(0)
#define DELAY_T1H() do{ _nop6(); }while(0)
#define DELAY_TLOW() do{ _nop6(); }while(0)
#define DELAY_TLOW2() //do{ _nop2(); }while(0)
-#define DELAY_SPACE() do{ _nop2(); }while(0)
-#define DELAY_NEXT() do{ _nop1(); }while(0)
+#define DELAY_SPACE() do{ _nop4(); }while(0)
+#define DELAY_NEXT() //do{ _nop1(); }while(0)
#endif
#if defined(TARGET_STM32F0)
@@ -166,24 +169,41 @@
#define DELAY_T1H() do{ _nop8(); _nop8(); }while(0)
#define DELAY_TLOW() do{ _nop16(); }while(0)
#define DELAY_TLOW2() //do{ _nop8(); _nop4(); }while(0)
-#define DELAY_SPACE() do{ _nop8(); _nop4(); }while(0)
-#define DELAY_NEXT() do{ _nop4(); }while(0)
+#define DELAY_SPACE() do{ _nop8(); _nop6(); }while(0)
+#define DELAY_NEXT() do{ _nop8(); }while(0)
#endif
-#if defined(TARGET_STM32F7)
-// DISCO-F746NG (216MHz), NUCLEO-F746ZG (216MHz)
+#if defined(TARGET_NUCLEO_F746ZG)
+// NUCLEO-F746ZG (216MHz)
#define T0H (35)
-#define T0L (125-T0H)
-#define T1H (100)
-#define T1L (125-T1H)
+#define T0L (110-T0H)
+#define T1H (75)
+#define T1L (110-T1H)
#define DELAY_T0H() _delay(T0H)
#define DELAY_T1H() _delay(T1H-T0H)
#define DELAY_TLOW() _delay(T1L)
#define DELAY_TLOW2() //DELAY_TLOW()
-#define DELAY_SPACE() DELAY_TLOW()
-#define DELAY_NEXT() _delay(30)
+#define DELAY_SPACE() _delay(T1L+5)
+#define DELAY_NEXT() _delay(50)
+#endif
+#if defined(TARGET_DISCO_F746NG)
+// TARGET_DISCO_F746NG (216MHz)
+#define T0H (35)
+#define T0L (110-T0H)
+#define T1H (75)
+#define T1L (110-T1H)
+
+#define DELAY_T0H() _delay(T0H)
+#define DELAY_T1H() _delay(T1H-T0H)
+#define DELAY_TLOW() _delay(T1L)
+#define DELAY_TLOW2() //DELAY_TLOW()
+#define DELAY_SPACE() _delay(T1L+5)
+#define DELAY_NEXT() _delay(50)
+#endif
+
+#if defined(TARGET_STM32F7)
inline __attribute__((always_inline))
void WS281X::_delay(int value)
{