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: #ifndef __TIMERSCFG_H__ etisserant@375: #define __TIMERSCFG_H__ etisserant@375: etisserant@375: // Whatever your microcontroller, the timer wont work if etisserant@375: // TIMEVAL is not at least on 32 bits etisserant@375: #define TIMEVAL UNS32 etisserant@375: etisserant@375: // The timer of the AVR counts from 0000 to 0xFFFF in CTC mode (it can be etisserant@375: // shortened setting OCR3A eg. to get 2ms instead of 2.048ms) etisserant@375: #define TIMEVAL_MAX 0xFFFF etisserant@375: etisserant@375: // The timer is incrementing every 4 us. etisserant@375: //#define MS_TO_TIMEVAL(ms) (ms * 250) etisserant@375: //#define US_TO_TIMEVAL(us) (us>>2) etisserant@375: etisserant@375: // The timer is incrementing every 8 us. etisserant@375: #define MS_TO_TIMEVAL(ms) ((ms) * 125) etisserant@375: #define US_TO_TIMEVAL(us) ((us)>>3) etisserant@375: etisserant@375: #endif