From 72aa5c34ea41022bb494aebaca6c3db6c30167b3 Mon Sep 17 00:00:00 2001 From: Daniel Mohr Date: Fri, 6 Oct 2023 14:27:21 +0200 Subject: [PATCH 1/5] ignore some hidden refs on deploy_to_repo in ci pipeline --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 71620a9..2cb6291 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -126,4 +126,5 @@ deploy_to_repo: - repopath=$(mktemp -d) - git clone --bare --mirror ${CI_REPOSITORY_URL} $repopath - (cd $repopath && git for-each-ref --format 'delete %(refname)' refs/merge-requests | tee >(git update-ref --stdin)) + - (cd $repopath && git for-each-ref --format 'delete %(refname)' refs/pipelines | tee >(git update-ref --stdin)) - (cd $repopath && git push --prune --mirror $backup_repo) -- GitLab From cf7c828cb43589e5a92b80e1a057ae12df8cffdf Mon Sep 17 00:00:00 2001 From: Daniel Mohr Date: Thu, 12 Oct 2023 17:17:57 +0200 Subject: [PATCH 2/5] make use of cppcheck in ci pipeline --- .gitlab-ci.yml | 11 +++++++++++ .pre-commit-config.yaml | 4 ++-- src/fast_samd21_tc3.h | 2 +- src/fast_samd21_tc4.h | 4 ++-- src/fast_samd21_tc4_tc5.h | 6 +++--- src/fast_samd21_tc5.h | 4 ++-- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2cb6291..ffce467 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,6 +21,17 @@ pre-commit: - pre-commit --version - pre-commit run --all-files +cppcheck: + stage: check_coding_style + image: + # https://hub.docker.com/_/alpine + name: alpine:latest + script: + - date + # install necessary packages: + - apk add --no-cache cppcheck + - cppcheck --suppress="*:test/*" --enable=warning,performance,portability,information --error-exitcode=1 $(find -iname "*.ino") $(find -iname "*.c++") $(find -iname "*.h") + arduino-lint: stage: check_coding_style image: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 376aa0e..ebe77be 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.5.0 hooks: # https://pre-commit.com/hooks.html - id: check-added-large-files @@ -14,6 +14,6 @@ repos: - id: trailing-whitespace - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.32.2 + rev: v0.37.0 hooks: - id: markdownlint diff --git a/src/fast_samd21_tc3.h b/src/fast_samd21_tc3.h index 9419217..a9211ab 100644 --- a/src/fast_samd21_tc3.h +++ b/src/fast_samd21_tc3.h @@ -147,7 +147,7 @@ uint8_t fast_samd21_tc3_configure(double us) { } #else - #error “This library only supports boards with a SAMD processor.” + #error "This library only supports boards with a SAMD processor." #endif #endif /* fast_samd21_tc3_h */ diff --git a/src/fast_samd21_tc4.h b/src/fast_samd21_tc4.h index fd12c70..52b3172 100644 --- a/src/fast_samd21_tc4.h +++ b/src/fast_samd21_tc4.h @@ -20,7 +20,7 @@ #define fast_samd21_tc4_h #if defined(fast_samd21_tc4_tc5_h) - #error “TC4 counter can not be used together with TC4/TC5 32-bit counter.” + #error "TC4 counter can not be used together with TC4/TC5 32-bit counter." #endif #if defined(ARDUINO_ARCH_SAMD) @@ -151,7 +151,7 @@ uint8_t fast_samd21_tc4_configure(double us) { } #else - #error “This library only supports boards with a SAMD processor.” + #error "This library only supports boards with a SAMD processor." #endif #endif /* fast_samd21_tc4_h */ diff --git a/src/fast_samd21_tc4_tc5.h b/src/fast_samd21_tc4_tc5.h index d7865bf..a3b4d1b 100644 --- a/src/fast_samd21_tc4_tc5.h +++ b/src/fast_samd21_tc4_tc5.h @@ -20,11 +20,11 @@ #define fast_samd21_tc4_tc5_h #if defined(fast_samd21_tc4_h) - #error “TC4/TC5 32-bit counter can not be used together with TC4 counter.” + #error "TC4/TC5 32-bit counter can not be used together with TC4 counter." #endif #if defined(fast_samd21_tc5_h) - #error “TC4/TC5 32-bit counter can not be used together with TC5 counter.” + #error "TC4/TC5 32-bit counter can not be used together with TC5 counter." #endif #if defined(ARDUINO_ARCH_SAMD) @@ -159,7 +159,7 @@ uint8_t fast_samd21_tc4_tc5_configure(double us) { } #else - #error “This library only supports boards with a SAMD processor.” + #error "This library only supports boards with a SAMD processor." #endif #endif /* fast_samd21_tc4_tc5_h */ diff --git a/src/fast_samd21_tc5.h b/src/fast_samd21_tc5.h index 61b6e8f..4625a0d 100644 --- a/src/fast_samd21_tc5.h +++ b/src/fast_samd21_tc5.h @@ -20,7 +20,7 @@ #define fast_samd21_tc5_h #if defined(fast_samd21_tc4_tc5_h) - #error “TC5 counter can not be used together with TC4/TC5 32-bit counter.” + #error "TC5 counter can not be used together with TC4/TC5 32-bit counter." #endif #if defined(ARDUINO_ARCH_SAMD) @@ -151,7 +151,7 @@ uint8_t fast_samd21_tc5_configure(double us) { } #else - #error “This library only supports boards with a SAMD processor.” + #error "This library only supports boards with a SAMD processor." #endif #endif /* fast_samd21_tc5_h */ -- GitLab From 9d3a49aa5818372d24b6929c061fa8f6748acdbb Mon Sep 17 00:00:00 2001 From: Daniel Mohr Date: Fri, 15 Aug 2025 16:09:12 +0200 Subject: [PATCH 3/5] make use of yaml2script --- .gitlab-ci.yml | 30 +++++++++++++++++------------- .pre-commit-config.yaml | 22 +++++++++++++++++++--- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ffce467..5267f10 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,18 +8,22 @@ stages: - release - deploy +.display_env: + before_script: + - date + - uname -a + - cat /etc/os-release + pre-commit: stage: check_coding_style image: # https://hub.docker.com/_/alpine name: alpine:latest + extends: .display_env script: - - date - # install necessary packages: - - apk add --no-cache bash gcc git libc-dev npm py3-pip python3-dev - - pip3 install pre-commit + - apk add --no-cache git npm pre-commit - pre-commit --version - - pre-commit run --all-files + - pre-commit run --all-files --show-diff-on-failure cppcheck: stage: check_coding_style @@ -30,7 +34,7 @@ cppcheck: - date # install necessary packages: - apk add --no-cache cppcheck - - cppcheck --suppress="*:test/*" --enable=warning,performance,portability,information --error-exitcode=1 $(find -iname "*.ino") $(find -iname "*.c++") $(find -iname "*.h") + - find . \( -iname "*.ino" -o -iname "*.c++" -o -iname "*.h" \) -print0 | xargs -0 cppcheck --suppress="*:test/*" --enable=warning,performance,portability,information --error-exitcode=1 arduino-lint: stage: check_coding_style @@ -116,10 +120,10 @@ deploy_to_github: - apk add --no-cache git openssh - mkdir ~/.ssh && chmod 700 ~/.ssh - ssh-keyscan -H github.com >> ~/.ssh/known_hosts - - mv $github_deploy_key ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519 + - mv "$github_deploy_key" ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519 - repopath=$(mktemp -d) - - git clone --bare --mirror ${CI_REPOSITORY_URL} $repopath - - (cd $repopath && git push --prune --mirror git@github.com:ug-cp/fast_samd21_tc.git) + - git clone --bare --mirror "${CI_REPOSITORY_URL}" "$repopath" + - (cd "$repopath" && git push --prune --mirror git@github.com:ug-cp/fast_samd21_tc.git) deploy_to_repo: stage: deploy @@ -135,7 +139,7 @@ deploy_to_repo: - date - apk add --no-cache git - repopath=$(mktemp -d) - - git clone --bare --mirror ${CI_REPOSITORY_URL} $repopath - - (cd $repopath && git for-each-ref --format 'delete %(refname)' refs/merge-requests | tee >(git update-ref --stdin)) - - (cd $repopath && git for-each-ref --format 'delete %(refname)' refs/pipelines | tee >(git update-ref --stdin)) - - (cd $repopath && git push --prune --mirror $backup_repo) + - git clone --bare --mirror "${CI_REPOSITORY_URL}" "$repopath" + - (cd "$repopath" && git for-each-ref --format 'delete %(refname)' refs/merge-requests | tee >(git update-ref --stdin)) + - (cd "$repopath" && git for-each-ref --format 'delete %(refname)' refs/pipelines | tee >(git update-ref --stdin)) + - (cd "$repopath" && git push --prune --mirror "$backup_repo") diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ebe77be..62e151b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v6.0.0 hooks: # https://pre-commit.com/hooks.html - id: check-added-large-files @@ -12,8 +12,24 @@ repos: - id: end-of-file-fixer - id: mixed-line-ending - id: trailing-whitespace - - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.37.0 + rev: v0.45.0 hooks: - id: markdownlint + - repo: https://gitlab.com/yaml2script/yaml2script + rev: 0.2.1 + hooks: + - id: yaml2script-check + additional_dependencies: + - shellcheck-py + args: [.gitlab-ci.yml, variables, stages, .display_env, pre-commit, cppcheck, arduino-lint, arduino_ci, prepare_release, release_job, trigger_deploy2zenodo] + - id: yaml2script-check + name: yaml2script check -parameter_check_command=-e SC2154 + additional_dependencies: + - shellcheck-py + args: [-parameter_check_command=-e SC2154, .gitlab-ci.yml, deploy_to_github] + - id: yaml2script-check + name: yaml2script check -parameter_check_command=-e SC2154 --shell=bash + additional_dependencies: + - shellcheck-py + args: [-parameter_check_command=-e SC2154 --shell=bash, .gitlab-ci.yml, deploy_to_repo] -- GitLab From b8013e09f02015b3fb013d60be860c2d21170c29 Mon Sep 17 00:00:00 2001 From: Daniel Mohr Date: Fri, 15 Aug 2025 16:23:36 +0200 Subject: [PATCH 4/5] typo --- .gitlab-ci.yml | 2 +- .pre-commit-config.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5267f10..b6f59b5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,7 +34,7 @@ cppcheck: - date # install necessary packages: - apk add --no-cache cppcheck - - find . \( -iname "*.ino" -o -iname "*.c++" -o -iname "*.h" \) -print0 | xargs -0 cppcheck --suppress="*:test/*" --enable=warning,performance,portability,information --error-exitcode=1 + - find . \( -iname "*.ino" -o -iname "*.c++" -o -iname "*.h" \) -print0 | xargs -0 cppcheck --suppress="*:test/*" --suppress=missingIncludeSystem --suppress=missingInclude --enable=warning,performance,portability,information --error-exitcode=1 --check-level=exhaustive arduino-lint: stage: check_coding_style diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62e151b..1b98164 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: yaml2script-check additional_dependencies: - shellcheck-py - args: [.gitlab-ci.yml, variables, stages, .display_env, pre-commit, cppcheck, arduino-lint, arduino_ci, prepare_release, release_job, trigger_deploy2zenodo] + args: [.gitlab-ci.yml, variables, stages, .display_env, pre-commit, cppcheck, arduino-lint, arduino_ci, prepare_release, release_job] - id: yaml2script-check name: yaml2script check -parameter_check_command=-e SC2154 additional_dependencies: -- GitLab From cda31d75e0f3e0e6e728cfddd8bc6d0582f1df57 Mon Sep 17 00:00:00 2001 From: Daniel Mohr Date: Tue, 19 Aug 2025 19:47:38 +0200 Subject: [PATCH 5/5] added DOI --- .gitlab-ci.yml | 19 +++++++++++++++++++ .pre-commit-config.yaml | 2 +- CITATION.cff | 37 +++++++++++++++++++++++++++++++++++++ LICENSE | 2 +- README.md | 11 +++++++---- library.properties | 2 +- 6 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 CITATION.cff diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b6f59b5..8bf9297 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,6 +24,8 @@ pre-commit: - apk add --no-cache git npm pre-commit - pre-commit --version - pre-commit run --all-files --show-diff-on-failure + - pre-commit autoupdate --jobs $((($(nproc) * 3 + 2 - 1)/2)) + - git diff .pre-commit-config.yaml cppcheck: stage: check_coding_style @@ -143,3 +145,20 @@ deploy_to_repo: - (cd "$repopath" && git for-each-ref --format 'delete %(refname)' refs/merge-requests | tee >(git update-ref --stdin)) - (cd "$repopath" && git for-each-ref --format 'delete %(refname)' refs/pipelines | tee >(git update-ref --stdin)) - (cd "$repopath" && git push --prune --mirror "$backup_repo") + +trigger_deploy2zenodo: + stage: deploy + rules: + - if: $CI_COMMIT_TAG + when: never + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_SERVER_HOST == "gitlab.com" + variables: + TAG: $TAG + TAG_COMMIT_SHA: $CI_COMMIT_SHA + TAG_COMMIT_TIMESTAMP: $CI_COMMIT_TIMESTAMP + trigger: + project: daniel_mohr/deploy_fast_samd21_tc_to_zenodo + strategy: depend + forward: + yaml_variables: true + pipeline_variables: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1b98164..62e151b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: yaml2script-check additional_dependencies: - shellcheck-py - args: [.gitlab-ci.yml, variables, stages, .display_env, pre-commit, cppcheck, arduino-lint, arduino_ci, prepare_release, release_job] + args: [.gitlab-ci.yml, variables, stages, .display_env, pre-commit, cppcheck, arduino-lint, arduino_ci, prepare_release, release_job, trigger_deploy2zenodo] - id: yaml2script-check name: yaml2script check -parameter_check_command=-e SC2154 additional_dependencies: diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..6b9a55f --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,37 @@ +cff-version: 1.2.0 +title: fast_samd21_tc +message: If you use this software, please cite it using the metadata from this file. +type: software +authors: + - given-names: Daniel + family-names: Mohr + orcid: https://orcid.org/0000-0002-9382-6586 + affiliation: Institute of Physics, University of Greifswald, Greifswald, Germany +identifiers: + - description: The concept DOI of the work. + type: doi + value: 10.5281/zenodo.16880701 +repository-code: https://gitlab.com/projects/39183427 +url: https://gitlab.com/ug-cp/fast_samd21_tc +abstract: |- + TC3, TC4 or TC5 timer library for SAMD21 microcontrollers. + This library allows using the TC3_Handler, TC4_Handler and the TC5_Handler routine triggered by the 16-bit Timer/Counter TC3, TC4 or TC5 on SAMD21 (e. g. Arduino MKRZERO). It is also possible to use TC4 and TC5 as a 32-bit Timer/Counter. It is possible to trigger very fast (a few microseconds, e. g. 4 us and less, depending on the runtime of the handler routine/function). You can use fraction numbers as interval (e. g. 2.5 us). Keep in mind, TC4 and TC5 are not completely independent. But you can use TC4 and TC5 together as a 32-bit counter. This 32-bit counter allows to call the interrupt with a time between calls up to 1 day and more. + This library is licensed under BSD-3-Clause. +keywords: + - Arduino + - samd + - samd21 + - timer + - interrupt + - timing + - microcontroller + - high-speed + - embedded systems + - tc + - tc3 + - tc4 + - tc5 + - 16-bit timer + - 32-bit timer +license: bsd-3-clause +doi: 10.5281/zenodo.16880701 diff --git a/LICENSE b/LICENSE index e4ac5df..6dcae5e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2022, Daniel Mohr and University of Greifswald, Institute of Physics, Colloidal (dusty) plasma group +Copyright (c) 2022-2025, Daniel Mohr and University of Greifswald, Institute of Physics, Colloidal (dusty) plasma group All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index e5c8553..cad9cde 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,11 @@ --- author: Daniel Mohr -date: 2023-10-06 +date: 2025-08-19 url: https://gitlab.com/ug-cp/fast_samd21_tc +mirror: https://github.com/ug-cp/fast_samd21_tc +Arduino Library Manager: https://www.arduino.cc/reference/en/libraries/fast_samd21_tc/ license: BSD 3-Clause License +doi: https://doi.org/10.5281/zenodo.16880701 --- # fast_samd21_tc -- TC5, TC4 or TC3 timer library for SAMD21 microcontrollers @@ -308,9 +311,9 @@ In the folder [examples](examples) you can find some examples. ## License, Copyright: BSD 3-Clause License -Copyright (c) 2022, 2023 Daniel Mohr and - University of Greifswald, Institute of Physics, - Colloidal (dusty) plasma group +Copyright (c) 2022-2025 Daniel Mohr and + University of Greifswald, Institute of Physics, + Colloidal (dusty) plasma group All rights reserved. diff --git a/library.properties b/library.properties index 425b193..bc03614 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=fast_samd21_tc -version=0.3.0 +version=0.3.1 author=Daniel Mohr maintainer=Daniel Mohr sentence=TC3, TC4 or TC5 timer library for SAMD21 microcontrollers. -- GitLab