diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..4eeeb5a --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +@gfurtadoalmeida \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..d9b8467 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,94 @@ +name: ❗ Bug Report +description: Create a report to help us improve. +title: "[Bug]: " +labels: ['bug'] +body: + - type: markdown + attributes: + value: | + We welcome bug reports! This template will help us gather the information we need to start the triage process. + - type: textarea + id: background + attributes: + label: Description + description: Please share a clear and concise description of the problem. + placeholder: Description + validations: + required: true + - type: textarea + id: repro-steps + attributes: + label: Reproduction Steps + description: | + Please include minimal steps to reproduce the problem if possible. E.g.: the smallest possible code snippet; or a small project, with steps to run it. + + We will close this issue if: + - We are not able to reproduce the behavior you're reporting. + - The issue is a duplicate of an existing issue. + - The behavior you're reporting is by design. + placeholder: Minimal Reproduction + validations: + required: true + - type: textarea + id: expected-behavior + attributes: + label: Expected behavior + description: | + Provide a description of the expected behavior. + placeholder: Expected behavior + validations: + required: true + - type: textarea + id: actual-behavior + attributes: + label: Actual behavior + description: | + Provide a description of the actual behavior. If applicable please include any error messages, exception stacktraces or memory dumps. + placeholder: Actual behavior + validations: + required: true + - type: dropdown + id: chip-model + attributes: + label: Chip model used. + multiple: false + options: + - MCP3204 + - MCP3208 + - Both + validations: + required: true + - type: input + id: idf-version + attributes: + label: IDF version. + description: On which IDF version does this issue occur on? + placeholder: ex. v3.2-dev-1148-g96cd3b75c + validations: + required: true + - type: input + id: chip-revision + attributes: + label: Espressif SoC revision. + description: On which Espressif SoC revision does your application run on? + placeholder: ex. ESP32-C3 (QFN32) (revision v0.3) + validations: + required: true + - type: textarea + id: debug-logs + attributes: + label: Debug Logs. + description: Debug log goes here, should contain the backtrace, as well as the reset source if it is a crash. + placeholder: Your log goes here. + render: plain text + validations: + required: false + - type: textarea + id: other-info + attributes: + label: Other information + description: | + If you have an idea where the problem might lie, let us know that here. Please include any pointers to code, relevant changes, or related issues you know of. + placeholder: Other information + validations: + required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000..29486f6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,35 @@ +name: 💡 Feature request +description: Propose a feature or improvement +title: '[Feature request]: ' +labels: ['feature'] +body: + - type: markdown + attributes: + value: | + We welcome feature requests! This template will help us gather the information we need to start the review process. + - type: textarea + id: background + attributes: + label: Background and motivation + description: Please describe the purpose and value of the new feature. + placeholder: Purpose + validations: + required: true + - type: textarea + id: description + attributes: + label: Describe the solution expected + description: | + Please provide a clear and concise description of what you want to happen. + placeholder: Description + validations: + required: true + - type: textarea + id: additional-info + attributes: + label: Additional info + description: | + Add any other information about the feature request here. + placeholder: Additional info + validations: + required: false diff --git a/.github/PULL_REQUEST_TEMPLATE/pull-request-template.md b/.github/PULL_REQUEST_TEMPLATE/pull-request-template.md new file mode 100644 index 0000000..916934b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull-request-template.md @@ -0,0 +1,19 @@ +# Pull Request + +## Details + +Please explain the changes you made here. + +## Checklist + +- [ ] PR started by branching from the head of the default branch +- [ ] PR targeted to merge into the default branch +- [ ] Created tests which fail without the change +- [ ] All tests passing +- [ ] Successfully ran a local build + +## Where has this been tested? + +- Chip model: +- IDF version: +- Espressif SoC revision: diff --git a/.github/workflows/build.yml b/.github/workflows/development.yml similarity index 65% rename from .github/workflows/build.yml rename to .github/workflows/development.yml index 6c04a53..d259259 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/development.yml @@ -1,18 +1,26 @@ -name: build +name: development on: push: - branches: [ "master" ] + branches: ["master"] paths: - 'components/**' - 'main/**' - 'test/**' pull_request: - branches: [ "master" ] + types: + - opened + - edited + - synchronize + - reopened + paths: + - 'components/**' + - 'main/**' + - 'test/**' workflow_dispatch: env: - esp_docker_image: gfurtadoalmeida/esp32-docker-sonar:v5.1 + ESP_DOCKER_IMAGE: gfurtadoalmeida/esp32-docker-sonar:v5.1 jobs: build: @@ -31,12 +39,12 @@ jobs: - name: Pull ESP-IDF Image shell: pwsh - run: docker pull ${{env.esp_docker_image}} + run: docker pull ${{env.ESP_DOCKER_IMAGE}} - name: Build with Sonar shell: pwsh - run: docker run --rm --env SONARCLOUD_ORGANIZATION=${{secrets.SONARCLOUD_ORGANIZATION}} --env SONARCLOUD_TOKEN=${{secrets.SONARCLOUD_TOKEN}} --env LC_ALL='C.UTF-8' -v ${{github.workspace}}:/project -w /project ${{env.esp_docker_image}} idf.py build + run: docker run --rm --env SONARCLOUD_ORGANIZATION=${{secrets.SONARCLOUD_ORGANIZATION}} --env SONARCLOUD_TOKEN=${{secrets.SONARCLOUD_TOKEN}} --env LC_ALL='C.UTF-8' -v ${{github.workspace}}:/project -w /project ${{env.ESP_DOCKER_IMAGE}} idf.py build - name: Build Test shell: pwsh - run: docker run --rm --env LC_ALL='C.UTF-8' -v ${{github.workspace}}:/project -w /project ${{env.esp_docker_image}} idf.py -C ./test build + run: docker run --rm --env LC_ALL='C.UTF-8' -v ${{github.workspace}}:/project -w /project ${{env.ESP_DOCKER_IMAGE}} idf.py -C ./test build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f9b5630 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,64 @@ +name: release + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+*' + +jobs: + build: + runs-on: ubuntu-latest + + env: + ESP_DOCKER_IMAGE: gfurtadoalmeida/esp32-docker-sonar:v5.1 + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Docker Login + uses: docker/login-action@v2.1.0 + with: + username: ${{secrets.DOCKER_USERNAME}} + password: ${{secrets.DOCKER_TOKEN}} + + - name: Pull ESP-IDF Image + shell: pwsh + run: docker pull ${{env.ESP_DOCKER_IMAGE}} + + - name: Build + shell: pwsh + run: docker run --rm --env LC_ALL='C.UTF-8' -v ${{github.workspace}}:/project -w /project ${{env.ESP_DOCKER_IMAGE}} idf.py build + + - name: Build Test + shell: pwsh + run: docker run --rm --env LC_ALL='C.UTF-8' -v ${{github.workspace}}:/project -w /project ${{env.ESP_DOCKER_IMAGE}} idf.py -C ./test build + + release: + runs-on: ubuntu-latest + needs: [build] + permissions: + contents: write + + env: + ZIP_NAME: esp32-driver-mcp320x.${{github.ref_name}}.zip + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Create Zip + shell: bash + run: zip -r ${{env.ZIP_NAME}} 'components/esp32_driver_mcp320x/' + + - name: Publish + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: "${{env.ZIP_NAME}}" + makeLatest: true + name: ESP32 Driver MCP320X ${{github.ref_name}} + removeArtifacts: false + replacesArtifacts: true diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..87ec3f8 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,132 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official email address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[@gfurtadoalmeida](https://twitter.com/gfurtadoalmeida). +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..57a0357 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,11 @@ +# Contributing + +* Branch from the head of the default branch. +* Follow the [ESP-IDF code conventions](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/contribute/style-guide.html). +* The code must support any [ESP32 module](https://www.espressif.com/en/products/modules). +* Use portable types: + * ```stdbool.h```: [bool](https://en.wikipedia.org/wiki/C_data_types#Boolean_type). + * ```stdint.h```: [fixed-width integer](https://en.wikipedia.org/wiki/C_data_types#stdint.h). + * ```stddef.h```: [pointers and sizes](https://en.wikipedia.org/wiki/C_data_types#Size_and_pointer_difference_types). +* Do not hide pointers behind typedefs. +* Create tests for every new functionality. diff --git a/README.md b/README.md index 87cf94e..a87efb0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ESP32 - MCP3204/3208 12-bit ADC Driver -![GitHub Build Status](https://github.com/gfurtadoalmeida/esp32-driver-mcp320x/actions/workflows/build.yml/badge.svg) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=esp32_driver_mcp320x&metric=bugs)](https://sonarcloud.io/summary/new_code?id=esp32_driver_mcp320x) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=esp32_driver_mcp320x&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=esp32_driver_mcp320x) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=esp32_driver_mcp320x&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=esp32_driver_mcp320x) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=esp32_driver_mcp320x&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=esp32_driver_mcp320x) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=esp32_driver_mcp320x&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=esp32_driver_mcp320x) +![GitHub Build Status](https://github.com/gfurtadoalmeida/esp32-driver-mcp320x/actions/workflows/release.yml/badge.svg) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=esp32_driver_mcp320x&metric=bugs)](https://sonarcloud.io/summary/new_code?id=esp32_driver_mcp320x) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=esp32_driver_mcp320x&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=esp32_driver_mcp320x) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=esp32_driver_mcp320x&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=esp32_driver_mcp320x) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=esp32_driver_mcp320x&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=esp32_driver_mcp320x) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=esp32_driver_mcp320x&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=esp32_driver_mcp320x) ESP32 driver for Microchip [MCP3204](https://www.microchip.com/en-us/product/MCP3204) and [MCP3208](https://www.microchip.com/en-us/product/MCP3208) 12-bit ADCs. ## Characteristics