diff options
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 bdca565d8..2c2d9fb2d 100644 --- a/drivers/chibios/ws2812.c +++ b/drivers/chibios/ws2812.c | |||
| @@ -14,6 +14,14 @@ | |||
| 14 | # endif | 14 | # endif |
| 15 | #endif | 15 | #endif |
| 16 | 16 | ||
| 17 | // Push Pull or Open Drain Configuration | ||
| 18 | // Default Push Pull | ||
| 19 | #ifndef WS2812_EXTERNAL_PULLUP | ||
| 20 | # define WS2812_OUTPUT_MODE PAL_MODE_OUTPUT_PUSHPULL | ||
| 21 | #else | ||
| 22 | # define WS2812_OUTPUT_MODE PAL_MODE_OUTPUT_OPENDRAIN | ||
| 23 | #endif | ||
| 24 | |||
| 17 | #define NUMBER_NOPS 6 | 25 | #define NUMBER_NOPS 6 |
| 18 | #define CYCLES_PER_SEC (STM32_SYSCLK / NUMBER_NOPS * NOP_FUDGE) | 26 | #define CYCLES_PER_SEC (STM32_SYSCLK / NUMBER_NOPS * NOP_FUDGE) |
| 19 | #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 | 27 | #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) { | |||
| 66 | } | 74 | } |
| 67 | } | 75 | } |
| 68 | 76 | ||
| 69 | void ws2812_init(void) { setPinOutput(RGB_DI_PIN); } | 77 | void ws2812_init(void) { palSetLineMode(RGB_DI_PIN, WS2812_OUTPUT_MODE); } |
| 70 | 78 | ||
| 71 | // Setleds for standard RGB | 79 | // Setleds for standard RGB |
| 72 | void ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) { | 80 | void ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) { |
