Test and verify functionality

This commit is contained in:
hodasemi 2023-02-01 06:10:38 +01:00
parent e55af0616d
commit e070e75eca
2 changed files with 21 additions and 7 deletions

13
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,13 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "cargo",
"command": "run",
"problemMatcher": [
"$rustc"
],
"label": "rust: cargo run"
}
]
}

View file

@ -15,6 +15,7 @@ use bsp::{
prelude::*,
usb::UsbBus,
},
XOSC_CRYSTAL_FREQ,
};
use cortex_m::delay::Delay;
@ -44,10 +45,8 @@ fn main() -> ! {
let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);
// Configure the clocks
//
// The default is to generate a 125 MHz system clock
let clocks = hal::clocks::init_clocks_and_plls(
rp_pico::XOSC_CRYSTAL_FREQ,
XOSC_CRYSTAL_FREQ,
pac.XOSC,
pac.CLOCKS,
pac.PLL_SYS,
@ -91,15 +90,17 @@ fn main() -> ! {
}
let mut delay = Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
const PIXEL: i8 = 100;
const WAIT_TIME: u32 = 250;
loop {
mouse_move(&mut delay, 4);
mouse_move(&mut delay, -4);
mouse_move(&mut delay, WAIT_TIME, PIXEL);
mouse_move(&mut delay, WAIT_TIME, -PIXEL);
}
}
fn mouse_move(delay: &mut Delay, v: i8) {
delay.delay_ms(100);
fn mouse_move(delay: &mut Delay, wait_time: u32, v: i8) {
delay.delay_ms(wait_time);
let rep = MouseReport {
x: 0,