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/adb.c | 171 +++++++++++++++++++----------------------------- 1 file changed, 66 insertions(+), 105 deletions(-) (limited to 'tmk_core/protocol/adb.c') diff --git a/tmk_core/protocol/adb.c b/tmk_core/protocol/adb.c index 5c6c99b4fc..a23c919619 100644 --- a/tmk_core/protocol/adb.c +++ b/tmk_core/protocol/adb.c @@ -42,11 +42,10 @@ POSSIBILITY OF SUCH DAMAGE. #include #include "adb.h" - // GCC doesn't inline functions normally -#define data_lo() (ADB_DDR |= (1<>i)) + if (data & (0x80 >> i)) place_bit1(); else place_bit0(); @@ -275,29 +243,22 @@ static inline void send_byte(uint8_t data) // These are carefully coded to take 6 cycles of overhead. // inline asm approach became too convoluted -static inline uint16_t wait_data_lo(uint16_t us) -{ +static inline uint16_t wait_data_lo(uint16_t us) { do { - if ( !data_in() ) - break; + if (!data_in()) break; _delay_us(1 - (6 * 1000000.0 / F_CPU)); - } - while ( --us ); + } while (--us); return us; } -static inline uint16_t wait_data_hi(uint16_t us) -{ +static inline uint16_t wait_data_hi(uint16_t us) { do { - if ( data_in() ) - break; + if (data_in()) break; _delay_us(1 - (6 * 1000000.0 / F_CPU)); - } - while ( --us ); + } while (--us); return us; } - /* ADB Protocol ============ @@ -375,7 +336,7 @@ Commands A A A A 1 1 R R Talk(read from a device) The command to read keycodes from keyboard is 0x2C which - consist of keyboard address 2 and Talk against register 0. + consist of keyboard address 2 and Talk against register 0. Address: 2: keyboard @@ -457,7 +418,7 @@ Keyboard Data(Register0) Keyboard LEDs & state of keys(Register2) This register hold current state of three LEDs and nine keys. The state of LEDs can be changed by sending Listen command. - + 1514 . . . . . . 7 6 5 . 3 2 1 0 | | | | | | | | | | | | | | | +- LED1(NumLock) | | | | | | | | | | | | | | +--- LED2(CapsLock) -- cgit v1.2.3