diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1384882 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,13 @@ +name: build + +on: + push: + branches: [master] + +jobs: + x86_64-pc-linux-gnu-gcc: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: cmake -Bbuild + - run: cmake --build build \ No newline at end of file diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml new file mode 100644 index 0000000..7000b42 --- /dev/null +++ b/.github/workflows/license.yml @@ -0,0 +1,15 @@ +name: license + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + check-license: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check license + uses: kt3k/license_checker@v1.0.6 \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..caf36fa --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,16 @@ +name: tests + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + x86_64-pc-linux-gnu-gcc: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: cmake -Bbuild + - run: cmake --build build --target DCCTests + - run: ctest --test-dir build --schedule-random \ No newline at end of file diff --git a/.licenserc.json b/.licenserc.json new file mode 100644 index 0000000..cf246e5 --- /dev/null +++ b/.licenserc.json @@ -0,0 +1,7 @@ +{ + "{include,src}/**/*.{c,cpp,h,hpp}": [ + "// This Source Code Form is subject to the terms of the Mozilla Public", + "// License, v. 2.0. If a copy of the MPL was not distributed with this", + "// file, You can obtain one at https://mozilla.org/MPL/2.0/." + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 18baf65..04571fa 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # DCC +[![build](https://github.com/ZIMO-Elektronik/DCC/actions/workflows/build.yml/badge.svg)](https://github.com/ZIMO-Elektronik/DCC/actions/workflows/build.yml) [![tests](https://github.com/ZIMO-Elektronik/DCC/actions/workflows/tests.yml/badge.svg)](https://github.com/ZIMO-Elektronik/DCC/actions/workflows/tests.yml) + DCC is an acronym for [Digital Command Control](https://en.wikipedia.org/wiki/Digital_Command_Control), a standardized protocol for controlling digital model railways. This C++ library of the same name contains platform-independent code to either decode (decoder) or generate (command station) a DCC signal on the track. For both cases, a typical microcontroller timer with microsecond precision is sufficient for implementing a receiver or transmitter class. Also included, but not platform-independent, is an encoder for the [ESP32 RMT](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/rmt.html) peripherals. @@ -29,7 +31,7 @@ The implementation provided here is used in the following products: ## Protocol -The DCC protocol is defined by various standards published by the [National Model Railroad Association (NMRA)](https://www.nmra.org/) and the [RailCommunity](https://www.vhdm.at/). The standards are mostly consistent and I have tried to match the English and German standards in the table below, but if you can read German I would recommend sticking to the RCN standards as these are updated more frequently. +The DCC protocol is defined by various standards published by the [National Model Railroad Association (NMRA)](https://www.nmra.org/) and the [RailCommunity](https://www.vhdm.at/). The standards are mostly consistent and we have attempted to match the English and German standards in the table below. However, if you can read German, we recommend that you stick to the RCN standards as they are updated more frequently. | NMRA (English) | RailCommunity (German) | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | @@ -122,7 +124,7 @@ FetchContent_Declare( target_link_libraries(YourTarget PRIVATE DCC::DCC) ``` -A number of [options](CMakeLists.txt) are provided to configure various sizes such as the receiver queue length or the maximum packet length. When RAM becomes scarce, queue lengths can be reduced. On the other hand, if the processing of the commands is too slow and cannot be done every few milliseconds, it can make sense to lengthen the queues and batch process several commands at once. Otherwise, I would recommend sticking with the defaults. +A number of [options](CMakeLists.txt) are provided to configure various sizes such as the receiver queue length or the maximum packet length. When RAM becomes scarce, queue lengths can be reduced. On the other hand, if the processing of the commands is too slow and cannot be done every few milliseconds, it can make sense to lengthen the queues and batch process several commands at once. Otherwise, we recommend sticking with the defaults. ```cmake set(DCC_RX_QUEUE_SIZE 8