Skip to content

Commit

Permalink
src: Patch codal-nrf52 with ws2812b timing patch.
Browse files Browse the repository at this point in the history
From codal-nrf52 commit 84b1aeec870addcfb6027a924dbfe83f1f10c6db

Signed-off-by: Damien George <[email protected]>
  • Loading branch information
dpgeorge committed Oct 16, 2023
1 parent 8e2bd63 commit 49716d8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ define CODAL_PATCH
cat codal.patch | git -C $(CODAL_DIR) apply -
endef

define CODAL_LIBRARIES_CODAL_NRF52_CLEAN
git -C $(CODAL_DIR)/libraries/codal-nrf52 checkout inc
endef

define CODAL_LIBRARIES_CODAL_NRF52_PATCH
$(call CODAL_LIBRARIES_CODAL_NRF52_CLEAN)
cat neopixel_ws2812b_timing.patch | git -C $(CODAL_DIR)/libraries/codal-nrf52 apply -
endef

.PHONY: all codal_cmake codal_build libmicropython clean

all: codal_build
Expand All @@ -33,7 +42,9 @@ codal_cmake:
# Build the codal app and make the final HEX file
codal_build: libmicropython
$(call CODAL_PATCH)
$(call CODAL_LIBRARIES_CODAL_NRF52_PATCH)
make -C $(BUILD)
$(call CODAL_LIBRARIES_CODAL_NRF52_CLEAN)
$(call CODAL_CLEAN)
arm-none-eabi-size $(CODAL_BUILD)/MICROBIT
$(PYTHON) addlayouttable.py $(SRC_HEX) $(SRC_MAP) -o $(DEST_HEX)
Expand Down
17 changes: 17 additions & 0 deletions src/neopixel_ws2812b_timing.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/inc/WS2812B.h b/inc/WS2812B.h
index 3a6deb6..a24967b 100644
--- a/inc/WS2812B.h
+++ b/inc/WS2812B.h
@@ -32,9 +32,9 @@ DEALINGS IN THE SOFTWARE.

#define WS2812B_BUFFER_SIZE 256
#define WS2812B_PAD (0x8000)
-#define WS2812B_LOW (0x8000 | 6)
-#define WS2812B_HIGH (0x8000 | 10)
-#define WS2812B_PWM_FREQ 500000
+#define WS2812B_LOW (0x8000 | 5) // 320ns
+#define WS2812B_HIGH (0x8000 | 12) // 760ns
+#define WS2812B_PWM_FREQ 800000
#define WS2812B_ZERO_PADDING 50

/**

0 comments on commit 49716d8

Please sign in to comment.