From cb1285b0ab45336be5f0ade2bf2d6ebf9a3ae993 Mon Sep 17 00:00:00 2001 From: bruce33 Date: Sun, 15 Jul 2018 11:10:55 +0100 Subject: [PATCH] core: improve timing in ps2_host_send to fix caps/num LEDs consistency --- tmk_core/protocol/ps2_busywait.c | 7 ++++--- tmk_core/protocol/ps2_interrupt.c | 7 ++++--- tmk_core/protocol/ps2_usart.c | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/tmk_core/protocol/ps2_busywait.c b/tmk_core/protocol/ps2_busywait.c index a64933219e..0fb9617a23 100644 --- a/tmk_core/protocol/ps2_busywait.c +++ b/tmk_core/protocol/ps2_busywait.c @@ -73,6 +73,9 @@ uint8_t ps2_host_send(uint8_t data) bool parity = true; ps2_error = PS2_ERR_NONE; + // see http://www.burtonsys.com/ps2_chapweske.htm but note that + // sending host->device samples on the rising not falling CLK edge + /* terminate a transmission if we have */ inhibit(); wait_us(100); // 100us [4]p.13, [5]p.50 @@ -84,7 +87,6 @@ uint8_t ps2_host_send(uint8_t data) /* Data bit */ for (uint8_t i = 0; i < 8; i++) { - wait_us(15); if (data&(1<device samples on the rising not falling CLK edge + PS2_INT_OFF(); /* terminate a transmission if we have */ @@ -85,7 +88,6 @@ uint8_t ps2_host_send(uint8_t data) /* Data bit[2-9] */ for (uint8_t i = 0; i < 8; i++) { - _delay_us(15); if (data&(1<device samples on the rising not falling CLK edge + PS2_USART_OFF(); /* terminate a transmission if we have */ @@ -91,7 +94,6 @@ uint8_t ps2_host_send(uint8_t data) /* Data bit[2-9] */ for (uint8_t i = 0; i < 8; i++) { - _delay_us(15); if (data&(1<