diff options
author | Xelus22 <17491233+Xelus22@users.noreply.github.com> | 2020-06-19 22:35:32 +0000 |
---|---|---|
committer | Drashna Jael're <drashna@live.com> | 2020-08-08 21:17:24 -0700 |
commit | dc2c6e3a7dbcecc153cf70a574d25a38950f02b4 (patch) | |
tree | 949accb526bd4cdc678449319cae52a5a2764933 /drivers/chibios/ws2812.c | |
parent | 43dadc79ff72be3b29b55283808c6be9ce9b7efc (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 fa702fca98..1824806939 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) { |