Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:14b95d68acf6, committed 2018-05-10
- Comitter:
- RuslanUrya
- Date:
- Thu May 10 15:08:30 2018 +0000
- Child:
- 1:16f48f8c7ad3
- Commit message:
- attempt first
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/chip.h Thu May 10 15:08:30 2018 +0000 @@ -0,0 +1,11 @@ +#include "stm32f103c8t6.h" +#define UAVCAN_STM32_BAREMETAL 1 +#define UAVCAN_STM32_NUM_IFACES 1 +#define STM32_PCLK1 HAL_RCC_GetPCLK1Freq() +#define STM32_TIMCLK1 (48000000ul) //48MHz. Is UAVCAN_STM32_TIMER_NUMBER 1? +#define CAN1_TX_IRQHandler CAN1_TX_IRQHandler +#define CAN1_RX0_IRQHandler CAN1_RX0_IRQHandler +#define CAN1_RX1_IRQHandler CAN1_RX1_IRQHandler + + +//#define UAVCAN_DEBUG 1 //for monitoring of bus. Note that this feature requires C++ I/O streams and UAVCAN_TOSTRING. \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libuavcan.lib Thu May 10 15:08:30 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/RuslanUrya/code/libuavcan/#e81e0032ae63
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu May 10 15:08:30 2018 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+#include "chip.h"
+#include "libuavcan/libuavcan/include/uavcan/build_config.hpp" //All default configuration options
+#include "libuavcan/libuavcan_drivers/stm32/driver/include/uavcan_stm32/build_config.hpp" //OS detection; Any General-Purpose timer
+#include "libuavcan/libuavcan/include/uavcan/node/subscriber.hpp" //Subscriber class
+
+#include <uavcan/equipment/actuator/Command.hpp> //message type
+
+extern uavcan::ICanDriver& getCanDriver();
+extern uavcan::ISystemClock& getSystemClock();
+
+const unsigned NodeMemoryPoolSize = 16384; // Need calulate (tutorial 2).
+typedef uavcan::Node<NodeMemoryPoolSize> Node;
+
+static Node& getNode() {
+ static Node node(getCanDriver(), getSystemClock());
+ return node;
+}
+
+int main() {
+ auto& node = getNode();
+ node.setNodeID(2);
+ node.setName("Actuator");
+ if (node.start() > 0){ //<>?
+ //обработка ошибок запуска
+ }
+ uavcan::Subscriber <uavcan::equipment::actuator::Command> sub(node); //define node to publisher
+ if (sub.start() > 0) { //инициализация паблишера
+ //обработка ошибок
+ }
+
+ node.setMoreOptional();
+ while(1) {
+ if (node.spin(uavcan::MonotonicDuration::getInfinite()) < 0){
+ //обработчик ошибок
+ }
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu May 10 15:08:30 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/5aab5a7997ee \ No newline at end of file