Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more trait re-exports to prelude module #260

Merged
merged 3 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 91 additions & 5 deletions esp-hal-common/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,52 @@ pub use fugit::{
};
pub use nb;

#[cfg(any(esp32c2, esp32c3))]
pub use crate::analog::SarAdcExt as _esp_hal_analog_SarAdcExt;
#[cfg(any(esp32, esp32s2, esp32s3))]
pub use crate::analog::SensExt as _esp_hal_analog_SensExt;
#[cfg(rmt)]
pub use crate::pulse_control::{
ConfiguredChannel as _esp_hal_pulse_control_ConfiguredChannel,
OutputChannel as _esp_hal_pulse_control_OutputChannel,
};
#[cfg(any(esp32, esp32s2))]
pub use crate::analog::SensExt;
pub use crate::{macros::*, system::SystemExt};
pub use crate::spi::dma::WithDmaSpi3 as _esp_hal_spi_dma_WithDmaSpi3;
pub use crate::{
clock::Clock as _esp_hal_clock_Clock,
dma::{
DmaTransfer as _esp_hal_dma_DmaTransfer,
DmaTransferRxTx as _esp_hal_dma_DmaTransferRxTx,
},
gpio::{
InputPin as _esp_hal_gpio_InputPin,
OutputPin as _esp_hal_gpio_OutputPin,
Pin as _esp_hal_gpio_Pin,
},
i2c::Instance as _esp_hal_i2c_Instance,
ledc::{
channel::{
ChannelHW as _esp_hal_ledc_channel_ChannelHW,
ChannelIFace as _esp_hal_ledc_channel_ChannelIFace,
},
timer::{
TimerHW as _esp_hal_ledc_timer_TimerHW,
TimerIFace as _esp_hal_ledc_timer_TimerIFace,
},
},
macros::*,
serial::{Instance as _esp_hal_serial_Instance, UartPins as _esp_hal_serial_UartPins},
spi::{
dma::WithDmaSpi2 as _esp_hal_spi_dma_WithDmaSpi2,
Instance as _esp_hal_spi_Instance,
InstanceDma as _esp_hal_spi_InstanceDma,
},
system::SystemExt as _esp_hal_system_SystemExt,
timer::{
Instance as _esp_hal_timer_Instance,
TimerGroupInstance as _esp_hal_timer_TimerGroupInstance,
},
};

/// All traits required for using the 1.0.0-alpha.x release of embedded-hal
#[cfg(feature = "eh1")]
Expand Down Expand Up @@ -55,7 +98,50 @@ pub mod eh1 {
};
pub use nb;

pub use crate::system::SystemExt;
#[cfg(any(esp32c2, esp32c3))]
pub use crate::analog::SarAdcExt as _esp_hal_analog_SarAdcExt;
#[cfg(any(esp32, esp32s2, esp32s3))]
pub use crate::analog::SensExt as _esp_hal_analog_SensExt;
#[cfg(rmt)]
pub use crate::pulse_control::{
ConfiguredChannel as _esp_hal_pulse_control_ConfiguredChannel,
OutputChannel as _esp_hal_pulse_control_OutputChannel,
};
#[cfg(any(esp32, esp32s2))]
pub use crate::spi::dma::WithDmaSpi3 as _esp_hal_spi_dma_WithDmaSpi3;
pub use crate::{
clock::Clock as _esp_hal_clock_Clock,
dma::{
DmaTransfer as _esp_hal_dma_DmaTransfer,
DmaTransferRxTx as _esp_hal_dma_DmaTransferRxTx,
},
gpio::{
InputPin as _esp_hal_gpio_InputPin,
OutputPin as _esp_hal_gpio_OutputPin,
Pin as _esp_hal_gpio_Pin,
},
i2c::Instance as _esp_hal_i2c_Instance,
ledc::{
channel::{
ChannelHW as _esp_hal_ledc_channel_ChannelHW,
ChannelIFace as _esp_hal_ledc_channel_ChannelIFace,
},
timer::{
TimerHW as _esp_hal_ledc_timer_TimerHW,
TimerIFace as _esp_hal_ledc_timer_TimerIFace,
},
},
macros::*,
serial::{Instance as _esp_hal_serial_Instance, UartPins as _esp_hal_serial_UartPins},
spi::{
dma::WithDmaSpi2 as _esp_hal_spi_dma_WithDmaSpi2,
Instance as _esp_hal_spi_Instance,
InstanceDma as _esp_hal_spi_InstanceDma,
},
system::SystemExt as _esp_hal_system_SystemExt,
timer::{
Instance as _esp_hal_timer_Instance,
TimerGroupInstance as _esp_hal_timer_TimerGroupInstance,
},
};
}

