From d1ae1502adae6e9be0b1c284da5f0a7d72b72d33 Mon Sep 17 00:00:00 2001 From: asterix Date: Mon, 17 May 2010 08:24:48 +0000 Subject: [PATCH] Reformat. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3702 38d2e660-2303-0410-9eaa-f027e97ec537 --- boards/triface/hw/hw_input.h | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/boards/triface/hw/hw_input.h b/boards/triface/hw/hw_input.h index f0ef721c..2a56b89f 100644 --- a/boards/triface/hw/hw_input.h +++ b/boards/triface/hw/hw_input.h @@ -26,7 +26,7 @@ * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. * - * Copyright 2003, 2004, 2006 Develer S.r.l. (http://www.develer.com/) + * Copyright 2003, 2004, 2006, 2010 Develer S.r.l. (http://www.develer.com/) * Copyright 2000 Bernie Innocenti * * --> @@ -42,19 +42,17 @@ #include /* Set pins as input and enable pull-up */ -#define INPUT_INIT_D do \ -{ \ - (DDRD &= ~(BV(PD4) | BV(PD5) | BV(PD6) | BV(PD7))); \ - (PORTD |= (BV(PD4) | BV(PD5) | BV(PD6) | BV(PD7))); \ -} while(0) +#define INPUT_INIT_D \ + do{ \ + DDRD &= ~(BV(PD4) | BV(PD5) | BV(PD6) | BV(PD7)); \ + PORTD |= (BV(PD4) | BV(PD5) | BV(PD6) | BV(PD7)); \ + } while(0) -#define INPUT_INIT_E do \ -{ \ - (DDRE &= ~(BV(PE4) | BV(PE5) | BV(PE6) | BV(PE7))); \ - ATOMIC((PORTE |= (BV(PE4) | BV(PE5) | BV(PE6) | BV(PE7)))); \ -} while(0) - -#define INPUT_INIT do { INPUT_INIT_D; INPUT_INIT_E;} while(0) +#define INPUT_INIT_E \ + do{ \ + DDRE &= ~(BV(PE4) | BV(PE5) | BV(PE6) | BV(PE7)); \ + PORTE |= (BV(PE4) | BV(PE5) | BV(PE6) | BV(PE7)); \ + } while(0) INLINE uint8_t INPUT_GET(void) { @@ -62,10 +60,17 @@ INLINE uint8_t INPUT_GET(void) out_d = PIND; out_e = PINE; + /* Select our input (see scheme) */ out_d >>= 4; out_e = out_e & 0xF0; - return out_e | out_d; + return (out_e | out_d); } -#endif // HW_INPUT_H +#define INPUT_INIT() \ + do { \ + INPUT_INIT_D; \ + INPUT_INIT_E; \ + } while(0) + +#endif /* HW_INPUT_H */ -- 2.25.1