aboutsummaryrefslogtreecommitdiff
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)
downloadqmk_firmware-a32f7e1a25a8a200d838aa8256ffe39708fbd723.tar.gz
qmk_firmware-a32f7e1a25a8a200d838aa8256ffe39708fbd723.zip
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 8ddacd98b..c0e9fb5ee 100644
--- a/tmk_core/common/backlight.c
+++ b/tmk_core/common/backlight.c
@@ -100,7 +100,7 @@ void backlight_enable(void)
100 backlight_set(backlight_config.level); 100 backlight_set(backlight_config.level);
101} 101}
102 102
103/** /brief Disable backlight 103/** \brief Disable backlight
104 * 104 *
105 * FIXME: needs doc 105 * FIXME: needs doc
106 */ 106 */
@@ -162,3 +162,56 @@ uint8_t get_backlight_level(void)
162{ 162{
163 return backlight_config.level; 163 return backlight_config.level;
164} 164}
165
166#ifdef BACKLIGHT_BREATHING
167/** \brief Backlight breathing toggle
168 *
169 * FIXME: needs doc
170 */
171void backlight_toggle_breathing(void)
172{
173 bool breathing = backlight_config.breathing;
174 dprintf("backlight breathing toggle: %u\n", breathing);
175 if (breathing)
176 backlight_disable_breathing();
177 else
178 backlight_enable_breathing();
179}
180
181/** \brief Enable backlight breathing
182 *
183 * FIXME: needs doc
184 */
185void backlight_enable_breathing(void)
186{
187 if (backlight_config.breathing) return; // do nothing if breathing is already on
188
189 backlight_config.breathing = true;
190 eeconfig_update_backlight(backlight_config.raw);
191 dprintf("backlight breathing enable\n");
192 breathing_enable();
193}
194
195/** \brief Disable backlight breathing
196 *
197 * FIXME: needs doc
198 */
199void backlight_disable_breathing(void)
200{
201 if (!backlight_config.breathing) return; // do nothing if breathing is already off
202
203 backlight_config.breathing = false;
204 eeconfig_update_backlight(backlight_config.raw);
205 dprintf("backlight breathing disable\n");
206 breathing_disable();
207}
208
209/** \brief Get the backlight breathing status
210 *
211 * FIXME: needs doc
212 */
213bool is_backlight_breathing(void)
214{
215 return backlight_config.breathing;
216}
217#endif