mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-17 13:12:08 +00:00
ChibiOS - Non blocking xap_send_base
This commit is contained in:
parent
d7c6f31567
commit
ff2f0d943b
@ -100,3 +100,14 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
|
||||
[_ADJUST] = { ENCODER_CCW_CW(RGB_RMOD, RGB_MOD), ENCODER_CCW_CW(KC_RIGHT, KC_LEFT) },
|
||||
};
|
||||
#endif
|
||||
|
||||
void housekeeping_task_user(void) {
|
||||
static uint32_t timer = 0;
|
||||
static uint8_t count = 0;
|
||||
if (timer_elapsed32(timer) > 1000) {
|
||||
timer = timer_read32();
|
||||
count++;
|
||||
|
||||
xap_broadcast(0x03, &count, 1);
|
||||
}
|
||||
}
|
||||
|
@ -1138,7 +1138,13 @@ void xap_send_base(uint8_t *data, uint8_t length) {
|
||||
if (length != XAP_EPSIZE) {
|
||||
return;
|
||||
}
|
||||
chnWrite(&drivers.xap_driver.driver, data, length);
|
||||
|
||||
// see console sendchar for timeout details
|
||||
static bool timed_out = false;
|
||||
|
||||
const sysinterval_t timeout = timed_out ? TIME_IMMEDIATE : TIME_MS2I(5);
|
||||
const size_t result = chnWriteTimeout(&drivers.xap_driver.driver, data, length, timeout);
|
||||
timed_out = (result == 0);
|
||||
}
|
||||
|
||||
void xap_send(xap_token_t token, xap_response_flags_t response_flags, const void *data, size_t length) {
|
||||
|
Loading…
Reference in New Issue
Block a user