summaryrefslogtreecommitdiff
path: root/platforms
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2024-02-20 21:13:18 +1100
committerGitHub <noreply@github.com>2024-02-20 21:13:18 +1100
commit865a8f42a6128dfc09a24fe749b0d78d8c69b70e (patch)
tree72ac80d27735bf488fe64ce89b1903f39ac6e1b4 /platforms
parente198643d66b488945964abe913aa0356b87423a1 (diff)
WS2812 bitbang: prefix for `NOP_FUDGE` define (#23110)
Diffstat (limited to 'platforms')
-rw-r--r--platforms/chibios/drivers/ws2812_bitbang.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/platforms/chibios/drivers/ws2812_bitbang.c b/platforms/chibios/drivers/ws2812_bitbang.c
index 593377068b..1ed87c4381 100644
--- a/platforms/chibios/drivers/ws2812_bitbang.c
+++ b/platforms/chibios/drivers/ws2812_bitbang.c
@@ -3,18 +3,23 @@
3#include "gpio.h" 3#include "gpio.h"
4#include "chibios_config.h" 4#include "chibios_config.h"
5 5
6// DEPRECATED - DO NOT USE
7#if defined(NOP_FUDGE)
8# define WS2812_BITBANG_NOP_FUDGE NOP_FUDGE
9#endif
10
6/* Adapted from https://github.com/bigjosh/SimpleNeoPixelDemo/ */ 11/* Adapted from https://github.com/bigjosh/SimpleNeoPixelDemo/ */
7 12
8#ifndef NOP_FUDGE 13#ifndef WS2812_BITBANG_NOP_FUDGE
9# if defined(STM32F0XX) || defined(STM32F1XX) || defined(GD32VF103) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX) || defined(WB32F3G71xx) || defined(WB32FQ95xx) 14# if defined(STM32F0XX) || defined(STM32F1XX) || defined(GD32VF103) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX) || defined(WB32F3G71xx) || defined(WB32FQ95xx)
10# define NOP_FUDGE 0.4 15# define WS2812_BITBANG_NOP_FUDGE 0.4
11# else 16# else
12# if defined(RP2040) 17# if defined(RP2040)
13# error "Please use `vendor` WS2812 driver for RP2040" 18# error "Please use `vendor` WS2812 driver for RP2040"
14# else 19# else
15# error "NOP_FUDGE configuration required" 20# error "WS2812_BITBANG_NOP_FUDGE configuration required"
16# endif 21# endif
17# define NOP_FUDGE 1 // this just pleases the compile so the above error is easier to spot 22# define WS2812_BITBANG_NOP_FUDGE 1 // this just pleases the compile so the above error is easier to spot
18# endif 23# endif
19#endif 24#endif
20 25
@@ -33,7 +38,7 @@
33#endif 38#endif
34 39
35#define NUMBER_NOPS 6 40#define NUMBER_NOPS 6
36#define CYCLES_PER_SEC (CPU_CLOCK / NUMBER_NOPS * NOP_FUDGE) 41#define CYCLES_PER_SEC (CPU_CLOCK / NUMBER_NOPS * WS2812_BITBANG_NOP_FUDGE)
37#define NS_PER_SEC (1000000000L) // Note that this has to be SIGNED since we want to be able to check for negative values of derivatives 42#define NS_PER_SEC (1000000000L) // Note that this has to be SIGNED since we want to be able to check for negative values of derivatives
38#define NS_PER_CYCLE (NS_PER_SEC / CYCLES_PER_SEC) 43#define NS_PER_CYCLE (NS_PER_SEC / CYCLES_PER_SEC)
39#define NS_TO_CYCLES(n) ((n) / NS_PER_CYCLE) 44#define NS_TO_CYCLES(n) ((n) / NS_PER_CYCLE)