Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Core
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
Model registry
Operate
Environments
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
OwnTech
Power API
Core
Commits
21b5fbbe
Commit
21b5fbbe
authored
2 years ago
by
Clément Foucher
Browse files
Options
Downloads
Patches
Plain Diff
Include readPin function to GPIO API.
parent
74974de7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
zephyr/modules/owntech_gpio_api/zephyr/public_api/GpioApi.cpp
+12
-0
12 additions, 0 deletions
...yr/modules/owntech_gpio_api/zephyr/public_api/GpioApi.cpp
zephyr/modules/owntech_gpio_api/zephyr/public_api/GpioApi.h
+1
-0
1 addition, 0 deletions
zephyr/modules/owntech_gpio_api/zephyr/public_api/GpioApi.h
with
13 additions
and
0 deletions
zephyr/modules/owntech_gpio_api/zephyr/public_api/GpioApi.cpp
+
12
−
0
View file @
21b5fbbe
...
...
@@ -84,6 +84,18 @@ void GpioApi::writePin(pin_t pin, uint8_t value)
}
}
uint8_t
GpioApi
::
readPin
(
pin_t
pin
)
{
gpio_pin_t
pin_number
=
this
->
getPinNumber
(
pin
);
const
struct
device
*
port
=
this
->
getGpioDevice
(
pin
);
if
(
port
!=
nullptr
)
{
return
(
uint8_t
)
gpio_pin_get
(
port
,
pin_number
);
}
return
0
;
}
gpio_pin_t
GpioApi
::
getPinNumber
(
pin_t
pin
)
{
return
(((
uint8_t
)
pin
)
&
0x0F
)
+
1
;
...
...
This diff is collapsed.
Click to expand it.
zephyr/modules/owntech_gpio_api/zephyr/public_api/GpioApi.h
+
1
−
0
View file @
21b5fbbe
...
...
@@ -123,6 +123,7 @@ public:
void
resetPin
(
pin_t
pin
);
void
togglePin
(
pin_t
pin
);
void
writePin
(
pin_t
pin
,
uint8_t
value
);
uint8_t
readPin
(
pin_t
pin
);
private:
gpio_pin_t
getPinNumber
(
pin_t
pin
);
...
...
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