examples/gene_SYNC_HCS12/appli.c
changeset 61 813ffdfbffb2
parent 56 904abfb26abf
child 80 37354e408645
equal deleted inserted replaced
60:a8723422e0dd 61:813ffdfbffb2
    47 #include "../include/timer.h"
    47 #include "../include/timer.h"
    48 #include "../include/lifegrd.h"
    48 #include "../include/lifegrd.h"
    49 #include "../include/sync.h"
    49 #include "../include/sync.h"
    50 
    50 
    51 #include "../include/nmtSlave.h"
    51 #include "../include/nmtSlave.h"
       
    52 
       
    53 // File created by the GUI 
    52 #include "objdict.h"
    54 #include "objdict.h"
    53 
    55 
    54 // Variables defined in the object dictionary (See objdict.c)
       
    55 extern UNS16 acceptanceFilter1;		// Mapped at index 0x2015, subindex 0x00
       
    56 extern UNS16 acceptanceFilter2;		// Mapped at index 0x2016, subindex 0x00
       
    57 extern UNS16 acceptanceFilter3;		// Mapped at index 0x2017, subindex 0x00
       
    58 extern UNS16 acceptanceFilter4;		// Mapped at index 0x2018, subindex 0x00
       
    59 extern UNS16 mask1;		// Mapped at index 0x2019, subindex 0x00
       
    60 extern UNS16 mask2;		// Mapped at index 0x2020, subindex 0x00
       
    61 extern UNS16 mask3;		// Mapped at index 0x2021, subindex 0x00
       
    62 extern UNS16 mask4;		// Mapped at index 0x2022, subindex 0x00
       
    63 extern UNS8 applyDownloadedFilters;
       
    64 
    56 
    65 
    57 
    66 
    58 
    67 
    59 
    68 // HCS12 configuration
    60 // HCS12 configuration
   148 void initCanopencapteur (void);
   140 void initCanopencapteur (void);
   149 // Init the sensor
   141 // Init the sensor
   150 void initSensor(void);
   142 void initSensor(void);
   151 void initPortB(void);
   143 void initPortB(void);
   152 void initPortH(void);
   144 void initPortH(void);
   153 
       
   154 // Functions needed by Canfestival
       
   155 // Notice that gene_SYNC is the name of the sensor defined in python GUI.
       
   156 // Do not change it !.
       
   157 void gene_SYNC_initialisation(void);
       
   158 void gene_SYNC_preOperational(void);
       
   159 void gene_SYNC_operational(void);
       
   160 void gene_SYNC_stopped(void);
       
   161 void gene_SYNC_post_sync(void);
       
   162 
   145 
   163 
   146 
   164 //------------------------------------------------------------------------------
   147 //------------------------------------------------------------------------------
   165 //Initialisation of the port B for the leds.
   148 //Initialisation of the port B for the leds.
   166 void initPortB(void)
   149 void initPortB(void)
   286 }
   269 }
   287 
   270 
   288 //------------------------------------------------------------------------------
   271 //------------------------------------------------------------------------------
   289 void gene_SYNC_SDOtimeoutError (UNS8 line)
   272 void gene_SYNC_SDOtimeoutError (UNS8 line)
   290 {
   273 {
       
   274 	// This function was implemented for the Client's use (client = the one which initiate the dialog),
       
   275 	// but we can use it also for the server.
       
   276 	// Note : if for an other reason than a timeout, a SDO to read or write 
       
   277 	// faile, we do not have implemented a warning function at the server side.
       
   278 	// Of course, there is one on the client side.
       
   279   
   291   MSG_ERR(0x1F01, "SDO timeout for line : ", line);
   280   MSG_ERR(0x1F01, "SDO timeout for line : ", line);
       
   281   // See the transfer structure in sdo.h to know what informations
       
   282   // you can retreive.
       
   283   MSG_ERR(0x1F02, "  to access index ", gene_SYNC_Data.transfers[line].index);
       
   284   MSG_ERR(0x1F03, "         subIndex ", gene_SYNC_Data.transfers[line].subIndex);
   292 }
   285 }
   293 
   286 
   294 //------------------------------------------------------------------------------
   287 //------------------------------------------------------------------------------
   295 UNS8 gene_SYNC_canSend(Message *m)
   288 UNS8 gene_SYNC_canSend(Message *m)
   296 {
   289 {