diff options
author | Xelus22 <17491233+Xelus22@users.noreply.github.com> | 2020-06-19 22:35:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-20 08:35:32 +1000 |
commit | c7851484457e5ab604962ae7c914b863b8de0cb2 (patch) | |
tree | f2fbfc27c8adf8de4a242392ca979561287dc62a /drivers/chibios/ws2812.c | |
parent | b43bdc1c69bb5a57976a159bfc00c4ac1c7c7f8f (diff) |
STM32 WS2812 Open Drain Configuration (#9414)
* update docs stm32 only and applies to all 3 driver
* cformat
Diffstat (limited to 'drivers/chibios/ws2812.c')
-rw-r--r-- | drivers/chibios/ws2812.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/chibios/ws2812.c b/drivers/chibios/ws2812.c index bdca565d88..2c2d9fb2dc 100644 --- a/drivers/chibios/ws2812.c +++ b/drivers/chibios/ws2812.c @@ -14,6 +14,14 @@ # endif #endif +// Push Pull or Open Drain Configuration +// Default Push Pull +#ifndef WS2812_EXTERNAL_PULLUP +# define WS2812_OUTPUT_MODE PAL_MODE_OUTPUT_PUSHPULL +#else +# define WS2812_OUTPUT_MODE PAL_MODE_OUTPUT_OPENDRAIN +#endif + #define NUMBER_NOPS 6 #define CYCLES_PER_SEC (STM32_SYSCLK / NUMBER_NOPS * NOP_FUDGE) #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 @@ -66,7 +74,7 @@ void sendByte(uint8_t byte) { } } -void ws2812_init(void) { setPinOutput(RGB_DI_PIN); } +void ws2812_init(void) { palSetLineMode(RGB_DI_PIN, WS2812_OUTPUT_MODE); } // Setleds for standard RGB void ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) { |