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.
include/ServiceProvider.h
- Committer:
- ptpaterson
- Date:
- 2016-01-09
- Revision:
- 4:2034b04c86d2
- Parent:
- 3:12b3c25bdeba
- Child:
- 5:22a337cdc0e3
File content as of revision 4:2034b04c86d2:
/** ****************************************************************************** * @file * @author Paul Paterson * @version * @date 2015-12-22 * @brief CANOpen implementation library ****************************************************************************** * @attention * * <h2><center>© COPYRIGHT(c) 2015 Paul Paterson * * All rights reserved. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PPCAN_SERVICE_PROVIDER_H #define PPCAN_SERVICE_PROVIDER_H #include "CanOpenMessage.h" #include <queue> /*========================================================================= * Forward declarations *========================================================================= */ struct CanOpenHandle; namespace ppCANOpen { /* Avoid circular reference */ class Node; /** Node Class to implement feature of a CANOpen NMT node */ class ServiceProvider { public: ServiceProvider (void); ~ServiceProvider (void); /** Main loop */ void Run (void); /** Register a node to get messages and get update calls * @note * @param * @retval */ int AddNode (Node * node); /** Register a node to get messages and get update calls * @note * @param * @retval */ /** Add a message to the message queue outbox * @note * @param */ void PostMessage (CanOpenMessage * msg); // TODO: remove node (swap pointers to fill in nicely private: /** define size of arrays in one place */ static const int SERVICE_MAX_NODES = 8; /* ======================================================================== * Private Members * ======================================================================== */ /** array of messages in a queue * @note twice number of max nodes is a bit arbitrary. Will need at * least max nodes, but not sure how much more to be safe. */ std::queue<CanOpenMessage> outbox; //CanOpenMessage outbox[SERVICE_MAX_NODES * 2]; //int messageCount; /** array of nodes to cycle through. * @note */ Node * nodes[SERVICE_MAX_NODES]; /** Keeps count of current number of nodes. * @note */ int nodeCount; /** stores handle for can open api */ CanOpenHandle * hCanOpen; }; } /* namspace ppCANOpen */ #endif /* PPCAN_SERVICE_PROVIDER_H */