peter@413: /* peter@413: This file is part of CanFestival, a library implementing CanOpen Stack. peter@413: peter@413: Copyright (C): Edouard TISSERANT and Francis DUPIN peter@413: AVR Port: Andreas GLAUSER and Peter CHRISTEN peter@413: peter@413: See COPYING file for copyrights details. peter@413: peter@413: This library is free software; you can redistribute it and/or peter@413: modify it under the terms of the GNU Lesser General Public peter@413: License as published by the Free Software Foundation; either peter@413: version 2.1 of the License, or (at your option) any later version. peter@413: peter@413: This library is distributed in the hope that it will be useful, peter@413: but WITHOUT ANY WARRANTY; without even the implied warranty of peter@413: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU peter@413: Lesser General Public License for more details. peter@413: peter@413: You should have received a copy of the GNU Lesser General Public peter@413: License along with this library; if not, write to the Free Software peter@413: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA peter@413: */ peter@413: /****************************************************************************** peter@413: MCU ports and Bits peter@413: Makros for access on hardware peter@413: ******************************************************************************/ peter@413: peter@413: #ifndef _HARDWARE_INCLUDED peter@413: #define _HARDWARE_INCLUDED peter@413: peter@413: /****************************************************************************** peter@413: Makros for bit access on the ports and registers peter@413: ******************************************************************************/ peter@413: // Macros for set and clear bits in I/O registers peter@413: #define setbit(address,bit) ((address) |= (1<<(bit))) peter@413: #define clearbit(address,bit) ((address) &= ~(1<<(bit))) peter@413: #define togglebit(address,bit) ((address) ^= (1<<(bit))) peter@413: peter@413: // Macro for testing of a single bit in an I/O location peter@413: #define checkbit(address,bit) ((address) & (1<<(bit))) peter@413: peter@413: /************************** Hardware Makros **********************************/ peter@413: peter@413: // Read the inputs peter@413: #define get_inputs() (~PINA) peter@413: #define read_bcd() (~PINC & 0x0F) peter@413: // Write the outputs peter@413: #define set_outputs(val) PORTB = ~(val) peter@413: peter@413: #endif // _HARDWARE_INCLUDED peter@413: peter@413: