Browse Source

bind xap_broadcast_secure_status to secure_hook_quantum

zvecr 4 years ago
parent
commit
17dbcedc8b

+ 7 - 0
lib/python/qmk/xap/gen_firmware/header_generator.py

@@ -194,7 +194,14 @@ def _append_internal_types(lines, container):
     broadcast_prefix = broadcast_messages['define_prefix']
     for key, value in broadcast_messages['messages'].items():
         define = value.get('define')
+        name = to_snake(f'{broadcast_prefix}_{define}')
+
         lines.append(f'#define {broadcast_prefix}_{define} {key}')
+        if 'return_type' in value:
+            ret_type = _get_c_type(value['return_type'])
+            lines.append(f'void {name}({ret_type} value);')
+        else:
+            lines.append(f'void {name}(const void *data, size_t length);')
 
     # Add special
     lines.append(f'#define {broadcast_prefix}_TOKEN 0xFFFF')

+ 0 - 4
quantum/keyboard.c

@@ -559,10 +559,6 @@ void quantum_task(void) {
 #ifdef SECURE_ENABLE
     secure_task();
 #endif
-
-#ifdef XAP_ENABLE
-    xap_event_task();
-#endif
 }
 
 /** \brief Keyboard task: Do keyboard routine jobs

+ 4 - 0
quantum/quantum.c

@@ -582,5 +582,9 @@ void secure_hook_quantum(secure_status_t secure_status) {
         clear_keyboard();
         layer_clear();
     }
+
+#    if defined(XAP_ENABLE)
+    xap_broadcast_secure_status(secure_status);
+#    endif
 }
 #endif

+ 0 - 12
quantum/xap/xap.c

@@ -158,15 +158,3 @@ void xap_execute_route(xap_token_t token, const xap_route_t *routes, size_t max_
 void xap_receive(xap_token_t token, const uint8_t *data, size_t length) {
     xap_execute_route(token, xap_route_table, sizeof(xap_route_table) / sizeof(xap_route_t), data, length);
 }
-
-void xap_event_task(void) {
-#ifdef SECURE_ENABLE
-    static secure_status_t last_status = -1;
-
-    secure_status_t status = secure_get_status();
-    if (last_status != status) {
-        last_status = status;
-        xap_broadcast_secure_status(status);
-    }
-#endif
-}

+ 0 - 2
quantum/xap/xap.h

@@ -36,5 +36,3 @@ bool xap_respond_data_P(xap_token_t token, const void *data, size_t length);
 
 void xap_send(xap_token_t token, xap_response_flags_t response_flags, const void *data, size_t length);
 void xap_broadcast(uint8_t type, const void *data, size_t length);
-
-void xap_event_task(void);