#ifndef IO_MACROS_H_INCLUDED #define IO_MACROS_H_INCLUDED /* || || Filename: IO_Macros.h || Title: IO manipulation macros || Author: Efthymios Koktsidis || Email: efthymios.ks@gmail.com || Compiler: AVR-GCC || Description: This library contains macros for || easy port manipulation (similar || to Arduino). || || Demo: || 1. #define LED A, 0 || 6. PinModeToggle(BUTTON); || 2. #define BUTTON A, 1 || 7. DigitalWrite(LED, LOW); || 3. || 8. DigitalWrite(LED, HIGH); || 4. PinMode(BUTTON, OUTPUT); || 9. DigitalLevelToggle(LED); || 5. PinMode(LED, OUTPUT); ||10. int a = DigitalRead(BUTTON); || */ #include //----- I/O Macros ----- //Macros to edit PORT, DDR and PIN #define PinMode( x, y) ( y ? _SET(DDR, x) : _CLEAR(DDR, x) ) #define DigitalWrite( x, y) ( y ? _SET(PORT, x) : _CLEAR(PORT, x) ) #define DigitalRead( x) ( _GET(PIN, x) ) #define PinModeToggle( x) ( _TOGGLE(DDR, x) ) #define DigitalLevelToggle( x) ( _TOGGLE(PORT, x) ) //General use bit manipulating commands #define BitSet( x, y) ( x |= (1UL<