library for C++ CANOpen implementation. mbed independant, but is easy to attach into with mbed.

Dependents:   ppCANOpen_Example DISCO-F746NG_rtos_test

Example:

Import programppCANOpen_Example

I am no longer actively working on the ppCANOpen library, however, I want to publish this project so that anyone who wants to pick up any of the pieces can have a good example. This is a a project I was working on using the ppCANOpen library. It has a pretty in deep use of the object dictionary structure. And a number of functions to control high voltage pinball drivers, if you're into that sort of thing.

Committer:
ptpaterson
Date:
Sat Jan 09 17:15:29 2016 +0000
Revision:
4:2034b04c86d2
Parent:
3:12b3c25bdeba
Child:
5:22a337cdc0e3
echo ability

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ptpaterson 2:c724ff3a4e4d 1 /**
ptpaterson 2:c724ff3a4e4d 2 ******************************************************************************
ptpaterson 2:c724ff3a4e4d 3 * @file
ptpaterson 2:c724ff3a4e4d 4 * @author Paul Paterson
ptpaterson 2:c724ff3a4e4d 5 * @version
ptpaterson 2:c724ff3a4e4d 6 * @date 2015-12-14
ptpaterson 2:c724ff3a4e4d 7 * @brief CANOpen implementation library
ptpaterson 2:c724ff3a4e4d 8 ******************************************************************************
ptpaterson 2:c724ff3a4e4d 9 * @attention
ptpaterson 2:c724ff3a4e4d 10 *
ptpaterson 2:c724ff3a4e4d 11 * <h2><center>&copy; COPYRIGHT(c) 2015 Paul Paterson
ptpaterson 2:c724ff3a4e4d 12 *
ptpaterson 2:c724ff3a4e4d 13 * All rights reserved.
ptpaterson 2:c724ff3a4e4d 14
ptpaterson 2:c724ff3a4e4d 15 This program is free software: you can redistribute it and/or modify
ptpaterson 2:c724ff3a4e4d 16 it under the terms of the GNU General Public License as published by
ptpaterson 2:c724ff3a4e4d 17 the Free Software Foundation, either version 3 of the License, or
ptpaterson 2:c724ff3a4e4d 18 (at your option) any later version.
ptpaterson 2:c724ff3a4e4d 19
ptpaterson 2:c724ff3a4e4d 20 This program is distributed in the hope that it will be useful,
ptpaterson 2:c724ff3a4e4d 21 but WITHOUT ANY WARRANTY; without even the implied warranty of
ptpaterson 2:c724ff3a4e4d 22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ptpaterson 2:c724ff3a4e4d 23 GNU General Public License for more details.
ptpaterson 2:c724ff3a4e4d 24
ptpaterson 2:c724ff3a4e4d 25 You should have received a copy of the GNU General Public License
ptpaterson 2:c724ff3a4e4d 26 along with this program. If not, see <http://www.gnu.org/licenses/>.
ptpaterson 2:c724ff3a4e4d 27 */
ptpaterson 2:c724ff3a4e4d 28
ptpaterson 2:c724ff3a4e4d 29 #include "Node.h"
ptpaterson 3:12b3c25bdeba 30 #include "ServiceProvider.h"
ptpaterson 2:c724ff3a4e4d 31 #include "ObjectDictionary.h"
ptpaterson 2:c724ff3a4e4d 32
ptpaterson 4:2034b04c86d2 33 #include "CanOpenMessage.h"
ptpaterson 4:2034b04c86d2 34
ptpaterson 4:2034b04c86d2 35 #include <stdio.h>
ptpaterson 4:2034b04c86d2 36
ptpaterson 2:c724ff3a4e4d 37 namespace ppCANOpen
ptpaterson 2:c724ff3a4e4d 38 {
ptpaterson 4:2034b04c86d2 39
ptpaterson 2:c724ff3a4e4d 40
ptpaterson 4:2034b04c86d2 41 /** CANOpen Function Codes */
ptpaterson 4:2034b04c86d2 42 typedef enum {
ptpaterson 4:2034b04c86d2 43 CANOPEN_FUNCTION_CODE_NMT = 0x00,
ptpaterson 4:2034b04c86d2 44 CANOPEN_FUNCTION_CODE_SYNC = 0x01,
ptpaterson 4:2034b04c86d2 45 CANOPEN_FUNCTION_CODE_TIME = 0x02,
ptpaterson 4:2034b04c86d2 46 CANOPEN_FUNCTION_CODE_PDO1T = 0x03,
ptpaterson 4:2034b04c86d2 47 CANOPEN_FUNCTION_CODE_PD01R = 0x04,
ptpaterson 4:2034b04c86d2 48 CANOPEN_FUNCTION_CODE_PD02T = 0x05,
ptpaterson 4:2034b04c86d2 49 CANOPEN_FUNCTION_CODE_PD02R = 0x06,
ptpaterson 4:2034b04c86d2 50 CANOPEN_FUNCTION_CODE_PD03T = 0x07,
ptpaterson 4:2034b04c86d2 51 CANOPEN_FUNCTION_CODE_PD03R = 0x08,
ptpaterson 4:2034b04c86d2 52 CANOPEN_FUNCTION_CODE_PD04T = 0x09,
ptpaterson 4:2034b04c86d2 53 CANOPEN_FUNCTION_CODE_PD04R = 0x0A,
ptpaterson 4:2034b04c86d2 54 CANOPEN_FUNCTION_CODE_SD0T = 0x0B,
ptpaterson 4:2034b04c86d2 55 CANOPEN_FUNCTION_CODE_SD0R = 0x0C,
ptpaterson 4:2034b04c86d2 56 CANOPEN_FUNCTION_CODE_NODE_GUARD = 0x0E,
ptpaterson 4:2034b04c86d2 57 CANOPEN_FUNCTION_CODE_LSS = 0x0F
ptpaterson 4:2034b04c86d2 58 } CanOpenFunctionCodes;
ptpaterson 4:2034b04c86d2 59
ptpaterson 4:2034b04c86d2 60 /* Message Constants */
ptpaterson 4:2034b04c86d2 61 #define MESSAGE_NODEID_BITS 0b00001111111
ptpaterson 4:2034b04c86d2 62 #define MESSAGE_COMMAND_BITS 0b11110000000
ptpaterson 4:2034b04c86d2 63
ptpaterson 4:2034b04c86d2 64 /* Message Macros -----------------------------------------------------------*/
ptpaterson 4:2034b04c86d2 65 #define MESSAGE_GET_NODEID(cobId) (cobId & MESSAGE_NODEID_BITS)
ptpaterson 4:2034b04c86d2 66 #define MESSAGE_GET_COMMAND(cobId) ((cobId & MESSAGE_COMMAND_BITS) >> 7)
ptpaterson 4:2034b04c86d2 67
ptpaterson 4:2034b04c86d2 68 /*=========================================================================
ptpaterson 4:2034b04c86d2 69 * SDO MESSAGE PARAMETERS
ptpaterson 4:2034b04c86d2 70 *=========================================================================
ptpaterson 4:2034b04c86d2 71 */
ptpaterson 4:2034b04c86d2 72
ptpaterson 4:2034b04c86d2 73 /** SDO initiate protocol command specifiers */
ptpaterson 4:2034b04c86d2 74 typedef enum {
ptpaterson 4:2034b04c86d2 75 SDO_CCS_DOWNLOAD_SEGMENT_REQUEST = 0x00,
ptpaterson 4:2034b04c86d2 76 SDO_CCS_INITIATE_DOWNLOAD_REQUEST = 0x01,
ptpaterson 4:2034b04c86d2 77 SDO_CCS_INITIATE_UPLOAD_REQUEST = 0x02,
ptpaterson 4:2034b04c86d2 78 } SdoClientCommandSpecifier;
ptpaterson 4:2034b04c86d2 79
ptpaterson 4:2034b04c86d2 80 /** SDO segment protocol command specifiers */
ptpaterson 4:2034b04c86d2 81 typedef enum {
ptpaterson 4:2034b04c86d2 82 SDO_SCS_DOWNLOAD_SEGMENT_RESPONSE = 0x01,
ptpaterson 4:2034b04c86d2 83 SDO_SCS_INITIATE_UPLOAD_RESPONSE = 0x02,
ptpaterson 4:2034b04c86d2 84 SDO_SCS_INITIATE_DOWNLOAD_RESPONSE = 0x03,
ptpaterson 4:2034b04c86d2 85 } SdoServerCommandSpecifier;
ptpaterson 4:2034b04c86d2 86
ptpaterson 4:2034b04c86d2 87 /* SDO constants --------------------------------------------------------*/
ptpaterson 4:2034b04c86d2 88 #define SDO_SIZE_INDICATOR_BIT 0b00000001
ptpaterson 4:2034b04c86d2 89 #define SDO_TRANSFER_TYPE_BIT 0b00000010
ptpaterson 4:2034b04c86d2 90 #define SDO_DATA_COUNT_BITS 0b00001100
ptpaterson 4:2034b04c86d2 91 #define SDO_TOGGLE_BIT 0b00010000
ptpaterson 4:2034b04c86d2 92 #define SDO_CS_BITS 0b11100000
ptpaterson 4:2034b04c86d2 93
ptpaterson 4:2034b04c86d2 94 /* SDO macros -----------------------------------------------------------*/
ptpaterson 4:2034b04c86d2 95 #define SDO_GET_CS(data0) ((data0 & SDO_CS_BITS) >> 5)
ptpaterson 4:2034b04c86d2 96 #define SDO_GET_DATA_COUNT(data0) ((data0 & SDO_DATA_COUNT_BITS) >> 2)
ptpaterson 4:2034b04c86d2 97
ptpaterson 4:2034b04c86d2 98
ptpaterson 4:2034b04c86d2 99 /*=========================================================================
ptpaterson 4:2034b04c86d2 100 * NMT MESSAGE PARAMETERS
ptpaterson 4:2034b04c86d2 101 *=========================================================================
ptpaterson 4:2034b04c86d2 102 */
ptpaterson 4:2034b04c86d2 103
ptpaterson 4:2034b04c86d2 104 /** NMT node control protocol command specifiers */
ptpaterson 4:2034b04c86d2 105 typedef enum {
ptpaterson 4:2034b04c86d2 106 NMT_CS_START = 0x01,
ptpaterson 4:2034b04c86d2 107 NMT_CS_STOP = 0x02,
ptpaterson 4:2034b04c86d2 108 NMT_CS_ENTER_PREOP = 0x80,
ptpaterson 4:2034b04c86d2 109 NMT_CS_RESET_NODE = 0x81,
ptpaterson 4:2034b04c86d2 110 NMT_CS_RESET_COM = 0x82
ptpaterson 4:2034b04c86d2 111 } NmtCommandSpecifier;
ptpaterson 4:2034b04c86d2 112
ptpaterson 4:2034b04c86d2 113 Node::Node (ServiceProvider * pProvider)
ptpaterson 3:12b3c25bdeba 114 {
ptpaterson 4:2034b04c86d2 115 pMyProvider = pProvider;
ptpaterson 4:2034b04c86d2 116 pProvider->AddNode(this);
ptpaterson 3:12b3c25bdeba 117 }
ptpaterson 3:12b3c25bdeba 118
ptpaterson 3:12b3c25bdeba 119 /*=============================================================================
ptpaterson 3:12b3c25bdeba 120 * Methods to handle message indication and confirmation
ptpaterson 3:12b3c25bdeba 121 *=============================================================================
ptpaterson 3:12b3c25bdeba 122 */
ptpaterson 3:12b3c25bdeba 123
ptpaterson 4:2034b04c86d2 124 int Node::DispatchMessage(CanOpenMessage *msg)
ptpaterson 3:12b3c25bdeba 125 {
ptpaterson 4:2034b04c86d2 126 int command = MESSAGE_GET_COMMAND(msg->id);
ptpaterson 4:2034b04c86d2 127 int nodeId = MESSAGE_GET_NODEID(msg->id);
ptpaterson 4:2034b04c86d2 128
ptpaterson 4:2034b04c86d2 129 //printf("*** N.Dispatch: got com and id\r\n");
ptpaterson 3:12b3c25bdeba 130
ptpaterson 3:12b3c25bdeba 131 switch (command) {
ptpaterson 3:12b3c25bdeba 132 case CANOPEN_FUNCTION_CODE_NMT:
ptpaterson 4:2034b04c86d2 133 printf("*** N.Dispatch: it's an NMT Control!!!\r\n");
ptpaterson 4:2034b04c86d2 134 if (msg->data[0] == nodeId) {
ptpaterson 4:2034b04c86d2 135 HandleNodeControl ((int)msg->data[1]);
ptpaterson 3:12b3c25bdeba 136 }
ptpaterson 3:12b3c25bdeba 137 break;
ptpaterson 3:12b3c25bdeba 138 default:
ptpaterson 4:2034b04c86d2 139 printf("*** N.Dispatch: some random message\r\n");
ptpaterson 3:12b3c25bdeba 140 break;
ptpaterson 3:12b3c25bdeba 141 }
ptpaterson 4:2034b04c86d2 142
ptpaterson 4:2034b04c86d2 143 // ECHO ***********************
ptpaterson 4:2034b04c86d2 144 pMyProvider->PostMessage(msg);
ptpaterson 4:2034b04c86d2 145 // END ECHO *******************
ptpaterson 4:2034b04c86d2 146
ptpaterson 3:12b3c25bdeba 147 return 1;
ptpaterson 3:12b3c25bdeba 148 }
ptpaterson 2:c724ff3a4e4d 149
ptpaterson 2:c724ff3a4e4d 150 /*=============================================================================
ptpaterson 2:c724ff3a4e4d 151 * Methods to handle message indication and confirmation
ptpaterson 2:c724ff3a4e4d 152 *=============================================================================
ptpaterson 2:c724ff3a4e4d 153 */
ptpaterson 2:c724ff3a4e4d 154
ptpaterson 2:c724ff3a4e4d 155 int Node::ConsumePdo (const int pdoNum, char *const data)
ptpaterson 2:c724ff3a4e4d 156 {
ptpaterson 2:c724ff3a4e4d 157 return 0;
ptpaterson 2:c724ff3a4e4d 158 }
ptpaterson 2:c724ff3a4e4d 159
ptpaterson 2:c724ff3a4e4d 160 int Node::HandlePdoReadRequest (const int pdoNum)
ptpaterson 2:c724ff3a4e4d 161 {
ptpaterson 2:c724ff3a4e4d 162 return 0;
ptpaterson 2:c724ff3a4e4d 163 }
ptpaterson 2:c724ff3a4e4d 164
ptpaterson 2:c724ff3a4e4d 165 int Node::ConsumeEmergency (void)
ptpaterson 2:c724ff3a4e4d 166 {
ptpaterson 2:c724ff3a4e4d 167 return 0;
ptpaterson 2:c724ff3a4e4d 168 }
ptpaterson 2:c724ff3a4e4d 169
ptpaterson 3:12b3c25bdeba 170 int Node::HandleNodeControl (int commandSpecifier)
ptpaterson 2:c724ff3a4e4d 171 {
ptpaterson 3:12b3c25bdeba 172 int result = 0;
ptpaterson 4:2034b04c86d2 173
ptpaterson 3:12b3c25bdeba 174 switch (commandSpecifier) {
ptpaterson 3:12b3c25bdeba 175 case NMT_CS_START:
ptpaterson 4:2034b04c86d2 176 if (State::INITIALIZED != state.nmtState) {
ptpaterson 4:2034b04c86d2 177 state.nmtState = State::OPERATIONAL;
ptpaterson 3:12b3c25bdeba 178 state.bBoot = 0;
ptpaterson 3:12b3c25bdeba 179 state.bSDO = 1;
ptpaterson 3:12b3c25bdeba 180 state.bEmergency = 1;
ptpaterson 3:12b3c25bdeba 181 state.bSYNC = 1;
ptpaterson 3:12b3c25bdeba 182 state.bLifeGuard = 1;
ptpaterson 3:12b3c25bdeba 183 state.bPDO = 1;
ptpaterson 3:12b3c25bdeba 184 state.bLSS = 0;
ptpaterson 3:12b3c25bdeba 185 OnOperational();
ptpaterson 3:12b3c25bdeba 186 result = 1;
ptpaterson 3:12b3c25bdeba 187 }
ptpaterson 3:12b3c25bdeba 188 break;
ptpaterson 4:2034b04c86d2 189
ptpaterson 3:12b3c25bdeba 190 case NMT_CS_STOP:
ptpaterson 4:2034b04c86d2 191 if (State::INITIALIZED != state.nmtState) {
ptpaterson 4:2034b04c86d2 192 state.nmtState = State::STOPPED;
ptpaterson 3:12b3c25bdeba 193 state.bBoot = 0;
ptpaterson 3:12b3c25bdeba 194 state.bSDO = 0;
ptpaterson 3:12b3c25bdeba 195 state.bEmergency = 0;
ptpaterson 3:12b3c25bdeba 196 state.bSYNC = 0;
ptpaterson 3:12b3c25bdeba 197 state.bLifeGuard = 1;
ptpaterson 3:12b3c25bdeba 198 state.bPDO = 0;
ptpaterson 3:12b3c25bdeba 199 state.bLSS = 1;
ptpaterson 3:12b3c25bdeba 200 }
ptpaterson 3:12b3c25bdeba 201 OnStopped();
ptpaterson 3:12b3c25bdeba 202 result = 1;
ptpaterson 3:12b3c25bdeba 203 break;
ptpaterson 4:2034b04c86d2 204
ptpaterson 3:12b3c25bdeba 205 case NMT_CS_ENTER_PREOP:
ptpaterson 4:2034b04c86d2 206 state.nmtState = State::PREOPERATIONAL;
ptpaterson 3:12b3c25bdeba 207 state.bBoot = 0;
ptpaterson 3:12b3c25bdeba 208 state.bSDO = 1;
ptpaterson 3:12b3c25bdeba 209 state.bEmergency = 1;
ptpaterson 3:12b3c25bdeba 210 state.bSYNC = 1;
ptpaterson 3:12b3c25bdeba 211 state.bLifeGuard = 1;
ptpaterson 3:12b3c25bdeba 212 state.bPDO = 0;
ptpaterson 3:12b3c25bdeba 213 state.bLSS = 1;
ptpaterson 3:12b3c25bdeba 214 OnPreoperational();
ptpaterson 3:12b3c25bdeba 215 result = 1;
ptpaterson 3:12b3c25bdeba 216 break;
ptpaterson 4:2034b04c86d2 217
ptpaterson 3:12b3c25bdeba 218 case NMT_CS_RESET_NODE:
ptpaterson 3:12b3c25bdeba 219 case NMT_CS_RESET_COM:
ptpaterson 4:2034b04c86d2 220
ptpaterson 4:2034b04c86d2 221 state.nmtState = State::INITIALIZED;
ptpaterson 3:12b3c25bdeba 222 state.bBoot = 1;
ptpaterson 3:12b3c25bdeba 223 state.bSDO = 0;
ptpaterson 3:12b3c25bdeba 224 state.bEmergency = 0;
ptpaterson 3:12b3c25bdeba 225 state.bSYNC = 0;
ptpaterson 3:12b3c25bdeba 226 state.bLifeGuard = 0;
ptpaterson 3:12b3c25bdeba 227 state.bPDO = 0;
ptpaterson 3:12b3c25bdeba 228 state.bLSS = 0;
ptpaterson 4:2034b04c86d2 229
ptpaterson 4:2034b04c86d2 230 state.bLifeGuardToggle = 0;
ptpaterson 4:2034b04c86d2 231
ptpaterson 4:2034b04c86d2 232 /* boot message is actually just the first node guard/ heart beat message */
ptpaterson 4:2034b04c86d2 233 // TODO: wrap up into heartbeat/lifeguard message
ptpaterson 4:2034b04c86d2 234 CanOpenMessage msgBoot;
ptpaterson 4:2034b04c86d2 235 msgBoot.id = CANOPEN_FUNCTION_CODE_NODE_GUARD | 5;
ptpaterson 4:2034b04c86d2 236 msgBoot.format = CANOPEN_FORMAT_STANDARD;
ptpaterson 4:2034b04c86d2 237 msgBoot.type = CANOPEN_TYPE_DATA;
ptpaterson 4:2034b04c86d2 238 msgBoot.dataCount = 1;
ptpaterson 4:2034b04c86d2 239 msgBoot.data[0] = 0;
ptpaterson 4:2034b04c86d2 240
ptpaterson 4:2034b04c86d2 241 pMyProvider->PostMessage(&msgBoot);
ptpaterson 4:2034b04c86d2 242
ptpaterson 3:12b3c25bdeba 243 result = 1;
ptpaterson 3:12b3c25bdeba 244 break;
ptpaterson 4:2034b04c86d2 245
ptpaterson 3:12b3c25bdeba 246 default:
ptpaterson 3:12b3c25bdeba 247 break;
ptpaterson 3:12b3c25bdeba 248 }
ptpaterson 4:2034b04c86d2 249
ptpaterson 3:12b3c25bdeba 250 return result;
ptpaterson 2:c724ff3a4e4d 251 }
ptpaterson 2:c724ff3a4e4d 252
ptpaterson 2:c724ff3a4e4d 253 int Node::HandleNodeGuardRequest (const int masterId)
ptpaterson 2:c724ff3a4e4d 254 {
ptpaterson 2:c724ff3a4e4d 255 return 0;
ptpaterson 2:c724ff3a4e4d 256 }
ptpaterson 2:c724ff3a4e4d 257
ptpaterson 2:c724ff3a4e4d 258 int Node::ConsumeHeartbeat (const int producerId)
ptpaterson 2:c724ff3a4e4d 259 {
ptpaterson 2:c724ff3a4e4d 260 return 0;
ptpaterson 2:c724ff3a4e4d 261 }
ptpaterson 2:c724ff3a4e4d 262
ptpaterson 2:c724ff3a4e4d 263 /*=============================================================================
ptpaterson 2:c724ff3a4e4d 264 * Methods to handle operation of node device
ptpaterson 2:c724ff3a4e4d 265 *=============================================================================
ptpaterson 2:c724ff3a4e4d 266 */
ptpaterson 4:2034b04c86d2 267
ptpaterson 2:c724ff3a4e4d 268 void Node::Update (void)
ptpaterson 2:c724ff3a4e4d 269 {
ptpaterson 4:2034b04c86d2 270 if (State::OPERATIONAL == state.nmtState) {
ptpaterson 3:12b3c25bdeba 271 OnUpdate();
ptpaterson 4:2034b04c86d2 272 }
ptpaterson 4:2034b04c86d2 273
ptpaterson 4:2034b04c86d2 274 // TODO: check elapsed time to see if it is time for fixed update
ptpaterson 2:c724ff3a4e4d 275 }
ptpaterson 2:c724ff3a4e4d 276
ptpaterson 2:c724ff3a4e4d 277 /*=============================================================================
ptpaterson 2:c724ff3a4e4d 278 * Methods to implement node control in derived classes
ptpaterson 2:c724ff3a4e4d 279 *=============================================================================
ptpaterson 2:c724ff3a4e4d 280 */
ptpaterson 2:c724ff3a4e4d 281
ptpaterson 2:c724ff3a4e4d 282 /*=============================================================================
ptpaterson 2:c724ff3a4e4d 283 * Local functions
ptpaterson 2:c724ff3a4e4d 284 *=============================================================================
ptpaterson 2:c724ff3a4e4d 285 */
ptpaterson 4:2034b04c86d2 286
ptpaterson 4:2034b04c86d2 287
ptpaterson 4:2034b04c86d2 288
ptpaterson 4:2034b04c86d2 289 /*=============================================================================
ptpaterson 4:2034b04c86d2 290 *=============================================================================
ptpaterson 4:2034b04c86d2 291 * Methods to handle message requests and responses
ptpaterson 4:2034b04c86d2 292 * Called by the node, usually during Update() or during handling of
ptpaterson 4:2034b04c86d2 293 * incoming messages.
ptpaterson 4:2034b04c86d2 294 *
ptpaterson 4:2034b04c86d2 295 * Removed from Service ProviderClass. Not sure if we will need these in the future
ptpaterson 4:2034b04c86d2 296 *=============================================================================
ptpaterson 4:2034b04c86d2 297 *=============================================================================
ptpaterson 4:2034b04c86d2 298 */
ptpaterson 4:2034b04c86d2 299
ptpaterson 4:2034b04c86d2 300 /* PDO (7.2.2), MPDO (7.2.3) --------------------------------------------*/
ptpaterson 4:2034b04c86d2 301
ptpaterson 4:2034b04c86d2 302 /** Build and send a PDO request
ptpaterson 4:2034b04c86d2 303 * @note
ptpaterson 4:2034b04c86d2 304 * @param
ptpaterson 4:2034b04c86d2 305 */
ptpaterson 4:2034b04c86d2 306 void RequestPdo (int pdoNum){}
ptpaterson 4:2034b04c86d2 307
ptpaterson 4:2034b04c86d2 308 /** Build and send a PDO
ptpaterson 4:2034b04c86d2 309 * @note
ptpaterson 4:2034b04c86d2 310 * @param
ptpaterson 4:2034b04c86d2 311 */
ptpaterson 4:2034b04c86d2 312 void ProducePdo (int pdoNum, char * data){}
ptpaterson 4:2034b04c86d2 313
ptpaterson 4:2034b04c86d2 314
ptpaterson 4:2034b04c86d2 315 /* SDO (7.2.4) ----------------------------------------------------------*/
ptpaterson 4:2034b04c86d2 316
ptpaterson 4:2034b04c86d2 317 /** initiate SDO download
ptpaterson 4:2034b04c86d2 318 * @note Handles automatically whether it will be a expedited transfer or
ptpaterson 4:2034b04c86d2 319 * or if message will be split into
ptpaterson 4:2034b04c86d2 320 * @param
ptpaterson 4:2034b04c86d2 321 *
ptpaterson 4:2034b04c86d2 322 * Node will create a big data array and Service provide will have to
ptpaterson 4:2034b04c86d2 323 * iterate through and send all of the data. ServiceProvider will pass
ptpaterson 4:2034b04c86d2 324 * the confirmation to the node, and the node will free up it's buffer.
ptpaterson 4:2034b04c86d2 325 */
ptpaterson 4:2034b04c86d2 326 void DownloadSdo (int sdoNum, int index, int subindex, int size, char * data){}
ptpaterson 4:2034b04c86d2 327
ptpaterson 4:2034b04c86d2 328 /** initiate SDO upload
ptpaterson 4:2034b04c86d2 329 * @note
ptpaterson 4:2034b04c86d2 330 * @param
ptpaterson 4:2034b04c86d2 331 */
ptpaterson 4:2034b04c86d2 332 void UploadSdo (int sdoNum, int index, int subindex){}
ptpaterson 4:2034b04c86d2 333
ptpaterson 4:2034b04c86d2 334 /** Acknowledge that SDO was recieved properly
ptpaterson 4:2034b04c86d2 335 * @note
ptpaterson 4:2034b04c86d2 336 * @param
ptpaterson 4:2034b04c86d2 337 */
ptpaterson 4:2034b04c86d2 338 void ConfirmSdo (int sdoNum, int bSuccess){}
ptpaterson 4:2034b04c86d2 339
ptpaterson 4:2034b04c86d2 340 /** Abort current SDO transfer
ptpaterson 4:2034b04c86d2 341 * @note
ptpaterson 4:2034b04c86d2 342 * @param
ptpaterson 4:2034b04c86d2 343 */
ptpaterson 4:2034b04c86d2 344 void AbortSdo (int sdoNum){}
ptpaterson 4:2034b04c86d2 345
ptpaterson 4:2034b04c86d2 346
ptpaterson 4:2034b04c86d2 347 /* Emergency object (7.2.7) ---------------------------------------------*/
ptpaterson 4:2034b04c86d2 348
ptpaterson 4:2034b04c86d2 349 // TODO: emergency producer
ptpaterson 4:2034b04c86d2 350
ptpaterson 4:2034b04c86d2 351
ptpaterson 4:2034b04c86d2 352 /* Network Management (7.2.8) -------------------------------------------*/
ptpaterson 4:2034b04c86d2 353 /* ---- Node Control (7.2.8.2.1) ----------------------------------------*/
ptpaterson 4:2034b04c86d2 354
ptpaterson 4:2034b04c86d2 355 /** Build a CANOpen nmt control message to a node
ptpaterson 4:2034b04c86d2 356 * @note
ptpaterson 4:2034b04c86d2 357 * @param
ptpaterson 4:2034b04c86d2 358 */
ptpaterson 4:2034b04c86d2 359 int SendNodeControl (NmtCommandSpecifier cs, unsigned int nodeId){return 0;}
ptpaterson 4:2034b04c86d2 360
ptpaterson 4:2034b04c86d2 361
ptpaterson 4:2034b04c86d2 362 /* ---- Error Control (7.2.8.2.2) ---------------------------------------*/
ptpaterson 4:2034b04c86d2 363
ptpaterson 4:2034b04c86d2 364 /** Build a CANOpen error control request to a node
ptpaterson 4:2034b04c86d2 365 * @note
ptpaterson 4:2034b04c86d2 366 * @param
ptpaterson 4:2034b04c86d2 367 */
ptpaterson 4:2034b04c86d2 368 int RequestErrorControl (NmtCommandSpecifier cs, unsigned int nodeId){return 0;}
ptpaterson 4:2034b04c86d2 369
ptpaterson 4:2034b04c86d2 370 /** Build a CANOpen error control response
ptpaterson 4:2034b04c86d2 371 * @note
ptpaterson 4:2034b04c86d2 372 * @param
ptpaterson 4:2034b04c86d2 373 */
ptpaterson 4:2034b04c86d2 374 int RespondErrorControl (NmtCommandSpecifier cs, unsigned int nodeId){return 0;}
ptpaterson 4:2034b04c86d2 375
ptpaterson 2:c724ff3a4e4d 376
ptpaterson 2:c724ff3a4e4d 377 } /* namspace ppCANOpen */
ptpaterson 2:c724ff3a4e4d 378
ptpaterson 2:c724ff3a4e4d 379