Skip to content

Commit 49716d8

Browse files
committed
src: Patch codal-nrf52 with ws2812b timing patch.
From codal-nrf52 commit 84b1aeec870addcfb6027a924dbfe83f1f10c6db Signed-off-by: Damien George <[email protected]>
1 parent 8e2bd63 commit 49716d8

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ define CODAL_PATCH
1919
cat codal.patch | git -C $(CODAL_DIR) apply -
2020
endef
2121

22+
define CODAL_LIBRARIES_CODAL_NRF52_CLEAN
23+
git -C $(CODAL_DIR)/libraries/codal-nrf52 checkout inc
24+
endef
25+
26+
define CODAL_LIBRARIES_CODAL_NRF52_PATCH
27+
$(call CODAL_LIBRARIES_CODAL_NRF52_CLEAN)
28+
cat neopixel_ws2812b_timing.patch | git -C $(CODAL_DIR)/libraries/codal-nrf52 apply -
29+
endef
30+
2231
.PHONY: all codal_cmake codal_build libmicropython clean
2332

2433
all: codal_build
@@ -33,7 +42,9 @@ codal_cmake:
3342
# Build the codal app and make the final HEX file
3443
codal_build: libmicropython
3544
$(call CODAL_PATCH)
45+
$(call CODAL_LIBRARIES_CODAL_NRF52_PATCH)
3646
make -C $(BUILD)
47+
$(call CODAL_LIBRARIES_CODAL_NRF52_CLEAN)
3748
$(call CODAL_CLEAN)
3849
arm-none-eabi-size $(CODAL_BUILD)/MICROBIT
3950
$(PYTHON) addlayouttable.py $(SRC_HEX) $(SRC_MAP) -o $(DEST_HEX)

src/neopixel_ws2812b_timing.patch

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/inc/WS2812B.h b/inc/WS2812B.h
2+
index 3a6deb6..a24967b 100644
3+
--- a/inc/WS2812B.h
4+
+++ b/inc/WS2812B.h
5+
@@ -32,9 +32,9 @@ DEALINGS IN THE SOFTWARE.
6+
7+
#define WS2812B_BUFFER_SIZE 256
8+
#define WS2812B_PAD (0x8000)
9+
-#define WS2812B_LOW (0x8000 | 6)
10+
-#define WS2812B_HIGH (0x8000 | 10)
11+
-#define WS2812B_PWM_FREQ 500000
12+
+#define WS2812B_LOW (0x8000 | 5) // 320ns
13+
+#define WS2812B_HIGH (0x8000 | 12) // 760ns
14+
+#define WS2812B_PWM_FREQ 800000
15+
#define WS2812B_ZERO_PADDING 50
16+
17+
/**

0 commit comments

Comments
 (0)