├── .editorconfig
├── .envrc
├── .github
├── dependabot.yaml
├── settings.yml
└── workflows
│ ├── flake-checker.yaml
│ ├── flake-lock-updater.yaml
│ ├── link-checker.yaml
│ ├── micropython.yaml
│ ├── pyright.yaml
│ ├── treefmt.yaml
│ ├── update-nix-direnv.yaml
│ ├── update-nixos-release.yaml
│ ├── update-requirements.yaml
│ └── yamllint.yaml
├── .gitignore
├── .justfile
├── .vscode
├── extensions.json
└── settings.json
├── .yamlfmt.yaml
├── .yamllint.yaml
├── CODE_OF_CONDUCT.adoc
├── LICENSE.adoc
├── README.adoc
├── flake.lock
├── flake.nix
├── lychee.toml
├── main.py
├── overlays
└── default.nix
├── package.nix
├── pics
├── pico-pwm-fan-controller-breadboard-side-1.jpg
├── pico-pwm-fan-controller-breadboard-side-2.jpg
├── pico-pwm-fan-controller-breadboard-side-3.jpg
├── pico-pwm-fan-controller-breadboard-top-1.jpg
└── pico-pwm-fan-controller-breadboard-top-2.jpg
├── pre-commit-hooks.nix
├── pyproject.toml
├── requirements-dev.in
├── requirements-dev.txt
└── treefmt.nix
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | end_of_line = lf
6 | insert_final_newline = true
7 | indent_size = 2
8 | indent_style = space
9 | max_line_length = 120
10 | trim_trailing_whitespace = true
11 |
12 | [*.adoc]
13 | indent_size = unset
14 |
15 | [*.{adoc,envrc,nu,yaml,yml}]
16 | max_line_length = off
17 |
18 | [{justfile,.justfile,*.just}]
19 | indent_size = 4
20 |
21 | [*.py]
22 | indent_size = 4
23 |
--------------------------------------------------------------------------------
/.envrc:
--------------------------------------------------------------------------------
1 | if ! has nix_direnv_version || ! nix_direnv_version 3.0.7; then
2 | source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.7/direnvrc" "sha256-bn8WANE5a91RusFmRI7kS751ApelG02nMcwRekC/qzc="
3 | fi
4 |
5 | use flake
6 |
7 |
--------------------------------------------------------------------------------
/.github/dependabot.yaml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "github-actions"
4 | directory: "/"
5 | schedule:
6 | interval: "weekly"
7 |
--------------------------------------------------------------------------------
/.github/settings.yml:
--------------------------------------------------------------------------------
1 | repository:
2 | # See https://developer.github.com/v3/repos/#edit for all available settings.
3 |
4 | name: PWM-Fan-Controller-MicroPython
5 | # A short description of the repository that will show up on GitHub
6 | description: A simple program for controlling a fan using MicroPython on a microcontroller
7 | # A URL with more information about the repository
8 | # homepage: ""
9 | # A comma-separated list of topics to set on the repository
10 | topics: python, raspberry-pi, microcontroller, nix, micropython, fan-control, pwm, pico, rp2040,
11 | # Either `true` to make the repository private, or `false` to make it public.
12 | private: false
13 | # Either `true` to enable issues for this repository, `false` to disable them.
14 | has_issues: true
15 | # Either `true` to enable projects for this repository, or `false` to disable them.
16 | # If projects are disabled for the organization, passing `true` will cause an API error.
17 | has_projects: false
18 | # Either `true` to enable the wiki for this repository, `false` to disable it.
19 | has_wiki: false
20 | # Either `true` to enable downloads for this repository, `false` to disable them.
21 | has_downloads: false
22 | # Updates the default branch for this repository.
23 | default_branch: main
24 | # Either `true` to allow squash-merging pull requests, or `false` to prevent
25 | # squash-merging.
26 | allow_squash_merge: true
27 | # Either `true` to allow merging pull requests with a merge commit, or `false`
28 | # to prevent merging pull requests with merge commits.
29 | allow_merge_commit: true
30 | # Either `true` to allow rebase-merging pull requests, or `false` to prevent
31 | # rebase-merging.
32 | allow_rebase_merge: true
33 | # Either `true` to enable automatic deletion of branches on merge, or `false` to disable
34 | delete_branch_on_merge: true
35 | # Either `true` to enable automated security fixes, or `false` to disable
36 | # automated security fixes.
37 | enable_automated_security_fixes: true
38 | # Either `true` to enable vulnerability alerts, or `false` to disable
39 | # vulnerability alerts.
40 | enable_vulnerability_alerts: true
41 | # Labels: define labels for Issues and Pull Requests
42 | #
43 | labels:
44 | # - name: bug
45 | # color: CC0000
46 | # description: An issue with the system 🐛.
47 |
48 | # - name: feature
49 | # # If including a `#`, make sure to wrap it with quotes!
50 | # color: '#336699'
51 | # description: New functionality.
52 |
53 | # - name: Help Wanted
54 | # # Provide a new name to rename an existing label
55 | # new_name: first-timers-only
56 |
57 | # Milestones: define milestones for Issues and Pull Requests
58 | milestones:
59 | # - title: milestone-title
60 | # description: milestone-description
61 | # # The state of the milestone. Either `open` or `closed`
62 | # state: open
63 |
64 | # Collaborators: give specific users access to this repository.
65 | # See https://docs.github.com/en/rest/reference/repos#add-a-repository-collaborator for available options
66 | collaborators:
67 | # - username: null
68 | # Note: `permission` is only valid on organization-owned repositories.
69 | # The permission to grant the collaborator. Can be one of:
70 | # * `pull` - can pull, but not push to or administer this repository.
71 | # * `push` - can pull and push, but not administer this repository.
72 | # * `admin` - can pull, push and administer this repository.
73 | # * `maintain` - Recommended for project managers who need to manage the repository without access to sensitive or destructive actions.
74 | # * `triage` - Recommended for contributors who need to proactively manage issues and pull requests without write access.
75 | # permission: push
76 | # See https://docs.github.com/en/rest/reference/teams#add-or-update-team-repository-permissions for available options
77 | teams:
78 | # - name: network
79 | # The permission to grant the team. Can be one of:
80 | # * `pull` - can pull, but not push to or administer this repository.
81 | # * `push` - can pull and push, but not administer this repository.
82 | # * `admin` - can pull, push and administer this repository.
83 | # * `maintain` - Recommended for project managers who need to manage the repository without access to sensitive or destructive actions.
84 | # * `triage` - Recommended for contributors who need to proactively manage issues and pull requests without write access.
85 | # permission: maintain
86 | branches:
87 | - name: main
88 | # https://docs.github.com/en/rest/reference/repos#update-branch-protection
89 | # Branch Protection settings. Set to null to disable
90 | protection:
91 | # Required. Require at least one approving review on a pull request, before merging. Set to null to disable.
92 | required_pull_request_reviews:
93 | # # The number of approvals required. (1-6)
94 | # required_approving_review_count: 1
95 | # # Dismiss approved reviews automatically when a new commit is pushed.
96 | # dismiss_stale_reviews: true
97 | # # Blocks merge until code owners have reviewed.
98 | # require_code_owner_reviews: true
99 | # # Specify which users and teams can dismiss pull request reviews. Pass an empty dismissal_restrictions object to disable. User and team dismissal_restrictions are only available for organization-owned repositories. Omit this parameter for personal repositories.
100 | # dismissal_restrictions:
101 | # users: []
102 | # teams: []
103 | # Required. Require status checks to pass before merging. Set to null to disable
104 | required_status_checks:
105 | # Required. Require branches to be up to date before merging.
106 | strict: true
107 | # Required. The list of status checks to require in order to merge into this branch
108 | contexts: []
109 | # Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
110 | enforce_admins: false
111 | # Required. Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable.
112 | restrictions:
113 | apps: []
114 | users: []
115 | teams: []
116 |
--------------------------------------------------------------------------------
/.github/workflows/flake-checker.yaml:
--------------------------------------------------------------------------------
1 | name: Check Nix Flake
2 | "on":
3 | pull_request:
4 | branches: ["main"]
5 | paths:
6 | - '**.nix'
7 | - .github/workflows/flake-checker.yaml
8 | - flake.lock
9 | push:
10 | branches: ["main"]
11 | paths:
12 | - '**.nix'
13 | - .github/workflows/flake-checker.yaml
14 | - flake.lock
15 |
16 | jobs:
17 | flake-checker:
18 | runs-on: ubuntu-latest
19 | steps:
20 | - uses: actions/checkout@v4
21 | - uses: DeterminateSystems/flake-checker-action@v9
22 |
--------------------------------------------------------------------------------
/.github/workflows/flake-lock-updater.yaml:
--------------------------------------------------------------------------------
1 | name: Flake ❄️ Lock 🔒️ Updater ✨
2 |
3 | "on":
4 | schedule:
5 | # Run on the third and eighteenth of the month.
6 | - cron: '0 0 3,18 * *'
7 | workflow_dispatch:
8 |
9 | jobs:
10 | flake-lock-updater:
11 | name: Flake Lock Updater
12 | runs-on: ubuntu-latest
13 | steps:
14 | - uses: actions/checkout@v4
15 | with:
16 | fetch-depth: 0
17 | - uses: DeterminateSystems/nix-installer-action@v16
18 | - uses: DeterminateSystems/magic-nix-cache-action@v9
19 | - uses: DeterminateSystems/update-flake-lock@v24
20 | with:
21 | pr-assignees: ${{ github.repository_owner }}
22 | pr-labels: |
23 | automated
24 | dependencies
25 | pr-title: "chore: update flake.lock"
26 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
27 |
--------------------------------------------------------------------------------
/.github/workflows/link-checker.yaml:
--------------------------------------------------------------------------------
1 | name: Check URLs with Lychee
2 |
3 | "on":
4 | pull_request:
5 | branches: [main]
6 | paths:
7 | - '**.adoc'
8 | - '**.nix'
9 | - .github/workflows/link-checker.yaml
10 | - flake.lock
11 | - lychee.toml
12 | push:
13 | branches: [main]
14 | paths:
15 | - '**.adoc'
16 | - '**.nix'
17 | - .github/workflows/link-checker.yaml
18 | - flake.lock
19 | - lychee.toml
20 | schedule:
21 | # Run once a month on the 14th.
22 | - cron: "0 0 14 * *"
23 | workflow_dispatch:
24 |
25 | jobs:
26 | link-checker:
27 | runs-on: ubuntu-latest
28 | steps:
29 | - uses: actions/checkout@v4
30 | - uses: DeterminateSystems/nix-installer-action@v16
31 | - uses: DeterminateSystems/magic-nix-cache-action@v9
32 | - name: Restore lychee cache
33 | id: cache-lychee-restore
34 | uses: actions/cache/restore@v4
35 | with:
36 | key: lychee-cache
37 | path: .lycheecache
38 | - name: Convert the Asciidoc files to html
39 | run: nix develop --command asciidoctor ./**/*.adoc
40 | - name: Run lychee on the generated site
41 | env:
42 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43 | run: nix develop --command lychee --cache --no-progress --verbose ./**/*.html
44 | - name: Save lychee cache
45 | uses: actions/cache/save@v4
46 | if: always()
47 | with:
48 | key: lychee-cache
49 | path: .lycheecache
50 |
--------------------------------------------------------------------------------
/.github/workflows/micropython.yaml:
--------------------------------------------------------------------------------
1 | name: MicroPython
2 |
3 | "on":
4 | pull_request:
5 | branches: ["main"]
6 | paths:
7 | - '**.nix'
8 | - .github/workflows/micropython.yaml
9 | - flake.lock
10 | push:
11 | branches: ["main"]
12 | paths:
13 | - '**.nix'
14 | - .github/workflows/micropython.yaml
15 | - flake.lock
16 | workflow_dispatch:
17 |
18 | jobs:
19 | micropython:
20 | runs-on: ubuntu-latest
21 | steps:
22 | - uses: actions/checkout@v4
23 | - uses: DeterminateSystems/nix-installer-action@v16
24 | - uses: DeterminateSystems/magic-nix-cache-action@v9
25 | - name: Build
26 | run: nix build .#micropython
27 | - name: Upload MicroPython
28 | uses: actions/upload-artifact@v4
29 | with:
30 | name: micropython
31 | path: |
32 | result/bin/RPI_PICO.uf2
33 |
--------------------------------------------------------------------------------
/.github/workflows/pyright.yaml:
--------------------------------------------------------------------------------
1 | name: Pyright
2 | "on":
3 | pull_request:
4 | branches: ["main"]
5 | paths:
6 | - '**.nix'
7 | - '**.py'
8 | - .github/workflows/pyright.yaml
9 | - flake.lock
10 | - pyproject.toml
11 | - requirements-dev.txt
12 | push:
13 | branches: ["main"]
14 | paths:
15 | - '**.nix'
16 | - '**.py'
17 | - .github/workflows/pyright.yaml
18 | - flake.lock
19 | - pyproject.toml
20 | - requirements-dev.txt
21 |
22 | jobs:
23 | pyright:
24 | runs-on: ubuntu-latest
25 | steps:
26 | - uses: actions/checkout@v4
27 | - uses: DeterminateSystems/nix-installer-action@v16
28 | - uses: DeterminateSystems/magic-nix-cache-action@v9
29 | - name: Cache Python virtual environment
30 | uses: actions/cache@v4
31 | with:
32 | key: venv-${{ runner.os }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('requirements-dev.txt') }}
33 | path: .venv
34 | - name: Check Python code with Pyright
35 | run: nix develop --command pyright --pythonpath .venv/bin/python --warnings
36 |
--------------------------------------------------------------------------------
/.github/workflows/treefmt.yaml:
--------------------------------------------------------------------------------
1 | name: Check files with treefmt
2 | "on":
3 | pull_request:
4 | branches: ["main"]
5 | paths:
6 | - '**.json'
7 | - '**.just'
8 | - '**.json'
9 | - '**.nix'
10 | - '**.py'
11 | - '**.toml'
12 | - '**.yaml'
13 | - '**.yml'
14 | - '**/.justfile'
15 | - '**/justfile'
16 | - .github/workflows/treefmt.yaml
17 | - flake.lock
18 | push:
19 | branches: ["main"]
20 | paths:
21 | - '**.json'
22 | - '**.just'
23 | - '**.json'
24 | - '**.nix'
25 | - '**.py'
26 | - '**.toml'
27 | - '**.yaml'
28 | - '**.yml'
29 | - '**/.justfile'
30 | - '**/justfile'
31 | - .github/workflows/treefmt.yaml
32 | - flake.lock
33 |
34 | jobs:
35 | treefmt:
36 | runs-on: ubuntu-latest
37 | steps:
38 | - uses: actions/checkout@v4
39 | - uses: DeterminateSystems/nix-installer-action@v16
40 | - uses: DeterminateSystems/magic-nix-cache-action@v9
41 | - name: Cache Python virtual environment
42 | uses: actions/cache@v4
43 | with:
44 | key: venv-${{ runner.os }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('requirements-dev.txt') }}
45 | path: .venv
46 | - name: Run treefmt
47 | run: nix develop --command treefmt --ci
48 | - uses: reviewdog/action-suggester@v1
49 | with:
50 | fail_on_error: true
51 | github_token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
52 | tool_name: treefmt
53 |
--------------------------------------------------------------------------------
/.github/workflows/update-nix-direnv.yaml:
--------------------------------------------------------------------------------
1 | name: Update nix-direnv
2 |
3 | "on":
4 | schedule:
5 | - cron: "0 0 16 * *"
6 | workflow_dispatch:
7 |
8 | permissions:
9 | contents: write
10 | pull-requests: write
11 |
12 | jobs:
13 | update-nix-direnv:
14 | runs-on: ubuntu-latest
15 | steps:
16 | - uses: actions/checkout@v4
17 | - uses: DeterminateSystems/nix-installer-action@v16
18 | - uses: DeterminateSystems/magic-nix-cache-action@v9
19 | - name: Update nix-direnv to the latest version
20 | run: nix run .#update-nix-direnv
21 | - name: Create Pull Request
22 | uses: peter-evans/create-pull-request@v7
23 | with:
24 | assignees: ${{ github.repository_owner }}
25 | branch: "update/nix-direnv"
26 | commit-message: "chore(deps): Update nix-direnv"
27 | title: "chore(deps): Update nix-direnv"
28 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
29 |
--------------------------------------------------------------------------------
/.github/workflows/update-nixos-release.yaml:
--------------------------------------------------------------------------------
1 | name: Update NixOS Release
2 |
3 | "on":
4 | schedule:
5 | - cron: "0 0 15 6,12 *"
6 | workflow_dispatch:
7 |
8 | permissions:
9 | contents: write
10 | pull-requests: write
11 |
12 | jobs:
13 | update-nixos-release:
14 | runs-on: ubuntu-latest
15 | steps:
16 | - uses: actions/checkout@v4
17 | - uses: DeterminateSystems/nix-installer-action@v16
18 | - uses: DeterminateSystems/magic-nix-cache-action@v9
19 | - name: Update the NixOS release in flake.nix to the latest
20 | run: |
21 | nix run .#update-nixos-release
22 | if [[ -n $(git status --porcelain=2) ]]; then
23 | nix flake update
24 | fi
25 | - name: Create Pull Request
26 | uses: peter-evans/create-pull-request@v7
27 | with:
28 | assignees: ${{ github.repository_owner }}
29 | branch: "update/nixos"
30 | commit-message: "chore(deps): Update NixOS release"
31 | title: "chore(deps): Update NixOS release"
32 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
33 |
--------------------------------------------------------------------------------
/.github/workflows/update-requirements.yaml:
--------------------------------------------------------------------------------
1 | name: Update Requirements
2 |
3 | "on":
4 | schedule:
5 | # Once a month on the 3rd
6 | - cron: "0 0 3 * *"
7 | workflow_dispatch:
8 |
9 | permissions:
10 | contents: write
11 | pull-requests: write
12 |
13 | jobs:
14 | update-requirements:
15 | runs-on: ubuntu-latest
16 | steps:
17 | - uses: actions/checkout@v4
18 | - uses: DeterminateSystems/nix-installer-action@v16
19 | - uses: DeterminateSystems/magic-nix-cache-action@v9
20 | - name: Cache Python virtual environment
21 | uses: actions/cache@v4
22 | with:
23 | key: venv-${{ runner.os }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('requirements-dev.txt') }}
24 | path: .venv
25 | - name: Update Python dependencies in requirements-dev.txt
26 | run: nix develop --command pip-compile requirements-dev.in
27 | - name: Create Pull Request
28 | uses: peter-evans/create-pull-request@v7
29 | with:
30 | assignees: ${{ github.repository_owner }}
31 | branch: "update/requirements"
32 | commit-message: "chore(deps): Update Python dependencies"
33 | title: "chore(deps): Update Python dependencies"
34 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
35 |
--------------------------------------------------------------------------------
/.github/workflows/yamllint.yaml:
--------------------------------------------------------------------------------
1 | name: yamllint
2 | "on":
3 | pull_request:
4 | branches: ["main"]
5 | paths:
6 | - '**.nix'
7 | - '**.yaml'
8 | - '**.yml'
9 | - .github/workflows/yamllint.yaml
10 | - .yamllint.yaml
11 | - flake.lock
12 | push:
13 | branches: ["main"]
14 | paths:
15 | - '**.nix'
16 | - '**.yaml'
17 | - '**.yml'
18 | - .github/workflows/yamllint.yaml
19 | - .yamllint.yaml
20 | - flake.lock
21 |
22 | jobs:
23 | yamllint:
24 | runs-on: ubuntu-latest
25 | steps:
26 | - uses: actions/checkout@v4
27 | - uses: DeterminateSystems/nix-installer-action@v16
28 | - uses: DeterminateSystems/magic-nix-cache-action@v9
29 | - name: Cache Python virtual environment
30 | uses: actions/cache@v4
31 | with:
32 | key: venv-${{ runner.os }}-${{ hashFiles('flake.lock') }}-${{ hashFiles('requirements-dev.txt') }}
33 | path: .venv
34 | - name: Check YAML files
35 | run: nix develop --command yamllint --format github .
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Asciidoctor
2 | *.html
3 |
4 | # Firmware
5 | *.elf
6 | *.uf2
7 |
8 | # direnv
9 | .direnv/
10 |
11 | # git-hooks.nix
12 | /.pre-commit-config.yaml
13 |
14 | # lychee
15 | .lycheecache
16 |
17 | # Nix
18 | result
19 |
20 | # Python
21 | __pycache__/
22 | .mypy_cache
23 | .pytest_cache/
24 | .ruff_cache/
25 | .venv/
26 | typings/
27 | venv/
28 |
--------------------------------------------------------------------------------
/.justfile:
--------------------------------------------------------------------------------
1 | default: install
2 |
3 | alias c := check
4 |
5 | check: && format
6 | yamllint .
7 | ruff check --fix .
8 | pyright --warnings
9 | asciidoctor **/*.adoc
10 | lychee --cache **/*.html
11 | nix flake check
12 |
13 | alias f := format
14 | alias fmt := format
15 |
16 | format:
17 | treefmt
18 |
19 | init-dev: && sync
20 | [ -d .venv ] || python -m venv .venv
21 | .venv/bin/python -m pip install pip-tools
22 | .venv/bin/python -m pip install --requirement requirements-dev.txt
23 |
24 | install device="":
25 | #!/usr/bin/env nu
26 | let serial_device = (
27 | if ( "{{ device }}" | is-empty) {(
28 | ^.venv/bin/mpremote devs |
29 | parse '{device} {serial_number} {vendor_id}:{product_id} {description}' |
30 | where description == "MicroPython Board in FS mode" |
31 | get device |
32 | first
33 | )} else {
34 | "{{ device }}"
35 | }
36 | )
37 | let port_option = (
38 | if not ($serial_device | is-empty) {
39 | $"port:($serial_device)"
40 | } else {
41 | ""
42 | }
43 | )
44 | ^.venv/bin/mpremote connect $port_option fs cp main.py :
45 |
46 | # todo Automate updating this.
47 | install-micropython file="RPI_PICO-20241025-v1.24.0.uf2":
48 | curl --location \
49 | --output-dir /run/media/$(id --name --user)/RPI-RP2 \
50 | --remote-name "https://micropython.org/resources/firmware/{{ file }}"
51 |
52 | # Mount the local repository on the device and execute commands.
53 |
54 | # By default, the main.py file is executed on the device.
55 | run command='exec "import main"' device="":
56 | #!/usr/bin/env nu
57 | let serial_device = (
58 | if ( "{{ device }}" | is-empty) {(
59 | ^.venv/bin/mpremote devs |
60 | parse '{device} {serial_number} {vendor_id}:{product_id} {description}' |
61 | where description == "MicroPython Board in FS mode" |
62 | get device |
63 | first
64 | )} else {
65 | "{{ device }}"
66 | }
67 | )
68 | let port_option = (
69 | if not ($serial_device | is-empty) {
70 | $"port:($serial_device)"
71 | } else {
72 | ""
73 | }
74 | )
75 | ^.venv/bin/mpremote connect $port_option mount . {{ command }}
76 |
77 | sync:
78 | source .venv/bin/activate && pip-sync --python-executable .venv/bin/python requirements-dev.txt
79 |
80 | alias u := update
81 | alias up := update
82 |
83 | update:
84 | nix run ".#update-nix-direnv"
85 | nix run ".#update-nixos-release"
86 | nix flake update
87 | source .venv/bin/activate && pip-compile requirements-dev.in
88 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "charliermarsh.ruff",
4 | "ms-python.vscode-pylance",
5 | "ms-python.python",
6 | "mkhl.direnv",
7 | "ibecker.treefmt-vscode",
8 | "asciidoctor.asciidoctor-vscode",
9 | "tamasfe.even-better-toml",
10 | "bbenoist.nix",
11 | "tekumara.typos-vscode",
12 | "nefrob.vscode-just-syntax",
13 | "thenuprojectcontributors.vscode-nushell-lang",
14 | "jnoortheen.nix-ide"
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "cSpell.words": [
3 | "Adafruit",
4 | "adoc",
5 | "AHCT",
6 | "Asciidoctor",
7 | "autofix",
8 | "bootloader",
9 | "bootsel",
10 | "busio",
11 | "cclauss",
12 | "CIRCUITPY",
13 | "circuitpython",
14 | "Datasheet",
15 | "deadnix",
16 | "dialout",
17 | "digitalio",
18 | "direnv",
19 | "EEPROM",
20 | "FRAM",
21 | "framebuf",
22 | "GPIO",
23 | "gsub",
24 | "ibiqlik",
25 | "ifdef",
26 | "ifndef",
27 | "justfile",
28 | "lightsleep",
29 | "microcontroller",
30 | "microcontrollers",
31 | "micropython",
32 | "MOSI",
33 | "mpremote",
34 | "mypy",
35 | "nixos",
36 | "nixpkgs",
37 | "Noctua",
38 | "Optimziations",
39 | "ostree",
40 | "Pico",
41 | "Pinout",
42 | "pkgs",
43 | "pyboard",
44 | "pylint",
45 | "pyright",
46 | "pyserial",
47 | "qtpy",
48 | "Qwiic",
49 | "repos",
50 | "sramcs",
51 | "srcs",
52 | "treefmt",
53 | "udisksctl",
54 | "unmount",
55 | "usermod",
56 | "VBUS",
57 | "venv",
58 | "xhci"
59 | ],
60 | "files.watcherExclude": {
61 | "**/.direnv/**": true,
62 | ".lycheecache": true,
63 | ".pre-commit-config.yaml": true,
64 | "**/result": true,
65 | "**/result/**": true,
66 | "**/target/**": true
67 | },
68 | "nix.enableLanguageServer": true,
69 | "nix.serverPath": "nil"
70 | }
71 |
--------------------------------------------------------------------------------
/.yamlfmt.yaml:
--------------------------------------------------------------------------------
1 | formatter:
2 | type: basic
3 | retain_line_breaks_single: true
4 |
--------------------------------------------------------------------------------
/.yamllint.yaml:
--------------------------------------------------------------------------------
1 | extends: default
2 |
3 | rules:
4 | document-start: disable
5 | line-length: disable
6 | comments:
7 | min-spaces-from-content: 1
8 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.adoc:
--------------------------------------------------------------------------------
1 | = Contributor Covenant Code of Conduct
2 |
3 | == Our Pledge
4 |
5 | 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, religion, or sexual identity and orientation.
6 |
7 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8 |
9 | == Our Standards
10 |
11 | Examples of behavior that contributes to a positive environment for our community include:
12 |
13 | * Demonstrating empathy and kindness toward other people
14 | * Being respectful of differing opinions, viewpoints, and experiences
15 | * Giving and gracefully accepting constructive feedback
16 | * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17 | * Focusing on what is best not just for us as individuals, but for the overall community
18 |
19 | Examples of unacceptable behavior include:
20 |
21 | * The use of sexualized language or imagery, and sexual attention or advances of any kind
22 | * Trolling, insulting or derogatory comments, and personal or political attacks
23 | * Public or private harassment
24 | * Publishing others' private information, such as a physical or email address, without their explicit permission
25 | * Other conduct which could reasonably be considered inappropriate in a professional setting
26 |
27 | == Enforcement Responsibilities
28 |
29 | 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.
30 |
31 | 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.
32 |
33 | == Scope
34 |
35 | This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces.
36 | Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
37 |
38 | == Enforcement
39 |
40 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at jordan@jwillikers.com.
41 | All complaints will be reviewed and investigated promptly and fairly.
42 |
43 | All community leaders are obligated to respect the privacy and security of the reporter of any incident.
44 |
45 | == Enforcement Guidelines
46 |
47 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
48 |
49 | === 1. Correction
50 |
51 | *Community Impact*: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
52 |
53 | *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.
54 |
55 | === 2. Warning
56 |
57 | *Community Impact*: A violation through a single incident or series of actions.
58 |
59 | *Consequence*: A warning with consequences for continued behavior.
60 | No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time.
61 | 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.
62 |
63 | === 3. Temporary Ban
64 |
65 | *Community Impact*: A serious violation of community standards, including sustained inappropriate behavior.
66 |
67 | *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.
68 | Violating these terms may lead to a permanent ban.
69 |
70 | === 4. Permanent Ban
71 |
72 | *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.
73 |
74 | *Consequence*: A permanent ban from any sort of public interaction within the community.
75 |
76 | == Attribution
77 |
78 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
79 |
80 | Community Impact Guidelines were inspired by https://github.com/mozilla/diversity[Mozilla's code of conduct enforcement ladder].
81 |
82 | [homepage]: https://www.contributor-covenant.org
83 |
84 | For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq.
85 | Translations are available at https://www.contributor-covenant.org/translations.
86 |
--------------------------------------------------------------------------------
/LICENSE.adoc:
--------------------------------------------------------------------------------
1 | = GNU General Public License
2 |
3 | _Version 3, 29 June 2007_
4 | _Copyright © 2007 Free Software Foundation, Inc. _
5 |
6 | Everyone is permitted to copy and distribute verbatim copies of this license
7 | document, but changing it is not allowed.
8 |
9 | == Preamble
10 |
11 | The GNU General Public License is a free, copyleft license for software and other
12 | kinds of works.
13 |
14 | The licenses for most software and other practical works are designed to take away
15 | your freedom to share and change the works. By contrast, the GNU General Public
16 | License is intended to guarantee your freedom to share and change all versions of a
17 | program--to make sure it remains free software for all its users. We, the Free
18 | Software Foundation, use the GNU General Public License for most of our software; it
19 | applies also to any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not price. Our General
23 | Public Licenses are designed to make sure that you have the freedom to distribute
24 | copies of free software (and charge for them if you wish), that you receive source
25 | code or can get it if you want it, that you can change the software or use pieces of
26 | it in new free programs, and that you know you can do these things.
27 |
28 | To protect your rights, we need to prevent others from denying you these rights or
29 | asking you to surrender the rights. Therefore, you have certain responsibilities if
30 | you distribute copies of the software, or if you modify it: responsibilities to
31 | respect the freedom of others.
32 |
33 | For example, if you distribute copies of such a program, whether gratis or for a fee,
34 | you must pass on to the recipients the same freedoms that you received. You must make
35 | sure that they, too, receive or can get the source code. And you must show them these
36 | terms so they know their rights.
37 |
38 | Developers that use the GNU GPL protect your rights with two steps: __(1)__ assert
39 | copyright on the software, and __(2)__ offer you this License giving you legal permission
40 | to copy, distribute and/or modify it.
41 |
42 | For the developers' and authors' protection, the GPL clearly explains that there is
43 | no warranty for this free software. For both users' and authors' sake, the GPL
44 | requires that modified versions be marked as changed, so that their problems will not
45 | be attributed erroneously to authors of previous versions.
46 |
47 | Some devices are designed to deny users access to install or run modified versions of
48 | the software inside them, although the manufacturer can do so. This is fundamentally
49 | incompatible with the aim of protecting users' freedom to change the software. The
50 | systematic pattern of such abuse occurs in the area of products for individuals to
51 | use, which is precisely where it is most unacceptable. Therefore, we have designed
52 | this version of the GPL to prohibit the practice for those products. If such problems
53 | arise substantially in other domains, we stand ready to extend this provision to
54 | those domains in future versions of the GPL, as needed to protect the freedom of
55 | users.
56 |
57 | Finally, every program is threatened constantly by software patents. States should
58 | not allow patents to restrict development and use of software on general-purpose
59 | computers, but in those that do, we wish to avoid the special danger that patents
60 | applied to a free program could make it effectively proprietary. To prevent this, the
61 | GPL assures that patents cannot be used to render the program non-free.
62 |
63 | The precise terms and conditions for copying, distribution and modification follow.
64 |
65 | == TERMS AND CONDITIONS
66 |
67 | === 0. Definitions
68 |
69 | “This License” refers to version 3 of the GNU General Public License.
70 |
71 | “Copyright” also means copyright-like laws that apply to other kinds of
72 | works, such as semiconductor masks.
73 |
74 | “The Program” refers to any copyrightable work licensed under this
75 | License. Each licensee is addressed as “you”. “Licensees” and
76 | “recipients” may be individuals or organizations.
77 |
78 | To “modify” a work means to copy from or adapt all or part of the work in
79 | a fashion requiring copyright permission, other than the making of an exact copy. The
80 | resulting work is called a “modified version” of the earlier work or a
81 | work “based on” the earlier work.
82 |
83 | A “covered work” means either the unmodified Program or a work based on
84 | the Program.
85 |
86 | To “propagate” a work means to do anything with it that, without
87 | permission, would make you directly or secondarily liable for infringement under
88 | applicable copyright law, except executing it on a computer or modifying a private
89 | copy. Propagation includes copying, distribution (with or without modification),
90 | making available to the public, and in some countries other activities as well.
91 |
92 | To “convey” a work means any kind of propagation that enables other
93 | parties to make or receive copies. Mere interaction with a user through a computer
94 | network, with no transfer of a copy, is not conveying.
95 |
96 | An interactive user interface displays “Appropriate Legal Notices” to the
97 | extent that it includes a convenient and prominently visible feature that __(1)__
98 | displays an appropriate copyright notice, and __(2)__ tells the user that there is no
99 | warranty for the work (except to the extent that warranties are provided), that
100 | licensees may convey the work under this License, and how to view a copy of this
101 | License. If the interface presents a list of user commands or options, such as a
102 | menu, a prominent item in the list meets this criterion.
103 |
104 | === 1. Source Code
105 |
106 | The “source code” for a work means the preferred form of the work for
107 | making modifications to it. “Object code” means any non-source form of a
108 | work.
109 |
110 | A “Standard Interface” means an interface that either is an official
111 | standard defined by a recognized standards body, or, in the case of interfaces
112 | specified for a particular programming language, one that is widely used among
113 | developers working in that language.
114 |
115 | The “System Libraries” of an executable work include anything, other than
116 | the work as a whole, that __(a)__ is included in the normal form of packaging a Major
117 | Component, but which is not part of that Major Component, and __(b)__ serves only to
118 | enable use of the work with that Major Component, or to implement a Standard
119 | Interface for which an implementation is available to the public in source code form.
120 | A “Major Component”, in this context, means a major essential component
121 | (kernel, window system, and so on) of the specific operating system (if any) on which
122 | the executable work runs, or a compiler used to produce the work, or an object code
123 | interpreter used to run it.
124 |
125 | The “Corresponding Source” for a work in object code form means all the
126 | source code needed to generate, install, and (for an executable work) run the object
127 | code and to modify the work, including scripts to control those activities. However,
128 | it does not include the work's System Libraries, or general-purpose tools or
129 | generally available free programs which are used unmodified in performing those
130 | activities but which are not part of the work. For example, Corresponding Source
131 | includes interface definition files associated with source files for the work, and
132 | the source code for shared libraries and dynamically linked subprograms that the work
133 | is specifically designed to require, such as by intimate data communication or
134 | control flow between those subprograms and other parts of the work.
135 |
136 | The Corresponding Source need not include anything that users can regenerate
137 | automatically from other parts of the Corresponding Source.
138 |
139 | The Corresponding Source for a work in source code form is that same work.
140 |
141 | === 2. Basic Permissions
142 |
143 | All rights granted under this License are granted for the term of copyright on the
144 | Program, and are irrevocable provided the stated conditions are met. This License
145 | explicitly affirms your unlimited permission to run the unmodified Program. The
146 | output from running a covered work is covered by this License only if the output,
147 | given its content, constitutes a covered work. This License acknowledges your rights
148 | of fair use or other equivalent, as provided by copyright law.
149 |
150 | You may make, run and propagate covered works that you do not convey, without
151 | conditions so long as your license otherwise remains in force. You may convey covered
152 | works to others for the sole purpose of having them make modifications exclusively
153 | for you, or provide you with facilities for running those works, provided that you
154 | comply with the terms of this License in conveying all material for which you do not
155 | control copyright. Those thus making or running the covered works for you must do so
156 | exclusively on your behalf, under your direction and control, on terms that prohibit
157 | them from making any copies of your copyrighted material outside their relationship
158 | with you.
159 |
160 | Conveying under any other circumstances is permitted solely under the conditions
161 | stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
162 |
163 | === 3. Protecting Users' Legal Rights From Anti-Circumvention Law
164 |
165 | No covered work shall be deemed part of an effective technological measure under any
166 | applicable law fulfilling obligations under article 11 of the WIPO copyright treaty
167 | adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention
168 | of such measures.
169 |
170 | When you convey a covered work, you waive any legal power to forbid circumvention of
171 | technological measures to the extent such circumvention is effected by exercising
172 | rights under this License with respect to the covered work, and you disclaim any
173 | intention to limit operation or modification of the work as a means of enforcing,
174 | against the work's users, your or third parties' legal rights to forbid circumvention
175 | of technological measures.
176 |
177 | === 4. Conveying Verbatim Copies
178 |
179 | You may convey verbatim copies of the Program's source code as you receive it, in any
180 | medium, provided that you conspicuously and appropriately publish on each copy an
181 | appropriate copyright notice; keep intact all notices stating that this License and
182 | any non-permissive terms added in accord with section 7 apply to the code; keep
183 | intact all notices of the absence of any warranty; and give all recipients a copy of
184 | this License along with the Program.
185 |
186 | You may charge any price or no price for each copy that you convey, and you may offer
187 | support or warranty protection for a fee.
188 |
189 | === 5. Conveying Modified Source Versions
190 |
191 | You may convey a work based on the Program, or the modifications to produce it from
192 | the Program, in the form of source code under the terms of section 4, provided that
193 | you also meet all of these conditions:
194 |
195 | * __a)__ The work must carry prominent notices stating that you modified it, and giving a
196 | relevant date.
197 | * __b)__ The work must carry prominent notices stating that it is released under this
198 | License and any conditions added under section 7. This requirement modifies the
199 | requirement in section 4 to “keep intact all notices”.
200 | * __c)__ You must license the entire work, as a whole, under this License to anyone who
201 | comes into possession of a copy. This License will therefore apply, along with any
202 | applicable section 7 additional terms, to the whole of the work, and all its parts,
203 | regardless of how they are packaged. This License gives no permission to license the
204 | work in any other way, but it does not invalidate such permission if you have
205 | separately received it.
206 | * __d)__ If the work has interactive user interfaces, each must display Appropriate Legal
207 | Notices; however, if the Program has interactive interfaces that do not display
208 | Appropriate Legal Notices, your work need not make them do so.
209 |
210 | A compilation of a covered work with other separate and independent works, which are
211 | not by their nature extensions of the covered work, and which are not combined with
212 | it such as to form a larger program, in or on a volume of a storage or distribution
213 | medium, is called an “aggregate” if the compilation and its resulting
214 | copyright are not used to limit the access or legal rights of the compilation's users
215 | beyond what the individual works permit. Inclusion of a covered work in an aggregate
216 | does not cause this License to apply to the other parts of the aggregate.
217 |
218 | === 6. Conveying Non-Source Forms
219 |
220 | You may convey a covered work in object code form under the terms of sections 4 and
221 | 5, provided that you also convey the machine-readable Corresponding Source under the
222 | terms of this License, in one of these ways:
223 |
224 | * __a)__ Convey the object code in, or embodied in, a physical product (including a
225 | physical distribution medium), accompanied by the Corresponding Source fixed on a
226 | durable physical medium customarily used for software interchange.
227 | * __b)__ Convey the object code in, or embodied in, a physical product (including a
228 | physical distribution medium), accompanied by a written offer, valid for at least
229 | three years and valid for as long as you offer spare parts or customer support for
230 | that product model, to give anyone who possesses the object code either __(1)__ a copy of
231 | the Corresponding Source for all the software in the product that is covered by this
232 | License, on a durable physical medium customarily used for software interchange, for
233 | a price no more than your reasonable cost of physically performing this conveying of
234 | source, or __(2)__ access to copy the Corresponding Source from a network server at no
235 | charge.
236 | * __c)__ Convey individual copies of the object code with a copy of the written offer to
237 | provide the Corresponding Source. This alternative is allowed only occasionally and
238 | noncommercially, and only if you received the object code with such an offer, in
239 | accord with subsection 6b.
240 | * __d)__ Convey the object code by offering access from a designated place (gratis or for
241 | a charge), and offer equivalent access to the Corresponding Source in the same way
242 | through the same place at no further charge. You need not require recipients to copy
243 | the Corresponding Source along with the object code. If the place to copy the object
244 | code is a network server, the Corresponding Source may be on a different server
245 | (operated by you or a third party) that supports equivalent copying facilities,
246 | provided you maintain clear directions next to the object code saying where to find
247 | the Corresponding Source. Regardless of what server hosts the Corresponding Source,
248 | you remain obligated to ensure that it is available for as long as needed to satisfy
249 | these requirements.
250 | * __e)__ Convey the object code using peer-to-peer transmission, provided you inform
251 | other peers where the object code and Corresponding Source of the work are being
252 | offered to the general public at no charge under subsection 6d.
253 |
254 | A separable portion of the object code, whose source code is excluded from the
255 | Corresponding Source as a System Library, need not be included in conveying the
256 | object code work.
257 |
258 | A “User Product” is either __(1)__ a “consumer product”, which
259 | means any tangible personal property which is normally used for personal, family, or
260 | household purposes, or __(2)__ anything designed or sold for incorporation into a
261 | dwelling. In determining whether a product is a consumer product, doubtful cases
262 | shall be resolved in favor of coverage. For a particular product received by a
263 | particular user, “normally used” refers to a typical or common use of
264 | that class of product, regardless of the status of the particular user or of the way
265 | in which the particular user actually uses, or expects or is expected to use, the
266 | product. A product is a consumer product regardless of whether the product has
267 | substantial commercial, industrial or non-consumer uses, unless such uses represent
268 | the only significant mode of use of the product.
269 |
270 | “Installation Information” for a User Product means any methods,
271 | procedures, authorization keys, or other information required to install and execute
272 | modified versions of a covered work in that User Product from a modified version of
273 | its Corresponding Source. The information must suffice to ensure that the continued
274 | functioning of the modified object code is in no case prevented or interfered with
275 | solely because modification has been made.
276 |
277 | If you convey an object code work under this section in, or with, or specifically for
278 | use in, a User Product, and the conveying occurs as part of a transaction in which
279 | the right of possession and use of the User Product is transferred to the recipient
280 | in perpetuity or for a fixed term (regardless of how the transaction is
281 | characterized), the Corresponding Source conveyed under this section must be
282 | accompanied by the Installation Information. But this requirement does not apply if
283 | neither you nor any third party retains the ability to install modified object code
284 | on the User Product (for example, the work has been installed in ROM).
285 |
286 | The requirement to provide Installation Information does not include a requirement to
287 | continue to provide support service, warranty, or updates for a work that has been
288 | modified or installed by the recipient, or for the User Product in which it has been
289 | modified or installed. Access to a network may be denied when the modification itself
290 | materially and adversely affects the operation of the network or violates the rules
291 | and protocols for communication across the network.
292 |
293 | Corresponding Source conveyed, and Installation Information provided, in accord with
294 | this section must be in a format that is publicly documented (and with an
295 | implementation available to the public in source code form), and must require no
296 | special password or key for unpacking, reading or copying.
297 |
298 | === 7. Additional Terms
299 |
300 | “Additional permissions” are terms that supplement the terms of this
301 | License by making exceptions from one or more of its conditions. Additional
302 | permissions that are applicable to the entire Program shall be treated as though they
303 | were included in this License, to the extent that they are valid under applicable
304 | law. If additional permissions apply only to part of the Program, that part may be
305 | used separately under those permissions, but the entire Program remains governed by
306 | this License without regard to the additional permissions.
307 |
308 | When you convey a copy of a covered work, you may at your option remove any
309 | additional permissions from that copy, or from any part of it. (Additional
310 | permissions may be written to require their own removal in certain cases when you
311 | modify the work.) You may place additional permissions on material, added by you to a
312 | covered work, for which you have or can give appropriate copyright permission.
313 |
314 | Notwithstanding any other provision of this License, for material you add to a
315 | covered work, you may (if authorized by the copyright holders of that material)
316 | supplement the terms of this License with terms:
317 |
318 | * __a)__ Disclaiming warranty or limiting liability differently from the terms of
319 | sections 15 and 16 of this License; or
320 | * __b)__ Requiring preservation of specified reasonable legal notices or author
321 | attributions in that material or in the Appropriate Legal Notices displayed by works
322 | containing it; or
323 | * __c)__ Prohibiting misrepresentation of the origin of that material, or requiring that
324 | modified versions of such material be marked in reasonable ways as different from the
325 | original version; or
326 | * __d)__ Limiting the use for publicity purposes of names of licensors or authors of the
327 | material; or
328 | * __e)__ Declining to grant rights under trademark law for use of some trade names,
329 | trademarks, or service marks; or
330 | * __f)__ Requiring indemnification of licensors and authors of that material by anyone
331 | who conveys the material (or modified versions of it) with contractual assumptions of
332 | liability to the recipient, for any liability that these contractual assumptions
333 | directly impose on those licensors and authors.
334 |
335 | All other non-permissive additional terms are considered “further
336 | restrictions” within the meaning of section 10. If the Program as you received
337 | it, or any part of it, contains a notice stating that it is governed by this License
338 | along with a term that is a further restriction, you may remove that term. If a
339 | license document contains a further restriction but permits relicensing or conveying
340 | under this License, you may add to a covered work material governed by the terms of
341 | that license document, provided that the further restriction does not survive such
342 | relicensing or conveying.
343 |
344 | If you add terms to a covered work in accord with this section, you must place, in
345 | the relevant source files, a statement of the additional terms that apply to those
346 | files, or a notice indicating where to find the applicable terms.
347 |
348 | Additional terms, permissive or non-permissive, may be stated in the form of a
349 | separately written license, or stated as exceptions; the above requirements apply
350 | either way.
351 |
352 | === 8. Termination
353 |
354 | You may not propagate or modify a covered work except as expressly provided under
355 | this License. Any attempt otherwise to propagate or modify it is void, and will
356 | automatically terminate your rights under this License (including any patent licenses
357 | granted under the third paragraph of section 11).
358 |
359 | However, if you cease all violation of this License, then your license from a
360 | particular copyright holder is reinstated __(a)__ provisionally, unless and until the
361 | copyright holder explicitly and finally terminates your license, and __(b)__ permanently,
362 | if the copyright holder fails to notify you of the violation by some reasonable means
363 | prior to 60 days after the cessation.
364 |
365 | Moreover, your license from a particular copyright holder is reinstated permanently
366 | if the copyright holder notifies you of the violation by some reasonable means, this
367 | is the first time you have received notice of violation of this License (for any
368 | work) from that copyright holder, and you cure the violation prior to 30 days after
369 | your receipt of the notice.
370 |
371 | Termination of your rights under this section does not terminate the licenses of
372 | parties who have received copies or rights from you under this License. If your
373 | rights have been terminated and not permanently reinstated, you do not qualify to
374 | receive new licenses for the same material under section 10.
375 |
376 | === 9. Acceptance Not Required for Having Copies
377 |
378 | You are not required to accept this License in order to receive or run a copy of the
379 | Program. Ancillary propagation of a covered work occurring solely as a consequence of
380 | using peer-to-peer transmission to receive a copy likewise does not require
381 | acceptance. However, nothing other than this License grants you permission to
382 | propagate or modify any covered work. These actions infringe copyright if you do not
383 | accept this License. Therefore, by modifying or propagating a covered work, you
384 | indicate your acceptance of this License to do so.
385 |
386 | === 10. Automatic Licensing of Downstream Recipients
387 |
388 | Each time you convey a covered work, the recipient automatically receives a license
389 | from the original licensors, to run, modify and propagate that work, subject to this
390 | License. You are not responsible for enforcing compliance by third parties with this
391 | License.
392 |
393 | An “entity transaction” is a transaction transferring control of an
394 | organization, or substantially all assets of one, or subdividing an organization, or
395 | merging organizations. If propagation of a covered work results from an entity
396 | transaction, each party to that transaction who receives a copy of the work also
397 | receives whatever licenses to the work the party's predecessor in interest had or
398 | could give under the previous paragraph, plus a right to possession of the
399 | Corresponding Source of the work from the predecessor in interest, if the predecessor
400 | has it or can get it with reasonable efforts.
401 |
402 | You may not impose any further restrictions on the exercise of the rights granted or
403 | affirmed under this License. For example, you may not impose a license fee, royalty,
404 | or other charge for exercise of rights granted under this License, and you may not
405 | initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging
406 | that any patent claim is infringed by making, using, selling, offering for sale, or
407 | importing the Program or any portion of it.
408 |
409 | === 11. Patents
410 |
411 | A “contributor” is a copyright holder who authorizes use under this
412 | License of the Program or a work on which the Program is based. The work thus
413 | licensed is called the contributor's “contributor version”.
414 |
415 | A contributor's “essential patent claims” are all patent claims owned or
416 | controlled by the contributor, whether already acquired or hereafter acquired, that
417 | would be infringed by some manner, permitted by this License, of making, using, or
418 | selling its contributor version, but do not include claims that would be infringed
419 | only as a consequence of further modification of the contributor version. For
420 | purposes of this definition, “control” includes the right to grant patent
421 | sublicenses in a manner consistent with the requirements of this License.
422 |
423 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent license
424 | under the contributor's essential patent claims, to make, use, sell, offer for sale,
425 | import and otherwise run, modify and propagate the contents of its contributor
426 | version.
427 |
428 | In the following three paragraphs, a “patent license” is any express
429 | agreement or commitment, however denominated, not to enforce a patent (such as an
430 | express permission to practice a patent or covenant not to sue for patent
431 | infringement). To “grant” such a patent license to a party means to make
432 | such an agreement or commitment not to enforce a patent against the party.
433 |
434 | If you convey a covered work, knowingly relying on a patent license, and the
435 | Corresponding Source of the work is not available for anyone to copy, free of charge
436 | and under the terms of this License, through a publicly available network server or
437 | other readily accessible means, then you must either __(1)__ cause the Corresponding
438 | Source to be so available, or __(2)__ arrange to deprive yourself of the benefit of the
439 | patent license for this particular work, or __(3)__ arrange, in a manner consistent with
440 | the requirements of this License, to extend the patent license to downstream
441 | recipients. “Knowingly relying” means you have actual knowledge that, but
442 | for the patent license, your conveying the covered work in a country, or your
443 | recipient's use of the covered work in a country, would infringe one or more
444 | identifiable patents in that country that you have reason to believe are valid.
445 |
446 | If, pursuant to or in connection with a single transaction or arrangement, you
447 | convey, or propagate by procuring conveyance of, a covered work, and grant a patent
448 | license to some of the parties receiving the covered work authorizing them to use,
449 | propagate, modify or convey a specific copy of the covered work, then the patent
450 | license you grant is automatically extended to all recipients of the covered work and
451 | works based on it.
452 |
453 | A patent license is “discriminatory” if it does not include within the
454 | scope of its coverage, prohibits the exercise of, or is conditioned on the
455 | non-exercise of one or more of the rights that are specifically granted under this
456 | License. You may not convey a covered work if you are a party to an arrangement with
457 | a third party that is in the business of distributing software, under which you make
458 | payment to the third party based on the extent of your activity of conveying the
459 | work, and under which the third party grants, to any of the parties who would receive
460 | the covered work from you, a discriminatory patent license __(a)__ in connection with
461 | copies of the covered work conveyed by you (or copies made from those copies), or __(b)__
462 | primarily for and in connection with specific products or compilations that contain
463 | the covered work, unless you entered into that arrangement, or that patent license
464 | was granted, prior to 28 March 2007.
465 |
466 | Nothing in this License shall be construed as excluding or limiting any implied
467 | license or other defenses to infringement that may otherwise be available to you
468 | under applicable patent law.
469 |
470 | === 12. No Surrender of Others' Freedom
471 |
472 | If conditions are imposed on you (whether by court order, agreement or otherwise)
473 | that contradict the conditions of this License, they do not excuse you from the
474 | conditions of this License. If you cannot convey a covered work so as to satisfy
475 | simultaneously your obligations under this License and any other pertinent
476 | obligations, then as a consequence you may not convey it at all. For example, if you
477 | agree to terms that obligate you to collect a royalty for further conveying from
478 | those to whom you convey the Program, the only way you could satisfy both those terms
479 | and this License would be to refrain entirely from conveying the Program.
480 |
481 | === 13. Use with the GNU Affero General Public License
482 |
483 | Notwithstanding any other provision of this License, you have permission to link or
484 | combine any covered work with a work licensed under version 3 of the GNU Affero
485 | General Public License into a single combined work, and to convey the resulting work.
486 | The terms of this License will continue to apply to the part which is the covered
487 | work, but the special requirements of the GNU Affero General Public License, section
488 | 13, concerning interaction through a network will apply to the combination as such.
489 |
490 | === 14. Revised Versions of this License
491 |
492 | The Free Software Foundation may publish revised and/or new versions of the GNU
493 | General Public License from time to time. Such new versions will be similar in spirit
494 | to the present version, but may differ in detail to address new problems or concerns.
495 |
496 | Each version is given a distinguishing version number. If the Program specifies that
497 | a certain numbered version of the GNU General Public License “or any later
498 | version” applies to it, you have the option of following the terms and
499 | conditions either of that numbered version or of any later version published by the
500 | Free Software Foundation. If the Program does not specify a version number of the GNU
501 | General Public License, you may choose any version ever published by the Free
502 | Software Foundation.
503 |
504 | If the Program specifies that a proxy can decide which future versions of the GNU
505 | General Public License can be used, that proxy's public statement of acceptance of a
506 | version permanently authorizes you to choose that version for the Program.
507 |
508 | Later license versions may give you additional or different permissions. However, no
509 | additional obligations are imposed on any author or copyright holder as a result of
510 | your choosing to follow a later version.
511 |
512 | === 15. Disclaimer of Warranty
513 |
514 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
515 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
516 | PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
517 | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
518 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE
519 | QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
520 | DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
521 |
522 | === 16. Limitation of Liability
523 |
524 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
525 | COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS
526 | PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
527 | INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
528 | PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE
529 | OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE
530 | WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
531 | POSSIBILITY OF SUCH DAMAGES.
532 |
533 | === 17. Interpretation of Sections 15 and 16
534 |
535 | If the disclaimer of warranty and limitation of liability provided above cannot be
536 | given local legal effect according to their terms, reviewing courts shall apply local
537 | law that most closely approximates an absolute waiver of all civil liability in
538 | connection with the Program, unless a warranty or assumption of liability accompanies
539 | a copy of the Program in return for a fee.
540 |
541 | _END OF TERMS AND CONDITIONS_
542 |
543 | == How to Apply These Terms to Your New Programs
544 |
545 | If you develop a new program, and you want it to be of the greatest possible use to
546 | the public, the best way to achieve this is to make it free software which everyone
547 | can redistribute and change under these terms.
548 |
549 | To do so, attach the following notices to the program. It is safest to attach them
550 | to the start of each source file to most effectively state the exclusion of warranty;
551 | and each file should have at least the “copyright” line and a pointer to
552 | where the full notice is found.
553 |
554 |
555 | Copyright (C)
556 |
557 | This program is free software: you can redistribute it and/or modify
558 | it under the terms of the GNU General Public License as published by
559 | the Free Software Foundation, either version 3 of the License, or
560 | (at your option) any later version.
561 |
562 | This program is distributed in the hope that it will be useful,
563 | but WITHOUT ANY WARRANTY; without even the implied warranty of
564 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
565 | GNU General Public License for more details.
566 |
567 | You should have received a copy of the GNU General Public License
568 | along with this program. If not, see .
569 |
570 | Also add information on how to contact you by electronic and paper mail.
571 |
572 | If the program does terminal interaction, make it output a short notice like this
573 | when it starts in an interactive mode:
574 |
575 | Copyright (C)
576 | This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
577 | This is free software, and you are welcome to redistribute it
578 | under certain conditions; type 'show c' for details.
579 |
580 | The hypothetical commands `show w` and `show c` should show the appropriate parts of
581 | the General Public License. Of course, your program's commands might be different;
582 | for a GUI interface, you would use an “about box”.
583 |
584 | You should also get your employer (if you work as a programmer) or school, if any, to
585 | sign a “copyright disclaimer” for the program, if necessary. For more
586 | information on this, and how to apply and follow the GNU GPL, see
587 | .
588 |
589 | The GNU General Public License does not permit incorporating your program into
590 | proprietary programs. If your program is a subroutine library, you may consider it
591 | more useful to permit linking proprietary applications with the library. If this is
592 | what you want to do, use the GNU Lesser General Public License instead of this
593 | License. But first, please read
594 | .
595 |
--------------------------------------------------------------------------------
/README.adoc:
--------------------------------------------------------------------------------
1 | = PWM Fan Controller MicroPython
2 | Jordan Williams
3 | :experimental:
4 | :icons: font
5 | ifdef::env-github[]
6 | :tip-caption: :bulb:
7 | :note-caption: :information_source:
8 | :important-caption: :heavy_exclamation_mark:
9 | :caution-caption: :fire:
10 | :warning-caption: :warning:
11 | endif::[]
12 | :Asciidoctor_: https://asciidoctor.org/[Asciidoctor]
13 | :just: https://github.com/casey/just[just]
14 | :Linux: https://www.linuxfoundation.org/[Linux]
15 | :MicroPython: https://micropython.org/[MicroPython]
16 | :nix: https://nixos.org/[Nix]
17 | :nix-direnv: https://github.com/nix-community/nix-direnv[nix-direnv]
18 | :Noctua-NF-P12-redux-1700-PWM-Fan: https://noctua.at/en/nf-p12-redux-1700-pwm[Noctua NF-P12 redux-1700 PWM Fan]
19 | :pip-tools: https://github.com/jazzband/pip-tools[pip-tools]
20 | :pre-commit: https://github.com/nix-community/nixpkgs-update[pre-commit]
21 | :Python: https://www.python.org/[Python]
22 | :Raspberry-Pi-Pico: https://www.raspberrypi.com/products/raspberry-pi-pico/[Raspberry Pi Pico]
23 |
24 | image:https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json[Ruff, link=https://github.com/astral-sh/ruff]
25 |
26 | A simple PWM fan controller for the {Raspberry-Pi-Pico}, written in {MicroPython}.
27 |
28 | ifdef::env-github[]
29 | ++++
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | ++++
46 | endif::[]
47 |
48 | ifndef::env-github[]
49 | image::pics/pico-pwm-fan-controller-breadboard-top-1.jpg[Raspberry PI Pico PWM Fan Controller Breadboard Top View 1, align=center]
50 | image::pics/pico-pwm-fan-controller-breadboard-top-2.jpg[Raspberry PI Pico PWM Fan Controller Breadboard Tope View 2, align=center]
51 | image::pics/pico-pwm-fan-controller-breadboard-side-1.jpg[Raspberry PI Pico PWM Fan Controller Breadboard Side View 1, align=center]
52 | image::pics/pico-pwm-fan-controller-breadboard-side-2.jpg[Raspberry PI Pico PWM Fan Controller Breadboard Side View 2, align=center]
53 | image::pics/pico-pwm-fan-controller-breadboard-side-3.jpg[Raspberry PI Pico PWM Fan Controller Breadboard Side View 3, align=center]
54 | endif::[]
55 |
56 | == Hardware
57 |
58 | All the hardware components in my particular build are enumerated here.
59 |
60 | .Fan Controller Components
61 | * https://www.adafruit.com/product/798[12V DC 1000mA (1A) regulated switching power adapter - UL listed]
62 | * https://www.digikey.com/en/products/detail/onsemi/1N4001RLG/918017[1N4001 Power Blocking Diode]
63 | * https://www.digikey.com/en/products/detail/molex/0470533000/3262217[4-Pin Male Fan Header]
64 | * https://www.digikey.com/en/products/detail/texas-instruments/SN74AHCT125N/375798[74AHCT125 - Quad Level-Shifter]
65 | * https://www.adafruit.com/product/368[Female DC Power adapter - 2.1mm jack to screw terminal block]
66 | * https://www.adafruit.com/product/64[Half-size breadboard]
67 | * https://www.adafruit.com/product/1311[Hook-up Wire - 22AWG Solid Core]
68 | * micro USB Power Supply for the microcontroller
69 | * {Raspberry-Pi-Pico}
70 | * https://www.adafruit.com/product/759[Premium Male/Male Jumper Wires - 40 x 3" (75mm)]
71 |
72 | Programming will require a micro USB cable and a computer.
73 | If you don't already have one, you'll probably want a fan, too.
74 | This circuit is meant for a 12V fan.
75 | I use this controller for the {Noctua-NF-P12-redux-1700-PWM-Fan}.
76 |
77 | == How it Works
78 |
79 | This is a dead-simple PWM fan controller that simply lowers the speed of the {Noctua-NF-P12-redux-1700-PWM-Fan} to a quiet 40%.
80 | The microcontroller simply sets the fan speed and then does nothing.
81 | The fan setup might evolve in the future to take into account temperature sensing and dynamic speed adjustment.
82 |
83 | The 3.3V microcontroller used here requires a logic level shifter to boost the PWM signal up to 5V for the fan.
84 | I use the 74AHCT125 to perform the logic level conversion, using pin #40, `VBUS`, to provide the 5V reference voltage.
85 |
86 | The Raspberry Pi Pico only draws 8.63 mA of power now that the firmware is taking advantage of the light sleep mode.
87 | If you're concerned about power usage or type safety, then you might be interested in my Rust-based implementation, https://github.com/jwillikers/PWM-Fan-Controller[PWM Fan Controller].
88 | The Rust-based version still sips a bit less power on the Pico, 1.99 mA.
89 | This is probably mostly due to the fact that the Rust-based version runs entirely off the low-power Ring Oscillator clock instead of the Crystal Oscillator.
90 | If you know any ways to improve the energy usage, feel free to get in touch or contribute!
91 |
92 | === Wiring
93 |
94 | The 74AHCT125 is wired as shown in the <<74AHCT125 Wiring>> table.
95 | All pins omitted from the table are connected to ground.
96 |
97 | .74AHCT125 Wiring
98 | [cols="1,2,2"]
99 | |===
100 | | 74AHCT125 Pin
101 | | Signal
102 | | Connection
103 |
104 | | 2
105 | | 3.3V logic level input
106 | | Pico pin #20 (GP15)
107 |
108 | | 3
109 | | 5V logic level output
110 | | 1N4001 to fan header pin #4 (Control)
111 |
112 | | 8
113 | | 5V
114 | | Pico pin #40 (VBUS)
115 | |===
116 |
117 | The output signal from the logic level shifter is sent through the 1N4001 power blocking diode to the fan header.
118 | The pins on the 4-pin fan header are classified in the <<4-pin Fan Header Pinout>> table.
119 | The pins are numbered one through four from left to right with the pins reaching upwards and the overhang positioned between the viewer and the pins.
120 |
121 | .4-pin Fan Header Pinout
122 | [cols="1,4"]
123 | |===
124 | | Fan Header Pin
125 | | Signal
126 |
127 | | 1
128 | | GND
129 |
130 | | 2
131 | | +12VDC
132 |
133 | | 3
134 | | Sense
135 |
136 | | 4
137 | | Control
138 | |===
139 |
140 | == Getting Started
141 |
142 | The instructions here setup the software for the Raspberry Pi Pico.
143 | It is assumed that you are on and familiar with Linux and using MicroPython on microcontrollers.
144 |
145 | [TIP]
146 | ====
147 | To access the serial connection to the Raspberry Pi Pico without requiring superuser privileges, add your user to the `dialout` group.
148 |
149 | [,sh]
150 | ----
151 | sudo usermod --append --groups dialout $USER
152 | ----
153 |
154 | Now log out and back in for the change to take effect.
155 | ====
156 |
157 | . Install {just} by following the instructions in the https://github.com/casey/just?tab=readme-ov-file#installation[installation section].
158 |
159 | . Clone this project's repository.
160 | +
161 | [,sh]
162 | ----
163 | git clone https://github.com/jwillikers/PWM-Fan-Controller-MicroPython.git
164 | ----
165 |
166 | . Change into the project directory.
167 | +
168 | [,sh]
169 | ----
170 | cd PWM-Fan-Controller-MicroPython
171 | ----
172 |
173 | . Hold down the button marked _BOOTSEL_ on the board while plugging it in to your computer with a micro USB cable.
174 |
175 | . Mount the drive provided by the Pico.
176 | The RP2040 may be mounted as a disk on your computer automatically.
177 | If not, determine the block device representing the Pico by perusing the block devices available from the `lsblk` command.
178 | To mount `/dev/sda1`, as in my case, use the `udisksctl` command like so to mount the block device.
179 | +
180 | [,sh]
181 | ----
182 | udisksctl mount --block-device /dev/sda1
183 | ----
184 |
185 | . To download and install MicroPython, run `just install-micropython`.
186 | +
187 | [,sh]
188 | ----
189 | just install-micropython
190 | ----
191 |
192 | . Wait for the file to finish copying.
193 | When it is done, a serial console will become available which provides access to the board.
194 | This serial port can be found with the `dmesg` command as follows.
195 | +
196 | --
197 | [,sh]
198 | ----
199 | sudo dmesg | tail
200 | [ 443.276661] usb 1-4.3.2: reset high-speed USB device number 22 using xhci_hcd
201 | [ 2180.628239] usb 1-3.2: USB disconnect, device number 10
202 | [ 4242.965271] usb 1-3.1: USB disconnect, device number 6
203 | [ 4245.247932] usb 1-3.1: new full-speed USB device number 23 using xhci_hcd
204 | [ 4245.387678] usb 1-3.1: New USB device found, idVendor=2e8a, idProduct=0005, bcdDevice= 1.00
205 | [ 4245.387681] usb 1-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
206 | [ 4245.387682] usb 1-3.1: Product: Board in FS mode
207 | [ 4245.387683] usb 1-3.1: Manufacturer: MicroPython
208 | [ 4245.387684] usb 1-3.1: SerialNumber: df6050788b1e1c2e
209 | [ 4245.397678] cdc_acm 1-3.1:1.0: ttyACM0: USB ACM device
210 | ----
211 |
212 | `ttyACM0` in the preceding output indicates the device node.
213 | This device resides under `/dev` on the filesystem.
214 | Note the name of the device shown in your output, since it will be used to copy the source code to the microcontroller's on-board filesystem.
215 | --
216 |
217 | . Run `just install` to install the firmware to the Pico.
218 | +
219 | --
220 | [,sh]
221 | ----
222 | just install
223 | ----
224 |
225 | [NOTE]
226 | ====
227 | If you previously installed the firmware, you must install the firmware or connect to the board with the `mpremote` command within the first fifteen seconds after plugging in the board.
228 | This is because the board will start sleeping in small intervals to reduce power usage.
229 | ====
230 | --
231 |
232 | . Once the previous command finishes, you may unplug the board.
233 |
234 | == Development
235 |
236 | The following instructions describe how to set up a local development environment and perform development tasks.
237 |
238 | === Development Environment
239 |
240 | It's possible to use a development environment from {Nix} or from a standard Python virtual environment.
241 | Both methods are described in the following sections.
242 |
243 | ==== Nix
244 |
245 | I've added development environment and some helpers using {Nix}.
246 | Honestly, with {pip-tools} and a hard-coded version of MicroPython, this project is already very reproducible.
247 | Nix doesn't offer much on top of that, except that it manages the version Python which is nice, and builds MicroPython itself.
248 | This allows further tweaks to be made to the MicroPython implementation in a reproducible manner.
249 | Additionally, it provides better consistency between the development environment and CI.
250 | I mostly wanted to use this as a learning opportunity, which was well worth the effort.
251 | Currently, Nix is just using a virtual environment with the dependencies from the `requirements-dev.txt` file.
252 |
253 | The `nix develop` command can be used to enter or run commands in an environment with all of the necessary dependencies.
254 | For convenience, direnv can be used to automatically load this environment when entering the project's directory.
255 | The https://marketplace.visualstudio.com/items?itemName=mkhl.direnv[mkhl.direnv VSCode extension] integrates this environment in VSCode for development.
256 | Nix also generates the configuration for {pre-commit}, which automates formatting and various checks when committing changes.
257 | Follow the instructions here to set up your development environment using Nix.
258 |
259 | . Install an implementation of {Nix}, such as https://lix.systems[Lix] used here.
260 | +
261 | [,sh]
262 | ----
263 | curl -sSf -L https://install.lix.systems/lix | sh -s -- install
264 | ----
265 |
266 | . Install direnv for your system according to the https://direnv.net/docs/installation.html[direnv installation instructions].
267 | +
268 | [,sh]
269 | ----
270 | sudo rpm-ostree install direnv
271 | sudo systemctl reboot
272 | ----
273 |
274 | . Integrate direnv with your shell by following the instructions on the https://direnv.net/docs/hook.html[direnv Setup page].
275 |
276 | . Permit the direnv configuration for the repository.
277 | +
278 | [,sh]
279 | ----
280 | direnv allow
281 | ----
282 |
283 | There are a couple of Nix commands available for common tasks.
284 |
285 | . Install MicroPython by running the `micropython` app output.
286 | +
287 | [,sh]
288 | ----
289 | nix run .#micropython
290 | ----
291 |
292 | . Install the fan controller firmware by running the `pwm-fan-controller` app output.
293 | +
294 | [,sh]
295 | ----
296 | nix run .#pwm-fan-controller
297 | ----
298 |
299 | ==== Virtual Environment
300 |
301 | . Run `just init-dev` to initialize the virtual environment for development.
302 | This will install all of the necessary dependencies and the {pre-commit} hooks.
303 | +
304 | [,sh]
305 | ----
306 | just init-dev
307 | ----
308 |
309 | === Develop
310 |
311 | The easiest way to test code on the device is to use mount the repository on the device and execute the code from there.
312 | The following code demonstrates how to use the `mpremote` command to do just this.
313 |
314 | [,sh]
315 | ----
316 | mpremote connect mount . exec "import main"
317 | ----
318 |
319 | It's also possible to run a repl instead by omitting the second command.
320 |
321 | [,sh]
322 | ----
323 | mpremote connect mount .
324 | ----
325 |
326 | For more information on how to use `mpremote`, check out the https://docs.micropython.org/en/latest/reference/mpremote.html[MicroPython remote control: mpremote] page of the MicroPython documentation.
327 |
328 | === Just
329 |
330 | Many of the necessary tasks for development have dedicated just commands.
331 | Here is the briefest overview.
332 |
333 | . For local development, the `just run` command can be used to run commands after mounting the local directory on the device.
334 | By default, it it will execute the main.py file, but other commands to `mpremote` can be provided as the first argument.
335 | +
336 | [,sh]
337 | ----
338 | just run
339 | ----
340 |
341 | . To update dependencies, run `just update`.
342 | +
343 | [,sh]
344 | ----
345 | just update
346 | ----
347 |
348 | . Use `just --list` to list other available tasks.
349 | +
350 | [,sh]
351 | ----
352 | just --list
353 | ----
354 |
355 | == Todo
356 |
357 | . Use mypy to enforce static typing.
358 | Unfortunately, mypy is not able to properly load the MicroPython stubs.
359 | Wait until support is better to implement this functionality.
360 |
361 | == References
362 |
363 | * https://www.ti.com/lit/ds/symlink/sn74ahct125.pdf[SN74AHCT125 Datasheet]
364 | * https://en.wikipedia.org/wiki/Computer_fan_control#Pulse-width_modulation[Computer Fan Control: Pulse-width modulation]
365 | * https://docs.micropython.org/en/latest/rp2/quickref.html#pwm-pulse-width-modulation[MicroPython Quick reference for the RP2: PWM (pulse width modulation)]
366 | * https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf[RP2040 Datasheet]
367 | * https://www.raspberrypi.com/documentation/microcontrollers/pico-series.html#pico-1-family[Raspberry Pi Pico Documentation]
368 | * https://www.raspberrypi.com/documentation/microcontrollers/pico-series.html#pinout-and-design-files-2[Raspberry Pi Pico Pinout]
369 |
370 | == Contributing
371 |
372 | Contributions in the form of issues, feedback, and even pull requests are welcome.
373 | Make sure to adhere to the project's link:CODE_OF_CONDUCT.adoc[Code of Conduct].
374 |
375 | == Open Source Software
376 |
377 | This project is built on the hard work of countless open source contributors.
378 | Several of these projects are enumerated below.
379 |
380 | * {Asciidoctor_}
381 | * {MicroPython}
382 | * {Linux}
383 | * {pip-tools}
384 | * {pre-commit}
385 | * {Python}
386 |
387 | == Code of Conduct
388 |
389 | Refer to the project's link:CODE_OF_CONDUCT.adoc[Code of Conduct] for details.
390 |
391 | == License
392 |
393 | This repository is licensed under the https://www.gnu.org/licenses/gpl-3.0.html[GPLv3], a copy of which is provided link:LICENSE.adoc[here].
394 |
395 | © 2022-2024 Jordan Williams
396 |
397 | == Authors
398 |
399 | mailto:{email}[{author}]
400 |
--------------------------------------------------------------------------------
/flake.lock:
--------------------------------------------------------------------------------
1 | {
2 | "nodes": {
3 | "flake-compat": {
4 | "flake": false,
5 | "locked": {
6 | "lastModified": 1696426674,
7 | "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
8 | "owner": "edolstra",
9 | "repo": "flake-compat",
10 | "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
11 | "type": "github"
12 | },
13 | "original": {
14 | "owner": "edolstra",
15 | "repo": "flake-compat",
16 | "type": "github"
17 | }
18 | },
19 | "flake-utils": {
20 | "inputs": {
21 | "systems": "systems"
22 | },
23 | "locked": {
24 | "lastModified": 1731533236,
25 | "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
26 | "owner": "numtide",
27 | "repo": "flake-utils",
28 | "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
29 | "type": "github"
30 | },
31 | "original": {
32 | "owner": "numtide",
33 | "repo": "flake-utils",
34 | "type": "github"
35 | }
36 | },
37 | "gitignore": {
38 | "inputs": {
39 | "nixpkgs": [
40 | "pre-commit-hooks",
41 | "nixpkgs"
42 | ]
43 | },
44 | "locked": {
45 | "lastModified": 1709087332,
46 | "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
47 | "owner": "hercules-ci",
48 | "repo": "gitignore.nix",
49 | "rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
50 | "type": "github"
51 | },
52 | "original": {
53 | "owner": "hercules-ci",
54 | "repo": "gitignore.nix",
55 | "type": "github"
56 | }
57 | },
58 | "nix-update-scripts": {
59 | "inputs": {
60 | "flake-utils": [
61 | "flake-utils"
62 | ],
63 | "nixpkgs": [
64 | "nixpkgs"
65 | ],
66 | "pre-commit-hooks": [
67 | "pre-commit-hooks"
68 | ],
69 | "treefmt-nix": [
70 | "treefmt-nix"
71 | ]
72 | },
73 | "locked": {
74 | "lastModified": 1745927951,
75 | "narHash": "sha256-4Y3gkd1SmgqIbvxvy9G1kjcth3YDqy5pZtWm3Oo1OSs=",
76 | "owner": "jwillikers",
77 | "repo": "nix-update-scripts",
78 | "rev": "4e2fbdd447c8d5ea640bfe7707f662bdd942aa7b",
79 | "type": "github"
80 | },
81 | "original": {
82 | "owner": "jwillikers",
83 | "repo": "nix-update-scripts",
84 | "type": "github"
85 | }
86 | },
87 | "nixpkgs": {
88 | "locked": {
89 | "lastModified": 1747335874,
90 | "narHash": "sha256-IKKIXTSYJMmUtE+Kav5Rob8SgLPnfnq4Qu8LyT4gdqQ=",
91 | "owner": "NixOS",
92 | "repo": "nixpkgs",
93 | "rev": "ba8b70ee098bc5654c459d6a95dfc498b91ff858",
94 | "type": "github"
95 | },
96 | "original": {
97 | "owner": "NixOS",
98 | "ref": "nixos-24.11",
99 | "repo": "nixpkgs",
100 | "type": "github"
101 | }
102 | },
103 | "pre-commit-hooks": {
104 | "inputs": {
105 | "flake-compat": "flake-compat",
106 | "gitignore": "gitignore",
107 | "nixpkgs": [
108 | "nixpkgs"
109 | ]
110 | },
111 | "locked": {
112 | "lastModified": 1747372754,
113 | "narHash": "sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=",
114 | "owner": "cachix",
115 | "repo": "pre-commit-hooks.nix",
116 | "rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46",
117 | "type": "github"
118 | },
119 | "original": {
120 | "owner": "cachix",
121 | "repo": "pre-commit-hooks.nix",
122 | "type": "github"
123 | }
124 | },
125 | "root": {
126 | "inputs": {
127 | "flake-utils": "flake-utils",
128 | "nix-update-scripts": "nix-update-scripts",
129 | "nixpkgs": "nixpkgs",
130 | "pre-commit-hooks": "pre-commit-hooks",
131 | "treefmt-nix": "treefmt-nix"
132 | }
133 | },
134 | "systems": {
135 | "locked": {
136 | "lastModified": 1681028828,
137 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
138 | "owner": "nix-systems",
139 | "repo": "default",
140 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
141 | "type": "github"
142 | },
143 | "original": {
144 | "owner": "nix-systems",
145 | "repo": "default",
146 | "type": "github"
147 | }
148 | },
149 | "treefmt-nix": {
150 | "inputs": {
151 | "nixpkgs": [
152 | "nixpkgs"
153 | ]
154 | },
155 | "locked": {
156 | "lastModified": 1747469671,
157 | "narHash": "sha256-bo1ptiFoNqm6m1B2iAhJmWCBmqveLVvxom6xKmtuzjg=",
158 | "owner": "numtide",
159 | "repo": "treefmt-nix",
160 | "rev": "ab0378b61b0d85e73a8ab05d5c6029b5bd58c9fb",
161 | "type": "github"
162 | },
163 | "original": {
164 | "owner": "numtide",
165 | "repo": "treefmt-nix",
166 | "type": "github"
167 | }
168 | }
169 | },
170 | "root": "root",
171 | "version": 7
172 | }
173 |
--------------------------------------------------------------------------------
/flake.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs = {
3 | flake-utils.url = "github:numtide/flake-utils";
4 | nix-update-scripts = {
5 | url = "github:jwillikers/nix-update-scripts";
6 | inputs = {
7 | flake-utils.follows = "flake-utils";
8 | nixpkgs.follows = "nixpkgs";
9 | pre-commit-hooks.follows = "pre-commit-hooks";
10 | treefmt-nix.follows = "treefmt-nix";
11 | };
12 | };
13 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
14 | pre-commit-hooks = {
15 | url = "github:cachix/pre-commit-hooks.nix";
16 | inputs = {
17 | nixpkgs.follows = "nixpkgs";
18 | };
19 | };
20 | treefmt-nix = {
21 | url = "github:numtide/treefmt-nix";
22 | inputs.nixpkgs.follows = "nixpkgs";
23 | };
24 | };
25 | outputs =
26 | {
27 | # deadnix: skip
28 | self,
29 | nix-update-scripts,
30 | nixpkgs,
31 | flake-utils,
32 | pre-commit-hooks,
33 | treefmt-nix,
34 | }:
35 | flake-utils.lib.eachDefaultSystem (
36 | system:
37 | let
38 | overlays = import ./overlays { };
39 | pkgs = import nixpkgs {
40 | inherit system overlays;
41 | };
42 | pre-commit = pre-commit-hooks.lib.${system}.run (
43 | import ./pre-commit-hooks.nix { inherit pkgs treefmtEval; }
44 | );
45 | treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
46 | in
47 | with pkgs;
48 | {
49 | apps = {
50 | inherit (nix-update-scripts.apps.${system}) update-nix-direnv update-nixos-release;
51 | install = {
52 | micropython = {
53 | type = "app";
54 | program = builtins.toString (
55 | pkgs.writers.writeNu "install-micropython" ''
56 | cp ${pkgs.micropython}/bin/RPI_PICO.uf2 (["/run/media/" (^id --name --user) "RPI-RP2"] | path join)
57 | ''
58 | );
59 | };
60 | pwm-fan-controller = {
61 | type = "app";
62 | program = builtins.toString (
63 | pkgs.writers.writeNu "install-pwm-fan-controller" ''
64 | let serial_device = (
65 | ^${pkgs.lib.getExe mpremote} devs |
66 | parse '{device} {serial_number} {vendor_id}:{product_id} {description}' |
67 | where description == "MicroPython Board in FS mode" |
68 | get device |
69 | first
70 | )
71 | let port_option = (
72 | if not ($serial_device | is-empty) {
73 | $"port:($serial_device)"
74 | } else {
75 | ""
76 | }
77 | )
78 | ^${pkgs.lib.getExe mpremote} connect $port_option fs cp ${
79 | self.packages.${system}.pwm-fan-controller
80 | }/bin/main.py :
81 | ''
82 | );
83 | };
84 | };
85 | default = self.apps.${system}.install.pwm-fan-controller;
86 | };
87 | devShells.default = mkShell {
88 | nativeBuildInputs =
89 | with pkgs;
90 | [
91 | asciidoctor
92 | fish
93 | just
94 | lychee
95 | micropython
96 | nushell
97 | # todo Migrate everything over to Nix eventually.
98 | # mpremote
99 | python3Packages.python
100 | python3Packages.pip-tools
101 | python3Packages.venvShellHook
102 | treefmtEval.config.build.wrapper
103 | (builtins.attrValues treefmtEval.config.build.programs)
104 | ]
105 | ++ pre-commit.enabledPackages;
106 | venvDir = "./.venv";
107 | postVenvCreation = ''
108 | pip-sync --python-executable .venv/bin/python requirements-dev.txt
109 | '';
110 | # https://github.com/NixOS/nixpkgs/issues/223151
111 | postShellHook =
112 | ''
113 | export LC_ALL="C.UTF-8";
114 | pip-sync --python-executable .venv/bin/python requirements-dev.txt
115 | ''
116 | + pre-commit.shellHook;
117 | };
118 | packages = {
119 | default = pkgs.micropython;
120 | inherit (pkgs) micropython;
121 | pwm-fan-controller = callPackage ./package.nix { };
122 | };
123 | formatter = treefmtEval.config.build.wrapper;
124 | }
125 | );
126 | }
127 |
--------------------------------------------------------------------------------
/lychee.toml:
--------------------------------------------------------------------------------
1 | # Due to rate limiting from digikey.com and gnu.org
2 | accept = [429]
3 |
4 | cache = true
5 | exclude = [
6 | '^http://www\.gnu\.org',
7 | # Raspberry Pi's website returns 403 forbidden codes for GitHub runners.
8 | '^https://www\.raspberrypi\.com',
9 | '^https://www\.gnu\.org',
10 | ]
11 | max_cache_age = "2w"
12 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | from machine import lightsleep, Pin, PWM
2 | from time import sleep
3 |
4 | MAX_DUTY_CYCLE = 65_535
5 | FORTY_PERCENT_DUTY_CYCLE = (MAX_DUTY_CYCLE * 2) // 5
6 |
7 | # PWM fans use a frequency of 25 kHz.
8 | PWM_FAN_FREQUENCY = 25_000
9 |
10 | ONE_MILLISECOND = 0.001
11 |
12 | # For PWM use GPIO pin #29, which is pin A0 on the Adafruit QT Py RP2040.
13 | # PWM_PIN = 29
14 |
15 | # For PWM use GPIO pin #15, which is pin #20 on the Raspberry Pi Pico.
16 | PWM_PIN = 15
17 |
18 | pwm0 = PWM(Pin(PWM_PIN))
19 |
20 | pwm0.freq(PWM_FAN_FREQUENCY)
21 |
22 | # Reduce the speed of the fan to 40% by setting the PWM duty cycle to 40%.
23 | pwm0.duty_u16(FORTY_PERCENT_DUTY_CYCLE)
24 |
25 | # Wait 15 seconds before initiating light sleep.
26 | # This allows accessing the board for the first 15 seconds after it it receives power.
27 | sleep(15)
28 |
29 | while True:
30 | lightsleep(2)
31 | pwm0.freq(PWM_FAN_FREQUENCY)
32 | # Reduce the speed of the fan to 40% by setting the PWM duty cycle to 40%.
33 | pwm0.duty_u16(FORTY_PERCENT_DUTY_CYCLE)
34 | sleep(ONE_MILLISECOND)
35 |
--------------------------------------------------------------------------------
/overlays/default.nix:
--------------------------------------------------------------------------------
1 | _: [
2 | # Build MicroPython for the rp2-pico
3 | (_self: super: {
4 | micropython = super.micropython.overrideAttrs (prevAttrs: {
5 | nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [
6 | super.cmake
7 | super.gcc-arm-embedded
8 | ];
9 | buildInputs = prevAttrs.buildInputs ++ [
10 | super.picotool
11 | ];
12 | dontUseCmakeConfigure = true;
13 | doCheck = false;
14 | makeFlags = [
15 | "-C"
16 | "ports/rp2"
17 | ];
18 | installPhase = ''
19 | runHook preInstall
20 | mkdir --parents $out/bin
21 | install -Dm755 ports/rp2/build-RPI_PICO/firmware.uf2 $out/bin/RPI_PICO.uf2
22 | runHook postInstall
23 | '';
24 | });
25 | })
26 | ]
27 |
--------------------------------------------------------------------------------
/package.nix:
--------------------------------------------------------------------------------
1 | {
2 | stdenvNoCC,
3 | }:
4 | stdenvNoCC.mkDerivation {
5 | pname = "pwm-fan-controller-micropython";
6 | version = "0.2.0";
7 |
8 | src = ./.;
9 |
10 | installPhase = ''
11 | runHook preInstall
12 | install -D --mode=0644 --target-directory=$out/bin main.py
13 | runHook postInstall
14 | '';
15 | }
16 |
--------------------------------------------------------------------------------
/pics/pico-pwm-fan-controller-breadboard-side-1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jwillikers/PWM-Fan-Controller-MicroPython/0cf804aab7ed784c4ebcfc714b741207f1c78585/pics/pico-pwm-fan-controller-breadboard-side-1.jpg
--------------------------------------------------------------------------------
/pics/pico-pwm-fan-controller-breadboard-side-2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jwillikers/PWM-Fan-Controller-MicroPython/0cf804aab7ed784c4ebcfc714b741207f1c78585/pics/pico-pwm-fan-controller-breadboard-side-2.jpg
--------------------------------------------------------------------------------
/pics/pico-pwm-fan-controller-breadboard-side-3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jwillikers/PWM-Fan-Controller-MicroPython/0cf804aab7ed784c4ebcfc714b741207f1c78585/pics/pico-pwm-fan-controller-breadboard-side-3.jpg
--------------------------------------------------------------------------------
/pics/pico-pwm-fan-controller-breadboard-top-1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jwillikers/PWM-Fan-Controller-MicroPython/0cf804aab7ed784c4ebcfc714b741207f1c78585/pics/pico-pwm-fan-controller-breadboard-top-1.jpg
--------------------------------------------------------------------------------
/pics/pico-pwm-fan-controller-breadboard-top-2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jwillikers/PWM-Fan-Controller-MicroPython/0cf804aab7ed784c4ebcfc714b741207f1c78585/pics/pico-pwm-fan-controller-breadboard-top-2.jpg
--------------------------------------------------------------------------------
/pre-commit-hooks.nix:
--------------------------------------------------------------------------------
1 | { pkgs, treefmtEval, ... }:
2 | {
3 | src = ./.;
4 | hooks = {
5 | check-added-large-files.enable = true;
6 | check-builtin-literals.enable = true;
7 | check-case-conflicts.enable = true;
8 | check-executables-have-shebangs.enable = true;
9 |
10 | # todo Not integrated with Nix?
11 | check-format = {
12 | enable = true;
13 | entry = "${treefmtEval.config.build.wrapper}/bin/treefmt --fail-on-change";
14 | };
15 |
16 | check-json.enable = true;
17 | check-python.enable = true;
18 | check-shebang-scripts-are-executable.enable = true;
19 | check-toml.enable = true;
20 | check-yaml.enable = true;
21 | deadnix.enable = true;
22 | detect-private-keys.enable = true;
23 | editorconfig-checker.enable = true;
24 | end-of-file-fixer.enable = true;
25 | fix-byte-order-marker.enable = true;
26 | # flake-checker.enable = true;
27 | forbid-new-submodules.enable = true;
28 | # todo Enable lychee when asciidoc is supported.
29 | # See https://github.com/lycheeverse/lychee/issues/291
30 | # lychee.enable = true;
31 | mixed-line-endings.enable = true;
32 | nil.enable = true;
33 |
34 | pip-compile = {
35 | enable = true;
36 | package = pkgs.python3Packages.pip-tools;
37 | entry = "${pkgs.python3Packages.pip-tools}/bin/pip-compile requirements-dev.in";
38 | description = "Automatically compile requirements.";
39 | name = "pip-compile";
40 | files = "^requirements-dev\\.(in|txt)$";
41 | pass_filenames = false;
42 | };
43 |
44 | pyright = {
45 | args = [
46 | "--pythonpath"
47 | ".venv/bin/python"
48 | ];
49 | enable = true;
50 | };
51 | python-debug-statements.enable = true;
52 | pyupgrade.enable = true;
53 |
54 | strip-location-metadata = {
55 | name = "Strip location metadata";
56 | description = "Strip geolocation metadata from image files";
57 | enable = true;
58 | entry = "${pkgs.exiftool}/bin/exiftool -duplicates -overwrite_original '-gps*='";
59 | package = pkgs.exiftool;
60 | types = [ "image" ];
61 | };
62 | trim-trailing-whitespace.enable = true;
63 | yamllint.enable = true;
64 | };
65 | }
66 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | [tool.pip-tools]
2 | allow_unsafe = true
3 | generate_hashes = true
4 | reuse_hashes = true
5 | upgrade = true
6 |
7 | [tool.pyright]
8 | ignore = ["**/typings"]
9 | exclude = ["**/.*", "__*", "**/node_modules", "**/typings", "venv"]
10 |
11 | typeCheckingMode = "basic"
12 | pythonPlatform = "Linux"
13 |
14 | reportMissingModuleSource = "none"
15 | reportUnnecessaryTypeIgnoreComment = "error"
16 |
--------------------------------------------------------------------------------
/requirements-dev.in:
--------------------------------------------------------------------------------
1 | micropython-rp2-pico-stubs
2 | mpremote
3 | pip-tools
4 |
--------------------------------------------------------------------------------
/requirements-dev.txt:
--------------------------------------------------------------------------------
1 | #
2 | # This file is autogenerated by pip-compile with Python 3.12
3 | # by the following command:
4 | #
5 | # pip-compile --allow-unsafe --generate-hashes requirements-dev.in
6 | #
7 | build==1.2.2.post1 \
8 | --hash=sha256:1d61c0887fa860c01971625baae8bdd338e517b836a2f70dd1f7aa3a6b2fc5b5 \
9 | --hash=sha256:b36993e92ca9375a219c99e606a122ff365a760a2d4bba0caa09bd5278b608b7
10 | # via pip-tools
11 | click==8.1.8 \
12 | --hash=sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2 \
13 | --hash=sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a
14 | # via pip-tools
15 | micropython-rp2-pico-stubs==1.20.0.post5 \
16 | --hash=sha256:57d64f3db9d1d2e1150983c4c719ea521644367283072146b06dcd15d783dfc1 \
17 | --hash=sha256:aba78deb37e696b30744201da7435daa8363e24834750a8bb711b60c843391e8
18 | # via -r requirements-dev.in
19 | micropython-stdlib-stubs==1.24.1.post2 \
20 | --hash=sha256:1ef3b2cf4f84cd8a96bf05184c09498a246b87435bcea0235f3b49861a1d1cd1
21 | # via micropython-rp2-pico-stubs
22 | mpremote==1.25.0 \
23 | --hash=sha256:42691ff8f7ea4b5f2fc1b51de99609995d383671a4b4d4daad8cbd486d26aa23 \
24 | --hash=sha256:d0dcd8ab364d87270e1766308882e536e541052efd64aadaac83bc7ebbea2815
25 | # via -r requirements-dev.in
26 | packaging==25.0 \
27 | --hash=sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484 \
28 | --hash=sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f
29 | # via build
30 | pip-tools==7.4.1 \
31 | --hash=sha256:4c690e5fbae2f21e87843e89c26191f0d9454f362d8acdbd695716493ec8b3a9 \
32 | --hash=sha256:864826f5073864450e24dbeeb85ce3920cdfb09848a3d69ebf537b521f14bcc9
33 | # via -r requirements-dev.in
34 | pyproject-hooks==1.2.0 \
35 | --hash=sha256:1e859bd5c40fae9448642dd871adf459e5e2084186e8d2c2a79a824c970da1f8 \
36 | --hash=sha256:9e5c6bfa8dcc30091c74b0cf803c81fdd29d94f01992a7707bc97babb1141913
37 | # via
38 | # build
39 | # pip-tools
40 | pyserial==3.5 \
41 | --hash=sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb \
42 | --hash=sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0
43 | # via mpremote
44 | wheel==0.45.1 \
45 | --hash=sha256:661e1abd9198507b1409a20c02106d9670b2576e916d58f520316666abca6729 \
46 | --hash=sha256:708e7481cc80179af0e556bbf0cc00b8444c7321e2700b8d8580231d13017248
47 | # via pip-tools
48 |
49 | # The following packages are considered to be unsafe in a requirements file:
50 | pip==25.1.1 \
51 | --hash=sha256:2913a38a2abf4ea6b64ab507bd9e967f3b53dc1ede74b01b0931e1ce548751af \
52 | --hash=sha256:3de45d411d308d5054c2168185d8da7f9a2cd753dbac8acbfa88a8909ecd9077
53 | # via pip-tools
54 | setuptools==80.1.0 \
55 | --hash=sha256:2e308396e1d83de287ada2c2fd6e64286008fe6aca5008e0b6a8cb0e2c86eedd \
56 | --hash=sha256:ea0e7655c05b74819f82e76e11a85b31779fee7c4969e82f72bab0664e8317e4
57 | # via pip-tools
58 |
--------------------------------------------------------------------------------
/treefmt.nix:
--------------------------------------------------------------------------------
1 | _: {
2 | config = {
3 | programs = {
4 | actionlint.enable = true;
5 | jsonfmt.enable = true;
6 | just.enable = true;
7 | # todo
8 | # mypy.enable = true;
9 | nixfmt.enable = true;
10 | ruff-check.enable = true;
11 | ruff-format.enable = true;
12 | statix.enable = true;
13 | taplo.enable = true;
14 | typos.enable = true;
15 | yamlfmt.enable = true;
16 | };
17 | settings.formatter.typos.excludes = [
18 | "*.avif"
19 | "*.bmp"
20 | "*.gif"
21 | "*.jpeg"
22 | "*.jpg"
23 | "*.png"
24 | "*.svg"
25 | "*.tiff"
26 | "*.webp"
27 | ".vscode/settings.json"
28 | ];
29 | projectRootFile = "flake.nix";
30 | };
31 | }
32 |
--------------------------------------------------------------------------------