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.
source/Node.cpp@2:c724ff3a4e4d, 2015-12-30 (annotated)
- Committer:
- ptpaterson
- Date:
- Wed Dec 30 13:33:41 2015 +0000
- Revision:
- 2:c724ff3a4e4d
- Child:
- 3:12b3c25bdeba
Implement simple Object Dictionary and derived class.
Who changed what in which revision?
User | Revision | Line number | New 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>© 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 | 2:c724ff3a4e4d | 30 | #include "ObjectDictionary.h" |
ptpaterson | 2:c724ff3a4e4d | 31 | |
ptpaterson | 2:c724ff3a4e4d | 32 | namespace ppCANOpen |
ptpaterson | 2:c724ff3a4e4d | 33 | { |
ptpaterson | 2:c724ff3a4e4d | 34 | |
ptpaterson | 2:c724ff3a4e4d | 35 | Node::Node (void) {} |
ptpaterson | 2:c724ff3a4e4d | 36 | |
ptpaterson | 2:c724ff3a4e4d | 37 | /*============================================================================= |
ptpaterson | 2:c724ff3a4e4d | 38 | * Methods to handle message indication and confirmation |
ptpaterson | 2:c724ff3a4e4d | 39 | *============================================================================= |
ptpaterson | 2:c724ff3a4e4d | 40 | */ |
ptpaterson | 2:c724ff3a4e4d | 41 | |
ptpaterson | 2:c724ff3a4e4d | 42 | int Node::ConsumePdo (const int pdoNum, char *const data) |
ptpaterson | 2:c724ff3a4e4d | 43 | { |
ptpaterson | 2:c724ff3a4e4d | 44 | return 0; |
ptpaterson | 2:c724ff3a4e4d | 45 | } |
ptpaterson | 2:c724ff3a4e4d | 46 | |
ptpaterson | 2:c724ff3a4e4d | 47 | int Node::HandlePdoReadRequest (const int pdoNum) |
ptpaterson | 2:c724ff3a4e4d | 48 | { |
ptpaterson | 2:c724ff3a4e4d | 49 | return 0; |
ptpaterson | 2:c724ff3a4e4d | 50 | } |
ptpaterson | 2:c724ff3a4e4d | 51 | |
ptpaterson | 2:c724ff3a4e4d | 52 | int Node::ConsumeEmergency (void) |
ptpaterson | 2:c724ff3a4e4d | 53 | { |
ptpaterson | 2:c724ff3a4e4d | 54 | return 0; |
ptpaterson | 2:c724ff3a4e4d | 55 | } |
ptpaterson | 2:c724ff3a4e4d | 56 | |
ptpaterson | 2:c724ff3a4e4d | 57 | int Node::HandleNodeControl (void) |
ptpaterson | 2:c724ff3a4e4d | 58 | { |
ptpaterson | 2:c724ff3a4e4d | 59 | return 0; |
ptpaterson | 2:c724ff3a4e4d | 60 | } |
ptpaterson | 2:c724ff3a4e4d | 61 | |
ptpaterson | 2:c724ff3a4e4d | 62 | int Node::HandleNodeGuardRequest (const int masterId) |
ptpaterson | 2:c724ff3a4e4d | 63 | { |
ptpaterson | 2:c724ff3a4e4d | 64 | return 0; |
ptpaterson | 2:c724ff3a4e4d | 65 | } |
ptpaterson | 2:c724ff3a4e4d | 66 | |
ptpaterson | 2:c724ff3a4e4d | 67 | int Node::ConsumeHeartbeat (const int producerId) |
ptpaterson | 2:c724ff3a4e4d | 68 | { |
ptpaterson | 2:c724ff3a4e4d | 69 | return 0; |
ptpaterson | 2:c724ff3a4e4d | 70 | } |
ptpaterson | 2:c724ff3a4e4d | 71 | |
ptpaterson | 2:c724ff3a4e4d | 72 | /*============================================================================= |
ptpaterson | 2:c724ff3a4e4d | 73 | * Methods to handle operation of node device |
ptpaterson | 2:c724ff3a4e4d | 74 | *============================================================================= |
ptpaterson | 2:c724ff3a4e4d | 75 | */ |
ptpaterson | 2:c724ff3a4e4d | 76 | |
ptpaterson | 2:c724ff3a4e4d | 77 | void Node::Update (void) |
ptpaterson | 2:c724ff3a4e4d | 78 | { |
ptpaterson | 2:c724ff3a4e4d | 79 | |
ptpaterson | 2:c724ff3a4e4d | 80 | } |
ptpaterson | 2:c724ff3a4e4d | 81 | |
ptpaterson | 2:c724ff3a4e4d | 82 | /*============================================================================= |
ptpaterson | 2:c724ff3a4e4d | 83 | * Methods to implement node control in derived classes |
ptpaterson | 2:c724ff3a4e4d | 84 | *============================================================================= |
ptpaterson | 2:c724ff3a4e4d | 85 | */ |
ptpaterson | 2:c724ff3a4e4d | 86 | |
ptpaterson | 2:c724ff3a4e4d | 87 | void Node::OnInitialize (void){} |
ptpaterson | 2:c724ff3a4e4d | 88 | void Node::OnPreoperational (void){} |
ptpaterson | 2:c724ff3a4e4d | 89 | void Node::OnOperational (void){} |
ptpaterson | 2:c724ff3a4e4d | 90 | void Node::OnStopped (void){} |
ptpaterson | 2:c724ff3a4e4d | 91 | |
ptpaterson | 2:c724ff3a4e4d | 92 | /*============================================================================= |
ptpaterson | 2:c724ff3a4e4d | 93 | * Local functions |
ptpaterson | 2:c724ff3a4e4d | 94 | *============================================================================= |
ptpaterson | 2:c724ff3a4e4d | 95 | */ |
ptpaterson | 2:c724ff3a4e4d | 96 | |
ptpaterson | 2:c724ff3a4e4d | 97 | |
ptpaterson | 2:c724ff3a4e4d | 98 | |
ptpaterson | 2:c724ff3a4e4d | 99 | } /* namspace ppCANOpen */ |
ptpaterson | 2:c724ff3a4e4d | 100 | |
ptpaterson | 2:c724ff3a4e4d | 101 |