New feature : event timers allowed for RxPDOs (subidx 5 in RxPDO com paramaters)
--- a/examples/DS401_Master/TestMasterMicroMod.c Thu Oct 13 17:51:27 2011 +0200
+++ b/examples/DS401_Master/TestMasterMicroMod.c Wed Nov 02 22:37:24 2011 +0100
@@ -136,8 +136,9 @@
4, /*UNS8 count*/
0, /*UNS8 dataType*/
&TPDO_COBId,/*void *data*/
- CheckSDOAndContinue); /*SDOCallback_t Callback*/
- }
+ CheckSDOAndContinue, /*SDOCallback_t Callback*/
+ 0); /* use block mode */
+ }
break;
case 2:
@@ -153,7 +154,8 @@
1, /*UNS8 count*/
0, /*UNS8 dataType*/
&Transmission_Type,/*void *data*/
- CheckSDOAndContinue); /*SDOCallback_t Callback*/
+ CheckSDOAndContinue, /*SDOCallback_t Callback*/
+ 0); /* use block mode */
}
break;
@@ -170,7 +172,8 @@
4, /*UNS8 count*/
0, /*UNS8 dataType*/
&TPDO_COBId,/*void *data*/
- CheckSDOAndContinue); /*SDOCallback_t Callback*/
+ CheckSDOAndContinue, /*SDOCallback_t Callback*/
+ 0); /* use block mode */
}
break;
@@ -187,7 +190,8 @@
4, /*UNS8 count*/
0, /*UNS8 dataType*/
&TPDO_COBId,/*void *data*/
- CheckSDOAndContinue); /*SDOCallback_t Callback*/
+ CheckSDOAndContinue, /*SDOCallback_t Callback*/
+ 0); /* use block mode */
}
break;
@@ -205,7 +209,8 @@
1, /*UNS8 count*/
0, /*UNS8 dataType*/
&Transmission_Type,/*void *data*/
- CheckSDOAndContinue); /*SDOCallback_t Callback*/
+ CheckSDOAndContinue, /*SDOCallback_t Callback*/
+ 0); /* use block mode */
}
break;
@@ -222,7 +227,8 @@
4, /*UNS8 count*/
0, /*UNS8 dataType*/
&TPDO_COBId,/*void *data*/
- CheckSDOAndContinue); /*SDOCallback_t Callback*/
+ CheckSDOAndContinue, /*SDOCallback_t Callback*/
+ 0); /* use block mode */
}
break;
@@ -238,7 +244,8 @@
2, /*UNS8 count*/
0, /*UNS8 dataType*/
&Heartbeat_Producer_Time,/*void *data*/
- CheckSDOAndContinue); /*SDOCallback_t Callback*/
+ CheckSDOAndContinue, /*SDOCallback_t Callback*/
+ 0); /* use block mode */
}
break;
@@ -255,7 +262,8 @@
4, /*UNS8 count*/
0, /*UNS8 dataType*/
&TPDO_COBId,/*void *data*/
- CheckSDOAndContinue); /*SDOCallback_t Callback*/
+ CheckSDOAndContinue, /*SDOCallback_t Callback*/
+ 0); /* use block mode */
}
break;
@@ -272,7 +280,8 @@
4, /*UNS8 count*/
0, /*UNS8 dataType*/
&TPDO_COBId,/*void *data*/
- CheckSDOAndContinue); /*SDOCallback_t Callback*/
+ CheckSDOAndContinue, /*SDOCallback_t Callback*/
+ 0); /* use block mode */
}
break;
@@ -289,7 +298,8 @@
4, /*UNS8 count*/
0, /*UNS8 dataType*/
&TPDO_COBId,/*void *data*/
- CheckSDOAndContinue); /*SDOCallback_t Callback*/
+ CheckSDOAndContinue, /*SDOCallback_t Callback*/
+ 0); /* use block mode */
}
break;
--- a/include/data.h Thu Oct 13 17:51:27 2011 +0200
+++ b/include/data.h Wed Nov 02 22:37:24 2011 +0100
@@ -58,6 +58,8 @@
UNS8 *bDeviceNodeId;
const indextable *objdict;
s_PDO_status *PDO_status;
+ TIMER_HANDLE *RxPDO_EventTimers;
+ void (*RxPDO_EventTimers_Handler)(CO_Data*, UNS32);
const quick_index *firstIndex;
const quick_index *lastIndex;
const UNS16 *ObjdictSize;
@@ -239,6 +241,8 @@
& NODE_PREFIX ## _bDeviceNodeId, /* bDeviceNodeId */\
NODE_PREFIX ## _objdict, /* objdict */\
NODE_PREFIX ## _PDO_status, /* PDO_status */\
+ NULL, /* RxPDO_EventTimers */\
+ _RxPDO_EventTimers_Handler, /* RxPDO_EventTimers_Handler */\
& NODE_PREFIX ## _firstIndex, /* firstIndex */\
& NODE_PREFIX ## _lastIndex, /* lastIndex */\
& NODE_PREFIX ## _ObjdictSize, /* ObjdictSize */\
--- a/include/pdo.h Thu Oct 13 17:51:27 2011 +0200
+++ b/include/pdo.h Wed Nov 02 22:37:24 2011 +0100
@@ -38,6 +38,9 @@
#include "data.h"
+/* Handler for RxPDO event timers : empty function that user can overload */
+void _RxPDO_EventTimers_Handler(CO_Data *d, UNS32 pdoNum);
+
/* Status of the TPDO : */
#define PDO_INHIBITED 0x01
#define PDO_RTR_SYNC_READY 0x01
--- a/src/pdo.c Thu Oct 13 17:51:27 2011 +0200
+++ b/src/pdo.c Wed Nov 02 22:37:24 2011 +0100
@@ -186,6 +186,7 @@
UNS32 objDict;
UNS16 offsetObjdict;
UNS16 lastIndex;
+ TIMEVAL EventTimerDuration = 0;
status = state2;
@@ -220,6 +221,7 @@
{
/* The cobId is recognized */
status = state4;
+ EventTimerDuration = *(UNS16 *)d->objdict[offsetObjdict].pSubindex[5].pObject;
MSG_WAR (0x3936, "cobId found at index ",
0x1400 + numPdo);
break;
@@ -303,7 +305,12 @@
}
numMap++;
} /* end loop while on mapped variables */
-
+ if (EventTimerDuration && d->RxPDO_EventTimers)
+ {
+ DelAlarm (d->RxPDO_EventTimers[numPdo]);
+ d->RxPDO_EventTimers[numPdo] = SetAlarm (d, numPdo, d->RxPDO_EventTimers_Handler,
+ MS_TO_TIMEVAL (EventTimerDuration), 0);
+ }
return 0;
} /* end switch status */
@@ -604,6 +611,11 @@
sendOnePDOevent (d, (UNS8) pdoNum);
}
+void
+_RxPDO_EventTimers_Handler(CO_Data *d, UNS32 pdoNum)
+{
+}
+
/*!
**
**