Skip to content

Commit

Permalink
Remove remaining references to embedded-hal-02 for GPIO examples (#1392)
Browse files Browse the repository at this point in the history
  • Loading branch information
MabezDev authored Apr 4, 2024
1 parent 969f9a1 commit b8ca132
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 15 deletions.
4 changes: 4 additions & 0 deletions esp-hal/src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,11 +1166,13 @@ where
GpioPin { _mode: PhantomData }
}

/// Configures the pin into alternate mode one.
pub fn into_alternate_1(self) -> GpioPin<Alternate<AF1>, GPIONUM> {
self.init_output(AlternateFunction::Function1, false);
GpioPin { _mode: PhantomData }
}

/// Configures the pin into alternate mode two.
pub fn into_alternate_2(self) -> GpioPin<Alternate<AF2>, GPIONUM> {
self.init_output(AlternateFunction::Function2, false);
GpioPin { _mode: PhantomData }
Expand Down Expand Up @@ -1334,6 +1336,7 @@ where
Self: GpioProperties,
<Self as GpioProperties>::PinType: IsAnalogPin,
{
/// Configures the pin into a an [Analog] pin.
pub fn into_analog(self) -> GpioPin<Analog, GPIONUM> {
crate::soc::gpio::internal_into_analog(GPIONUM);

Expand Down Expand Up @@ -1377,6 +1380,7 @@ impl<MODE, TYPE> AnyPin<MODE, TYPE>
where
TYPE: PinType,
{
/// Degrade the pin to remove the pin number generics.
pub fn degrade(self) -> AnyPin<MODE> {
AnyPin {
inner: self.inner,
Expand Down
2 changes: 0 additions & 2 deletions examples/src/bin/blinky_erased_pins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
//! Additionally demonstrates passing GPIO to a function in a generic way.
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
//% FEATURES: embedded-hal-02

#![no_std]
#![no_main]

use embedded_hal_02::digital::v2::{InputPin, ToggleableOutputPin};
use esp_backtrace as _;
use esp_hal::{
clock::ClockControl,
Expand Down
3 changes: 1 addition & 2 deletions examples/src/bin/embassy_multicore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! signal set by the task running on the other core.
//% CHIPS: esp32 esp32s3
//% FEATURES: embassy embassy-executor-thread embassy-time-timg0 embassy-generic-timers embedded-hal-02
//% FEATURES: embassy embassy-executor-thread embassy-time-timg0 embassy-generic-timers

#![no_std]
#![no_main]
Expand All @@ -15,7 +15,6 @@ use core::ptr::addr_of_mut;
use embassy_executor::Spawner;
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, signal::Signal};
use embassy_time::{Duration, Ticker};
use embedded_hal_02::digital::v2::OutputPin;
use esp_backtrace as _;
use esp_hal::{
clock::ClockControl,
Expand Down
3 changes: 1 addition & 2 deletions examples/src/bin/embassy_multicore_interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! signal set by the task running on the other core.
//% CHIPS: esp32 esp32s3
//% FEATURES: embassy embassy-executor-interrupt embassy-time-timg0 embassy-generic-timers embedded-hal-02
//% FEATURES: embassy embassy-executor-interrupt embassy-time-timg0 embassy-generic-timers

#![no_std]
#![no_main]
Expand All @@ -14,7 +14,6 @@ use core::ptr::addr_of_mut;

use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, signal::Signal};
use embassy_time::{Duration, Ticker};
use embedded_hal_02::digital::v2::OutputPin;
use esp_backtrace as _;
use esp_hal::{
clock::ClockControl,
Expand Down
3 changes: 1 addition & 2 deletions examples/src/bin/embassy_rmt_rx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
//! Connect GPIO5 to GPIO4
//% CHIPS: esp32 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
//% FEATURES: async embassy embassy-executor-thread embassy-time-timg0 embassy-generic-timers embedded-hal-02
//% FEATURES: async embassy embassy-executor-thread embassy-time-timg0 embassy-generic-timers

#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]

use embassy_executor::Spawner;
use embassy_time::{Duration, Timer};
use embedded_hal_02::digital::v2::ToggleableOutputPin;
use esp_backtrace as _;
use esp_hal::{
clock::ClockControl,
Expand Down
1 change: 0 additions & 1 deletion examples/src/bin/embassy_wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

use embassy_executor::Spawner;
use embassy_time::{Duration, Timer};
use embedded_hal_async::digital::Wait;
use esp_backtrace as _;
use esp_hal::{
clock::ClockControl,
Expand Down
2 changes: 0 additions & 2 deletions examples/src/bin/etm_gpio.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
//! Control LED on GPIO1 by the BOOT-BUTTON via ETM
//% CHIPS: esp32c6 esp32h2
//% FEATURES: embedded-hal-02

#![no_std]
#![no_main]

use embedded_hal_02::digital::v2::OutputPin;
use esp_backtrace as _;
use esp_hal::{
etm::Etm,
Expand Down
3 changes: 1 addition & 2 deletions examples/src/bin/serial_interrupts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ use esp_hal::{
clock::ClockControl,
delay::Delay,
gpio,
interrupt::{self, Priority},
peripherals::{Interrupt, Peripherals, UART0},
peripherals::{Peripherals, UART0},
prelude::*,
uart::{
config::{AtCmdConfig, Config},
Expand Down
2 changes: 0 additions & 2 deletions examples/src/bin/spi_slave_dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@
//! so no immediate neighbor is available.
//% CHIPS: esp32c2 esp32c3 esp32c6 esp32h2 esp32s3
//% FEATURES: embedded-hal-02

#![no_std]
#![no_main]

use embedded_hal_02::digital::v2::{InputPin, OutputPin};
use esp_backtrace as _;
use esp_hal::{
clock::ClockControl,
Expand Down

0 comments on commit b8ca132

Please sign in to comment.