-
Notifications
You must be signed in to change notification settings - Fork 542
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DroneCAN add socketcan support, rename to DroneCAN
Rename canardv1 to OpenCyphal Apply suggestions from code review Co-authored-by: Petro Karashchenko <[email protected]>
- Loading branch information
1 parent
b67b561
commit 4c7c169
Showing
22 changed files
with
347 additions
and
227 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/libcanard | ||
/*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# | ||
# For a description of the syntax of this configuration file, | ||
# see the file kconfig-language.txt in the NuttX tools repository. | ||
# | ||
|
||
config CANUTILS_LIBDRONECAN | ||
bool "libcanard DroneCAN Library" | ||
default n | ||
depends on (CAN && CAN_EXTID) || NET_CAN | ||
---help--- | ||
Enable the libcanard DroneCAN library. | ||
|
||
if CANUTILS_LIBDRONECAN | ||
|
||
config LIBDRONECAN_URL | ||
string "libcanard URL" | ||
default "https://github.com/dronecan/libcanard/archive" | ||
---help--- | ||
libcanard URL. | ||
|
||
config LIBDRONECAN_VERSION | ||
string "libcanard Version" | ||
default "21f2a73df86886101e254d02cfc2277cd2a15717" | ||
---help--- | ||
libcanard version. | ||
|
||
config LIBDRONECAN_CANFD | ||
bool "(Experimental) libcanard CAN FD Support" | ||
default n | ||
depends on NET_CAN_CANFD && EXPERIMENTAL | ||
---help--- | ||
libcanard CAN FD support. | ||
Adds support for CAN FD, this is still experimental | ||
since libcanard doesn't support runtime switching | ||
between CAN2.0B and CAN FD that well | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
############################################################################ | ||
# apps/canutils/libdronecan/Makefile | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. The | ||
# ASF licenses this file to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance with the | ||
# License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
############################################################################ | ||
|
||
include $(APPDIR)/Make.defs | ||
|
||
WD := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'} | ||
|
||
UNPACK = unzip | ||
PACKEXT = .zip | ||
|
||
LIBDRONECAN_URL = $(patsubst "%",%,$(strip $(CONFIG_LIBDRONECAN_URL))) | ||
LIBDRONECAN_VERSION = $(patsubst "%",%,$(strip $(CONFIG_LIBDRONECAN_VERSION))) | ||
|
||
LIBDRONECAN_PACKNAME = $(LIBDRONECAN_UNPACKNAME)$(PACKEXT) | ||
LIBDRONECAN_UNPACKNAME = libcanard-$(LIBDRONECAN_VERSION) | ||
LIBDRONECAN_SRCNAME = libcanard | ||
|
||
LIBDRONECAN_SRCDIR = $(WD)/$(LIBDRONECAN_SRCNAME) | ||
LIBDRONECAN_DRVDIR = $(LIBDRONECAN_SRCDIR)$(DELIM)drivers$(DELIM)nuttx | ||
LIBDRONECAN_SOCKETCANDIR = $(LIBDRONECAN_SRCDIR)$(DELIM)drivers$(DELIM)socketcan | ||
|
||
# Conflict with Cyphal's libcanard | ||
ifeq ($(CONFIG_CANUTILS_LIBOPENCYPHAL),y) | ||
CFLAGS += -DcanardInit=dronecanardInit | ||
endif | ||
|
||
CFLAGS += -std=c99 -DCANARD_ASSERT=DEBUGASSERT | ||
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/canutils/libdronecan/libcanard | ||
|
||
ifeq ($(CONFIG_LIBDRONECAN_CANFD),y) | ||
CFLAGS += -DCANARD_ENABLE_CANFD=1 | ||
endif | ||
|
||
CSRCS = $(LIBDRONECAN_SRCDIR)$(DELIM)canard.c | ||
|
||
ifeq ($(CONFIG_NET_CAN),y) | ||
CSRCS += $(LIBDRONECAN_SOCKETCANDIR)$(DELIM)socketcan.c | ||
else | ||
CSRCS += $(LIBDRONECAN_DRVDIR)$(DELIM)canard_nuttx.c | ||
endif | ||
|
||
# Download and unpack tarball if no git repo found | ||
ifeq ($(wildcard $(LIBDRONECAN_SRCNAME)/.git),) | ||
$(LIBDRONECAN_PACKNAME): | ||
@echo "Downloading: $@" | ||
$(Q) curl -o $@ -L $(LIBDRONECAN_URL)$(DELIM)$(LIBDRONECAN_VERSION)$(PACKEXT) | ||
|
||
$(LIBDRONECAN_SRCNAME): $(LIBDRONECAN_PACKNAME) | ||
@echo "Unpacking: $< -> $@" | ||
$(call DELDIR, $@) | ||
$(Q) $(UNPACK) $< | ||
$(Q) mv $(LIBDRONECAN_UNPACKNAME) $(LIBDRONECAN_SRCNAME) | ||
$(Q) touch $@ | ||
|
||
$(LIBDRONECAN_SRCDIR)$(DELIM)canard.c: $(LIBDRONECAN_SRCNAME) | ||
endif | ||
|
||
context:: $(LIBDRONECAN_SRCNAME) | ||
|
||
distclean:: | ||
ifeq ($(wildcard $(LIBDRONECAN_SRCNAME)/.git),) | ||
$(call DELDIR, $(LIBDRONECAN_SRCNAME)) | ||
$(call DELFILE, $(LIBDRONECAN_PACKNAME)) | ||
endif | ||
|
||
include $(APPDIR)/Application.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/libcanard | ||
/o1heap | ||
/*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.