pub use crate::{macros::*, timer::Instance};
2 changes: 1 addition & 1 deletion esp32-hal/examples/gpio_interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use critical_section::Mutex;
use esp32_hal::{
clock::ClockControl,
gpio::{Gpio0, IO},
gpio_types::{Event, Input, Pin, PullDown},
gpio_types::{Event, Input, PullDown},
interrupt,
macros::ram,
pac::{self, Peripherals},
Expand Down
4 changes: 2 additions & 2 deletions esp32-hal/examples/spi_loopback_dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

use esp32_hal::{
clock::ClockControl,
dma::{DmaPriority, DmaTransferRxTx},
dma::{DmaPriority},
gpio::IO,
pac::Peripherals,
pdma::Dma,
prelude::*,
spi::{dma::WithDmaSpi2, Spi, SpiMode},
spi::{Spi, SpiMode},
timer::TimerGroup,
Delay,
Rtc,
Expand Down
1 change: 1 addition & 0 deletions esp32-hal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub use esp_hal_common::{
pulse_control,
serial,
spi,
system,
timer,
utils,
Cpu,
Expand Down
2 changes: 0 additions & 2 deletions esp32c2-hal/examples/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@

use esp32c2_hal::{
adc::{AdcConfig, Attenuation, ADC, ADC1},
analog::SarAdcExt,
clock::ClockControl,
gpio::IO,
pac::Peripherals,
prelude::*,
system::SystemExt,
timer::TimerGroup,
Delay,
Rtc,
Expand Down
1 change: 0 additions & 1 deletion esp32c2-hal/examples/blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use esp32c2_hal::{
gpio::IO,
pac::Peripherals,
prelude::*,
system::SystemExt,
timer::TimerGroup,
Delay,
Rtc,
Expand Down
2 changes: 1 addition & 1 deletion esp32c2-hal/examples/gpio_interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use critical_section::Mutex;
use esp32c2_hal::{
clock::ClockControl,
gpio::{Gpio9, IO},
gpio_types::{Event, Input, Pin, PullDown},
gpio_types::{Event, Input, PullDown},
interrupt,
pac::{self, Peripherals},
prelude::*,
Expand Down
4 changes: 2 additions & 2 deletions esp32c2-hal/examples/spi_loopback_dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

use esp32c2_hal::{
clock::ClockControl,
dma::{DmaPriority, DmaTransferRxTx},
dma::{DmaPriority},
gdma::Gdma,
gpio::IO,
pac::Peripherals,
prelude::*,
spi::{dma::WithDmaSpi2, Spi, SpiMode},
spi::{Spi, SpiMode},
timer::TimerGroup,
Delay,
Rtc,
Expand Down
2 changes: 0 additions & 2 deletions esp32c3-hal/examples/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@

use esp32c3_hal::{
adc::{AdcConfig, Attenuation, ADC, ADC1},
analog::SarAdcExt,
clock::ClockControl,
gpio::IO,
pac::Peripherals,
prelude::*,
system::SystemExt,
timer::TimerGroup,
Delay,
Rtc,
Expand Down
1 change: 0 additions & 1 deletion esp32c3-hal/examples/blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use esp32c3_hal::{
gpio::IO,
pac::Peripherals,
prelude::*,
system::SystemExt,
timer::TimerGroup,
Delay,
Rtc,
Expand Down
2 changes: 1 addition & 1 deletion esp32c3-hal/examples/gpio_interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use critical_section::Mutex;
use esp32c3_hal::{
clock::ClockControl,
gpio::{Gpio9, IO},
gpio_types::{Event, Input, Pin, PullDown},
gpio_types::{Event, Input, PullDown},
interrupt,
pac::{self, Peripherals},
prelude::*,
Expand Down
1 change: 0 additions & 1 deletion esp32c3-hal/examples/pulse_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use esp32c3_hal::{
pac::Peripherals,
prelude::*,
pulse_control::{ClockSource, ConfiguredChannel, OutputChannel, PulseCode, RepeatMode},
system::SystemExt,
timer::TimerGroup,
PulseControl,
Rtc,
Expand Down
4 changes: 2 additions & 2 deletions esp32c3-hal/examples/spi_loopback_dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

use esp32c3_hal::{
clock::ClockControl,
dma::{DmaPriority, DmaTransferRxTx},
dma::{DmaPriority},
gdma::Gdma,
gpio::IO,
pac::Peripherals,
prelude::*,
spi::{dma::WithDmaSpi2, Spi, SpiMode},
spi::{Spi, SpiMode},
timer::TimerGroup,
Delay,
Rtc,
Expand Down
2 changes: 1 addition & 1 deletion esp32s2-hal/examples/gpio_interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use critical_section::Mutex;
use esp32s2_hal::{
clock::ClockControl,
gpio::{Gpio0, IO},
gpio_types::{Event, Input, Pin, PullDown},
gpio_types::{Event, Input, PullDown},
interrupt,
macros::ram,
pac::{self, Peripherals},
Expand Down
4 changes: 2 additions & 2 deletions esp32s2-hal/examples/spi_loopback_dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

use esp32s2_hal::{
clock::ClockControl,
dma::{DmaPriority, DmaTransferRxTx},
dma::{DmaPriority},
gpio::IO,
pac::Peripherals,
pdma::Dma,
prelude::*,
spi::{dma::WithDmaSpi2, Spi, SpiMode},
spi::{Spi, SpiMode},
timer::TimerGroup,
Delay,
Rtc,
Expand Down
1 change: 1 addition & 0 deletions esp32s2-hal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub use esp_hal_common::{
pulse_control,
serial,
spi,
system,
systimer,
timer,
utils,
Expand Down
1 change: 0 additions & 1 deletion esp32s3-hal/examples/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

use esp32s3_hal::{
adc::{AdcConfig, Attenuation, ADC, ADC1},
analog::SensExt,
clock::ClockControl,
gpio::IO,
pac::Peripherals,
Expand Down
2 changes: 1 addition & 1 deletion esp32s3-hal/examples/gpio_interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use critical_section::Mutex;
use esp32s3_hal::{
clock::ClockControl,
gpio::{Gpio0, IO},
gpio_types::{Event, Input, Pin, PullDown},
gpio_types::{Event, Input, PullDown},
interrupt,
macros::ram,
pac::{self, Peripherals},
Expand Down
4 changes: 2 additions & 2 deletions esp32s3-hal/examples/spi_loopback_dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

use esp32s3_hal::{
clock::ClockControl,
dma::{DmaPriority, DmaTransferRxTx},
dma::{DmaPriority},
gdma::Gdma,
gpio::IO,
pac::Peripherals,
prelude::*,
spi::{dma::WithDmaSpi2, Spi, SpiMode},
spi::{Spi, SpiMode},
timer::TimerGroup,
Delay,
Rtc,
Expand Down
2 changes: 1 addition & 1 deletion esp32s3-hal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ pub use esp_hal_common::{
pulse_control,
serial,
spi,
system,
systimer,
timer,
usb_serial_jtag,
utils,
Cpu,
Delay,
Expand Down