Rust Cycle is a (WIP) bicycle computer built on Rust!
Use the local nix derivation:
nix-build ./local.nix
Ensure that bluetooth is enabled.
In nixos, set hardware.bluetooth.enabled = true
in your /etc/nixos/configuaration.nix
file.
Create the executable with nix.
nix-build
On the host or target (where ever its running from) add the appropriate network capabilities. This has to be done on every new build!
sudo setcap 'cap_net_raw,cap_net_admin+eip' ${BINARY}
SPI is used to interface with the InkyPhat display.
In /boot/config.txt
add (or uncomment) dtparam=spi=on
.
Reboot to enable this change.
I2C is used to interface with the button shim.
In /boot/config.txt
add (or uncomment) dtparam=i2c_arm=on
.
Reboot to enable this change.
Our GPS module uses UART to send NMEA sentences. Because we will be using Bluetooth, which uses the primary serial device, we need to use the miniUart for serial communication.
In /boot/cmdline.txt
remove console=serial0,115200
.
In /boot/config.txt
add enable_uart=1
.
Reboot to enable these changes.
From the host, fill in the misc/rust-cycle.service
file and send it to the target.
scp misc/rust-cycle.service pi@raspberrypi:~/Downloads/
Then add the service into the pi's set of services.
sudo mv ~/Downloads/rust-cycle.service /etc/systemd/system/
On the target, enable the service:
sudo systemctl enable rust-cycle.service
On reboot, the application will start.