-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pw_gpio: Add new module and interfaces
NOTE: this module will be renamed `pw_digital_io` immediately in a follow-up change. The Digital IO interface represents individual GPIO lines that support some combination of input, output, and/or interrupt functionality. The choice of supported capability, and most other configuration details are left up to the backend implementation. Change-Id: I27437464ff918592e69a0bdbcbe005c68f2e9ef5 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/94100 Reviewed-by: Ewout van Bekkum <[email protected]> Reviewed-by: Wyatt Hepler <[email protected]> Commit-Queue: Anton Markov <[email protected]>
- Loading branch information
Showing
13 changed files
with
1,385 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ pw_env_setup | |
pw_file | ||
pw_function | ||
pw_fuzzer | ||
pw_gpio | ||
pw_hdlc | ||
pw_hex_dump | ||
pw_i2c | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright 2020 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
load( | ||
"//pw_build:pigweed.bzl", | ||
"pw_cc_library", | ||
"pw_cc_test", | ||
) | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
licenses(["notice"]) | ||
|
||
pw_cc_library( | ||
name = "pw_gpio", | ||
srcs = ["gpio.cc"], | ||
hdrs = [ | ||
"public/pw_gpio/gpio.h", | ||
"public/pw_gpio/internal/conversions.h", | ||
], | ||
includes = ["public"], | ||
deps = [ | ||
"//pw_assert", | ||
"//pw_function", | ||
"//pw_result", | ||
"//pw_status", | ||
], | ||
) | ||
|
||
pw_cc_test( | ||
name = "gpio_test", | ||
srcs = ["gpio_test.cc"], | ||
deps = [ | ||
":pw_gpio", | ||
"//pw_unit_test", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Copyright 2020 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
import("//build_overrides/pigweed.gni") | ||
|
||
import("$dir_pw_build/target_types.gni") | ||
import("$dir_pw_docgen/docs.gni") | ||
import("$dir_pw_toolchain/generate_toolchain.gni") | ||
import("$dir_pw_unit_test/test.gni") | ||
|
||
config("public_include_path") { | ||
include_dirs = [ "public" ] | ||
visibility = [ ":*" ] | ||
} | ||
|
||
pw_source_set("pw_gpio") { | ||
public_configs = [ ":public_include_path" ] | ||
public = [ | ||
"public/pw_gpio/gpio.h", | ||
"public/pw_gpio/internal/conversions.h", | ||
] | ||
sources = [ "gpio.cc" ] | ||
public_deps = [ | ||
dir_pw_assert, | ||
dir_pw_function, | ||
dir_pw_result, | ||
dir_pw_status, | ||
] | ||
} | ||
|
||
pw_doc_group("docs") { | ||
sources = [ "docs.rst" ] | ||
} | ||
|
||
pw_test_group("tests") { | ||
tests = [ ":gpio_test" ] | ||
} | ||
|
||
pw_test("gpio_test") { | ||
sources = [ "gpio_test.cc" ] | ||
deps = [ ":pw_gpio" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright 2020 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
include($ENV{PW_ROOT}/pw_build/pigweed.cmake) | ||
|
||
pw_add_module_library(pw_gpio | ||
HEADERS | ||
public/pw_gpio/gpio.h | ||
public/pw_gpio/internal/conversions.h | ||
PUBLIC_INCLUDES | ||
public | ||
SOURCES | ||
gpio.cc | ||
PUBLIC_DEPS | ||
pw_assert | ||
pw_function | ||
pw_result | ||
pw_status | ||
) | ||
if(Zephyr_FOUND AND CONFIG_PIGWEED_GPIO) | ||
zephyr_link_libraries(pw_gpio) | ||
endif() | ||
|
||
pw_add_test(pw_gpio.stream_test | ||
SOURCES | ||
gpio_test.cc | ||
DEPS | ||
pw_gpio | ||
GROUPS | ||
modules | ||
pw_gpio | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This directory contains the `pw` Digital IO Hardware Abstraction Layer (HAL). | ||
This HAL defines interfaces for working with Digital IO lines that provide | ||
different combinations of capabilities (input, output, and/or interrupts). | ||
Hardware specific backends provide implementations of these interfaces for | ||
different hardware platforms. | ||
|
||
Warning: This module is under construction and may not be ready for use. |
Oops, something went wrong.