aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-misc.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2019-05-14 01:41:32 -0600
committerSelene ToyKeeper2019-05-14 01:41:32 -0600
commit6adfea8f7c4b7b37ce79153ce4873baf73e627d5 (patch)
tree5f189e9ef78d1fc1c51791122bdd1d43f7599d7f /spaghetti-monster/fsm-misc.c
parentfixed bug where click-click-hold from off to strobes would also activate tint... (diff)
downloadanduril-6adfea8f7c4b7b37ce79153ce4873baf73e627d5.tar.gz
anduril-6adfea8f7c4b7b37ce79153ce4873baf73e627d5.tar.bz2
anduril-6adfea8f7c4b7b37ce79153ce4873baf73e627d5.zip
moved triangle_wave into fsm-misc, because I need it for power correction in tint ramping
Diffstat (limited to '')
-rw-r--r--spaghetti-monster/fsm-misc.c7
1 files changed, 7 insertions, 0 deletions
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