diff options
author | Nick Brassel <[email protected]> | 2023-11-28 16:39:48 +1100 |
---|---|---|
committer | Nick Brassel <[email protected]> | 2023-11-28 16:40:47 +1100 |
commit | 0115951de12bd4c798a43a380651c34552552e85 (patch) | |
tree | 62999011ae782d93aa6dc9c889615db2a840cafc /users/anderson/smoothled.c | |
parent | 0379d1f59e58cefa18cdb72ba1b77507d1108ae6 (diff) | |
parent | 4d99e0a23cff02f4c6e55e093b5de08a9be0df7c (diff) | |
download | qmk_firmware-0.23.0.tar.gz qmk_firmware-0.23.0.zip |
`develop` -> `master`, 2023q4 edition0.23.0
Diffstat (limited to 'users/anderson/smoothled.c')
-rw-r--r-- | users/anderson/smoothled.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/users/anderson/smoothled.c b/users/anderson/smoothled.c deleted file mode 100644 index 3af729563c..0000000000 --- a/users/anderson/smoothled.c +++ /dev/null @@ -1,34 +0,0 @@ -#include <smoothled.h> - -static uint32_t sourceColor = 0x000000; -static uint32_t currentColor = 0x000000; -static uint32_t targetColor = 0x000000; -static int32_t smoothledTimer = -1; - -void smoothled_set(uint32_t color) { - smoothledTimer = timer_read32(); - sourceColor = currentColor; - targetColor = color; -} - -void smoothled_process(void) { - if (smoothledTimer < 0) { - return; - } - int32_t kb = timer_elapsed32(smoothledTimer); - int32_t ka = SMOOTH_DURATION - kb; - if (kb > SMOOTH_DURATION) { - kb = SMOOTH_DURATION; - ka = 0; - smoothledTimer = -1; - } - currentColor = 0; - for (int i = 2; i >= 0; i--) { - uint32_t shift = i * 8; - currentColor |= (ka * ((uint32_t)(sourceColor >> shift) & 0xFF) + kb * ((uint32_t)(targetColor >> shift) & 0xFF)) / SMOOTH_DURATION; - /*currentColor |= ((targetColor >> shift) & 0xFF);*/ - currentColor <<= 8; - } - currentColor >>= 8; - rgblight_setrgb((currentColor >> 16) & 0xFF, (currentColor >> 8) & 0xFF, currentColor & 0xFF); -} |