Update deps
This commit is contained in:
1782
lib/Cargo.lock
generated
1782
lib/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -13,10 +13,10 @@ embedded-hal = "0.2.5"
|
||||
usb-device = "0.2.9"
|
||||
usbd-hid = "0.6.1"
|
||||
static_cell = "1.0.0"
|
||||
embedded-io = { version = "*", features = ["async"] }
|
||||
embedded-io-async = "*"
|
||||
futures = { version = "0.3", default-features = false, features = ["async-await"] }
|
||||
embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", features = ["log", "executor-thread", "nightly", "integrated-timers" ] }
|
||||
embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", features = ["log", "nightly"] }
|
||||
embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", features = ["log"] }
|
||||
embassy-time = { git = "https://github.com/embassy-rs/embassy.git", features = ["log"] }
|
||||
embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", features = ["log"] }
|
||||
embassy-usb = { git = "https://github.com/embassy-rs/embassy.git", features = ["usbd-hid"] }
|
||||
@ -44,7 +44,7 @@ embassy-time = { git = "https://github.com/embassy-rs/embassy.git", features = [
|
||||
simple_logger = "4"
|
||||
|
||||
[target.thumbv6m-none-eabi.dependencies]
|
||||
embassy-rp = { git = "https://github.com/embassy-rs/embassy.git", features = ["log", "nightly", "unstable-traits", "unstable-pac", "time-driver", "critical-section-impl"] }
|
||||
embassy-rp = { git = "https://github.com/embassy-rs/embassy.git", features = ["log", "unstable-pac", "time-driver", "critical-section-impl"] }
|
||||
embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", features = ["arch-cortex-m"] }
|
||||
|
||||
[build-dependencies]
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
use embassy_rp::{
|
||||
bind_interrupts,
|
||||
peripherals::{UART0, USB},
|
||||
peripherals::{PIO0, PIO1, UART0, USB},
|
||||
};
|
||||
|
||||
bind_interrupts! {
|
||||
pub struct Irqs {
|
||||
UART0_IRQ => embassy_rp::uart::BufferedInterruptHandler<UART0>;
|
||||
USBCTRL_IRQ => embassy_rp::usb::InterruptHandler<USB>;
|
||||
PIO0_IRQ_0 => embassy_rp::pio::InterruptHandler<PIO0>;
|
||||
PIO1_IRQ_0 => embassy_rp::pio::InterruptHandler<PIO1>;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ const MIN_IDLE_BRIGHTESS: f32 = 0.05;
|
||||
#[derive(Clone, Copy)]
|
||||
enum LightState {
|
||||
Solid(Rgb),
|
||||
#[allow(dead_code)]
|
||||
SolidThenFade {
|
||||
color: Rgb,
|
||||
solid_until: Instant,
|
||||
@ -68,8 +69,12 @@ async fn tick(state: &'static State, lights: &mut [LightState; SWITCH_COUNT]) {
|
||||
.lights
|
||||
.update(|rgbs| {
|
||||
for (button, light) in lights.iter_mut().enumerate() {
|
||||
let Some(&led_id) = state.led_map.get(button) else { continue; };
|
||||
let Some(rgb) = rgbs.get_mut(led_id) else { continue; };
|
||||
let Some(&led_id) = state.led_map.get(button) else {
|
||||
continue;
|
||||
};
|
||||
let Some(rgb) = rgbs.get_mut(led_id) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
match &*light {
|
||||
LightState::None => {}
|
||||
@ -115,7 +120,9 @@ async fn idle_animation(state: &'static State) {
|
||||
};
|
||||
|
||||
for (n, &i) in state.led_map.iter().enumerate() {
|
||||
let Some(light) = lights.get_mut(i) else { continue };
|
||||
let Some(light) = lights.get_mut(i) else {
|
||||
continue;
|
||||
};
|
||||
let [r, g, b] = wheel(
|
||||
(n as u64 * IDLE_ANIMATION_KEY_OFFSET + tick * IDLE_ANIMATION_SPEED) as u8,
|
||||
)
|
||||
@ -190,6 +197,8 @@ async fn handle_event(
|
||||
return;
|
||||
}
|
||||
|
||||
let Some(light) = lights.get_mut(event.source_button) else { return; };
|
||||
let Some(light) = lights.get_mut(event.source_button) else {
|
||||
return;
|
||||
};
|
||||
*light = rgb;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ use crc_any::CRCu16;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp::peripherals::{PIN_0, PIN_1, UART0};
|
||||
use embassy_rp::uart::{self, BufferedUart, DataBits, Parity, StopBits};
|
||||
use embedded_io::asynch::{Read, Write};
|
||||
use embedded_io_async::{Read, Write};
|
||||
use futures::{select_biased, FutureExt};
|
||||
use heapless::Vec;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -14,6 +14,7 @@ struct State {
|
||||
device_descriptor: [u8; 256],
|
||||
config_descriptor: [u8; 256],
|
||||
bos_descriptor: [u8; 256],
|
||||
msos_descriptor: [u8; 256],
|
||||
control_buf: [u8; 64],
|
||||
}
|
||||
|
||||
@ -38,6 +39,7 @@ pub fn builder(usb: USB) -> Builder<'static, Driver<'static, USB>> {
|
||||
device_descriptor: [0; 256],
|
||||
config_descriptor: [0; 256],
|
||||
bos_descriptor: [0; 256],
|
||||
msos_descriptor: [0; 256],
|
||||
control_buf: [0; 64],
|
||||
});
|
||||
|
||||
@ -64,6 +66,7 @@ pub fn builder(usb: USB) -> Builder<'static, Driver<'static, USB>> {
|
||||
&mut state.device_descriptor,
|
||||
&mut state.config_descriptor,
|
||||
&mut state.bos_descriptor,
|
||||
&mut state.msos_descriptor,
|
||||
&mut state.control_buf,
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use embassy_rp::dma::{self, AnyChannel};
|
||||
use embassy_rp::interrupt::typelevel::Binding;
|
||||
use embassy_rp::pio::{self, FifoJoin, Instance, Pio, PioPin, ShiftConfig, ShiftDirection};
|
||||
use embassy_rp::relocate::RelocatedProgram;
|
||||
use embassy_rp::{Peripheral, PeripheralRef};
|
||||
use fixed::FixedU32;
|
||||
|
||||
@ -14,10 +14,11 @@ pub struct Ws2812<P: pio::Instance + 'static> {
|
||||
impl<P: Instance> Ws2812<P> {
|
||||
pub fn new(
|
||||
pio: impl Peripheral<P = P> + 'static,
|
||||
irqs: impl Binding<P::Interrupt, pio::InterruptHandler<P>>,
|
||||
dma: impl dma::Channel,
|
||||
pin: impl PioPin,
|
||||
) -> Self {
|
||||
let mut pio = Pio::new(pio);
|
||||
let mut pio = Pio::new(pio, irqs);
|
||||
let mut sm = pio.sm0;
|
||||
// prepare the PIO program
|
||||
let side_set = ::pio::SideSet::new(false, 1, false);
|
||||
@ -46,8 +47,8 @@ impl<P: Instance> Ws2812<P> {
|
||||
|
||||
let prg = a.assemble_with_wrap(wrap_source, wrap_target);
|
||||
|
||||
let relocated_prg = RelocatedProgram::new(&prg);
|
||||
let loaded_prg = pio.common.load_program(&relocated_prg);
|
||||
//let relocated_prg = RelocatedProgram::new(&prg);
|
||||
let loaded_prg = pio.common.load_program(&prg);
|
||||
|
||||
// Clock config
|
||||
// TODO CLOCK_FREQ should come from embassy_rp
|
||||
|
||||
Reference in New Issue
Block a user