Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DC motor driver hat
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
Container 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
Software
DC motor driver hat
Commits
2799ea8e
Commit
2799ea8e
authored
1 year ago
by
Samuel Tardieu
Browse files
Options
Downloads
Patches
Plain Diff
Set correct direction for left motor
parent
d0d5e68e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tb6612fng.rs
+7
-2
7 additions, 2 deletions
src/tb6612fng.rs
with
7 additions
and
2 deletions
src/tb6612fng.rs
+
7
−
2
View file @
2799ea8e
...
...
@@ -91,14 +91,19 @@ impl Tb6612fng {
self
.standby
.set_high
();
}
pub
fn
move_
lef
t
(
&
mut
self
,
value
:
Movement
)
{
pub
fn
move_
righ
t
(
&
mut
self
,
value
:
Movement
)
{
let
(
i1
,
i2
,
duty
)
=
value
.into_command
();
self
.a1
.set_state
(
i1
);
self
.a2
.set_state
(
i2
);
self
.pwm
.set_duty
(
Channel
::
C3
,
duty
);
}
pub
fn
move_right
(
&
mut
self
,
value
:
Movement
)
{
pub
fn
move_left
(
&
mut
self
,
value
:
Movement
)
{
let
value
=
if
let
Movement
::
Advance
(
v
)
=
value
{
Movement
::
Advance
(
-
v
)
}
else
{
value
};
let
(
i1
,
i2
,
duty
)
=
value
.into_command
();
self
.b1
.set_state
(
i1
);
self
.b2
.set_state
(
i2
);
...
...
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