BACnet open source protocol for embedded systems using Zephyr OS integrated with BACnet Stack C library hosted on Sourceforge and Github sites.
This integration uses automated continuous integration services to assist in automated compilation, validation, linting, security scanning, and unit testing to produce robust C code.
GitHub Workflow: BACnet Stack Zephyr Twister Unit Tests and Sample Build
GitHub Workflow: CodeQL Analysis
The Zephyr OS integration offers a collection of samples in the zephyr/samples folder that highlight the features of this BACnet integration, including some BACnet Basic dynamically created objects and services that can be used to quickly create a custom BACnet device on a variety of existing boards.
These samples are crafted to be simple and easy to understand, serving as a starting point for your own projects.
This repository is a Zephyr manifest-module, which means it can be used in either of the following ways:
-
As a module brought in by a different manifest (recommended for product development)
[Prototyped but not verified] Add the following into the root manifest file (e.g., $workspace_dir/$manifest_repo/west.yml)
# In external manifest repository, `west.yml` # to bring in the Zephyr integration of bacnet-stack # as a Zephyr module # Add the following under remotes: - name: bacnet-stack url-base: https://github.com/bacnet-stack # Add the following under projects: - name: bacnet repo-path: bacnet-stack-zephyr path: modules/lib/bacnet import: name-allowlist: - bacnet-stack - name: bacnet-stack path: modules/lib/bacnet/stack-
As a workspace manifest repository (recommended for bacnet-stack contributions):
west init -m https://github.com/bacnet-stack/bacnet-stack-zephyr --mr default $my_workspace
-
Note that as Zephyr OS versions change, their API often changes. This library will use the following methods to accommodate the changes:
- Use defines from <zephyr/version.h> for API changes:
#if ZEPHYR_VERSION_CODE >= ZEPHYR_VERSION(4,2,0) typedef uint64_t mgmt_event_t; #else typedef uint32_t mgmt_event_t; #endif - In CMakeLists.txt via trying to load specific versions of the Zephyr
package or checking using:
if ("${KERNEL_VERSION_STRING}" VERSION_GREATER_EQUAL "4.2.0") # Do stuff... endif() - In Kconfig by using 2 above and trying to load specific versions of the Zephyr plugin and updating CONF_FILE accordingly.
- In .dts, .dtsi or .overlay files, use KERNEL_VERSION_NUMBER or
KERNEL_VERSION_MAJOR defines. The C preprocessor is run on all
devicetree files to expand macro references.
#if KERNEL_VERSION_MAJOR < 4 /delete-node/ &storage_partition; #endif
A simple "Hello World" sample that can be used with any supported board boards and prints "Hello BACnet-Stack" to the console.
A device application demonstrating configuration of a BACnet Smart Actuator (B-SA) device profile that can be used with any supported boards.
A device application demonstrating configuration of a BACnet Smart Sensor (B-SS) device profile that can be used with any supported boards.
A device application demonstrating configuration of a BACnet Lighting Device (B-LD) device profile that can be used with any supported boards.
A device application demonstrating configuration of a BACnet Lighting Supervisor (B-LS) device profile that can be used with any supported boards.
See Zephyr Project Coding Guidelines