diff options
author | Sergey Vlasov <vsu@altlinux.ru> | 2021-02-09 00:33:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-09 08:33:04 +1100 |
commit | 627ceebef3ed19eceba3642a830ffbf44f4a9e04 (patch) | |
tree | 261ce414affa8c15f4973036153ec770553138ef /drivers/avr/serial.h | |
parent | d2f204c1e3ef92d774feded0ba05a145c2d03cf7 (diff) |
ws2812: Fix number of nops for AVR at 8 MHz (#9559)
* ws2812: Fix number of nops for AVR at 8 MHz
When trying to calculate the number of nops for AVR running at 8 MHz,
the value of `w3` is expected to be negative; however, because `F_CPU`
is defined in tmk_core/avr.mk with the `UL` suffix, the preprocessor
performs its calculations using `unsigned long`, getting a very large
positive number instead of the expected negative number; this then
results in generating code with a huge number of nops. Fix the broken
calculations by performing a comparison before subtraction, so that the
unsigned number wraparound does not occur.
The keyboard which triggers the problem is `handwired/promethium`; the
buggy code silently compiles, but the resulting timings would be
completely wrong.
* ws2812: Clean up the code after the 8 MHz fix
Remove old code which was unsuccessfully trying to clamp negative w1, w2
and w3 values to 0, and set w1_nops, w2_nops and w3_nops directly.
Diffstat (limited to 'drivers/avr/serial.h')
0 files changed, 0 insertions, 0 deletions