summaryrefslogtreecommitdiffstats
path: root/tmk_core/common/backlight.c
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2019-07-16 17:56:36 +1000
committerskullydazed <skullydazed@users.noreply.github.com>2019-07-16 00:56:36 -0700
commita32f7e1a25a8a200d838aa8256ffe39708fbd723 (patch)
treeb1ede8bd7ce3d6b31c7bfd83d0f23a804c8efc8f /tmk_core/common/backlight.c
parente2dfb787da2a2ba88e0e074b396a2b988e10eccf (diff)
Store backlight breathing state in EEPROM (#6105)
* Store backlight breathing state in EEPROM * Reduce backlight_config.level from 6 bits to 4 (max 15 "on" levels) * Error out if BACKLIGHT_LEVELS is > 15 * Remove mention of default backlight pin in rules.mk template * Remove pointless comment
Diffstat (limited to 'tmk_core/common/backlight.c')
-rw-r--r--tmk_core/common/backlight.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/tmk_core/common/backlight.c b/tmk_core/common/backlight.c
index 8ddacd98b6..c0e9fb5ee4 100644
--- a/tmk_core/common/backlight.c
+++ b/tmk_core/common/backlight.c
@@ -100,7 +100,7 @@ void backlight_enable(void)
backlight_set(backlight_config.level);
}
-/** /brief Disable backlight
+/** \brief Disable backlight
*
* FIXME: needs doc
*/
@@ -162,3 +162,56 @@ uint8_t get_backlight_level(void)
{
return backlight_config.level;
}
+
+#ifdef BACKLIGHT_BREATHING
+/** \brief Backlight breathing toggle
+ *
+ * FIXME: needs doc
+ */
+void backlight_toggle_breathing(void)
+{
+ bool breathing = backlight_config.breathing;
+ dprintf("backlight breathing toggle: %u\n", breathing);
+ if (breathing)
+ backlight_disable_breathing();
+ else
+ backlight_enable_breathing();
+}
+
+/** \brief Enable backlight breathing
+ *
+ * FIXME: needs doc
+ */
+void backlight_enable_breathing(void)
+{
+ if (backlight_config.breathing) return; // do nothing if breathing is already on
+
+ backlight_config.breathing = true;
+ eeconfig_update_backlight(backlight_config.raw);
+ dprintf("backlight breathing enable\n");
+ breathing_enable();
+}
+
+/** \brief Disable backlight breathing
+ *
+ * FIXME: needs doc
+ */
+void backlight_disable_breathing(void)
+{
+ if (!backlight_config.breathing) return; // do nothing if breathing is already off
+
+ backlight_config.breathing = false;
+ eeconfig_update_backlight(backlight_config.raw);
+ dprintf("backlight breathing disable\n");
+ breathing_disable();
+}
+
+/** \brief Get the backlight breathing status
+ *
+ * FIXME: needs doc
+ */
+bool is_backlight_breathing(void)
+{
+ return backlight_config.breathing;
+}
+#endif