FastLED 3.9.15
|
LIB8STATIC uint8_t addmod8 | ( | uint8_t | a, |
uint8_t | b, | ||
uint8_t | m ) |
Add two numbers, and calculate the modulo of the sum and a third number, M.
In other words, it returns (A+B) % M. It is designed as a compact mechanism for incrementing a "mode" switch and wrapping around back to "mode 0" when the switch goes past the end of the available range. e.g. if you have seven modes, this switches to the next one and wraps around if needed:
a | dividend byte |
b | value to add to the dividend |
m | divisor byte |
Definition at line 392 of file math8.h.
References LIB8STATIC.
Referenced by chooseNextColorPalette(), and fl::TwinkleFox::chooseNextColorPalette().