From 5496a8e9da16286ecc7e486c37438c234167ea92 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 30 Mar 2009 00:20:12 +0200 Subject: * digital/avr/common: - added IO_* macros to define port/bit combinations. --- digital/avr/common/io.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'digital/avr/common/io.h') diff --git a/digital/avr/common/io.h b/digital/avr/common/io.h index d6be6042..6fe5479a 100644 --- a/digital/avr/common/io.h +++ b/digital/avr/common/io.h @@ -49,4 +49,25 @@ #endif /* HOST */ +/** Use these macros to define port and bit number combination. + * For example: + * + * #define MY_IO B, 5 + * IO_PORT (MY_IO) => PORTB + * IO_DDR (MY_IO) => DDRB + * IO_PIN (MY_IO) => PINB + * IO_BV (MY_IO) => _BV (5) + * IO_N (MY_IO) => (5) + */ +#define IO_PORT(io) IO_PORT_ (io) +#define IO_PORT_(p, n) PORT ## p +#define IO_DDR(io) IO_DDR_ (io) +#define IO_DDR_(p, n) DDR ## p +#define IO_PIN(io) IO_PIN_ (io) +#define IO_PIN_(p, n) PIN ## p +#define IO_BV(io) IO_BV_ (io) +#define IO_BV_(p, n) _BV (n) +#define IO_N(io) IO_N_ (io) +#define IO_N_(p, n) (n) + #endif /* io_h */ -- cgit v1.2.3