// ---------------------------------------------------------------------------- /* * Copyright (c) 2007 Fabian Greif, Roboterclub Aachen e.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Id: mcp2515_private.h 1565 2011-10-15 02:18:36Z nratonpass $ */ // ---------------------------------------------------------------------------- #ifndef MCP2515_PRIVATE_H #define MCP2515_PRIVATE_H // ---------------------------------------------------------------------------- /** * \brief defines only used inside the library * * \author Fabian Greif * \version $Id: mcp2515_private.h 1565 2011-10-15 02:18:36Z nratonpass $ *\version $Id: mcp2515_private.h 1565 2011-10-15 02:18:36Z nratonpass $ * \todo MCP2515_TXRTSn Pins nutzbar machen. */ // ---------------------------------------------------------------------------- #include #include #include #include #include "can.h" #include "utils.h" #include "can_private.h" #include "spi.h" // ---------------------------------------------------------------------------- #if defined(SUPPORT_MCP2515) && (SUPPORT_MCP2515 == 1) #if defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) || defined(__AVR_ATmega644__) #define P_MOSI B,5 #define P_MISO B,6 #define P_SCK B,7 #define SUPPORT_FOR_MCP2515__ #elif defined(__AVR_ATmega8__) || defined(__AVR_ATmega48__) || \ defined(__AVR_ATmega88__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) #define P_MOSI B,3 #define P_MISO B,4 #define P_SCK B,5 #define SUPPORT_FOR_MCP2515__ #elif defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) #define P_MOSI B,2 #define P_MISO B,3 #define P_SCK B,1 #define SUPPORT_FOR_MCP2515__ #elif defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) #define P_MOSI B,0 #define P_MISO B,1 #define P_SCK B,2 #define USE_SOFTWARE_SPI 1 #define SUPPORT_FOR_MCP2515__ #else #error choosen AVR-type is not supported yet! #endif #endif #ifdef SUPPORT_FOR_MCP2515__ #define MCP2515_DISABLE_MASKS_AND_FILTERS 1 // ---------------------------------------------------------------------------- // load some default values #ifndef MCP2515_CLKOUT_PRESCALER #define MCP2515_CLKOUT_PRESCALER 0 #endif #ifndef MCP2515_INTERRUPTS #define MCP2515_INTERRUPTS (1<