pin definitions and I/O macros More...
#include <avr/io.h>
Go to the source code of this file.
Defines | |
#define | MASK(PIN) (1 << PIN) |
MASKING- returns . | |
#define | _READ(IO) (IO ## _RPORT & MASK(IO ## _PIN)) |
Read a pin. | |
#define | _WRITE(IO, v) do { if (v) { IO ## _WPORT |= MASK(IO ## _PIN); } else { IO ## _WPORT &= ~MASK(IO ## _PIN); }; } while (0) |
write to a pin | |
#define | _TOGGLE(IO) do { IO ## _RPORT = MASK(IO ## _PIN); } while (0) |
toggle a pin | |
#define | _SET_INPUT(IO) do { IO ## _DDR &= ~MASK(IO ## _PIN); } while (0) |
set pin as input | |
#define | _SET_OUTPUT(IO) do { IO ## _DDR |= MASK(IO ## _PIN); } while (0) |
set pin as output | |
#define | _GET_INPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) == 0) |
check if pin is an input | |
#define | _GET_OUTPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) != 0) |
check if pin is an output | |
#define | READ(IO) _READ(IO) |
Read a pin wrapper. | |
#define | WRITE(IO, v) _WRITE(IO, v) |
Write to a pin wrapper. | |
#define | TOGGLE(IO) _TOGGLE(IO) |
toggle a pin wrapper | |
#define | SET_INPUT(IO) _SET_INPUT(IO) |
set pin as input wrapper | |
#define | SET_OUTPUT(IO) _SET_OUTPUT(IO) |
set pin as output wrapper | |
#define | GET_INPUT(IO) _GET_INPUT(IO) |
check if pin is an input wrapper | |
#define | GET_OUTPUT(IO) _GET_OUTPUT(IO) |
check if pin is an output wrapper | |
#define | MASK(PIN) (1 << PIN) |
#define | _READ(IO) (IO ## _RPORT & MASK(IO ## _PIN)) |
#define | _WRITE(IO, v) do { if (v) { IO ## _WPORT |= MASK(IO ## _PIN); } else { IO ## _WPORT &= ~MASK(IO ## _PIN); }; } while (0) |
#define | _TOGGLE(IO) do { IO ## _RPORT = MASK(IO ## _PIN); } while (0) |
#define | _SET_INPUT(IO) do { IO ## _DDR &= ~MASK(IO ## _PIN); } while (0) |
#define | _SET_OUTPUT(IO) do { IO ## _DDR |= MASK(IO ## _PIN); } while (0) |
#define | _GET_INPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) == 0) |
#define | _GET_OUTPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) != 0) |
#define | READ(IO) _READ(IO) |
#define | WRITE(IO, v) _WRITE(IO, v) |
#define | TOGGLE(IO) _TOGGLE(IO) |
#define | SET_INPUT(IO) _SET_INPUT(IO) |
#define | SET_OUTPUT(IO) _SET_OUTPUT(IO) |
#define | GET_INPUT(IO) _GET_INPUT(IO) |
#define | GET_OUTPUT(IO) _GET_OUTPUT(IO) |
#define | MASK(PIN) (1 << PIN) |
MASKING- returns . | |
#define | _READ(IO) (IO ## _RPORT & MASK(IO ## _PIN)) |
Read a pin. | |
#define | _WRITE(IO, v) do { if (v) { IO ## _WPORT |= MASK(IO ## _PIN); } else { IO ## _WPORT &= ~MASK(IO ## _PIN); }; } while (0) |
write to a pin | |
#define | _TOGGLE(IO) do { IO ## _RPORT = MASK(IO ## _PIN); } while (0) |
toggle a pin | |
#define | _SET_INPUT(IO) do { IO ## _DDR &= ~MASK(IO ## _PIN); } while (0) |
set pin as input | |
#define | _SET_OUTPUT(IO) do { IO ## _DDR |= MASK(IO ## _PIN); } while (0) |
set pin as output | |
#define | _GET_INPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) == 0) |
check if pin is an input | |
#define | _GET_OUTPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) != 0) |
check if pin is an output | |
#define | READ(IO) _READ(IO) |
Read a pin wrapper. | |
#define | WRITE(IO, v) _WRITE(IO, v) |
Write to a pin wrapper. | |
#define | TOGGLE(IO) _TOGGLE(IO) |
toggle a pin wrapper | |
#define | SET_INPUT(IO) _SET_INPUT(IO) |
set pin as input wrapper | |
#define | SET_OUTPUT(IO) _SET_OUTPUT(IO) |
set pin as output wrapper | |
#define | GET_INPUT(IO) _GET_INPUT(IO) |
check if pin is an input wrapper | |
#define | GET_OUTPUT(IO) _GET_OUTPUT(IO) |
check if pin is an output wrapper | |
#define | MASK(PIN) (1 << PIN) |
#define | _READ(IO) (IO ## _RPORT & MASK(IO ## _PIN)) |
#define | _WRITE(IO, v) do { if (v) { IO ## _WPORT |= MASK(IO ## _PIN); } else { IO ## _WPORT &= ~MASK(IO ## _PIN); }; } while (0) |
#define | _TOGGLE(IO) do { IO ## _RPORT = MASK(IO ## _PIN); } while (0) |
#define | _SET_INPUT(IO) do { IO ## _DDR &= ~MASK(IO ## _PIN); } while (0) |
#define | _SET_OUTPUT(IO) do { IO ## _DDR |= MASK(IO ## _PIN); } while (0) |
#define | _GET_INPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) == 0) |
#define | _GET_OUTPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) != 0) |
#define | READ(IO) _READ(IO) |
#define | WRITE(IO, v) _WRITE(IO, v) |
#define | TOGGLE(IO) _TOGGLE(IO) |
#define | SET_INPUT(IO) _SET_INPUT(IO) |
#define | SET_OUTPUT(IO) _SET_OUTPUT(IO) |
#define | GET_INPUT(IO) _GET_INPUT(IO) |
#define | GET_OUTPUT(IO) _GET_OUTPUT(IO) |
#define | MASK(PIN) (1 << PIN) |
MASKING- returns . | |
#define | _READ(IO) (IO ## _RPORT & MASK(IO ## _PIN)) |
Read a pin. | |
#define | _WRITE(IO, v) do { if (v) { IO ## _WPORT |= MASK(IO ## _PIN); } else { IO ## _WPORT &= ~MASK(IO ## _PIN); }; } while (0) |
write to a pin | |
#define | _TOGGLE(IO) do { IO ## _RPORT = MASK(IO ## _PIN); } while (0) |
toggle a pin | |
#define | _SET_INPUT(IO) do { IO ## _DDR &= ~MASK(IO ## _PIN); } while (0) |
set pin as input | |
#define | _SET_OUTPUT(IO) do { IO ## _DDR |= MASK(IO ## _PIN); } while (0) |
set pin as output | |
#define | _GET_INPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) == 0) |
check if pin is an input | |
#define | _GET_OUTPUT(IO) ((IO ## _DDR & MASK(IO ## _PIN)) != 0) |
check if pin is an output | |
#define | READ(IO) _READ(IO) |
Read a pin wrapper. | |
#define | WRITE(IO, v) _WRITE(IO, v) |
Write to a pin wrapper. | |
#define | TOGGLE(IO) _TOGGLE(IO) |
toggle a pin wrapper | |
#define | SET_INPUT(IO) _SET_INPUT(IO) |
set pin as input wrapper | |
#define | SET_OUTPUT(IO) _SET_OUTPUT(IO) |
set pin as output wrapper | |
#define | GET_INPUT(IO) _GET_INPUT(IO) |
check if pin is an input wrapper | |
#define | GET_OUTPUT(IO) _GET_OUTPUT(IO) |
check if pin is an output wrapper |
pin definitions and I/O macros
why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html