qmk_firmware/drivers/avr
Sergey Vlasov 627ceebef3
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.
2021-02-09 08:33:04 +11:00
..
analog.c Hid joystick interface (#4226) 2020-08-29 14:30:02 -07:00
analog.h Improve support and docs for ADC driver (#7191) 2019-12-08 12:11:29 +11:00
apa102.c Fix capitalisation of "GitHub" (#9184) 2020-05-25 19:43:14 -07:00
apa102.h clang-format changes 2019-08-30 15:01:52 -07:00
glcdfont.c Clean up includes for glcdfont headers (#7745) 2020-03-01 17:56:50 +11:00
hd44780.c clang-format changes 2019-08-30 15:01:52 -07:00
hd44780.h Change include guards in tmk_core/ and drivers/ to pragma once (#11240) 2020-12-26 15:56:11 +11:00
i2c_master.c Fix capitalisation of "GitHub" (#9184) 2020-05-25 19:43:14 -07:00
i2c_master.h Change include guards in tmk_core/ and drivers/ to pragma once (#11240) 2020-12-26 15:56:11 +11:00
i2c_slave.c Fix capitalisation of "GitHub" (#9184) 2020-05-25 19:43:14 -07:00
i2c_slave.h Change include guards in tmk_core/ and drivers/ to pragma once (#11240) 2020-12-26 15:56:11 +11:00
serial.c 2020 November 28 Breaking Changes Update (#11053) 2020-11-28 12:02:18 -08:00
serial.h Update split serial code to use driver pattern (#7990) 2020-01-24 13:50:51 +00:00
spi_master.c Fix error handling in SPI master. (#11122) 2020-12-06 12:50:02 +11:00
spi_master.h adds support for the atmega328 (#9043) 2020-06-10 22:23:11 +01:00
ssd1306.c Fix ssd1306 compilation on avr-gcc 10 (#9267) 2020-09-17 10:42:24 +10:00
ssd1306.h Change include guards in tmk_core/ and drivers/ to pragma once (#11240) 2020-12-26 15:56:11 +11:00
ws2812_i2c.c Unify RGB and RGBW commands (#7297) 2019-11-09 15:51:39 +00:00
ws2812.c ws2812: Fix number of nops for AVR at 8 MHz (#9559) 2021-02-09 08:33:04 +11:00