diff options
author | Pavel Kirienko <pavel.kirienko@gmail.com> | 2014-05-07 13:42:34 +0400 |
---|---|---|
committer | Pavel Kirienko <pavel.kirienko@gmail.com> | 2014-05-07 13:42:34 +0400 |
commit | 4b11145797fdc26e5bf29738dd319ab9e8003356 (patch) | |
tree | df22dd0eb07515b14bab8ded5d31d86e4cfa6b55 /src/modules/uavcan/uavcan_main.hpp | |
parent | 5716dad25db27315fa7cebf8183a71f864860f41 (diff) | |
download | px4-firmware-4b11145797fdc26e5bf29738dd319ab9e8003356.tar.gz px4-firmware-4b11145797fdc26e5bf29738dd319ab9e8003356.tar.bz2 px4-firmware-4b11145797fdc26e5bf29738dd319ab9e8003356.zip |
Working UAVCAN node. No application logic is implemented yet; the node just publishes its status once a second (uavcan.protocol.NodeStatus) and responds to basic services (transport stats, node discovery)
Diffstat (limited to 'src/modules/uavcan/uavcan_main.hpp')
-rw-r--r-- | src/modules/uavcan/uavcan_main.hpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/modules/uavcan/uavcan_main.hpp b/src/modules/uavcan/uavcan_main.hpp index 7fcc992d0..8bd660cc5 100644 --- a/src/modules/uavcan/uavcan_main.hpp +++ b/src/modules/uavcan/uavcan_main.hpp @@ -36,4 +36,31 @@ #include <uavcan_stm32/uavcan_stm32.hpp> -// ... +/** + * Implements basic functinality of UAVCAN node. + */ +class UavcanNode +{ + static constexpr unsigned MemPoolSize = 10752; + static constexpr unsigned RxQueueLenPerIface = 64; + static constexpr unsigned StackSize = 3000; + +public: + typedef uavcan::Node<MemPoolSize> Node; + typedef uavcan_stm32::CanInitHelper<RxQueueLenPerIface> CanInitHelper; + + UavcanNode(uavcan::ICanDriver& can_driver, uavcan::ISystemClock& system_clock) + : _node(can_driver, system_clock) + { } + + static int start(uavcan::NodeID node_id, uint32_t bitrate); + + Node& getNode() { return _node; } + +private: + int init(uavcan::NodeID node_id); + int run(); + + static UavcanNode* _instance; + Node _node; +}; |