Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce includes for caps_word header #18948

Merged
merged 1 commit into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions quantum/caps_word.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <stdint.h>
#include "caps_word.h"
#include "timer.h"
#include "action.h"
#include "action_util.h"

/** @brief True when Caps Word is active. */
static bool caps_word_active = false;
Expand All @@ -36,6 +40,8 @@ void caps_word_task(void) {
void caps_word_reset_idle_timer(void) {
idle_timer = timer_read() + CAPS_WORD_IDLE_TIMEOUT;
}
#else
void caps_word_task(void) {}
#endif // CAPS_WORD_IDLE_TIMEOUT > 0

void caps_word_on(void) {
Expand Down
27 changes: 16 additions & 11 deletions quantum/caps_word.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,31 @@

#pragma once

#include "quantum.h"
#include <stdbool.h>

#ifndef CAPS_WORD_IDLE_TIMEOUT
# define CAPS_WORD_IDLE_TIMEOUT 5000 // Default timeout of 5 seconds.
#endif // CAPS_WORD_IDLE_TIMEOUT
#endif

#if CAPS_WORD_IDLE_TIMEOUT > 0
/** @brief Matrix scan task for Caps Word feature */
void caps_word_task(void);

#if CAPS_WORD_IDLE_TIMEOUT > 0
/** @brief Resets timer for Caps Word idle timeout. */
void caps_word_reset_idle_timer(void);
#else
static inline void caps_word_task(void) {}
#endif // CAPS_WORD_IDLE_TIMEOUT > 0

void caps_word_on(void); /**< Activates Caps Word. */
void caps_word_off(void); /**< Deactivates Caps Word. */
void caps_word_toggle(void); /**< Toggles Caps Word. */
bool is_caps_word_on(void); /**< Gets whether currently active. */
#endif

/** @brief Activates Caps Word. */
void caps_word_on(void);

/** @brief Deactivates Caps Word. */
void caps_word_off(void);

/** @brief Toggles Caps Word. */
void caps_word_toggle(void);

/** @brief Gets whether currently active. */
bool is_caps_word_on(void);

/**
* @brief Caps Word set callback.
Expand Down