CANfestival - an open source CANopen framework

Dependencies:   mbed

Committer:
sam_grove
Date:
Wed Sep 26 05:43:05 2012 +0000
Revision:
6:bc64031ac849
Parent:
0:6219434a0cb5
Change a typecast in can_mbed.cpp from unit8_t * to char * to fit the CANMessage constructor

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sam_grove 0:6219434a0cb5 1 /*
sam_grove 0:6219434a0cb5 2 This file is part of CanFestival, a library implementing CanOpen Stack.
sam_grove 0:6219434a0cb5 3
sam_grove 0:6219434a0cb5 4 Copyright (C): Edouard TISSERANT and Francis DUPIN
sam_grove 0:6219434a0cb5 5
sam_grove 0:6219434a0cb5 6 See COPYING file for copyrights details.
sam_grove 0:6219434a0cb5 7
sam_grove 0:6219434a0cb5 8 This library is free software; you can redistribute it and/or
sam_grove 0:6219434a0cb5 9 modify it under the terms of the GNU Lesser General Public
sam_grove 0:6219434a0cb5 10 License as published by the Free Software Foundation; either
sam_grove 0:6219434a0cb5 11 version 2.1 of the License, or (at your option) any later version.
sam_grove 0:6219434a0cb5 12
sam_grove 0:6219434a0cb5 13 This library is distributed in the hope that it will be useful,
sam_grove 0:6219434a0cb5 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
sam_grove 0:6219434a0cb5 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
sam_grove 0:6219434a0cb5 16 Lesser General Public License for more details.
sam_grove 0:6219434a0cb5 17
sam_grove 0:6219434a0cb5 18 You should have received a copy of the GNU Lesser General Public
sam_grove 0:6219434a0cb5 19 License along with this library; if not, write to the Free Software
sam_grove 0:6219434a0cb5 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
sam_grove 0:6219434a0cb5 21 */
sam_grove 0:6219434a0cb5 22
sam_grove 0:6219434a0cb5 23 #ifndef canopen_timer_h
sam_grove 0:6219434a0cb5 24 #define canopen_timer_h
sam_grove 0:6219434a0cb5 25
sam_grove 0:6219434a0cb5 26 #include <timerscfg.h>
sam_grove 0:6219434a0cb5 27 #include <applicfg.h>
sam_grove 0:6219434a0cb5 28
sam_grove 0:6219434a0cb5 29 #define TIMER_HANDLE INTEGER16
sam_grove 0:6219434a0cb5 30
sam_grove 0:6219434a0cb5 31 #include "data.h"
sam_grove 0:6219434a0cb5 32
sam_grove 0:6219434a0cb5 33 #ifdef __cplusplus
sam_grove 0:6219434a0cb5 34 extern "C"{
sam_grove 0:6219434a0cb5 35 #endif
sam_grove 0:6219434a0cb5 36
sam_grove 0:6219434a0cb5 37 /* --------- types and constants definitions --------- */
sam_grove 0:6219434a0cb5 38 #define TIMER_FREE 0
sam_grove 0:6219434a0cb5 39 #define TIMER_ARMED 1
sam_grove 0:6219434a0cb5 40 #define TIMER_TRIG 2
sam_grove 0:6219434a0cb5 41 #define TIMER_TRIG_PERIOD 3
sam_grove 0:6219434a0cb5 42
sam_grove 0:6219434a0cb5 43 #define TIMER_NONE -1
sam_grove 0:6219434a0cb5 44
sam_grove 0:6219434a0cb5 45 typedef void (*TimerCallback_t)(CO_Data* d, UNS32 id);
sam_grove 0:6219434a0cb5 46
sam_grove 0:6219434a0cb5 47 struct struct_s_timer_entry {
sam_grove 0:6219434a0cb5 48 UNS8 state;
sam_grove 0:6219434a0cb5 49 CO_Data* d;
sam_grove 0:6219434a0cb5 50 TimerCallback_t callback; /* The callback func. */
sam_grove 0:6219434a0cb5 51 UNS32 id; /* The callback func. */
sam_grove 0:6219434a0cb5 52 TIMEVAL val;
sam_grove 0:6219434a0cb5 53 TIMEVAL interval; /* Periodicity */
sam_grove 0:6219434a0cb5 54 };
sam_grove 0:6219434a0cb5 55
sam_grove 0:6219434a0cb5 56 typedef struct struct_s_timer_entry s_timer_entry;
sam_grove 0:6219434a0cb5 57
sam_grove 0:6219434a0cb5 58 /* --------- prototypes --------- */
sam_grove 0:6219434a0cb5 59 /*#define SetAlarm(d, id, callback, value, period) printf("%s, %d, SetAlarm(%s, %s, %s, %s, %s)\n",__FILE__, __LINE__, #d, #id, #callback, #value, #period); _SetAlarm(d, id, callback, value, period)*/
sam_grove 0:6219434a0cb5 60 /**
sam_grove 0:6219434a0cb5 61 * @ingroup timer
sam_grove 0:6219434a0cb5 62 * @brief Set an alarm to execute a callback function when expired.
sam_grove 0:6219434a0cb5 63 * @param *d Pointer to a CAN object data structure
sam_grove 0:6219434a0cb5 64 * @param id The alarm Id
sam_grove 0:6219434a0cb5 65 * @param callback A callback function
sam_grove 0:6219434a0cb5 66 * @param value Call the callback function at current time + value
sam_grove 0:6219434a0cb5 67 * @param period Call periodically the callback function
sam_grove 0:6219434a0cb5 68 * @return handle The timer handle
sam_grove 0:6219434a0cb5 69 */
sam_grove 0:6219434a0cb5 70 TIMER_HANDLE SetAlarm(CO_Data* d, UNS32 id, TimerCallback_t callback, TIMEVAL value, TIMEVAL period);
sam_grove 0:6219434a0cb5 71
sam_grove 0:6219434a0cb5 72 /**
sam_grove 0:6219434a0cb5 73 * @ingroup timer
sam_grove 0:6219434a0cb5 74 * @brief Delete an alarm before expiring.
sam_grove 0:6219434a0cb5 75 * @param handle A timer handle
sam_grove 0:6219434a0cb5 76 * @return The timer handle
sam_grove 0:6219434a0cb5 77 */
sam_grove 0:6219434a0cb5 78 TIMER_HANDLE DelAlarm(TIMER_HANDLE handle);
sam_grove 0:6219434a0cb5 79
sam_grove 0:6219434a0cb5 80 void TimeDispatch(void);
sam_grove 0:6219434a0cb5 81
sam_grove 0:6219434a0cb5 82 /**
sam_grove 0:6219434a0cb5 83 * @ingroup timer
sam_grove 0:6219434a0cb5 84 * @brief Set a timerfor a given time.
sam_grove 0:6219434a0cb5 85 * @param value The time value.
sam_grove 0:6219434a0cb5 86 */
sam_grove 0:6219434a0cb5 87 void setTimer(TIMEVAL value);
sam_grove 0:6219434a0cb5 88
sam_grove 0:6219434a0cb5 89 /**
sam_grove 0:6219434a0cb5 90 * @ingroup timer
sam_grove 0:6219434a0cb5 91 * @brief Get the time elapsed since latest timer occurence.
sam_grove 0:6219434a0cb5 92 * @return time elapsed since latest timer occurence
sam_grove 0:6219434a0cb5 93 */
sam_grove 0:6219434a0cb5 94 TIMEVAL getElapsedTime(void);
sam_grove 0:6219434a0cb5 95
sam_grove 0:6219434a0cb5 96 #ifdef __cplusplus
sam_grove 0:6219434a0cb5 97 }
sam_grove 0:6219434a0cb5 98 #endif
sam_grove 0:6219434a0cb5 99
sam_grove 0:6219434a0cb5 100 #endif /* #define __timer_h__ */