From 6adfea8f7c4b7b37ce79153ce4873baf73e627d5 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 14 May 2019 01:41:32 -0600 Subject: moved triangle_wave into fsm-misc, because I need it for power correction in tint ramping --- spaghetti-monster/fsm-misc.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spaghetti-monster/fsm-misc.c') diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c index e61fe00..9f953fa 100644 --- a/spaghetti-monster/fsm-misc.c +++ b/spaghetti-monster/fsm-misc.c @@ -146,5 +146,12 @@ void indicator_led_auto() { */ #endif // USE_INDICATOR_LED +#ifdef USE_TRIANGLE_WAVE +uint8_t triangle_wave(uint8_t phase) { + uint8_t result = phase << 1; + if (phase > 127) result = 255 - result; + return result; +} +#endif #endif -- cgit v1.2.3