Arduino-GPIO
General Purpose Input/Output (GPIO) library for Arduino
Board.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  BOARD
 

Macros

#define GPIO_PIN(port, pin)   (((port) << 4) | (pin))
 
#define GPIO_REG(pin)   ((pin) >> 4)
 
#define GPIO_MASK(pin)   _BV((pin) & 0xf)
 
#define GPIO_ATOMIC_MAX   GPIO_PIN(0x40,0)
 
#define GPIO_ATOMIC(expr)
 

Macro Definition Documentation

#define GPIO_ATOMIC (   expr)
Value:
do { \
if (PIN < GPIO_ATOMIC_MAX) { \
expr; \
} \
else { \
uint8_t sreg = SREG; \
__asm__ __volatile__("cli" ::: "memory"); \
expr; \
SREG = sreg; \
__asm__ __volatile__("" ::: "memory"); \
} \
} while (0)
#define GPIO_ATOMIC_MAX
Definition: Board.h:43

Forces given expression to be atomic. Higher port addresses cannot be accessed with a single instruction and require disabling of interrupts to become atomic.

Parameters
[in]exprexpression to be atomic.

Definition at line 51 of file Board.h.

#define GPIO_ATOMIC_MAX   GPIO_PIN(0x40,0)

Maximum port control register address for atomic bit instructions.

Definition at line 43 of file Board.h.

#define GPIO_MASK (   pin)    _BV((pin) & 0xf)

Return pin mask from board pin value.

Returns
pin mask

Definition at line 40 of file Board.h.

#define GPIO_PIN (   port,
  pin 
)    (((port) << 4) | (pin))

Board pin values are bit-pointers and constructed from port control register address and pin bit position.

Parameters
[in]portcontrol register address.
[in]pinpin bit position in control register.

Definition at line 28 of file Board.h.

#define GPIO_REG (   pin)    ((pin) >> 4)

Return port control register address from board pin value.

Returns
io port address

Definition at line 34 of file Board.h.