Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gaming_mouse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
e7020e_2021_group_edwkll-7
gaming_mouse
Commits
d5308b3d
Commit
d5308b3d
authored
3 years ago
by
Kalle Löfgren
Browse files
Options
Downloads
Patches
Plain Diff
Update Project_Mouse.rs
parent
76dfde35
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/Project_Mouse.rs
+27
-20
27 additions, 20 deletions
code/Project_Mouse.rs
with
27 additions
and
20 deletions
code/Project_Mouse.rs
+
27
−
20
View file @
d5308b3d
...
...
@@ -261,11 +261,12 @@ const APP: () = {
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
)
{
static
mut
PREV_UP
:
bool
=
false
;
static
mut
PREV_DOWN
:
bool
=
false
;
let
Led_Counter
=
cx
.resources.Led_Counter
;
let
myScaler
=
cx
.resources.Scaler
;
let
hid
=
cx
.resources.hid
;
let
led_r
=
cx
.resources.led_r
;
...
...
@@ -289,31 +290,37 @@ const APP: () = {
//LEDs
let
mut
state
:
i8
=
0
;
if
l_click
.is_high
()
.unwrap
(){
if
led_r
.is_high
()
.unwrap
(){
state
=
1
;
}
else
{
state
=
2
;
if
Led_Counter
==
10
{
Led_Counter
=
0
;
if
l_click
.is_high
()
.unwrap
(){
if
led_r
.is_high
()
.unwrap
(){
state
=
1
;
}
else
{
state
=
2
;
}
}
}
if
l_click
.is_low
()
.unwrap
()
&&
r_click
.is_high
()
.unwrap
(){
if
led_b
.is_high
()
.unwrap
(){
state
=
3
;
if
l_click
.is_low
()
.unwrap
()
&&
r_click
.is_high
()
.unwrap
(){
if
led_b
.is_high
()
.unwrap
(){
state
=
3
;
}
else
{
state
=
4
;
}
}
else
{
state
=
4
;
}
}
else
{
if
led_g
.is_high
()
.unwrap
(){
state
=
5
;
if
led_g
.is_high
()
.unwrap
(){
state
=
5
;
}
else
{
state
=
6
;
}
}
else
{
state
=
6
;
toggle_led
(
state
,
led_r
,
led_g
,
led_b
);
}
else
{
Led_Counter
=
Led_Counter
+
1
;
}
toggle_led
(
state
,
led_r
,
led_g
,
led_b
);
let
(
x
,
y
)
=
cx
.resources.pmw3389
.read_status
()
.unwrap
();
//rprintln!("{} {}", x as i64, y as i64);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment