From b624f32f944acdc59dcb130674c09090c5c404cb 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/iwrap/iwrap.c | 202 +++++++++++++++------------------------- 1 file changed, 76 insertions(+), 126 deletions(-) (limited to 'tmk_core/protocol/iwrap/iwrap.c') diff --git a/tmk_core/protocol/iwrap/iwrap.c b/tmk_core/protocol/iwrap/iwrap.c index 71ccc493e2..05e632da38 100644 --- a/tmk_core/protocol/iwrap/iwrap.c +++ b/tmk_core/protocol/iwrap/iwrap.c @@ -37,43 +37,39 @@ along with this program. If not, see . #include "iwrap.h" #include "print.h" - /* iWRAP MUX mode utils. 3.10 HID raw mode(iWRAP_HID_Application_Note.pdf) */ -#define MUX_HEADER(LINK, LENGTH) do { \ - xmit(0xbf); /* SOF */ \ - xmit(LINK); /* Link */ \ - xmit(0x00); /* Flags */ \ - xmit(LENGTH); /* Length */ \ -} while (0) -#define MUX_FOOTER(LINK) xmit(LINK^0xff) - +#define MUX_HEADER(LINK, LENGTH) \ + do { \ + xmit(0xbf); /* SOF */ \ + xmit(LINK); /* Link */ \ + xmit(0x00); /* Flags */ \ + xmit(LENGTH); /* Length */ \ + } while (0) +#define MUX_FOOTER(LINK) xmit(LINK ^ 0xff) static uint8_t connected = 0; -//static uint8_t channel = 1; +// static uint8_t channel = 1; /* iWRAP buffer */ #define MUX_BUF_SIZE 64 -static char buf[MUX_BUF_SIZE]; +static char buf[MUX_BUF_SIZE]; static uint8_t snd_pos = 0; #define MUX_RCV_BUF_SIZE 256 -static char rcv_buf[MUX_RCV_BUF_SIZE]; +static char rcv_buf[MUX_RCV_BUF_SIZE]; static uint8_t rcv_head = 0; static uint8_t rcv_tail = 0; - /* receive buffer */ -static void rcv_enq(char c) -{ +static void rcv_enq(char c) { uint8_t next = (rcv_head + 1) % MUX_RCV_BUF_SIZE; if (next != rcv_tail) { rcv_buf[rcv_head] = c; - rcv_head = next; + rcv_head = next; } } -static char rcv_deq(void) -{ +static char rcv_deq(void) { char c = 0; if (rcv_head != rcv_tail) { c = rcv_buf[rcv_tail++]; @@ -91,38 +87,33 @@ static char rcv_peek(void) } */ -static void rcv_clear(void) -{ - rcv_tail = rcv_head = 0; -} +static void rcv_clear(void) { rcv_tail = rcv_head = 0; } /* iWRAP response */ -ISR(PCINT1_vect, ISR_BLOCK) // recv() runs away in case of ISR_NOBLOCK +ISR(PCINT1_vect, ISR_BLOCK) // recv() runs away in case of ISR_NOBLOCK { - if ((SUART_IN_PIN & (1<mods); - xmit(0x00); // reserved byte(always 0) + xmit(0x00); // reserved byte(always 0) xmit(report->keys[0]); xmit(report->keys[1]); xmit(report->keys[2]); @@ -347,16 +302,15 @@ static void send_keyboard(report_keyboard_t *report) MUX_FOOTER(0x01); } -static void send_mouse(report_mouse_t *report) -{ +static void send_mouse(report_mouse_t *report) { #if defined(MOUSEKEY_ENABLE) || defined(PS2_MOUSE_ENABLE) || defined(POINTING_DEVICE_ENABLE) if (!iwrap_connected() && !iwrap_check_connection()) return; MUX_HEADER(0x01, 0x09); // HID raw mode header xmit(0x9f); - xmit(0x07); // Length - xmit(0xa1); // DATA(Input) - xmit(0x02); // Report ID + xmit(0x07); // Length + xmit(0xa1); // DATA(Input) + xmit(0x02); // Report ID xmit(report->buttons); xmit(report->x); xmit(report->y); @@ -366,18 +320,14 @@ static void send_mouse(report_mouse_t *report) #endif } -static void send_system(uint16_t data) -{ - /* not supported */ -} +static void send_system(uint16_t data) { /* not supported */ } -static void send_consumer(uint16_t data) -{ +static void send_consumer(uint16_t data) { #ifdef EXTRAKEY_ENABLE static uint16_t last_data = 0; - uint8_t bits1 = 0; - uint8_t bits2 = 0; - uint8_t bits3 = 0; + uint8_t bits1 = 0; + uint8_t bits2 = 0; + uint8_t bits3 = 0; if (!iwrap_connected() && !iwrap_check_connection()) return; if (data == last_data) return; @@ -458,9 +408,9 @@ static void send_consumer(uint16_t data) MUX_HEADER(0x01, 0x07); xmit(0x9f); - xmit(0x05); // Length - xmit(0xa1); // DATA(Input) - xmit(0x03); // Report ID + xmit(0x05); // Length + xmit(0xa1); // DATA(Input) + xmit(0x03); // Report ID xmit(bits1); xmit(bits2); xmit(bits3); -- cgit v1.2.3