From 49716d8af6f926a74186d109d0696611048418ff Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 16 Oct 2023 16:04:25 +1100 Subject: [PATCH] src: Patch codal-nrf52 with ws2812b timing patch. From codal-nrf52 commit 84b1aeec870addcfb6027a924dbfe83f1f10c6db Signed-off-by: Damien George --- src/Makefile | 11 +++++++++++ src/neopixel_ws2812b_timing.patch | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/neopixel_ws2812b_timing.patch diff --git a/src/Makefile b/src/Makefile index 70bb10c..1db71bd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 @@ -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) diff --git a/src/neopixel_ws2812b_timing.patch b/src/neopixel_ws2812b_timing.patch new file mode 100644 index 0000000..d96d993 --- /dev/null +++ b/src/neopixel_ws2812b_timing.patch @@ -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 + + /**