From 97ab5ea995ab99284861ec92d063987d201d12d3 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Thu, 29 Mar 2012 23:54:16 +0200 Subject: digital/avr/common: add IO_TOGGLE --- digital/avr/common/io.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'digital/avr') diff --git a/digital/avr/common/io.h b/digital/avr/common/io.h index 9690a55b..66a64e04 100644 --- a/digital/avr/common/io.h +++ b/digital/avr/common/io.h @@ -96,6 +96,7 @@ intr_restore (intr_flags_t flags) { } * IO_GET (MY_IO) => (PINB & _BV (5)) * IO_SET (MY_IO) => PORTB |= _BV (5) * IO_CLR (MY_IO) => PORTB &= ~_BV (5) + * IO_TOGGLE (MY_IO) => PORTB ^= _BV (5) * IO_OUTPUT (MY_IO) => DDRB |= _BV (5) * IO_INPUT (MY_IO) => DDRB &= ~_BV (5) */ @@ -116,6 +117,8 @@ intr_restore (intr_flags_t flags) { } #define IO_SET_(p, n) IO_PORT_ (p, n) |= IO_BV_ (p, n) #define IO_CLR(io) IO_CLR_ (io) #define IO_CLR_(p, n) IO_PORT_ (p, n) &= ~IO_BV_ (p, n) +#define IO_TOGGLE(io) IO_TOGGLE_ (io) +#define IO_TOGGLE_(p, n) IO_PORT_ (p, n) ^= IO_BV_ (p, n) #define IO_OUTPUT(io) IO_OUTPUT_ (io) #define IO_OUTPUT_(p, n) IO_DDR_ (p, n) |= IO_BV_ (p, n) #define IO_INPUT(io) IO_INPUT_ (io) -- cgit v1.2.3