8uint8_t
time_alpha8(uint32_t now, uint32_t start, uint32_t end) {
15 uint32_t elapsed = now - start;
16 uint32_t total = end - start;
17 uint32_t out = (elapsed * 255) / total;
21 return static_cast<uint8_t
>(out);
31 uint32_t elapsed = now - start;
32 uint32_t total = end - start;
33 uint32_t out = (elapsed * 65535) / total;
37 return static_cast<uint16_t
>(out);
54 uint32_t latchMs, uint32_t fallingTime) {
uint8_t update(uint32_t now) override
Compute current 0–255 output based on how much time has elapsed since trigger().
bool isActive(uint32_t now) const override
void trigger(uint32_t now) override
Call this when you want to (re)start the ramp cycle.
uint32_t mFinishedFallingTime
TimeRamp(uint32_t risingTime, uint32_t latchMs, uint32_t fallingTime)
uint32_t mFinishedPlateauTime
uint32_t mFinishedRisingTime
uint8_t time_alpha8(uint32_t now, uint32_t start, uint32_t end)
uint16_t time_alpha16(uint32_t now, uint32_t start, uint32_t end)
Implements a simple red square effect for 2D LED grids.