Switch to upstream pw_digital_io_rp2040
Bug: b/303255049
Change-Id: I7d3c58e90017911843aa60f2c9277dff842f8722
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/experimental/+/173650
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
Reviewed-by: Erik Gilling <konkers@google.com>
diff --git a/applications/app_common_impl/common_pico.cc b/applications/app_common_impl/common_pico.cc
index 1402f7b..ba29f9e 100644
--- a/applications/app_common_impl/common_pico.cc
+++ b/applications/app_common_impl/common_pico.cc
@@ -50,8 +50,8 @@
#endif
using pw::Status;
-using pw::digital_io::PicoDigitalIn;
-using pw::digital_io::PicoDigitalOut;
+using pw::digital_io::Rp2040DigitalIn;
+using pw::digital_io::Rp2040DigitalInOut;
using pw::display::Display;
using pw::framebuffer::Framebuffer;
using pw::framebuffer::PixelFormat;
@@ -106,14 +106,14 @@
.bit_order = pw::spi::BitOrder::kMsbFirst,
};
-PicoDigitalOut s_display_dc_pin(DISPLAY_DC_GPIO);
+Rp2040DigitalInOut s_display_dc_pin(DISPLAY_DC_GPIO);
#if DISPLAY_RESET_GPIO != -1
-PicoDigitalOut s_display_reset_pin(DISPLAY_RESET_GPIO);
+Rp2040DigitalInOut s_display_reset_pin(DISPLAY_RESET_GPIO);
#endif
#if DISPLAY_TE_GPIO != -1
-PicoDigitalIn s_display_tear_effect_pin(DISPLAY_TE_GPIO);
+Rp2040DigitalIn s_display_tear_effect_pin(DISPLAY_TE_GPIO);
#endif
-PicoDigitalOut s_display_cs_pin(DISPLAY_CS_GPIO);
+Rp2040DigitalInOut s_display_cs_pin(DISPLAY_CS_GPIO);
PicoChipSelector s_spi_chip_selector(s_display_cs_pin);
PicoInitiator s_spi_initiator(SPI_PORT);
VirtualMutex s_spi_initiator_mutex;
diff --git a/modules.gni b/modules.gni
index 2265a04..5b1977e 100644
--- a/modules.gni
+++ b/modules.gni
@@ -31,7 +31,6 @@
dir_pw_color = get_path_info("pw_graphics/pw_color", "abspath")
dir_pw_math = get_path_info("pw_graphics/pw_math", "abspath")
dir_pw_digital_io_arduino = get_path_info("pw_digital_io_arduino", "abspath")
- dir_pw_digital_io_rp2040 = get_path_info("pw_digital_io_rp2040", "abspath")
dir_pw_digital_io_stm32cube =
get_path_info("pw_digital_io_stm32cube", "abspath")
dir_pw_display = get_path_info("pw_graphics/pw_display", "abspath")
diff --git a/pw_digital_io_rp2040/BUILD.gn b/pw_digital_io_rp2040/BUILD.gn
deleted file mode 100644
index a316a03..0000000
--- a/pw_digital_io_rp2040/BUILD.gn
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright 2022 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/pi_pico.gni")
-import("//build_overrides/pigweed.gni")
-import("$dir_pw_build/target_types.gni")
-
-config("public_includes") {
- include_dirs = [ "public" ]
-}
-
-pw_source_set("pw_digital_io_rp2040") {
- public_configs = [ ":public_includes" ]
- public = [ "public/pw_digital_io_rp2040/digital_io.h" ]
- deps = [
- "$PICO_ROOT/src/common/pico_base",
- "$PICO_ROOT/src/common/pico_stdlib",
- ]
- public_deps = [
- "$dir_pw_digital_io",
- "$dir_pw_status",
- ]
- sources = [ "digital_io.cc" ]
- remove_configs = [ "$dir_pw_build:strict_warnings" ]
-}
diff --git a/pw_digital_io_rp2040/digital_io.cc b/pw_digital_io_rp2040/digital_io.cc
deleted file mode 100644
index 000adf4..0000000
--- a/pw_digital_io_rp2040/digital_io.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2022 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 "pw_digital_io_rp2040/digital_io.h"
-
-#include "hardware/gpio.h"
-#include "pico/stdlib.h"
-#include "pw_status/status.h"
-
-namespace pw::digital_io {
-
-PicoDigitalIn::PicoDigitalIn(uint32_t pin) : pin_(pin) {}
-
-// pw::digital_io::DigitalIn implementation:
-Status PicoDigitalIn::DoEnable(bool enable) {
- if (!enable) {
- // Added later: https://github.com/raspberrypi/pico-sdk/issues/792
- // which first appeared in Pico SDK 1.3.0.
- // Cannot find a way to check Pico SDK version at compile time.
- // gpio_deinit(pin_);
- return Status::Unavailable();
- }
-
- gpio_init(pin_);
- gpio_set_dir(pin_, GPIO_IN);
- return OkStatus();
-}
-
-Result<State> PicoDigitalIn::DoGetState() {
- const pw::Result<State> result(State(gpio_get(pin_)));
- return result;
-}
-
-// pw::digital_io::DigitalOut implementation:
-PicoDigitalOut::PicoDigitalOut(uint32_t pin) : pin_(pin) {}
-
-Status PicoDigitalOut::DoEnable(bool enable) {
- if (!enable) {
- // Added later: https://github.com/raspberrypi/pico-sdk/issues/792
- // which first appeared in Pico SDK 1.3.0.
- // Cannot find a way to check Pico SDK version at compile time.
- // gpio_deinit(pin_);
- return Status::Unavailable();
- }
-
- gpio_init(pin_);
- gpio_set_dir(pin_, GPIO_OUT);
- return OkStatus();
-}
-
-Status PicoDigitalOut::DoSetState(State level) {
- gpio_put(pin_, level == State::kActive);
- return OkStatus();
-}
-
-} // namespace pw::digital_io
diff --git a/pw_digital_io_rp2040/public/pw_digital_io_rp2040/digital_io.h b/pw_digital_io_rp2040/public/pw_digital_io_rp2040/digital_io.h
deleted file mode 100644
index b04386c..0000000
--- a/pw_digital_io_rp2040/public/pw_digital_io_rp2040/digital_io.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2022 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.
-
-#pragma once
-
-#include <cstdint>
-
-#include "pw_digital_io/digital_io.h"
-
-namespace pw::digital_io {
-
-class PicoDigitalOut : public DigitalOut {
- public:
- PicoDigitalOut(uint32_t pin);
-
- // pw::digital_io::DigitalOut implementation:
- Status DoEnable(bool enable) override;
- Status DoSetState(State level) override;
-
- private:
- uint32_t pin_;
-};
-
-class PicoDigitalIn : public DigitalIn {
- public:
- PicoDigitalIn(uint32_t pin);
-
- // pw::digital_io::DigitalIn implementation:
- Status DoEnable(bool enable) override;
- Result<State> DoGetState() override;
-
- private:
- uint32_t pin_;
-};
-
-} // namespace pw::digital_io
diff --git a/third_party/pigweed b/third_party/pigweed
index 7bffcc0..77e861a 160000
--- a/third_party/pigweed
+++ b/third_party/pigweed
@@ -1 +1 @@
-Subproject commit 7bffcc0fce846849e04ad6f58a7e84fd287f94d4
+Subproject commit 77e861a611c7afa377646c2961e8021130eae101