33 |
33 |
34 #include "data.h" |
34 #include "data.h" |
35 |
35 |
36 /** |
36 /** |
37 * @ingroup nmtmaster |
37 * @ingroup nmtmaster |
38 * @brief Transmit a NMT message on the bus number bus_id |
38 * @brief Transmit a NMT message on the network to the slave whose nodeId is node ID. |
39 * to the slave whose node_id is ID |
|
40 * |
39 * |
41 * bus_id is hardware dependant |
40 * @param *d Pointer to a CAN object data structure |
42 * cs represents the order of state changement: |
41 * @param nodeId Id of the slave node |
43 * - cs = NMT_Start_Node // Put the node in operational mode |
42 * @param cs The order of state changement \n\n |
44 * - cs = NMT_Stop_Node // Put the node in stopped mode |
43 * |
45 * - cs = NMT_Enter_PreOperational // Put the node in pre_operational mode |
44 * Allowed states : |
46 * - cs = NMT_Reset_Node // Put the node in initialization mode |
45 * - cs = NMT_Start_Node // Put the node in operational mode |
47 * - cs = NMT_Reset_Comunication // Put the node in initialization mode |
46 * - cs = NMT_Stop_Node // Put the node in stopped mode |
|
47 * - cs = NMT_Enter_PreOperational // Put the node in pre_operational mode |
|
48 * - cs = NMT_Reset_Node // Put the node in initialization mode |
|
49 * - cs = NMT_Reset_Comunication // Put the node in initialization mode |
|
50 * |
48 * The mode is changed according to the slave state machine mode : |
51 * The mode is changed according to the slave state machine mode : |
49 * - initialisation ---> pre-operational (Automatic transition) |
52 * - initialisation ---> pre-operational (Automatic transition) |
50 * - pre-operational <--> operational |
53 * - pre-operational <--> operational |
51 * - pre-operational <--> stopped |
54 * - pre-operational <--> stopped |
52 * - pre-operational, operational, stopped -> initialisation\n |
55 * - pre-operational, operational, stopped -> initialisation |
53 * @param *d Pointer on a CAN object data structure |
56 * \n\n |
54 * @param Node_ID Id of the slave node |
57 * @return errorcode |
55 * @param cs State changement |
58 * - 0 if the NMT message was send |
56 * @return canSend(bus_id,&m) |
59 * - 1 if an error occurs |
57 */ |
60 */ |
58 UNS8 masterSendNMTstateChange (CO_Data* d, UNS8 Node_ID, UNS8 cs); |
61 UNS8 masterSendNMTstateChange (CO_Data* d, UNS8 nodeId, UNS8 cs); |
59 |
62 |
60 /** |
63 /** |
61 * @ingroup nmtmaster |
64 * @ingroup nmtmaster |
62 * @brief Transmit a Node_Guard message on the bus number bus_id |
65 * @brief Transmit a NodeGuard message on the network to the slave whose nodeId is node ID |
63 * to the slave whose node_id is nodeId |
|
64 * |
66 * |
65 * bus_id is hardware dependant |
67 * @param *d Pointer to a CAN object data structure |
66 * @param *d Pointer on a CAN object data structure |
|
67 * @param nodeId Id of the slave node |
68 * @param nodeId Id of the slave node |
68 * @return canSend(bus_id,&m) |
69 * @return |
|
70 * - 0 is returned if the NodeGuard message was send. |
|
71 * - 1 is returned if an error occurs. |
69 */ |
72 */ |
70 UNS8 masterSendNMTnodeguard (CO_Data* d, UNS8 nodeId); |
73 UNS8 masterSendNMTnodeguard (CO_Data* d, UNS8 nodeId); |
71 |
74 |
72 /** |
75 /** |
73 * @ingroup nmtmaster |
76 * @ingroup nmtmaster |
74 * @brief Prepare a Node_Guard message transmission on the bus number bus_id |
77 * @brief Ask the state of the slave node whose nodeId is node Id. |
75 * to the slave whose node_id is nodeId |
|
76 * |
78 * |
77 * Put nodeId = 0 to send an NMT broadcast. |
79 * To ask states of all nodes on the network (NMT broadcast), nodeId must be equal to 0 |
78 * This message will ask for the slave, whose node_id is nodeId, its state |
80 * @param *d Pointer to a CAN object data structure |
79 * bus_id is hardware dependant |
|
80 * @param *d Pointer on a CAN object data structure |
|
81 * @param nodeId Id of the slave node |
81 * @param nodeId Id of the slave node |
82 */ |
82 */ |
83 void masterRequestNodeState (CO_Data* d, UNS8 nodeId); |
83 void masterRequestNodeState (CO_Data* d, UNS8 nodeId); |
84 |
84 |
85 |
85 |