-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NTCAN hardware layer #198
base: main
Are you sure you want to change the base?
NTCAN hardware layer #198
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's still in a draft state but here's some initial thoughts. Nothing major but I worry about them using an All Rights Reserved in their header file. We will have to do our due diligence to see if this can be added to the repo in the first place.
hardware_integration/include/isobus/hardware_integration/ntcan_fifo_plugin.hpp
Outdated
Show resolved
Hide resolved
hardware_integration/include/isobus/hardware_integration/ntcan_fifo_plugin.hpp
Outdated
Show resolved
Hide resolved
* * | ||
* ntcan.h -- NTCAN-API procedure declarations and constant definitions * | ||
* * | ||
* Copyright (c) 1997 - 2022, esd electronics gmbh. All rights reserved. * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All rights reserved is more restrictive than MIT license - we may not be able to include this file in our project. I will have to check their EULA...
if (NTCAN_SUCCESS == openResult) | ||
{ | ||
ids = 0x20000000; | ||
openResult = canIdRegionAdd(handle, 0 | NTCAN_20B_BASE, &ids); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 | something is always something. Do you need the 0?
hardware_integration/include/isobus/hardware_integration/NTCAN.h
Outdated
Show resolved
Hide resolved
hardware_integration/include/isobus/hardware_integration/NTCAN.h
Outdated
Show resolved
Hide resolved
Thanks for the comments. Fortunately most of those seem fairly trivial. As for the main point - basic testing has at least confirmed it works. |
So I'm not sure what the best way to deal with removing the explicit width types in, since I used those to match what the NTCAN API expects. If a function expects
As for the inclusion of the library directly, I did that because the PCAN one did and I was just trying to emulate the existing style. However, since you need the driver installed to use this hardware backend anyway, and that includes the SDK with the latest version of the includes and libs, I don't think much is lost by removing it entirely and not worrying about the licenses at all. I can even rebase and purge the copies from git history. |
- Prefix types with `std::`. - Comment `| 0`. - Still using explicit width types, because they're what the API takes (and none are exposed outside the plugin). - Not a suggestion, but I switched to using `<< 11` and `<< 29` instead of more magic numbers to make it slightly clearer that those numbers are to do with CAN 11- and 29-bit identifiers. - Reduced some scopes.
I've rebased and removed the copies of the ntcan library. Now you just have to link it correctly. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
I wanted to add support for this virtual CAN bus:
https://esd.eu/en/products/can-sdk
I know there's a basic virtual CAN already in the library, but it doesn't work between processes.
This is only a very basic first pass at the code (and clearly copied almost wholesale from the PCAN implementation), just here for any early comments (I've not even tested it yet). They do claim that their library is cross-platform, so there may be a way to support Linux in here as well. You may notice that the bundled
.lib
files are in sub-directories instead of using the existing_x86
and_x64
naming convention on other libraries. This is because the include itself, copied from their SDK, looks for a file named exactlyntcan.lib
via#pragma
.