Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vinscant rust #69

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions vinscant/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[build]
#target = "xtensa-esp32s2-espidf"
target = "xtensa-esp32-espidf"

[target.xtensa-esp32s2-espidf]
linker = "ldproxy"
runner = "espflash flash --monitor" # Select this runner for espflash v3.x.x
rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110

[target.xtensa-esp32-espidf]
linker = "ldproxy"
runner = "espflash flash --monitor" # Select this runner for espflash v3.x.x
rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110

[unstable]
build-std = ["std", "panic_abort"]

[env]
#MCU="esp32s2"
MCU="esp32"
# Note: this variable is not used by the pio builder (`cargo build --features pio`)
ESP_IDF_VERSION = "v5.2.2"

# Workaround for https://github.com/esp-rs/esp-idf-template/issues/174
CRATE_CC_NO_DEFAULTS = "1"
40 changes: 40 additions & 0 deletions vinscant/.github/workflows/rust_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Continuous Integration

on:
push:
paths-ignore:
- "**/README.md"
pull_request:
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
rust-checks:
name: Rust Checks
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
action:
- command: build
args: --release
- command: fmt
args: --all -- --check --color always
- command: clippy
args: --all-targets --all-features --workspace -- -D warnings
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust
uses: esp-rs/[email protected]
with:
default: true
buildtargets: esp32s2
ldproxy: true
- name: Enable caching
uses: Swatinem/rust-cache@v2
- name: Run command
run: cargo ${{ matrix.action.command }} ${{ matrix.action.args }}
10 changes: 5 additions & 5 deletions vinscant/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
key.txt
mfrc522.py
webrepl_cli.py

# ESP-IDF default build directory name
build
/.vscode
/.embuild
/target
/Cargo.lock
cfg.toml
49 changes: 49 additions & 0 deletions vinscant/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[package]
name = "vinscant"
version = "0.1.0"
authors = ["axel"]
edition = "2021"
resolver = "2"
rust-version = "1.77"

[lib]
name = "lib"
path = "src/lib.rs"

[[bin]]
name = "vinscant"
harness = false # do not use the built in cargo test harness -> resolve rust-analyzer errors

[profile.release]
opt-level = "s"

[profile.dev]
debug = true # Symbols are nice and they don't increase the size on Flash
opt-level = "z"

[features]
default = ["std", "embassy", "esp-idf-svc/native"]

pio = ["esp-idf-svc/pio"]
std = ["alloc", "esp-idf-svc/binstart", "esp-idf-svc/std"]
alloc = ["esp-idf-svc/alloc"]
nightly = ["esp-idf-svc/nightly"]
experimental = ["esp-idf-svc/experimental"]
embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf-svc/embassy-time-driver"]

[dependencies]
log = { version = "0.4", default-features = false }
esp-idf-svc = { version = "0.49", default-features = false }
toml-cfg = "0.2.0"
anyhow = "1.0.86"
embedded-svc = "0.28.0"
mfrc522 = "0.7.0"
hex = "0.4.3"
ws2812-esp32-rmt-driver = { version = "0.9.0", features = ["smart-leds-trait"] }
smart_led_effects = "0.1.7"
palette = "0.7.6"
rgb = "0.8.50"

[build-dependencies]
embuild = "0.32.0"
toml-cfg = "0.2.0"
2 changes: 1 addition & 1 deletion vinscant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ono
- RFID-RC522

Connect RFID-RC522 Rfid reader on these pins:

TODO update pins
```
SDA/CS: 34
MOSI: 35
Expand Down
15 changes: 15 additions & 0 deletions vinscant/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#[toml_cfg::toml_config]
pub struct Config {
#[default("")]
wifi_ssid: &'static str,
#[default("")]
wifi_psk: &'static str,
}

fn main() {
// Check if the `cfg.toml` file exists and has been filled out.
if !std::path::Path::new("cfg.toml").exists() {
panic!("You need to create a `cfg.toml` file with your Wi-Fi credentials! Use `cfg.toml.example` as a template.");
}
embuild::espidf::sysenv::output();
}
4 changes: 4 additions & 0 deletions vinscant/cfg.toml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[vinscant]
wifi_ssid = "Your SSID here"
wifi_psk = "Your password here"
auth_key = "Your key here"
29 changes: 0 additions & 29 deletions vinscant/mpfiles/boot.py

This file was deleted.

Empty file removed vinscant/mpfiles/lib/__init__.py
Empty file.
Loading
Loading