Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pete
firmware
Commits
eed9ffda
Commit
eed9ffda
authored
5 years ago
by
rahix
Browse files
Options
Downloads
Plain Diff
Merge 'Port buttons module to new hwlock API'
Closes #189 See merge request
card10/firmware!363
parents
b46a9e7a
a8f4d358
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
epicardium/modules/buttons.c
+4
-8
4 additions, 8 deletions
epicardium/modules/buttons.c
with
4 additions
and
8 deletions
epicardium/modules/buttons.c
+
4
−
8
View file @
eed9ffda
...
...
@@ -16,20 +16,15 @@ static const uint8_t pin_mask[] = {
uint8_t
epic_buttons_read
(
uint8_t
mask
)
{
uint8_t
ret
=
0
;
if
(
portexpander_detected
()
&&
(
mask
&
0x7
))
{
if
(
hwlock_acquire_timeout
(
HWLOCK_I2C
,
portMAX_DELAY
)
<
0
)
{
LOG_ERR
(
"buttons"
,
"Can't acquire I2C bus"
);
return
0
;
}
hwlock_acquire
(
HWLOCK_I2C
);
if
(
portexpander_detected
()
&&
(
mask
&
0x7
))
{
/*
* Not using PB_Get() here as that performs one I2C trans
c
ation
* Not using PB_Get() here as that performs one I2C transa
c
tion
* per button.
*/
uint8_t
pin_status
=
~
portexpander_in_get
(
0xFF
);
hwlock_release
(
HWLOCK_I2C
);
for
(
uint8_t
m
=
1
;
m
<
0x8
;
m
<<=
1
)
{
if
(
mask
&
m
&&
pin_status
&
pin_mask
[
m
])
{
ret
|=
m
;
...
...
@@ -41,5 +36,6 @@ uint8_t epic_buttons_read(uint8_t mask)
ret
|=
BUTTON_RESET
;
}
hwlock_release
(
HWLOCK_I2C
);
return
ret
;
}
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