Test and verify functionality
This commit is contained in:
parent
e55af0616d
commit
e070e75eca
2 changed files with 21 additions and 7 deletions
13
.vscode/tasks.json
vendored
Normal file
13
.vscode/tasks.json
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "cargo",
|
||||||
|
"command": "run",
|
||||||
|
"problemMatcher": [
|
||||||
|
"$rustc"
|
||||||
|
],
|
||||||
|
"label": "rust: cargo run"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
15
src/main.rs
15
src/main.rs
|
@ -15,6 +15,7 @@ use bsp::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
usb::UsbBus,
|
usb::UsbBus,
|
||||||
},
|
},
|
||||||
|
XOSC_CRYSTAL_FREQ,
|
||||||
};
|
};
|
||||||
|
|
||||||
use cortex_m::delay::Delay;
|
use cortex_m::delay::Delay;
|
||||||
|
@ -44,10 +45,8 @@ fn main() -> ! {
|
||||||
let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);
|
let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);
|
||||||
|
|
||||||
// Configure the clocks
|
// Configure the clocks
|
||||||
//
|
|
||||||
// The default is to generate a 125 MHz system clock
|
|
||||||
let clocks = hal::clocks::init_clocks_and_plls(
|
let clocks = hal::clocks::init_clocks_and_plls(
|
||||||
rp_pico::XOSC_CRYSTAL_FREQ,
|
XOSC_CRYSTAL_FREQ,
|
||||||
pac.XOSC,
|
pac.XOSC,
|
||||||
pac.CLOCKS,
|
pac.CLOCKS,
|
||||||
pac.PLL_SYS,
|
pac.PLL_SYS,
|
||||||
|
@ -91,15 +90,17 @@ fn main() -> ! {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut delay = Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
|
let mut delay = Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
|
||||||
|
const PIXEL: i8 = 100;
|
||||||
|
const WAIT_TIME: u32 = 250;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
mouse_move(&mut delay, 4);
|
mouse_move(&mut delay, WAIT_TIME, PIXEL);
|
||||||
mouse_move(&mut delay, -4);
|
mouse_move(&mut delay, WAIT_TIME, -PIXEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mouse_move(delay: &mut Delay, v: i8) {
|
fn mouse_move(delay: &mut Delay, wait_time: u32, v: i8) {
|
||||||
delay.delay_ms(100);
|
delay.delay_ms(wait_time);
|
||||||
|
|
||||||
let rep = MouseReport {
|
let rep = MouseReport {
|
||||||
x: 0,
|
x: 0,
|
||||||
|
|
Loading…
Reference in a new issue