Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
GamingMouse
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Österberg
GamingMouse
Commits
f168e7f5
Commit
f168e7f5
authored
Mar 18, 2021
by
Otto Kalliorinne
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://gitlab.henriktjader.com/CarlOsterberg/gamingmouse
parents
8292aedc
b242ea60
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
code/Cargo.lock
+18
-5
18 additions, 5 deletions
code/Cargo.lock
code/Cargo.toml
+2
-2
2 additions, 2 deletions
code/Cargo.toml
code/examples/button_test.rs
+33
-15
33 additions, 15 deletions
code/examples/button_test.rs
code/examples/rtt_rtic_usb_mouse.rs
+11
-0
11 additions, 0 deletions
code/examples/rtt_rtic_usb_mouse.rs
with
64 additions
and
22 deletions
code/Cargo.lock
+
18
−
5
View file @
f168e7f5
...
@@ -18,8 +18,8 @@ dependencies = [
...
@@ -18,8 +18,8 @@ dependencies = [
"cortex-m-rtic",
"cortex-m-rtic",
"cortex-m-semihosting",
"cortex-m-semihosting",
"embedded-hal",
"embedded-hal",
"panic-
hal
t",
"panic-
rtt-targe
t",
"rtt-target",
"rtt-target
0.3.0
",
"stm32f4 0.13.0",
"stm32f4 0.13.0",
"stm32f4xx-hal",
"stm32f4xx-hal",
"usb-device",
"usb-device",
...
@@ -245,10 +245,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
...
@@ -245,10 +245,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae"
checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae"
[[package]]
[[package]]
name = "panic-
hal
t"
name = "panic-
rtt-targe
t"
version = "0.
2.0
"
version = "0.
1.1
"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812"
checksum = "cfcd4deccf5edead7dcd0531448f0bab1b935e6d88e47225b4b7c6bd3a443180"
dependencies = [
"cortex-m 0.6.7",
"rtt-target 0.2.2",
]
[[package]]
[[package]]
name = "proc-macro2"
name = "proc-macro2"
...
@@ -297,6 +301,15 @@ dependencies = [
...
@@ -297,6 +301,15 @@ dependencies = [
"syn",
"syn",
]
]
[[package]]
name = "rtt-target"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0869b4c5b6a6d8c5583fc473f9eb3423a170f77626b8c8a7fb18eddcda5770e2"
dependencies = [
"ufmt-write",
]
[[package]]
[[package]]
name = "rtt-target"
name = "rtt-target"
version = "0.3.0"
version = "0.3.0"
...
...
...
...
This diff is collapsed.
Click to expand it.
code/Cargo.toml
+
2
−
2
View file @
f168e7f5
...
@@ -14,13 +14,13 @@ embedded-hal = "0.2.4"
...
@@ -14,13 +14,13 @@ embedded-hal = "0.2.4"
usb-device
=
"0.2.7"
usb-device
=
"0.2.7"
# Panic handlers, comment all but one to generate doc!
# Panic handlers, comment all but one to generate doc!
panic-halt
=
"0.2.0"
#
panic-halt = "0.2.0"
# Uncomment for the itm panic examples.
# Uncomment for the itm panic examples.
#panic-itm = "0.4.2"
#panic-itm = "0.4.2"
# Uncomment for the rtt-timing examples.
# Uncomment for the rtt-timing examples.
#
panic-rtt-target = { version = "0.1.1", features = ["cortex-m"] }
panic-rtt-target
=
{
version
=
"0.1.1"
,
features
=
[
"cortex-m"
]
}
# Uncomment for the semihosting examples.
# Uncomment for the semihosting examples.
#panic-semihosting = "0.5.6"
#panic-semihosting = "0.5.6"
...
...
...
...
This diff is collapsed.
Click to expand it.
code/examples/button_test.rs
+
33
−
15
View file @
f168e7f5
...
@@ -3,15 +3,31 @@
...
@@ -3,15 +3,31 @@
#![no_main]
#![no_main]
#![no_std]
#![no_std]
use
panic_halt
as
_
;
//
use panic_halt as _;
use
rtt_target
::{
rprintln
,
rtt_init_print
};
use
rtt_target
::{
rprintln
,
rtt_init_print
};
use
stm32f4
::{
self
};
use
stm32f4
::{
self
};
use
embedded_hal
::
spi
::
MODE_3
;
use
embedded_hal
::
spi
::
MODE_3
;
//
use panic_rtt_target as _;
use
panic_rtt_target
as
_
;
use
rtic
::
cyccnt
::{
Instant
,
U32Ext
as
_
};
use
rtic
::
cyccnt
::{
Instant
,
U32Ext
as
_
};
use
stm32f4xx_hal
::{
dwt
::
Dwt
,
gpio
::
Speed
,
gpio
::{
Alternate
,
Input
,
Output
,
PullUp
,
PushPull
,
gpiob
,
gpioc
::{
self
,
PC6
,
PC7
}},
prelude
::
*
,
rcc
::
Clocks
,
spi
::
Spi
,
stm32
,
timer
};
use
stm32f4xx_hal
::{
dwt
::
Dwt
,
gpio
::
Speed
,
gpio
::{
Alternate
,
Input
,
Output
,
PullUp
,
PushPull
,
gpiob
,
gpioc
::{
self
,
PC6
,
PC7
}},
prelude
::
*
,
rcc
::
Clocks
,
spi
::
Spi
,
stm32
};
const
OFFSET
:
u32
=
1_000_000
;
#[rtic::app(device
=
stm32f4xx_hal::stm32,
monotonic
=
rtic::cyccnt::CYCCNT,
peripherals
=
true
)]
#[rtic::app(device
=
stm32f4xx_hal::stm32,
monotonic
=
rtic::cyccnt::CYCCNT,
peripherals
=
true
)]
const
APP
:
()
=
{
const
APP
:
()
=
{
...
@@ -23,22 +39,24 @@ const APP: () = {
...
@@ -23,22 +39,24 @@ const APP: () = {
DPIB1
:
gpiob
::
PB13
<
Input
<
PullUp
>>
,
DPIB1
:
gpiob
::
PB13
<
Input
<
PullUp
>>
,
DPIB2
:
gpiob
::
PB12
<
Input
<
PullUp
>>
,
DPIB2
:
gpiob
::
PB12
<
Input
<
PullUp
>>
,
MB5
:
gpiob
::
PB15
<
Input
<
PullUp
>>
,
MB5
:
gpiob
::
PB15
<
Input
<
PullUp
>>
,
MB4
:
gpiob
::
PB14
<
Input
<
PullUp
>>
,
MB4
:
gpiob
::
PB14
<
Input
<
PullUp
>>
timer
:
timer
::
Timer
<
stm32
::
TIM3
>
}
}
#[init]
#[init
(schedule
=
[
tick]
)
]
fn
init
(
cx
:
init
::
Context
)
->
init
::
LateResources
{
fn
init
(
cx
:
init
::
Context
)
->
init
::
LateResources
{
rtt_init_print!
();
rtt_init_print!
();
rprintln!
(
"init"
);
rprintln!
(
"init"
);
let
device
=
cx
.device
;
let
device
=
cx
.device
;
let
mut
core
=
cx
.core
;
let
rcc
=
device
.RCC
.constrain
();
core
.DCB
.enable_trace
();
core
.DWT
.enable_cycle_counter
();
// 16 MHz (default, all clocks)
let
now
=
cx
.start
;
let
clocks
=
rcc
.cfgr
.freeze
();
cx
.schedule
.tick
(
now
+
OFFSET
.cycles
())
.unwrap
();
let
gpioc
=
device
.GPIOC
.split
();
let
gpioc
=
device
.GPIOC
.split
();
let
gpiob
=
device
.GPIOB
.split
();
let
gpiob
=
device
.GPIOB
.split
();
...
@@ -52,10 +70,7 @@ const APP: () = {
...
@@ -52,10 +70,7 @@ const APP: () = {
let
dpib1
=
gpiob
.pb13
.into_pull_up_input
();
let
dpib1
=
gpiob
.pb13
.into_pull_up_input
();
let
dpib2
=
gpiob
.pb12
.into_pull_up_input
();
let
dpib2
=
gpiob
.pb12
.into_pull_up_input
();
let
mut
timer
=
timer
::
Timer
::
tim3
(
device
.TIM3
,
1
.khz
(),
clocks
);
init
::
LateResources
{
MB1
:
mb1
,
MB2
:
mb2
,
MB4
:
mb4
,
MB5
:
mb5
,
DPIB1
:
dpib1
,
DPIB2
:
dpib2
}
timer
.listen
(
timer
::
Event
::
TimeOut
);
init
::
LateResources
{
MB1
:
mb1
,
MB2
:
mb2
,
MB4
:
mb4
,
MB5
:
mb5
,
DPIB1
:
dpib1
,
DPIB2
:
dpib2
,
timer
}
}
}
#[idle]
#[idle]
...
@@ -65,9 +80,8 @@ const APP: () = {
...
@@ -65,9 +80,8 @@ const APP: () = {
}
}
}
}
#[task(
binds
=
TIM3,
priority
=
1
,
resources
=
[
MB1,MB2,MB4,MB5,DPIB1,DPIB2
,timer
]
)]
#[task(priority
=
1
,
resources
=
[
MB1,MB2,MB4,MB5,DPIB1,DPIB2
]
,
schedule
=
[
tick
])]
fn
tick
(
mut
cx
:
tick
::
Context
)
{
fn
tick
(
mut
cx
:
tick
::
Context
)
{
cx
.resources.timer
.clear_interrupt
(
timer
::
Event
::
TimeOut
);
if
cx
.resources.MB1
.is_low
()
.unwrap
()
{
if
cx
.resources.MB1
.is_low
()
.unwrap
()
{
rprintln!
(
"MB1"
);
rprintln!
(
"MB1"
);
}
}
...
@@ -86,7 +100,11 @@ const APP: () = {
...
@@ -86,7 +100,11 @@ const APP: () = {
if
cx
.resources.DPIB2
.is_low
()
.unwrap
()
{
if
cx
.resources.DPIB2
.is_low
()
.unwrap
()
{
rprintln!
(
"DPIB2"
);
rprintln!
(
"DPIB2"
);
}
}
cx
.schedule
.tick
(
cx
.scheduled
+
OFFSET
.cycles
())
.unwrap
();
}
}
extern
"C"
{
fn
EXTI0
();
}
};
};
This diff is collapsed.
Click to expand it.
code/examples/rtt_rtic_usb_mouse.rs
+
11
−
0
View file @
f168e7f5
...
@@ -277,6 +277,16 @@ const APP: () = {
...
@@ -277,6 +277,16 @@ const APP: () = {
let
gpioc
=
device
.GPIOC
.split
();
let
gpioc
=
device
.GPIOC
.split
();
let
gpiob
=
device
.GPIOB
.split
();
let
gpiob
=
device
.GPIOB
.split
();
<<<<<<<
HEAD
let
mb2
=
gpioc
.pc6
.into_pull_up_input
();
let
mb1
=
gpioc
.pc7
.into_pull_up_input
();
let
mb5
=
gpiob
.pb15
.into_pull_up_input
();
let
mb4
=
gpiob
.pb14
.into_pull_up_input
();
let
dpib1
=
gpiob
.pb13
.into_pull_up_input
();
let
dpib2
=
gpiob
.pb12
.into_pull_up_input
();
=======
// Buttons
// Buttons
let
mb2
=
gpioc
.pc6
.into_pull_up_input
();
let
mb2
=
gpioc
.pc6
.into_pull_up_input
();
let
mb1
=
gpioc
.pc7
.into_pull_up_input
();
let
mb1
=
gpioc
.pc7
.into_pull_up_input
();
...
@@ -306,6 +316,7 @@ const APP: () = {
...
@@ -306,6 +316,7 @@ const APP: () = {
// set in burst mode
// set in burst mode
pmw3389
.write_register
(
Register
::
MotionBurst
,
0x00
);
pmw3389
.write_register
(
Register
::
MotionBurst
,
0x00
);
>>>>>>>
3043
b359af07960fb4472e373824f552897ee4aa
// Pull the D+ pin down to send a RESET condition to the USB bus.
// Pull the D+ pin down to send a RESET condition to the USB bus.
let
mut
usb_dp
=
gpioa
.pa12
.into_push_pull_output
();
let
mut
usb_dp
=
gpioa
.pa12
.into_push_pull_output
();
...
...
...
...
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