Update deps
This commit is contained in:
804
right/Cargo.lock → Cargo.lock
generated
804
right/Cargo.lock → Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
9
Cargo.toml
Normal file
9
Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[workspace]
|
||||||
|
members = [
|
||||||
|
"lib",
|
||||||
|
"left",
|
||||||
|
"right",
|
||||||
|
]
|
||||||
|
|
||||||
|
resolver = "2"
|
||||||
|
|
||||||
1799
left/Cargo.lock
generated
1799
left/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -12,9 +12,9 @@ package = "tangentbord1-lib"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
tgnt = { git = "https://git.nubo.sh/hulthe/tgnt.git", default-features = false }
|
tgnt = { git = "https://git.nubo.sh/hulthe/tgnt.git", default-features = false }
|
||||||
cortex-m-rt = "0.7"
|
cortex-m-rt = "0.7"
|
||||||
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", "log", "executor-thread", "nightly", "integrated-timers" ] }
|
embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", features = ["arch-cortex-m", "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-time = { git = "https://github.com/embassy-rs/embassy.git", features = ["log"] }
|
||||||
embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", features = ["log"] }
|
embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", features = ["log"] }
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
|
|||||||
@ -16,6 +16,7 @@ use log::error;
|
|||||||
use tangentbord1::{
|
use tangentbord1::{
|
||||||
board::Board,
|
board::Board,
|
||||||
event::Half,
|
event::Half,
|
||||||
|
interrupts::Irqs,
|
||||||
keyboard::KeyboardConfig,
|
keyboard::KeyboardConfig,
|
||||||
logger::Logger,
|
logger::Logger,
|
||||||
rgb::Rgb,
|
rgb::Rgb,
|
||||||
@ -48,8 +49,8 @@ async fn main(_spawner: Spawner) {
|
|||||||
|
|
||||||
let _neopixel_power = Output::new(board.neopixel_power, Level::High);
|
let _neopixel_power = Output::new(board.neopixel_power, Level::High);
|
||||||
|
|
||||||
let mut neopixel = Ws2812::new(board.PIO0, board.DMA_CH0, board.neopixel);
|
let mut neopixel = Ws2812::new(board.PIO0, Irqs, board.DMA_CH0, board.neopixel);
|
||||||
let neopixels_d5 = Ws2812::new(board.PIO1, board.DMA_CH1, board.d5);
|
let neopixels_d5 = Ws2812::new(board.PIO1, Irqs, board.DMA_CH1, board.d5);
|
||||||
|
|
||||||
neopixel.write(&[Rgb::new(0xFF, 0x00, 0x00)]).await;
|
neopixel.write(&[Rgb::new(0xFF, 0x00, 0x00)]).await;
|
||||||
|
|
||||||
|
|||||||
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"
|
usb-device = "0.2.9"
|
||||||
usbd-hid = "0.6.1"
|
usbd-hid = "0.6.1"
|
||||||
static_cell = "1.0.0"
|
static_cell = "1.0.0"
|
||||||
embedded-io = { version = "*", features = ["async"] }
|
embedded-io-async = "*"
|
||||||
futures = { version = "0.3", default-features = false, features = ["async-await"] }
|
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-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-time = { git = "https://github.com/embassy-rs/embassy.git", features = ["log"] }
|
||||||
embassy-futures = { 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"] }
|
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"
|
simple_logger = "4"
|
||||||
|
|
||||||
[target.thumbv6m-none-eabi.dependencies]
|
[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"] }
|
embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", features = ["arch-cortex-m"] }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
use embassy_rp::{
|
use embassy_rp::{
|
||||||
bind_interrupts,
|
bind_interrupts,
|
||||||
peripherals::{UART0, USB},
|
peripherals::{PIO0, PIO1, UART0, USB},
|
||||||
};
|
};
|
||||||
|
|
||||||
bind_interrupts! {
|
bind_interrupts! {
|
||||||
pub struct Irqs {
|
pub struct Irqs {
|
||||||
UART0_IRQ => embassy_rp::uart::BufferedInterruptHandler<UART0>;
|
UART0_IRQ => embassy_rp::uart::BufferedInterruptHandler<UART0>;
|
||||||
USBCTRL_IRQ => embassy_rp::usb::InterruptHandler<USB>;
|
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)]
|
#[derive(Clone, Copy)]
|
||||||
enum LightState {
|
enum LightState {
|
||||||
Solid(Rgb),
|
Solid(Rgb),
|
||||||
|
#[allow(dead_code)]
|
||||||
SolidThenFade {
|
SolidThenFade {
|
||||||
color: Rgb,
|
color: Rgb,
|
||||||
solid_until: Instant,
|
solid_until: Instant,
|
||||||
@ -68,8 +69,12 @@ async fn tick(state: &'static State, lights: &mut [LightState; SWITCH_COUNT]) {
|
|||||||
.lights
|
.lights
|
||||||
.update(|rgbs| {
|
.update(|rgbs| {
|
||||||
for (button, light) in lights.iter_mut().enumerate() {
|
for (button, light) in lights.iter_mut().enumerate() {
|
||||||
let Some(&led_id) = state.led_map.get(button) else { continue; };
|
let Some(&led_id) = state.led_map.get(button) else {
|
||||||
let Some(rgb) = rgbs.get_mut(led_id) else { continue; };
|
continue;
|
||||||
|
};
|
||||||
|
let Some(rgb) = rgbs.get_mut(led_id) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
match &*light {
|
match &*light {
|
||||||
LightState::None => {}
|
LightState::None => {}
|
||||||
@ -115,7 +120,9 @@ async fn idle_animation(state: &'static State) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (n, &i) in state.led_map.iter().enumerate() {
|
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(
|
let [r, g, b] = wheel(
|
||||||
(n as u64 * IDLE_ANIMATION_KEY_OFFSET + tick * IDLE_ANIMATION_SPEED) as u8,
|
(n as u64 * IDLE_ANIMATION_KEY_OFFSET + tick * IDLE_ANIMATION_SPEED) as u8,
|
||||||
)
|
)
|
||||||
@ -190,6 +197,8 @@ async fn handle_event(
|
|||||||
return;
|
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;
|
*light = rgb;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ use crc_any::CRCu16;
|
|||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_rp::peripherals::{PIN_0, PIN_1, UART0};
|
use embassy_rp::peripherals::{PIN_0, PIN_1, UART0};
|
||||||
use embassy_rp::uart::{self, BufferedUart, DataBits, Parity, StopBits};
|
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 futures::{select_biased, FutureExt};
|
||||||
use heapless::Vec;
|
use heapless::Vec;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|||||||
@ -14,6 +14,7 @@ struct State {
|
|||||||
device_descriptor: [u8; 256],
|
device_descriptor: [u8; 256],
|
||||||
config_descriptor: [u8; 256],
|
config_descriptor: [u8; 256],
|
||||||
bos_descriptor: [u8; 256],
|
bos_descriptor: [u8; 256],
|
||||||
|
msos_descriptor: [u8; 256],
|
||||||
control_buf: [u8; 64],
|
control_buf: [u8; 64],
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,6 +39,7 @@ pub fn builder(usb: USB) -> Builder<'static, Driver<'static, USB>> {
|
|||||||
device_descriptor: [0; 256],
|
device_descriptor: [0; 256],
|
||||||
config_descriptor: [0; 256],
|
config_descriptor: [0; 256],
|
||||||
bos_descriptor: [0; 256],
|
bos_descriptor: [0; 256],
|
||||||
|
msos_descriptor: [0; 256],
|
||||||
control_buf: [0; 64],
|
control_buf: [0; 64],
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -64,6 +66,7 @@ pub fn builder(usb: USB) -> Builder<'static, Driver<'static, USB>> {
|
|||||||
&mut state.device_descriptor,
|
&mut state.device_descriptor,
|
||||||
&mut state.config_descriptor,
|
&mut state.config_descriptor,
|
||||||
&mut state.bos_descriptor,
|
&mut state.bos_descriptor,
|
||||||
|
&mut state.msos_descriptor,
|
||||||
&mut state.control_buf,
|
&mut state.control_buf,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use embassy_rp::dma::{self, AnyChannel};
|
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::pio::{self, FifoJoin, Instance, Pio, PioPin, ShiftConfig, ShiftDirection};
|
||||||
use embassy_rp::relocate::RelocatedProgram;
|
|
||||||
use embassy_rp::{Peripheral, PeripheralRef};
|
use embassy_rp::{Peripheral, PeripheralRef};
|
||||||
use fixed::FixedU32;
|
use fixed::FixedU32;
|
||||||
|
|
||||||
@ -14,10 +14,11 @@ pub struct Ws2812<P: pio::Instance + 'static> {
|
|||||||
impl<P: Instance> Ws2812<P> {
|
impl<P: Instance> Ws2812<P> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
pio: impl Peripheral<P = P> + 'static,
|
pio: impl Peripheral<P = P> + 'static,
|
||||||
|
irqs: impl Binding<P::Interrupt, pio::InterruptHandler<P>>,
|
||||||
dma: impl dma::Channel,
|
dma: impl dma::Channel,
|
||||||
pin: impl PioPin,
|
pin: impl PioPin,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut pio = Pio::new(pio);
|
let mut pio = Pio::new(pio, irqs);
|
||||||
let mut sm = pio.sm0;
|
let mut sm = pio.sm0;
|
||||||
// prepare the PIO program
|
// prepare the PIO program
|
||||||
let side_set = ::pio::SideSet::new(false, 1, false);
|
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 prg = a.assemble_with_wrap(wrap_source, wrap_target);
|
||||||
|
|
||||||
let relocated_prg = RelocatedProgram::new(&prg);
|
//let relocated_prg = RelocatedProgram::new(&prg);
|
||||||
let loaded_prg = pio.common.load_program(&relocated_prg);
|
let loaded_prg = pio.common.load_program(&prg);
|
||||||
|
|
||||||
// Clock config
|
// Clock config
|
||||||
// TODO CLOCK_FREQ should come from embassy_rp
|
// TODO CLOCK_FREQ should come from embassy_rp
|
||||||
|
|||||||
@ -12,9 +12,9 @@ package = "tangentbord1-lib"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
tgnt = { git = "https://git.nubo.sh/hulthe/tgnt.git", default-features = false }
|
tgnt = { git = "https://git.nubo.sh/hulthe/tgnt.git", default-features = false }
|
||||||
cortex-m-rt = "0.7"
|
cortex-m-rt = "0.7"
|
||||||
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", "log", "executor-thread", "nightly", "integrated-timers" ] }
|
embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", features = ["arch-cortex-m", "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-time = { git = "https://github.com/embassy-rs/embassy.git", features = ["log"] }
|
||||||
embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", features = ["log"] }
|
embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", features = ["log"] }
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
|
|||||||
@ -15,6 +15,7 @@ use log::error;
|
|||||||
use tangentbord1::{
|
use tangentbord1::{
|
||||||
board::Board,
|
board::Board,
|
||||||
event::Half,
|
event::Half,
|
||||||
|
interrupts::Irqs,
|
||||||
keyboard::KeyboardConfig,
|
keyboard::KeyboardConfig,
|
||||||
logger::Logger,
|
logger::Logger,
|
||||||
rgb::Rgb,
|
rgb::Rgb,
|
||||||
@ -47,8 +48,8 @@ async fn main(_spawner: Spawner) {
|
|||||||
|
|
||||||
let _neopixel_power = Output::new(board.neopixel_power, Level::High);
|
let _neopixel_power = Output::new(board.neopixel_power, Level::High);
|
||||||
|
|
||||||
let mut neopixel = Ws2812::new(board.PIO0, board.DMA_CH0, board.neopixel);
|
let mut neopixel = Ws2812::new(board.PIO0, Irqs, board.DMA_CH0, board.neopixel);
|
||||||
let neopixels_d5 = Ws2812::new(board.PIO1, board.DMA_CH1, board.d5);
|
let neopixels_d5 = Ws2812::new(board.PIO1, Irqs, board.DMA_CH1, board.d5);
|
||||||
|
|
||||||
neopixel.write(&[Rgb::new(0xFF, 0x00, 0x00)]).await;
|
neopixel.write(&[Rgb::new(0xFF, 0x00, 0x00)]).await;
|
||||||
|
|
||||||
|
|||||||
2
run
2
run
@ -8,7 +8,7 @@ def main [
|
|||||||
--serial (-s): string # The serial device to get logs from.
|
--serial (-s): string # The serial device to get logs from.
|
||||||
--probe (-p): bool # Flash & run using probe-run instead of elf2uf2
|
--probe (-p): bool # Flash & run using probe-run instead of elf2uf2
|
||||||
] {
|
] {
|
||||||
if $probe {
|
if $probe == true {
|
||||||
cargo build --bin $bin
|
cargo build --bin $bin
|
||||||
probe-run --chip RP2040 --speed 4000 ("./target/thumbv6m-none-eabi/debug/" + $bin)
|
probe-run --chip RP2040 --speed 4000 ("./target/thumbv6m-none-eabi/debug/" + $bin)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2023-02-01"
|
channel = "nightly"
|
||||||
components = ["rust-std", "rust-src", "rustfmt", "cargo", "clippy"]
|
components = ["rust-std", "rust-src", "rustfmt", "cargo", "clippy"]
|
||||||
targets = ["thumbv6m-none-eabi"]
|
targets = ["thumbv6m-none-eabi"]
|
||||||
|
|||||||
Reference in New Issue
Block a user