bind xap_broadcast_secure_status to secure_hook_quantum

This commit is contained in:
zvecr 2022-05-22 22:47:50 +01:00
parent d95d22201a
commit 17dbcedc8b
5 changed files with 11 additions and 18 deletions

View file

@ -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')

View file

@ -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

View file

@ -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

View file

@ -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
}

View file

@ -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);