diff --git a/Cargo.toml b/Cargo.toml index d8fd588..963bad7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "subtone" -version = "0.3.0" +version = "0.4.0" license = "MIT" resolver = "2" @@ -15,19 +15,20 @@ panic-probe = { version = "0.3", features = ["print-defmt"] } embassy-embedded-hal = { version ="0.1.0", features = ["defmt"] } -embassy-executor = { version = "0.4.0", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } +embassy-executor = { version = "0.5.0", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } embassy-futures = { version = "0.1.1", features = ["defmt"] } embassy-sync = { version = "0.5.0", features = ["defmt"] } -embassy-time = { version = "0.2.0", features = ["defmt", "defmt-timestamp-uptime"] } +embassy-time = { version = "0.3.0", features = ["defmt", "defmt-timestamp-uptime"] } embassy-rp = { version = "0.1.0", features = ["defmt", "unstable-pac", "time-driver", "critical-section-impl"] } ssd1306 = "0.8.0" fixed = "1.23.1" pio-proc = "0.2" pio = "0.2.1" -static_cell = "1.3.0" +static_cell = "2.0.0" +portable-atomic = { version = "1.6.0", features = ["critical-section"] } embedded-graphics = "0.8.1" -display-interface = "0.4.1" +display-interface = "0.5.0" rp2040-boot2 = "0.3.0" @@ -37,12 +38,12 @@ tinybmp = "0.5.0" pdm = {version = "0.1.0", git = "https://github.com/zarath/embedded-libs" } [patch.crates-io] -embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy", rev = "ca2e3759ad31f511c239d30132a28714b0e402db" } -embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "ca2e3759ad31f511c239d30132a28714b0e402db" } -embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "ca2e3759ad31f511c239d30132a28714b0e402db" } -embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "ca2e3759ad31f511c239d30132a28714b0e402db" } -embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "ca2e3759ad31f511c239d30132a28714b0e402db" } -embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "ca2e3759ad31f511c239d30132a28714b0e402db" } +embassy-embedded-hal = { git = "https://github.com/embassy-rs/embassy", rev = "f3a0bcb15eb7f7d1b2f9d948f8d487b76a4308fe" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy", rev = "f3a0bcb15eb7f7d1b2f9d948f8d487b76a4308fe" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "f3a0bcb15eb7f7d1b2f9d948f8d487b76a4308fe" } +embassy-time = { git = "https://github.com/embassy-rs/embassy", rev = "f3a0bcb15eb7f7d1b2f9d948f8d487b76a4308fe" } +embassy-rp = { git = "https://github.com/embassy-rs/embassy", rev = "f3a0bcb15eb7f7d1b2f9d948f8d487b76a4308fe" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy", rev = "f3a0bcb15eb7f7d1b2f9d948f8d487b76a4308fe" } # cargo build/run [profile.dev] diff --git a/OpenSCAD/case.scad b/OpenSCAD/case.scad index 6dbd645..5b68790 100644 --- a/OpenSCAD/case.scad +++ b/OpenSCAD/case.scad @@ -213,8 +213,19 @@ module knob() cylinder(h = 12.0, d1 = 2.4, d2 = 2.0); } } + for (w = [45.0:90.0:315.0]) + { + rotate([0.0, 0.0, w]) + translate([4.0, 0.0, 3.5]) + cube([2.0, 0.6, 7], center=true); + } + for (w = [45.0:90.0:135.0]) + { + rotate([0.0, 0.0, w]) + translate([3.8, 0.0, 3.5]) + cube([2.6, 0.6, 7], center=true); + } } // baseplate(); // case (); knob(); -// pipe(h=20, do=20, di=16); diff --git a/OpenSCAD/case.stl b/OpenSCAD/case.stl deleted file mode 100644 index 9666632..0000000 Binary files a/OpenSCAD/case.stl and /dev/null differ diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a886a97..df5628f 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,7 @@ # Before upgrading check that everything is available on all tier1 targets here: # https://rust-lang.github.io/rustup-components-history [toolchain] -channel = "nightly-2023-12-19" +channel = "nightly-2024-03-26" components = [ "rust-src", "rustfmt" ] targets = [ "thumbv6m-none-eabi", diff --git a/src/encoder.rs b/src/encoder.rs index 83d233c..4c2fe19 100644 --- a/src/encoder.rs +++ b/src/encoder.rs @@ -1,8 +1,7 @@ use defmt::info; use embassy_futures::join::join; use embassy_futures::select::{select, Either}; -use embassy_rp::gpio::{Flex, Pin, Pull}; -use embassy_rp::Peripheral; +use embassy_rp::gpio::Input; use embassy_time::{Duration, Timer}; pub enum EncoderDirection { @@ -12,20 +11,14 @@ pub enum EncoderDirection { pub static DELAY_DEFAULT: Duration = Duration::from_millis(5); -pub struct Encoder<'d, T: Pin, V: Pin> { - pin_a: Flex<'d, T>, - pin_b: Flex<'d, V>, +pub struct Encoder<'d> { + pin_a: Input<'d>, + pin_b: Input<'d>, } -impl<'d, T: Pin, V: Pin> Encoder<'d, T, V> { +impl<'d> Encoder<'d> { #[inline] - pub fn new(pin_a: impl Peripheral
+ 'd, pin_b: impl Peripheral
+ 'd) -> Self {
- let mut pin_a = Flex::new(pin_a);
- let mut pin_b = Flex::new(pin_b);
- pin_a.set_as_input();
- pin_a.set_pull(Pull::Up);
- pin_b.set_as_input();
- pin_b.set_pull(Pull::Up);
+ pub fn new(pin_a: Input<'static>, pin_b: Input<'static>) -> Self {
Self { pin_a, pin_b }
}
diff --git a/src/main.rs b/src/main.rs
index aecc58f..154cee1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,8 +1,9 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
-
+#[allow(static_mut_refs)]
use core::mem::size_of;
+use core::ptr::addr_of_mut;
use defmt::info;
use embassy_executor::Executor;
@@ -13,8 +14,8 @@ use embassy_rp::{
gpio::{Input, Pull},
i2c::{Config as I2cConfig, I2c},
multicore::{spawn_core1, Stack},
- peripherals::{DMA_CH0, DMA_CH1, FLASH, I2C1, PIN_2, PIN_26, PIN_3, PIN_4, PIO0},
- pio::{Config as PioConfig, FifoJoin, InterruptHandler, Pio, ShiftDirection},
+ peripherals::{DMA_CH0, DMA_CH1, FLASH, I2C1, PIN_26, PIO0},
+ pio::{Config as PioConfig, FifoJoin, InterruptHandler, Pio, ShiftDirection, StateMachine},
rom_data::{float_funcs::fdiv, reset_to_usb_boot},
Peripheral,
};
@@ -88,8 +89,8 @@ static CHANNEL: Channel