summaryrefslogtreecommitdiff
path: root/users/drashna/transport_sync.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/drashna/transport_sync.c')
-rw-r--r--users/drashna/transport_sync.c122
1 files changed, 63 insertions, 59 deletions
diff --git a/users/drashna/transport_sync.c b/users/drashna/transport_sync.c
index c3ef2eff5b..fdd596c04c 100644
--- a/users/drashna/transport_sync.c
+++ b/users/drashna/transport_sync.c
@@ -1,30 +1,44 @@
-#ifdef SPLIT_TRANSACTION_IDS_USER
-# include "transport_sync.h"
-# include "transactions.h"
-# include <string.h>
-
-# ifdef UNICODE_ENABLE
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "transport_sync.h"
+#include "transactions.h"
+#include <string.h>
+
+#ifdef UNICODE_ENABLE
extern unicode_config_t unicode_config;
-# endif
-# ifdef AUDIO_ENABLE
-# include "audio.h"
-# endif
-# if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
+#endif
+#ifdef AUDIO_ENABLE
+# include "audio.h"
+extern bool delayed_tasks_run;
+#endif
+#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
extern bool tap_toggling;
-# endif
-# ifdef SWAP_HANDS_ENABLE
+#endif
+#ifdef SWAP_HANDS_ENABLE
extern bool swap_hands;
-# endif
+#endif
extern userspace_config_t userspace_config;
-typedef struct {
- bool oled_on;
- bool audio_enable;
- bool audio_clicky_enable;
- bool tap_toggling;
- bool unicode_mode;
- bool swap_hands;
- uint8_t reserved :2;
+__attribute__((aligned(8))) typedef struct {
+ bool audio_enable;
+ bool audio_clicky_enable;
+ bool tap_toggling;
+ bool unicode_mode;
+ bool swap_hands;
} user_runtime_config_t;
uint16_t transport_keymap_config = 0;
@@ -57,58 +71,49 @@ void keyboard_post_init_transport_sync(void) {
void user_transport_update(void) {
if (is_keyboard_master()) {
-# ifdef OLED_DRIVER_ENABLE
- user_state.oled_on = is_oled_on();
-# endif
-
transport_keymap_config = keymap_config.raw;
transport_userspace_config = userspace_config.raw;
-# ifdef AUDIO_ENABLE
+#ifdef AUDIO_ENABLE
user_state.audio_enable = is_audio_on();
user_state.audio_clicky_enable = is_clicky_on();
-# endif
-# if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
+#endif
+#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
user_state.tap_toggling = tap_toggling;
-# endif
-# ifdef SWAP_HANDS_ENABLE
+#endif
+#ifdef SWAP_HANDS_ENABLE
user_state.swap_hands = swap_hands;
-# endif
+#endif
} else {
-# ifdef OLED_DRIVER_ENABLE
- if (user_state.oled_on) {
- oled_on();
- } else {
- oled_off();
- }
-# endif
keymap_config.raw = transport_keymap_config;
userspace_config.raw = transport_userspace_config;
-# ifdef UNICODE_ENABLE
+#ifdef UNICODE_ENABLE
unicode_config.input_mode = user_state.unicode_mode;
-# endif
-# ifdef AUDIO_ENABLE
- if (user_state.audio_enable != is_audio_on()) {
- if (user_state.audio_enable) {
- audio_on();
- } else {
- audio_off();
+#endif
+#ifdef AUDIO_ENABLE
+ if (delayed_tasks_run) {
+ if (user_state.audio_enable != is_audio_on()) {
+ if (user_state.audio_enable) {
+ audio_on();
+ } else {
+ audio_off();
+ }
}
- }
- if (user_state.audio_clicky_enable != is_clicky_on()) {
- if (user_state.audio_clicky_enable) {
- clicky_on();
- } else {
- clicky_off();
+ if (user_state.audio_clicky_enable != is_clicky_on()) {
+ if (user_state.audio_clicky_enable) {
+ clicky_on();
+ } else {
+ clicky_off();
+ }
}
}
-# endif
-# if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
+#endif
+#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
tap_toggling = user_state.tap_toggling;
-# endif
-# ifdef SWAP_HANDS_ENABLE
+#endif
+#ifdef SWAP_HANDS_ENABLE
swap_hands = user_state.swap_hands;
-# endif
+#endif
}
}
@@ -185,4 +190,3 @@ void housekeeping_task_user(void) {
// Data sync from master to slave
user_transport_sync();
}
-#endif