From f8fe33acfac01064112fd2b5da680abfb5190b97 Mon Sep 17 00:00:00 2001 From: skullY Date: Fri, 30 Aug 2019 11:19:03 -0700 Subject: clang-format changes --- tmk_core/protocol/ps2_usart.c | 88 +++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 49 deletions(-) (limited to 'tmk_core/protocol/ps2_usart.c') diff --git a/tmk_core/protocol/ps2_usart.c b/tmk_core/protocol/ps2_usart.c index 6936ca7b88..6a66dc4a1e 100644 --- a/tmk_core/protocol/ps2_usart.c +++ b/tmk_core/protocol/ps2_usart.c @@ -46,53 +46,48 @@ POSSIBILITY OF SUCH DAMAGE. #include "ps2_io.h" #include "print.h" - -#define WAIT(stat, us, err) do { \ - if (!wait_##stat(us)) { \ - ps2_error = err; \ - goto ERROR; \ - } \ -} while (0) - +#define WAIT(stat, us, err) \ + do { \ + if (!wait_##stat(us)) { \ + ps2_error = err; \ + goto ERROR; \ + } \ + } while (0) uint8_t ps2_error = PS2_ERR_NONE; - static inline uint8_t pbuf_dequeue(void); -static inline void pbuf_enqueue(uint8_t data); -static inline bool pbuf_has_data(void); -static inline void pbuf_clear(void); +static inline void pbuf_enqueue(uint8_t data); +static inline bool pbuf_has_data(void); +static inline void pbuf_clear(void); - -void ps2_host_init(void) -{ - idle(); // without this many USART errors occur when cable is disconnected +void ps2_host_init(void) { + idle(); // without this many USART errors occur when cable is disconnected PS2_USART_INIT(); PS2_USART_RX_INT_ON(); // POR(150-2000ms) plus BAT(300-500ms) may take 2.5sec([3]p.20) //_delay_ms(2500); } -uint8_t ps2_host_send(uint8_t data) -{ +uint8_t ps2_host_send(uint8_t data) { bool parity = true; - ps2_error = PS2_ERR_NONE; + ps2_error = PS2_ERR_NONE; PS2_USART_OFF(); /* terminate a transmission if we have */ inhibit(); - _delay_us(100); // [4]p.13 + _delay_us(100); // [4]p.13 /* 'Request to Send' and Start bit */ data_lo(); clock_hi(); - WAIT(clock_lo, 10000, 10); // 10ms [5]p.50 + WAIT(clock_lo, 10000, 10); // 10ms [5]p.50 /* Data bit[2-9] */ for (uint8_t i = 0; i < 8; i++) { _delay_us(15); - if (data&(1<