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