Skip to content
Snippets Groups Projects
Commit d5308b3d authored by Kalle Löfgren's avatar Kalle Löfgren
Browse files

Update Project_Mouse.rs

parent 76dfde35
Branches
No related tags found
No related merge requests found
...@@ -261,11 +261,12 @@ const APP: () = { ...@@ -261,11 +261,12 @@ const APP: () = {
fn EXTI0(); fn EXTI0();
} }
#[task(binds=OTG_FS, resources = [led_r, led_g, led_b, r_click, l_click, w_click, M1_click, M2_click, scroll_up, scroll_down, Scaler, hid, pmw3389, usb_dev], priority = 2)] #[task(binds=OTG_FS, resources = [Led_Counter, led_r, led_g, led_b, r_click, l_click, w_click, M1_click, M2_click, scroll_up, scroll_down, Scaler, hid, pmw3389, usb_dev], priority = 2)]
fn toggle(cx: toggle::Context) { fn toggle(cx: toggle::Context) {
static mut PREV_UP: bool = false; static mut PREV_UP: bool = false;
static mut PREV_DOWN: bool = false; static mut PREV_DOWN: bool = false;
let Led_Counter = cx.resources.Led_Counter;
let myScaler = cx.resources.Scaler; let myScaler = cx.resources.Scaler;
let hid = cx.resources.hid; let hid = cx.resources.hid;
let led_r = cx.resources.led_r; let led_r = cx.resources.led_r;
...@@ -289,31 +290,37 @@ const APP: () = { ...@@ -289,31 +290,37 @@ const APP: () = {
//LEDs //LEDs
let mut state: i8 = 0; let mut state: i8 = 0;
if l_click.is_high().unwrap(){ if Led_Counter == 10{
if led_r.is_high().unwrap(){ Led_Counter = 0;
state = 1; if l_click.is_high().unwrap(){
} if led_r.is_high().unwrap(){
else{ state = 1;
state = 2; }
else{
state = 2;
}
} }
} if l_click.is_low().unwrap() && r_click.is_high().unwrap(){
if l_click.is_low().unwrap() && r_click.is_high().unwrap(){ if led_b.is_high().unwrap(){
if led_b.is_high().unwrap(){ state = 3;
state = 3; }
else{
state = 4;
}
} }
else{ else{
state = 4; if led_g.is_high().unwrap(){
} state = 5;
} }
else{ else{
if led_g.is_high().unwrap(){ state = 6;
state = 5; }
} }
else{ toggle_led(state, led_r, led_g, led_b);
state = 6;
} }
else{
Led_Counter = Led_Counter + 1;
} }
toggle_led(state, led_r, led_g, led_b);
let (x, y) = cx.resources.pmw3389.read_status().unwrap(); let (x, y) = cx.resources.pmw3389.read_status().unwrap();
//rprintln!("{} {}", x as i64, y as i64); //rprintln!("{} {}", x as i64, y as i64);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment