diff options
| author | Joel Challis <git@zvecr.com> | 2021-11-25 19:35:06 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-25 19:35:06 +0000 |
| commit | 5e9c29da0df045b03ada9278c34f37b22349a6f7 (patch) | |
| tree | 3dbe67afa346513de1132e23c636b5ad01bc3550 /platforms/avr | |
| parent | 3d0062071133ad76504ede49a66063115c4a06c5 (diff) | |
| download | qmk_firmware-5e9c29da0df045b03ada9278c34f37b22349a6f7.tar.gz qmk_firmware-5e9c29da0df045b03ada9278c34f37b22349a6f7.zip | |
Tidy up adjustable ws2812 timing (#15299)
Diffstat (limited to 'platforms/avr')
| -rw-r--r-- | platforms/avr/drivers/ws2812.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/platforms/avr/drivers/ws2812.c b/platforms/avr/drivers/ws2812.c index 77c492cd4..9150b3c52 100644 --- a/platforms/avr/drivers/ws2812.c +++ b/platforms/avr/drivers/ws2812.c | |||
| @@ -52,20 +52,15 @@ void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds) { | |||
| 52 | using the fast 800kHz clockless WS2811/2812 protocol. | 52 | using the fast 800kHz clockless WS2811/2812 protocol. |
| 53 | */ | 53 | */ |
| 54 | 54 | ||
| 55 | // Timing in ns | ||
| 56 | #define w_zeropulse 350 | ||
| 57 | #define w_onepulse 900 | ||
| 58 | #define w_totalperiod 1250 | ||
| 59 | |||
| 60 | // Fixed cycles used by the inner loop | 55 | // Fixed cycles used by the inner loop |
| 61 | #define w_fixedlow 2 | 56 | #define w_fixedlow 2 |
| 62 | #define w_fixedhigh 4 | 57 | #define w_fixedhigh 4 |
| 63 | #define w_fixedtotal 8 | 58 | #define w_fixedtotal 8 |
| 64 | 59 | ||
| 65 | // Insert NOPs to match the timing, if possible | 60 | // Insert NOPs to match the timing, if possible |
| 66 | #define w_zerocycles (((F_CPU / 1000) * w_zeropulse) / 1000000) | 61 | #define w_zerocycles (((F_CPU / 1000) * WS2812_T0H) / 1000000) |
| 67 | #define w_onecycles (((F_CPU / 1000) * w_onepulse + 500000) / 1000000) | 62 | #define w_onecycles (((F_CPU / 1000) * WS2812_T1H + 500000) / 1000000) |
| 68 | #define w_totalcycles (((F_CPU / 1000) * w_totalperiod + 500000) / 1000000) | 63 | #define w_totalcycles (((F_CPU / 1000) * WS2812_TIMING + 500000) / 1000000) |
| 69 | 64 | ||
| 70 | // w1_nops - nops between rising edge and falling edge - low | 65 | // w1_nops - nops between rising edge and falling edge - low |
| 71 | #if w_zerocycles >= w_fixedlow | 66 | #if w_zerocycles >= w_fixedlow |
