PWM fan controller written in Rust targeting different microcontrollers.
Currently, these are basic examples for setting the Noctua NF-P12 redux-1700 PWM Fan to a quiescent 40% speed.
Implementations for specific boards can be found in the boards
directory.
The implementations include boards targeting the Arm, AVR, and RISC-V architectures.
Nix is used to manage dependencies, toolchains, and development environments for each board.
This makes it possible to develop locally in an environment that is consistent with CI.
The nix develop
command can be used to enter or run commands in an environment with all of the necessary dependencies.
For convenience, direnv can be used to automatically load this environment when entering the project’s directory.
The mkhl.direnv VSCode extension integrates this environment in VSCode for development.
Nix also generates the configuration for pre-commit, which automates formatting and various checks when committing changes.
Follow the instructions here to set up your development environment.
-
Install an implementation of Nix, such as Lix used here.
curl -sSf -L https://install.lix.systems/lix | sh -s -- install
-
Install direnv for your system according to the direnv installation instructions.
sudo rpm-ostree install direnv sudo systemctl reboot
-
Integrate direnv with your shell by following the instructions on the direnv Setup page.
-
Clone the repository.
git clone https://github.com/jwillikers/pwm-fan-controller.git
-
Permit the direnv configuration for the desired board or boards in the repository. The following command allows loading the environments for all boards.
direnv allow boards/*
-
Run
pre-commit install
to configure pre-commit hooks in the repository.pre-commit install
-
The just command runner can be used to perform common tasks, such as building the and flashing the firmware for a particular board. The commands do not automatically use or assume a Nix environment. When in the directory for a particular board, this shouldn’t be a problem as direnv automatically loads the Nix environment. However, the top-level directory does not load any environment, so use
nix develop
as required to execute thejust commands
.nix develop .#attiny85 --command just flash attiny85
On Linux, most distributions require the user to be in a particular group to access serial ports. Here, I document the particular steps required to permit access to serial ports on Fedora Atomic variants.
-
On Fedora Atomic, the dialout group does not exist in the
/etc/group
, so it must be added there.echo (getent group dialout) | sudo tee -a /etc/group
-
Add the user to the dialout group to access USB without requiring superuser privileges.
sudo usermod --append --groups dialout $USER
-
Log out and back in for the group change to take effect.
Contributions in the form of issues, feedback, and even pull requests are welcome. Make sure to adhere to the project’s Code of Conduct.
This project is built on the hard work of countless open source contributors. Several of these projects are enumerated below.
Refer to the project’s Code of Conduct for details.
Licensed under either of
-
Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
-
MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
© 2022-2024 Jordan Williams