diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 4081ec7..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,93 +0,0 @@ -version: 2 - -jobs: - build: - docker: - - image: sensirion/embedded-ci:2.1.0 - steps: - - checkout - - run: - name: update common repo - command: git submodule update --init - - run: make prepare - - run: make - - run: make clean - - run: make style-check - - run: make release - - run: - name: build stub release drivers - command: | - (cd release/sht3x - make CONFIG_I2C_TYPE=hw_i2c - make CONFIG_I2C_TYPE=sw_i2c - make clean) - (cd release/shtc1 - make CONFIG_I2C_TYPE=hw_i2c - make CONFIG_I2C_TYPE=sw_i2c - make clean) - - run: - name: build Linux release drivers - command: | - (cd release/sht3x - make CONFIG_I2C_TYPE=hw_i2c hw_i2c_impl_src=hw_i2c/sample-implementations/linux_user_space/sensirion_hw_i2c_implementation.c - make CONFIG_I2C_TYPE=sw_i2c sw_i2c_impl_src=sw_i2c/sample-implementations/linux_user_space/sensirion_sw_i2c_implementation.c - make clean) - (cd release/shtc1 - make CONFIG_I2C_TYPE=hw_i2c hw_i2c_impl_src=hw_i2c/sample-implementations/linux_user_space/sensirion_hw_i2c_implementation.c - make CONFIG_I2C_TYPE=sw_i2c sw_i2c_impl_src=sw_i2c/sample-implementations/linux_user_space/sensirion_sw_i2c_implementation.c - make clean) - - deploy: - docker: - - image: sensirion/embedded-ci:2.1.0 - steps: - - checkout - - run: - name: update common repo - command: git submodule update --init - - run: make release - - run: - name: Move zip files to artifact directory - command: | - mkdir -p /releases - mv release/*.zip /releases/ - - persist_to_workspace: - root: /releases - paths: . - - store-artifacts: - path: /releases - - github-release: - docker: - - image: cibuilds/github:0.13 - steps: - - attach_workspace: - at: /releases - - run: - name: "Publish Release on GitHub" - command: ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -n "Embedded-SHT ${CIRCLE_TAG}" -soft ${CIRCLE_TAG} /releases/ - -workflows: - version: 2 - build_and_deploy: - jobs: - - build: - filters: # required since `deploy` has tag filters AND requires `build` - tags: - only: /.*/ - - deploy: - requires: - - build - filters: - branches: - only: master - tags: - only: /^\d+\.\d+\.\d+$/ - - github-release: - requires: - - deploy - filters: - branches: - ignore: /.*/ - tags: - only: /^\d+\.\d+\.\d+$/ diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..e7b50ea --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,28 @@ +name: syntax, static code analyis and build check for c drivers + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + code-analysis: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: awalsh128/cache-apt-pkgs-action@v1 + with: + packages: cppcheck clang-format + version: 1.0 + - name: clang-format syntax-check + run: | + find sht-common -type f -iregex ".*\.\(c\|h\|cpp\|ino\)" -exec clang-format -i -style=file {} \; + find shtc1 -type f -iregex ".*\.\(c\|h\|cpp\|ino\)" -exec clang-format -i -style=file {} \; + find sht3x -type f -iregex ".*\.\(c\|h\|cpp\|ino\)" -exec clang-format -i -style=file {} \; + find sht4x -type f -iregex ".*\.\(c\|h\|cpp\|ino\)" -exec clang-format -i -style=file {} \; + git diff --exit-code + - name: cppcheck static code analyis + run: cppcheck --std=c89 --language=c --error-exitcode=1 --enable=warning,style,performance,portability --suppress=unreadVariable -i sample-projects/ -i embedded-common/ -i release/ . diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 6cbf260..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,34 +0,0 @@ -include: 'https://raw.githubusercontent.com/Sensirion/ci-config-github/master/github-status-gitlab-ci-template-v1.yml' - -stages: - - publish_build_pending - - build - - publish_build_status - -variables: - GIT_SUBMODULE_STRATEGY: recursive - GITHUB_PROJECT_NAME: embedded-sht - -publish_build_pending: - extends: .github_publish_pending - stage: publish_build_pending - -publish_success: - extends: .github_publish_success - stage: publish_build_status - -publish_failure: - extends: .github_publish_failure - stage: publish_build_status - -test: - stage: build - image: - name: registry.gitlab.sensirion.lokal/sensirion/docker/docker-rpi-testbed:1.1.0 - tags: - - mso-sw-testbed-2 - script: - - git clone -b 2.0.0 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab/MSO-SW/drivers/testbed/i2c-mux-testbed.git - - cd tests - - make test - diff --git a/sht3x/sht3x.c b/sht3x/sht3x.c index bcb38cf..37f0ff6 100644 --- a/sht3x/sht3x.c +++ b/sht3x/sht3x.c @@ -150,13 +150,12 @@ void sht3x_set_power_mode(sht3x_measurement_mode_t mode) { int16_t sht3x_read_serial(sht3x_i2c_addr_t addr, uint32_t* serial) { int16_t ret; - uint8_t serial_bytes[4]; ret = sensirion_i2c_write_cmd(addr, SHT3X_CMD_READ_SERIAL_ID); sensirion_sleep_usec(SHT3X_CMD_DURATION_USEC); if (ret == STATUS_OK) { - + uint8_t serial_bytes[4]; ret = sensirion_i2c_read_words_as_bytes( addr, serial_bytes, SENSIRION_NUM_WORDS(serial_bytes)); *serial = sensirion_bytes_to_uint32_t(serial_bytes); diff --git a/shtc1/shtc1.c b/shtc1/shtc1.c index 6f4b8d1..7784d47 100644 --- a/shtc1/shtc1.c +++ b/shtc1/shtc1.c @@ -140,7 +140,7 @@ int16_t shtc1_read_serial(uint32_t* serial) { return ret; *serial = ((uint32_t)serial_words[0] << 16) | serial_words[1]; - return ret; + return 0; } const char* shtc1_get_driver_version(void) {