* 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.
* Fix incorrect delay when setting WS2812 (and similar) leds
* Add documentation for WS2812_DELAY_MICROSECONDS
* Remove improper cast to uint8_t
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
* Remove unneeded cast to uint8_t and correct math
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
* microseconds -> µs
Co-authored-by: Ryan <fauxpark@gmail.com>
* Make documentation better match the spec sheet.
Co-authored-by: Ryan <fauxpark@gmail.com>
* Rename macro to match spec sheet
* Further correction to the delay maths for the SPI case.
Co-authored-by: Joel Challis <git@zvecr.com>
* Move ws2812_common.h to the drivers directory
* Revert "Further correction to the delay maths for the SPI case."
This reverts commit e61b56a2cfc7dfec9992a7a3af92afa50e5b8ec0.
* Remove ws2812_setleds_pin(); consolidate ws2812.h
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Joel Challis <git@zvecr.com>
* Move Ergodox EZ RGB code to custom driver
Also implements full addressing of Ergodox EZ's LED Strip, as written by seebs
Co-authored-by: Seebs <seebs@seebs.net>
* Make Clipping range accessible for custom drivers
* Remove RGBW_BB_TWI from driver and docs
* Revert changes to clipping range support
* Use just rgblight_set instead of full custom driver
* Convert to i2c_master commands
* Rename rgblight driver and clean up includes
* Fix unicode in comments
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Remove separate RGBW implementation for a unified function
* Set White to 0 in RGBW LEDs
This is just to get this working, later, proper brightness can be handled elsewhere.
* Use us instead of nanoseconds(?) since it renders correctly on web
* Remove RGBW function from arm/ws2812.h
* Remove RGBW function from arm/ws2812.c
* Formatting changes
* Add doc info