Particle driver library to support Microchip MCP2515 and MCP25625 CAN controllers.
This code is based on the Seeed-Studio CAN bus shield repository (https://github.com/Seeed-Studio/CAN_BUS_Shield) written by Loovee ([email protected]).
For instructions on using this library on the Tracker platforms see AN017 Tracker CAN.
On platforms such as the tracker that use external IO expanders and other circuits for GPIO access to the CAN device, normal write accesses with the digitalWrite
interface must be employed instead of the faster version digitalWriteFast
for direct MCU IO. For this reason MCP2515_NORMAL_WRITES
must be specified to the precompiler to use normal digitalWrite
.
There are two ways to accomplish this:
- Add a compile define to your Workbench settings file that will add
MCP2515_NORMAL_WRITES
automatically to all source compiled. - Create a local makefile in the
src/
directory to add the define.
- Open
.vscode/settings.json
file in Workbench. - Add this line to the top of the settings. Don't forget the comma at the end.
"particle.compileDefines": ["MCP2515_NORMAL_WRITES"],
- Save the settings file.
- Clean your application so that the define is applied to all files by pressing and select "Particle: Clean application (local)".
- Compile your application.
Your settings.json file should look similar to this.
{
"particle.compileDefines": ["MCP2515_NORMAL_WRITES"],
"extensions.ignoreRecommendations": true,
"C_Cpp.default.configurationProvider": "particle.particle-vscode-core",
"cortex-debug.openocdPath": "${command:particle.getDebuggerOpenocdPath}",
"files.associations": {
"*.ino": "cpp"
},
"particle.firmwareVersion": "2.0.0-rc.3"
}
- Copy and paste the following make file text into a file named
build.mk
in yoursrc/
directory. - Clean your application.
- Compile your application.
INCLUDE_DIRS += $(SOURCE_PATH)/$(USRSRC) # add user sources to include path
# add C and CPP files - if USRSRC is not empty, then add a slash
CPPSRC += $(call target_files,$(USRSRC_SLASH),*.cpp)
CSRC += $(call target_files,$(USRSRC_SLASH),*.c)
APPSOURCES=$(call target_files,$(USRSRC_SLASH),*.cpp)
APPSOURCES+=$(call target_files,$(USRSRC_SLASH),*.c)
ifeq ($(strip $(APPSOURCES)),)
$(error "No sources found in $(SOURCE_PATH)/$(USRSRC)")
endif
CPPFLAGS+=-DMCP2515_NORMAL_WRITES
Unless stated elsewhere, file headers or otherwise, all files herein are licensed under The MIT License (MIT). For more information, please read the LICENSE file.
If you have questions about software licensing, please contact Particle support.
This firmware is released under The MIT License (MIT), what does that mean for you?
- You may use this commercially to build applications for your devices! You DO NOT need to distribute your object files or the source code of your application under The MIT License. Your source can be released under a non-MIT license. Your source code belongs to you when you build an application using this library.
When am I required to share my code?
- You are NOT required to share your application firmware binaries, source, or object files when linking against libraries or System Firmware licensed under LGPL.
Why?
- This license allows businesses to confidently build firmware and make devices without risk to their intellectual property, while at the same time helping the community benefit from non-proprietary contributions to the shared reference firmware.
Questions / Concerns?
- Particle intends for this firmware to be commercially useful and safe for our community of makers and enterprises. Please Contact Us if you have any questions or concerns, or if you require special licensing.
(Note! This FAQ isn't meant to be legal advice, if you're unsure, please consult an attorney)
Want to contribute to the Particle tracker edge firmware project? Follow this link to find out how.
Having problems or have awesome suggestions? Connect with us here.
- Initial file commit