peter@521: /* peter@521: This file is part of CanFestival, a library implementing CanOpen Stack. peter@521: peter@521: Copyright (C): Edouard TISSERANT and Francis DUPIN peter@521: AT91 Port: Peter CHRISTEN peter@521: peter@521: See COPYING file for copyrights details. peter@521: peter@521: This library is free software; you can redistribute it and/or peter@521: modify it under the terms of the GNU Lesser General Public peter@521: License as published by the Free Software Foundation; either peter@521: version 2.1 of the License, or (at your option) any later version. peter@521: peter@521: This library is distributed in the hope that it will be useful, peter@521: but WITHOUT ANY WARRANTY; without even the implied warranty of peter@521: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU peter@521: Lesser General Public License for more details. peter@521: peter@521: You should have received a copy of the GNU Lesser General Public peter@521: License along with this library; if not, write to the Free Software peter@521: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA peter@521: */ peter@521: peter@521: #ifndef __APPLICFG_AVR__ peter@521: #define __APPLICFG_AVR__ peter@521: peter@521: #include peter@521: #include peter@521: peter@521: peter@521: /// Convert an integer to a string in hexadecimal format peter@521: /// If you do not wants to use a lastCar, put lastCar = '\0' (end of string) peter@521: /// ex : value = 0XABCDEF and lastCar = '\n' peter@521: /// buf[0] = '0' peter@521: /// buf[1] = 'X' peter@521: /// buf[2] = 'A' peter@521: /// .... peter@521: /// buf[7] = 'F' peter@521: /// buf[8] = '\n' peter@521: /// buf[9] = '\0' peter@521: extern char * peter@521: hex_convert (char *buf, unsigned long value, char lastCar); peter@521: peter@521: /// Print the string to the serial port sci peter@521: /// (sci takes the values SCI0 or SCI1) peter@521: extern void printSCI_str (char sci, const char * str); peter@521: peter@521: /// Print the number in hexadecimal to the serial port sci peter@521: /// (sci takes the values SCI0 or SCI1) peter@521: extern void printSCI_nbr (char sci, unsigned long nbr, char lastCar); peter@521: peter@521: // Integers peter@521: #define INTEGER8 signed char peter@521: #define INTEGER16 short peter@521: #define INTEGER24 long peter@521: #define INTEGER32 long peter@521: #define INTEGER40 long long peter@521: #define INTEGER48 long long peter@521: #define INTEGER56 long long peter@521: #define INTEGER64 long long peter@521: peter@521: // Unsigned integers peter@521: #define UNS8 unsigned char peter@521: #define UNS16 unsigned short peter@521: #define UNS32 unsigned long peter@521: #define UNS24 unsigned long peter@521: #define UNS40 unsigned long long peter@521: #define UNS48 unsigned long long peter@521: #define UNS56 unsigned long long peter@521: #define UNS64 unsigned long long peter@521: peter@521: // Reals peter@521: #define REAL32 float peter@521: #define REAL64 double peter@521: peter@521: // Reals peter@521: #define REAL32 float peter@521: #define REAL64 double peter@521: peter@521: #include "can.h" peter@521: peter@521: peter@521: /// Definition of MSG_ERR peter@521: // --------------------- peter@521: #ifdef DEBUG_ERR_CONSOLE_ON peter@521: # define MSG_ERR(num, str, val) \ peter@521: initSCI_0(); \ peter@521: printSCI_nbr(SCI0, num, ' '); \ peter@521: /* large printing on console */ \ peter@521: printSCI_str(SCI0, str); \ peter@521: printSCI_nbr(SCI0, val, '\n'); peter@521: #else peter@521: # define MSG_ERR(num, str, val) peter@521: #endif peter@521: peter@521: /// Definition of MSG_WAR peter@521: // --------------------- peter@521: #ifdef DEBUG_WAR_CONSOLE_ON peter@521: # define MSG_WAR(num, str, val) \ peter@521: initSCI_0(); \ peter@521: printSCI_nbr(SCI0, num, ' '); \ peter@521: /* large printing on console */ \ peter@521: printSCI_str(SCI0, str); \ peter@521: printSCI_nbr(SCI0, val, '\n'); peter@521: #else peter@521: # define MSG_WAR(num, str, val) peter@521: #endif peter@521: peter@521: typedef void* CAN_HANDLE; peter@521: peter@521: typedef void* CAN_PORT; peter@521: peter@521: #endif peter@521: peter@521: