Skip to content

Commit

Permalink
Changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Sep 9, 2024
1 parent c434e16 commit 48f414b
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 67 deletions.
3 changes: 3 additions & 0 deletions esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Previously unavailable memory is available via `.dram2_uninit` section (#2079)
- You can now use `Input`, `Output`, `OutputOpenDrain` and `Flex` pins as EXTI and RTCIO wakeup sources (#2095)
- Added `Rtc::set_current_time` to allow setting RTC time, and `Rtc::current_time` to getting RTC time while taking into account boot time (#1883)
- Added APIs to allow connecting signals through the GPIO matrix. (#?)

### Changed

Expand All @@ -36,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The (previously undocumented) `ErasedPin` enum has been replaced with the `ErasedPin` struct. (#2094)
- Renamed and merged `Rtc::get_time_us` and `Rtc::get_time_ms` into `Rtc::time_since_boot` (#1883)
- ESP32: Added support for touch sensing on GPIO32 and 33 (#2109)
- Renamed `ErasedPin` to `AnyPin` (#?)

### Fixed

Expand All @@ -54,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed `AnyInputOnlyPin` in favour of `AnyPin`. (#2071)
- Removed the following functions from `GpioPin`: `is_high`, `is_low`, `set_high`, `set_low`, `set_state`, `is_set_high`, `is_set_low`, `toggle`. (#2094)
- Removed `Rtc::get_time_raw` (#1883)
- Removed `AnyPin` (#?)

## [0.20.1] - 2024-08-30

Expand Down
14 changes: 7 additions & 7 deletions esp-hal/src/gpio/interconnect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use crate::{
gpio::{
self,
AlternateFunction,
AnyPin,
DummyPin,
ErasedPin,
GpioPin,
GpioProperties,
InputPin,
Expand All @@ -26,7 +26,7 @@ use crate::{

/// Multiple input signal can be connected to one pin.
pub struct InputSignal {
pin: ErasedPin,
pin: AnyPin,
is_inverted: bool,
}

Expand All @@ -50,7 +50,7 @@ impl Peripheral for InputSignal {
impl Sealed for InputSignal {}

impl InputSignal {
pub(crate) fn new(pin: ErasedPin) -> Self {
pub(crate) fn new(pin: AnyPin) -> Self {
Self {
pin,
is_inverted: false,
Expand Down Expand Up @@ -154,7 +154,7 @@ impl PeripheralInputPin for InputSignal {

/// Multiple pins can be connected to one output signal.
pub struct OutputSignal {
pin: ErasedPin,
pin: AnyPin,
is_inverted: bool,
}

Expand All @@ -172,7 +172,7 @@ impl Peripheral for OutputSignal {
impl Sealed for OutputSignal {}

impl OutputSignal {
pub(crate) fn new(pin: ErasedPin) -> Self {
pub(crate) fn new(pin: AnyPin) -> Self {
Self {
is_inverted: false,
pin,
Expand Down Expand Up @@ -342,8 +342,8 @@ impl From<DummyPin> for AnyInputSignal {
}
}

impl From<ErasedPin> for AnyInputSignal {
fn from(input: ErasedPin) -> Self {
impl From<AnyPin> for AnyInputSignal {
fn from(input: AnyPin) -> Self {
Self(AnyInputSignalInner::Input(input.peripheral_input()))
}
}
Expand Down
2 changes: 1 addition & 1 deletion esp-hal/src/gpio/lp_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ macro_rules! lp_gpio {
($this:expr, $inner:ident, $code:tt) => {
match $this {
$(
ErasedPinInner::[<Gpio $gpionum >]($inner) => {
AnyPinInner::[<Gpio $gpionum >]($inner) => {
$code
},
)+
Expand Down
68 changes: 34 additions & 34 deletions esp-hal/src/gpio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,20 +257,20 @@ pub trait Pin: Sealed {
/// GPIO number
fn number(&self, _: private::Internal) -> u8;

/// Type-erase (degrade) this pin into an ErasedPin.
/// Type-erase (degrade) this pin into an AnyPin.
///
/// This converts pin singletons (`GpioPin<0>`, …), which are all different
/// types, into the same type. It is useful for creating arrays of pins,
/// or avoiding generics.
fn degrade(self) -> ErasedPin
fn degrade(self) -> AnyPin
where
Self: Sized,
{
self.degrade_internal(private::Internal)
}

#[doc(hidden)]
fn degrade_internal(&self, _: private::Internal) -> ErasedPin;
fn degrade_internal(&self, _: private::Internal) -> AnyPin;

/// Enable/disable sleep-mode
fn sleep_mode(&mut self, on: bool, _: private::Internal);
Expand Down Expand Up @@ -684,7 +684,7 @@ where
GPIONUM
}

fn degrade_internal(&self, _: private::Internal) -> ErasedPin {
fn degrade_internal(&self, _: private::Internal) -> AnyPin {
self.degrade_pin(private::Internal)
}

Expand Down Expand Up @@ -1006,7 +1006,7 @@ pub trait GpioProperties {
type IsAnalog: BooleanType;
type IsTouch: BooleanType;

fn degrade_pin(&self, _: private::Internal) -> ErasedPin;
fn degrade_pin(&self, _: private::Internal) -> AnyPin;
fn output_signals() -> [Option<OutputSignal>; 6];
fn input_signals() -> [Option<InputSignal>; 6];
}
Expand Down Expand Up @@ -1083,8 +1083,8 @@ macro_rules! gpio {
type InterruptStatus = $crate::gpio::[< InterruptStatusRegisterAccessBank $bank >];
$crate::pin_types!($type);

fn degrade_pin(&self, _: $crate::private::Internal) -> ErasedPin {
ErasedPin($crate::gpio::ErasedPinInner::[< Gpio $gpionum >](unsafe { Self::steal() }))
fn degrade_pin(&self, _: $crate::private::Internal) -> AnyPin {
AnyPin($crate::gpio::AnyPinInner::[< Gpio $gpionum >](unsafe { Self::steal() }))
}

fn output_signals() -> [Option<OutputSignal>; 6]{
Expand Down Expand Up @@ -1122,29 +1122,29 @@ macro_rules! gpio {
)+
}

pub(crate) enum ErasedPinInner {
pub(crate) enum AnyPinInner {
$(
[<Gpio $gpionum >](GpioPin<$gpionum>),
)+
}

/// Type-erased GPIO pin
pub struct ErasedPin(pub(crate) ErasedPinInner);
pub struct AnyPin(pub(crate) AnyPinInner);

impl ErasedPin {
impl AnyPin {
pub(crate) unsafe fn clone_unchecked(&self) -> Self {
match self.0 {
$(ErasedPinInner::[<Gpio $gpionum >](_) => {
Self(ErasedPinInner::[< Gpio $gpionum >](unsafe { GpioPin::steal() }))
$(AnyPinInner::[<Gpio $gpionum >](_) => {
Self(AnyPinInner::[< Gpio $gpionum >](unsafe { GpioPin::steal() }))
})+
}
}
}

impl $crate::peripheral::Peripheral for ErasedPin {
type P = ErasedPin;
impl $crate::peripheral::Peripheral for AnyPin {
type P = AnyPin;
unsafe fn clone_unchecked(&mut self) -> Self {
ErasedPin::clone_unchecked(self)
AnyPin::clone_unchecked(self)
}
}

Expand All @@ -1156,7 +1156,7 @@ macro_rules! gpio {
($this:expr, $inner:ident, $code:tt) => {
match $this {
$(
ErasedPinInner::[<Gpio $gpionum >]($inner) => if_output_pin!($type, {
AnyPinInner::[<Gpio $gpionum >]($inner) => if_output_pin!($type, {
$code
} else {{
let _ = $inner;
Expand All @@ -1173,7 +1173,7 @@ macro_rules! gpio {
($this:expr, $inner:ident, $code:tt) => {
match $this {
$(
ErasedPinInner::[<Gpio $gpionum >]($inner) => $code
AnyPinInner::[<Gpio $gpionum >]($inner) => $code
)+
}
}
Expand Down Expand Up @@ -1263,7 +1263,7 @@ macro_rules! rtc_pins {
($this:expr, $inner:ident, $code:tt) => {
match $this {
$(
paste::paste! { ErasedPinInner::[<Gpio $pin_num >]($inner) } => {
paste::paste! { AnyPinInner::[<Gpio $pin_num >]($inner) } => {
$code
},
)+
Expand All @@ -1281,7 +1281,7 @@ macro_rules! rtc_pins {
match $this {
$(
$(
paste::paste! { ErasedPinInner::[<Gpio $pin_num >]($inner) } => {
paste::paste! { AnyPinInner::[<Gpio $pin_num >]($inner) } => {
// FIXME: replace with $(ignore($rue)) once stable
handle_rtcio_with_resistors!(@ignore $rue, $rde);
$code
Expand Down Expand Up @@ -1353,7 +1353,7 @@ macro_rules! rtc_pins {
($this:expr, $inner:ident, $code:tt) => {
match $this {
$(
paste::paste! { ErasedPinInner::[<Gpio $pin_num >]($inner) } => {
paste::paste! { AnyPinInner::[<Gpio $pin_num >]($inner) } => {
$code
},
)+
Expand Down Expand Up @@ -1583,7 +1583,7 @@ macro_rules! touch {
}

/// GPIO output driver.
pub struct Output<'d, P = ErasedPin> {
pub struct Output<'d, P = AnyPin> {
pin: Flex<'d, P>,
}

Expand Down Expand Up @@ -1683,7 +1683,7 @@ where
}

/// GPIO input driver.
pub struct Input<'d, P = ErasedPin> {
pub struct Input<'d, P = AnyPin> {
pin: Flex<'d, P>,
}

Expand Down Expand Up @@ -1784,7 +1784,7 @@ where
}

/// GPIO open-drain output driver.
pub struct OutputOpenDrain<'d, P = ErasedPin> {
pub struct OutputOpenDrain<'d, P = AnyPin> {
pin: Flex<'d, P>,
}

Expand Down Expand Up @@ -1919,7 +1919,7 @@ where
}

/// Flexible pin driver.
pub struct Flex<'d, P = ErasedPin> {
pub struct Flex<'d, P = AnyPin> {
pin: PeripheralRef<'d, P>,
}

Expand Down Expand Up @@ -2104,9 +2104,9 @@ where
pub(crate) mod internal {
use super::*;

impl private::Sealed for ErasedPin {}
impl private::Sealed for AnyPin {}

impl ErasedPin {
impl AnyPin {
/// Turns the pin object into a peripheral output.
#[inline]
pub fn peripheral_input(self) -> interconnect::InputSignal {
Expand All @@ -2120,12 +2120,12 @@ pub(crate) mod internal {
}
}

impl Pin for ErasedPin {
impl Pin for AnyPin {
fn number(&self, _: private::Internal) -> u8 {
handle_gpio_input!(&self.0, target, { Pin::number(target, private::Internal) })
}

fn degrade_internal(&self, _: private::Internal) -> ErasedPin {
fn degrade_internal(&self, _: private::Internal) -> AnyPin {
unsafe { self.clone_unchecked() }
}

Expand All @@ -2142,7 +2142,7 @@ pub(crate) mod internal {
}
}

impl PeripheralInputPin for ErasedPin {
impl PeripheralInputPin for AnyPin {
fn init_input(&self, pull_down: bool, pull_up: bool, _: private::Internal) {
handle_gpio_input!(&self.0, target, {
PeripheralInputPin::init_input(target, pull_down, pull_up, private::Internal)
Expand Down Expand Up @@ -2190,7 +2190,7 @@ pub(crate) mod internal {
}
}

impl InputPin for ErasedPin {
impl InputPin for AnyPin {
fn listen_with_options(
&mut self,
event: Event,
Expand Down Expand Up @@ -2236,7 +2236,7 @@ pub(crate) mod internal {
}
}

impl PeripheralOutputPin for ErasedPin {
impl PeripheralOutputPin for AnyPin {
fn set_to_open_drain_output(&mut self, _: private::Internal) {
handle_gpio_output!(&mut self.0, target, {
PeripheralOutputPin::set_to_open_drain_output(target, private::Internal)
Expand Down Expand Up @@ -2336,10 +2336,10 @@ pub(crate) mod internal {
}
}

impl OutputPin for ErasedPin {}
impl OutputPin for AnyPin {}

#[cfg(any(xtensa, esp32c2, esp32c3, esp32c6))]
impl RtcPin for ErasedPin {
impl RtcPin for AnyPin {
#[cfg(xtensa)]
#[allow(unused_braces)] // False positive :/
fn rtc_number(&self) -> u8 {
Expand Down Expand Up @@ -2368,7 +2368,7 @@ pub(crate) mod internal {
}

#[cfg(any(esp32c2, esp32c3, esp32c6, xtensa))]
impl RtcPinWithResistors for ErasedPin {
impl RtcPinWithResistors for AnyPin {
fn rtcio_pullup(&mut self, enable: bool) {
handle_rtcio_with_resistors!(&mut self.0, target, {
RtcPinWithResistors::rtcio_pullup(target, enable)
Expand Down
4 changes: 2 additions & 2 deletions esp-hal/src/peripheral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use core::{
/// dedicated struct is memory efficiency:
///
/// Peripheral singletons are typically either zero-sized (for concrete
/// peripherals like `PA9` or `Spi4`) or very small (for example `ErasedPin`
/// peripherals like `PA9` or `Spi4`) or very small (for example `AnyPin`
/// which is 1 byte). However `&mut T` is always 4 bytes for 32-bit targets,
/// even if T is zero-sized. PeripheralRef stores a copy of `T` instead, so it's
/// the same size.
Expand Down Expand Up @@ -93,7 +93,7 @@ impl<'a, T> PeripheralRef<'a, T> {
/// using an `Into` impl to convert from `T` to `U`.
///
/// For example, this can be useful to degrade GPIO pins: converting from
/// PeripheralRef<'a, PB11>` to `PeripheralRef<'a, ErasedPin>`.
/// PeripheralRef<'a, PB11>` to `PeripheralRef<'a, AnyPin>`.
#[inline]
pub fn map_into<U>(self) -> PeripheralRef<'a, U>
where
Expand Down
6 changes: 4 additions & 2 deletions esp-wifi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `have-strchr` feature to disable including `strchr` (#2096)

### Changed

- esp-wifi now allocates memory from the global allocator provided by `esp-alloc` (#2099)

### Fixed

- Feature `wifi-logs` doesn't break the build anymore (#2117)

### Removed

- Removed the `clocks` parameter from `esp_wifi::initialize` (#1999)

## 0.9.1 - 2024-09-03

### Added
Expand All @@ -43,8 +47,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

- Removed the `clocks` parameter from `esp_wifi::initialize` (#1999)

## 0.8.0 - 2024-08-29

### Added
Expand Down
Loading

0 comments on commit 48f414b

Please sign in to comment.