yarf 0.1
Yet Another RepRap Firmware
Defines
src/hardware/fastio.h File Reference

Collection of macros for easily doing I/O on many of the Atmel ATmega MCUs. More...

#include <avr/io.h>

Go to the source code of this file.

Defines

#define MASK(PIN)   (1 << PIN)
 MASKING- returns $2^PIN$.
#define _READ(IO)   ((bool)(DIO ## IO ## _RPORT & MASK(DIO ## IO ## _PIN)))
 Read a pin.
#define _WRITE(IO, v)   do { if (v) {DIO ## IO ## _WPORT |= MASK(DIO ## IO ## _PIN); } else {DIO ## IO ## _WPORT &= ~MASK(DIO ## IO ## _PIN); }; } while (0)
 write to a pin
#define _TOGGLE(IO)   do {DIO ## IO ## _RPORT = MASK(DIO ## IO ## _PIN); } while (0)
 toggle a pin
#define _SET_INPUT(IO)   do {DIO ## IO ## _DDR &= ~MASK(DIO ## IO ## _PIN); } while (0)
 set pin as input
#define _SET_OUTPUT(IO)   do {DIO ## IO ## _DDR |= MASK(DIO ## IO ## _PIN); } while (0)
 set pin as output
#define _GET_INPUT(IO)   ((DIO ## IO ## _DDR & MASK(DIO ## IO ## _PIN)) == 0)
 check if pin is an input
#define _GET_OUTPUT(IO)   ((DIO ## IO ## _DDR & MASK(DIO ## 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

Detailed Description

Collection of macros for easily doing I/O on many of the Atmel ATmega MCUs.

Author:
Triffid_Hunter This file was written by Triffid_Hunter and has been modified by Kliment.

Definition in file fastio.h.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines