Compare commits
2 commits
fbc187f001
...
cb95755998
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb95755998 | ||
|
|
e3fd07a28e |
4 changed files with 35 additions and 25 deletions
|
|
@ -8,6 +8,8 @@ rustflags = [
|
||||||
# Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.)
|
# Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.)
|
||||||
# NOTE: May negatively impact performance of produced code
|
# NOTE: May negatively impact performance of produced code
|
||||||
"-C", "force-frame-pointers",
|
"-C", "force-frame-pointers",
|
||||||
|
#https://defmt.ferrous-systems.com/setup
|
||||||
|
"-C", "link-arg=-Tdefmt.x",
|
||||||
]
|
]
|
||||||
|
|
||||||
target = "riscv32imac-unknown-none-elf"
|
target = "riscv32imac-unknown-none-elf"
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ esp-bootloader-esp-idf = { version = "0.4.0", features = ["esp32c6"] }
|
||||||
critical-section = "1.2.0"
|
critical-section = "1.2.0"
|
||||||
esp-alloc = "0.9.0"
|
esp-alloc = "0.9.0"
|
||||||
rtt-target = "0.6.2"
|
rtt-target = "0.6.2"
|
||||||
|
embedded-hal = "1.0.0"
|
||||||
|
esp-backtrace = {version = "0.18.1",features = ["esp32c6","defmt"]}
|
||||||
|
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,28 @@
|
||||||
{ pkgs ? import <nixpkgs> {}}:
|
{ pkgs ? import <nixpkgs> {
|
||||||
let rust-toolchain = with pkgs; symlinkJoin {
|
overlays = [
|
||||||
name = "rust-toolchain";
|
(import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"))
|
||||||
paths = [
|
|
||||||
probe-rs-tools
|
|
||||||
rustup
|
|
||||||
rustc
|
|
||||||
cargo
|
|
||||||
rustfmt
|
|
||||||
rust-analyzer
|
|
||||||
clippy
|
|
||||||
rustPlatform.rustcSrc
|
|
||||||
];
|
];
|
||||||
};
|
}
|
||||||
in pkgs.mkShell {
|
}:
|
||||||
buildInputs = [rust-toolchain];
|
|
||||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
let
|
||||||
RUST_BACKTRACE = 1;
|
# Define the specific toolchain with ESP32-C6 support
|
||||||
|
rustToolchain = pkgs.rust-bin.selectLatestNightlyWith(toolchain: toolchain.default.override {
|
||||||
|
targets = [ "riscv32imac-unknown-none-elf" ];
|
||||||
|
extensions = [ "rust-src" "llvm-tools-preview" ];
|
||||||
|
});
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
nativeBuildInputs = [
|
||||||
|
rustToolchain
|
||||||
|
pkgs.probe-rs-tools
|
||||||
|
pkgs.espflash # For flashing your ESP32-C6
|
||||||
|
pkgs.pkg-config
|
||||||
|
pkgs.gcc # Critical: provides the 'cc' wrapper script
|
||||||
|
];
|
||||||
|
|
||||||
|
# Injects necessary library paths for the Nix-wrapped linker
|
||||||
|
shellHook = ''
|
||||||
|
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc ]}"
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ use esp_hal::handler;
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
use esp_hal::time::{Duration, Instant};
|
use esp_hal::time::{Duration, Instant};
|
||||||
use esp_hal::timer::timg::TimerGroup;
|
use esp_hal::timer::timg::TimerGroup;
|
||||||
|
use esp_backtrace as _;
|
||||||
use critical_section::Mutex;
|
use critical_section::Mutex;
|
||||||
use rtt_target::rprintln;
|
use rtt_target::rprintln;
|
||||||
mod dc_driver;
|
mod dc_driver;
|
||||||
|
|
@ -38,7 +38,10 @@ fn panic(_: &core::panic::PanicInfo) -> ! {
|
||||||
//
|
//
|
||||||
static EMERGENCY_BUTTON: Mutex<RefCell<Option<Input>>> = Mutex::new(RefCell::new(None));
|
static EMERGENCY_BUTTON: Mutex<RefCell<Option<Input>>> = Mutex::new(RefCell::new(None));
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
//target RPM
|
||||||
|
const DEFAULT_TARGET_RPM: u32 = 1000;
|
||||||
|
//in seconds
|
||||||
|
const DEFAULT_SPIN_TIME:u32 = 10;
|
||||||
// This creates a default app-descriptor required by the esp-idf bootloader.
|
// This creates a default app-descriptor required by the esp-idf bootloader.
|
||||||
// For more information see: <https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/app_image_format.html#application-description>
|
// For more information see: <https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/app_image_format.html#application-description>
|
||||||
esp_bootloader_esp_idf::esp_app_desc!();
|
esp_bootloader_esp_idf::esp_app_desc!();
|
||||||
|
|
@ -98,12 +101,6 @@ fn main() -> ! {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.with_rx(peripherals.GPIO5)
|
.with_rx(peripherals.GPIO5)
|
||||||
.with_tx(peripherals.GPIO7);
|
.with_tx(peripherals.GPIO7);
|
||||||
// uart0.write(b"page page0");
|
|
||||||
// uart0.write(b"\xff");
|
|
||||||
// uart0.write(b"\xff");
|
|
||||||
// uart0.write(b"\xff");
|
|
||||||
// uart0.write(b"\xff");
|
|
||||||
// rprintln!("WRITE HAPPENED!");
|
|
||||||
let mut display = Nextion::new(&mut uart0);
|
let mut display = Nextion::new(&mut uart0);
|
||||||
display.send_command(b"page page0");
|
display.send_command(b"page page0");
|
||||||
loop {
|
loop {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue