From 1df46096ff30004c52ae2e9a6001152e8ec05390 Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Wed, 25 May 2016 09:07:32 -0400 Subject: [PATCH] libuavcan: Rename uavcan to libuavcan --- canutils/Kconfig | 2 +- canutils/{uavcan => libuavcan}/.gitignore | 0 canutils/{uavcan => libuavcan}/Kconfig | 102 +++++++++--------- canutils/{uavcan => libuavcan}/Make.defs | 8 +- canutils/{uavcan => libuavcan}/Makefile | 68 ++++++------ ...96ace50155573e545ed9bf2fb09964ee2367.patch | 0 .../{uavcan => libuavcan}/platform_stm32.cpp | 23 ++-- 7 files changed, 102 insertions(+), 101 deletions(-) rename canutils/{uavcan => libuavcan}/.gitignore (100%) rename canutils/{uavcan => libuavcan}/Kconfig (69%) rename canutils/{uavcan => libuavcan}/Make.defs (90%) rename canutils/{uavcan => libuavcan}/Makefile (77%) rename canutils/{uavcan => libuavcan}/nuttx-b04396ace50155573e545ed9bf2fb09964ee2367.patch (100%) rename canutils/{uavcan => libuavcan}/platform_stm32.cpp (83%) diff --git a/canutils/Kconfig b/canutils/Kconfig index a0907602b..5fe2e45ce 100644 --- a/canutils/Kconfig +++ b/canutils/Kconfig @@ -5,7 +5,7 @@ menu "CAN Utilities" -source "$APPSDIR/canutils/uavcan/Kconfig" source "$APPSDIR/canutils/libcanard/Kconfig" +source "$APPSDIR/canutils/libuavcan/Kconfig" endmenu # CAN Utilities diff --git a/canutils/uavcan/.gitignore b/canutils/libuavcan/.gitignore similarity index 100% rename from canutils/uavcan/.gitignore rename to canutils/libuavcan/.gitignore diff --git a/canutils/uavcan/Kconfig b/canutils/libuavcan/Kconfig similarity index 69% rename from canutils/uavcan/Kconfig rename to canutils/libuavcan/Kconfig index 89e6bf60f..64d7157dd 100644 --- a/canutils/uavcan/Kconfig +++ b/canutils/libuavcan/Kconfig @@ -3,8 +3,8 @@ # see the file kconfig-language.txt in the NuttX tools repository. # -config CANUTILS_UAVCAN - bool "UAVCAN Library" +config CANUTILS_LIBUAVCAN + bool "libuavcan Library" default n depends on STM32_HAVE_CAN1 depends on !STM32_CAN1 @@ -14,47 +14,47 @@ config CANUTILS_UAVCAN depends on HAVE_CXX depends on !DISABLE_POLL ---help--- - Enables support for the UAVCAN library. + Enables support for the libuavcan library. -if CANUTILS_UAVCAN +if CANUTILS_LIBUAVCAN -config UAVCAN_LIBUAVCAN_URL - string "UAVCAN URL" +config LIBUAVCAN_URL + string "libuavcan URL" default "https://github.com/UAVCAN/libuavcan/archive" ---help--- - UAVCAN URL. + libuavcan URL. -config UAVCAN_LIBUAVCAN_VERSION - string "UAVCAN Version" +config LIBUAVCAN_VERSION + string "libuavcan Version" default "b04396ace50155573e545ed9bf2fb09964ee2367" ---help--- - UAVCAN version. + libuavcan version. -config UAVCAN_DSDL_URL +config LIBUAVCAN_DSDL_URL string "DSDL URL" default "https://github.com/UAVCAN/dsdl/archive" ---help--- DSDL URL. -config UAVCAN_DSDL_VERSION +config LIBUAVCAN_DSDL_VERSION string "DSDL Version" default "9804a3e6972825586be252ce08dd899f44994b14" ---help--- DSDL version. -config UAVCAN_PYUAVCAN_URL - string "Python UAVCAN URL" +config LIBUAVCAN_PYUAVCAN_URL + string "pyuavcan URL" default "https://github.com/UAVCAN/pyuavcan/archive" ---help--- - Python UAVCAN URL. + pyuavcan URL. -config UAVCAN_PYUAVCAN_VERSION - string "Python UAVCAN Version" +config LIBUAVCAN_PYUAVCAN_VERSION + string "pyuavcan Version" default "c58477a644d20ccf95a20c151f3a0402f271c3b8" ---help--- - Python UAVCAN version. + pyuavcan version. -config UAVCAN_STM32_NUM_IFACES +config LIBUAVCAN_STM32_NUM_IFACES int "Number of CAN Interfaces" default 1 range 1 1 if !STM32_HAVE_CAN2 @@ -62,44 +62,44 @@ config UAVCAN_STM32_NUM_IFACES choice prompt "Timer" - default UAVCAN_STM32_TIM2 if !STM32_TIM2 - default UAVCAN_STM32_TIM3 if STM32_HAVE_TIM3 && !STM32_TIM3 - default UAVCAN_STM32_TIM4 if STM32_HAVE_TIM4 && !STM32_TIM4 - default UAVCAN_STM32_TIM5 if STM32_HAVE_TIM5 && !STM32_TIM5 - default UAVCAN_STM32_TIM6 if STM32_HAVE_TIM6 && !STM32_TIM6 - default UAVCAN_STM32_TIM7 if STM32_HAVE_TIM7 && !STM32_TIM7 + default LIBUAVCAN_STM32_TIM2 if !STM32_TIM2 + default LIBUAVCAN_STM32_TIM3 if STM32_HAVE_TIM3 && !STM32_TIM3 + default LIBUAVCAN_STM32_TIM4 if STM32_HAVE_TIM4 && !STM32_TIM4 + default LIBUAVCAN_STM32_TIM5 if STM32_HAVE_TIM5 && !STM32_TIM5 + default LIBUAVCAN_STM32_TIM6 if STM32_HAVE_TIM6 && !STM32_TIM6 + default LIBUAVCAN_STM32_TIM7 if STM32_HAVE_TIM7 && !STM32_TIM7 -config UAVCAN_STM32_TIM2 +config LIBUAVCAN_STM32_TIM2 bool "TIM2" depends on !STM32_TIM2 ---help--- The library will use TIM2. -config UAVCAN_STM32_TIM3 +config LIBUAVCAN_STM32_TIM3 bool "TIM3" depends on STM32_HAVE_TIM3 && !STM32_TIM3 ---help--- The library will use TIM3. -config UAVCAN_STM32_TIM4 +config LIBUAVCAN_STM32_TIM4 bool "TIM4" depends on STM32_HAVE_TIM4 && !STM32_TIM4 ---help--- The library will use TIM4. -config UAVCAN_STM32_TIM5 +config LIBUAVCAN_STM32_TIM5 bool "TIM5" depends on STM32_HAVE_TIM5 && !STM32_TIM5 ---help--- The library will use TIM5. -config UAVCAN_STM32_TIM6 +config LIBUAVCAN_STM32_TIM6 bool "TIM6" depends on STM32_HAVE_TIM6 && !STM32_TIM6 ---help--- The library will use TIM6. -config UAVCAN_STM32_TIM7 +config LIBUAVCAN_STM32_TIM7 bool "TIM7" depends on STM32_HAVE_TIM7 && !STM32_TIM7 ---help--- @@ -109,111 +109,111 @@ endchoice choice prompt "C++ Version" - default UAVCAN_CPP03 + default LIBUAVCAN_CPP03 -config UAVCAN_CPP03 +config LIBUAVCAN_CPP03 bool "C++03" ---help--- The library will use C++03. -config UAVCAN_CPP11 +config LIBUAVCAN_CPP11 bool "C++11" ---help--- The library will use C++11. endchoice -config UAVCAN_DEBUG +config LIBUAVCAN_DEBUG bool "Debug" default n ---help--- Enables debug. -config UAVCAN_EXCEPTIONS +config LIBUAVCAN_EXCEPTIONS bool "Exceptions" default n ---help--- Enables exceptions. -config UAVCAN_TINY +config LIBUAVCAN_TINY bool "Tiny" default n ---help--- Removes some features to save memory. -config UAVCAN_NO_GLOBAL_DATA_TYPE_REGISTRY +config LIBUAVCAN_NO_GLOBAL_DATA_TYPE_REGISTRY bool "No Global Data Type Registry" default n ---help--- Removes the global data type registry. -config UAVCAN_TOSTRING +config LIBUAVCAN_TOSTRING bool "Implement toString" default n - depends on UAVCAN_EXCEPTIONS + depends on LIBUAVCAN_EXCEPTIONS ---help--- The library will add a toString method to most of its classes. -config UAVCAN_IMPLEMENT_PLACEMENT_NEW +config LIBUAVCAN_IMPLEMENT_PLACEMENT_NEW bool "Implement Placement new" default n ---help--- The library will implement placement new. -config UAVCAN_USE_EXTERNAL_SNPRINTF +config LIBUAVCAN_USE_EXTERNAL_SNPRINTF bool "Use External snprintf" default n ---help--- The library will use an external snprintf. -config UAVCAN_USE_EXTERNAL_FLOAT16_CONVERSION +config LIBUAVCAN_USE_EXTERNAL_FLOAT16_CONVERSION bool "Use External float16 Conversion" default n ---help--- The library will use an external float16 conversion. -config UAVCAN_NO_ASSERTIONS +config LIBUAVCAN_NO_ASSERTIONS bool "No Assertions" default n ---help--- Disables assertions. -config UAVCAN_MEM_POOL_BLOCK_SIZE +config LIBUAVCAN_MEM_POOL_BLOCK_SIZE int "Memory Pool Block Size" default 0 ---help--- Specifies the memory pool block size. If the value is 0, the library will use a default value. -config UAVCAN_FLOAT_COMPARISON_EPSILON_MULT +config LIBUAVCAN_FLOAT_COMPARISON_EPSILON_MULT int "Float Comparion Epsilon Mult" default 0 ---help--- Specifies the float comparison epsilon mult. If the value is 0, the library will use a default value. -config UAVCAN_MAX_CAN_ACCEPTANCE_FILTERS +config LIBUAVCAN_MAX_CAN_ACCEPTANCE_FILTERS int "Max CAN Acceptance Filters" default 0 ---help--- Specifies the maximum number of CAN acceptance filters. If the value is 0, the library will use a default value. -config UAVCAN_MAX_NETWORK_SIZE_HINT +config LIBUAVCAN_MAX_NETWORK_SIZE_HINT int "Max Network Size Hint" default 0 ---help--- Specifies the maximum network size. If the value is 0, the library will use a default value. -config UAVCAN_RX_QUEUE_CAPACITY +config LIBUAVCAN_RX_QUEUE_CAPACITY int "Rx Queue Capacity" default 0 ---help--- Specifies the rx queue capacity. If the value is 0, the library will use a default value. -config UAVCAN_BIT_RATE +config LIBUAVCAN_BIT_RATE int "Bit Rate" default 0 range 0 1000000 @@ -221,7 +221,7 @@ config UAVCAN_BIT_RATE Specifies the CAN bit rate. If the value is 0, the library will automatically detect the bit rate. -config UAVCAN_INIT_RETRIES +config LIBUAVCAN_INIT_RETRIES int "Initialization Retries" default 0 ---help--- diff --git a/canutils/uavcan/Make.defs b/canutils/libuavcan/Make.defs similarity index 90% rename from canutils/uavcan/Make.defs rename to canutils/libuavcan/Make.defs index fa3c9c602..de45b2130 100644 --- a/canutils/uavcan/Make.defs +++ b/canutils/libuavcan/Make.defs @@ -1,7 +1,7 @@ ############################################################################ -# apps/canutils/uavcan/Make.defs +# apps/canutils/libuavcan/Make.defs # -# Copyright (C) 2015 Omni Hoverboards Inc. All rights reserved. +# Copyright (C) 2015-2016 Omni Hoverboards Inc. All rights reserved. # Author: Paul Alexander Patience # # Redistribution and use in source and binary forms, with or without @@ -33,6 +33,6 @@ # ############################################################################ -ifeq ($(CONFIG_CANUTILS_UAVCAN),y) -CONFIGURED_APPS += canutils/uavcan +ifeq ($(CONFIG_CANUTILS_LIBUAVCAN),y) +CONFIGURED_APPS += canutils/libuavcan endif diff --git a/canutils/uavcan/Makefile b/canutils/libuavcan/Makefile similarity index 77% rename from canutils/uavcan/Makefile rename to canutils/libuavcan/Makefile index decf9e117..c4752e69b 100644 --- a/canutils/uavcan/Makefile +++ b/canutils/libuavcan/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# apps/canutils/uavcan/Makefile +# apps/canutils/libuavcan/Makefile # # Copyright (C) 2015-2016 Omni Hoverboards Inc. All rights reserved. # Author: Paul Alexander Patience @@ -41,21 +41,21 @@ WGET = wget UNPACK = unzip PACKEXT = .zip -LIBUAVCAN_URL = $(patsubst "%",%,$(strip $(CONFIG_UAVCAN_LIBUAVCAN_URL))) -LIBUAVCAN_VERSION = $(patsubst "%",%,$(strip $(CONFIG_UAVCAN_LIBUAVCAN_VERSION))) +LIBUAVCAN_URL = $(patsubst "%",%,$(strip $(CONFIG_LIBUAVCAN_URL))) +LIBUAVCAN_VERSION = $(patsubst "%",%,$(strip $(CONFIG_LIBUAVCAN_VERSION))) LIBUAVCAN_UNPACKNAME = libuavcan-$(LIBUAVCAN_VERSION) LIBUAVCAN_PACKNAME = $(LIBUAVCAN_UNPACKNAME)$(PACKEXT) LIBUAVCAN_DSDL_PATH = libuavcan$(DELIM)dsdl LIBUAVCAN_PYUAVCAN_PATH = libuavcan$(DELIM)libuavcan$(DELIM)dsdl_compiler$(DELIM)pyuavcan LIBUAVCAN_PATCHNAME = nuttx-$(LIBUAVCAN_VERSION).patch -DSDL_URL = $(patsubst "%",%,$(strip $(CONFIG_UAVCAN_DSDL_URL))) -DSDL_VERSION = $(patsubst "%",%,$(strip $(CONFIG_UAVCAN_DSDL_VERSION))) +DSDL_URL = $(patsubst "%",%,$(strip $(CONFIG_LIBUAVCAN_DSDL_URL))) +DSDL_VERSION = $(patsubst "%",%,$(strip $(CONFIG_LIBUAVCAN_DSDL_VERSION))) DSDL_UNPACKNAME = dsdl-$(DSDL_VERSION) DSDL_PACKNAME = $(DSDL_UNPACKNAME)$(PACKEXT) -PYUAVCAN_URL = $(patsubst "%",%,$(strip $(CONFIG_UAVCAN_PYUAVCAN_URL))) -PYUAVCAN_VERSION = $(patsubst "%",%,$(strip $(CONFIG_UAVCAN_PYUAVCAN_VERSION))) +PYUAVCAN_URL = $(patsubst "%",%,$(strip $(CONFIG_LIBUAVCAN_PYUAVCAN_URL))) +PYUAVCAN_VERSION = $(patsubst "%",%,$(strip $(CONFIG_LIBUAVCAN_PYUAVCAN_VERSION))) PYUAVCAN_UNPACKNAME = pyuavcan-$(PYUAVCAN_VERSION) PYUAVCAN_PACKNAME = $(PYUAVCAN_UNPACKNAME)$(PACKEXT) @@ -70,24 +70,24 @@ CXXFLAGS += -I$(TOPDIR)$(DELIM)arch$(DELIM)arm$(DELIM)src$(DELIM)stm32 CXXFLAGS += -D__KERNEL__ CXXFLAGS += -DUAVCAN_STM32_NUTTX=1 -CXXFLAGS += -DUAVCAN_STM32_NUM_IFACES=$(CONFIG_UAVCAN_STM32_NUM_IFACES) +CXXFLAGS += -DUAVCAN_STM32_NUM_IFACES=$(CONFIG_LIBUAVCAN_STM32_NUM_IFACES) -ifeq ($(CONFIG_UAVCAN_STM32_TIM2),y) +ifeq ($(CONFIG_LIBUAVCAN_STM32_TIM2),y) CXXFLAGS += -DUAVCAN_STM32_TIMER_NUMBER=2 else -ifeq ($(CONFIG_UAVCAN_STM32_TIM3),y) +ifeq ($(CONFIG_LIBUAVCAN_STM32_TIM3),y) CXXFLAGS += -DUAVCAN_STM32_TIMER_NUMBER=3 else -ifeq ($(CONFIG_UAVCAN_STM32_TIM4),y) +ifeq ($(CONFIG_LIBUAVCAN_STM32_TIM4),y) CXXFLAGS += -DUAVCAN_STM32_TIMER_NUMBER=4 else -ifeq ($(CONFIG_UAVCAN_STM32_TIM5),y) +ifeq ($(CONFIG_LIBUAVCAN_STM32_TIM5),y) CXXFLAGS += -DUAVCAN_STM32_TIMER_NUMBER=5 else -ifeq ($(CONFIG_UAVCAN_STM32_TIM6),y) +ifeq ($(CONFIG_LIBUAVCAN_STM32_TIM6),y) CXXFLAGS += -DUAVCAN_STM32_TIMER_NUMBER=6 else -ifeq ($(CONFIG_UAVCAN_STM32_TIM7),y) +ifeq ($(CONFIG_LIBUAVCAN_STM32_TIM7),y) CXXFLAGS += -DUAVCAN_STM32_TIMER_NUMBER=7 endif endif @@ -96,68 +96,68 @@ endif endif endif -ifeq ($(CONFIG_UAVCAN_CPP03),y) +ifeq ($(CONFIG_LIBUAVCAN_CPP03),y) CXXFLAGS += -std=c++03 -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 else -ifeq ($(CONFIG_UAVCAN_CPP11),y) +ifeq ($(CONFIG_LIBUAVCAN_CPP11),y) CXXFLAGS += -std=c++11 -DUAVCAN_CPP_VERSION=UAVCAN_CPP11 endif endif -ifeq ($(CONFIG_UAVCAN_DEBUG),y) +ifeq ($(CONFIG_LIBUAVCAN_DEBUG),y) CXXFLAGS += -DUAVCAN_DEBUG=1 endif -ifeq ($(CONFIG_UAVCAN_EXCEPTIONS),y) +ifeq ($(CONFIG_LIBUAVCAN_EXCEPTIONS),y) CXXFLAGS += -DUAVCAN_EXCEPTIONS=1 else CXXFLAGS += -DUAVCAN_EXCEPTIONS=0 endif -ifeq ($(CONFIG_UAVCAN_TINY),y) +ifeq ($(CONFIG_LIBUAVCAN_TINY),y) CXXFLAGS += -DUAVCAN_TINY=1 endif -ifeq ($(CONFIG_UAVCAN_NO_GLOBAL_DATA_TYPE_REGISTRY),y) +ifeq ($(CONFIG_LIBUAVCAN_NO_GLOBAL_DATA_TYPE_REGISTRY),y) CXXFLAGS += -DUAVCAN_NO_GLOBAL_DATA_TYPE_REGISTRY=1 endif -ifeq ($(CONFIG_UAVCAN_TOSTRING),y) +ifeq ($(CONFIG_LIBUAVCAN_TOSTRING),y) CXXFLAGS += -DUAVCAN_TOSTRING=1 else CXXFLAGS += -DUAVCAN_TOSTRING=0 endif -ifeq ($(CONFIG_UAVCAN_IMPLEMENT_PLACEMENT_NEW),y) +ifeq ($(CONFIG_LIBUAVCAN_IMPLEMENT_PLACEMENT_NEW),y) CXXFLAGS += -DUAVCAN_IMPLEMENT_PLACEMENT_NEW=1 endif -ifeq ($(CONFIG_UAVCAN_USE_EXTERNAL_SNPRINTF),y) +ifeq ($(CONFIG_LIBUAVCAN_USE_EXTERNAL_SNPRINTF),y) CXXFLAGS += -DUAVCAN_USE_EXTERNAL_SNPRINTF=1 endif -ifeq ($(CONFIG_UAVCAN_USE_EXTERNAL_FLOAT16_CONVERSION),y) +ifeq ($(CONFIG_LIBUAVCAN_USE_EXTERNAL_FLOAT16_CONVERSION),y) CXXFLAGS += -DUAVCAN_USE_EXTERNAL_FLOAT16_CONVERSION=1 endif -ifeq ($(CONFIG_UAVCAN_NO_ASSERTIONS),y) +ifeq ($(CONFIG_LIBUAVCAN_NO_ASSERTIONS),y) CXXFLAGS += -DUAVCAN_NO_ASSERTIONS=1 endif -ifneq ($(CONFIG_UAVCAN_MEM_POOL_BLOCK_SIZE),0) -CXXFLAGS += -DUAVCAN_MEM_POOL_BLOCK_SIZE=$(CONFIG_UAVCAN_MEM_POOL_BLOCK_SIZE) +ifneq ($(CONFIG_LIBUAVCAN_MEM_POOL_BLOCK_SIZE),0) +CXXFLAGS += -DUAVCAN_MEM_POOL_BLOCK_SIZE=$(CONFIG_LIBUAVCAN_MEM_POOL_BLOCK_SIZE) endif -ifneq ($(CONFIG_UAVCAN_FLOAT_COMPARISON_EPSILON_MULT),0) -CXXFLAGS += -DUAVCAN_FLOAT_COMPARISON_EPSILON_MULT=$(CONFIG_UAVCAN_FLOAT_COMPARISON_EPSILON_MULT) +ifneq ($(CONFIG_LIBUAVCAN_FLOAT_COMPARISON_EPSILON_MULT),0) +CXXFLAGS += -DUAVCAN_FLOAT_COMPARISON_EPSILON_MULT=$(CONFIG_LIBUAVCAN_FLOAT_COMPARISON_EPSILON_MULT) endif -ifneq ($(CONFIG_UAVCAN_MAX_CAN_ACCEPTANCE_FILTERS),0) -CXXFLAGS += -DUAVCAN_MAX_CAN_ACCEPTANCE_FILTERS=$(CONFIG_UAVCAN_MAX_CAN_ACCEPTANCE_FILTERS) +ifneq ($(CONFIG_LIBUAVCAN_MAX_CAN_ACCEPTANCE_FILTERS),0) +CXXFLAGS += -DUAVCAN_MAX_CAN_ACCEPTANCE_FILTERS=$(CONFIG_LIBUAVCAN_MAX_CAN_ACCEPTANCE_FILTERS) endif -ifneq ($(CONFIG_UAVCAN_MAX_NETWORK_SIZE_HINT),0) -CXXFLAGS += -DUAVCAN_MAX_NETWORK_SIZE_HINT=$(CONFIG_UAVCAN_MAX_NETWORK_SIZE_HINT) +ifneq ($(CONFIG_LIBUAVCAN_MAX_NETWORK_SIZE_HINT),0) +CXXFLAGS += -DUAVCAN_MAX_NETWORK_SIZE_HINT=$(CONFIG_LIBUAVCAN_MAX_NETWORK_SIZE_HINT) endif CXXEXT = .cpp @@ -212,6 +212,7 @@ libuavcan: $(LIBUAVCAN_UNPACKNAME) $(DSDL_UNPACKNAME) $(PYUAVCAN_UNPACKNAME) $(Q) cp -R $(DSDL_UNPACKNAME) $(LIBUAVCAN_DSDL_PATH) $(call DELDIR, $(LIBUAVCAN_PYUAVCAN_PATH)) $(Q) cp -R $(PYUAVCAN_UNPACKNAME) $(LIBUAVCAN_PYUAVCAN_PATH) + $(Q) touch $@ dsdlc_generated: libuavcan $(info $(shell $(LIBUAVCAN_DSDLC) $(UAVCAN_DSDL_DIR))) @@ -248,7 +249,6 @@ clean: distclean: clean $(call DELFILE, Make.dep) $(call DELFILE, .depend) - $(call DELFILE, .libuavcan_patched) $(call DELDIR, $(LIBUAVCAN_UNPACKNAME)) $(call DELFILE, $(LIBUAVCAN_PACKNAME)) $(call DELDIR, $(DSDL_UNPACKNAME)) diff --git a/canutils/uavcan/nuttx-b04396ace50155573e545ed9bf2fb09964ee2367.patch b/canutils/libuavcan/nuttx-b04396ace50155573e545ed9bf2fb09964ee2367.patch similarity index 100% rename from canutils/uavcan/nuttx-b04396ace50155573e545ed9bf2fb09964ee2367.patch rename to canutils/libuavcan/nuttx-b04396ace50155573e545ed9bf2fb09964ee2367.patch diff --git a/canutils/uavcan/platform_stm32.cpp b/canutils/libuavcan/platform_stm32.cpp similarity index 83% rename from canutils/uavcan/platform_stm32.cpp rename to canutils/libuavcan/platform_stm32.cpp index 026bbafc2..e1adeddf0 100644 --- a/canutils/uavcan/platform_stm32.cpp +++ b/canutils/libuavcan/platform_stm32.cpp @@ -1,7 +1,7 @@ /**************************************************************************** - * canutils/uavcan/uavcan_platform.cpp + * canutils/libuavcan/platform_stm32.cpp * - * Copyright (C) 2015 Omni Hoverboards Inc. All rights reserved. + * Copyright (C) 2015-2016 Omni Hoverboards Inc. All rights reserved. * Author: Paul Alexander Patience * * Redistribution and use in source and binary forms, with or without @@ -47,9 +47,9 @@ * Configuration ****************************************************************************/ -#if CONFIG_UAVCAN_RX_QUEUE_CAPACITY == 0 -# undef CONFIG_UAVCAN_RX_QUEUE_CAPACITY -# define CONFIG_UAVCAN_RX_QUEUE_CAPACITY +#if CONFIG_LIBUAVCAN_RX_QUEUE_CAPACITY == 0 +# undef CONFIG_LIBUAVCAN_RX_QUEUE_CAPACITY +# define CONFIG_LIBUAVCAN_RX_QUEUE_CAPACITY #endif /**************************************************************************** @@ -58,7 +58,8 @@ static void delay(void) { - std::usleep(uavcan_stm32::CanInitHelper:: + std::usleep(uavcan_stm32:: + CanInitHelper:: getRecommendedListeningDelay().toUSec()); } @@ -68,22 +69,22 @@ static void delay(void) uavcan::ICanDriver &getCanDriver(void) { - static uavcan_stm32::CanInitHelper can; + static uavcan_stm32::CanInitHelper can; static bool initialized = false; if (!initialized) { - uavcan::uint32_t bitrate = CONFIG_UAVCAN_BIT_RATE; + uavcan::uint32_t bitrate = CONFIG_LIBUAVCAN_BIT_RATE; -#if CONFIG_UAVCAN_INIT_RETRIES > 0 +#if CONFIG_LIBUAVCAN_INIT_RETRIES > 0 int retries = 0; #endif while (can.init(delay, bitrate) < 0) { -#if CONFIG_UAVCAN_INIT_RETRIES > 0 +#if CONFIG_LIBUAVCAN_INIT_RETRIES > 0 retries++; - if (retries >= CONFIG_UAVCAN_INIT_RETRIES) + if (retries >= CONFIG_LIBUAVCAN_INIT_RETRIES) { PANIC(); }