examples/TestMasterSlaveLSS/SlaveA.c
changeset 381 854c43cdc24a
child 384 83793fc7ce48
equal deleted inserted replaced
380:fe47568b8281 381:854c43cdc24a
       
     1 /*
       
     2 This file is part of CanFestival, a library implementing CanOpen Stack. 
       
     3 
       
     4 Copyright (C): Edouard TISSERANT and Francis DUPIN
       
     5 
       
     6 See COPYING file for copyrights details.
       
     7 
       
     8 This library is free software; you can redistribute it and/or
       
     9 modify it under the terms of the GNU Lesser General Public
       
    10 License as published by the Free Software Foundation; either
       
    11 version 2.1 of the License, or (at your option) any later version.
       
    12 
       
    13 This library is distributed in the hope that it will be useful,
       
    14 but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    16 Lesser General Public License for more details.
       
    17 
       
    18 You should have received a copy of the GNU Lesser General Public
       
    19 License along with this library; if not, write to the Free Software
       
    20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    21 */
       
    22 
       
    23 #include "SlaveA.h"
       
    24 #include "Master.h"
       
    25 #include "TestMasterSlaveLSS.h"
       
    26 
       
    27 extern s_BOARD SlaveBoardA;
       
    28 /*****************************************************************************/
       
    29 void TestSlaveA_heartbeatError(CO_Data* d, UNS8 heartbeatID)
       
    30 {
       
    31 	eprintf("TestSlaveA_heartbeatError %d\n", heartbeatID);
       
    32 }
       
    33 
       
    34 void TestSlaveA_initialisation(CO_Data* d)
       
    35 {
       
    36 	eprintf("TestSlaveA_initialisation\n");
       
    37 }
       
    38 
       
    39 void TestSlaveA_preOperational(CO_Data* d)
       
    40 {
       
    41 	eprintf("TestSlaveA_preOperational\n");
       
    42 }
       
    43 
       
    44 void TestSlaveA_operational(CO_Data* d)
       
    45 {
       
    46 	eprintf("TestSlaveA_operational\n");
       
    47 }
       
    48 
       
    49 void TestSlaveA_stopped(CO_Data* d)
       
    50 {
       
    51 	eprintf("TestSlaveA_stopped\n");
       
    52 }
       
    53 
       
    54 void TestSlaveA_post_sync(CO_Data* d)
       
    55 {
       
    56       eprintf("TestSlaveA_post_sync\n");
       
    57 }
       
    58 
       
    59 void TestSlaveA_post_TPDO(CO_Data* d)
       
    60 {
       
    61 	eprintf("TestSlaveA_post_TPDO\n");
       
    62 	SlaveAMap1++;
       
    63 	SlaveAMap2+=2;
       
    64 }
       
    65 
       
    66 void TestSlaveA_storeODSubIndex(CO_Data* d, UNS16 wIndex, UNS8 bSubindex)
       
    67 {
       
    68 	/*TODO : 
       
    69 	 * - call getODEntry for index and subindex, 
       
    70 	 * - save content to file, database, flash, nvram, ...
       
    71 	 * 
       
    72 	 * To ease flash organisation, index of variable to store
       
    73 	 * can be established by scanning d->objdict[d->ObjdictSize]
       
    74 	 * for variables to store.
       
    75 	 * 
       
    76 	 * */
       
    77 	eprintf("TestSlaveA_storeODSubIndex : %4.4x %2.2x\n", wIndex,  bSubindex);
       
    78 }
       
    79 
       
    80 void TestSlaveA_post_emcy(CO_Data* d, UNS8 nodeID, UNS16 errCode, UNS8 errReg)
       
    81 {
       
    82 	eprintf("SlaveA received EMCY message. Node: %2.2x  ErrorCode: %4.4x  ErrorRegister: %2.2x\n", nodeID, errCode, errReg);
       
    83 }
       
    84 
       
    85 void TestSlaveA_StoreConfiguration(CO_Data* d, UNS8 *error, UNS8 *spec_error)
       
    86 {
       
    87 	printf("TestSlaveA_StoreConfiguration\n");
       
    88 }
       
    89 
       
    90 void TestSlaveA_ChangeBaudRate(CO_Data* d, char *baudrate)
       
    91 {
       
    92 	eprintf("TestSlaveA_ChangeBaudRate from %s to %s\n", SlaveBoardA.baudrate, baudrate);
       
    93 	SlaveBoardA.baudrate=baudrate;
       
    94 	/* something to do with the new baudrate */
       
    95 }