`qmk format-c`, `qmk format-python`

This commit is contained in:
Nick Brassel 2022-03-09 20:01:20 +11:00
parent 575d8c19fc
commit c3ac89d1c9
4 changed files with 13 additions and 9 deletions

View File

@ -1,7 +1,5 @@
"""This script generates the XAP protocol generated header to be compiled into QMK. """This script generates the XAP protocol generated header to be compiled into QMK.
""" """
import pyhash
from qmk.casing import to_snake from qmk.casing import to_snake
from qmk.constants import GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE from qmk.constants import GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE
from qmk.xap.common import latest_xap_defs, route_conditions from qmk.xap.common import latest_xap_defs, route_conditions

View File

@ -22,7 +22,7 @@
#define QSTR(z) QSTR2(z) #define QSTR(z) QSTR2(z)
typedef enum xap_route_type_t { typedef enum xap_route_type_t {
XAP_UNUSED = 0, // "Unused" needs to be zero -- undefined routes (through preprocessor) will be skipped XAP_UNUSED = 0, // "Unused" needs to be zero -- undefined routes (through preprocessor) will be skipped
XAP_ROUTE, XAP_ROUTE,
XAP_EXECUTE, XAP_EXECUTE,
XAP_VALUE, XAP_VALUE,
@ -113,4 +113,6 @@ void xap_execute_route(xap_token_t token, const xap_route_t *routes, size_t max_
xap_respond_failure(token, XAP_RESPONSE_FLAG_FAILED); xap_respond_failure(token, XAP_RESPONSE_FLAG_FAILED);
} }
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_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);
}

View File

@ -18,7 +18,9 @@
#include <xap.h> #include <xap.h>
#include <info_json_gz.h> #include <info_json_gz.h>
void xap_respond_failure(xap_token_t token, xap_response_flags_t response_flags) { xap_send(token, response_flags, NULL, 0); } void xap_respond_failure(xap_token_t token, xap_response_flags_t response_flags) {
xap_send(token, response_flags, NULL, 0);
}
bool xap_respond_data(xap_token_t token, const void *data, size_t length) { bool xap_respond_data(xap_token_t token, const void *data, size_t length) {
xap_send(token, XAP_RESPONSE_FLAG_SUCCESS, data, length); xap_send(token, XAP_RESPONSE_FLAG_SUCCESS, data, length);
@ -36,4 +38,6 @@ bool xap_respond_u32(xap_token_t token, uint32_t value) {
return true; return true;
} }
uint32_t xap_route_qmk_ffffffffffffffff_getter(void) { return 0x12345678; } uint32_t xap_route_qmk_ffffffffffffffff_getter(void) {
return 0x12345678;
}

View File

@ -293,7 +293,7 @@ static void xap_task(void) {
} }
} }
} }
#endif // XAP_ENABLE #endif // XAP_ENABLE
/******************************************************************************* /*******************************************************************************
* Console * Console
@ -561,7 +561,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) {
/* Setup XAP endpoints */ /* Setup XAP endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint((XAP_IN_EPNUM | ENDPOINT_DIR_IN), EP_TYPE_INTERRUPT, XAP_EPSIZE, 1); ConfigSuccess &= Endpoint_ConfigureEndpoint((XAP_IN_EPNUM | ENDPOINT_DIR_IN), EP_TYPE_INTERRUPT, XAP_EPSIZE, 1);
ConfigSuccess &= Endpoint_ConfigureEndpoint((XAP_OUT_EPNUM | ENDPOINT_DIR_OUT), EP_TYPE_INTERRUPT, XAP_EPSIZE, 1); ConfigSuccess &= Endpoint_ConfigureEndpoint((XAP_OUT_EPNUM | ENDPOINT_DIR_OUT), EP_TYPE_INTERRUPT, XAP_EPSIZE, 1);
#endif // XAP_ENABLE #endif // XAP_ENABLE
#ifdef CONSOLE_ENABLE #ifdef CONSOLE_ENABLE
/* Setup console endpoint */ /* Setup console endpoint */
@ -1189,7 +1189,7 @@ void protocol_post_task(void) {
#endif #endif
#ifdef XAP_ENABLE #ifdef XAP_ENABLE
xap_task(); xap_task();
#endif #endif
#if !defined(INTERRUPT_CONTROL_ENDPOINT) #if !defined(INTERRUPT_CONTROL_ENDPOINT)